upload method
Future<GoogleCloudAiplatformV1ClaudeFile>
upload(
- GoogleCloudAiplatformV1CreateFileRequest request,
- String parent,
- String publishersId, {
- String? $fields,
- Media? uploadMedia,
Uploads a file that can be referenced by ID from subsequent Claude model requests.
request - The metadata request object.
Request parameters:
parent - Required. The location to create the file under. Format:
projects/{project}/locations/{location}
Value must have pattern ^projects/\[^/\]+/locations/\[^/\]+$.
publishersId - null
$fields - Selector specifying which fields to include in a partial
response.
uploadMedia - The media to upload.
Completes with a GoogleCloudAiplatformV1ClaudeFile.
Completes with a commons.ApiRequestError if the API endpoint returned an error.
If the used http.Client completes with an error when making a REST call,
this method will complete with the same error.
Implementation
async.Future<GoogleCloudAiplatformV1ClaudeFile> upload(
GoogleCloudAiplatformV1CreateFileRequest request,
core.String parent,
core.String publishersId, {
core.String? $fields,
commons.Media? uploadMedia,
}) async {
final body_ = convert.json.encode(request);
final queryParams_ = <core.String, core.List<core.String>>{
'fields': ?$fields == null ? null : [$fields],
};
core.String url_;
if (uploadMedia == null) {
url_ =
'v1/' +
core.Uri.encodeFull('$parent') +
'/publishers/' +
commons.escapeVariable('$publishersId') +
'/files';
} else {
url_ =
'/upload/v1/' +
core.Uri.encodeFull('$parent') +
'/publishers/' +
commons.escapeVariable('$publishersId') +
'/files';
}
final response_ = await _requester.request(
url_,
'POST',
body: body_,
queryParams: queryParams_,
uploadMedia: uploadMedia,
uploadOptions: commons.UploadOptions.defaultOptions,
);
return GoogleCloudAiplatformV1ClaudeFile.fromJson(
response_ as core.Map<core.String, core.dynamic>,
);
}