listWhatsAppTemplateLibrary method

Future<ListWhatsAppTemplateLibraryOutput> listWhatsAppTemplateLibrary({
  1. required String id,
  2. Map<String, String>? filters,
  3. int? maxResults,
  4. String? nextToken,
})

Lists templates available in Meta's template library for WhatsApp messaging.

May throw AccessDeniedByMetaException. May throw DependencyException. May throw InternalServiceException. May throw InvalidParametersException. May throw ResourceNotFoundException. May throw ThrottledRequestException.

Parameter id : The ID of the WhatsApp Business Account to list library templates for.

Parameter filters : Map of filters to apply (searchKey, topic, usecase, industry, language).

Parameter maxResults : The maximum number of results to return per page (1-100).

Parameter nextToken : The token for the next page of results.

Implementation

Future<ListWhatsAppTemplateLibraryOutput> listWhatsAppTemplateLibrary({
  required String id,
  Map<String, String>? filters,
  int? maxResults,
  String? nextToken,
}) async {
  _s.validateNumRange(
    'maxResults',
    maxResults,
    1,
    100,
  );
  final $query = <String, List<String>>{
    'id': [id],
  };
  final $payload = <String, dynamic>{
    if (filters != null) 'filters': filters,
    if (maxResults != null) 'maxResults': maxResults,
    if (nextToken != null) 'nextToken': nextToken,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/v1/whatsapp/template/library',
    queryParams: $query,
    exceptionFnMap: _exceptionFns,
  );
  return ListWhatsAppTemplateLibraryOutput.fromJson(response);
}