createSegmentDefinition method
Creates a segment definition associated to the given domain.
May throw AccessDeniedException.
May throw BadRequestException.
May throw InternalServerException.
May throw ResourceNotFoundException.
May throw ThrottlingException.
Parameter displayName :
The display name of the segment definition.
Parameter domainName :
The unique name of the domain.
Parameter segmentDefinitionName :
The unique name of the segment definition.
Parameter description :
The description of the segment definition.
Parameter segmentGroups :
Specifies the base segments and dimensions for a segment definition along
with their respective relationship.
Parameter segmentSort :
The segment sort.
Parameter segmentSqlQuery :
The segment SQL query.
Parameter tags :
The tags used to organize, track, or control access for this resource.
Implementation
Future<CreateSegmentDefinitionResponse> createSegmentDefinition({
required String displayName,
required String domainName,
required String segmentDefinitionName,
String? description,
SegmentGroup? segmentGroups,
SegmentSort? segmentSort,
String? segmentSqlQuery,
Map<String, String>? tags,
}) async {
final $payload = <String, dynamic>{
'DisplayName': displayName,
if (description != null) 'Description': description,
if (segmentGroups != null) 'SegmentGroups': segmentGroups,
if (segmentSort != null) 'SegmentSort': segmentSort,
if (segmentSqlQuery != null) 'SegmentSqlQuery': segmentSqlQuery,
if (tags != null) 'Tags': tags,
};
final response = await _protocol.send(
payload: $payload,
method: 'POST',
requestUri:
'/domains/${Uri.encodeComponent(domainName)}/segment-definitions/${Uri.encodeComponent(segmentDefinitionName)}',
exceptionFnMap: _exceptionFns,
);
return CreateSegmentDefinitionResponse.fromJson(response);
}