createAttachment method

Future<AttachmentCreateResultDTO> createAttachment({
  1. required String issueIdOrKey,
  2. required AttachmentCreateDTO body,
})

This method adds one or more temporary files (attached to the request's service desk using servicedesk/{serviceDeskId}/attachTemporaryFile) as attachments to a customer request and set the attachment visibility using the public flag. Also, it is possible to include a comment with the attachments.

To get a list of attachments for a comment on the request use servicedeskapi/request/{issueIdOrKey}/comment/{commentId}/attachment.

Permissions required: Permission to add an attachment.

Request limitations: Customers can set attachments to public visibility only.

Implementation

Future<AttachmentCreateResultDTO> createAttachment(
    {required String issueIdOrKey, required AttachmentCreateDTO body}) async {
  return AttachmentCreateResultDTO.fromJson(await _client.send(
    'post',
    'rest/servicedeskapi/request/{issueIdOrKey}/attachment',
    pathParameters: {
      'issueIdOrKey': issueIdOrKey,
    },
    body: body.toJson(),
  ));
}