updateSegment method

Future<UpdateSegmentResponse> updateSegment({
  1. required String applicationId,
  2. required String segmentId,
  3. required WriteSegmentRequest writeSegmentRequest,
})

Creates a new segment for an application or updates the configuration, dimension, and other settings for an existing segment that's associated with an application.

May throw BadRequestException. May throw InternalServerErrorException. May throw PayloadTooLargeException. May throw ForbiddenException. May throw NotFoundException. May throw MethodNotAllowedException. May throw TooManyRequestsException.

Parameter applicationId : The unique identifier for the application. This identifier is displayed as the Project ID on the Amazon Pinpoint console.

Parameter segmentId : The unique identifier for the segment.

Implementation

Future<UpdateSegmentResponse> updateSegment({
  required String applicationId,
  required String segmentId,
  required WriteSegmentRequest writeSegmentRequest,
}) async {
  ArgumentError.checkNotNull(applicationId, 'applicationId');
  ArgumentError.checkNotNull(segmentId, 'segmentId');
  ArgumentError.checkNotNull(writeSegmentRequest, 'writeSegmentRequest');
  final response = await _protocol.sendRaw(
    payload: writeSegmentRequest,
    method: 'PUT',
    requestUri:
        '/v1/apps/${Uri.encodeComponent(applicationId)}/segments/${Uri.encodeComponent(segmentId)}',
    exceptionFnMap: _exceptionFns,
  );
  final $json = await _s.jsonFromResponse(response);
  return UpdateSegmentResponse(
    segmentResponse: SegmentResponse.fromJson($json),
  );
}