add(task, body=None, x__xgafv=None)
Adds a file, folder or site stored in Google Drive, OneDrive, SharePoint or another third-party store as an artifact. The service persists `link_json_metadata` to Cloud Storage as a JSON metadata reference (a `.link.json` file), and links it to a parent resource: a task, named by `task`, or a collaborative project, named by `collaborative_project`. This method is idempotent with respect to the linked entity, identified by `link_json_metadata.provider` and `link_json_metadata.source_artifact_id`, or `link_json_metadata.uri` when `source_artifact_id` is unset: adding an entity that the parent already has does not add another artifact, and returns the same `artifact_id`.
Close httplib2 connections.
list(parent, filter=None, pageSize=None, pageToken=None, path=None, recursive=None, x__xgafv=None)
Lists the files and directories in a task's workspace. By default only the immediate children of `path` are returned; set `recursive` to descend into subdirectories. Entries that match `filter` are returned in breadth-first order. While the task's sandbox is running, paths it writes locally are read from the sandbox so the listing reflects files not yet synced to storage; otherwise they are read from storage. Which one served a request is not visible to the caller.
list_next(previous_request, previous_response)
Retrieves the next page of results.
preview(parent, outputMimeType=None, path=None, x__xgafv=None)
Returns a file converted for a preview, such as a PDF of a .pptx. A server-streaming RPC. The response body is the converted file's bytes, with its media type as the `Content-Type`. The server converts the file as it is stored now, on every call, and stores nothing. A PDF asked for as a PDF is returned as stored. Fails with `INVALID_ARGUMENT` or `FAILED_PRECONDITION` when the file cannot be converted (an unsupported format, too large, or unreadable), with `DEADLINE_EXCEEDED` when the conversion takes too long, and with `UNAVAILABLE` when conversion is busy or not available; the last two may succeed on a retry.
remove(parent, body=None, x__xgafv=None)
Deletes a file from a task's workspace. `path` must be an absolute path to a file in the task's workspace, under `/workspace/`, e.g. `/workspace/userdata/input.csv`. A path outside `/workspace/`, including a relative path, or a path with a `..` segment fails with `INVALID_ARGUMENT`. A directory path, or a task in a terminal state, fails with `FAILED_PRECONDITION`. A missing file fails with `NOT_FOUND` unless `allow_missing` is `true`, in which case the call succeeds and changes nothing.
add(task, body=None, x__xgafv=None)
Adds a file, folder or site stored in Google Drive, OneDrive, SharePoint or another third-party store as an artifact. The service persists `link_json_metadata` to Cloud Storage as a JSON metadata reference (a `.link.json` file), and links it to a parent resource: a task, named by `task`, or a collaborative project, named by `collaborative_project`. This method is idempotent with respect to the linked entity, identified by `link_json_metadata.provider` and `link_json_metadata.source_artifact_id`, or `link_json_metadata.uri` when `source_artifact_id` is unset: adding an entity that the parent already has does not add another artifact, and returns the same `artifact_id`.
Args:
task: string, Optional. The task to link the file to. Format: projects/{project}/locations/{location}/agents/{agent}/tasks/{task} Exactly one of `task` and `collaborative_project` must be set. (required)
body: object, The request body.
The object takes the form of:
{ # Request for ArtifactService.AddArtifact.
"collaborativeProject": "A String", # Optional. The collaborative project to link the file to. Format: projects/{project}/locations/{location}/collaborativeProjects/{collaborative_project} Exactly one of `task` and `collaborative_project` must be set.
"linkJsonMetadata": { # A file, folder, site or other item in a first-party or third-party store, as its `.link.json` file in the workspace records it. A link file is this message as proto JSON with the field names below, e.g. `{"source_artifact_id":"1AbC","provider":"GOOGLE_DRIVE","artifact_type": "GOOGLE_DRIVE_FILE","uri":"https://drive.google.com/file/d/1AbC/view"}`. A link file may hold fields this message does not have; they are ignored. `path` and `update_time` are not part of a link file: the service sets both on a link it lists, from the link file it read the link from, and `AddArtifact` clears both from a request. # Required. The linked entity, stored as its `.link.json` file.
"artifactType": "A String", # Optional. The provider-specific kind of entity, in upper snake case. Known values are GOOGLE_DRIVE_DOC, GOOGLE_DRIVE_SHEET, GOOGLE_DRIVE_SLIDES, GOOGLE_DRIVE_FILE, GOOGLE_DRIVE_FOLDER, ONE_DRIVE_FILE, ONE_DRIVE_FOLDER, SHAREPOINT_FILE, SHAREPOINT_FOLDER and SHAREPOINT_SITE; a connector may use others. Must match `A-Z*`. At most 64 characters.
"mimeType": "A String", # Optional. The entity's media type, e.g. "application/vnd.ms-excel". Empty for an entity that has none, such as a SharePoint site.
"path": "A String", # Output only. Absolute path of the link file in the workspace, e.g. `/workspace/userdata/{artifact_id}.link.json` in a task or `/workspace/project/{artifact_id}.link.json` in a collaborative project. Always under `/workspace` and never contains `..`. Set by `ArtifactService.ListWorkspaceArtifacts`. `ArtifactService.AddArtifact` clears it from a request, so it is never written to the link file.
"provider": "A String", # Required. The store that holds the entity.
"sourceArtifactId": "A String", # Optional. The entity's ID in its store, unique within `provider`: a Drive file ID, a Jira issue ID, or, for OneDrive and SharePoint, whose item IDs are unique only within a drive, the drive ID and the drive item ID, e.g. "{drive-id}/{item-id}". At most 1024 characters. With `provider`, it identifies the entity: it names the link file and is the idempotency key for `AddArtifact`. When it is unset, `uri` takes its place, so two URIs of one entity, such as a Drive file's /view and /edit URIs, are two entities.
"updateTime": "A String", # Output only. Last modification time of the link file at `path`, as `ArtifactService.ListWorkspaceArtifacts` read it. Not part of a link file. It is what tells two listings of one entity apart after the entity was updated in place. Such an update leaves every other field alone -- the entity keeps its `uri` and its `source_artifact_id`, so the link file keeps its name -- and it leaves the link file's bytes alone too, because a link file records WHICH entity is linked and not what state that entity is in. The time the file was rewritten is the only thing that moves.
"uri": "A String", # Required. URI of the entity, e.g. "https://drive.google.com/file/d/FILE_ID/view". At most 2048 characters.
},
"task": "A String", # Optional. The task to link the file to. Format: projects/{project}/locations/{location}/agents/{agent}/tasks/{task} Exactly one of `task` and `collaborative_project` must be set.
}
x__xgafv: string, V1 error format.
Allowed values
1 - v1 error format
2 - v2 error format
Returns:
An object of the form:
{ # Response for ArtifactService.AddArtifact.
"artifactId": "A String", # The ID of the added artifact.
}
close()
Close httplib2 connections.
list(parent, filter=None, pageSize=None, pageToken=None, path=None, recursive=None, x__xgafv=None)
Lists the files and directories in a task's workspace. By default only the immediate children of `path` are returned; set `recursive` to descend into subdirectories. Entries that match `filter` are returned in breadth-first order. While the task's sandbox is running, paths it writes locally are read from the sandbox so the listing reflects files not yet synced to storage; otherwise they are read from storage. Which one served a request is not visible to the caller.
Args:
parent: string, Required. The task or collaborative project whose workspace to list. Format: projects/{project}/locations/{location}/agents/{agent}/tasks/{task} or projects/{project}/locations/{location}/collaborativeProjects/{collaborative_project} (required)
filter: string, Optional. An AIP-160 filter expression that entries must match, e.g. `type = FILE AND mime_type = "image/*"`. Empty matches every entry. Supported fields: * `type` -- `FILE` or `DIRECTORY` (see `TaskArtifactFile.Type`), case-sensitive. * `mime_type` -- a media type in double quotes, e.g. `"text/csv"`. `*` is a wildcard, so `"image/*"` matches every image type. Directories have an empty `mime_type`. Comparisons use `=` or `!=` and combine with `AND`, `OR`, `NOT` (or `-`) and parentheses. A filter that is not valid AIP-160, or that uses another field or operator, is rejected with `INVALID_ARGUMENT`. The filter selects which entries are returned, not which directories are walked: with `recursive`, `type = FILE` still returns the files in subdirectories.
pageSize: integer, Optional. The maximum number of entries to return. The service may return fewer than this value, including none on a page that is not the last. If unspecified or 0, at most 100 are returned. The maximum is 1000; values above 1000 are coerced to 1000. A negative value is rejected with `INVALID_ARGUMENT`.
pageToken: string, Optional. A page token, received from a previous ListWorkspaceArtifacts call. Provide this to retrieve the subsequent page. When paginating, all other fields of the request except `page_size` must match the call that provided the page token. The workspace is live: the agent can write between pages, so a paged listing is not a snapshot. An entry added during the walk may or may not appear, and one removed may still be listed and then fail to download.
path: string, Optional. Absolute path of the directory to list, e.g. `/workspace/userdata`. Must be `/workspace` or under it, at most 1024 characters, and not contain a `..` segment. Defaults to `/workspace`.
recursive: boolean, Optional. If `true`, descends into subdirectories. Results are breadth-first.
x__xgafv: string, V1 error format.
Allowed values
1 - v1 error format
2 - v2 error format
Returns:
An object of the form:
{ # Response for ArtifactService.ListWorkspaceArtifacts.
"nextPageToken": "A String", # A token to retrieve the next page; empty if there are no more pages.
"workspaceArtifacts": [ # The artifacts under the requested directory that match `filter`. Each is a file or directory in the workspace, or a link to an entity in a first-party or third-party store, such as Google Drive or OneDrive.
{ # An artifact listed by ArtifactService.ListWorkspaceArtifacts: a file or directory in the workspace, or a link to an entity in a first-party or third-party store.
"linkJsonMetadata": { # A file, folder, site or other item in a first-party or third-party store, as its `.link.json` file in the workspace records it. A link file is this message as proto JSON with the field names below, e.g. `{"source_artifact_id":"1AbC","provider":"GOOGLE_DRIVE","artifact_type": "GOOGLE_DRIVE_FILE","uri":"https://drive.google.com/file/d/1AbC/view"}`. A link file may hold fields this message does not have; they are ignored. `path` and `update_time` are not part of a link file: the service sets both on a link it lists, from the link file it read the link from, and `AddArtifact` clears both from a request. # A link to a file, folder or site in a first-party or third-party store, such as Google Drive or OneDrive, as passed to ArtifactService.AddArtifact.
"artifactType": "A String", # Optional. The provider-specific kind of entity, in upper snake case. Known values are GOOGLE_DRIVE_DOC, GOOGLE_DRIVE_SHEET, GOOGLE_DRIVE_SLIDES, GOOGLE_DRIVE_FILE, GOOGLE_DRIVE_FOLDER, ONE_DRIVE_FILE, ONE_DRIVE_FOLDER, SHAREPOINT_FILE, SHAREPOINT_FOLDER and SHAREPOINT_SITE; a connector may use others. Must match `A-Z*`. At most 64 characters.
"mimeType": "A String", # Optional. The entity's media type, e.g. "application/vnd.ms-excel". Empty for an entity that has none, such as a SharePoint site.
"path": "A String", # Output only. Absolute path of the link file in the workspace, e.g. `/workspace/userdata/{artifact_id}.link.json` in a task or `/workspace/project/{artifact_id}.link.json` in a collaborative project. Always under `/workspace` and never contains `..`. Set by `ArtifactService.ListWorkspaceArtifacts`. `ArtifactService.AddArtifact` clears it from a request, so it is never written to the link file.
"provider": "A String", # Required. The store that holds the entity.
"sourceArtifactId": "A String", # Optional. The entity's ID in its store, unique within `provider`: a Drive file ID, a Jira issue ID, or, for OneDrive and SharePoint, whose item IDs are unique only within a drive, the drive ID and the drive item ID, e.g. "{drive-id}/{item-id}". At most 1024 characters. With `provider`, it identifies the entity: it names the link file and is the idempotency key for `AddArtifact`. When it is unset, `uri` takes its place, so two URIs of one entity, such as a Drive file's /view and /edit URIs, are two entities.
"updateTime": "A String", # Output only. Last modification time of the link file at `path`, as `ArtifactService.ListWorkspaceArtifacts` read it. Not part of a link file. It is what tells two listings of one entity apart after the entity was updated in place. Such an update leaves every other field alone -- the entity keeps its `uri` and its `source_artifact_id`, so the link file keeps its name -- and it leaves the link file's bytes alone too, because a link file records WHICH entity is linked and not what state that entity is in. The time the file was rewritten is the only thing that moves.
"uri": "A String", # Required. URI of the entity, e.g. "https://drive.google.com/file/d/FILE_ID/view". At most 2048 characters.
},
"taskArtifactFile": { # A file or directory in a task's workspace. # A file or directory in the workspace.
"mimeType": "A String", # Output only. The detected media type. Empty for directories.
"path": "A String", # Output only. Absolute path in the task's sandbox, e.g. "/workspace/userdata/input.csv" or "/workspace/report.md". Always under "/workspace" and never contains "..". Can be passed as-is to DownloadTaskArtifact.
"sizeBytes": "A String", # Output only. Size of the file in bytes. Zero for directories.
"type": "A String", # Output only. Whether this entry is a file or a directory.
"updateTime": "A String", # Output only. Last modification time of the file as it was read: the sandbox's when read from a running sandbox, otherwise the stored object's.
},
},
],
}
list_next(previous_request, previous_response)
Retrieves the next page of results. Args: previous_request: The request for the previous page. (required) previous_response: The response from the request for the previous page. (required) Returns: A request object that you can call 'execute()' on to request the next page. Returns None if there are no more items in the collection.
preview(parent, outputMimeType=None, path=None, x__xgafv=None)
Returns a file converted for a preview, such as a PDF of a .pptx. A server-streaming RPC. The response body is the converted file's bytes, with its media type as the `Content-Type`. The server converts the file as it is stored now, on every call, and stores nothing. A PDF asked for as a PDF is returned as stored. Fails with `INVALID_ARGUMENT` or `FAILED_PRECONDITION` when the file cannot be converted (an unsupported format, too large, or unreadable), with `DEADLINE_EXCEEDED` when the conversion takes too long, and with `UNAVAILABLE` when conversion is busy or not available; the last two may succeed on a retry.
Args:
parent: string, Required. The task or collaborative project whose workspace holds the file. Format: projects/{project}/locations/{location}/agents/{agent}/tasks/{task} or projects/{project}/locations/{location}/collaborativeProjects/{collaborative_project} (required)
outputMimeType: string, Required. The media type to convert the file to: * `application/pdf`: the file as a PDF, e.g. of a .docx, .pptx or .xlsx. * `application/json`: a spreadsheet, e.g. a .xlsx or .csv, as JSON describing its sheets and cells, from which a client draws the workbook as a grid.
path: string, Required. Absolute path of a file in the task's workspace, e.g. `/workspace/report.pptx`, or, for a collaborative project, under `/workspace/project`, e.g. `/workspace/project/report.pptx`. Must be under `/workspace`, at most 1024 characters, and not contain a `..` segment. Accepts `TaskArtifactFile.path` as-is.
x__xgafv: string, V1 error format.
Allowed values
1 - v1 error format
2 - v2 error format
Returns:
An object of the form:
{ # Message that represents an arbitrary HTTP body. It should only be used for payload formats that can't be represented as JSON, such as raw binary or an HTML page. This message can be used both in streaming and non-streaming API methods in the request as well as the response. It can be used as a top-level request field, which is convenient if one wants to extract parameters from either the URL or HTTP template into the request fields and also want access to the raw HTTP body. Example: message GetResourceRequest { // A unique request id. string request_id = 1; // The raw HTTP body is bound to this field. google.api.HttpBody http_body = 2; } service ResourceService { rpc GetResource(GetResourceRequest) returns (google.api.HttpBody); rpc UpdateResource(google.api.HttpBody) returns (google.protobuf.Empty); } Example with streaming methods: service CaldavService { rpc GetCalendar(stream google.api.HttpBody) returns (stream google.api.HttpBody); rpc UpdateCalendar(stream google.api.HttpBody) returns (stream google.api.HttpBody); } Use of this type only changes how the request and response bodies are handled, all other features will continue to work unchanged.
"contentType": "A String", # The HTTP Content-Type header value specifying the content type of the body.
"data": "A String", # The HTTP request/response body as raw binary.
"extensions": [ # Application specific response metadata. Must be set in the first response for streaming APIs.
{
"a_key": "", # Properties of the object. Contains field @type with type URL.
},
],
}
remove(parent, body=None, x__xgafv=None)
Deletes a file from a task's workspace. `path` must be an absolute path to a file in the task's workspace, under `/workspace/`, e.g. `/workspace/userdata/input.csv`. A path outside `/workspace/`, including a relative path, or a path with a `..` segment fails with `INVALID_ARGUMENT`. A directory path, or a task in a terminal state, fails with `FAILED_PRECONDITION`. A missing file fails with `NOT_FOUND` unless `allow_missing` is `true`, in which case the call succeeds and changes nothing.
Args:
parent: string, Required. The task or collaborative project whose workspace holds the file. Format: projects/{project}/locations/{location}/agents/{agent}/tasks/{task} or projects/{project}/locations/{location}/collaborativeProjects/{collaborative_project} (required)
body: object, The request body.
The object takes the form of:
{ # Request for ArtifactService.RemoveWorkspaceArtifact.
"allowMissing": True or False, # Optional. If `true`, deleting a file that does not exist succeeds and changes nothing.
"path": "A String", # Required. Absolute path of the file to delete, e.g. `/workspace/userdata/input.csv`, or, for a collaborative project, under `/workspace/project`, e.g. `/workspace/project/report.md`. Must be under `/workspace/`, at most 1024 characters, and not contain a `..` segment.
}
x__xgafv: string, V1 error format.
Allowed values
1 - v1 error format
2 - v2 error format
Returns:
An object of the form:
{ # Response for ArtifactService.RemoveWorkspaceArtifact.
}