Agent Platform API . projects . locations . publishers . files

Instance Methods

close()

Close httplib2 connections.

delete(name, x__xgafv=None)

Deletes the given file. Returns the deleted file's ID rather than an empty body. See `DeleteFileResponse`.

download(name, x__xgafv=None)

Downloads the contents of the given file. Only files marked `downloadable` can be retrieved this way; user-uploaded files are not downloadable.

download_media(name, x__xgafv=None)

Downloads the contents of the given file. Only files marked `downloadable` can be retrieved this way; user-uploaded files are not downloadable.

get(name, x__xgafv=None)

Gets the metadata for the given file.

list(parent, publishersId, limit=None, page=None, x__xgafv=None)

Lists the files owned by the requesting project and location. Supports two mutually exclusive modes: paginated listing via an opaque `page` cursor, or batch fetch by `ids`. See `ListFilesRequest`.

upload(parent, publishersId, body=None, media_body=None, media_mime_type=None, x__xgafv=None)

Uploads a file that can be referenced by ID from subsequent Claude model requests.

Method Details

close()
Close httplib2 connections.
delete(name, x__xgafv=None)
Deletes the given file. Returns the deleted file's ID rather than an empty body. See `DeleteFileResponse`.

Args:
  name: string, Required. The name of the file to delete. Format: `projects/{project}/locations/{location}/publishers/{publisher}/files/{file}` (required)
  x__xgafv: string, V1 error format.
    Allowed values
      1 - v1 error format
      2 - v2 error format

Returns:
  An object of the form:

    { # Response message for ClaudeFileService.DeleteFile. Returns `{id, type: "file_deleted"}` rather than an empty body, matching the Claude Files API.
  "id": "A String", # The ID of the deleted file.
  "type": "A String", # The object type. Always `file_deleted`.
}
download(name, x__xgafv=None)
Downloads the contents of the given file. Only files marked `downloadable` can be retrieved this way; user-uploaded files are not downloadable.

Args:
  name: string, Required. The name of the file to download. Format: `projects/{project}/locations/{location}/publishers/{publisher}/files/{file}` (required)
  x__xgafv: string, V1 error format.
    Allowed values
      1 - v1 error format
      2 - v2 error format

Returns:
  An object of the form:

    { # Response message for ClaudeFileService.DownloadFile.
}
download_media(name, x__xgafv=None)
Downloads the contents of the given file. Only files marked `downloadable` can be retrieved this way; user-uploaded files are not downloadable.

Args:
  name: string, Required. The name of the file to download. Format: `projects/{project}/locations/{location}/publishers/{publisher}/files/{file}` (required)
  x__xgafv: string, V1 error format.
    Allowed values
      1 - v1 error format
      2 - v2 error format

Returns:
  The media object as a string.

    
get(name, x__xgafv=None)
Gets the metadata for the given file.

Args:
  name: string, Required. The name of the file to get. Format: `projects/{project}/locations/{location}/publishers/{publisher}/files/{file}` (required)
  x__xgafv: string, V1 error format.
    Allowed values
      1 - v1 error format
      2 - v2 error format

Returns:
  An object of the form:

    { # A file that can be referenced by ID from subsequent Claude model requests. The JSON representation of this message matches the Claude Files API File object field-for-field, so that code written against that API parses these responses unchanged.
  "created_at": "A String", # Output only. The time at which the file was created.
  "downloadable": True or False, # Output only. Whether the contents of this file can be retrieved with `DownloadFile`. False for user-uploaded files, true for tool-generated ones.
  "expires_at": "A String", # Output only. The time at which the file expires and is deleted, set from the `expires_in_seconds` upload form field. Unset for files that do not expire, which is serialised as `null`.
  "filename": "A String", # Output only. The original name of the uploaded file, taken from the `Content-Disposition` header on upload. Between 1 and 255 characters. Control characters and the characters `<>:"|?*\/` are not accepted.
  "id": "A String", # Output only. The server-assigned identifier of the file, for example `file_abc123`. This is the ID to pass in subsequent model requests.
  "mime_type": "A String", # Output only. The media type of the file, taken from the `Content-Type` header of the file part on upload.
  "size_bytes": 42, # Output only. The size of the file in bytes.
  "type": "A String", # Output only. The object type. Always `file`.
}
list(parent, publishersId, limit=None, page=None, x__xgafv=None)
Lists the files owned by the requesting project and location. Supports two mutually exclusive modes: paginated listing via an opaque `page` cursor, or batch fetch by `ids`. See `ListFilesRequest`.

