createWebhook method

Future<CreateWebhookResult> createWebhook({
  1. required String appId,
  2. required String branchName,
  3. String? description,
})

Creates a new webhook on an Amplify app.

May throw BadRequestException. May throw UnauthorizedException. May throw NotFoundException. May throw InternalFailureException. May throw LimitExceededException. May throw DependentServiceFailureException.

Parameter appId : The unique ID for an Amplify app.

Parameter branchName : The name for a branch that is part of an Amplify app.

Parameter description : The description for a webhook.

Implementation

Future<CreateWebhookResult> createWebhook({
  required String appId,
  required String branchName,
  String? description,
}) async {
  ArgumentError.checkNotNull(appId, 'appId');
  _s.validateStringLength(
    'appId',
    appId,
    1,
    20,
    isRequired: true,
  );
  ArgumentError.checkNotNull(branchName, 'branchName');
  _s.validateStringLength(
    'branchName',
    branchName,
    1,
    255,
    isRequired: true,
  );
  _s.validateStringLength(
    'description',
    description,
    0,
    1000,
  );
  final $payload = <String, dynamic>{
    'branchName': branchName,
    if (description != null) 'description': description,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/apps/${Uri.encodeComponent(appId)}/webhooks',
    exceptionFnMap: _exceptionFns,
  );
  return CreateWebhookResult.fromJson(response);
}