getTemplateListWithHttpInfo method

Future<Response> getTemplateListWithHttpInfo(
  1. String templateType, {
  2. bool? paginated,
  3. int? limit,
  4. int? offset,
})

List all templates

Returns a list of all templates. The templates are returned sorted by position.

Note: This method returns the HTTP Response.

Parameters:

  • String templateType (required): The type of templates to list (email or SMS)

  • bool paginated: Whether to paginate the results. If true, the results will be paginated. If false, the results will not be paginated.

  • int limit: Applies a limit to the number of results returned. Can be used for paginating the results together with offset.

  • int offset: Skip the first offset results when paginating. Needs to be an integer greater or equal to zero. To be used in conjunction with limit.

Implementation

Future<http.Response> getTemplateListWithHttpInfo(
  String templateType, {
  bool? paginated,
  int? limit,
  int? offset,
}) async {
  // ignore: prefer_const_declarations
  final path = r'/templates/{template_type}'
      .replaceAll('{template_type}', templateType);

  // ignore: prefer_final_locals
  Object? postBody;

  final queryParams = <QueryParam>[];
  final headerParams = <String, String>{};
  final formParams = <String, String>{};

  if (paginated != null) {
    queryParams.addAll(_queryParams('', 'paginated', paginated));
  }
  if (limit != null) {
    queryParams.addAll(_queryParams('', 'limit', limit));
  }
  if (offset != null) {
    queryParams.addAll(_queryParams('', 'offset', offset));
  }

  const contentTypes = <String>[];

  return apiClient.invokeAPI(
    path,
    'GET',
    queryParams,
    postBody,
    headerParams,
    formParams,
    contentTypes.isEmpty ? null : contentTypes.first,
  );
}