getIncomingWebhooks method

Future<List<MmIncomingWebhook>?> getIncomingWebhooks({
  1. int? page,
  2. int? perPage,
  3. String? teamId,
})

List incoming webhooks

Get a page of a list of incoming webhooks. Optionally filter for a specific team using query parameters. ##### Permissions manage_webhooks for the system or manage_webhooks for the specific team.

Parameters:

  • int page: The page to select.

  • int perPage: The number of hooks per page.

  • String teamId: The ID of the team to get hooks for.

Implementation

Future<List<MmIncomingWebhook>?> getIncomingWebhooks({
  int? page,
  int? perPage,
  String? teamId,
}) async {
  final response = await getIncomingWebhooksWithHttpInfo(
    page: page,
    perPage: perPage,
    teamId: teamId,
  );
  if (response.statusCode >= HttpStatus.badRequest) {
    throw MmApiException(response.statusCode, await _decodeBodyBytes(response));
  }
  // When a remote server returns no body with a status of 204, we shall not decode it.
  // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  // FormatException when trying to decode an empty string.
  if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
    final responseBody = await _decodeBodyBytes(response);
    return (await apiClient.deserializeAsync(responseBody, 'List<MmIncomingWebhook>') as List)
        .cast<MmIncomingWebhook>()
        .toList();
  }
  return null;
}