Args:
  parent: string, Required. The location to list files under. Format: `projects/{project}/locations/{location}` (required)
  publishersId: string, A parameter (required)
  limit: integer, Optional. The number of files to return per page. Defaults to 20 if unset, maximum 1000. Mutually exclusive with `ids`.
  page: string, Optional. Opaque pagination cursor. Pass the previous response's `next_page` to fetch the next page. Mutually exclusive with `ids`.
  x__xgafv: string, V1 error format.
    Allowed values
      1 - v1 error format
      2 - v2 error format

Returns:
  An object of the form:

    { # Response message for ClaudeFileService.ListFiles.
  "data": [ # The files.
    { # A file that can be referenced by ID from subsequent Claude model requests. The JSON representation of this message matches the Claude Files API File object field-for-field, so that code written against that API parses these responses unchanged.
      "created_at": "A String", # Output only. The time at which the file was created.
      "downloadable": True or False, # Output only. Whether the contents of this file can be retrieved with `DownloadFile`. False for user-uploaded files, true for tool-generated ones.
      "expires_at": "A String", # Output only. The time at which the file expires and is deleted, set from the `expires_in_seconds` upload form field. Unset for files that do not expire, which is serialised as `null`.
      "filename": "A String", # Output only. The original name of the uploaded file, taken from the `Content-Disposition` header on upload. Between 1 and 255 characters. Control characters and the characters `<>:"|?*\/` are not accepted.
      "id": "A String", # Output only. The server-assigned identifier of the file, for example `file_abc123`. This is the ID to pass in subsequent model requests.
      "mime_type": "A String", # Output only. The media type of the file, taken from the `Content-Type` header of the file part on upload.
      "size_bytes": 42, # Output only. The size of the file in bytes.
      "type": "A String", # Output only. The object type. Always `file`.
    },
  ],
  "next_page": "A String", # Opaque cursor for the next page. Unset on the last page, and always unset when `ids` was supplied, since batch fetch is single-page.
}
upload(parent, publishersId, body=None, media_body=None, media_mime_type=None, x__xgafv=None)
Uploads a file that can be referenced by ID from subsequent Claude model requests.

Args:
  parent: string, Required. The location to create the file under. Format: `projects/{project}/locations/{location}` (required)
  publishersId: string, A parameter (required)
  body: object, The request body.
    The object takes the form of:

{ # Request message for ClaudeFileService.CreateFile.
}

  media_body: string, The filename of the media request body, or an instance of a MediaUpload object.
  media_mime_type: string, The MIME type of the media request body, or an instance of a MediaUpload object.
  x__xgafv: string, V1 error format.
    Allowed values
      1 - v1 error format
      2 - v2 error format

Returns:
  An object of the form:

    { # A file that can be referenced by ID from subsequent Claude model requests. The JSON representation of this message matches the Claude Files API File object field-for-field, so that code written against that API parses these responses unchanged.
  "created_at": "A String", # Output only. The time at which the file was created.
  "downloadable": True or False, # Output only. Whether the contents of this file can be retrieved with `DownloadFile`. False for user-uploaded files, true for tool-generated ones.
  "expires_at": "A String", # Output only. The time at which the file expires and is deleted, set from the `expires_in_seconds` upload form field. Unset for files that do not expire, which is serialised as `null`.
  "filename": "A String", # Output only. The original name of the uploaded file, taken from the `Content-Disposition` header on upload. Between 1 and 255 characters. Control characters and the characters `<>:"|?*\/` are not accepted.
  "id": "A String", # Output only. The server-assigned identifier of the file, for example `file_abc123`. This is the ID to pass in subsequent model requests.
  "mime_type": "A String", # Output only. The media type of the file, taken from the `Content-Type` header of the file part on upload.
  "size_bytes": 42, # Output only. The size of the file in bytes.
  "type": "A String", # Output only. The object type. Always `file`.
}