getOutgoingWebhooks method

Future<List<MmOutgoingWebhook>?> getOutgoingWebhooks({
  1. int? page,
  2. int? perPage,
  3. String? teamId,
  4. String? channelId,
})

List outgoing webhooks

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

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.

  • String channelId: The ID of the channel to get hooks for.

Implementation

Future<List<MmOutgoingWebhook>?> getOutgoingWebhooks({
  int? page,
  int? perPage,
  String? teamId,
  String? channelId,
}) async {
  final response = await getOutgoingWebhooksWithHttpInfo(
    page: page,
    perPage: perPage,
    teamId: teamId,
    channelId: channelId,
  );
  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<MmOutgoingWebhook>') as List)
        .cast<MmOutgoingWebhook>()
        .toList();
  }
  return null;
}