workspaceUploadFileWithHttpInfo method
Workspace-scoped multipart upload (RBAC-protected).
Note: This method returns the HTTP Response.
Parameters:
Implementation
Future<Response> workspaceUploadFileWithHttpInfo(String org, String workspace, { MultipartFile? file, }) async {
// ignore: prefer_const_declarations
final path = r'/v1/organizations/{org}/workspaces/{workspace}/files/upload'
.replaceAll('{org}', org)
.replaceAll('{workspace}', workspace);
// ignore: prefer_final_locals
Object? postBody;
final queryParams = <QueryParam>[];
final headerParams = <String, String>{};
final formParams = <String, String>{};
const contentTypes = <String>['multipart/form-data'];
bool hasFields = false;
final mp = MultipartRequest('POST', Uri.parse(path));
if (file != null) {
hasFields = true;
mp.fields[r'file'] = file.field;
mp.files.add(file);
}
if (hasFields) {
postBody = mp;
}
return apiClient.invokeAPI(
path,
'POST',
queryParams,
postBody,
headerParams,
formParams,
contentTypes.isEmpty ? null : contentTypes.first,
);
}