createTerms method
Creates terms documents for the requested app client. When Terms and conditions and Privacy policy documents are configured, the app client displays links to them in the sign-up page of managed login for the app client.
You can provide URLs for terms documents in the languages that are
supported by managed
login localization. Amazon Cognito directs users to the terms
documents for their current language, with fallback to
default if no document exists for the language.
Each request accepts one type of terms document and a map of language-to-link for that document type. You must provide both types of terms documents in at least one language before Amazon Cognito displays your terms documents. Supply each type in separate requests.
For more information, see Terms documents.
Learn more
- Signing Amazon Web Services API Requests
- Using the Amazon Cognito user pools API and user pool endpoints
May throw ConcurrentModificationException.
May throw InternalErrorException.
May throw InvalidParameterException.
May throw LimitExceededException.
May throw NotAuthorizedException.
May throw OperationNotEnabledException.
May throw ResourceNotFoundException.
May throw TermsExistsException.
May throw TooManyRequestsException.
Parameter clientId :
The ID of the app client where you want to create terms documents. Must be
an app client in the requested user pool.
Parameter enforcement :
This parameter is reserved for future use and currently accepts only one
value.
Parameter termsName :
A friendly name for the document that you want to create in the current
request. Must begin with terms-of-use or
privacy-policy as identification of the document type.
Provide URLs for both terms-of-use and
privacy-policy in separate requests.
Parameter termsSource :
This parameter is reserved for future use and currently accepts only one
value.
Parameter userPoolId :
The ID of the user pool where you want to create terms documents.
Parameter links :
A map of URLs to languages. For each localized language that will view the
requested TermsName, assign a URL. A selection of
cognito:default displays for all languages that don't have a
language-specific URL.
For example, "cognito:default": "https://terms.example.com",
"cognito:spanish": "https://terms.example.com/es".
Implementation
Future<CreateTermsResponse> createTerms({
required String clientId,
required TermsEnforcementType enforcement,
required String termsName,
required TermsSourceType termsSource,
required String userPoolId,
Map<String, String>? links,
}) async {
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.1',
'X-Amz-Target': 'AWSCognitoIdentityProviderService.CreateTerms'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'ClientId': clientId,
'Enforcement': enforcement.value,
'TermsName': termsName,
'TermsSource': termsSource.value,
'UserPoolId': userPoolId,
if (links != null) 'Links': links,
},
);
return CreateTermsResponse.fromJson(jsonResponse.body);
}