createFilter method
Creates a recommendation filter. For more information, see Using Filters with Amazon Personalize.
May throw InvalidInputException. May throw ResourceAlreadyExistsException. May throw ResourceNotFoundException. May throw LimitExceededException.
Parameter datasetGroupArn :
The ARN of the dataset group that the filter will belong to.
Parameter filterExpression :
The filter expression that designates the interaction types that the
filter will filter out. A filter expression must follow the following
format:
EXCLUDE itemId WHERE INTERACTIONS.event_type in
("EVENT_TYPE")
Where "EVENT_TYPE" is the type of event to filter out. To filter out all
items with any interactions history, set "*" as the
EVENT_TYPE. For more information, see Using
Filters with Amazon Personalize.
Parameter name :
The name of the filter to create.
Implementation
Future<CreateFilterResponse> createFilter({
required String datasetGroupArn,
required String filterExpression,
required String name,
}) async {
ArgumentError.checkNotNull(datasetGroupArn, 'datasetGroupArn');
_s.validateStringLength(
'datasetGroupArn',
datasetGroupArn,
0,
256,
isRequired: true,
);
ArgumentError.checkNotNull(filterExpression, 'filterExpression');
_s.validateStringLength(
'filterExpression',
filterExpression,
1,
2500,
isRequired: true,
);
ArgumentError.checkNotNull(name, 'name');
_s.validateStringLength(
'name',
name,
1,
63,
isRequired: true,
);
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.1',
'X-Amz-Target': 'AmazonPersonalize.CreateFilter'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'datasetGroupArn': datasetGroupArn,
'filterExpression': filterExpression,
'name': name,
},
);
return CreateFilterResponse.fromJson(jsonResponse.body);
}