uploadFileBase64 method
Upload a file via JSON with base64-encoded content.
Equivalent to uploadFile for clients that can't post multipart bodies (e.g. browser fetch with strict CSP).
Parameters:
- UploadFileBase64Request uploadFileBase64Request (required):
Implementation
Future<SpatioFile?> uploadFileBase64(UploadFileBase64Request uploadFileBase64Request,) async {
final response = await uploadFileBase64WithHttpInfo(uploadFileBase64Request,);
if (response.statusCode >= HttpStatus.badRequest) {
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
}
// When a remote server returns no body with a status of 204, we shall not decode it.
// At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
// FormatException when trying to decode an empty string.
if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'SpatioFile',) as SpatioFile;
}
return null;
}