uploadAttachmentBytesWithHttpInfo method
Future<Response>
uploadAttachmentBytesWithHttpInfo(
- UploadAttachmentBytesRequest uploadAttachmentBytesRequest, {
- String? contentType,
- String? filename,
Upload an attachment for sending using file byte stream input octet stream. Returns an array whose first element is the ID of the uploaded attachment.
Note: This method returns the HTTP Response
.
Parameters:
-
UploadAttachmentBytesRequest uploadAttachmentBytesRequest (required):
-
String contentType: Optional contentType for file. For instance
application/pdf
-
String filename: Optional filename to save upload with
Implementation
Future<Response> uploadAttachmentBytesWithHttpInfo(UploadAttachmentBytesRequest uploadAttachmentBytesRequest, { String? contentType, String? filename, }) async {
// ignore: prefer_const_declarations
final path = r'/attachments/bytes';
// ignore: prefer_final_locals
Object? postBody = uploadAttachmentBytesRequest;
final queryParams = <QueryParam>[];
final headerParams = <String, String>{};
final formParams = <String, String>{};
if (filename != null) {
queryParams.addAll(_queryParams('', 'filename', filename));
}
if (contentType != null) {
headerParams[r'contentType'] = parameterToString(contentType);
}
const contentTypes = <String>['application/octet-stream'];
return apiClient.invokeAPI(
path,
'POST',
queryParams,
postBody,
headerParams,
formParams,
contentTypes.isEmpty ? null : contentTypes.first,
);
}