updateContent method

Future<UpdateContentResponse> updateContent({
  1. required String contentId,
  2. required String knowledgeBaseId,
  3. Map<String, String>? metadata,
  4. String? overrideLinkOutUri,
  5. bool? removeOverrideLinkOutUri,
  6. String? revisionId,
  7. String? title,
  8. String? uploadId,
})

Updates information about the content.

May throw AccessDeniedException. May throw PreconditionFailedException. May throw ResourceNotFoundException. May throw ValidationException.

Parameter contentId : The identifier of the content. Can be either the ID or the ARN. URLs cannot contain the ARN.

Parameter knowledgeBaseId : The identifier of the knowledge base. This should not be a QUICK_RESPONSES type knowledge base if you're storing Wisdom Content resource to it. Can be either the ID or the ARN

Parameter metadata : A key/value map to store attributes without affecting tagging or recommendations. For example, when synchronizing data between an external system and Wisdom, you can store an external version identifier as metadata to utilize for determining drift.

Parameter overrideLinkOutUri : The URI for the article. If the knowledge base has a templateUri, setting this argument overrides it for this piece of content. To remove an existing overrideLinkOurUri, exclude this argument and set removeOverrideLinkOutUri to true.

Parameter removeOverrideLinkOutUri : Unset the existing overrideLinkOutUri if it exists.

Parameter revisionId : The revisionId of the content resource to update, taken from an earlier call to GetContent, GetContentSummary, SearchContent, or ListContents. If included, this argument acts as an optimistic lock to ensure content was not modified since it was last read. If it has been modified, this API throws a PreconditionFailedException.

Parameter title : The title of the content.

Parameter uploadId : A pointer to the uploaded asset. This value is returned by StartContentUpload.

Implementation

Future<UpdateContentResponse> updateContent({
  required String contentId,
  required String knowledgeBaseId,
  Map<String, String>? metadata,
  String? overrideLinkOutUri,
  bool? removeOverrideLinkOutUri,
  String? revisionId,
  String? title,
  String? uploadId,
}) async {
  final $payload = <String, dynamic>{
    if (metadata != null) 'metadata': metadata,
    if (overrideLinkOutUri != null) 'overrideLinkOutUri': overrideLinkOutUri,
    if (removeOverrideLinkOutUri != null)
      'removeOverrideLinkOutUri': removeOverrideLinkOutUri,
    if (revisionId != null) 'revisionId': revisionId,
    if (title != null) 'title': title,
    if (uploadId != null) 'uploadId': uploadId,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri:
        '/knowledgeBases/${Uri.encodeComponent(knowledgeBaseId)}/contents/${Uri.encodeComponent(contentId)}',
    exceptionFnMap: _exceptionFns,
  );
  return UpdateContentResponse.fromJson(response);
}