startUpload method

Future<StartUpload> startUpload({
  1. UploadRequest? body,
  2. Map? mediaParams,
})

Implementation

Future<StartUpload> startUpload({UploadRequest? body, Map? mediaParams}) async {
  final builder = RequestBuilder();
  builder.body = {
    ...?body?.wrapped,
    if(mediaParams!=null) "media": mediaParams,
  };
  // create path and map variables
  // create path and map variables
  builder.path = "/uploads";
  List<String> contentTypes = ["application/json"];
  String contentType = contentTypes.isNotEmpty ? contentTypes[0] : "application/json";
  builder.contentType = contentType;
  builder.basePath = apiClient.basePaths["sunnyMain"];
  builder.authNames = ["Bearer"];

  builder.method = HttpMethod.POST;

  final response = await apiClient.invokeRequest(builder);
  final value = apiClient.decodeAs<StartUpload>(response.body);
  return value!;
}