createCustomMetadata method
Adds one or more custom properties to the specified resource (a folder, document, or version).
May throw EntityNotExistsException. May throw UnauthorizedOperationException. May throw UnauthorizedResourceAccessException. May throw ProhibitedStateException. May throw CustomMetadataLimitExceededException. May throw FailedDependencyException. May throw ServiceUnavailableException.
Parameter customMetadata
:
Custom metadata in the form of name-value pairs.
Parameter resourceId
:
The ID of the resource.
Parameter authenticationToken
:
Amazon WorkDocs authentication token. Not required when using AWS
administrator credentials to access the API.
Parameter versionId
:
The ID of the version, if the custom metadata is being added to a document
version.
Implementation
Future<void> createCustomMetadata({
required Map<String, String> customMetadata,
required String resourceId,
String? authenticationToken,
String? versionId,
}) async {
ArgumentError.checkNotNull(customMetadata, 'customMetadata');
ArgumentError.checkNotNull(resourceId, 'resourceId');
_s.validateStringLength(
'resourceId',
resourceId,
1,
128,
isRequired: true,
);
_s.validateStringLength(
'authenticationToken',
authenticationToken,
1,
8199,
);
_s.validateStringLength(
'versionId',
versionId,
1,
128,
);
final headers = <String, String>{
if (authenticationToken != null)
'Authentication': authenticationToken.toString(),
};
final $query = <String, List<String>>{
if (versionId != null) 'versionid': [versionId],
};
final $payload = <String, dynamic>{
'CustomMetadata': customMetadata,
};
final response = await _protocol.send(
payload: $payload,
method: 'PUT',
requestUri:
'/api/v1/resources/${Uri.encodeComponent(resourceId)}/customMetadata',
queryParams: $query,
headers: headers,
exceptionFnMap: _exceptionFns,
);
}