Fix generation for methods with abnormal page token conventions (#330)
* Fix generation for methods with abnormal page token conventions
Addresses https://github.com/googleapis/toolkit/issues/692
diff --git a/googleapiclient/discovery.py b/googleapiclient/discovery.py
index 1266883..fe19022 100644
--- a/googleapiclient/discovery.py
+++ b/googleapiclient/discovery.py
@@ -117,6 +117,7 @@
'type': 'string',
'required': False,
}
+_PAGE_TOKEN_NAMES = ('pageToken', 'nextPageToken')
# Parameters accepted by the stack, but not visible via discovery.
# TODO(dhermes): Remove 'userip' in 'v2'.
@@ -724,7 +725,11 @@
for name in parameters.required_params:
if name not in kwargs:
- raise TypeError('Missing required parameter "%s"' % name)
+ # temporary workaround for non-paging methods incorrectly requiring
+ # page token parameter (cf. drive.changes.watch vs. drive.changes.list)
+ if name not in _PAGE_TOKEN_NAMES or _findPageTokenName(
+ _methodProperties(methodDesc, schema, 'response')):
+ raise TypeError('Missing required parameter "%s"' % name)
for name, regex in six.iteritems(parameters.pattern_params):
if name in kwargs:
@@ -927,13 +932,20 @@
return (methodName, method)
-def createNextMethod(methodName):
+def createNextMethod(methodName,
+ pageTokenName='pageToken',
+ nextPageTokenName='nextPageToken',
+ isPageTokenParameter=True):
"""Creates any _next methods for attaching to a Resource.
The _next methods allow for easy iteration through list() responses.
Args:
methodName: string, name of the method to use.
+ pageTokenName: string, name of request page token field.
+ nextPageTokenName: string, name of response page token field.
+ isPageTokenParameter: Boolean, True if request page token is a query
+ parameter, False if request page token is a field of the request body.
"""
methodName = fix_method_name(methodName)
@@ -951,24 +963,24 @@
# Retrieve nextPageToken from previous_response
# Use as pageToken in previous_request to create new request.
- if 'nextPageToken' not in previous_response or not previous_response['nextPageToken']:
+ nextPageToken = previous_response.get(nextPageTokenName, None)
+ if not nextPageToken:
return None
request = copy.copy(previous_request)
- pageToken = previous_response['nextPageToken']
- parsed = list(urlparse(request.uri))
- q = parse_qsl(parsed[4])
-
- # Find and remove old 'pageToken' value from URI
- newq = [(key, value) for (key, value) in q if key != 'pageToken']
- newq.append(('pageToken', pageToken))
- parsed[4] = urlencode(newq)
- uri = urlunparse(parsed)
-
- request.uri = uri
-
- logger.info('URL being requested: %s %s' % (methodName,uri))
+ if isPageTokenParameter:
+ # Replace pageToken value in URI
+ request.uri = _add_query_parameter(
+ request.uri, pageTokenName, nextPageToken)
+ logger.info('Next page request URL: %s %s' % (methodName, request.uri))
+ else:
+ # Replace pageToken value in request body
+ model = self._model
+ body = model.deserialize(request.body)
+ body[pageTokenName] = nextPageToken
+ request.body = model.serialize(body)
+ logger.info('Next page request body: %s %s' % (methodName, body))
return request
@@ -1116,19 +1128,59 @@
method.__get__(self, self.__class__))
def _add_next_methods(self, resourceDesc, schema):
- # Add _next() methods
- # Look for response bodies in schema that contain nextPageToken, and methods
- # that take a pageToken parameter.
- if 'methods' in resourceDesc:
- for methodName, methodDesc in six.iteritems(resourceDesc['methods']):
- if 'response' in methodDesc:
- responseSchema = methodDesc['response']
- if '$ref' in responseSchema:
- responseSchema = schema.get(responseSchema['$ref'])
- hasNextPageToken = 'nextPageToken' in responseSchema.get('properties',
- {})
- hasPageToken = 'pageToken' in methodDesc.get('parameters', {})
- if hasNextPageToken and hasPageToken:
- fixedMethodName, method = createNextMethod(methodName + '_next')
- self._set_dynamic_attr(fixedMethodName,
- method.__get__(self, self.__class__))
+ # Add _next() methods if and only if one of the names 'pageToken' or
+ # 'nextPageToken' occurs among the fields of both the method's response
+ # type either the method's request (query parameters) or request body.
+ if 'methods' not in resourceDesc:
+ return
+ for methodName, methodDesc in six.iteritems(resourceDesc['methods']):
+ nextPageTokenName = _findPageTokenName(
+ _methodProperties(methodDesc, schema, 'response'))
+ if not nextPageTokenName:
+ continue
+ isPageTokenParameter = True
+ pageTokenName = _findPageTokenName(methodDesc.get('parameters', {}))
+ if not pageTokenName:
+ isPageTokenParameter = False
+ pageTokenName = _findPageTokenName(
+ _methodProperties(methodDesc, schema, 'request'))
+ if not pageTokenName:
+ continue
+ fixedMethodName, method = createNextMethod(
+ methodName + '_next', pageTokenName, nextPageTokenName,
+ isPageTokenParameter)
+ self._set_dynamic_attr(fixedMethodName,
+ method.__get__(self, self.__class__))
+
+
+def _findPageTokenName(fields):
+ """Search field names for one like a page token.
+
+ Args:
+ fields: container of string, names of fields.
+
+ Returns:
+ First name that is either 'pageToken' or 'nextPageToken' if one exists,
+ otherwise None.
+ """
+ return next((tokenName for tokenName in _PAGE_TOKEN_NAMES
+ if tokenName in fields), None)
+
+def _methodProperties(methodDesc, schema, name):
+ """Get properties of a field in a method description.
+
+ Args:
+ methodDesc: object, fragment of deserialized discovery document that
+ describes the method.
+ schema: object, mapping of schema names to schema descriptions.
+ name: string, name of top-level field in method description.
+
+ Returns:
+ Object representing fragment of deserialized discovery document
+ corresponding to 'properties' field of object corresponding to named field
+ in method description, if it exists, otherwise empty dict.
+ """
+ desc = methodDesc.get(name, {})
+ if '$ref' in desc:
+ desc = schema.get(desc['$ref'], {})
+ return desc.get('properties', {})
diff --git a/googleapiclient/http.py b/googleapiclient/http.py
index aece933..4330f26 100644
--- a/googleapiclient/http.py
+++ b/googleapiclient/http.py
@@ -817,6 +817,7 @@
if 'content-length' not in self.headers:
self.headers['content-length'] = str(self.body_size)
# If the request URI is too long then turn it into a POST request.
+ # Assume that a GET request never contains a request body.
if len(self.uri) > MAX_URI_LENGTH and self.method == 'GET':
self.method = 'POST'
self.headers['x-http-method-override'] = 'GET'
diff --git a/googleapiclient/schema.py b/googleapiclient/schema.py
index 9feaf28..160d388 100644
--- a/googleapiclient/schema.py
+++ b/googleapiclient/schema.py
@@ -161,13 +161,14 @@
# Return with trailing comma and newline removed.
return self._prettyPrintSchema(schema, dent=1)[:-2]
- def get(self, name):
+ def get(self, name, default=None):
"""Get deserialized JSON schema from the schema name.
Args:
name: string, Schema name.
+ default: object, return value if name not found.
"""
- return self.schemas[name]
+ return self.schemas.get(name, default)
class _SchemaToStruct(object):
diff --git a/tests/data/bigquery.json b/tests/data/bigquery.json
new file mode 100644
index 0000000..c9f63e3
--- /dev/null
+++ b/tests/data/bigquery.json
@@ -0,0 +1,2773 @@
+{
+ "kind": "discovery#restDescription",
+ "etag": "\"tbys6C40o18GZwyMen5GMkdK-3s/wyP_l3wPjLK3LUrJqeSGHNESSW0\"",
+ "discoveryVersion": "v1",
+ "id": "bigquery:v2",
+ "name": "bigquery",
+ "version": "v2",
+ "revision": "20161130",
+ "title": "BigQuery API",
+ "description": "A data platform for customers to create, manage, share and query data.",
+ "ownerDomain": "google.com",
+ "ownerName": "Google",
+ "icons": {
+ "x16": "https://www.google.com/images/icons/product/search-16.gif",
+ "x32": "https://www.google.com/images/icons/product/search-32.gif"
+ },
+ "documentationLink": "https://cloud.google.com/bigquery/",
+ "protocol": "rest",
+ "baseUrl": "https://www.googleapis.com/bigquery/v2/",
+ "basePath": "/bigquery/v2/",
+ "rootUrl": "https://www.googleapis.com/",
+ "servicePath": "bigquery/v2/",
+ "batchPath": "batch",
+ "parameters": {
+ "alt": {
+ "type": "string",
+ "description": "Data format for the response.",
+ "default": "json",
+ "enum": [
+ "json"
+ ],
+ "enumDescriptions": [
+ "Responses with Content-Type of application/json"
+ ],
+ "location": "query"
+ },
+ "fields": {
+ "type": "string",
+ "description": "Selector specifying which fields to include in a partial response.",
+ "location": "query"
+ },
+ "key": {
+ "type": "string",
+ "description": "API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.",
+ "location": "query"
+ },
+ "oauth_token": {
+ "type": "string",
+ "description": "OAuth 2.0 token for the current user.",
+ "location": "query"
+ },
+ "prettyPrint": {
+ "type": "boolean",
+ "description": "Returns response with indentations and line breaks.",
+ "default": "true",
+ "location": "query"
+ },
+ "quotaUser": {
+ "type": "string",
+ "description": "Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided.",
+ "location": "query"
+ },
+ "userIp": {
+ "type": "string",
+ "description": "IP address of the site where the request originates. Use this if you want to enforce per-user limits.",
+ "location": "query"
+ }
+ },
+ "auth": {
+ "oauth2": {
+ "scopes": {
+ "https://www.googleapis.com/auth/bigquery": {
+ "description": "View and manage your data in Google BigQuery"
+ },
+ "https://www.googleapis.com/auth/bigquery.insertdata": {
+ "description": "Insert data into Google BigQuery"
+ },
+ "https://www.googleapis.com/auth/cloud-platform": {
+ "description": "View and manage your data across Google Cloud Platform services"
+ },
+ "https://www.googleapis.com/auth/cloud-platform.read-only": {
+ "description": "View your data across Google Cloud Platform services"
+ },
+ "https://www.googleapis.com/auth/devstorage.full_control": {
+ "description": "Manage your data and permissions in Google Cloud Storage"
+ },
+ "https://www.googleapis.com/auth/devstorage.read_only": {
+ "description": "View your data in Google Cloud Storage"
+ },
+ "https://www.googleapis.com/auth/devstorage.read_write": {
+ "description": "Manage your data in Google Cloud Storage"
+ }
+ }
+ }
+ },
+ "schemas": {
+ "BigtableColumn": {
+ "id": "BigtableColumn",
+ "type": "object",
+ "properties": {
+ "encoding": {
+ "type": "string",
+ "description": "[Optional] The encoding of the values when the type is not STRING. Acceptable encoding values are: TEXT - indicates values are alphanumeric text strings. BINARY - indicates values are encoded using HBase Bytes.toBytes family of functions. 'encoding' can also be set at the column family level. However, the setting at this level takes precedence if 'encoding' is set at both levels."
+ },
+ "fieldName": {
+ "type": "string",
+ "description": "[Optional] If the qualifier is not a valid BigQuery field identifier i.e. does not match [a-zA-Z][a-zA-Z0-9_]*, a valid identifier must be provided as the column field name and is used as field name in queries."
+ },
+ "onlyReadLatest": {
+ "type": "boolean",
+ "description": "[Optional] If this is set, only the latest version of value in this column are exposed. 'onlyReadLatest' can also be set at the column family level. However, the setting at this level takes precedence if 'onlyReadLatest' is set at both levels."
+ },
+ "qualifierEncoded": {
+ "type": "string",
+ "description": "[Required] Qualifier of the column. Columns in the parent column family that has this exact qualifier are exposed as . field. If the qualifier is valid UTF-8 string, it can be specified in the qualifier_string field. Otherwise, a base-64 encoded value must be set to qualifier_encoded. The column field name is the same as the column qualifier. However, if the qualifier is not a valid BigQuery field identifier i.e. does not match [a-zA-Z][a-zA-Z0-9_]*, a valid identifier must be provided as field_name.",
+ "format": "byte"
+ },
+ "qualifierString": {
+ "type": "string"
+ },
+ "type": {
+ "type": "string",
+ "description": "[Optional] The type to convert the value in cells of this column. The values are expected to be encoded using HBase Bytes.toBytes function when using the BINARY encoding value. Following BigQuery types are allowed (case-sensitive) - BYTES STRING INTEGER FLOAT BOOLEAN Default type is BYTES. 'type' can also be set at the column family level. However, the setting at this level takes precedence if 'type' is set at both levels."
+ }
+ }
+ },
+ "BigtableColumnFamily": {
+ "id": "BigtableColumnFamily",
+ "type": "object",
+ "properties": {
+ "columns": {
+ "type": "array",
+ "description": "[Optional] Lists of columns that should be exposed as individual fields as opposed to a list of (column name, value) pairs. All columns whose qualifier matches a qualifier in this list can be accessed as .. Other columns can be accessed as a list through .Column field.",
+ "items": {
+ "$ref": "BigtableColumn"
+ }
+ },
+ "encoding": {
+ "type": "string",
+ "description": "[Optional] The encoding of the values when the type is not STRING. Acceptable encoding values are: TEXT - indicates values are alphanumeric text strings. BINARY - indicates values are encoded using HBase Bytes.toBytes family of functions. This can be overridden for a specific column by listing that column in 'columns' and specifying an encoding for it."
+ },
+ "familyId": {
+ "type": "string",
+ "description": "Identifier of the column family."
+ },
+ "onlyReadLatest": {
+ "type": "boolean",
+ "description": "[Optional] If this is set only the latest version of value are exposed for all columns in this column family. This can be overridden for a specific column by listing that column in 'columns' and specifying a different setting for that column."
+ },
+ "type": {
+ "type": "string",
+ "description": "[Optional] The type to convert the value in cells of this column family. The values are expected to be encoded using HBase Bytes.toBytes function when using the BINARY encoding value. Following BigQuery types are allowed (case-sensitive) - BYTES STRING INTEGER FLOAT BOOLEAN Default type is BYTES. This can be overridden for a specific column by listing that column in 'columns' and specifying a type for it."
+ }
+ }
+ },
+ "BigtableOptions": {
+ "id": "BigtableOptions",
+ "type": "object",
+ "properties": {
+ "columnFamilies": {
+ "type": "array",
+ "description": "[Optional] List of column families to expose in the table schema along with their types. This list restricts the column families that can be referenced in queries and specifies their value types. You can use this list to do type conversions - see the 'type' field for more details. If you leave this list empty, all column families are present in the table schema and their values are read as BYTES. During a query only the column families referenced in that query are read from Bigtable.",
+ "items": {
+ "$ref": "BigtableColumnFamily"
+ }
+ },
+ "ignoreUnspecifiedColumnFamilies": {
+ "type": "boolean",
+ "description": "[Optional] If field is true, then the column families that are not specified in columnFamilies list are not exposed in the table schema. Otherwise, they are read with BYTES type values. The default value is false."
+ },
+ "readRowkeyAsString": {
+ "type": "boolean",
+ "description": "[Optional] If field is true, then the rowkey column families will be read and converted to string. Otherwise they are read with BYTES type values and users need to manually cast them with CAST if necessary. The default value is false."
+ }
+ }
+ },
+ "CsvOptions": {
+ "id": "CsvOptions",
+ "type": "object",
+ "properties": {
+ "allowJaggedRows": {
+ "type": "boolean",
+ "description": "[Optional] Indicates if BigQuery should accept rows that are missing trailing optional columns. If true, BigQuery treats missing trailing columns as null values. If false, records with missing trailing columns are treated as bad records, and if there are too many bad records, an invalid error is returned in the job result. The default value is false."
+ },
+ "allowQuotedNewlines": {
+ "type": "boolean",
+ "description": "[Optional] Indicates if BigQuery should allow quoted data sections that contain newline characters in a CSV file. The default value is false."
+ },
+ "encoding": {
+ "type": "string",
+ "description": "[Optional] The character encoding of the data. The supported values are UTF-8 or ISO-8859-1. The default value is UTF-8. BigQuery decodes the data after the raw, binary data has been split using the values of the quote and fieldDelimiter properties."
+ },
+ "fieldDelimiter": {
+ "type": "string",
+ "description": "[Optional] The separator for fields in a CSV file. BigQuery converts the string to ISO-8859-1 encoding, and then uses the first byte of the encoded string to split the data in its raw, binary state. BigQuery also supports the escape sequence \"\\t\" to specify a tab separator. The default value is a comma (',')."
+ },
+ "quote": {
+ "type": "string",
+ "description": "[Optional] The value that is used to quote data sections in a CSV file. BigQuery converts the string to ISO-8859-1 encoding, and then uses the first byte of the encoded string to split the data in its raw, binary state. The default value is a double-quote ('\"'). If your data does not contain quoted sections, set the property value to an empty string. If your data contains quoted newline characters, you must also set the allowQuotedNewlines property to true.",
+ "default": "\"",
+ "pattern": ".?"
+ },
+ "skipLeadingRows": {
+ "type": "string",
+ "description": "[Optional] The number of rows at the top of a CSV file that BigQuery will skip when reading the data. The default value is 0. This property is useful if you have header rows in the file that should be skipped.",
+ "format": "int64"
+ }
+ }
+ },
+ "Dataset": {
+ "id": "Dataset",
+ "type": "object",
+ "properties": {
+ "access": {
+ "type": "array",
+ "description": "[Optional] An array of objects that define dataset access for one or more entities. You can set this property when inserting or updating a dataset in order to control who is allowed to access the data. If unspecified at dataset creation time, BigQuery adds default dataset access for the following entities: access.specialGroup: projectReaders; access.role: READER; access.specialGroup: projectWriters; access.role: WRITER; access.specialGroup: projectOwners; access.role: OWNER; access.userByEmail: [dataset creator email]; access.role: OWNER;",
+ "items": {
+ "type": "object",
+ "properties": {
+ "domain": {
+ "type": "string",
+ "description": "[Pick one] A domain to grant access to. Any users signed in with the domain specified will be granted the specified access. Example: \"example.com\"."
+ },
+ "groupByEmail": {
+ "type": "string",
+ "description": "[Pick one] An email address of a Google Group to grant access to."
+ },
+ "role": {
+ "type": "string",
+ "description": "[Required] Describes the rights granted to the user specified by the other member of the access object. The following string values are supported: READER, WRITER, OWNER."
+ },
+ "specialGroup": {
+ "type": "string",
+ "description": "[Pick one] A special group to grant access to. Possible values include: projectOwners: Owners of the enclosing project. projectReaders: Readers of the enclosing project. projectWriters: Writers of the enclosing project. allAuthenticatedUsers: All authenticated BigQuery users."
+ },
+ "userByEmail": {
+ "type": "string",
+ "description": "[Pick one] An email address of a user to grant access to. For example: fred@example.com."
+ },
+ "view": {
+ "$ref": "TableReference",
+ "description": "[Pick one] A view from a different dataset to grant access to. Queries executed against that view will have read access to tables in this dataset. The role field is not required when this field is set. If that view is updated by any user, access to the view needs to be granted again via an update operation."
+ }
+ }
+ }
+ },
+ "creationTime": {
+ "type": "string",
+ "description": "[Output-only] The time when this dataset was created, in milliseconds since the epoch.",
+ "format": "int64"
+ },
+ "datasetReference": {
+ "$ref": "DatasetReference",
+ "description": "[Required] A reference that identifies the dataset."
+ },
+ "defaultTableExpirationMs": {
+ "type": "string",
+ "description": "[Optional] The default lifetime of all tables in the dataset, in milliseconds. The minimum value is 3600000 milliseconds (one hour). Once this property is set, all newly-created tables in the dataset will have an expirationTime property set to the creation time plus the value in this property, and changing the value will only affect new tables, not existing ones. When the expirationTime for a given table is reached, that table will be deleted automatically. If a table's expirationTime is modified or removed before the table expires, or if you provide an explicit expirationTime when creating a table, that value takes precedence over the default expiration time indicated by this property.",
+ "format": "int64"
+ },
+ "description": {
+ "type": "string",
+ "description": "[Optional] A user-friendly description of the dataset."
+ },
+ "etag": {
+ "type": "string",
+ "description": "[Output-only] A hash of the resource."
+ },
+ "friendlyName": {
+ "type": "string",
+ "description": "[Optional] A descriptive name for the dataset."
+ },
+ "id": {
+ "type": "string",
+ "description": "[Output-only] The fully-qualified unique name of the dataset in the format projectId:datasetId. The dataset name without the project name is given in the datasetId field. When creating a new dataset, leave this field blank, and instead specify the datasetId field."
+ },
+ "kind": {
+ "type": "string",
+ "description": "[Output-only] The resource type.",
+ "default": "bigquery#dataset"
+ },
+ "labels": {
+ "type": "object",
+ "description": "[Experimental] The labels associated with this dataset. You can use these to organize and group your datasets. You can set this property when inserting or updating a dataset. See Labeling Datasets for more information.",
+ "additionalProperties": {
+ "type": "string"
+ }
+ },
+ "lastModifiedTime": {
+ "type": "string",
+ "description": "[Output-only] The date when this dataset or any of its tables was last modified, in milliseconds since the epoch.",
+ "format": "int64"
+ },
+ "location": {
+ "type": "string",
+ "description": "[Experimental] The geographic location where the dataset should reside. Possible values include EU and US. The default value is US."
+ },
+ "selfLink": {
+ "type": "string",
+ "description": "[Output-only] A URL that can be used to access the resource again. You can use this URL in Get or Update requests to the resource."
+ }
+ }
+ },
+ "DatasetList": {
+ "id": "DatasetList",
+ "type": "object",
+ "properties": {
+ "datasets": {
+ "type": "array",
+ "description": "An array of the dataset resources in the project. Each resource contains basic information. For full information about a particular dataset resource, use the Datasets: get method. This property is omitted when there are no datasets in the project.",
+ "items": {
+ "type": "object",
+ "properties": {
+ "datasetReference": {
+ "$ref": "DatasetReference",
+ "description": "The dataset reference. Use this property to access specific parts of the dataset's ID, such as project ID or dataset ID."
+ },
+ "friendlyName": {
+ "type": "string",
+ "description": "A descriptive name for the dataset, if one exists."
+ },
+ "id": {
+ "type": "string",
+ "description": "The fully-qualified, unique, opaque ID of the dataset."
+ },
+ "kind": {
+ "type": "string",
+ "description": "The resource type. This property always returns the value \"bigquery#dataset\".",
+ "default": "bigquery#dataset"
+ },
+ "labels": {
+ "type": "object",
+ "description": "[Experimental] The labels associated with this dataset. You can use these to organize and group your datasets.",
+ "additionalProperties": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ },
+ "etag": {
+ "type": "string",
+ "description": "A hash value of the results page. You can use this property to determine if the page has changed since the last request."
+ },
+ "kind": {
+ "type": "string",
+ "description": "The list type. This property always returns the value \"bigquery#datasetList\".",
+ "default": "bigquery#datasetList"
+ },
+ "nextPageToken": {
+ "type": "string",
+ "description": "A token that can be used to request the next results page. This property is omitted on the final results page."
+ }
+ }
+ },
+ "DatasetReference": {
+ "id": "DatasetReference",
+ "type": "object",
+ "properties": {
+ "datasetId": {
+ "type": "string",
+ "description": "[Required] A unique ID for this dataset, without the project name. The ID must contain only letters (a-z, A-Z), numbers (0-9), or underscores (_). The maximum length is 1,024 characters.",
+ "annotations": {
+ "required": [
+ "bigquery.datasets.update"
+ ]
+ }
+ },
+ "projectId": {
+ "type": "string",
+ "description": "[Optional] The ID of the project containing this dataset.",
+ "annotations": {
+ "required": [
+ "bigquery.datasets.update"
+ ]
+ }
+ }
+ }
+ },
+ "ErrorProto": {
+ "id": "ErrorProto",
+ "type": "object",
+ "properties": {
+ "debugInfo": {
+ "type": "string",
+ "description": "Debugging information. This property is internal to Google and should not be used."
+ },
+ "location": {
+ "type": "string",
+ "description": "Specifies where the error occurred, if present."
+ },
+ "message": {
+ "type": "string",
+ "description": "A human-readable description of the error."
+ },
+ "reason": {
+ "type": "string",
+ "description": "A short error code that summarizes the error."
+ }
+ }
+ },
+ "ExplainQueryStage": {
+ "id": "ExplainQueryStage",
+ "type": "object",
+ "properties": {
+ "computeRatioAvg": {
+ "type": "number",
+ "description": "Relative amount of time the average shard spent on CPU-bound tasks.",
+ "format": "double"
+ },
+ "computeRatioMax": {
+ "type": "number",
+ "description": "Relative amount of time the slowest shard spent on CPU-bound tasks.",
+ "format": "double"
+ },
+ "id": {
+ "type": "string",
+ "description": "Unique ID for stage within plan.",
+ "format": "int64"
+ },
+ "name": {
+ "type": "string",
+ "description": "Human-readable name for stage."
+ },
+ "readRatioAvg": {
+ "type": "number",
+ "description": "Relative amount of time the average shard spent reading input.",
+ "format": "double"
+ },
+ "readRatioMax": {
+ "type": "number",
+ "description": "Relative amount of time the slowest shard spent reading input.",
+ "format": "double"
+ },
+ "recordsRead": {
+ "type": "string",
+ "description": "Number of records read into the stage.",
+ "format": "int64"
+ },
+ "recordsWritten": {
+ "type": "string",
+ "description": "Number of records written by the stage.",
+ "format": "int64"
+ },
+ "steps": {
+ "type": "array",
+ "description": "List of operations within the stage in dependency order (approximately chronological).",
+ "items": {
+ "$ref": "ExplainQueryStep"
+ }
+ },
+ "waitRatioAvg": {
+ "type": "number",
+ "description": "Relative amount of time the average shard spent waiting to be scheduled.",
+ "format": "double"
+ },
+ "waitRatioMax": {
+ "type": "number",
+ "description": "Relative amount of time the slowest shard spent waiting to be scheduled.",
+ "format": "double"
+ },
+ "writeRatioAvg": {
+ "type": "number",
+ "description": "Relative amount of time the average shard spent on writing output.",
+ "format": "double"
+ },
+ "writeRatioMax": {
+ "type": "number",
+ "description": "Relative amount of time the slowest shard spent on writing output.",
+ "format": "double"
+ }
+ }
+ },
+ "ExplainQueryStep": {
+ "id": "ExplainQueryStep",
+ "type": "object",
+ "properties": {
+ "kind": {
+ "type": "string",
+ "description": "Machine-readable operation type."
+ },
+ "substeps": {
+ "type": "array",
+ "description": "Human-readable stage descriptions.",
+ "items": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "ExternalDataConfiguration": {
+ "id": "ExternalDataConfiguration",
+ "type": "object",
+ "properties": {
+ "autodetect": {
+ "type": "boolean",
+ "description": "[Experimental] Try to detect schema and format options automatically. Any option specified explicitly will be honored."
+ },
+ "bigtableOptions": {
+ "$ref": "BigtableOptions",
+ "description": "[Optional] Additional options if sourceFormat is set to BIGTABLE."
+ },
+ "compression": {
+ "type": "string",
+ "description": "[Optional] The compression type of the data source. Possible values include GZIP and NONE. The default value is NONE. This setting is ignored for Google Cloud Bigtable, Google Cloud Datastore backups and Avro formats."
+ },
+ "csvOptions": {
+ "$ref": "CsvOptions",
+ "description": "Additional properties to set if sourceFormat is set to CSV."
+ },
+ "googleSheetsOptions": {
+ "$ref": "GoogleSheetsOptions",
+ "description": "[Optional] Additional options if sourceFormat is set to GOOGLE_SHEETS."
+ },
+ "ignoreUnknownValues": {
+ "type": "boolean",
+ "description": "[Optional] Indicates if BigQuery should allow extra values that are not represented in the table schema. If true, the extra values are ignored. If false, records with extra columns are treated as bad records, and if there are too many bad records, an invalid error is returned in the job result. The default value is false. The sourceFormat property determines what BigQuery treats as an extra value: CSV: Trailing columns JSON: Named values that don't match any column names Google Cloud Bigtable: This setting is ignored. Google Cloud Datastore backups: This setting is ignored. Avro: This setting is ignored."
+ },
+ "maxBadRecords": {
+ "type": "integer",
+ "description": "[Optional] The maximum number of bad records that BigQuery can ignore when reading data. If the number of bad records exceeds this value, an invalid error is returned in the job result. The default value is 0, which requires that all records are valid. This setting is ignored for Google Cloud Bigtable, Google Cloud Datastore backups and Avro formats.",
+ "format": "int32"
+ },
+ "schema": {
+ "$ref": "TableSchema",
+ "description": "[Optional] The schema for the data. Schema is required for CSV and JSON formats. Schema is disallowed for Google Cloud Bigtable, Cloud Datastore backups, and Avro formats."
+ },
+ "sourceFormat": {
+ "type": "string",
+ "description": "[Required] The data format. For CSV files, specify \"CSV\". For Google sheets, specify \"GOOGLE_SHEETS\". For newline-delimited JSON, specify \"NEWLINE_DELIMITED_JSON\". For Avro files, specify \"AVRO\". For Google Cloud Datastore backups, specify \"DATASTORE_BACKUP\". [Experimental] For Google Cloud Bigtable, specify \"BIGTABLE\". Please note that reading from Google Cloud Bigtable is experimental and has to be enabled for your project. Please contact Google Cloud Support to enable this for your project."
+ },
+ "sourceUris": {
+ "type": "array",
+ "description": "[Required] The fully-qualified URIs that point to your data in Google Cloud. For Google Cloud Storage URIs: Each URI can contain one '*' wildcard character and it must come after the 'bucket' name. Size limits related to load jobs apply to external data sources. For Google Cloud Bigtable URIs: Exactly one URI can be specified and it has be a fully specified and valid HTTPS URL for a Google Cloud Bigtable table. For Google Cloud Datastore backups, exactly one URI can be specified, and it must end with '.backup_info'. Also, the '*' wildcard character is not allowed.",
+ "items": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "GetQueryResultsResponse": {
+ "id": "GetQueryResultsResponse",
+ "type": "object",
+ "properties": {
+ "cacheHit": {
+ "type": "boolean",
+ "description": "Whether the query result was fetched from the query cache."
+ },
+ "errors": {
+ "type": "array",
+ "description": "[Output-only] All errors and warnings encountered during the running of the job. Errors here do not necessarily mean that the job has completed or was unsuccessful.",
+ "items": {
+ "$ref": "ErrorProto"
+ }
+ },
+ "etag": {
+ "type": "string",
+ "description": "A hash of this response."
+ },
+ "jobComplete": {
+ "type": "boolean",
+ "description": "Whether the query has completed or not. If rows or totalRows are present, this will always be true. If this is false, totalRows will not be available."
+ },
+ "jobReference": {
+ "$ref": "JobReference",
+ "description": "Reference to the BigQuery Job that was created to run the query. This field will be present even if the original request timed out, in which case GetQueryResults can be used to read the results once the query has completed. Since this API only returns the first page of results, subsequent pages can be fetched via the same mechanism (GetQueryResults)."
+ },
+ "kind": {
+ "type": "string",
+ "description": "The resource type of the response.",
+ "default": "bigquery#getQueryResultsResponse"
+ },
+ "numDmlAffectedRows": {
+ "type": "string",
+ "description": "[Output-only, Experimental] The number of rows affected by a DML statement. Present only for DML statements INSERT, UPDATE or DELETE.",
+ "format": "int64"
+ },
+ "pageToken": {
+ "type": "string",
+ "description": "A token used for paging results."
+ },
+ "rows": {
+ "type": "array",
+ "description": "An object with as many results as can be contained within the maximum permitted reply size. To get any additional rows, you can call GetQueryResults and specify the jobReference returned above. Present only when the query completes successfully.",
+ "items": {
+ "$ref": "TableRow"
+ }
+ },
+ "schema": {
+ "$ref": "TableSchema",
+ "description": "The schema of the results. Present only when the query completes successfully."
+ },
+ "totalBytesProcessed": {
+ "type": "string",
+ "description": "The total number of bytes processed for this query.",
+ "format": "int64"
+ },
+ "totalRows": {
+ "type": "string",
+ "description": "The total number of rows in the complete query result set, which can be more than the number of rows in this single page of results. Present only when the query completes successfully.",
+ "format": "uint64"
+ }
+ }
+ },
+ "GoogleSheetsOptions": {
+ "id": "GoogleSheetsOptions",
+ "type": "object",
+ "properties": {
+ "skipLeadingRows": {
+ "type": "string",
+ "description": "[Optional] The number of rows at the top of a sheet that BigQuery will skip when reading the data. The default value is 0. This property is useful if you have header rows that should be skipped. When autodetect is on, behavior is the following: * skipLeadingRows unspecified - Autodetect tries to detect headers in the first row. If they are not detected, the row is read as data. Otherwise data is read starting from the second row. * skipLeadingRows is 0 - Instructs autodetect that there are no headers and data should be read starting from the first row. * skipLeadingRows = N \u003e 0 - Autodetect skips N-1 rows and tries to detect headers in row N. If headers are not detected, row N is just skipped. Otherwise row N is used to extract column names for the detected schema.",
+ "format": "int64"
+ }
+ }
+ },
+ "Job": {
+ "id": "Job",
+ "type": "object",
+ "properties": {
+ "configuration": {
+ "$ref": "JobConfiguration",
+ "description": "[Required] Describes the job configuration."
+ },
+ "etag": {
+ "type": "string",
+ "description": "[Output-only] A hash of this resource."
+ },
+ "id": {
+ "type": "string",
+ "description": "[Output-only] Opaque ID field of the job"
+ },
+ "jobReference": {
+ "$ref": "JobReference",
+ "description": "[Optional] Reference describing the unique-per-user name of the job."
+ },
+ "kind": {
+ "type": "string",
+ "description": "[Output-only] The type of the resource.",
+ "default": "bigquery#job"
+ },
+ "selfLink": {
+ "type": "string",
+ "description": "[Output-only] A URL that can be used to access this resource again."
+ },
+ "statistics": {
+ "$ref": "JobStatistics",
+ "description": "[Output-only] Information about the job, including starting time and ending time of the job."
+ },
+ "status": {
+ "$ref": "JobStatus",
+ "description": "[Output-only] The status of this job. Examine this value when polling an asynchronous job to see if the job is complete."
+ },
+ "user_email": {
+ "type": "string",
+ "description": "[Output-only] Email address of the user who ran the job."
+ }
+ }
+ },
+ "JobCancelResponse": {
+ "id": "JobCancelResponse",
+ "type": "object",
+ "properties": {
+ "job": {
+ "$ref": "Job",
+ "description": "The final state of the job."
+ },
+ "kind": {
+ "type": "string",
+ "description": "The resource type of the response.",
+ "default": "bigquery#jobCancelResponse"
+ }
+ }
+ },
+ "JobConfiguration": {
+ "id": "JobConfiguration",
+ "type": "object",
+ "properties": {
+ "copy": {
+ "$ref": "JobConfigurationTableCopy",
+ "description": "[Pick one] Copies a table."
+ },
+ "dryRun": {
+ "type": "boolean",
+ "description": "[Optional] If set, don't actually run this job. A valid query will return a mostly empty response with some processing statistics, while an invalid query will return the same error it would if it wasn't a dry run. Behavior of non-query jobs is undefined."
+ },
+ "extract": {
+ "$ref": "JobConfigurationExtract",
+ "description": "[Pick one] Configures an extract job."
+ },
+ "labels": {
+ "type": "object",
+ "description": "[Experimental] The labels associated with this job. You can use these to organize and group your jobs. Label keys and values can be no longer than 63 characters, can only contain letters, numeric characters, underscores and dashes. International characters are allowed. Label values are optional. Label keys must start with a letter and must be unique within a dataset. Both keys and values are additionally constrained to be \u003c= 128 bytes in size.",
+ "additionalProperties": {
+ "type": "string"
+ }
+ },
+ "load": {
+ "$ref": "JobConfigurationLoad",
+ "description": "[Pick one] Configures a load job."
+ },
+ "query": {
+ "$ref": "JobConfigurationQuery",
+ "description": "[Pick one] Configures a query job."
+ }
+ }
+ },
+ "JobConfigurationExtract": {
+ "id": "JobConfigurationExtract",
+ "type": "object",
+ "properties": {
+ "compression": {
+ "type": "string",
+ "description": "[Optional] The compression type to use for exported files. Possible values include GZIP and NONE. The default value is NONE."
+ },
+ "destinationFormat": {
+ "type": "string",
+ "description": "[Optional] The exported file format. Possible values include CSV, NEWLINE_DELIMITED_JSON and AVRO. The default value is CSV. Tables with nested or repeated fields cannot be exported as CSV."
+ },
+ "destinationUri": {
+ "type": "string",
+ "description": "[Pick one] DEPRECATED: Use destinationUris instead, passing only one URI as necessary. The fully-qualified Google Cloud Storage URI where the extracted table should be written."
+ },
+ "destinationUris": {
+ "type": "array",
+ "description": "[Pick one] A list of fully-qualified Google Cloud Storage URIs where the extracted table should be written.",
+ "items": {
+ "type": "string"
+ }
+ },
+ "fieldDelimiter": {
+ "type": "string",
+ "description": "[Optional] Delimiter to use between fields in the exported data. Default is ','"
+ },
+ "printHeader": {
+ "type": "boolean",
+ "description": "[Optional] Whether to print out a header row in the results. Default is true.",
+ "default": "true"
+ },
+ "sourceTable": {
+ "$ref": "TableReference",
+ "description": "[Required] A reference to the table being exported."
+ }
+ }
+ },
+ "JobConfigurationLoad": {
+ "id": "JobConfigurationLoad",
+ "type": "object",
+ "properties": {
+ "allowJaggedRows": {
+ "type": "boolean",
+ "description": "[Optional] Accept rows that are missing trailing optional columns. The missing values are treated as nulls. If false, records with missing trailing columns are treated as bad records, and if there are too many bad records, an invalid error is returned in the job result. The default value is false. Only applicable to CSV, ignored for other formats."
+ },
+ "allowQuotedNewlines": {
+ "type": "boolean",
+ "description": "Indicates if BigQuery should allow quoted data sections that contain newline characters in a CSV file. The default value is false."
+ },
+ "autodetect": {
+ "type": "boolean",
+ "description": "[Experimental] Indicates if we should automatically infer the options and schema for CSV and JSON sources."
+ },
+ "createDisposition": {
+ "type": "string",
+ "description": "[Optional] Specifies whether the job is allowed to create new tables. The following values are supported: CREATE_IF_NEEDED: If the table does not exist, BigQuery creates the table. CREATE_NEVER: The table must already exist. If it does not, a 'notFound' error is returned in the job result. The default value is CREATE_IF_NEEDED. Creation, truncation and append actions occur as one atomic update upon job completion."
+ },
+ "destinationTable": {
+ "$ref": "TableReference",
+ "description": "[Required] The destination table to load the data into."
+ },
+ "encoding": {
+ "type": "string",
+ "description": "[Optional] The character encoding of the data. The supported values are UTF-8 or ISO-8859-1. The default value is UTF-8. BigQuery decodes the data after the raw, binary data has been split using the values of the quote and fieldDelimiter properties."
+ },
+ "fieldDelimiter": {
+ "type": "string",
+ "description": "[Optional] The separator for fields in a CSV file. The separator can be any ISO-8859-1 single-byte character. To use a character in the range 128-255, you must encode the character as UTF8. BigQuery converts the string to ISO-8859-1 encoding, and then uses the first byte of the encoded string to split the data in its raw, binary state. BigQuery also supports the escape sequence \"\\t\" to specify a tab separator. The default value is a comma (',')."
+ },
+ "ignoreUnknownValues": {
+ "type": "boolean",
+ "description": "[Optional] Indicates if BigQuery should allow extra values that are not represented in the table schema. If true, the extra values are ignored. If false, records with extra columns are treated as bad records, and if there are too many bad records, an invalid error is returned in the job result. The default value is false. The sourceFormat property determines what BigQuery treats as an extra value: CSV: Trailing columns JSON: Named values that don't match any column names"
+ },
+ "maxBadRecords": {
+ "type": "integer",
+ "description": "[Optional] The maximum number of bad records that BigQuery can ignore when running the job. If the number of bad records exceeds this value, an invalid error is returned in the job result. The default value is 0, which requires that all records are valid.",
+ "format": "int32"
+ },
+ "nullMarker": {
+ "type": "string",
+ "description": "[Optional] This string will be interpreted as a null value when it appears in a CSV file. The default value is the empty string. Please refer to the documentation for further information."
+ },
+ "projectionFields": {
+ "type": "array",
+ "description": "[Experimental] If sourceFormat is set to \"DATASTORE_BACKUP\", indicates which entity properties to load into BigQuery from a Cloud Datastore backup. Property names are case sensitive and must be top-level properties. If no properties are specified, BigQuery loads all properties. If any named property isn't found in the Cloud Datastore backup, an invalid error is returned in the job result.",
+ "items": {
+ "type": "string"
+ }
+ },
+ "quote": {
+ "type": "string",
+ "description": "[Optional] The value that is used to quote data sections in a CSV file. BigQuery converts the string to ISO-8859-1 encoding, and then uses the first byte of the encoded string to split the data in its raw, binary state. The default value is a double-quote ('\"'). If your data does not contain quoted sections, set the property value to an empty string. If your data contains quoted newline characters, you must also set the allowQuotedNewlines property to true.",
+ "default": "\"",
+ "pattern": ".?"
+ },
+ "schema": {
+ "$ref": "TableSchema",
+ "description": "[Optional] The schema for the destination table. The schema can be omitted if the destination table already exists, or if you're loading data from Google Cloud Datastore."
+ },
+ "schemaInline": {
+ "type": "string",
+ "description": "[Deprecated] The inline schema. For CSV schemas, specify as \"Field1:Type1[,Field2:Type2]*\". For example, \"foo:STRING, bar:INTEGER, baz:FLOAT\"."
+ },
+ "schemaInlineFormat": {
+ "type": "string",
+ "description": "[Deprecated] The format of the schemaInline property."
+ },
+ "schemaUpdateOptions": {
+ "type": "array",
+ "description": "[Experimental] Allows the schema of the desitination table to be updated as a side effect of the load job. Schema update options are supported in two cases: when writeDisposition is WRITE_APPEND; when writeDisposition is WRITE_TRUNCATE and the destination table is a partition of a table, specified by partition decorators. For normal tables, WRITE_TRUNCATE will always overwrite the schema. One or more of the following values are specified: ALLOW_FIELD_ADDITION: allow adding a nullable field to the schema. ALLOW_FIELD_RELAXATION: allow relaxing a required field in the original schema to nullable.",
+ "items": {
+ "type": "string"
+ }
+ },
+ "skipLeadingRows": {
+ "type": "integer",
+ "description": "[Optional] The number of rows at the top of a CSV file that BigQuery will skip when loading the data. The default value is 0. This property is useful if you have header rows in the file that should be skipped.",
+ "format": "int32"
+ },
+ "sourceFormat": {
+ "type": "string",
+ "description": "[Optional] The format of the data files. For CSV files, specify \"CSV\". For datastore backups, specify \"DATASTORE_BACKUP\". For newline-delimited JSON, specify \"NEWLINE_DELIMITED_JSON\". For Avro, specify \"AVRO\". The default value is CSV."
+ },
+ "sourceUris": {
+ "type": "array",
+ "description": "[Required] The fully-qualified URIs that point to your data in Google Cloud Storage. Each URI can contain one '*' wildcard character and it must come after the 'bucket' name.",
+ "items": {
+ "type": "string"
+ }
+ },
+ "writeDisposition": {
+ "type": "string",
+ "description": "[Optional] Specifies the action that occurs if the destination table already exists. The following values are supported: WRITE_TRUNCATE: If the table already exists, BigQuery overwrites the table data. WRITE_APPEND: If the table already exists, BigQuery appends the data to the table. WRITE_EMPTY: If the table already exists and contains data, a 'duplicate' error is returned in the job result. The default value is WRITE_APPEND. Each action is atomic and only occurs if BigQuery is able to complete the job successfully. Creation, truncation and append actions occur as one atomic update upon job completion."
+ }
+ }
+ },
+ "JobConfigurationQuery": {
+ "id": "JobConfigurationQuery",
+ "type": "object",
+ "properties": {
+ "allowLargeResults": {
+ "type": "boolean",
+ "description": "If true, allows the query to produce arbitrarily large result tables at a slight cost in performance. Requires destinationTable to be set."
+ },
+ "createDisposition": {
+ "type": "string",
+ "description": "[Optional] Specifies whether the job is allowed to create new tables. The following values are supported: CREATE_IF_NEEDED: If the table does not exist, BigQuery creates the table. CREATE_NEVER: The table must already exist. If it does not, a 'notFound' error is returned in the job result. The default value is CREATE_IF_NEEDED. Creation, truncation and append actions occur as one atomic update upon job completion."
+ },
+ "defaultDataset": {
+ "$ref": "DatasetReference",
+ "description": "[Optional] Specifies the default dataset to use for unqualified table names in the query."
+ },
+ "destinationTable": {
+ "$ref": "TableReference",
+ "description": "[Optional] Describes the table where the query results should be stored. If not present, a new table will be created to store the results."
+ },
+ "flattenResults": {
+ "type": "boolean",
+ "description": "[Optional] Flattens all nested and repeated fields in the query results. The default value is true. allowLargeResults must be true if this is set to false.",
+ "default": "true"
+ },
+ "maximumBillingTier": {
+ "type": "integer",
+ "description": "[Optional] Limits the billing tier for this job. Queries that have resource usage beyond this tier will fail (without incurring a charge). If unspecified, this will be set to your project default.",
+ "default": "1",
+ "format": "int32"
+ },
+ "maximumBytesBilled": {
+ "type": "string",
+ "description": "[Optional] Limits the bytes billed for this job. Queries that will have bytes billed beyond this limit will fail (without incurring a charge). If unspecified, this will be set to your project default.",
+ "format": "int64"
+ },
+ "parameterMode": {
+ "type": "string",
+ "description": "[Experimental] Standard SQL only. Whether to use positional (?) or named (@myparam) query parameters in this query."
+ },
+ "preserveNulls": {
+ "type": "boolean",
+ "description": "[Deprecated] This property is deprecated."
+ },
+ "priority": {
+ "type": "string",
+ "description": "[Optional] Specifies a priority for the query. Possible values include INTERACTIVE and BATCH. The default value is INTERACTIVE."
+ },
+ "query": {
+ "type": "string",
+ "description": "[Required] BigQuery SQL query to execute."
+ },
+ "queryParameters": {
+ "type": "array",
+ "description": "Query parameters for standard SQL queries.",
+ "items": {
+ "$ref": "QueryParameter"
+ }
+ },
+ "schemaUpdateOptions": {
+ "type": "array",
+ "description": "[Experimental] Allows the schema of the destination table to be updated as a side effect of the query job. Schema update options are supported in two cases: when writeDisposition is WRITE_APPEND; when writeDisposition is WRITE_TRUNCATE and the destination table is a partition of a table, specified by partition decorators. For normal tables, WRITE_TRUNCATE will always overwrite the schema. One or more of the following values are specified: ALLOW_FIELD_ADDITION: allow adding a nullable field to the schema. ALLOW_FIELD_RELAXATION: allow relaxing a required field in the original schema to nullable.",
+ "items": {
+ "type": "string"
+ }
+ },
+ "tableDefinitions": {
+ "type": "object",
+ "description": "[Optional] If querying an external data source outside of BigQuery, describes the data format, location and other properties of the data source. By defining these properties, the data source can then be queried as if it were a standard BigQuery table.",
+ "additionalProperties": {
+ "$ref": "ExternalDataConfiguration"
+ }
+ },
+ "useLegacySql": {
+ "type": "boolean",
+ "description": "Specifies whether to use BigQuery's legacy SQL dialect for this query. The default value is true. If set to false, the query will use BigQuery's standard SQL: https://cloud.google.com/bigquery/sql-reference/ When useLegacySql is set to false, the values of allowLargeResults and flattenResults are ignored; query will be run as if allowLargeResults is true and flattenResults is false."
+ },
+ "useQueryCache": {
+ "type": "boolean",
+ "description": "[Optional] Whether to look for the result in the query cache. The query cache is a best-effort cache that will be flushed whenever tables in the query are modified. Moreover, the query cache is only available when a query does not have a destination table specified. The default value is true.",
+ "default": "true"
+ },
+ "userDefinedFunctionResources": {
+ "type": "array",
+ "description": "[Experimental] Describes user-defined function resources used in the query.",
+ "items": {
+ "$ref": "UserDefinedFunctionResource"
+ }
+ },
+ "writeDisposition": {
+ "type": "string",
+ "description": "[Optional] Specifies the action that occurs if the destination table already exists. The following values are supported: WRITE_TRUNCATE: If the table already exists, BigQuery overwrites the table data. WRITE_APPEND: If the table already exists, BigQuery appends the data to the table. WRITE_EMPTY: If the table already exists and contains data, a 'duplicate' error is returned in the job result. The default value is WRITE_EMPTY. Each action is atomic and only occurs if BigQuery is able to complete the job successfully. Creation, truncation and append actions occur as one atomic update upon job completion."
+ }
+ }
+ },
+ "JobConfigurationTableCopy": {
+ "id": "JobConfigurationTableCopy",
+ "type": "object",
+ "properties": {
+ "createDisposition": {
+ "type": "string",
+ "description": "[Optional] Specifies whether the job is allowed to create new tables. The following values are supported: CREATE_IF_NEEDED: If the table does not exist, BigQuery creates the table. CREATE_NEVER: The table must already exist. If it does not, a 'notFound' error is returned in the job result. The default value is CREATE_IF_NEEDED. Creation, truncation and append actions occur as one atomic update upon job completion."
+ },
+ "destinationTable": {
+ "$ref": "TableReference",
+ "description": "[Required] The destination table"
+ },
+ "sourceTable": {
+ "$ref": "TableReference",
+ "description": "[Pick one] Source table to copy."
+ },
+ "sourceTables": {
+ "type": "array",
+ "description": "[Pick one] Source tables to copy.",
+ "items": {
+ "$ref": "TableReference"
+ }
+ },
+ "writeDisposition": {
+ "type": "string",
+ "description": "[Optional] Specifies the action that occurs if the destination table already exists. The following values are supported: WRITE_TRUNCATE: If the table already exists, BigQuery overwrites the table data. WRITE_APPEND: If the table already exists, BigQuery appends the data to the table. WRITE_EMPTY: If the table already exists and contains data, a 'duplicate' error is returned in the job result. The default value is WRITE_EMPTY. Each action is atomic and only occurs if BigQuery is able to complete the job successfully. Creation, truncation and append actions occur as one atomic update upon job completion."
+ }
+ }
+ },
+ "JobList": {
+ "id": "JobList",
+ "type": "object",
+ "properties": {
+ "etag": {
+ "type": "string",
+ "description": "A hash of this page of results."
+ },
+ "jobs": {
+ "type": "array",
+ "description": "List of jobs that were requested.",
+ "items": {
+ "type": "object",
+ "properties": {
+ "configuration": {
+ "$ref": "JobConfiguration",
+ "description": "[Full-projection-only] Specifies the job configuration."
+ },
+ "errorResult": {
+ "$ref": "ErrorProto",
+ "description": "A result object that will be present only if the job has failed."
+ },
+ "id": {
+ "type": "string",
+ "description": "Unique opaque ID of the job."
+ },
+ "jobReference": {
+ "$ref": "JobReference",
+ "description": "Job reference uniquely identifying the job."
+ },
+ "kind": {
+ "type": "string",
+ "description": "The resource type.",
+ "default": "bigquery#job"
+ },
+ "state": {
+ "type": "string",
+ "description": "Running state of the job. When the state is DONE, errorResult can be checked to determine whether the job succeeded or failed."
+ },
+ "statistics": {
+ "$ref": "JobStatistics",
+ "description": "[Output-only] Information about the job, including starting time and ending time of the job."
+ },
+ "status": {
+ "$ref": "JobStatus",
+ "description": "[Full-projection-only] Describes the state of the job."
+ },
+ "user_email": {
+ "type": "string",
+ "description": "[Full-projection-only] Email address of the user who ran the job."
+ }
+ }
+ }
+ },
+ "kind": {
+ "type": "string",
+ "description": "The resource type of the response.",
+ "default": "bigquery#jobList"
+ },
+ "nextPageToken": {
+ "type": "string",
+ "description": "A token to request the next page of results."
+ }
+ }
+ },
+ "JobReference": {
+ "id": "JobReference",
+ "type": "object",
+ "properties": {
+ "jobId": {
+ "type": "string",
+ "description": "[Required] The ID of the job. The ID must contain only letters (a-z, A-Z), numbers (0-9), underscores (_), or dashes (-). The maximum length is 1,024 characters.",
+ "annotations": {
+ "required": [
+ "bigquery.jobs.getQueryResults"
+ ]
+ }
+ },
+ "projectId": {
+ "type": "string",
+ "description": "[Required] The ID of the project containing this job.",
+ "annotations": {
+ "required": [
+ "bigquery.jobs.getQueryResults"
+ ]
+ }
+ }
+ }
+ },
+ "JobStatistics": {
+ "id": "JobStatistics",
+ "type": "object",
+ "properties": {
+ "creationTime": {
+ "type": "string",
+ "description": "[Output-only] Creation time of this job, in milliseconds since the epoch. This field will be present on all jobs.",
+ "format": "int64"
+ },
+ "endTime": {
+ "type": "string",
+ "description": "[Output-only] End time of this job, in milliseconds since the epoch. This field will be present whenever a job is in the DONE state.",
+ "format": "int64"
+ },
+ "extract": {
+ "$ref": "JobStatistics4",
+ "description": "[Output-only] Statistics for an extract job."
+ },
+ "load": {
+ "$ref": "JobStatistics3",
+ "description": "[Output-only] Statistics for a load job."
+ },
+ "query": {
+ "$ref": "JobStatistics2",
+ "description": "[Output-only] Statistics for a query job."
+ },
+ "startTime": {
+ "type": "string",
+ "description": "[Output-only] Start time of this job, in milliseconds since the epoch. This field will be present when the job transitions from the PENDING state to either RUNNING or DONE.",
+ "format": "int64"
+ },
+ "totalBytesProcessed": {
+ "type": "string",
+ "description": "[Output-only] [Deprecated] Use the bytes processed in the query statistics instead.",
+ "format": "int64"
+ }
+ }
+ },
+ "JobStatistics2": {
+ "id": "JobStatistics2",
+ "type": "object",
+ "properties": {
+ "billingTier": {
+ "type": "integer",
+ "description": "[Output-only] Billing tier for the job.",
+ "format": "int32"
+ },
+ "cacheHit": {
+ "type": "boolean",
+ "description": "[Output-only] Whether the query result was fetched from the query cache."
+ },
+ "numDmlAffectedRows": {
+ "type": "string",
+ "description": "[Output-only, Experimental] The number of rows affected by a DML statement. Present only for DML statements INSERT, UPDATE or DELETE.",
+ "format": "int64"
+ },
+ "queryPlan": {
+ "type": "array",
+ "description": "[Output-only, Experimental] Describes execution plan for the query.",
+ "items": {
+ "$ref": "ExplainQueryStage"
+ }
+ },
+ "referencedTables": {
+ "type": "array",
+ "description": "[Output-only, Experimental] Referenced tables for the job. Queries that reference more than 50 tables will not have a complete list.",
+ "items": {
+ "$ref": "TableReference"
+ }
+ },
+ "schema": {
+ "$ref": "TableSchema",
+ "description": "[Output-only, Experimental] The schema of the results. Present only for successful dry run of non-legacy SQL queries."
+ },
+ "statementType": {
+ "type": "string",
+ "description": "[Output-only, Experimental] The type of query statement, if valid."
+ },
+ "totalBytesBilled": {
+ "type": "string",
+ "description": "[Output-only] Total bytes billed for the job.",
+ "format": "int64"
+ },
+ "totalBytesProcessed": {
+ "type": "string",
+ "description": "[Output-only] Total bytes processed for the job.",
+ "format": "int64"
+ },
+ "undeclaredQueryParameters": {
+ "type": "array",
+ "description": "[Output-only, Experimental] Standard SQL only: list of undeclared query parameters detected during a dry run validation.",
+ "items": {
+ "$ref": "QueryParameter"
+ }
+ }
+ }
+ },
+ "JobStatistics3": {
+ "id": "JobStatistics3",
+ "type": "object",
+ "properties": {
+ "inputFileBytes": {
+ "type": "string",
+ "description": "[Output-only] Number of bytes of source data in a load job.",
+ "format": "int64"
+ },
+ "inputFiles": {
+ "type": "string",
+ "description": "[Output-only] Number of source files in a load job.",
+ "format": "int64"
+ },
+ "outputBytes": {
+ "type": "string",
+ "description": "[Output-only] Size of the loaded data in bytes. Note that while a load job is in the running state, this value may change.",
+ "format": "int64"
+ },
+ "outputRows": {
+ "type": "string",
+ "description": "[Output-only] Number of rows imported in a load job. Note that while an import job is in the running state, this value may change.",
+ "format": "int64"
+ }
+ }
+ },
+ "JobStatistics4": {
+ "id": "JobStatistics4",
+ "type": "object",
+ "properties": {
+ "destinationUriFileCounts": {
+ "type": "array",
+ "description": "[Output-only] Number of files per destination URI or URI pattern specified in the extract configuration. These values will be in the same order as the URIs specified in the 'destinationUris' field.",
+ "items": {
+ "type": "string",
+ "format": "int64"
+ }
+ }
+ }
+ },
+ "JobStatus": {
+ "id": "JobStatus",
+ "type": "object",
+ "properties": {
+ "errorResult": {
+ "$ref": "ErrorProto",
+ "description": "[Output-only] Final error result of the job. If present, indicates that the job has completed and was unsuccessful."
+ },
+ "errors": {
+ "type": "array",
+ "description": "[Output-only] All errors encountered during the running of the job. Errors here do not necessarily mean that the job has completed or was unsuccessful.",
+ "items": {
+ "$ref": "ErrorProto"
+ }
+ },
+ "state": {
+ "type": "string",
+ "description": "[Output-only] Running state of the job."
+ }
+ }
+ },
+ "JsonObject": {
+ "id": "JsonObject",
+ "type": "object",
+ "description": "Represents a single JSON object.",
+ "additionalProperties": {
+ "$ref": "JsonValue"
+ }
+ },
+ "JsonValue": {
+ "id": "JsonValue",
+ "type": "any"
+ },
+ "ProjectList": {
+ "id": "ProjectList",
+ "type": "object",
+ "properties": {
+ "etag": {
+ "type": "string",
+ "description": "A hash of the page of results"
+ },
+ "kind": {
+ "type": "string",
+ "description": "The type of list.",
+ "default": "bigquery#projectList"
+ },
+ "nextPageToken": {
+ "type": "string",
+ "description": "A token to request the next page of results."
+ },
+ "projects": {
+ "type": "array",
+ "description": "Projects to which you have at least READ access.",
+ "items": {
+ "type": "object",
+ "properties": {
+ "friendlyName": {
+ "type": "string",
+ "description": "A descriptive name for this project."
+ },
+ "id": {
+ "type": "string",
+ "description": "An opaque ID of this project."
+ },
+ "kind": {
+ "type": "string",
+ "description": "The resource type.",
+ "default": "bigquery#project"
+ },
+ "numericId": {
+ "type": "string",
+ "description": "The numeric ID of this project.",
+ "format": "uint64"
+ },
+ "projectReference": {
+ "$ref": "ProjectReference",
+ "description": "A unique reference to this project."
+ }
+ }
+ }
+ },
+ "totalItems": {
+ "type": "integer",
+ "description": "The total number of projects in the list.",
+ "format": "int32"
+ }
+ }
+ },
+ "ProjectReference": {
+ "id": "ProjectReference",
+ "type": "object",
+ "properties": {
+ "projectId": {
+ "type": "string",
+ "description": "[Required] ID of the project. Can be either the numeric ID or the assigned ID of the project."
+ }
+ }
+ },
+ "QueryParameter": {
+ "id": "QueryParameter",
+ "type": "object",
+ "properties": {
+ "name": {
+ "type": "string",
+ "description": "[Optional] If unset, this is a positional parameter. Otherwise, should be unique within a query."
+ },
+ "parameterType": {
+ "$ref": "QueryParameterType",
+ "description": "[Required] The type of this parameter."
+ },
+ "parameterValue": {
+ "$ref": "QueryParameterValue",
+ "description": "[Required] The value of this parameter."
+ }
+ }
+ },
+ "QueryParameterType": {
+ "id": "QueryParameterType",
+ "type": "object",
+ "properties": {
+ "arrayType": {
+ "$ref": "QueryParameterType",
+ "description": "[Optional] The type of the array's elements, if this is an array."
+ },
+ "structTypes": {
+ "type": "array",
+ "description": "[Optional] The types of the fields of this struct, in order, if this is a struct.",
+ "items": {
+ "type": "object",
+ "properties": {
+ "description": {
+ "type": "string",
+ "description": "[Optional] Human-oriented description of the field."
+ },
+ "name": {
+ "type": "string",
+ "description": "[Optional] The name of this field."
+ },
+ "type": {
+ "$ref": "QueryParameterType",
+ "description": "[Required] The type of this field."
+ }
+ }
+ }
+ },
+ "type": {
+ "type": "string",
+ "description": "[Required] The top level type of this field."
+ }
+ }
+ },
+ "QueryParameterValue": {
+ "id": "QueryParameterValue",
+ "type": "object",
+ "properties": {
+ "arrayValues": {
+ "type": "array",
+ "description": "[Optional] The array values, if this is an array type.",
+ "items": {
+ "$ref": "QueryParameterValue"
+ }
+ },
+ "structValues": {
+ "type": "object",
+ "description": "[Optional] The struct field values, in order of the struct type's declaration.",
+ "additionalProperties": {
+ "$ref": "QueryParameterValue"
+ }
+ },
+ "value": {
+ "type": "string",
+ "description": "[Optional] The value of this value, if a simple scalar type."
+ }
+ }
+ },
+ "QueryRequest": {
+ "id": "QueryRequest",
+ "type": "object",
+ "properties": {
+ "defaultDataset": {
+ "$ref": "DatasetReference",
+ "description": "[Optional] Specifies the default datasetId and projectId to assume for any unqualified table names in the query. If not set, all table names in the query string must be qualified in the format 'datasetId.tableId'."
+ },
+ "dryRun": {
+ "type": "boolean",
+ "description": "[Optional] If set to true, BigQuery doesn't run the job. Instead, if the query is valid, BigQuery returns statistics about the job such as how many bytes would be processed. If the query is invalid, an error returns. The default value is false."
+ },
+ "kind": {
+ "type": "string",
+ "description": "The resource type of the request.",
+ "default": "bigquery#queryRequest"
+ },
+ "maxResults": {
+ "type": "integer",
+ "description": "[Optional] The maximum number of rows of data to return per page of results. Setting this flag to a small value such as 1000 and then paging through results might improve reliability when the query result set is large. In addition to this limit, responses are also limited to 10 MB. By default, there is no maximum row count, and only the byte limit applies.",
+ "format": "uint32"
+ },
+ "parameterMode": {
+ "type": "string",
+ "description": "[Experimental] Standard SQL only. Whether to use positional (?) or named (@myparam) query parameters in this query."
+ },
+ "preserveNulls": {
+ "type": "boolean",
+ "description": "[Deprecated] This property is deprecated."
+ },
+ "query": {
+ "type": "string",
+ "description": "[Required] A query string, following the BigQuery query syntax, of the query to execute. Example: \"SELECT count(f1) FROM [myProjectId:myDatasetId.myTableId]\".",
+ "annotations": {
+ "required": [
+ "bigquery.jobs.query"
+ ]
+ }
+ },
+ "queryParameters": {
+ "type": "array",
+ "description": "[Experimental] Query parameters for Standard SQL queries.",
+ "items": {
+ "$ref": "QueryParameter"
+ }
+ },
+ "timeoutMs": {
+ "type": "integer",
+ "description": "[Optional] How long to wait for the query to complete, in milliseconds, before the request times out and returns. Note that this is only a timeout for the request, not the query. If the query takes longer to run than the timeout value, the call returns without any results and with the 'jobComplete' flag set to false. You can call GetQueryResults() to wait for the query to complete and read the results. The default value is 10000 milliseconds (10 seconds).",
+ "format": "uint32"
+ },
+ "useLegacySql": {
+ "type": "boolean",
+ "description": "Specifies whether to use BigQuery's legacy SQL dialect for this query. The default value is true. If set to false, the query will use BigQuery's standard SQL: https://cloud.google.com/bigquery/sql-reference/ When useLegacySql is set to false, the values of allowLargeResults and flattenResults are ignored; query will be run as if allowLargeResults is true and flattenResults is false.",
+ "default": "true"
+ },
+ "useQueryCache": {
+ "type": "boolean",
+ "description": "[Optional] Whether to look for the result in the query cache. The query cache is a best-effort cache that will be flushed whenever tables in the query are modified. The default value is true.",
+ "default": "true"
+ }
+ }
+ },
+ "QueryResponse": {
+ "id": "QueryResponse",
+ "type": "object",
+ "properties": {
+ "cacheHit": {
+ "type": "boolean",
+ "description": "Whether the query result was fetched from the query cache."
+ },
+ "errors": {
+ "type": "array",
+ "description": "[Output-only] All errors and warnings encountered during the running of the job. Errors here do not necessarily mean that the job has completed or was unsuccessful.",
+ "items": {
+ "$ref": "ErrorProto"
+ }
+ },
+ "jobComplete": {
+ "type": "boolean",
+ "description": "Whether the query has completed or not. If rows or totalRows are present, this will always be true. If this is false, totalRows will not be available."
+ },
+ "jobReference": {
+ "$ref": "JobReference",
+ "description": "Reference to the Job that was created to run the query. This field will be present even if the original request timed out, in which case GetQueryResults can be used to read the results once the query has completed. Since this API only returns the first page of results, subsequent pages can be fetched via the same mechanism (GetQueryResults)."
+ },
+ "kind": {
+ "type": "string",
+ "description": "The resource type.",
+ "default": "bigquery#queryResponse"
+ },
+ "numDmlAffectedRows": {
+ "type": "string",
+ "description": "[Output-only, Experimental] The number of rows affected by a DML statement. Present only for DML statements INSERT, UPDATE or DELETE.",
+ "format": "int64"
+ },
+ "pageToken": {
+ "type": "string",
+ "description": "A token used for paging results."
+ },
+ "rows": {
+ "type": "array",
+ "description": "An object with as many results as can be contained within the maximum permitted reply size. To get any additional rows, you can call GetQueryResults and specify the jobReference returned above.",
+ "items": {
+ "$ref": "TableRow"
+ }
+ },
+ "schema": {
+ "$ref": "TableSchema",
+ "description": "The schema of the results. Present only when the query completes successfully."
+ },
+ "totalBytesProcessed": {
+ "type": "string",
+ "description": "The total number of bytes processed for this query. If this query was a dry run, this is the number of bytes that would be processed if the query were run.",
+ "format": "int64"
+ },
+ "totalRows": {
+ "type": "string",
+ "description": "The total number of rows in the complete query result set, which can be more than the number of rows in this single page of results.",
+ "format": "uint64"
+ }
+ }
+ },
+ "Streamingbuffer": {
+ "id": "Streamingbuffer",
+ "type": "object",
+ "properties": {
+ "estimatedBytes": {
+ "type": "string",
+ "description": "[Output-only] A lower-bound estimate of the number of bytes currently in the streaming buffer.",
+ "format": "uint64"
+ },
+ "estimatedRows": {
+ "type": "string",
+ "description": "[Output-only] A lower-bound estimate of the number of rows currently in the streaming buffer.",
+ "format": "uint64"
+ },
+ "oldestEntryTime": {
+ "type": "string",
+ "description": "[Output-only] Contains the timestamp of the oldest entry in the streaming buffer, in milliseconds since the epoch, if the streaming buffer is available.",
+ "format": "uint64"
+ }
+ }
+ },
+ "Table": {
+ "id": "Table",
+ "type": "object",
+ "properties": {
+ "creationTime": {
+ "type": "string",
+ "description": "[Output-only] The time when this table was created, in milliseconds since the epoch.",
+ "format": "int64"
+ },
+ "description": {
+ "type": "string",
+ "description": "[Optional] A user-friendly description of this table."
+ },
+ "etag": {
+ "type": "string",
+ "description": "[Output-only] A hash of this resource."
+ },
+ "expirationTime": {
+ "type": "string",
+ "description": "[Optional] The time when this table expires, in milliseconds since the epoch. If not present, the table will persist indefinitely. Expired tables will be deleted and their storage reclaimed.",
+ "format": "int64"
+ },
+ "externalDataConfiguration": {
+ "$ref": "ExternalDataConfiguration",
+ "description": "[Optional] Describes the data format, location, and other properties of a table stored outside of BigQuery. By defining these properties, the data source can then be queried as if it were a standard BigQuery table."
+ },
+ "friendlyName": {
+ "type": "string",
+ "description": "[Optional] A descriptive name for this table."
+ },
+ "id": {
+ "type": "string",
+ "description": "[Output-only] An opaque ID uniquely identifying the table."
+ },
+ "kind": {
+ "type": "string",
+ "description": "[Output-only] The type of the resource.",
+ "default": "bigquery#table"
+ },
+ "labels": {
+ "type": "object",
+ "description": "[Experimental] The labels associated with this table. You can use these to organize and group your tables. Label keys and values can be no longer than 63 characters, can only contain letters, numeric characters, underscores and dashes. International characters are allowed. Label values are optional. Label keys must start with a letter and must be unique within a dataset. Both keys and values are additionally constrained to be \u003c= 128 bytes in size.",
+ "additionalProperties": {
+ "type": "string"
+ }
+ },
+ "lastModifiedTime": {
+ "type": "string",
+ "description": "[Output-only] The time when this table was last modified, in milliseconds since the epoch.",
+ "format": "uint64"
+ },
+ "location": {
+ "type": "string",
+ "description": "[Output-only] The geographic location where the table resides. This value is inherited from the dataset."
+ },
+ "numBytes": {
+ "type": "string",
+ "description": "[Output-only] The size of this table in bytes, excluding any data in the streaming buffer.",
+ "format": "int64"
+ },
+ "numLongTermBytes": {
+ "type": "string",
+ "description": "[Output-only] The number of bytes in the table that are considered \"long-term storage\".",
+ "format": "int64"
+ },
+ "numRows": {
+ "type": "string",
+ "description": "[Output-only] The number of rows of data in this table, excluding any data in the streaming buffer.",
+ "format": "uint64"
+ },
+ "schema": {
+ "$ref": "TableSchema",
+ "description": "[Optional] Describes the schema of this table."
+ },
+ "selfLink": {
+ "type": "string",
+ "description": "[Output-only] A URL that can be used to access this resource again."
+ },
+ "streamingBuffer": {
+ "$ref": "Streamingbuffer",
+ "description": "[Output-only] Contains information regarding this table's streaming buffer, if one is present. This field will be absent if the table is not being streamed to or if there is no data in the streaming buffer."
+ },
+ "tableReference": {
+ "$ref": "TableReference",
+ "description": "[Required] Reference describing the ID of this table."
+ },
+ "timePartitioning": {
+ "$ref": "TimePartitioning",
+ "description": "[Experimental] If specified, configures time-based partitioning for this table."
+ },
+ "type": {
+ "type": "string",
+ "description": "[Output-only] Describes the table type. The following values are supported: TABLE: A normal BigQuery table. VIEW: A virtual table defined by a SQL query. EXTERNAL: A table that references data stored in an external storage system, such as Google Cloud Storage. The default value is TABLE."
+ },
+ "view": {
+ "$ref": "ViewDefinition",
+ "description": "[Optional] The view definition."
+ }
+ }
+ },
+ "TableCell": {
+ "id": "TableCell",
+ "type": "object",
+ "properties": {
+ "v": {
+ "type": "any"
+ }
+ }
+ },
+ "TableDataInsertAllRequest": {
+ "id": "TableDataInsertAllRequest",
+ "type": "object",
+ "properties": {
+ "ignoreUnknownValues": {
+ "type": "boolean",
+ "description": "[Optional] Accept rows that contain values that do not match the schema. The unknown values are ignored. Default is false, which treats unknown values as errors."
+ },
+ "kind": {
+ "type": "string",
+ "description": "The resource type of the response.",
+ "default": "bigquery#tableDataInsertAllRequest"
+ },
+ "rows": {
+ "type": "array",
+ "description": "The rows to insert.",
+ "items": {
+ "type": "object",
+ "properties": {
+ "insertId": {
+ "type": "string",
+ "description": "[Optional] A unique ID for each row. BigQuery uses this property to detect duplicate insertion requests on a best-effort basis."
+ },
+ "json": {
+ "$ref": "JsonObject",
+ "description": "[Required] A JSON object that contains a row of data. The object's properties and values must match the destination table's schema."
+ }
+ }
+ }
+ },
+ "skipInvalidRows": {
+ "type": "boolean",
+ "description": "[Optional] Insert all valid rows of a request, even if invalid rows exist. The default value is false, which causes the entire request to fail if any invalid rows exist."
+ },
+ "templateSuffix": {
+ "type": "string",
+ "description": "[Experimental] If specified, treats the destination table as a base template, and inserts the rows into an instance table named \"{destination}{templateSuffix}\". BigQuery will manage creation of the instance table, using the schema of the base template table. See https://cloud.google.com/bigquery/streaming-data-into-bigquery#template-tables for considerations when working with templates tables."
+ }
+ }
+ },
+ "TableDataInsertAllResponse": {
+ "id": "TableDataInsertAllResponse",
+ "type": "object",
+ "properties": {
+ "insertErrors": {
+ "type": "array",
+ "description": "An array of errors for rows that were not inserted.",
+ "items": {
+ "type": "object",
+ "properties": {
+ "errors": {
+ "type": "array",
+ "description": "Error information for the row indicated by the index property.",
+ "items": {
+ "$ref": "ErrorProto"
+ }
+ },
+ "index": {
+ "type": "integer",
+ "description": "The index of the row that error applies to.",
+ "format": "uint32"
+ }
+ }
+ }
+ },
+ "kind": {
+ "type": "string",
+ "description": "The resource type of the response.",
+ "default": "bigquery#tableDataInsertAllResponse"
+ }
+ }
+ },
+ "TableDataList": {
+ "id": "TableDataList",
+ "type": "object",
+ "properties": {
+ "etag": {
+ "type": "string",
+ "description": "A hash of this page of results."
+ },
+ "kind": {
+ "type": "string",
+ "description": "The resource type of the response.",
+ "default": "bigquery#tableDataList"
+ },
+ "pageToken": {
+ "type": "string",
+ "description": "A token used for paging results. Providing this token instead of the startIndex parameter can help you retrieve stable results when an underlying table is changing."
+ },
+ "rows": {
+ "type": "array",
+ "description": "Rows of results.",
+ "items": {
+ "$ref": "TableRow"
+ }
+ },
+ "totalRows": {
+ "type": "string",
+ "description": "The total number of rows in the complete table.",
+ "format": "int64"
+ }
+ }
+ },
+ "TableFieldSchema": {
+ "id": "TableFieldSchema",
+ "type": "object",
+ "properties": {
+ "description": {
+ "type": "string",
+ "description": "[Optional] The field description. The maximum length is 16K characters."
+ },
+ "fields": {
+ "type": "array",
+ "description": "[Optional] Describes the nested schema fields if the type property is set to RECORD.",
+ "items": {
+ "$ref": "TableFieldSchema"
+ }
+ },
+ "mode": {
+ "type": "string",
+ "description": "[Optional] The field mode. Possible values include NULLABLE, REQUIRED and REPEATED. The default value is NULLABLE."
+ },
+ "name": {
+ "type": "string",
+ "description": "[Required] The field name. The name must contain only letters (a-z, A-Z), numbers (0-9), or underscores (_), and must start with a letter or underscore. The maximum length is 128 characters."
+ },
+ "type": {
+ "type": "string",
+ "description": "[Required] The field data type. Possible values include STRING, BYTES, INTEGER, INT64 (same as INTEGER), FLOAT, FLOAT64 (same as FLOAT), BOOLEAN, BOOL (same as BOOLEAN), TIMESTAMP, DATE, TIME, DATETIME, RECORD (where RECORD indicates that the field contains a nested schema) or STRUCT (same as RECORD)."
+ }
+ }
+ },
+ "TableList": {
+ "id": "TableList",
+ "type": "object",
+ "properties": {
+ "etag": {
+ "type": "string",
+ "description": "A hash of this page of results."
+ },
+ "kind": {
+ "type": "string",
+ "description": "The type of list.",
+ "default": "bigquery#tableList"
+ },
+ "nextPageToken": {
+ "type": "string",
+ "description": "A token to request the next page of results."
+ },
+ "tables": {
+ "type": "array",
+ "description": "Tables in the requested dataset.",
+ "items": {
+ "type": "object",
+ "properties": {
+ "friendlyName": {
+ "type": "string",
+ "description": "The user-friendly name for this table."
+ },
+ "id": {
+ "type": "string",
+ "description": "An opaque ID of the table"
+ },
+ "kind": {
+ "type": "string",
+ "description": "The resource type.",
+ "default": "bigquery#table"
+ },
+ "labels": {
+ "type": "object",
+ "description": "[Experimental] The labels associated with this table. You can use these to organize and group your tables.",
+ "additionalProperties": {
+ "type": "string"
+ }
+ },
+ "tableReference": {
+ "$ref": "TableReference",
+ "description": "A reference uniquely identifying the table."
+ },
+ "type": {
+ "type": "string",
+ "description": "The type of table. Possible values are: TABLE, VIEW."
+ }
+ }
+ }
+ },
+ "totalItems": {
+ "type": "integer",
+ "description": "The total number of tables in the dataset.",
+ "format": "int32"
+ }
+ }
+ },
+ "TableReference": {
+ "id": "TableReference",
+ "type": "object",
+ "properties": {
+ "datasetId": {
+ "type": "string",
+ "description": "[Required] The ID of the dataset containing this table.",
+ "annotations": {
+ "required": [
+ "bigquery.tables.update"
+ ]
+ }
+ },
+ "projectId": {
+ "type": "string",
+ "description": "[Required] The ID of the project containing this table.",
+ "annotations": {
+ "required": [
+ "bigquery.tables.update"
+ ]
+ }
+ },
+ "tableId": {
+ "type": "string",
+ "description": "[Required] The ID of the table. The ID must contain only letters (a-z, A-Z), numbers (0-9), or underscores (_). The maximum length is 1,024 characters.",
+ "annotations": {
+ "required": [
+ "bigquery.tables.update"
+ ]
+ }
+ }
+ }
+ },
+ "TableRow": {
+ "id": "TableRow",
+ "type": "object",
+ "properties": {
+ "f": {
+ "type": "array",
+ "description": "Represents a single row in the result set, consisting of one or more fields.",
+ "items": {
+ "$ref": "TableCell"
+ }
+ }
+ }
+ },
+ "TableSchema": {
+ "id": "TableSchema",
+ "type": "object",
+ "properties": {
+ "fields": {
+ "type": "array",
+ "description": "Describes the fields in a table.",
+ "items": {
+ "$ref": "TableFieldSchema"
+ }
+ }
+ }
+ },
+ "TimePartitioning": {
+ "id": "TimePartitioning",
+ "type": "object",
+ "properties": {
+ "expirationMs": {
+ "type": "string",
+ "description": "[Optional] Number of milliseconds for which to keep the storage for a partition.",
+ "format": "int64"
+ },
+ "type": {
+ "type": "string",
+ "description": "[Required] The only type supported is DAY, which will generate one partition per day based on data loading time."
+ }
+ }
+ },
+ "UserDefinedFunctionResource": {
+ "id": "UserDefinedFunctionResource",
+ "type": "object",
+ "properties": {
+ "inlineCode": {
+ "type": "string",
+ "description": "[Pick one] An inline resource that contains code for a user-defined function (UDF). Providing a inline code resource is equivalent to providing a URI for a file containing the same code."
+ },
+ "resourceUri": {
+ "type": "string",
+ "description": "[Pick one] A code resource to load from a Google Cloud Storage URI (gs://bucket/path)."
+ }
+ }
+ },
+ "ViewDefinition": {
+ "id": "ViewDefinition",
+ "type": "object",
+ "properties": {
+ "query": {
+ "type": "string",
+ "description": "[Required] A query that BigQuery executes when the view is referenced."
+ },
+ "useLegacySql": {
+ "type": "boolean",
+ "description": "Specifies whether to use BigQuery's legacy SQL for this view. The default value is true. If set to false, the view will use BigQuery's standard SQL: https://cloud.google.com/bigquery/sql-reference/ Queries and views that reference this view must use the same flag value."
+ },
+ "userDefinedFunctionResources": {
+ "type": "array",
+ "description": "[Experimental] Describes user-defined function resources used in the query.",
+ "items": {
+ "$ref": "UserDefinedFunctionResource"
+ }
+ }
+ }
+ }
+ },
+ "resources": {
+ "datasets": {
+ "methods": {
+ "delete": {
+ "id": "bigquery.datasets.delete",
+ "path": "projects/{projectId}/datasets/{datasetId}",
+ "httpMethod": "DELETE",
+ "description": "Deletes the dataset specified by the datasetId value. Before you can delete a dataset, you must delete all its tables, either manually or by specifying deleteContents. Immediately after deletion, you can create another dataset with the same name.",
+ "parameters": {
+ "datasetId": {
+ "type": "string",
+ "description": "Dataset ID of dataset being deleted",
+ "required": true,
+ "location": "path"
+ },
+ "deleteContents": {
+ "type": "boolean",
+ "description": "If True, delete all the tables in the dataset. If False and the dataset contains tables, the request will fail. Default is False",
+ "location": "query"
+ },
+ "projectId": {
+ "type": "string",
+ "description": "Project ID of the dataset being deleted",
+ "required": true,
+ "location": "path"
+ }
+ },
+ "parameterOrder": [
+ "projectId",
+ "datasetId"
+ ],
+ "scopes": [
+ "https://www.googleapis.com/auth/bigquery",
+ "https://www.googleapis.com/auth/cloud-platform"
+ ]
+ },
+ "get": {
+ "id": "bigquery.datasets.get",
+ "path": "projects/{projectId}/datasets/{datasetId}",
+ "httpMethod": "GET",
+ "description": "Returns the dataset specified by datasetID.",
+ "parameters": {
+ "datasetId": {
+ "type": "string",
+ "description": "Dataset ID of the requested dataset",
+ "required": true,
+ "location": "path"
+ },
+ "projectId": {
+ "type": "string",
+ "description": "Project ID of the requested dataset",
+ "required": true,
+ "location": "path"
+ }
+ },
+ "parameterOrder": [
+ "projectId",
+ "datasetId"
+ ],
+ "response": {
+ "$ref": "Dataset"
+ },
+ "scopes": [
+ "https://www.googleapis.com/auth/bigquery",
+ "https://www.googleapis.com/auth/cloud-platform",
+ "https://www.googleapis.com/auth/cloud-platform.read-only"
+ ]
+ },
+ "insert": {
+ "id": "bigquery.datasets.insert",
+ "path": "projects/{projectId}/datasets",
+ "httpMethod": "POST",
+ "description": "Creates a new empty dataset.",
+ "parameters": {
+ "projectId": {
+ "type": "string",
+ "description": "Project ID of the new dataset",
+ "required": true,
+ "location": "path"
+ }
+ },
+ "parameterOrder": [
+ "projectId"
+ ],
+ "request": {
+ "$ref": "Dataset"
+ },
+ "response": {
+ "$ref": "Dataset"
+ },
+ "scopes": [
+ "https://www.googleapis.com/auth/bigquery",
+ "https://www.googleapis.com/auth/cloud-platform"
+ ]
+ },
+ "list": {
+ "id": "bigquery.datasets.list",
+ "path": "projects/{projectId}/datasets",
+ "httpMethod": "GET",
+ "description": "Lists all datasets in the specified project to which you have been granted the READER dataset role.",
+ "parameters": {
+ "all": {
+ "type": "boolean",
+ "description": "Whether to list all datasets, including hidden ones",
+ "location": "query"
+ },
+ "filter": {
+ "type": "string",
+ "description": "An expression for filtering the results of the request by label. The syntax is \"labels.\u003cname\u003e[:\u003cvalue\u003e]\". Multiple filters can be ANDed together by connecting with a space. Example: \"labels.department:receiving labels.active\". See Filtering datasets using labels for details.",
+ "location": "query"
+ },
+ "maxResults": {
+ "type": "integer",
+ "description": "The maximum number of results to return",
+ "format": "uint32",
+ "location": "query"
+ },
+ "pageToken": {
+ "type": "string",
+ "description": "Page token, returned by a previous call, to request the next page of results",
+ "location": "query"
+ },
+ "projectId": {
+ "type": "string",
+ "description": "Project ID of the datasets to be listed",
+ "required": true,
+ "location": "path"
+ }
+ },
+ "parameterOrder": [
+ "projectId"
+ ],
+ "response": {
+ "$ref": "DatasetList"
+ },
+ "scopes": [
+ "https://www.googleapis.com/auth/bigquery",
+ "https://www.googleapis.com/auth/cloud-platform",
+ "https://www.googleapis.com/auth/cloud-platform.read-only"
+ ]
+ },
+ "patch": {
+ "id": "bigquery.datasets.patch",
+ "path": "projects/{projectId}/datasets/{datasetId}",
+ "httpMethod": "PATCH",
+ "description": "Updates information in an existing dataset. The update method replaces the entire dataset resource, whereas the patch method only replaces fields that are provided in the submitted dataset resource. This method supports patch semantics.",
+ "parameters": {
+ "datasetId": {
+ "type": "string",
+ "description": "Dataset ID of the dataset being updated",
+ "required": true,
+ "location": "path"
+ },
+ "projectId": {
+ "type": "string",
+ "description": "Project ID of the dataset being updated",
+ "required": true,
+ "location": "path"
+ }
+ },
+ "parameterOrder": [
+ "projectId",
+ "datasetId"
+ ],
+ "request": {
+ "$ref": "Dataset"
+ },
+ "response": {
+ "$ref": "Dataset"
+ },
+ "scopes": [
+ "https://www.googleapis.com/auth/bigquery",
+ "https://www.googleapis.com/auth/cloud-platform"
+ ]
+ },
+ "update": {
+ "id": "bigquery.datasets.update",
+ "path": "projects/{projectId}/datasets/{datasetId}",
+ "httpMethod": "PUT",
+ "description": "Updates information in an existing dataset. The update method replaces the entire dataset resource, whereas the patch method only replaces fields that are provided in the submitted dataset resource.",
+ "parameters": {
+ "datasetId": {
+ "type": "string",
+ "description": "Dataset ID of the dataset being updated",
+ "required": true,
+ "location": "path"
+ },
+ "projectId": {
+ "type": "string",
+ "description": "Project ID of the dataset being updated",
+ "required": true,
+ "location": "path"
+ }
+ },
+ "parameterOrder": [
+ "projectId",
+ "datasetId"
+ ],
+ "request": {
+ "$ref": "Dataset"
+ },
+ "response": {
+ "$ref": "Dataset"
+ },
+ "scopes": [
+ "https://www.googleapis.com/auth/bigquery",
+ "https://www.googleapis.com/auth/cloud-platform"
+ ]
+ }
+ }
+ },
+ "jobs": {
+ "methods": {
+ "cancel": {
+ "id": "bigquery.jobs.cancel",
+ "path": "projects/{projectId}/jobs/{jobId}/cancel",
+ "httpMethod": "POST",
+ "description": "Requests that a job be cancelled. This call will return immediately, and the client will need to poll for the job status to see if the cancel completed successfully. Cancelled jobs may still incur costs.",
+ "parameters": {
+ "jobId": {
+ "type": "string",
+ "description": "[Required] Job ID of the job to cancel",
+ "required": true,
+ "location": "path"
+ },
+ "projectId": {
+ "type": "string",
+ "description": "[Required] Project ID of the job to cancel",
+ "required": true,
+ "location": "path"
+ }
+ },
+ "parameterOrder": [
+ "projectId",
+ "jobId"
+ ],
+ "response": {
+ "$ref": "JobCancelResponse"
+ },
+ "scopes": [
+ "https://www.googleapis.com/auth/bigquery",
+ "https://www.googleapis.com/auth/cloud-platform"
+ ]
+ },
+ "get": {
+ "id": "bigquery.jobs.get",
+ "path": "projects/{projectId}/jobs/{jobId}",
+ "httpMethod": "GET",
+ "description": "Returns information about a specific job. Job information is available for a six month period after creation. Requires that you're the person who ran the job, or have the Is Owner project role.",
+ "parameters": {
+ "jobId": {
+ "type": "string",
+ "description": "[Required] Job ID of the requested job",
+ "required": true,
+ "location": "path"
+ },
+ "projectId": {
+ "type": "string",
+ "description": "[Required] Project ID of the requested job",
+ "required": true,
+ "location": "path"
+ }
+ },
+ "parameterOrder": [
+ "projectId",
+ "jobId"
+ ],
+ "response": {
+ "$ref": "Job"
+ },
+ "scopes": [
+ "https://www.googleapis.com/auth/bigquery",
+ "https://www.googleapis.com/auth/cloud-platform",
+ "https://www.googleapis.com/auth/cloud-platform.read-only"
+ ]
+ },
+ "getQueryResults": {
+ "id": "bigquery.jobs.getQueryResults",
+ "path": "projects/{projectId}/queries/{jobId}",
+ "httpMethod": "GET",
+ "description": "Retrieves the results of a query job.",
+ "parameters": {
+ "jobId": {
+ "type": "string",
+ "description": "[Required] Job ID of the query job",
+ "required": true,
+ "location": "path"
+ },
+ "maxResults": {
+ "type": "integer",
+ "description": "Maximum number of results to read",
+ "format": "uint32",
+ "location": "query"
+ },
+ "pageToken": {
+ "type": "string",
+ "description": "Page token, returned by a previous call, to request the next page of results",
+ "location": "query"
+ },
+ "projectId": {
+ "type": "string",
+ "description": "[Required] Project ID of the query job",
+ "required": true,
+ "location": "path"
+ },
+ "startIndex": {
+ "type": "string",
+ "description": "Zero-based index of the starting row",
+ "format": "uint64",
+ "location": "query"
+ },
+ "timeoutMs": {
+ "type": "integer",
+ "description": "How long to wait for the query to complete, in milliseconds, before returning. Default is 10 seconds. If the timeout passes before the job completes, the 'jobComplete' field in the response will be false",
+ "format": "uint32",
+ "location": "query"
+ }
+ },
+ "parameterOrder": [
+ "projectId",
+ "jobId"
+ ],
+ "response": {
+ "$ref": "GetQueryResultsResponse"
+ },
+ "scopes": [
+ "https://www.googleapis.com/auth/bigquery",
+ "https://www.googleapis.com/auth/cloud-platform",
+ "https://www.googleapis.com/auth/cloud-platform.read-only"
+ ]
+ },
+ "insert": {
+ "id": "bigquery.jobs.insert",
+ "path": "projects/{projectId}/jobs",
+ "httpMethod": "POST",
+ "description": "Starts a new asynchronous job. Requires the Can View project role.",
+ "parameters": {
+ "projectId": {
+ "type": "string",
+ "description": "Project ID of the project that will be billed for the job",
+ "required": true,
+ "location": "path"
+ }
+ },
+ "parameterOrder": [
+ "projectId"
+ ],
+ "request": {
+ "$ref": "Job"
+ },
+ "response": {
+ "$ref": "Job"
+ },
+ "scopes": [
+ "https://www.googleapis.com/auth/bigquery",
+ "https://www.googleapis.com/auth/cloud-platform",
+ "https://www.googleapis.com/auth/devstorage.full_control",
+ "https://www.googleapis.com/auth/devstorage.read_only",
+ "https://www.googleapis.com/auth/devstorage.read_write"
+ ],
+ "supportsMediaUpload": true,
+ "mediaUpload": {
+ "accept": [
+ "*/*"
+ ],
+ "protocols": {
+ "simple": {
+ "multipart": true,
+ "path": "/upload/bigquery/v2/projects/{projectId}/jobs"
+ },
+ "resumable": {
+ "multipart": true,
+ "path": "/resumable/upload/bigquery/v2/projects/{projectId}/jobs"
+ }
+ }
+ }
+ },
+ "list": {
+ "id": "bigquery.jobs.list",
+ "path": "projects/{projectId}/jobs",
+ "httpMethod": "GET",
+ "description": "Lists all jobs that you started in the specified project. Job information is available for a six month period after creation. The job list is sorted in reverse chronological order, by job creation time. Requires the Can View project role, or the Is Owner project role if you set the allUsers property.",
+ "parameters": {
+ "allUsers": {
+ "type": "boolean",
+ "description": "Whether to display jobs owned by all users in the project. Default false",
+ "location": "query"
+ },
+ "maxResults": {
+ "type": "integer",
+ "description": "Maximum number of results to return",
+ "format": "uint32",
+ "location": "query"
+ },
+ "pageToken": {
+ "type": "string",
+ "description": "Page token, returned by a previous call, to request the next page of results",
+ "location": "query"
+ },
+ "projectId": {
+ "type": "string",
+ "description": "Project ID of the jobs to list",
+ "required": true,
+ "location": "path"
+ },
+ "projection": {
+ "type": "string",
+ "description": "Restrict information returned to a set of selected fields",
+ "enum": [
+ "full",
+ "minimal"
+ ],
+ "enumDescriptions": [
+ "Includes all job data",
+ "Does not include the job configuration"
+ ],
+ "location": "query"
+ },
+ "stateFilter": {
+ "type": "string",
+ "description": "Filter for job state",
+ "enum": [
+ "done",
+ "pending",
+ "running"
+ ],
+ "enumDescriptions": [
+ "Finished jobs",
+ "Pending jobs",
+ "Running jobs"
+ ],
+ "repeated": true,
+ "location": "query"
+ }
+ },
+ "parameterOrder": [
+ "projectId"
+ ],
+ "response": {
+ "$ref": "JobList"
+ },
+ "scopes": [
+ "https://www.googleapis.com/auth/bigquery",
+ "https://www.googleapis.com/auth/cloud-platform",
+ "https://www.googleapis.com/auth/cloud-platform.read-only"
+ ]
+ },
+ "query": {
+ "id": "bigquery.jobs.query",
+ "path": "projects/{projectId}/queries",
+ "httpMethod": "POST",
+ "description": "Runs a BigQuery SQL query synchronously and returns query results if the query completes within a specified timeout.",
+ "parameters": {
+ "projectId": {
+ "type": "string",
+ "description": "Project ID of the project billed for the query",
+ "required": true,
+ "location": "path"
+ }
+ },
+ "parameterOrder": [
+ "projectId"
+ ],
+ "request": {
+ "$ref": "QueryRequest"
+ },
+ "response": {
+ "$ref": "QueryResponse"
+ },
+ "scopes": [
+ "https://www.googleapis.com/auth/bigquery",
+ "https://www.googleapis.com/auth/cloud-platform",
+ "https://www.googleapis.com/auth/cloud-platform.read-only"
+ ]
+ }
+ }
+ },
+ "projects": {
+ "methods": {
+ "list": {
+ "id": "bigquery.projects.list",
+ "path": "projects",
+ "httpMethod": "GET",
+ "description": "Lists all projects to which you have been granted any project role.",
+ "parameters": {
+ "maxResults": {
+ "type": "integer",
+ "description": "Maximum number of results to return",
+ "format": "uint32",
+ "location": "query"
+ },
+ "pageToken": {
+ "type": "string",
+ "description": "Page token, returned by a previous call, to request the next page of results",
+ "location": "query"
+ }
+ },
+ "response": {
+ "$ref": "ProjectList"
+ },
+ "scopes": [
+ "https://www.googleapis.com/auth/bigquery",
+ "https://www.googleapis.com/auth/cloud-platform",
+ "https://www.googleapis.com/auth/cloud-platform.read-only"
+ ]
+ }
+ }
+ },
+ "tabledata": {
+ "methods": {
+ "insertAll": {
+ "id": "bigquery.tabledata.insertAll",
+ "path": "projects/{projectId}/datasets/{datasetId}/tables/{tableId}/insertAll",
+ "httpMethod": "POST",
+ "description": "Streams data into BigQuery one record at a time without needing to run a load job. Requires the WRITER dataset role.",
+ "parameters": {
+ "datasetId": {
+ "type": "string",
+ "description": "Dataset ID of the destination table.",
+ "required": true,
+ "location": "path"
+ },
+ "projectId": {
+ "type": "string",
+ "description": "Project ID of the destination table.",
+ "required": true,
+ "location": "path"
+ },
+ "tableId": {
+ "type": "string",
+ "description": "Table ID of the destination table.",
+ "required": true,
+ "location": "path"
+ }
+ },
+ "parameterOrder": [
+ "projectId",
+ "datasetId",
+ "tableId"
+ ],
+ "request": {
+ "$ref": "TableDataInsertAllRequest"
+ },
+ "response": {
+ "$ref": "TableDataInsertAllResponse"
+ },
+ "scopes": [
+ "https://www.googleapis.com/auth/bigquery",
+ "https://www.googleapis.com/auth/bigquery.insertdata",
+ "https://www.googleapis.com/auth/cloud-platform"
+ ]
+ },
+ "list": {
+ "id": "bigquery.tabledata.list",
+ "path": "projects/{projectId}/datasets/{datasetId}/tables/{tableId}/data",
+ "httpMethod": "GET",
+ "description": "Retrieves table data from a specified set of rows. Requires the READER dataset role.",
+ "parameters": {
+ "datasetId": {
+ "type": "string",
+ "description": "Dataset ID of the table to read",
+ "required": true,
+ "location": "path"
+ },
+ "maxResults": {
+ "type": "integer",
+ "description": "Maximum number of results to return",
+ "format": "uint32",
+ "location": "query"
+ },
+ "pageToken": {
+ "type": "string",
+ "description": "Page token, returned by a previous call, identifying the result set",
+ "location": "query"
+ },
+ "projectId": {
+ "type": "string",
+ "description": "Project ID of the table to read",
+ "required": true,
+ "location": "path"
+ },
+ "startIndex": {
+ "type": "string",
+ "description": "Zero-based index of the starting row to read",
+ "format": "uint64",
+ "location": "query"
+ },
+ "tableId": {
+ "type": "string",
+ "description": "Table ID of the table to read",
+ "required": true,
+ "location": "path"
+ }
+ },
+ "parameterOrder": [
+ "projectId",
+ "datasetId",
+ "tableId"
+ ],
+ "response": {
+ "$ref": "TableDataList"
+ },
+ "scopes": [
+ "https://www.googleapis.com/auth/bigquery",
+ "https://www.googleapis.com/auth/cloud-platform",
+ "https://www.googleapis.com/auth/cloud-platform.read-only"
+ ]
+ }
+ }
+ },
+ "tables": {
+ "methods": {
+ "delete": {
+ "id": "bigquery.tables.delete",
+ "path": "projects/{projectId}/datasets/{datasetId}/tables/{tableId}",
+ "httpMethod": "DELETE",
+ "description": "Deletes the table specified by tableId from the dataset. If the table contains data, all the data will be deleted.",
+ "parameters": {
+ "datasetId": {
+ "type": "string",
+ "description": "Dataset ID of the table to delete",
+ "required": true,
+ "location": "path"
+ },
+ "projectId": {
+ "type": "string",
+ "description": "Project ID of the table to delete",
+ "required": true,
+ "location": "path"
+ },
+ "tableId": {
+ "type": "string",
+ "description": "Table ID of the table to delete",
+ "required": true,
+ "location": "path"
+ }
+ },
+ "parameterOrder": [
+ "projectId",
+ "datasetId",
+ "tableId"
+ ],
+ "scopes": [
+ "https://www.googleapis.com/auth/bigquery",
+ "https://www.googleapis.com/auth/cloud-platform"
+ ]
+ },
+ "get": {
+ "id": "bigquery.tables.get",
+ "path": "projects/{projectId}/datasets/{datasetId}/tables/{tableId}",
+ "httpMethod": "GET",
+ "description": "Gets the specified table resource by table ID. This method does not return the data in the table, it only returns the table resource, which describes the structure of this table.",
+ "parameters": {
+ "datasetId": {
+ "type": "string",
+ "description": "Dataset ID of the requested table",
+ "required": true,
+ "location": "path"
+ },
+ "projectId": {
+ "type": "string",
+ "description": "Project ID of the requested table",
+ "required": true,
+ "location": "path"
+ },
+ "tableId": {
+ "type": "string",
+ "description": "Table ID of the requested table",
+ "required": true,
+ "location": "path"
+ }
+ },
+ "parameterOrder": [
+ "projectId",
+ "datasetId",
+ "tableId"
+ ],
+ "response": {
+ "$ref": "Table"
+ },
+ "scopes": [
+ "https://www.googleapis.com/auth/bigquery",
+ "https://www.googleapis.com/auth/cloud-platform",
+ "https://www.googleapis.com/auth/cloud-platform.read-only"
+ ]
+ },
+ "insert": {
+ "id": "bigquery.tables.insert",
+ "path": "projects/{projectId}/datasets/{datasetId}/tables",
+ "httpMethod": "POST",
+ "description": "Creates a new, empty table in the dataset.",
+ "parameters": {
+ "datasetId": {
+ "type": "string",
+ "description": "Dataset ID of the new table",
+ "required": true,
+ "location": "path"
+ },
+ "projectId": {
+ "type": "string",
+ "description": "Project ID of the new table",
+ "required": true,
+ "location": "path"
+ }
+ },
+ "parameterOrder": [
+ "projectId",
+ "datasetId"
+ ],
+ "request": {
+ "$ref": "Table"
+ },
+ "response": {
+ "$ref": "Table"
+ },
+ "scopes": [
+ "https://www.googleapis.com/auth/bigquery",
+ "https://www.googleapis.com/auth/cloud-platform"
+ ]
+ },
+ "list": {
+ "id": "bigquery.tables.list",
+ "path": "projects/{projectId}/datasets/{datasetId}/tables",
+ "httpMethod": "GET",
+ "description": "Lists all tables in the specified dataset. Requires the READER dataset role.",
+ "parameters": {
+ "datasetId": {
+ "type": "string",
+ "description": "Dataset ID of the tables to list",
+ "required": true,
+ "location": "path"
+ },
+ "maxResults": {
+ "type": "integer",
+ "description": "Maximum number of results to return",
+ "format": "uint32",
+ "location": "query"
+ },
+ "pageToken": {
+ "type": "string",
+ "description": "Page token, returned by a previous call, to request the next page of results",
+ "location": "query"
+ },
+ "projectId": {
+ "type": "string",
+ "description": "Project ID of the tables to list",
+ "required": true,
+ "location": "path"
+ }
+ },
+ "parameterOrder": [
+ "projectId",
+ "datasetId"
+ ],
+ "response": {
+ "$ref": "TableList"
+ },
+ "scopes": [
+ "https://www.googleapis.com/auth/bigquery",
+ "https://www.googleapis.com/auth/cloud-platform",
+ "https://www.googleapis.com/auth/cloud-platform.read-only"
+ ]
+ },
+ "patch": {
+ "id": "bigquery.tables.patch",
+ "path": "projects/{projectId}/datasets/{datasetId}/tables/{tableId}",
+ "httpMethod": "PATCH",
+ "description": "Updates information in an existing table. The update method replaces the entire table resource, whereas the patch method only replaces fields that are provided in the submitted table resource. This method supports patch semantics.",
+ "parameters": {
+ "datasetId": {
+ "type": "string",
+ "description": "Dataset ID of the table to update",
+ "required": true,
+ "location": "path"
+ },
+ "projectId": {
+ "type": "string",
+ "description": "Project ID of the table to update",
+ "required": true,
+ "location": "path"
+ },
+ "tableId": {
+ "type": "string",
+ "description": "Table ID of the table to update",
+ "required": true,
+ "location": "path"
+ }
+ },
+ "parameterOrder": [
+ "projectId",
+ "datasetId",
+ "tableId"
+ ],
+ "request": {
+ "$ref": "Table"
+ },
+ "response": {
+ "$ref": "Table"
+ },
+ "scopes": [
+ "https://www.googleapis.com/auth/bigquery",
+ "https://www.googleapis.com/auth/cloud-platform"
+ ]
+ },
+ "update": {
+ "id": "bigquery.tables.update",
+ "path": "projects/{projectId}/datasets/{datasetId}/tables/{tableId}",
+ "httpMethod": "PUT",
+ "description": "Updates information in an existing table. The update method replaces the entire table resource, whereas the patch method only replaces fields that are provided in the submitted table resource.",
+ "parameters": {
+ "datasetId": {
+ "type": "string",
+ "description": "Dataset ID of the table to update",
+ "required": true,
+ "location": "path"
+ },
+ "projectId": {
+ "type": "string",
+ "description": "Project ID of the table to update",
+ "required": true,
+ "location": "path"
+ },
+ "tableId": {
+ "type": "string",
+ "description": "Table ID of the table to update",
+ "required": true,
+ "location": "path"
+ }
+ },
+ "parameterOrder": [
+ "projectId",
+ "datasetId",
+ "tableId"
+ ],
+ "request": {
+ "$ref": "Table"
+ },
+ "response": {
+ "$ref": "Table"
+ },
+ "scopes": [
+ "https://www.googleapis.com/auth/bigquery",
+ "https://www.googleapis.com/auth/cloud-platform"
+ ]
+ }
+ }
+ }
+ }
+}
diff --git a/tests/data/drive.json b/tests/data/drive.json
new file mode 100644
index 0000000..af7b244
--- /dev/null
+++ b/tests/data/drive.json
@@ -0,0 +1,2456 @@
+{
+ "kind": "discovery#restDescription",
+ "etag": "\"tbys6C40o18GZwyMen5GMkdK-3s/4kaUogU191OXLH6MjJOHkd-Z-o8\"",
+ "discoveryVersion": "v1",
+ "id": "drive:v3",
+ "name": "drive",
+ "version": "v3",
+ "revision": "20161212",
+ "title": "Drive API",
+ "description": "Manages files in Drive including uploading, downloading, searching, detecting changes, and updating sharing permissions.",
+ "ownerDomain": "google.com",
+ "ownerName": "Google",
+ "icons": {
+ "x16": "https://ssl.gstatic.com/docs/doclist/images/drive_icon_16.png",
+ "x32": "https://ssl.gstatic.com/docs/doclist/images/drive_icon_32.png"
+ },
+ "documentationLink": "https://developers.google.com/drive/",
+ "protocol": "rest",
+ "baseUrl": "https://www.googleapis.com/drive/v3/",
+ "basePath": "/drive/v3/",
+ "rootUrl": "https://www.googleapis.com/",
+ "servicePath": "drive/v3/",
+ "batchPath": "batch",
+ "parameters": {
+ "alt": {
+ "type": "string",
+ "description": "Data format for the response.",
+ "default": "json",
+ "enum": [
+ "json"
+ ],
+ "enumDescriptions": [
+ "Responses with Content-Type of application/json"
+ ],
+ "location": "query"
+ },
+ "fields": {
+ "type": "string",
+ "description": "Selector specifying which fields to include in a partial response.",
+ "location": "query"
+ },
+ "key": {
+ "type": "string",
+ "description": "API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.",
+ "location": "query"
+ },
+ "oauth_token": {
+ "type": "string",
+ "description": "OAuth 2.0 token for the current user.",
+ "location": "query"
+ },
+ "prettyPrint": {
+ "type": "boolean",
+ "description": "Returns response with indentations and line breaks.",
+ "default": "true",
+ "location": "query"
+ },
+ "quotaUser": {
+ "type": "string",
+ "description": "Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided.",
+ "location": "query"
+ },
+ "userIp": {
+ "type": "string",
+ "description": "IP address of the site where the request originates. Use this if you want to enforce per-user limits.",
+ "location": "query"
+ }
+ },
+ "auth": {
+ "oauth2": {
+ "scopes": {
+ "https://www.googleapis.com/auth/drive": {
+ "description": "View and manage the files in your Google Drive"
+ },
+ "https://www.googleapis.com/auth/drive.appdata": {
+ "description": "View and manage its own configuration data in your Google Drive"
+ },
+ "https://www.googleapis.com/auth/drive.file": {
+ "description": "View and manage Google Drive files and folders that you have opened or created with this app"
+ },
+ "https://www.googleapis.com/auth/drive.metadata": {
+ "description": "View and manage metadata of files in your Google Drive"
+ },
+ "https://www.googleapis.com/auth/drive.metadata.readonly": {
+ "description": "View metadata for files in your Google Drive"
+ },
+ "https://www.googleapis.com/auth/drive.photos.readonly": {
+ "description": "View the photos, videos and albums in your Google Photos"
+ },
+ "https://www.googleapis.com/auth/drive.readonly": {
+ "description": "View the files in your Google Drive"
+ },
+ "https://www.googleapis.com/auth/drive.scripts": {
+ "description": "Modify your Google Apps Script scripts' behavior"
+ }
+ }
+ }
+ },
+ "schemas": {
+ "About": {
+ "id": "About",
+ "type": "object",
+ "description": "Information about the user, the user's Drive, and system capabilities.",
+ "properties": {
+ "appInstalled": {
+ "type": "boolean",
+ "description": "Whether the user has installed the requesting app."
+ },
+ "exportFormats": {
+ "type": "object",
+ "description": "A map of source MIME type to possible targets for all supported exports.",
+ "additionalProperties": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ },
+ "folderColorPalette": {
+ "type": "array",
+ "description": "The currently supported folder colors as RGB hex strings.",
+ "items": {
+ "type": "string"
+ }
+ },
+ "importFormats": {
+ "type": "object",
+ "description": "A map of source MIME type to possible targets for all supported imports.",
+ "additionalProperties": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ },
+ "kind": {
+ "type": "string",
+ "description": "Identifies what kind of resource this is. Value: the fixed string \"drive#about\".",
+ "default": "drive#about"
+ },
+ "maxImportSizes": {
+ "type": "object",
+ "description": "A map of maximum import sizes by MIME type, in bytes.",
+ "additionalProperties": {
+ "type": "string",
+ "format": "int64"
+ }
+ },
+ "maxUploadSize": {
+ "type": "string",
+ "description": "The maximum upload size in bytes.",
+ "format": "int64"
+ },
+ "storageQuota": {
+ "type": "object",
+ "description": "The user's storage quota limits and usage. All fields are measured in bytes.",
+ "properties": {
+ "limit": {
+ "type": "string",
+ "description": "The usage limit, if applicable. This will not be present if the user has unlimited storage.",
+ "format": "int64"
+ },
+ "usage": {
+ "type": "string",
+ "description": "The total usage across all services.",
+ "format": "int64"
+ },
+ "usageInDrive": {
+ "type": "string",
+ "description": "The usage by all files in Google Drive.",
+ "format": "int64"
+ },
+ "usageInDriveTrash": {
+ "type": "string",
+ "description": "The usage by trashed files in Google Drive.",
+ "format": "int64"
+ }
+ }
+ },
+ "user": {
+ "$ref": "User",
+ "description": "The authenticated user."
+ }
+ }
+ },
+ "Change": {
+ "id": "Change",
+ "type": "object",
+ "description": "A change to a file.",
+ "properties": {
+ "file": {
+ "$ref": "File",
+ "description": "The updated state of the file. Present if the file has not been removed."
+ },
+ "fileId": {
+ "type": "string",
+ "description": "The ID of the file which has changed."
+ },
+ "kind": {
+ "type": "string",
+ "description": "Identifies what kind of resource this is. Value: the fixed string \"drive#change\".",
+ "default": "drive#change"
+ },
+ "removed": {
+ "type": "boolean",
+ "description": "Whether the file has been removed from the view of the changes list, for example by deletion or lost access."
+ },
+ "time": {
+ "type": "string",
+ "description": "The time of this change (RFC 3339 date-time).",
+ "format": "date-time"
+ }
+ }
+ },
+ "ChangeList": {
+ "id": "ChangeList",
+ "type": "object",
+ "description": "A list of changes for a user.",
+ "properties": {
+ "changes": {
+ "type": "array",
+ "description": "The page of changes.",
+ "items": {
+ "$ref": "Change"
+ }
+ },
+ "kind": {
+ "type": "string",
+ "description": "Identifies what kind of resource this is. Value: the fixed string \"drive#changeList\".",
+ "default": "drive#changeList"
+ },
+ "newStartPageToken": {
+ "type": "string",
+ "description": "The starting page token for future changes. This will be present only if the end of the current changes list has been reached."
+ },
+ "nextPageToken": {
+ "type": "string",
+ "description": "The page token for the next page of changes. This will be absent if the end of the current changes list has been reached."
+ }
+ }
+ },
+ "Channel": {
+ "id": "Channel",
+ "type": "object",
+ "description": "An notification channel used to watch for resource changes.",
+ "properties": {
+ "address": {
+ "type": "string",
+ "description": "The address where notifications are delivered for this channel."
+ },
+ "expiration": {
+ "type": "string",
+ "description": "Date and time of notification channel expiration, expressed as a Unix timestamp, in milliseconds. Optional.",
+ "format": "int64"
+ },
+ "id": {
+ "type": "string",
+ "description": "A UUID or similar unique string that identifies this channel."
+ },
+ "kind": {
+ "type": "string",
+ "description": "Identifies this as a notification channel used to watch for changes to a resource. Value: the fixed string \"api#channel\".",
+ "default": "api#channel"
+ },
+ "params": {
+ "type": "object",
+ "description": "Additional parameters controlling delivery channel behavior. Optional.",
+ "additionalProperties": {
+ "type": "string",
+ "description": "Declares a new parameter by name."
+ }
+ },
+ "payload": {
+ "type": "boolean",
+ "description": "A Boolean value to indicate whether payload is wanted. Optional."
+ },
+ "resourceId": {
+ "type": "string",
+ "description": "An opaque ID that identifies the resource being watched on this channel. Stable across different API versions."
+ },
+ "resourceUri": {
+ "type": "string",
+ "description": "A version-specific identifier for the watched resource."
+ },
+ "token": {
+ "type": "string",
+ "description": "An arbitrary string delivered to the target address with each notification delivered over this channel. Optional."
+ },
+ "type": {
+ "type": "string",
+ "description": "The type of delivery mechanism used for this channel."
+ }
+ }
+ },
+ "Comment": {
+ "id": "Comment",
+ "type": "object",
+ "description": "A comment on a file.",
+ "properties": {
+ "anchor": {
+ "type": "string",
+ "description": "A region of the document represented as a JSON string. See anchor documentation for details on how to define and interpret anchor properties."
+ },
+ "author": {
+ "$ref": "User",
+ "description": "The user who created the comment."
+ },
+ "content": {
+ "type": "string",
+ "description": "The plain text content of the comment. This field is used for setting the content, while htmlContent should be displayed.",
+ "annotations": {
+ "required": [
+ "drive.comments.create",
+ "drive.comments.update"
+ ]
+ }
+ },
+ "createdTime": {
+ "type": "string",
+ "description": "The time at which the comment was created (RFC 3339 date-time).",
+ "format": "date-time"
+ },
+ "deleted": {
+ "type": "boolean",
+ "description": "Whether the comment has been deleted. A deleted comment has no content."
+ },
+ "htmlContent": {
+ "type": "string",
+ "description": "The content of the comment with HTML formatting."
+ },
+ "id": {
+ "type": "string",
+ "description": "The ID of the comment."
+ },
+ "kind": {
+ "type": "string",
+ "description": "Identifies what kind of resource this is. Value: the fixed string \"drive#comment\".",
+ "default": "drive#comment"
+ },
+ "modifiedTime": {
+ "type": "string",
+ "description": "The last time the comment or any of its replies was modified (RFC 3339 date-time).",
+ "format": "date-time"
+ },
+ "quotedFileContent": {
+ "type": "object",
+ "description": "The file content to which the comment refers, typically within the anchor region. For a text file, for example, this would be the text at the location of the comment.",
+ "properties": {
+ "mimeType": {
+ "type": "string",
+ "description": "The MIME type of the quoted content."
+ },
+ "value": {
+ "type": "string",
+ "description": "The quoted content itself. This is interpreted as plain text if set through the API."
+ }
+ }
+ },
+ "replies": {
+ "type": "array",
+ "description": "The full list of replies to the comment in chronological order.",
+ "items": {
+ "$ref": "Reply"
+ }
+ },
+ "resolved": {
+ "type": "boolean",
+ "description": "Whether the comment has been resolved by one of its replies."
+ }
+ }
+ },
+ "CommentList": {
+ "id": "CommentList",
+ "type": "object",
+ "description": "A list of comments on a file.",
+ "properties": {
+ "comments": {
+ "type": "array",
+ "description": "The page of comments.",
+ "items": {
+ "$ref": "Comment"
+ }
+ },
+ "kind": {
+ "type": "string",
+ "description": "Identifies what kind of resource this is. Value: the fixed string \"drive#commentList\".",
+ "default": "drive#commentList"
+ },
+ "nextPageToken": {
+ "type": "string",
+ "description": "The page token for the next page of comments. This will be absent if the end of the comments list has been reached."
+ }
+ }
+ },
+ "File": {
+ "id": "File",
+ "type": "object",
+ "description": "The metadata for a file.",
+ "properties": {
+ "appProperties": {
+ "type": "object",
+ "description": "A collection of arbitrary key-value pairs which are private to the requesting app.\nEntries with null values are cleared in update and copy requests.",
+ "additionalProperties": {
+ "type": "string"
+ }
+ },
+ "capabilities": {
+ "type": "object",
+ "description": "Capabilities the current user has on the file.",
+ "properties": {
+ "canComment": {
+ "type": "boolean",
+ "description": "Whether the user can comment on the file."
+ },
+ "canCopy": {
+ "type": "boolean",
+ "description": "Whether the user can copy the file."
+ },
+ "canEdit": {
+ "type": "boolean",
+ "description": "Whether the user can edit the file's content."
+ },
+ "canReadRevisions": {
+ "type": "boolean",
+ "description": "Whether the current user has read access to the Revisions resource of the file."
+ },
+ "canShare": {
+ "type": "boolean",
+ "description": "Whether the user can modify the file's permissions and sharing settings."
+ }
+ }
+ },
+ "contentHints": {
+ "type": "object",
+ "description": "Additional information about the content of the file. These fields are never populated in responses.",
+ "properties": {
+ "indexableText": {
+ "type": "string",
+ "description": "Text to be indexed for the file to improve fullText queries. This is limited to 128KB in length and may contain HTML elements."
+ },
+ "thumbnail": {
+ "type": "object",
+ "description": "A thumbnail for the file. This will only be used if Drive cannot generate a standard thumbnail.",
+ "properties": {
+ "image": {
+ "type": "string",
+ "description": "The thumbnail data encoded with URL-safe Base64 (RFC 4648 section 5).",
+ "format": "byte"
+ },
+ "mimeType": {
+ "type": "string",
+ "description": "The MIME type of the thumbnail."
+ }
+ }
+ }
+ }
+ },
+ "createdTime": {
+ "type": "string",
+ "description": "The time at which the file was created (RFC 3339 date-time).",
+ "format": "date-time"
+ },
+ "description": {
+ "type": "string",
+ "description": "A short description of the file."
+ },
+ "explicitlyTrashed": {
+ "type": "boolean",
+ "description": "Whether the file has been explicitly trashed, as opposed to recursively trashed from a parent folder."
+ },
+ "fileExtension": {
+ "type": "string",
+ "description": "The final component of fullFileExtension. This is only available for files with binary content in Drive."
+ },
+ "folderColorRgb": {
+ "type": "string",
+ "description": "The color for a folder as an RGB hex string. The supported colors are published in the folderColorPalette field of the About resource.\nIf an unsupported color is specified, the closest color in the palette will be used instead."
+ },
+ "fullFileExtension": {
+ "type": "string",
+ "description": "The full file extension extracted from the name field. May contain multiple concatenated extensions, such as \"tar.gz\". This is only available for files with binary content in Drive.\nThis is automatically updated when the name field changes, however it is not cleared if the new name does not contain a valid extension."
+ },
+ "hasThumbnail": {
+ "type": "boolean",
+ "description": "Whether this file has a thumbnail."
+ },
+ "headRevisionId": {
+ "type": "string",
+ "description": "The ID of the file's head revision. This is currently only available for files with binary content in Drive."
+ },
+ "iconLink": {
+ "type": "string",
+ "description": "A static, unauthenticated link to the file's icon."
+ },
+ "id": {
+ "type": "string",
+ "description": "The ID of the file."
+ },
+ "imageMediaMetadata": {
+ "type": "object",
+ "description": "Additional metadata about image media, if available.",
+ "properties": {
+ "aperture": {
+ "type": "number",
+ "description": "The aperture used to create the photo (f-number).",
+ "format": "float"
+ },
+ "cameraMake": {
+ "type": "string",
+ "description": "The make of the camera used to create the photo."
+ },
+ "cameraModel": {
+ "type": "string",
+ "description": "The model of the camera used to create the photo."
+ },
+ "colorSpace": {
+ "type": "string",
+ "description": "The color space of the photo."
+ },
+ "exposureBias": {
+ "type": "number",
+ "description": "The exposure bias of the photo (APEX value).",
+ "format": "float"
+ },
+ "exposureMode": {
+ "type": "string",
+ "description": "The exposure mode used to create the photo."
+ },
+ "exposureTime": {
+ "type": "number",
+ "description": "The length of the exposure, in seconds.",
+ "format": "float"
+ },
+ "flashUsed": {
+ "type": "boolean",
+ "description": "Whether a flash was used to create the photo."
+ },
+ "focalLength": {
+ "type": "number",
+ "description": "The focal length used to create the photo, in millimeters.",
+ "format": "float"
+ },
+ "height": {
+ "type": "integer",
+ "description": "The height of the image in pixels.",
+ "format": "int32"
+ },
+ "isoSpeed": {
+ "type": "integer",
+ "description": "The ISO speed used to create the photo.",
+ "format": "int32"
+ },
+ "lens": {
+ "type": "string",
+ "description": "The lens used to create the photo."
+ },
+ "location": {
+ "type": "object",
+ "description": "Geographic location information stored in the image.",
+ "properties": {
+ "altitude": {
+ "type": "number",
+ "description": "The altitude stored in the image.",
+ "format": "double"
+ },
+ "latitude": {
+ "type": "number",
+ "description": "The latitude stored in the image.",
+ "format": "double"
+ },
+ "longitude": {
+ "type": "number",
+ "description": "The longitude stored in the image.",
+ "format": "double"
+ }
+ }
+ },
+ "maxApertureValue": {
+ "type": "number",
+ "description": "The smallest f-number of the lens at the focal length used to create the photo (APEX value).",
+ "format": "float"
+ },
+ "meteringMode": {
+ "type": "string",
+ "description": "The metering mode used to create the photo."
+ },
+ "rotation": {
+ "type": "integer",
+ "description": "The rotation in clockwise degrees from the image's original orientation.",
+ "format": "int32"
+ },
+ "sensor": {
+ "type": "string",
+ "description": "The type of sensor used to create the photo."
+ },
+ "subjectDistance": {
+ "type": "integer",
+ "description": "The distance to the subject of the photo, in meters.",
+ "format": "int32"
+ },
+ "time": {
+ "type": "string",
+ "description": "The date and time the photo was taken (EXIF DateTime)."
+ },
+ "whiteBalance": {
+ "type": "string",
+ "description": "The white balance mode used to create the photo."
+ },
+ "width": {
+ "type": "integer",
+ "description": "The width of the image in pixels.",
+ "format": "int32"
+ }
+ }
+ },
+ "isAppAuthorized": {
+ "type": "boolean",
+ "description": "Whether the file was created or opened by the requesting app."
+ },
+ "kind": {
+ "type": "string",
+ "description": "Identifies what kind of resource this is. Value: the fixed string \"drive#file\".",
+ "default": "drive#file"
+ },
+ "lastModifyingUser": {
+ "$ref": "User",
+ "description": "The last user to modify the file."
+ },
+ "md5Checksum": {
+ "type": "string",
+ "description": "The MD5 checksum for the content of the file. This is only applicable to files with binary content in Drive."
+ },
+ "mimeType": {
+ "type": "string",
+ "description": "The MIME type of the file.\nDrive will attempt to automatically detect an appropriate value from uploaded content if no value is provided. The value cannot be changed unless a new revision is uploaded.\nIf a file is created with a Google Doc MIME type, the uploaded content will be imported if possible. The supported import formats are published in the About resource."
+ },
+ "modifiedByMe": {
+ "type": "boolean",
+ "description": "Whether the file has been modified by this user."
+ },
+ "modifiedByMeTime": {
+ "type": "string",
+ "description": "The last time the file was modified by the user (RFC 3339 date-time).",
+ "format": "date-time"
+ },
+ "modifiedTime": {
+ "type": "string",
+ "description": "The last time the file was modified by anyone (RFC 3339 date-time).\nNote that setting modifiedTime will also update modifiedByMeTime for the user.",
+ "format": "date-time"
+ },
+ "name": {
+ "type": "string",
+ "description": "The name of the file. This is not necessarily unique within a folder."
+ },
+ "originalFilename": {
+ "type": "string",
+ "description": "The original filename of the uploaded content if available, or else the original value of the name field. This is only available for files with binary content in Drive."
+ },
+ "ownedByMe": {
+ "type": "boolean",
+ "description": "Whether the user owns the file."
+ },
+ "owners": {
+ "type": "array",
+ "description": "The owners of the file. Currently, only certain legacy files may have more than one owner.",
+ "items": {
+ "$ref": "User"
+ }
+ },
+ "parents": {
+ "type": "array",
+ "description": "The IDs of the parent folders which contain the file.\nIf not specified as part of a create request, the file will be placed directly in the My Drive folder. Update requests must use the addParents and removeParents parameters to modify the values.",
+ "items": {
+ "type": "string"
+ }
+ },
+ "permissions": {
+ "type": "array",
+ "description": "The full list of permissions for the file. This is only available if the requesting user can share the file.",
+ "items": {
+ "$ref": "Permission"
+ }
+ },
+ "properties": {
+ "type": "object",
+ "description": "A collection of arbitrary key-value pairs which are visible to all apps.\nEntries with null values are cleared in update and copy requests.",
+ "additionalProperties": {
+ "type": "string"
+ }
+ },
+ "quotaBytesUsed": {
+ "type": "string",
+ "description": "The number of storage quota bytes used by the file. This includes the head revision as well as previous revisions with keepForever enabled.",
+ "format": "int64"
+ },
+ "shared": {
+ "type": "boolean",
+ "description": "Whether the file has been shared."
+ },
+ "sharedWithMeTime": {
+ "type": "string",
+ "description": "The time at which the file was shared with the user, if applicable (RFC 3339 date-time).",
+ "format": "date-time"
+ },
+ "sharingUser": {
+ "$ref": "User",
+ "description": "The user who shared the file with the requesting user, if applicable."
+ },
+ "size": {
+ "type": "string",
+ "description": "The size of the file's content in bytes. This is only applicable to files with binary content in Drive.",
+ "format": "int64"
+ },
+ "spaces": {
+ "type": "array",
+ "description": "The list of spaces which contain the file. The currently supported values are 'drive', 'appDataFolder' and 'photos'.",
+ "items": {
+ "type": "string"
+ }
+ },
+ "starred": {
+ "type": "boolean",
+ "description": "Whether the user has starred the file."
+ },
+ "thumbnailLink": {
+ "type": "string",
+ "description": "A short-lived link to the file's thumbnail, if available. Typically lasts on the order of hours. Only populated when the requesting app can access the file's content."
+ },
+ "thumbnailVersion": {
+ "type": "string",
+ "description": "The thumbnail version for use in client-contructable thumbnail URLs or thumbnail cache invalidation.",
+ "format": "int64"
+ },
+ "trashed": {
+ "type": "boolean",
+ "description": "Whether the file has been trashed, either explicitly or from a trashed parent folder. Only the owner may trash a file, and other users cannot see files in the owner's trash."
+ },
+ "version": {
+ "type": "string",
+ "description": "A monotonically increasing version number for the file. This reflects every change made to the file on the server, even those not visible to the user.",
+ "format": "int64"
+ },
+ "videoMediaMetadata": {
+ "type": "object",
+ "description": "Additional metadata about video media. This may not be available immediately upon upload.",
+ "properties": {
+ "durationMillis": {
+ "type": "string",
+ "description": "The duration of the video in milliseconds.",
+ "format": "int64"
+ },
+ "height": {
+ "type": "integer",
+ "description": "The height of the video in pixels.",
+ "format": "int32"
+ },
+ "width": {
+ "type": "integer",
+ "description": "The width of the video in pixels.",
+ "format": "int32"
+ }
+ }
+ },
+ "viewedByMe": {
+ "type": "boolean",
+ "description": "Whether the file has been viewed by this user."
+ },
+ "viewedByMeTime": {
+ "type": "string",
+ "description": "The last time the file was viewed by the user (RFC 3339 date-time).",
+ "format": "date-time"
+ },
+ "viewersCanCopyContent": {
+ "type": "boolean",
+ "description": "Whether users with only reader or commenter permission can copy the file's content. This affects copy, download, and print operations."
+ },
+ "webContentLink": {
+ "type": "string",
+ "description": "A link for downloading the content of the file in a browser. This is only available for files with binary content in Drive."
+ },
+ "webViewLink": {
+ "type": "string",
+ "description": "A link for opening the file in a relevant Google editor or viewer in a browser."
+ },
+ "writersCanShare": {
+ "type": "boolean",
+ "description": "Whether users with only writer permission can modify the file's permissions."
+ }
+ }
+ },
+ "FileList": {
+ "id": "FileList",
+ "type": "object",
+ "description": "A list of files.",
+ "properties": {
+ "files": {
+ "type": "array",
+ "description": "The page of files.",
+ "items": {
+ "$ref": "File"
+ }
+ },
+ "kind": {
+ "type": "string",
+ "description": "Identifies what kind of resource this is. Value: the fixed string \"drive#fileList\".",
+ "default": "drive#fileList"
+ },
+ "nextPageToken": {
+ "type": "string",
+ "description": "The page token for the next page of files. This will be absent if the end of the files list has been reached."
+ }
+ }
+ },
+ "GeneratedIds": {
+ "id": "GeneratedIds",
+ "type": "object",
+ "description": "A list of generated file IDs which can be provided in create requests.",
+ "properties": {
+ "ids": {
+ "type": "array",
+ "description": "The IDs generated for the requesting user in the specified space.",
+ "items": {
+ "type": "string"
+ }
+ },
+ "kind": {
+ "type": "string",
+ "description": "Identifies what kind of resource this is. Value: the fixed string \"drive#generatedIds\".",
+ "default": "drive#generatedIds"
+ },
+ "space": {
+ "type": "string",
+ "description": "The type of file that can be created with these IDs."
+ }
+ }
+ },
+ "Permission": {
+ "id": "Permission",
+ "type": "object",
+ "description": "A permission for a file. A permission grants a user, group, domain or the world access to a file or a folder hierarchy.",
+ "properties": {
+ "allowFileDiscovery": {
+ "type": "boolean",
+ "description": "Whether the permission allows the file to be discovered through search. This is only applicable for permissions of type domain or anyone."
+ },
+ "displayName": {
+ "type": "string",
+ "description": "A displayable name for users, groups or domains."
+ },
+ "domain": {
+ "type": "string",
+ "description": "The domain to which this permission refers."
+ },
+ "emailAddress": {
+ "type": "string",
+ "description": "The email address of the user or group to which this permission refers."
+ },
+ "expirationTime": {
+ "type": "string",
+ "description": "The time at which this permission will expire (RFC 3339 date-time).",
+ "format": "date-time"
+ },
+ "id": {
+ "type": "string",
+ "description": "The ID of this permission. This is a unique identifier for the grantee, and is published in User resources as permissionId."
+ },
+ "kind": {
+ "type": "string",
+ "description": "Identifies what kind of resource this is. Value: the fixed string \"drive#permission\".",
+ "default": "drive#permission"
+ },
+ "photoLink": {
+ "type": "string",
+ "description": "A link to the user's profile photo, if available."
+ },
+ "role": {
+ "type": "string",
+ "description": "The role granted by this permission. Valid values are: \n- owner \n- writer \n- commenter \n- reader",
+ "annotations": {
+ "required": [
+ "drive.permissions.create"
+ ]
+ }
+ },
+ "type": {
+ "type": "string",
+ "description": "The type of the grantee. Valid values are: \n- user \n- group \n- domain \n- anyone",
+ "annotations": {
+ "required": [
+ "drive.permissions.create"
+ ]
+ }
+ }
+ }
+ },
+ "PermissionList": {
+ "id": "PermissionList",
+ "type": "object",
+ "description": "A list of permissions for a file.",
+ "properties": {
+ "kind": {
+ "type": "string",
+ "description": "Identifies what kind of resource this is. Value: the fixed string \"drive#permissionList\".",
+ "default": "drive#permissionList"
+ },
+ "permissions": {
+ "type": "array",
+ "description": "The full list of permissions.",
+ "items": {
+ "$ref": "Permission"
+ }
+ }
+ }
+ },
+ "Reply": {
+ "id": "Reply",
+ "type": "object",
+ "description": "A reply to a comment on a file.",
+ "properties": {
+ "action": {
+ "type": "string",
+ "description": "The action the reply performed to the parent comment. Valid values are: \n- resolve \n- reopen"
+ },
+ "author": {
+ "$ref": "User",
+ "description": "The user who created the reply."
+ },
+ "content": {
+ "type": "string",
+ "description": "The plain text content of the reply. This field is used for setting the content, while htmlContent should be displayed. This is required on creates if no action is specified.",
+ "annotations": {
+ "required": [
+ "drive.replies.update"
+ ]
+ }
+ },
+ "createdTime": {
+ "type": "string",
+ "description": "The time at which the reply was created (RFC 3339 date-time).",
+ "format": "date-time"
+ },
+ "deleted": {
+ "type": "boolean",
+ "description": "Whether the reply has been deleted. A deleted reply has no content."
+ },
+ "htmlContent": {
+ "type": "string",
+ "description": "The content of the reply with HTML formatting."
+ },
+ "id": {
+ "type": "string",
+ "description": "The ID of the reply."
+ },
+ "kind": {
+ "type": "string",
+ "description": "Identifies what kind of resource this is. Value: the fixed string \"drive#reply\".",
+ "default": "drive#reply"
+ },
+ "modifiedTime": {
+ "type": "string",
+ "description": "The last time the reply was modified (RFC 3339 date-time).",
+ "format": "date-time"
+ }
+ }
+ },
+ "ReplyList": {
+ "id": "ReplyList",
+ "type": "object",
+ "description": "A list of replies to a comment on a file.",
+ "properties": {
+ "kind": {
+ "type": "string",
+ "description": "Identifies what kind of resource this is. Value: the fixed string \"drive#replyList\".",
+ "default": "drive#replyList"
+ },
+ "nextPageToken": {
+ "type": "string",
+ "description": "The page token for the next page of replies. This will be absent if the end of the replies list has been reached."
+ },
+ "replies": {
+ "type": "array",
+ "description": "The page of replies.",
+ "items": {
+ "$ref": "Reply"
+ }
+ }
+ }
+ },
+ "Revision": {
+ "id": "Revision",
+ "type": "object",
+ "description": "The metadata for a revision to a file.",
+ "properties": {
+ "id": {
+ "type": "string",
+ "description": "The ID of the revision."
+ },
+ "keepForever": {
+ "type": "boolean",
+ "description": "Whether to keep this revision forever, even if it is no longer the head revision. If not set, the revision will be automatically purged 30 days after newer content is uploaded. This can be set on a maximum of 200 revisions for a file.\nThis field is only applicable to files with binary content in Drive."
+ },
+ "kind": {
+ "type": "string",
+ "description": "Identifies what kind of resource this is. Value: the fixed string \"drive#revision\".",
+ "default": "drive#revision"
+ },
+ "lastModifyingUser": {
+ "$ref": "User",
+ "description": "The last user to modify this revision."
+ },
+ "md5Checksum": {
+ "type": "string",
+ "description": "The MD5 checksum of the revision's content. This is only applicable to files with binary content in Drive."
+ },
+ "mimeType": {
+ "type": "string",
+ "description": "The MIME type of the revision."
+ },
+ "modifiedTime": {
+ "type": "string",
+ "description": "The last time the revision was modified (RFC 3339 date-time).",
+ "format": "date-time"
+ },
+ "originalFilename": {
+ "type": "string",
+ "description": "The original filename used to create this revision. This is only applicable to files with binary content in Drive."
+ },
+ "publishAuto": {
+ "type": "boolean",
+ "description": "Whether subsequent revisions will be automatically republished. This is only applicable to Google Docs."
+ },
+ "published": {
+ "type": "boolean",
+ "description": "Whether this revision is published. This is only applicable to Google Docs."
+ },
+ "publishedOutsideDomain": {
+ "type": "boolean",
+ "description": "Whether this revision is published outside the domain. This is only applicable to Google Docs."
+ },
+ "size": {
+ "type": "string",
+ "description": "The size of the revision's content in bytes. This is only applicable to files with binary content in Drive.",
+ "format": "int64"
+ }
+ }
+ },
+ "RevisionList": {
+ "id": "RevisionList",
+ "type": "object",
+ "description": "A list of revisions of a file.",
+ "properties": {
+ "kind": {
+ "type": "string",
+ "description": "Identifies what kind of resource this is. Value: the fixed string \"drive#revisionList\".",
+ "default": "drive#revisionList"
+ },
+ "nextPageToken": {
+ "type": "string",
+ "description": "The page token for the next page of revisions. This will be absent if the end of the revisions list has been reached."
+ },
+ "revisions": {
+ "type": "array",
+ "description": "The full list of revisions.",
+ "items": {
+ "$ref": "Revision"
+ }
+ }
+ }
+ },
+ "StartPageToken": {
+ "id": "StartPageToken",
+ "type": "object",
+ "properties": {
+ "kind": {
+ "type": "string",
+ "description": "Identifies what kind of resource this is. Value: the fixed string \"drive#startPageToken\".",
+ "default": "drive#startPageToken"
+ },
+ "startPageToken": {
+ "type": "string",
+ "description": "The starting page token for listing changes."
+ }
+ }
+ },
+ "User": {
+ "id": "User",
+ "type": "object",
+ "description": "Information about a Drive user.",
+ "properties": {
+ "displayName": {
+ "type": "string",
+ "description": "A plain text displayable name for this user."
+ },
+ "emailAddress": {
+ "type": "string",
+ "description": "The email address of the user. This may not be present in certain contexts if the user has not made their email address visible to the requester."
+ },
+ "kind": {
+ "type": "string",
+ "description": "Identifies what kind of resource this is. Value: the fixed string \"drive#user\".",
+ "default": "drive#user"
+ },
+ "me": {
+ "type": "boolean",
+ "description": "Whether this user is the requesting user."
+ },
+ "permissionId": {
+ "type": "string",
+ "description": "The user's ID as visible in Permission resources."
+ },
+ "photoLink": {
+ "type": "string",
+ "description": "A link to the user's profile photo, if available."
+ }
+ }
+ }
+ },
+ "resources": {
+ "about": {
+ "methods": {
+ "get": {
+ "id": "drive.about.get",
+ "path": "about",
+ "httpMethod": "GET",
+ "description": "Gets information about the user, the user's Drive, and system capabilities.",
+ "response": {
+ "$ref": "About"
+ },
+ "scopes": [
+ "https://www.googleapis.com/auth/drive",
+ "https://www.googleapis.com/auth/drive.appdata",
+ "https://www.googleapis.com/auth/drive.file",
+ "https://www.googleapis.com/auth/drive.metadata",
+ "https://www.googleapis.com/auth/drive.metadata.readonly",
+ "https://www.googleapis.com/auth/drive.photos.readonly",
+ "https://www.googleapis.com/auth/drive.readonly"
+ ]
+ }
+ }
+ },
+ "changes": {
+ "methods": {
+ "getStartPageToken": {
+ "id": "drive.changes.getStartPageToken",
+ "path": "changes/startPageToken",
+ "httpMethod": "GET",
+ "description": "Gets the starting pageToken for listing future changes.",
+ "response": {
+ "$ref": "StartPageToken"
+ },
+ "scopes": [
+ "https://www.googleapis.com/auth/drive",
+ "https://www.googleapis.com/auth/drive.appdata",
+ "https://www.googleapis.com/auth/drive.file",
+ "https://www.googleapis.com/auth/drive.metadata",
+ "https://www.googleapis.com/auth/drive.metadata.readonly",
+ "https://www.googleapis.com/auth/drive.photos.readonly",
+ "https://www.googleapis.com/auth/drive.readonly"
+ ]
+ },
+ "list": {
+ "id": "drive.changes.list",
+ "path": "changes",
+ "httpMethod": "GET",
+ "description": "Lists changes for a user.",
+ "parameters": {
+ "includeRemoved": {
+ "type": "boolean",
+ "description": "Whether to include changes indicating that items have left the view of the changes list, for example by deletion or lost access.",
+ "default": "true",
+ "location": "query"
+ },
+ "pageSize": {
+ "type": "integer",
+ "description": "The maximum number of changes to return per page.",
+ "default": "100",
+ "format": "int32",
+ "minimum": "1",
+ "maximum": "1000",
+ "location": "query"
+ },
+ "pageToken": {
+ "type": "string",
+ "description": "The token for continuing a previous list request on the next page. This should be set to the value of 'nextPageToken' from the previous response or to the response from the getStartPageToken method.",
+ "required": true,
+ "location": "query"
+ },
+ "restrictToMyDrive": {
+ "type": "boolean",
+ "description": "Whether to restrict the results to changes inside the My Drive hierarchy. This omits changes to files such as those in the Application Data folder or shared files which have not been added to My Drive.",
+ "default": "false",
+ "location": "query"
+ },
+ "spaces": {
+ "type": "string",
+ "description": "A comma-separated list of spaces to query within the user corpus. Supported values are 'drive', 'appDataFolder' and 'photos'.",
+ "default": "drive",
+ "location": "query"
+ }
+ },
+ "parameterOrder": [
+ "pageToken"
+ ],
+ "response": {
+ "$ref": "ChangeList"
+ },
+ "scopes": [
+ "https://www.googleapis.com/auth/drive",
+ "https://www.googleapis.com/auth/drive.appdata",
+ "https://www.googleapis.com/auth/drive.file",
+ "https://www.googleapis.com/auth/drive.metadata",
+ "https://www.googleapis.com/auth/drive.metadata.readonly",
+ "https://www.googleapis.com/auth/drive.photos.readonly",
+ "https://www.googleapis.com/auth/drive.readonly"
+ ],
+ "supportsSubscription": true
+ },
+ "watch": {
+ "id": "drive.changes.watch",
+ "path": "changes/watch",
+ "httpMethod": "POST",
+ "description": "Subscribes to changes for a user.",
+ "parameters": {
+ "includeRemoved": {
+ "type": "boolean",
+ "description": "Whether to include changes indicating that items have left the view of the changes list, for example by deletion or lost access.",
+ "default": "true",
+ "location": "query"
+ },
+ "pageSize": {
+ "type": "integer",
+ "description": "The maximum number of changes to return per page.",
+ "default": "100",
+ "format": "int32",
+ "minimum": "1",
+ "maximum": "1000",
+ "location": "query"
+ },
+ "pageToken": {
+ "type": "string",
+ "description": "The token for continuing a previous list request on the next page. This should be set to the value of 'nextPageToken' from the previous response or to the response from the getStartPageToken method.",
+ "required": true,
+ "location": "query"
+ },
+ "restrictToMyDrive": {
+ "type": "boolean",
+ "description": "Whether to restrict the results to changes inside the My Drive hierarchy. This omits changes to files such as those in the Application Data folder or shared files which have not been added to My Drive.",
+ "default": "false",
+ "location": "query"
+ },
+ "spaces": {
+ "type": "string",
+ "description": "A comma-separated list of spaces to query within the user corpus. Supported values are 'drive', 'appDataFolder' and 'photos'.",
+ "default": "drive",
+ "location": "query"
+ }
+ },
+ "parameterOrder": [
+ "pageToken"
+ ],
+ "request": {
+ "$ref": "Channel",
+ "parameterName": "resource"
+ },
+ "response": {
+ "$ref": "Channel"
+ },
+ "scopes": [
+ "https://www.googleapis.com/auth/drive",
+ "https://www.googleapis.com/auth/drive.appdata",
+ "https://www.googleapis.com/auth/drive.file",
+ "https://www.googleapis.com/auth/drive.metadata",
+ "https://www.googleapis.com/auth/drive.metadata.readonly",
+ "https://www.googleapis.com/auth/drive.photos.readonly",
+ "https://www.googleapis.com/auth/drive.readonly"
+ ],
+ "supportsSubscription": true
+ }
+ }
+ },
+ "channels": {
+ "methods": {
+ "stop": {
+ "id": "drive.channels.stop",
+ "path": "channels/stop",
+ "httpMethod": "POST",
+ "description": "Stop watching resources through this channel",
+ "request": {
+ "$ref": "Channel",
+ "parameterName": "resource"
+ },
+ "scopes": [
+ "https://www.googleapis.com/auth/drive",
+ "https://www.googleapis.com/auth/drive.appdata",
+ "https://www.googleapis.com/auth/drive.file",
+ "https://www.googleapis.com/auth/drive.metadata",
+ "https://www.googleapis.com/auth/drive.metadata.readonly",
+ "https://www.googleapis.com/auth/drive.photos.readonly",
+ "https://www.googleapis.com/auth/drive.readonly"
+ ]
+ }
+ }
+ },
+ "comments": {
+ "methods": {
+ "create": {
+ "id": "drive.comments.create",
+ "path": "files/{fileId}/comments",
+ "httpMethod": "POST",
+ "description": "Creates a new comment on a file.",
+ "parameters": {
+ "fileId": {
+ "type": "string",
+ "description": "The ID of the file.",
+ "required": true,
+ "location": "path"
+ }
+ },
+ "parameterOrder": [
+ "fileId"
+ ],
+ "request": {
+ "$ref": "Comment"
+ },
+ "response": {
+ "$ref": "Comment"
+ },
+ "scopes": [
+ "https://www.googleapis.com/auth/drive",
+ "https://www.googleapis.com/auth/drive.file"
+ ]
+ },
+ "delete": {
+ "id": "drive.comments.delete",
+ "path": "files/{fileId}/comments/{commentId}",
+ "httpMethod": "DELETE",
+ "description": "Deletes a comment.",
+ "parameters": {
+ "commentId": {
+ "type": "string",
+ "description": "The ID of the comment.",
+ "required": true,
+ "location": "path"
+ },
+ "fileId": {
+ "type": "string",
+ "description": "The ID of the file.",
+ "required": true,
+ "location": "path"
+ }
+ },
+ "parameterOrder": [
+ "fileId",
+ "commentId"
+ ],
+ "scopes": [
+ "https://www.googleapis.com/auth/drive",
+ "https://www.googleapis.com/auth/drive.file"
+ ]
+ },
+ "get": {
+ "id": "drive.comments.get",
+ "path": "files/{fileId}/comments/{commentId}",
+ "httpMethod": "GET",
+ "description": "Gets a comment by ID.",
+ "parameters": {
+ "commentId": {
+ "type": "string",
+ "description": "The ID of the comment.",
+ "required": true,
+ "location": "path"
+ },
+ "fileId": {
+ "type": "string",
+ "description": "The ID of the file.",
+ "required": true,
+ "location": "path"
+ },
+ "includeDeleted": {
+ "type": "boolean",
+ "description": "Whether to return deleted comments. Deleted comments will not include their original content.",
+ "default": "false",
+ "location": "query"
+ }
+ },
+ "parameterOrder": [
+ "fileId",
+ "commentId"
+ ],
+ "response": {
+ "$ref": "Comment"
+ },
+ "scopes": [
+ "https://www.googleapis.com/auth/drive",
+ "https://www.googleapis.com/auth/drive.file",
+ "https://www.googleapis.com/auth/drive.readonly"
+ ]
+ },
+ "list": {
+ "id": "drive.comments.list",
+ "path": "files/{fileId}/comments",
+ "httpMethod": "GET",
+ "description": "Lists a file's comments.",
+ "parameters": {
+ "fileId": {
+ "type": "string",
+ "description": "The ID of the file.",
+ "required": true,
+ "location": "path"
+ },
+ "includeDeleted": {
+ "type": "boolean",
+ "description": "Whether to include deleted comments. Deleted comments will not include their original content.",
+ "default": "false",
+ "location": "query"
+ },
+ "pageSize": {
+ "type": "integer",
+ "description": "The maximum number of comments to return per page.",
+ "default": "20",
+ "format": "int32",
+ "minimum": "1",
+ "maximum": "100",
+ "location": "query"
+ },
+ "pageToken": {
+ "type": "string",
+ "description": "The token for continuing a previous list request on the next page. This should be set to the value of 'nextPageToken' from the previous response.",
+ "location": "query"
+ },
+ "startModifiedTime": {
+ "type": "string",
+ "description": "The minimum value of 'modifiedTime' for the result comments (RFC 3339 date-time).",
+ "location": "query"
+ }
+ },
+ "parameterOrder": [
+ "fileId"
+ ],
+ "response": {
+ "$ref": "CommentList"
+ },
+ "scopes": [
+ "https://www.googleapis.com/auth/drive",
+ "https://www.googleapis.com/auth/drive.file",
+ "https://www.googleapis.com/auth/drive.readonly"
+ ]
+ },
+ "update": {
+ "id": "drive.comments.update",
+ "path": "files/{fileId}/comments/{commentId}",
+ "httpMethod": "PATCH",
+ "description": "Updates a comment with patch semantics.",
+ "parameters": {
+ "commentId": {
+ "type": "string",
+ "description": "The ID of the comment.",
+ "required": true,
+ "location": "path"
+ },
+ "fileId": {
+ "type": "string",
+ "description": "The ID of the file.",
+ "required": true,
+ "location": "path"
+ }
+ },
+ "parameterOrder": [
+ "fileId",
+ "commentId"
+ ],
+ "request": {
+ "$ref": "Comment"
+ },
+ "response": {
+ "$ref": "Comment"
+ },
+ "scopes": [
+ "https://www.googleapis.com/auth/drive",
+ "https://www.googleapis.com/auth/drive.file"
+ ]
+ }
+ }
+ },
+ "files": {
+ "methods": {
+ "copy": {
+ "id": "drive.files.copy",
+ "path": "files/{fileId}/copy",
+ "httpMethod": "POST",
+ "description": "Creates a copy of a file and applies any requested updates with patch semantics.",
+ "parameters": {
+ "fileId": {
+ "type": "string",
+ "description": "The ID of the file.",
+ "required": true,
+ "location": "path"
+ },
+ "ignoreDefaultVisibility": {
+ "type": "boolean",
+ "description": "Whether to ignore the domain's default visibility settings for the created file. Domain administrators can choose to make all uploaded files visible to the domain by default; this parameter bypasses that behavior for the request. Permissions are still inherited from parent folders.",
+ "default": "false",
+ "location": "query"
+ },
+ "keepRevisionForever": {
+ "type": "boolean",
+ "description": "Whether to set the 'keepForever' field in the new head revision. This is only applicable to files with binary content in Drive.",
+ "default": "false",
+ "location": "query"
+ },
+ "ocrLanguage": {
+ "type": "string",
+ "description": "A language hint for OCR processing during image import (ISO 639-1 code).",
+ "location": "query"
+ }
+ },
+ "parameterOrder": [
+ "fileId"
+ ],
+ "request": {
+ "$ref": "File"
+ },
+ "response": {
+ "$ref": "File"
+ },
+ "scopes": [
+ "https://www.googleapis.com/auth/drive",
+ "https://www.googleapis.com/auth/drive.appdata",
+ "https://www.googleapis.com/auth/drive.file",
+ "https://www.googleapis.com/auth/drive.photos.readonly"
+ ]
+ },
+ "create": {
+ "id": "drive.files.create",
+ "path": "files",
+ "httpMethod": "POST",
+ "description": "Creates a new file.",
+ "parameters": {
+ "ignoreDefaultVisibility": {
+ "type": "boolean",
+ "description": "Whether to ignore the domain's default visibility settings for the created file. Domain administrators can choose to make all uploaded files visible to the domain by default; this parameter bypasses that behavior for the request. Permissions are still inherited from parent folders.",
+ "default": "false",
+ "location": "query"
+ },
+ "keepRevisionForever": {
+ "type": "boolean",
+ "description": "Whether to set the 'keepForever' field in the new head revision. This is only applicable to files with binary content in Drive.",
+ "default": "false",
+ "location": "query"
+ },
+ "ocrLanguage": {
+ "type": "string",
+ "description": "A language hint for OCR processing during image import (ISO 639-1 code).",
+ "location": "query"
+ },
+ "useContentAsIndexableText": {
+ "type": "boolean",
+ "description": "Whether to use the uploaded content as indexable text.",
+ "default": "false",
+ "location": "query"
+ }
+ },
+ "request": {
+ "$ref": "File"
+ },
+ "response": {
+ "$ref": "File"
+ },
+ "scopes": [
+ "https://www.googleapis.com/auth/drive",
+ "https://www.googleapis.com/auth/drive.appdata",
+ "https://www.googleapis.com/auth/drive.file"
+ ],
+ "supportsMediaUpload": true,
+ "mediaUpload": {
+ "accept": [
+ "*/*"
+ ],
+ "maxSize": "5120GB",
+ "protocols": {
+ "simple": {
+ "multipart": true,
+ "path": "/upload/drive/v3/files"
+ },
+ "resumable": {
+ "multipart": true,
+ "path": "/resumable/upload/drive/v3/files"
+ }
+ }
+ },
+ "supportsSubscription": true
+ },
+ "delete": {
+ "id": "drive.files.delete",
+ "path": "files/{fileId}",
+ "httpMethod": "DELETE",
+ "description": "Permanently deletes a file owned by the user without moving it to the trash. If the target is a folder, all descendants owned by the user are also deleted.",
+ "parameters": {
+ "fileId": {
+ "type": "string",
+ "description": "The ID of the file.",
+ "required": true,
+ "location": "path"
+ }
+ },
+ "parameterOrder": [
+ "fileId"
+ ],
+ "scopes": [
+ "https://www.googleapis.com/auth/drive",
+ "https://www.googleapis.com/auth/drive.appdata",
+ "https://www.googleapis.com/auth/drive.file"
+ ]
+ },
+ "emptyTrash": {
+ "id": "drive.files.emptyTrash",
+ "path": "files/trash",
+ "httpMethod": "DELETE",
+ "description": "Permanently deletes all of the user's trashed files.",
+ "scopes": [
+ "https://www.googleapis.com/auth/drive"
+ ]
+ },
+ "export": {
+ "id": "drive.files.export",
+ "path": "files/{fileId}/export",
+ "httpMethod": "GET",
+ "description": "Exports a Google Doc to the requested MIME type and returns the exported content.",
+ "parameters": {
+ "fileId": {
+ "type": "string",
+ "description": "The ID of the file.",
+ "required": true,
+ "location": "path"
+ },
+ "mimeType": {
+ "type": "string",
+ "description": "The MIME type of the format requested for this export.",
+ "required": true,
+ "location": "query"
+ }
+ },
+ "parameterOrder": [
+ "fileId",
+ "mimeType"
+ ],
+ "scopes": [
+ "https://www.googleapis.com/auth/drive",
+ "https://www.googleapis.com/auth/drive.file",
+ "https://www.googleapis.com/auth/drive.readonly"
+ ],
+ "supportsMediaDownload": true
+ },
+ "generateIds": {
+ "id": "drive.files.generateIds",
+ "path": "files/generateIds",
+ "httpMethod": "GET",
+ "description": "Generates a set of file IDs which can be provided in create requests.",
+ "parameters": {
+ "count": {
+ "type": "integer",
+ "description": "The number of IDs to return.",
+ "default": "10",
+ "format": "int32",
+ "minimum": "1",
+ "maximum": "1000",
+ "location": "query"
+ },
+ "space": {
+ "type": "string",
+ "description": "The space in which the IDs can be used to create new files. Supported values are 'drive' and 'appDataFolder'.",
+ "default": "drive",
+ "location": "query"
+ }
+ },
+ "response": {
+ "$ref": "GeneratedIds"
+ },
+ "scopes": [
+ "https://www.googleapis.com/auth/drive",
+ "https://www.googleapis.com/auth/drive.appdata",
+ "https://www.googleapis.com/auth/drive.file"
+ ]
+ },
+ "get": {
+ "id": "drive.files.get",
+ "path": "files/{fileId}",
+ "httpMethod": "GET",
+ "description": "Gets a file's metadata or content by ID.",
+ "parameters": {
+ "acknowledgeAbuse": {
+ "type": "boolean",
+ "description": "Whether the user is acknowledging the risk of downloading known malware or other abusive files. This is only applicable when alt=media.",
+ "default": "false",
+ "location": "query"
+ },
+ "fileId": {
+ "type": "string",
+ "description": "The ID of the file.",
+ "required": true,
+ "location": "path"
+ }
+ },
+ "parameterOrder": [
+ "fileId"
+ ],
+ "response": {
+ "$ref": "File"
+ },
+ "scopes": [
+ "https://www.googleapis.com/auth/drive",
+ "https://www.googleapis.com/auth/drive.appdata",
+ "https://www.googleapis.com/auth/drive.file",
+ "https://www.googleapis.com/auth/drive.metadata",
+ "https://www.googleapis.com/auth/drive.metadata.readonly",
+ "https://www.googleapis.com/auth/drive.photos.readonly",
+ "https://www.googleapis.com/auth/drive.readonly"
+ ],
+ "supportsMediaDownload": true,
+ "useMediaDownloadService": true,
+ "supportsSubscription": true
+ },
+ "list": {
+ "id": "drive.files.list",
+ "path": "files",
+ "httpMethod": "GET",
+ "description": "Lists or searches files.",
+ "parameters": {
+ "corpus": {
+ "type": "string",
+ "description": "The source of files to list.",
+ "default": "user",
+ "enum": [
+ "domain",
+ "user"
+ ],
+ "enumDescriptions": [
+ "Files shared to the user's domain.",
+ "Files owned by or shared to the user."
+ ],
+ "location": "query"
+ },
+ "orderBy": {
+ "type": "string",
+ "description": "A comma-separated list of sort keys. Valid keys are 'createdTime', 'folder', 'modifiedByMeTime', 'modifiedTime', 'name', 'quotaBytesUsed', 'recency', 'sharedWithMeTime', 'starred', and 'viewedByMeTime'. Each key sorts ascending by default, but may be reversed with the 'desc' modifier. Example usage: ?orderBy=folder,modifiedTime desc,name. Please note that there is a current limitation for users with approximately one million files in which the requested sort order is ignored.",
+ "location": "query"
+ },
+ "pageSize": {
+ "type": "integer",
+ "description": "The maximum number of files to return per page.",
+ "default": "100",
+ "format": "int32",
+ "minimum": "1",
+ "maximum": "1000",
+ "location": "query"
+ },
+ "pageToken": {
+ "type": "string",
+ "description": "The token for continuing a previous list request on the next page. This should be set to the value of 'nextPageToken' from the previous response.",
+ "location": "query"
+ },
+ "q": {
+ "type": "string",
+ "description": "A query for filtering the file results. See the \"Search for Files\" guide for supported syntax.",
+ "location": "query"
+ },
+ "spaces": {
+ "type": "string",
+ "description": "A comma-separated list of spaces to query within the corpus. Supported values are 'drive', 'appDataFolder' and 'photos'.",
+ "default": "drive",
+ "location": "query"
+ }
+ },
+ "response": {
+ "$ref": "FileList"
+ },
+ "scopes": [
+ "https://www.googleapis.com/auth/drive",
+ "https://www.googleapis.com/auth/drive.appdata",
+ "https://www.googleapis.com/auth/drive.file",
+ "https://www.googleapis.com/auth/drive.metadata",
+ "https://www.googleapis.com/auth/drive.metadata.readonly",
+ "https://www.googleapis.com/auth/drive.photos.readonly",
+ "https://www.googleapis.com/auth/drive.readonly"
+ ]
+ },
+ "update": {
+ "id": "drive.files.update",
+ "path": "files/{fileId}",
+ "httpMethod": "PATCH",
+ "description": "Updates a file's metadata and/or content with patch semantics.",
+ "parameters": {
+ "addParents": {
+ "type": "string",
+ "description": "A comma-separated list of parent IDs to add.",
+ "location": "query"
+ },
+ "fileId": {
+ "type": "string",
+ "description": "The ID of the file.",
+ "required": true,
+ "location": "path"
+ },
+ "keepRevisionForever": {
+ "type": "boolean",
+ "description": "Whether to set the 'keepForever' field in the new head revision. This is only applicable to files with binary content in Drive.",
+ "default": "false",
+ "location": "query"
+ },
+ "ocrLanguage": {
+ "type": "string",
+ "description": "A language hint for OCR processing during image import (ISO 639-1 code).",
+ "location": "query"
+ },
+ "removeParents": {
+ "type": "string",
+ "description": "A comma-separated list of parent IDs to remove.",
+ "location": "query"
+ },
+ "useContentAsIndexableText": {
+ "type": "boolean",
+ "description": "Whether to use the uploaded content as indexable text.",
+ "default": "false",
+ "location": "query"
+ }
+ },
+ "parameterOrder": [
+ "fileId"
+ ],
+ "request": {
+ "$ref": "File"
+ },
+ "response": {
+ "$ref": "File"
+ },
+ "scopes": [
+ "https://www.googleapis.com/auth/drive",
+ "https://www.googleapis.com/auth/drive.appdata",
+ "https://www.googleapis.com/auth/drive.file",
+ "https://www.googleapis.com/auth/drive.metadata",
+ "https://www.googleapis.com/auth/drive.scripts"
+ ],
+ "supportsMediaUpload": true,
+ "mediaUpload": {
+ "accept": [
+ "*/*"
+ ],
+ "maxSize": "5120GB",
+ "protocols": {
+ "simple": {
+ "multipart": true,
+ "path": "/upload/drive/v3/files/{fileId}"
+ },
+ "resumable": {
+ "multipart": true,
+ "path": "/resumable/upload/drive/v3/files/{fileId}"
+ }
+ }
+ }
+ },
+ "watch": {
+ "id": "drive.files.watch",
+ "path": "files/{fileId}/watch",
+ "httpMethod": "POST",
+ "description": "Subscribes to changes to a file",
+ "parameters": {
+ "acknowledgeAbuse": {
+ "type": "boolean",
+ "description": "Whether the user is acknowledging the risk of downloading known malware or other abusive files. This is only applicable when alt=media.",
+ "default": "false",
+ "location": "query"
+ },
+ "fileId": {
+ "type": "string",
+ "description": "The ID of the file.",
+ "required": true,
+ "location": "path"
+ }
+ },
+ "parameterOrder": [
+ "fileId"
+ ],
+ "request": {
+ "$ref": "Channel",
+ "parameterName": "resource"
+ },
+ "response": {
+ "$ref": "Channel"
+ },
+ "scopes": [
+ "https://www.googleapis.com/auth/drive",
+ "https://www.googleapis.com/auth/drive.appdata",
+ "https://www.googleapis.com/auth/drive.file",
+ "https://www.googleapis.com/auth/drive.metadata",
+ "https://www.googleapis.com/auth/drive.metadata.readonly",
+ "https://www.googleapis.com/auth/drive.photos.readonly",
+ "https://www.googleapis.com/auth/drive.readonly"
+ ],
+ "supportsMediaDownload": true,
+ "useMediaDownloadService": true,
+ "supportsSubscription": true
+ }
+ }
+ },
+ "permissions": {
+ "methods": {
+ "create": {
+ "id": "drive.permissions.create",
+ "path": "files/{fileId}/permissions",
+ "httpMethod": "POST",
+ "description": "Creates a permission for a file.",
+ "parameters": {
+ "emailMessage": {
+ "type": "string",
+ "description": "A custom message to include in the notification email.",
+ "location": "query"
+ },
+ "fileId": {
+ "type": "string",
+ "description": "The ID of the file.",
+ "required": true,
+ "location": "path"
+ },
+ "sendNotificationEmail": {
+ "type": "boolean",
+ "description": "Whether to send a notification email when sharing to users or groups. This defaults to true for users and groups, and is not allowed for other requests. It must not be disabled for ownership transfers.",
+ "location": "query"
+ },
+ "transferOwnership": {
+ "type": "boolean",
+ "description": "Whether to transfer ownership to the specified user and downgrade the current owner to a writer. This parameter is required as an acknowledgement of the side effect.",
+ "default": "false",
+ "location": "query"
+ }
+ },
+ "parameterOrder": [
+ "fileId"
+ ],
+ "request": {
+ "$ref": "Permission"
+ },
+ "response": {
+ "$ref": "Permission"
+ },
+ "scopes": [
+ "https://www.googleapis.com/auth/drive",
+ "https://www.googleapis.com/auth/drive.file"
+ ]
+ },
+ "delete": {
+ "id": "drive.permissions.delete",
+ "path": "files/{fileId}/permissions/{permissionId}",
+ "httpMethod": "DELETE",
+ "description": "Deletes a permission.",
+ "parameters": {
+ "fileId": {
+ "type": "string",
+ "description": "The ID of the file.",
+ "required": true,
+ "location": "path"
+ },
+ "permissionId": {
+ "type": "string",
+ "description": "The ID of the permission.",
+ "required": true,
+ "location": "path"
+ }
+ },
+ "parameterOrder": [
+ "fileId",
+ "permissionId"
+ ],
+ "scopes": [
+ "https://www.googleapis.com/auth/drive",
+ "https://www.googleapis.com/auth/drive.file"
+ ]
+ },
+ "get": {
+ "id": "drive.permissions.get",
+ "path": "files/{fileId}/permissions/{permissionId}",
+ "httpMethod": "GET",
+ "description": "Gets a permission by ID.",
+ "parameters": {
+ "fileId": {
+ "type": "string",
+ "description": "The ID of the file.",
+ "required": true,
+ "location": "path"
+ },
+ "permissionId": {
+ "type": "string",
+ "description": "The ID of the permission.",
+ "required": true,
+ "location": "path"
+ }
+ },
+ "parameterOrder": [
+ "fileId",
+ "permissionId"
+ ],
+ "response": {
+ "$ref": "Permission"
+ },
+ "scopes": [
+ "https://www.googleapis.com/auth/drive",
+ "https://www.googleapis.com/auth/drive.file",
+ "https://www.googleapis.com/auth/drive.metadata",
+ "https://www.googleapis.com/auth/drive.metadata.readonly",
+ "https://www.googleapis.com/auth/drive.photos.readonly",
+ "https://www.googleapis.com/auth/drive.readonly"
+ ]
+ },
+ "list": {
+ "id": "drive.permissions.list",
+ "path": "files/{fileId}/permissions",
+ "httpMethod": "GET",
+ "description": "Lists a file's permissions.",
+ "parameters": {
+ "fileId": {
+ "type": "string",
+ "description": "The ID of the file.",
+ "required": true,
+ "location": "path"
+ }
+ },
+ "parameterOrder": [
+ "fileId"
+ ],
+ "response": {
+ "$ref": "PermissionList"
+ },
+ "scopes": [
+ "https://www.googleapis.com/auth/drive",
+ "https://www.googleapis.com/auth/drive.file",
+ "https://www.googleapis.com/auth/drive.metadata",
+ "https://www.googleapis.com/auth/drive.metadata.readonly",
+ "https://www.googleapis.com/auth/drive.photos.readonly",
+ "https://www.googleapis.com/auth/drive.readonly"
+ ]
+ },
+ "update": {
+ "id": "drive.permissions.update",
+ "path": "files/{fileId}/permissions/{permissionId}",
+ "httpMethod": "PATCH",
+ "description": "Updates a permission with patch semantics.",
+ "parameters": {
+ "fileId": {
+ "type": "string",
+ "description": "The ID of the file.",
+ "required": true,
+ "location": "path"
+ },
+ "permissionId": {
+ "type": "string",
+ "description": "The ID of the permission.",
+ "required": true,
+ "location": "path"
+ },
+ "removeExpiration": {
+ "type": "boolean",
+ "description": "Whether to remove the expiration date.",
+ "default": "false",
+ "location": "query"
+ },
+ "transferOwnership": {
+ "type": "boolean",
+ "description": "Whether to transfer ownership to the specified user and downgrade the current owner to a writer. This parameter is required as an acknowledgement of the side effect.",
+ "default": "false",
+ "location": "query"
+ }
+ },
+ "parameterOrder": [
+ "fileId",
+ "permissionId"
+ ],
+ "request": {
+ "$ref": "Permission"
+ },
+ "response": {
+ "$ref": "Permission"
+ },
+ "scopes": [
+ "https://www.googleapis.com/auth/drive",
+ "https://www.googleapis.com/auth/drive.file"
+ ]
+ }
+ }
+ },
+ "replies": {
+ "methods": {
+ "create": {
+ "id": "drive.replies.create",
+ "path": "files/{fileId}/comments/{commentId}/replies",
+ "httpMethod": "POST",
+ "description": "Creates a new reply to a comment.",
+ "parameters": {
+ "commentId": {
+ "type": "string",
+ "description": "The ID of the comment.",
+ "required": true,
+ "location": "path"
+ },
+ "fileId": {
+ "type": "string",
+ "description": "The ID of the file.",
+ "required": true,
+ "location": "path"
+ }
+ },
+ "parameterOrder": [
+ "fileId",
+ "commentId"
+ ],
+ "request": {
+ "$ref": "Reply"
+ },
+ "response": {
+ "$ref": "Reply"
+ },
+ "scopes": [
+ "https://www.googleapis.com/auth/drive",
+ "https://www.googleapis.com/auth/drive.file"
+ ]
+ },
+ "delete": {
+ "id": "drive.replies.delete",
+ "path": "files/{fileId}/comments/{commentId}/replies/{replyId}",
+ "httpMethod": "DELETE",
+ "description": "Deletes a reply.",
+ "parameters": {
+ "commentId": {
+ "type": "string",
+ "description": "The ID of the comment.",
+ "required": true,
+ "location": "path"
+ },
+ "fileId": {
+ "type": "string",
+ "description": "The ID of the file.",
+ "required": true,
+ "location": "path"
+ },
+ "replyId": {
+ "type": "string",
+ "description": "The ID of the reply.",
+ "required": true,
+ "location": "path"
+ }
+ },
+ "parameterOrder": [
+ "fileId",
+ "commentId",
+ "replyId"
+ ],
+ "scopes": [
+ "https://www.googleapis.com/auth/drive",
+ "https://www.googleapis.com/auth/drive.file"
+ ]
+ },
+ "get": {
+ "id": "drive.replies.get",
+ "path": "files/{fileId}/comments/{commentId}/replies/{replyId}",
+ "httpMethod": "GET",
+ "description": "Gets a reply by ID.",
+ "parameters": {
+ "commentId": {
+ "type": "string",
+ "description": "The ID of the comment.",
+ "required": true,
+ "location": "path"
+ },
+ "fileId": {
+ "type": "string",
+ "description": "The ID of the file.",
+ "required": true,
+ "location": "path"
+ },
+ "includeDeleted": {
+ "type": "boolean",
+ "description": "Whether to return deleted replies. Deleted replies will not include their original content.",
+ "default": "false",
+ "location": "query"
+ },
+ "replyId": {
+ "type": "string",
+ "description": "The ID of the reply.",
+ "required": true,
+ "location": "path"
+ }
+ },
+ "parameterOrder": [
+ "fileId",
+ "commentId",
+ "replyId"
+ ],
+ "response": {
+ "$ref": "Reply"
+ },
+ "scopes": [
+ "https://www.googleapis.com/auth/drive",
+ "https://www.googleapis.com/auth/drive.file",
+ "https://www.googleapis.com/auth/drive.readonly"
+ ]
+ },
+ "list": {
+ "id": "drive.replies.list",
+ "path": "files/{fileId}/comments/{commentId}/replies",
+ "httpMethod": "GET",
+ "description": "Lists a comment's replies.",
+ "parameters": {
+ "commentId": {
+ "type": "string",
+ "description": "The ID of the comment.",
+ "required": true,
+ "location": "path"
+ },
+ "fileId": {
+ "type": "string",
+ "description": "The ID of the file.",
+ "required": true,
+ "location": "path"
+ },
+ "includeDeleted": {
+ "type": "boolean",
+ "description": "Whether to include deleted replies. Deleted replies will not include their original content.",
+ "default": "false",
+ "location": "query"
+ },
+ "pageSize": {
+ "type": "integer",
+ "description": "The maximum number of replies to return per page.",
+ "default": "20",
+ "format": "int32",
+ "minimum": "1",
+ "maximum": "100",
+ "location": "query"
+ },
+ "pageToken": {
+ "type": "string",
+ "description": "The token for continuing a previous list request on the next page. This should be set to the value of 'nextPageToken' from the previous response.",
+ "location": "query"
+ }
+ },
+ "parameterOrder": [
+ "fileId",
+ "commentId"
+ ],
+ "response": {
+ "$ref": "ReplyList"
+ },
+ "scopes": [
+ "https://www.googleapis.com/auth/drive",
+ "https://www.googleapis.com/auth/drive.file",
+ "https://www.googleapis.com/auth/drive.readonly"
+ ]
+ },
+ "update": {
+ "id": "drive.replies.update",
+ "path": "files/{fileId}/comments/{commentId}/replies/{replyId}",
+ "httpMethod": "PATCH",
+ "description": "Updates a reply with patch semantics.",
+ "parameters": {
+ "commentId": {
+ "type": "string",
+ "description": "The ID of the comment.",
+ "required": true,
+ "location": "path"
+ },
+ "fileId": {
+ "type": "string",
+ "description": "The ID of the file.",
+ "required": true,
+ "location": "path"
+ },
+ "replyId": {
+ "type": "string",
+ "description": "The ID of the reply.",
+ "required": true,
+ "location": "path"
+ }
+ },
+ "parameterOrder": [
+ "fileId",
+ "commentId",
+ "replyId"
+ ],
+ "request": {
+ "$ref": "Reply"
+ },
+ "response": {
+ "$ref": "Reply"
+ },
+ "scopes": [
+ "https://www.googleapis.com/auth/drive",
+ "https://www.googleapis.com/auth/drive.file"
+ ]
+ }
+ }
+ },
+ "revisions": {
+ "methods": {
+ "delete": {
+ "id": "drive.revisions.delete",
+ "path": "files/{fileId}/revisions/{revisionId}",
+ "httpMethod": "DELETE",
+ "description": "Permanently deletes a revision. This method is only applicable to files with binary content in Drive.",
+ "parameters": {
+ "fileId": {
+ "type": "string",
+ "description": "The ID of the file.",
+ "required": true,
+ "location": "path"
+ },
+ "revisionId": {
+ "type": "string",
+ "description": "The ID of the revision.",
+ "required": true,
+ "location": "path"
+ }
+ },
+ "parameterOrder": [
+ "fileId",
+ "revisionId"
+ ],
+ "scopes": [
+ "https://www.googleapis.com/auth/drive",
+ "https://www.googleapis.com/auth/drive.appdata",
+ "https://www.googleapis.com/auth/drive.file"
+ ]
+ },
+ "get": {
+ "id": "drive.revisions.get",
+ "path": "files/{fileId}/revisions/{revisionId}",
+ "httpMethod": "GET",
+ "description": "Gets a revision's metadata or content by ID.",
+ "parameters": {
+ "acknowledgeAbuse": {
+ "type": "boolean",
+ "description": "Whether the user is acknowledging the risk of downloading known malware or other abusive files. This is only applicable when alt=media.",
+ "default": "false",
+ "location": "query"
+ },
+ "fileId": {
+ "type": "string",
+ "description": "The ID of the file.",
+ "required": true,
+ "location": "path"
+ },
+ "revisionId": {
+ "type": "string",
+ "description": "The ID of the revision.",
+ "required": true,
+ "location": "path"
+ }
+ },
+ "parameterOrder": [
+ "fileId",
+ "revisionId"
+ ],
+ "response": {
+ "$ref": "Revision"
+ },
+ "scopes": [
+ "https://www.googleapis.com/auth/drive",
+ "https://www.googleapis.com/auth/drive.appdata",
+ "https://www.googleapis.com/auth/drive.file",
+ "https://www.googleapis.com/auth/drive.metadata",
+ "https://www.googleapis.com/auth/drive.metadata.readonly",
+ "https://www.googleapis.com/auth/drive.photos.readonly",
+ "https://www.googleapis.com/auth/drive.readonly"
+ ],
+ "supportsMediaDownload": true,
+ "useMediaDownloadService": true
+ },
+ "list": {
+ "id": "drive.revisions.list",
+ "path": "files/{fileId}/revisions",
+ "httpMethod": "GET",
+ "description": "Lists a file's revisions.",
+ "parameters": {
+ "fileId": {
+ "type": "string",
+ "description": "The ID of the file.",
+ "required": true,
+ "location": "path"
+ },
+ "pageSize": {
+ "type": "integer",
+ "description": "The maximum number of revisions to return per page.",
+ "default": "200",
+ "format": "int32",
+ "minimum": "1",
+ "maximum": "1000",
+ "location": "query"
+ },
+ "pageToken": {
+ "type": "string",
+ "description": "The token for continuing a previous list request on the next page. This should be set to the value of 'nextPageToken' from the previous response.",
+ "location": "query"
+ }
+ },
+ "parameterOrder": [
+ "fileId"
+ ],
+ "response": {
+ "$ref": "RevisionList"
+ },
+ "scopes": [
+ "https://www.googleapis.com/auth/drive",
+ "https://www.googleapis.com/auth/drive.appdata",
+ "https://www.googleapis.com/auth/drive.file",
+ "https://www.googleapis.com/auth/drive.metadata",
+ "https://www.googleapis.com/auth/drive.metadata.readonly",
+ "https://www.googleapis.com/auth/drive.photos.readonly",
+ "https://www.googleapis.com/auth/drive.readonly"
+ ]
+ },
+ "update": {
+ "id": "drive.revisions.update",
+ "path": "files/{fileId}/revisions/{revisionId}",
+ "httpMethod": "PATCH",
+ "description": "Updates a revision with patch semantics.",
+ "parameters": {
+ "fileId": {
+ "type": "string",
+ "description": "The ID of the file.",
+ "required": true,
+ "location": "path"
+ },
+ "revisionId": {
+ "type": "string",
+ "description": "The ID of the revision.",
+ "required": true,
+ "location": "path"
+ }
+ },
+ "parameterOrder": [
+ "fileId",
+ "revisionId"
+ ],
+ "request": {
+ "$ref": "Revision"
+ },
+ "response": {
+ "$ref": "Revision"
+ },
+ "scopes": [
+ "https://www.googleapis.com/auth/drive",
+ "https://www.googleapis.com/auth/drive.appdata",
+ "https://www.googleapis.com/auth/drive.file"
+ ]
+ }
+ }
+ }
+ }
+}
diff --git a/tests/data/logging.json b/tests/data/logging.json
new file mode 100644
index 0000000..b702ea8
--- /dev/null
+++ b/tests/data/logging.json
@@ -0,0 +1,2090 @@
+{
+ "id": "logging:v2",
+ "auth": {
+ "oauth2": {
+ "scopes": {
+ "https://www.googleapis.com/auth/cloud-platform": {
+ "description": "View and manage your data across Google Cloud Platform services"
+ },
+ "https://www.googleapis.com/auth/cloud-platform.read-only": {
+ "description": "View your data across Google Cloud Platform services"
+ },
+ "https://www.googleapis.com/auth/logging.read": {
+ "description": "View log data for your projects"
+ },
+ "https://www.googleapis.com/auth/logging.write": {
+ "description": "Submit log data for your projects"
+ },
+ "https://www.googleapis.com/auth/logging.admin": {
+ "description": "Administrate log data for your projects"
+ }
+ }
+ }
+ },
+ "description": "Writes log entries and manages your Stackdriver Logging configuration.",
+ "protocol": "rest",
+ "title": "Stackdriver Logging API",
+ "resources": {
+ "folders": {
+ "resources": {
+ "logs": {
+ "methods": {
+ "list": {
+ "id": "logging.folders.logs.list",
+ "response": {
+ "$ref": "ListLogsResponse"
+ },
+ "parameterOrder": [
+ "parent"
+ ],
+ "description": "Lists the logs in projects or organizations. Only logs that have entries are listed.",
+ "flatPath": "v2/folders/{foldersId}/logs",
+ "httpMethod": "GET",
+ "parameters": {
+ "pageSize": {
+ "description": "Optional. The maximum number of results to return from this request. Non-positive values are ignored. The presence of nextPageToken in the response indicates that more results might be available.",
+ "location": "query",
+ "type": "integer",
+ "format": "int32"
+ },
+ "parent": {
+ "description": "Required. The resource name that owns the logs:\n\"projects/[PROJECT_ID]\"\n\"organizations/[ORGANIZATION_ID]\"\n",
+ "required": true,
+ "pattern": "^folders/[^/]+$",
+ "location": "path",
+ "type": "string"
+ },
+ "pageToken": {
+ "description": "Optional. If present, then retrieve the next batch of results from the preceding call to this method. pageToken must be the value of nextPageToken from the previous response. The values of other method parameters should be identical to those in the previous call.",
+ "location": "query",
+ "type": "string"
+ }
+ },
+ "path": "v2/{+parent}/logs",
+ "scopes": [
+ "https://www.googleapis.com/auth/cloud-platform",
+ "https://www.googleapis.com/auth/cloud-platform.read-only",
+ "https://www.googleapis.com/auth/logging.admin",
+ "https://www.googleapis.com/auth/logging.read"
+ ]
+ },
+ "delete": {
+ "id": "logging.folders.logs.delete",
+ "response": {
+ "$ref": "Empty"
+ },
+ "parameterOrder": [
+ "logName"
+ ],
+ "description": "Deletes all the log entries in a log. The log reappears if it receives new entries.",
+ "flatPath": "v2/folders/{foldersId}/logs/{logsId}",
+ "httpMethod": "DELETE",
+ "parameters": {
+ "logName": {
+ "description": "Required. The resource name of the log to delete:\n\"projects/[PROJECT_ID]/logs/[LOG_ID]\"\n\"organizations/[ORGANIZATION_ID]/logs/[LOG_ID]\"\n[LOG_ID] must be URL-encoded. For example, \"projects/my-project-id/logs/syslog\", \"organizations/1234567890/logs/cloudresourcemanager.googleapis.com%2Factivity\". For more information about log names, see LogEntry.",
+ "required": true,
+ "pattern": "^folders/[^/]+/logs/[^/]+$",
+ "location": "path",
+ "type": "string"
+ }
+ },
+ "path": "v2/{+logName}",
+ "scopes": [
+ "https://www.googleapis.com/auth/cloud-platform",
+ "https://www.googleapis.com/auth/logging.admin"
+ ]
+ }
+ }
+ },
+ "sinks": {
+ "methods": {
+ "update": {
+ "id": "logging.folders.sinks.update",
+ "response": {
+ "$ref": "LogSink"
+ },
+ "parameterOrder": [
+ "sinkName"
+ ],
+ "description": "Updates a sink. If the named sink doesn't exist, then this method is identical to sinks.create. If the named sink does exist, then this method replaces the following fields in the existing sink with values from the new sink: destination, filter, output_version_format, start_time, and end_time. The updated filter might also have a new writer_identity; see the unique_writer_identity field.",
+ "request": {
+ "$ref": "LogSink"
+ },
+ "flatPath": "v2/folders/{foldersId}/sinks/{sinksId}",
+ "httpMethod": "PUT",
+ "parameters": {
+ "sinkName": {
+ "description": "Required. The full resource name of the sink to update, including the parent resource and the sink identifier:\n\"projects/[PROJECT_ID]/sinks/[SINK_ID]\"\n\"organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]\"\nExample: \"projects/my-project-id/sinks/my-sink-id\".",
+ "required": true,
+ "pattern": "^folders/[^/]+/sinks/[^/]+$",
+ "location": "path",
+ "type": "string"
+ },
+ "uniqueWriterIdentity": {
+ "description": "Optional. See sinks.create for a description of this field. When updating a sink, the effect of this field on the value of writer_identity in the updated sink depends on both the old and new values of this field:\nIf the old and new values of this field are both false or both true, then there is no change to the sink's writer_identity.\nIf the old value was false and the new value is true, then writer_identity is changed to a unique service account.\nIt is an error if the old value was true and the new value is false.",
+ "location": "query",
+ "type": "boolean"
+ }
+ },
+ "path": "v2/{+sinkName}",
+ "scopes": [
+ "https://www.googleapis.com/auth/cloud-platform",
+ "https://www.googleapis.com/auth/logging.admin"
+ ]
+ },
+ "get": {
+ "id": "logging.folders.sinks.get",
+ "response": {
+ "$ref": "LogSink"
+ },
+ "parameterOrder": [
+ "sinkName"
+ ],
+ "description": "Gets a sink.",
+ "flatPath": "v2/folders/{foldersId}/sinks/{sinksId}",
+ "httpMethod": "GET",
+ "parameters": {
+ "sinkName": {
+ "description": "Required. The parent resource name of the sink:\n\"projects/[PROJECT_ID]/sinks/[SINK_ID]\"\n\"organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]\"\nExample: \"projects/my-project-id/sinks/my-sink-id\".",
+ "required": true,
+ "pattern": "^folders/[^/]+/sinks/[^/]+$",
+ "location": "path",
+ "type": "string"
+ }
+ },
+ "path": "v2/{+sinkName}",
+ "scopes": [
+ "https://www.googleapis.com/auth/cloud-platform",
+ "https://www.googleapis.com/auth/cloud-platform.read-only",
+ "https://www.googleapis.com/auth/logging.admin",
+ "https://www.googleapis.com/auth/logging.read"
+ ]
+ },
+ "create": {
+ "id": "logging.folders.sinks.create",
+ "response": {
+ "$ref": "LogSink"
+ },
+ "parameterOrder": [
+ "parent"
+ ],
+ "description": "Creates a sink that exports specified log entries to a destination. The export of newly-ingested log entries begins immediately, unless the current time is outside the sink's start and end times or the sink's writer_identity is not permitted to write to the destination. A sink can export log entries only from the resource owning the sink.",
+ "request": {
+ "$ref": "LogSink"
+ },
+ "flatPath": "v2/folders/{foldersId}/sinks",
+ "httpMethod": "POST",
+ "parameters": {
+ "uniqueWriterIdentity": {
+ "description": "Optional. Determines the kind of IAM identity returned as writer_identity in the new sink. If this value is omitted or set to false, and if the sink's parent is a project, then the value returned as writer_identity is cloud-logs@google.com, the same identity used before the addition of writer identities to this API. The sink's destination must be in the same project as the sink itself.If this field is set to true, or if the sink is owned by a non-project resource such as an organization, then the value of writer_identity will be a unique service account used only for exports from the new sink. For more information, see writer_identity in LogSink.",
+ "location": "query",
+ "type": "boolean"
+ },
+ "parent": {
+ "description": "Required. The resource in which to create the sink:\n\"projects/[PROJECT_ID]\"\n\"organizations/[ORGANIZATION_ID]\"\nExamples: \"projects/my-logging-project\", \"organizations/123456789\".",
+ "required": true,
+ "pattern": "^folders/[^/]+$",
+ "location": "path",
+ "type": "string"
+ }
+ },
+ "path": "v2/{+parent}/sinks",
+ "scopes": [
+ "https://www.googleapis.com/auth/cloud-platform",
+ "https://www.googleapis.com/auth/logging.admin"
+ ]
+ },
+ "list": {
+ "id": "logging.folders.sinks.list",
+ "response": {
+ "$ref": "ListSinksResponse"
+ },
+ "parameterOrder": [
+ "parent"
+ ],
+ "description": "Lists sinks.",
+ "flatPath": "v2/folders/{foldersId}/sinks",
+ "httpMethod": "GET",
+ "parameters": {
+ "pageSize": {
+ "description": "Optional. The maximum number of results to return from this request. Non-positive values are ignored. The presence of nextPageToken in the response indicates that more results might be available.",
+ "location": "query",
+ "type": "integer",
+ "format": "int32"
+ },
+ "parent": {
+ "description": "Required. The parent resource whose sinks are to be listed. Examples: \"projects/my-logging-project\", \"organizations/123456789\".",
+ "required": true,
+ "pattern": "^folders/[^/]+$",
+ "location": "path",
+ "type": "string"
+ },
+ "pageToken": {
+ "description": "Optional. If present, then retrieve the next batch of results from the preceding call to this method. pageToken must be the value of nextPageToken from the previous response. The values of other method parameters should be identical to those in the previous call.",
+ "location": "query",
+ "type": "string"
+ }
+ },
+ "path": "v2/{+parent}/sinks",
+ "scopes": [
+ "https://www.googleapis.com/auth/cloud-platform",
+ "https://www.googleapis.com/auth/cloud-platform.read-only",
+ "https://www.googleapis.com/auth/logging.admin",
+ "https://www.googleapis.com/auth/logging.read"
+ ]
+ },
+ "delete": {
+ "id": "logging.folders.sinks.delete",
+ "response": {
+ "$ref": "Empty"
+ },
+ "parameterOrder": [
+ "sinkName"
+ ],
+ "description": "Deletes a sink. If the sink has a unique writer_identity, then that service account is also deleted.",
+ "flatPath": "v2/folders/{foldersId}/sinks/{sinksId}",
+ "httpMethod": "DELETE",
+ "parameters": {
+ "sinkName": {
+ "description": "Required. The full resource name of the sink to delete, including the parent resource and the sink identifier:\n\"projects/[PROJECT_ID]/sinks/[SINK_ID]\"\n\"organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]\"\nIt is an error if the sink does not exist. Example: \"projects/my-project-id/sinks/my-sink-id\". It is an error if the sink does not exist.",
+ "required": true,
+ "pattern": "^folders/[^/]+/sinks/[^/]+$",
+ "location": "path",
+ "type": "string"
+ }
+ },
+ "path": "v2/{+sinkName}",
+ "scopes": [
+ "https://www.googleapis.com/auth/cloud-platform",
+ "https://www.googleapis.com/auth/logging.admin"
+ ]
+ }
+ }
+ }
+ }
+ },
+ "billingAccounts": {
+ "resources": {
+ "logs": {
+ "methods": {
+ "list": {
+ "id": "logging.billingAccounts.logs.list",
+ "response": {
+ "$ref": "ListLogsResponse"
+ },
+ "parameterOrder": [
+ "parent"
+ ],
+ "description": "Lists the logs in projects or organizations. Only logs that have entries are listed.",
+ "flatPath": "v2/billingAccounts/{billingAccountsId}/logs",
+ "httpMethod": "GET",
+ "parameters": {
+ "pageSize": {
+ "description": "Optional. The maximum number of results to return from this request. Non-positive values are ignored. The presence of nextPageToken in the response indicates that more results might be available.",
+ "location": "query",
+ "type": "integer",
+ "format": "int32"
+ },
+ "parent": {
+ "description": "Required. The resource name that owns the logs:\n\"projects/[PROJECT_ID]\"\n\"organizations/[ORGANIZATION_ID]\"\n",
+ "required": true,
+ "pattern": "^billingAccounts/[^/]+$",
+ "location": "path",
+ "type": "string"
+ },
+ "pageToken": {
+ "description": "Optional. If present, then retrieve the next batch of results from the preceding call to this method. pageToken must be the value of nextPageToken from the previous response. The values of other method parameters should be identical to those in the previous call.",
+ "location": "query",
+ "type": "string"
+ }
+ },
+ "path": "v2/{+parent}/logs",
+ "scopes": [
+ "https://www.googleapis.com/auth/cloud-platform",
+ "https://www.googleapis.com/auth/cloud-platform.read-only",
+ "https://www.googleapis.com/auth/logging.admin",
+ "https://www.googleapis.com/auth/logging.read"
+ ]
+ },
+ "delete": {
+ "id": "logging.billingAccounts.logs.delete",
+ "response": {
+ "$ref": "Empty"
+ },
+ "parameterOrder": [
+ "logName"
+ ],
+ "description": "Deletes all the log entries in a log. The log reappears if it receives new entries.",
+ "flatPath": "v2/billingAccounts/{billingAccountsId}/logs/{logsId}",
+ "httpMethod": "DELETE",
+ "parameters": {
+ "logName": {
+ "description": "Required. The resource name of the log to delete:\n\"projects/[PROJECT_ID]/logs/[LOG_ID]\"\n\"organizations/[ORGANIZATION_ID]/logs/[LOG_ID]\"\n[LOG_ID] must be URL-encoded. For example, \"projects/my-project-id/logs/syslog\", \"organizations/1234567890/logs/cloudresourcemanager.googleapis.com%2Factivity\". For more information about log names, see LogEntry.",
+ "required": true,
+ "pattern": "^billingAccounts/[^/]+/logs/[^/]+$",
+ "location": "path",
+ "type": "string"
+ }
+ },
+ "path": "v2/{+logName}",
+ "scopes": [
+ "https://www.googleapis.com/auth/cloud-platform",
+ "https://www.googleapis.com/auth/logging.admin"
+ ]
+ }
+ }
+ },
+ "sinks": {
+ "methods": {
+ "update": {
+ "id": "logging.billingAccounts.sinks.update",
+ "response": {
+ "$ref": "LogSink"
+ },
+ "parameterOrder": [
+ "sinkName"
+ ],
+ "description": "Updates a sink. If the named sink doesn't exist, then this method is identical to sinks.create. If the named sink does exist, then this method replaces the following fields in the existing sink with values from the new sink: destination, filter, output_version_format, start_time, and end_time. The updated filter might also have a new writer_identity; see the unique_writer_identity field.",
+ "request": {
+ "$ref": "LogSink"
+ },
+ "flatPath": "v2/billingAccounts/{billingAccountsId}/sinks/{sinksId}",
+ "httpMethod": "PUT",
+ "parameters": {
+ "sinkName": {
+ "description": "Required. The full resource name of the sink to update, including the parent resource and the sink identifier:\n\"projects/[PROJECT_ID]/sinks/[SINK_ID]\"\n\"organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]\"\nExample: \"projects/my-project-id/sinks/my-sink-id\".",
+ "required": true,
+ "pattern": "^billingAccounts/[^/]+/sinks/[^/]+$",
+ "location": "path",
+ "type": "string"
+ },
+ "uniqueWriterIdentity": {
+ "description": "Optional. See sinks.create for a description of this field. When updating a sink, the effect of this field on the value of writer_identity in the updated sink depends on both the old and new values of this field:\nIf the old and new values of this field are both false or both true, then there is no change to the sink's writer_identity.\nIf the old value was false and the new value is true, then writer_identity is changed to a unique service account.\nIt is an error if the old value was true and the new value is false.",
+ "location": "query",
+ "type": "boolean"
+ }
+ },
+ "path": "v2/{+sinkName}",
+ "scopes": [
+ "https://www.googleapis.com/auth/cloud-platform",
+ "https://www.googleapis.com/auth/logging.admin"
+ ]
+ },
+ "get": {
+ "id": "logging.billingAccounts.sinks.get",
+ "response": {
+ "$ref": "LogSink"
+ },
+ "parameterOrder": [
+ "sinkName"
+ ],
+ "description": "Gets a sink.",
+ "flatPath": "v2/billingAccounts/{billingAccountsId}/sinks/{sinksId}",
+ "httpMethod": "GET",
+ "parameters": {
+ "sinkName": {
+ "description": "Required. The parent resource name of the sink:\n\"projects/[PROJECT_ID]/sinks/[SINK_ID]\"\n\"organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]\"\nExample: \"projects/my-project-id/sinks/my-sink-id\".",
+ "required": true,
+ "pattern": "^billingAccounts/[^/]+/sinks/[^/]+$",
+ "location": "path",
+ "type": "string"
+ }
+ },
+ "path": "v2/{+sinkName}",
+ "scopes": [
+ "https://www.googleapis.com/auth/cloud-platform",
+ "https://www.googleapis.com/auth/cloud-platform.read-only",
+ "https://www.googleapis.com/auth/logging.admin",
+ "https://www.googleapis.com/auth/logging.read"
+ ]
+ },
+ "create": {
+ "id": "logging.billingAccounts.sinks.create",
+ "response": {
+ "$ref": "LogSink"
+ },
+ "parameterOrder": [
+ "parent"
+ ],
+ "description": "Creates a sink that exports specified log entries to a destination. The export of newly-ingested log entries begins immediately, unless the current time is outside the sink's start and end times or the sink's writer_identity is not permitted to write to the destination. A sink can export log entries only from the resource owning the sink.",
+ "request": {
+ "$ref": "LogSink"
+ },
+ "flatPath": "v2/billingAccounts/{billingAccountsId}/sinks",
+ "httpMethod": "POST",
+ "parameters": {
+ "uniqueWriterIdentity": {
+ "description": "Optional. Determines the kind of IAM identity returned as writer_identity in the new sink. If this value is omitted or set to false, and if the sink's parent is a project, then the value returned as writer_identity is cloud-logs@google.com, the same identity used before the addition of writer identities to this API. The sink's destination must be in the same project as the sink itself.If this field is set to true, or if the sink is owned by a non-project resource such as an organization, then the value of writer_identity will be a unique service account used only for exports from the new sink. For more information, see writer_identity in LogSink.",
+ "location": "query",
+ "type": "boolean"
+ },
+ "parent": {
+ "description": "Required. The resource in which to create the sink:\n\"projects/[PROJECT_ID]\"\n\"organizations/[ORGANIZATION_ID]\"\nExamples: \"projects/my-logging-project\", \"organizations/123456789\".",
+ "required": true,
+ "pattern": "^billingAccounts/[^/]+$",
+ "location": "path",
+ "type": "string"
+ }
+ },
+ "path": "v2/{+parent}/sinks",
+ "scopes": [
+ "https://www.googleapis.com/auth/cloud-platform",
+ "https://www.googleapis.com/auth/logging.admin"
+ ]
+ },
+ "list": {
+ "id": "logging.billingAccounts.sinks.list",
+ "response": {
+ "$ref": "ListSinksResponse"
+ },
+ "parameterOrder": [
+ "parent"
+ ],
+ "description": "Lists sinks.",
+ "flatPath": "v2/billingAccounts/{billingAccountsId}/sinks",
+ "httpMethod": "GET",
+ "parameters": {
+ "pageSize": {
+ "description": "Optional. The maximum number of results to return from this request. Non-positive values are ignored. The presence of nextPageToken in the response indicates that more results might be available.",
+ "location": "query",
+ "type": "integer",
+ "format": "int32"
+ },
+ "parent": {
+ "description": "Required. The parent resource whose sinks are to be listed. Examples: \"projects/my-logging-project\", \"organizations/123456789\".",
+ "required": true,
+ "pattern": "^billingAccounts/[^/]+$",
+ "location": "path",
+ "type": "string"
+ },
+ "pageToken": {
+ "description": "Optional. If present, then retrieve the next batch of results from the preceding call to this method. pageToken must be the value of nextPageToken from the previous response. The values of other method parameters should be identical to those in the previous call.",
+ "location": "query",
+ "type": "string"
+ }
+ },
+ "path": "v2/{+parent}/sinks",
+ "scopes": [
+ "https://www.googleapis.com/auth/cloud-platform",
+ "https://www.googleapis.com/auth/cloud-platform.read-only",
+ "https://www.googleapis.com/auth/logging.admin",
+ "https://www.googleapis.com/auth/logging.read"
+ ]
+ },
+ "delete": {
+ "id": "logging.billingAccounts.sinks.delete",
+ "response": {
+ "$ref": "Empty"
+ },
+ "parameterOrder": [
+ "sinkName"
+ ],
+ "description": "Deletes a sink. If the sink has a unique writer_identity, then that service account is also deleted.",
+ "flatPath": "v2/billingAccounts/{billingAccountsId}/sinks/{sinksId}",
+ "httpMethod": "DELETE",
+ "parameters": {
+ "sinkName": {
+ "description": "Required. The full resource name of the sink to delete, including the parent resource and the sink identifier:\n\"projects/[PROJECT_ID]/sinks/[SINK_ID]\"\n\"organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]\"\nIt is an error if the sink does not exist. Example: \"projects/my-project-id/sinks/my-sink-id\". It is an error if the sink does not exist.",
+ "required": true,
+ "pattern": "^billingAccounts/[^/]+/sinks/[^/]+$",
+ "location": "path",
+ "type": "string"
+ }
+ },
+ "path": "v2/{+sinkName}",
+ "scopes": [
+ "https://www.googleapis.com/auth/cloud-platform",
+ "https://www.googleapis.com/auth/logging.admin"
+ ]
+ }
+ }
+ }
+ }
+ },
+ "organizations": {
+ "resources": {
+ "logs": {
+ "methods": {
+ "list": {
+ "id": "logging.organizations.logs.list",
+ "response": {
+ "$ref": "ListLogsResponse"
+ },
+ "parameterOrder": [
+ "parent"
+ ],
+ "description": "Lists the logs in projects or organizations. Only logs that have entries are listed.",
+ "flatPath": "v2/organizations/{organizationsId}/logs",
+ "httpMethod": "GET",
+ "parameters": {
+ "pageSize": {
+ "description": "Optional. The maximum number of results to return from this request. Non-positive values are ignored. The presence of nextPageToken in the response indicates that more results might be available.",
+ "location": "query",
+ "type": "integer",
+ "format": "int32"
+ },
+ "parent": {
+ "description": "Required. The resource name that owns the logs:\n\"projects/[PROJECT_ID]\"\n\"organizations/[ORGANIZATION_ID]\"\n",
+ "required": true,
+ "pattern": "^organizations/[^/]+$",
+ "location": "path",
+ "type": "string"
+ },
+ "pageToken": {
+ "description": "Optional. If present, then retrieve the next batch of results from the preceding call to this method. pageToken must be the value of nextPageToken from the previous response. The values of other method parameters should be identical to those in the previous call.",
+ "location": "query",
+ "type": "string"
+ }
+ },
+ "path": "v2/{+parent}/logs",
+ "scopes": [
+ "https://www.googleapis.com/auth/cloud-platform",
+ "https://www.googleapis.com/auth/cloud-platform.read-only",
+ "https://www.googleapis.com/auth/logging.admin",
+ "https://www.googleapis.com/auth/logging.read"
+ ]
+ },
+ "delete": {
+ "id": "logging.organizations.logs.delete",
+ "response": {
+ "$ref": "Empty"
+ },
+ "parameterOrder": [
+ "logName"
+ ],
+ "description": "Deletes all the log entries in a log. The log reappears if it receives new entries.",
+ "flatPath": "v2/organizations/{organizationsId}/logs/{logsId}",
+ "httpMethod": "DELETE",
+ "parameters": {
+ "logName": {
+ "description": "Required. The resource name of the log to delete:\n\"projects/[PROJECT_ID]/logs/[LOG_ID]\"\n\"organizations/[ORGANIZATION_ID]/logs/[LOG_ID]\"\n[LOG_ID] must be URL-encoded. For example, \"projects/my-project-id/logs/syslog\", \"organizations/1234567890/logs/cloudresourcemanager.googleapis.com%2Factivity\". For more information about log names, see LogEntry.",
+ "required": true,
+ "pattern": "^organizations/[^/]+/logs/[^/]+$",
+ "location": "path",
+ "type": "string"
+ }
+ },
+ "path": "v2/{+logName}",
+ "scopes": [
+ "https://www.googleapis.com/auth/cloud-platform",
+ "https://www.googleapis.com/auth/logging.admin"
+ ]
+ }
+ }
+ },
+ "sinks": {
+ "methods": {
+ "update": {
+ "id": "logging.organizations.sinks.update",
+ "response": {
+ "$ref": "LogSink"
+ },
+ "parameterOrder": [
+ "sinkName"
+ ],
+ "description": "Updates a sink. If the named sink doesn't exist, then this method is identical to sinks.create. If the named sink does exist, then this method replaces the following fields in the existing sink with values from the new sink: destination, filter, output_version_format, start_time, and end_time. The updated filter might also have a new writer_identity; see the unique_writer_identity field.",
+ "request": {
+ "$ref": "LogSink"
+ },
+ "flatPath": "v2/organizations/{organizationsId}/sinks/{sinksId}",
+ "httpMethod": "PUT",
+ "parameters": {
+ "sinkName": {
+ "description": "Required. The full resource name of the sink to update, including the parent resource and the sink identifier:\n\"projects/[PROJECT_ID]/sinks/[SINK_ID]\"\n\"organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]\"\nExample: \"projects/my-project-id/sinks/my-sink-id\".",
+ "required": true,
+ "pattern": "^organizations/[^/]+/sinks/[^/]+$",
+ "location": "path",
+ "type": "string"
+ },
+ "uniqueWriterIdentity": {
+ "description": "Optional. See sinks.create for a description of this field. When updating a sink, the effect of this field on the value of writer_identity in the updated sink depends on both the old and new values of this field:\nIf the old and new values of this field are both false or both true, then there is no change to the sink's writer_identity.\nIf the old value was false and the new value is true, then writer_identity is changed to a unique service account.\nIt is an error if the old value was true and the new value is false.",
+ "location": "query",
+ "type": "boolean"
+ }
+ },
+ "path": "v2/{+sinkName}",
+ "scopes": [
+ "https://www.googleapis.com/auth/cloud-platform",
+ "https://www.googleapis.com/auth/logging.admin"
+ ]
+ },
+ "get": {
+ "id": "logging.organizations.sinks.get",
+ "response": {
+ "$ref": "LogSink"
+ },
+ "parameterOrder": [
+ "sinkName"
+ ],
+ "description": "Gets a sink.",
+ "flatPath": "v2/organizations/{organizationsId}/sinks/{sinksId}",
+ "httpMethod": "GET",
+ "parameters": {
+ "sinkName": {
+ "description": "Required. The parent resource name of the sink:\n\"projects/[PROJECT_ID]/sinks/[SINK_ID]\"\n\"organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]\"\nExample: \"projects/my-project-id/sinks/my-sink-id\".",
+ "required": true,
+ "pattern": "^organizations/[^/]+/sinks/[^/]+$",
+ "location": "path",
+ "type": "string"
+ }
+ },
+ "path": "v2/{+sinkName}",
+ "scopes": [
+ "https://www.googleapis.com/auth/cloud-platform",
+ "https://www.googleapis.com/auth/cloud-platform.read-only",
+ "https://www.googleapis.com/auth/logging.admin",
+ "https://www.googleapis.com/auth/logging.read"
+ ]
+ },
+ "create": {
+ "id": "logging.organizations.sinks.create",
+ "response": {
+ "$ref": "LogSink"
+ },
+ "parameterOrder": [
+ "parent"
+ ],
+ "description": "Creates a sink that exports specified log entries to a destination. The export of newly-ingested log entries begins immediately, unless the current time is outside the sink's start and end times or the sink's writer_identity is not permitted to write to the destination. A sink can export log entries only from the resource owning the sink.",
+ "request": {
+ "$ref": "LogSink"
+ },
+ "flatPath": "v2/organizations/{organizationsId}/sinks",
+ "httpMethod": "POST",
+ "parameters": {
+ "uniqueWriterIdentity": {
+ "description": "Optional. Determines the kind of IAM identity returned as writer_identity in the new sink. If this value is omitted or set to false, and if the sink's parent is a project, then the value returned as writer_identity is cloud-logs@google.com, the same identity used before the addition of writer identities to this API. The sink's destination must be in the same project as the sink itself.If this field is set to true, or if the sink is owned by a non-project resource such as an organization, then the value of writer_identity will be a unique service account used only for exports from the new sink. For more information, see writer_identity in LogSink.",
+ "location": "query",
+ "type": "boolean"
+ },
+ "parent": {
+ "description": "Required. The resource in which to create the sink:\n\"projects/[PROJECT_ID]\"\n\"organizations/[ORGANIZATION_ID]\"\nExamples: \"projects/my-logging-project\", \"organizations/123456789\".",
+ "required": true,
+ "pattern": "^organizations/[^/]+$",
+ "location": "path",
+ "type": "string"
+ }
+ },
+ "path": "v2/{+parent}/sinks",
+ "scopes": [
+ "https://www.googleapis.com/auth/cloud-platform",
+ "https://www.googleapis.com/auth/logging.admin"
+ ]
+ },
+ "list": {
+ "id": "logging.organizations.sinks.list",
+ "response": {
+ "$ref": "ListSinksResponse"
+ },
+ "parameterOrder": [
+ "parent"
+ ],
+ "description": "Lists sinks.",
+ "flatPath": "v2/organizations/{organizationsId}/sinks",
+ "httpMethod": "GET",
+ "parameters": {
+ "pageSize": {
+ "description": "Optional. The maximum number of results to return from this request. Non-positive values are ignored. The presence of nextPageToken in the response indicates that more results might be available.",
+ "location": "query",
+ "type": "integer",
+ "format": "int32"
+ },
+ "parent": {
+ "description": "Required. The parent resource whose sinks are to be listed. Examples: \"projects/my-logging-project\", \"organizations/123456789\".",
+ "required": true,
+ "pattern": "^organizations/[^/]+$",
+ "location": "path",
+ "type": "string"
+ },
+ "pageToken": {
+ "description": "Optional. If present, then retrieve the next batch of results from the preceding call to this method. pageToken must be the value of nextPageToken from the previous response. The values of other method parameters should be identical to those in the previous call.",
+ "location": "query",
+ "type": "string"
+ }
+ },
+ "path": "v2/{+parent}/sinks",
+ "scopes": [
+ "https://www.googleapis.com/auth/cloud-platform",
+ "https://www.googleapis.com/auth/cloud-platform.read-only",
+ "https://www.googleapis.com/auth/logging.admin",
+ "https://www.googleapis.com/auth/logging.read"
+ ]
+ },
+ "delete": {
+ "id": "logging.organizations.sinks.delete",
+ "response": {
+ "$ref": "Empty"
+ },
+ "parameterOrder": [
+ "sinkName"
+ ],
+ "description": "Deletes a sink. If the sink has a unique writer_identity, then that service account is also deleted.",
+ "flatPath": "v2/organizations/{organizationsId}/sinks/{sinksId}",
+ "httpMethod": "DELETE",
+ "parameters": {
+ "sinkName": {
+ "description": "Required. The full resource name of the sink to delete, including the parent resource and the sink identifier:\n\"projects/[PROJECT_ID]/sinks/[SINK_ID]\"\n\"organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]\"\nIt is an error if the sink does not exist. Example: \"projects/my-project-id/sinks/my-sink-id\". It is an error if the sink does not exist.",
+ "required": true,
+ "pattern": "^organizations/[^/]+/sinks/[^/]+$",
+ "location": "path",
+ "type": "string"
+ }
+ },
+ "path": "v2/{+sinkName}",
+ "scopes": [
+ "https://www.googleapis.com/auth/cloud-platform",
+ "https://www.googleapis.com/auth/logging.admin"
+ ]
+ }
+ }
+ }
+ }
+ },
+ "projects": {
+ "resources": {
+ "metrics": {
+ "methods": {
+ "update": {
+ "id": "logging.projects.metrics.update",
+ "response": {
+ "$ref": "LogMetric"
+ },
+ "parameterOrder": [
+ "metricName"
+ ],
+ "description": "Creates or updates a logs-based metric.",
+ "request": {
+ "$ref": "LogMetric"
+ },
+ "flatPath": "v2/projects/{projectsId}/metrics/{metricsId}",
+ "httpMethod": "PUT",
+ "parameters": {
+ "metricName": {
+ "description": "The resource name of the metric to update:\n\"projects/[PROJECT_ID]/metrics/[METRIC_ID]\"\nThe updated metric must be provided in the request and it's name field must be the same as [METRIC_ID] If the metric does not exist in [PROJECT_ID], then a new metric is created.",
+ "required": true,
+ "pattern": "^projects/[^/]+/metrics/[^/]+$",
+ "location": "path",
+ "type": "string"
+ }
+ },
+ "path": "v2/{+metricName}",
+ "scopes": [
+ "https://www.googleapis.com/auth/cloud-platform",
+ "https://www.googleapis.com/auth/logging.admin",
+ "https://www.googleapis.com/auth/logging.write"
+ ]
+ },
+ "get": {
+ "id": "logging.projects.metrics.get",
+ "response": {
+ "$ref": "LogMetric"
+ },
+ "parameterOrder": [
+ "metricName"
+ ],
+ "description": "Gets a logs-based metric.",
+ "flatPath": "v2/projects/{projectsId}/metrics/{metricsId}",
+ "httpMethod": "GET",
+ "parameters": {
+ "metricName": {
+ "description": "The resource name of the desired metric:\n\"projects/[PROJECT_ID]/metrics/[METRIC_ID]\"\n",
+ "required": true,
+ "pattern": "^projects/[^/]+/metrics/[^/]+$",
+ "location": "path",
+ "type": "string"
+ }
+ },
+ "path": "v2/{+metricName}",
+ "scopes": [
+ "https://www.googleapis.com/auth/cloud-platform",
+ "https://www.googleapis.com/auth/cloud-platform.read-only",
+ "https://www.googleapis.com/auth/logging.admin",
+ "https://www.googleapis.com/auth/logging.read"
+ ]
+ },
+ "create": {
+ "id": "logging.projects.metrics.create",
+ "response": {
+ "$ref": "LogMetric"
+ },
+ "parameterOrder": [
+ "parent"
+ ],
+ "description": "Creates a logs-based metric.",
+ "request": {
+ "$ref": "LogMetric"
+ },
+ "flatPath": "v2/projects/{projectsId}/metrics",
+ "httpMethod": "POST",
+ "parameters": {
+ "parent": {
+ "description": "The resource name of the project in which to create the metric:\n\"projects/[PROJECT_ID]\"\nThe new metric must be provided in the request.",
+ "required": true,
+ "pattern": "^projects/[^/]+$",
+ "location": "path",
+ "type": "string"
+ }
+ },
+ "path": "v2/{+parent}/metrics",
+ "scopes": [
+ "https://www.googleapis.com/auth/cloud-platform",
+ "https://www.googleapis.com/auth/logging.admin",
+ "https://www.googleapis.com/auth/logging.write"
+ ]
+ },
+ "list": {
+ "id": "logging.projects.metrics.list",
+ "response": {
+ "$ref": "ListLogMetricsResponse"
+ },
+ "parameterOrder": [
+ "parent"
+ ],
+ "description": "Lists logs-based metrics.",
+ "flatPath": "v2/projects/{projectsId}/metrics",
+ "httpMethod": "GET",
+ "parameters": {
+ "pageSize": {
+ "description": "Optional. The maximum number of results to return from this request. Non-positive values are ignored. The presence of nextPageToken in the response indicates that more results might be available.",
+ "location": "query",
+ "type": "integer",
+ "format": "int32"
+ },
+ "parent": {
+ "description": "Required. The name of the project containing the metrics:\n\"projects/[PROJECT_ID]\"\n",
+ "required": true,
+ "pattern": "^projects/[^/]+$",
+ "location": "path",
+ "type": "string"
+ },
+ "pageToken": {
+ "description": "Optional. If present, then retrieve the next batch of results from the preceding call to this method. pageToken must be the value of nextPageToken from the previous response. The values of other method parameters should be identical to those in the previous call.",
+ "location": "query",
+ "type": "string"
+ }
+ },
+ "path": "v2/{+parent}/metrics",
+ "scopes": [
+ "https://www.googleapis.com/auth/cloud-platform",
+ "https://www.googleapis.com/auth/cloud-platform.read-only",
+ "https://www.googleapis.com/auth/logging.admin",
+ "https://www.googleapis.com/auth/logging.read"
+ ]
+ },
+ "delete": {
+ "id": "logging.projects.metrics.delete",
+ "response": {
+ "$ref": "Empty"
+ },
+ "parameterOrder": [
+ "metricName"
+ ],
+ "description": "Deletes a logs-based metric.",
+ "flatPath": "v2/projects/{projectsId}/metrics/{metricsId}",
+ "httpMethod": "DELETE",
+ "parameters": {
+ "metricName": {
+ "description": "The resource name of the metric to delete:\n\"projects/[PROJECT_ID]/metrics/[METRIC_ID]\"\n",
+ "required": true,
+ "pattern": "^projects/[^/]+/metrics/[^/]+$",
+ "location": "path",
+ "type": "string"
+ }
+ },
+ "path": "v2/{+metricName}",
+ "scopes": [
+ "https://www.googleapis.com/auth/cloud-platform",
+ "https://www.googleapis.com/auth/logging.admin",
+ "https://www.googleapis.com/auth/logging.write"
+ ]
+ }
+ }
+ },
+ "logs": {
+ "methods": {
+ "list": {
+ "id": "logging.projects.logs.list",
+ "response": {
+ "$ref": "ListLogsResponse"
+ },
+ "parameterOrder": [
+ "parent"
+ ],
+ "description": "Lists the logs in projects or organizations. Only logs that have entries are listed.",
+ "flatPath": "v2/projects/{projectsId}/logs",
+ "httpMethod": "GET",
+ "parameters": {
+ "pageSize": {
+ "description": "Optional. The maximum number of results to return from this request. Non-positive values are ignored. The presence of nextPageToken in the response indicates that more results might be available.",
+ "location": "query",
+ "type": "integer",
+ "format": "int32"
+ },
+ "parent": {
+ "description": "Required. The resource name that owns the logs:\n\"projects/[PROJECT_ID]\"\n\"organizations/[ORGANIZATION_ID]\"\n",
+ "required": true,
+ "pattern": "^projects/[^/]+$",
+ "location": "path",
+ "type": "string"
+ },
+ "pageToken": {
+ "description": "Optional. If present, then retrieve the next batch of results from the preceding call to this method. pageToken must be the value of nextPageToken from the previous response. The values of other method parameters should be identical to those in the previous call.",
+ "location": "query",
+ "type": "string"
+ }
+ },
+ "path": "v2/{+parent}/logs",
+ "scopes": [
+ "https://www.googleapis.com/auth/cloud-platform",
+ "https://www.googleapis.com/auth/cloud-platform.read-only",
+ "https://www.googleapis.com/auth/logging.admin",
+ "https://www.googleapis.com/auth/logging.read"
+ ]
+ },
+ "delete": {
+ "id": "logging.projects.logs.delete",
+ "response": {
+ "$ref": "Empty"
+ },
+ "parameterOrder": [
+ "logName"
+ ],
+ "description": "Deletes all the log entries in a log. The log reappears if it receives new entries.",
+ "flatPath": "v2/projects/{projectsId}/logs/{logsId}",
+ "httpMethod": "DELETE",
+ "parameters": {
+ "logName": {
+ "description": "Required. The resource name of the log to delete:\n\"projects/[PROJECT_ID]/logs/[LOG_ID]\"\n\"organizations/[ORGANIZATION_ID]/logs/[LOG_ID]\"\n[LOG_ID] must be URL-encoded. For example, \"projects/my-project-id/logs/syslog\", \"organizations/1234567890/logs/cloudresourcemanager.googleapis.com%2Factivity\". For more information about log names, see LogEntry.",
+ "required": true,
+ "pattern": "^projects/[^/]+/logs/[^/]+$",
+ "location": "path",
+ "type": "string"
+ }
+ },
+ "path": "v2/{+logName}",
+ "scopes": [
+ "https://www.googleapis.com/auth/cloud-platform",
+ "https://www.googleapis.com/auth/logging.admin"
+ ]
+ }
+ }
+ },
+ "sinks": {
+ "methods": {
+ "update": {
+ "id": "logging.projects.sinks.update",
+ "response": {
+ "$ref": "LogSink"
+ },
+ "parameterOrder": [
+ "sinkName"
+ ],
+ "description": "Updates a sink. If the named sink doesn't exist, then this method is identical to sinks.create. If the named sink does exist, then this method replaces the following fields in the existing sink with values from the new sink: destination, filter, output_version_format, start_time, and end_time. The updated filter might also have a new writer_identity; see the unique_writer_identity field.",
+ "request": {
+ "$ref": "LogSink"
+ },
+ "flatPath": "v2/projects/{projectsId}/sinks/{sinksId}",
+ "httpMethod": "PUT",
+ "parameters": {
+ "sinkName": {
+ "description": "Required. The full resource name of the sink to update, including the parent resource and the sink identifier:\n\"projects/[PROJECT_ID]/sinks/[SINK_ID]\"\n\"organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]\"\nExample: \"projects/my-project-id/sinks/my-sink-id\".",
+ "required": true,
+ "pattern": "^projects/[^/]+/sinks/[^/]+$",
+ "location": "path",
+ "type": "string"
+ },
+ "uniqueWriterIdentity": {
+ "description": "Optional. See sinks.create for a description of this field. When updating a sink, the effect of this field on the value of writer_identity in the updated sink depends on both the old and new values of this field:\nIf the old and new values of this field are both false or both true, then there is no change to the sink's writer_identity.\nIf the old value was false and the new value is true, then writer_identity is changed to a unique service account.\nIt is an error if the old value was true and the new value is false.",
+ "location": "query",
+ "type": "boolean"
+ }
+ },
+ "path": "v2/{+sinkName}",
+ "scopes": [
+ "https://www.googleapis.com/auth/cloud-platform",
+ "https://www.googleapis.com/auth/logging.admin"
+ ]
+ },
+ "get": {
+ "id": "logging.projects.sinks.get",
+ "response": {
+ "$ref": "LogSink"
+ },
+ "parameterOrder": [
+ "sinkName"
+ ],
+ "description": "Gets a sink.",
+ "flatPath": "v2/projects/{projectsId}/sinks/{sinksId}",
+ "httpMethod": "GET",
+ "parameters": {
+ "sinkName": {
+ "description": "Required. The parent resource name of the sink:\n\"projects/[PROJECT_ID]/sinks/[SINK_ID]\"\n\"organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]\"\nExample: \"projects/my-project-id/sinks/my-sink-id\".",
+ "required": true,
+ "pattern": "^projects/[^/]+/sinks/[^/]+$",
+ "location": "path",
+ "type": "string"
+ }
+ },
+ "path": "v2/{+sinkName}",
+ "scopes": [
+ "https://www.googleapis.com/auth/cloud-platform",
+ "https://www.googleapis.com/auth/cloud-platform.read-only",
+ "https://www.googleapis.com/auth/logging.admin",
+ "https://www.googleapis.com/auth/logging.read"
+ ]
+ },
+ "create": {
+ "id": "logging.projects.sinks.create",
+ "response": {
+ "$ref": "LogSink"
+ },
+ "parameterOrder": [
+ "parent"
+ ],
+ "description": "Creates a sink that exports specified log entries to a destination. The export of newly-ingested log entries begins immediately, unless the current time is outside the sink's start and end times or the sink's writer_identity is not permitted to write to the destination. A sink can export log entries only from the resource owning the sink.",
+ "request": {
+ "$ref": "LogSink"
+ },
+ "flatPath": "v2/projects/{projectsId}/sinks",
+ "httpMethod": "POST",
+ "parameters": {
+ "uniqueWriterIdentity": {
+ "description": "Optional. Determines the kind of IAM identity returned as writer_identity in the new sink. If this value is omitted or set to false, and if the sink's parent is a project, then the value returned as writer_identity is cloud-logs@google.com, the same identity used before the addition of writer identities to this API. The sink's destination must be in the same project as the sink itself.If this field is set to true, or if the sink is owned by a non-project resource such as an organization, then the value of writer_identity will be a unique service account used only for exports from the new sink. For more information, see writer_identity in LogSink.",
+ "location": "query",
+ "type": "boolean"
+ },
+ "parent": {
+ "description": "Required. The resource in which to create the sink:\n\"projects/[PROJECT_ID]\"\n\"organizations/[ORGANIZATION_ID]\"\nExamples: \"projects/my-logging-project\", \"organizations/123456789\".",
+ "required": true,
+ "pattern": "^projects/[^/]+$",
+ "location": "path",
+ "type": "string"
+ }
+ },
+ "path": "v2/{+parent}/sinks",
+ "scopes": [
+ "https://www.googleapis.com/auth/cloud-platform",
+ "https://www.googleapis.com/auth/logging.admin"
+ ]
+ },
+ "list": {
+ "id": "logging.projects.sinks.list",
+ "response": {
+ "$ref": "ListSinksResponse"
+ },
+ "parameterOrder": [
+ "parent"
+ ],
+ "description": "Lists sinks.",
+ "flatPath": "v2/projects/{projectsId}/sinks",
+ "httpMethod": "GET",
+ "parameters": {
+ "pageSize": {
+ "description": "Optional. The maximum number of results to return from this request. Non-positive values are ignored. The presence of nextPageToken in the response indicates that more results might be available.",
+ "location": "query",
+ "type": "integer",
+ "format": "int32"
+ },
+ "parent": {
+ "description": "Required. The parent resource whose sinks are to be listed. Examples: \"projects/my-logging-project\", \"organizations/123456789\".",
+ "required": true,
+ "pattern": "^projects/[^/]+$",
+ "location": "path",
+ "type": "string"
+ },
+ "pageToken": {
+ "description": "Optional. If present, then retrieve the next batch of results from the preceding call to this method. pageToken must be the value of nextPageToken from the previous response. The values of other method parameters should be identical to those in the previous call.",
+ "location": "query",
+ "type": "string"
+ }
+ },
+ "path": "v2/{+parent}/sinks",
+ "scopes": [
+ "https://www.googleapis.com/auth/cloud-platform",
+ "https://www.googleapis.com/auth/cloud-platform.read-only",
+ "https://www.googleapis.com/auth/logging.admin",
+ "https://www.googleapis.com/auth/logging.read"
+ ]
+ },
+ "delete": {
+ "id": "logging.projects.sinks.delete",
+ "response": {
+ "$ref": "Empty"
+ },
+ "parameterOrder": [
+ "sinkName"
+ ],
+ "description": "Deletes a sink. If the sink has a unique writer_identity, then that service account is also deleted.",
+ "flatPath": "v2/projects/{projectsId}/sinks/{sinksId}",
+ "httpMethod": "DELETE",
+ "parameters": {
+ "sinkName": {
+ "description": "Required. The full resource name of the sink to delete, including the parent resource and the sink identifier:\n\"projects/[PROJECT_ID]/sinks/[SINK_ID]\"\n\"organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]\"\nIt is an error if the sink does not exist. Example: \"projects/my-project-id/sinks/my-sink-id\". It is an error if the sink does not exist.",
+ "required": true,
+ "pattern": "^projects/[^/]+/sinks/[^/]+$",
+ "location": "path",
+ "type": "string"
+ }
+ },
+ "path": "v2/{+sinkName}",
+ "scopes": [
+ "https://www.googleapis.com/auth/cloud-platform",
+ "https://www.googleapis.com/auth/logging.admin"
+ ]
+ }
+ }
+ }
+ }
+ },
+ "entries": {
+ "methods": {
+ "write": {
+ "id": "logging.entries.write",
+ "response": {
+ "$ref": "WriteLogEntriesResponse"
+ },
+ "parameterOrder": [],
+ "description": "Writes log entries to Stackdriver Logging. All log entries are written by this method.",
+ "request": {
+ "$ref": "WriteLogEntriesRequest"
+ },
+ "flatPath": "v2/entries:write",
+ "httpMethod": "POST",
+ "parameters": {},
+ "path": "v2/entries:write",
+ "scopes": [
+ "https://www.googleapis.com/auth/cloud-platform",
+ "https://www.googleapis.com/auth/logging.admin",
+ "https://www.googleapis.com/auth/logging.write"
+ ]
+ },
+ "list": {
+ "id": "logging.entries.list",
+ "response": {
+ "$ref": "ListLogEntriesResponse"
+ },
+ "parameterOrder": [],
+ "description": "Lists log entries. Use this method to retrieve log entries from Stackdriver Logging. For ways to export log entries, see Exporting Logs.",
+ "request": {
+ "$ref": "ListLogEntriesRequest"
+ },
+ "flatPath": "v2/entries:list",
+ "httpMethod": "POST",
+ "parameters": {},
+ "path": "v2/entries:list",
+ "scopes": [
+ "https://www.googleapis.com/auth/cloud-platform",
+ "https://www.googleapis.com/auth/cloud-platform.read-only",
+ "https://www.googleapis.com/auth/logging.admin",
+ "https://www.googleapis.com/auth/logging.read"
+ ]
+ }
+ }
+ },
+ "monitoredResourceDescriptors": {
+ "methods": {
+ "list": {
+ "id": "logging.monitoredResourceDescriptors.list",
+ "response": {
+ "$ref": "ListMonitoredResourceDescriptorsResponse"
+ },
+ "parameterOrder": [],
+ "description": "Lists the descriptors for monitored resource types used by Stackdriver Logging.",
+ "flatPath": "v2/monitoredResourceDescriptors",
+ "httpMethod": "GET",
+ "parameters": {
+ "pageSize": {
+ "description": "Optional. The maximum number of results to return from this request. Non-positive values are ignored. The presence of nextPageToken in the response indicates that more results might be available.",
+ "location": "query",
+ "type": "integer",
+ "format": "int32"
+ },
+ "pageToken": {
+ "description": "Optional. If present, then retrieve the next batch of results from the preceding call to this method. pageToken must be the value of nextPageToken from the previous response. The values of other method parameters should be identical to those in the previous call.",
+ "location": "query",
+ "type": "string"
+ }
+ },
+ "path": "v2/monitoredResourceDescriptors",
+ "scopes": [
+ "https://www.googleapis.com/auth/cloud-platform",
+ "https://www.googleapis.com/auth/cloud-platform.read-only",
+ "https://www.googleapis.com/auth/logging.admin",
+ "https://www.googleapis.com/auth/logging.read"
+ ]
+ }
+ }
+ }
+ },
+ "schemas": {
+ "ListLogEntriesResponse": {
+ "description": "Result returned from ListLogEntries.",
+ "type": "object",
+ "properties": {
+ "entries": {
+ "description": "A list of log entries.",
+ "type": "array",
+ "items": {
+ "$ref": "LogEntry"
+ }
+ },
+ "nextPageToken": {
+ "description": "If there might be more results than those appearing in this response, then nextPageToken is included. To get the next set of results, call this method again using the value of nextPageToken as pageToken.If a value for next_page_token appears and the entries field is empty, it means that the search found no log entries so far but it did not have time to search all the possible log entries. Retry the method with this value for page_token to continue the search. Alternatively, consider speeding up the search by changing your filter to specify a single log name or resource type, or to narrow the time range of the search.",
+ "type": "string"
+ }
+ },
+ "id": "ListLogEntriesResponse"
+ },
+ "ListSinksResponse": {
+ "description": "Result returned from ListSinks.",
+ "type": "object",
+ "properties": {
+ "nextPageToken": {
+ "description": "If there might be more results than appear in this response, then nextPageToken is included. To get the next set of results, call the same method again using the value of nextPageToken as pageToken.",
+ "type": "string"
+ },
+ "sinks": {
+ "description": "A list of sinks.",
+ "type": "array",
+ "items": {
+ "$ref": "LogSink"
+ }
+ }
+ },
+ "id": "ListSinksResponse"
+ },
+ "SourceLocation": {
+ "description": "Specifies a location in a source code file.",
+ "type": "object",
+ "properties": {
+ "file": {
+ "description": "Source file name. Depending on the runtime environment, this might be a simple name or a fully-qualified name.",
+ "type": "string"
+ },
+ "functionName": {
+ "description": "Human-readable name of the function or method being invoked, with optional context such as the class or package name. This information is used in contexts such as the logs viewer, where a file and line number are less meaningful. The format can vary by language. For example: qual.if.ied.Class.method (Java), dir/package.func (Go), function (Python).",
+ "type": "string"
+ },
+ "line": {
+ "description": "Line within the source file.",
+ "type": "string",
+ "format": "int64"
+ }
+ },
+ "id": "SourceLocation"
+ },
+ "LogSink": {
+ "description": "Describes a sink used to export log entries to one of the following destinations in any project: a Cloud Storage bucket, a BigQuery dataset, or a Cloud Pub/Sub topic. A logs filter controls which log entries are exported. The sink must be created within a project or organization.",
+ "type": "object",
+ "properties": {
+ "destination": {
+ "description": "Required. The export destination:\n\"storage.googleapis.com/[GCS_BUCKET]\"\n\"bigquery.googleapis.com/projects/[PROJECT_ID]/datasets/[DATASET]\"\n\"pubsub.googleapis.com/projects/[PROJECT_ID]/topics/[TOPIC_ID]\"\nThe sink's writer_identity, set when the sink is created, must have permission to write to the destination or else the log entries are not exported. For more information, see Exporting Logs With Sinks.",
+ "type": "string"
+ },
+ "filter": {
+ "description": "Optional. An advanced logs filter. The only exported log entries are those that are in the resource owning the sink and that match the filter. The filter must use the log entry format specified by the output_version_format parameter. For example, in the v2 format:\nlogName=\"projects/[PROJECT_ID]/logs/[LOG_ID]\" AND severity\u003e=ERROR\n",
+ "type": "string"
+ },
+ "endTime": {
+ "description": "Optional. The time at which this sink will stop exporting log entries. Log entries are exported only if their timestamp is earlier than the end time. If this field is not supplied, there is no end time. If both a start time and an end time are provided, then the end time must be later than the start time.",
+ "type": "string",
+ "format": "google-datetime"
+ },
+ "name": {
+ "description": "Required. The client-assigned sink identifier, unique within the project. Example: \"my-syslog-errors-to-pubsub\". Sink identifiers are limited to 100 characters and can include only the following characters: upper and lower-case alphanumeric characters, underscores, hyphens, and periods.",
+ "type": "string"
+ },
+ "startTime": {
+ "description": "Optional. The time at which this sink will begin exporting log entries. Log entries are exported only if their timestamp is not earlier than the start time. The default value of this field is the time the sink is created or updated.",
+ "type": "string",
+ "format": "google-datetime"
+ },
+ "outputVersionFormat": {
+ "description": "Optional. The log entry format to use for this sink's exported log entries. The v2 format is used by default. The v1 format is deprecated and should be used only as part of a migration effort to v2. See Migration to the v2 API.",
+ "enum": [
+ "VERSION_FORMAT_UNSPECIFIED",
+ "V2",
+ "V1"
+ ],
+ "enumDescriptions": [
+ "An unspecified format version that will default to V2.",
+ "LogEntry version 2 format.",
+ "LogEntry version 1 format."
+ ],
+ "type": "string"
+ },
+ "writerIdentity": {
+ "description": "Output only. An IAM identity—a service account or group—under which Stackdriver Logging writes the exported log entries to the sink's destination. This field is set by sinks.create and sinks.update, based on the setting of unique_writer_identity in those methods.Until you grant this identity write-access to the destination, log entry exports from this sink will fail. For more information, see Granting access for a resource. Consult the destination service's documentation to determine the appropriate IAM roles to assign to the identity.",
+ "type": "string"
+ }
+ },
+ "id": "LogSink"
+ },
+ "ListLogsResponse": {
+ "description": "Result returned from ListLogs.",
+ "type": "object",
+ "properties": {
+ "logNames": {
+ "description": "A list of log names. For example, \"projects/my-project/syslog\" or \"organizations/123/cloudresourcemanager.googleapis.com%2Factivity\".",
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ },
+ "nextPageToken": {
+ "description": "If there might be more results than those appearing in this response, then nextPageToken is included. To get the next set of results, call this method again using the value of nextPageToken as pageToken.",
+ "type": "string"
+ }
+ },
+ "id": "ListLogsResponse"
+ },
+ "LogMetric": {
+ "description": "Describes a logs-based metric. The value of the metric is the number of log entries that match a logs filter in a given time interval.",
+ "type": "object",
+ "properties": {
+ "description": {
+ "description": "Optional. A description of this metric, which is used in documentation.",
+ "type": "string"
+ },
+ "filter": {
+ "description": "Required. An advanced logs filter which is used to match log entries. Example:\n\"resource.type=gae_app AND severity\u003e=ERROR\"\nThe maximum length of the filter is 20000 characters.",
+ "type": "string"
+ },
+ "name": {
+ "description": "Required. The client-assigned metric identifier. Examples: \"error_count\", \"nginx/requests\".Metric identifiers are limited to 100 characters and can include only the following characters: A-Z, a-z, 0-9, and the special characters _-.,+!*',()%/. The forward-slash character (/) denotes a hierarchy of name pieces, and it cannot be the first character of the name.The metric identifier in this field must not be URL-encoded (https://en.wikipedia.org/wiki/Percent-encoding). However, when the metric identifier appears as the [METRIC_ID] part of a metric_name API parameter, then the metric identifier must be URL-encoded. Example: \"projects/my-project/metrics/nginx%2Frequests\".",
+ "type": "string"
+ },
+ "version": {
+ "description": "Output only. The API version that created or updated this metric. The version also dictates the syntax of the filter expression. When a value for this field is missing, the default value of V2 should be assumed.",
+ "enum": [
+ "V2",
+ "V1"
+ ],
+ "enumDescriptions": [
+ "Stackdriver Logging API v2.",
+ "Stackdriver Logging API v1."
+ ],
+ "type": "string"
+ }
+ },
+ "id": "LogMetric"
+ },
+ "LogEntry": {
+ "description": "An individual entry in a log.",
+ "type": "object",
+ "properties": {
+ "textPayload": {
+ "description": "The log entry payload, represented as a Unicode string (UTF-8).",
+ "type": "string"
+ },
+ "httpRequest": {
+ "description": "Optional. Information about the HTTP request associated with this log entry, if applicable.",
+ "$ref": "HttpRequest"
+ },
+ "sourceLocation": {
+ "description": "Optional. Source code location information associated with the log entry, if any.",
+ "$ref": "LogEntrySourceLocation"
+ },
+ "jsonPayload": {
+ "description": "The log entry payload, represented as a structure that is expressed as a JSON object.",
+ "additionalProperties": {
+ "description": "Properties of the object.",
+ "type": "any"
+ },
+ "type": "object"
+ },
+ "labels": {
+ "description": "Optional. A set of user-defined (key, value) data that provides additional information about the log entry.",
+ "additionalProperties": {
+ "type": "string"
+ },
+ "type": "object"
+ },
+ "trace": {
+ "description": "Optional. Resource name of the trace associated with the log entry, if any. If it contains a relative resource name, the name is assumed to be relative to //tracing.googleapis.com. Example: projects/my-projectid/traces/06796866738c859f2f19b7cfb3214824",
+ "type": "string"
+ },
+ "logName": {
+ "description": "Required. The resource name of the log to which this log entry belongs:\n\"projects/[PROJECT_ID]/logs/[LOG_ID]\"\n\"organizations/[ORGANIZATION_ID]/logs/[LOG_ID]\"\n[LOG_ID] must be URL-encoded within log_name. Example: \"organizations/1234567890/logs/cloudresourcemanager.googleapis.com%2Factivity\". [LOG_ID] must be less than 512 characters long and can only include the following characters: upper and lower case alphanumeric characters, forward-slash, underscore, hyphen, and period.For backward compatibility, if log_name begins with a forward-slash, such as /projects/..., then the log entry is ingested as usual but the forward-slash is removed. Listing the log entry will not show the leading slash and filtering for a log name with a leading slash will never return any results.",
+ "type": "string"
+ },
+ "severity": {
+ "description": "Optional. The severity of the log entry. The default value is LogSeverity.DEFAULT.",
+ "enum": [
+ "DEFAULT",
+ "DEBUG",
+ "INFO",
+ "NOTICE",
+ "WARNING",
+ "ERROR",
+ "CRITICAL",
+ "ALERT",
+ "EMERGENCY"
+ ],
+ "enumDescriptions": [
+ "(0) The log entry has no assigned severity level.",
+ "(100) Debug or trace information.",
+ "(200) Routine information, such as ongoing status or performance.",
+ "(300) Normal but significant events, such as start up, shut down, or a configuration change.",
+ "(400) Warning events might cause problems.",
+ "(500) Error events are likely to cause problems.",
+ "(600) Critical events cause more severe problems or outages.",
+ "(700) A person must take an action immediately.",
+ "(800) One or more systems are unusable."
+ ],
+ "type": "string"
+ },
+ "resource": {
+ "description": "Required. The monitored resource associated with this log entry. Example: a log entry that reports a database error would be associated with the monitored resource designating the particular database that reported the error.",
+ "$ref": "MonitoredResource"
+ },
+ "protoPayload": {
+ "description": "The log entry payload, represented as a protocol buffer. Some Google Cloud Platform services use this field for their log entry payloads.",
+ "additionalProperties": {
+ "description": "Properties of the object. Contains field @type with type URL.",
+ "type": "any"
+ },
+ "type": "object"
+ },
+ "timestamp": {
+ "description": "Optional. The time the event described by the log entry occurred. If omitted, Stackdriver Logging will use the time the log entry is received.",
+ "type": "string",
+ "format": "google-datetime"
+ },
+ "insertId": {
+ "description": "Optional. A unique ID for the log entry. If you provide this field, the logging service considers other log entries in the same project with the same ID as duplicates which can be removed. If omitted, Stackdriver Logging will generate a unique ID for this log entry.",
+ "type": "string"
+ },
+ "operation": {
+ "description": "Optional. Information about an operation associated with the log entry, if applicable.",
+ "$ref": "LogEntryOperation"
+ }
+ },
+ "id": "LogEntry"
+ },
+ "LogLine": {
+ "description": "Application log line emitted while processing a request.",
+ "type": "object",
+ "properties": {
+ "time": {
+ "description": "Approximate time when this log entry was made.",
+ "type": "string",
+ "format": "google-datetime"
+ },
+ "severity": {
+ "description": "Severity of this log entry.",
+ "enum": [
+ "DEFAULT",
+ "DEBUG",
+ "INFO",
+ "NOTICE",
+ "WARNING",
+ "ERROR",
+ "CRITICAL",
+ "ALERT",
+ "EMERGENCY"
+ ],
+ "enumDescriptions": [
+ "(0) The log entry has no assigned severity level.",
+ "(100) Debug or trace information.",
+ "(200) Routine information, such as ongoing status or performance.",
+ "(300) Normal but significant events, such as start up, shut down, or a configuration change.",
+ "(400) Warning events might cause problems.",
+ "(500) Error events are likely to cause problems.",
+ "(600) Critical events cause more severe problems or outages.",
+ "(700) A person must take an action immediately.",
+ "(800) One or more systems are unusable."
+ ],
+ "type": "string"
+ },
+ "sourceLocation": {
+ "description": "Where in the source code this log message was written.",
+ "$ref": "SourceLocation"
+ },
+ "logMessage": {
+ "description": "App-provided log message.",
+ "type": "string"
+ }
+ },
+ "id": "LogLine"
+ },
+ "SourceReference": {
+ "description": "A reference to a particular snapshot of the source tree used to build and deploy an application.",
+ "type": "object",
+ "properties": {
+ "repository": {
+ "description": "Optional. A URI string identifying the repository. Example: \"https://github.com/GoogleCloudPlatform/kubernetes.git\"",
+ "type": "string"
+ },
+ "revisionId": {
+ "description": "The canonical and persistent identifier of the deployed revision. Example (git): \"0035781c50ec7aa23385dc841529ce8a4b70db1b\"",
+ "type": "string"
+ }
+ },
+ "id": "SourceReference"
+ },
+ "MonitoredResource": {
+ "description": "An object representing a resource that can be used for monitoring, logging, billing, or other purposes. Examples include virtual machine instances, databases, and storage devices such as disks. The type field identifies a MonitoredResourceDescriptor object that describes the resource's schema. Information in the labels field identifies the actual resource and its attributes according to the schema. For example, a particular Compute Engine VM instance could be represented by the following object, because the MonitoredResourceDescriptor for \"gce_instance\" has labels \"instance_id\" and \"zone\":\n{ \"type\": \"gce_instance\",\n \"labels\": { \"instance_id\": \"12345678901234\",\n \"zone\": \"us-central1-a\" }}\n",
+ "type": "object",
+ "properties": {
+ "labels": {
+ "description": "Required. Values for all of the labels listed in the associated monitored resource descriptor. For example, Cloud SQL databases use the labels \"database_id\" and \"zone\".",
+ "additionalProperties": {
+ "type": "string"
+ },
+ "type": "object"
+ },
+ "type": {
+ "description": "Required. The monitored resource type. This field must match the type field of a MonitoredResourceDescriptor object. For example, the type of a Cloud SQL database is \"cloudsql_database\".",
+ "type": "string"
+ }
+ },
+ "id": "MonitoredResource"
+ },
+ "WriteLogEntriesRequest": {
+ "description": "The parameters to WriteLogEntries.",
+ "type": "object",
+ "properties": {
+ "labels": {
+ "description": "Optional. Default labels that are added to the labels field of all log entries in entries. If a log entry already has a label with the same key as a label in this parameter, then the log entry's label is not changed. See LogEntry.",
+ "additionalProperties": {
+ "type": "string"
+ },
+ "type": "object"
+ },
+ "entries": {
+ "description": "Required. The log entries to write. Values supplied for the fields log_name, resource, and labels in this entries.write request are added to those log entries that do not provide their own values for the fields.To improve throughput and to avoid exceeding the quota limit for calls to entries.write, you should write multiple log entries at once rather than calling this method for each individual log entry.",
+ "type": "array",
+ "items": {
+ "$ref": "LogEntry"
+ }
+ },
+ "logName": {
+ "description": "Optional. A default log resource name that is assigned to all log entries in entries that do not specify a value for log_name:\n\"projects/[PROJECT_ID]/logs/[LOG_ID]\"\n\"organizations/[ORGANIZATION_ID]/logs/[LOG_ID]\"\n[LOG_ID] must be URL-encoded. For example, \"projects/my-project-id/logs/syslog\" or \"organizations/1234567890/logs/cloudresourcemanager.googleapis.com%2Factivity\". For more information about log names, see LogEntry.",
+ "type": "string"
+ },
+ "partialSuccess": {
+ "description": "Optional. Whether valid entries should be written even if some other entries fail due to INVALID_ARGUMENT or PERMISSION_DENIED errors. If any entry is not written, the response status will be the error associated with one of the failed entries and include error details in the form of WriteLogEntriesPartialErrors.",
+ "type": "boolean"
+ },
+ "resource": {
+ "description": "Optional. A default monitored resource object that is assigned to all log entries in entries that do not specify a value for resource. Example:\n{ \"type\": \"gce_instance\",\n \"labels\": {\n \"zone\": \"us-central1-a\", \"instance_id\": \"00000000000000000000\" }}\nSee LogEntry.",
+ "$ref": "MonitoredResource"
+ }
+ },
+ "id": "WriteLogEntriesRequest"
+ },
+ "LabelDescriptor": {
+ "description": "A description of a label.",
+ "type": "object",
+ "properties": {
+ "description": {
+ "description": "A human-readable description for the label.",
+ "type": "string"
+ },
+ "valueType": {
+ "description": "The type of data that can be assigned to the label.",
+ "enum": [
+ "STRING",
+ "BOOL",
+ "INT64"
+ ],
+ "enumDescriptions": [
+ "A variable-length string. This is the default.",
+ "Boolean; true or false.",
+ "A 64-bit signed integer."
+ ],
+ "type": "string"
+ },
+ "key": {
+ "description": "The label key.",
+ "type": "string"
+ }
+ },
+ "id": "LabelDescriptor"
+ },
+ "ListLogMetricsResponse": {
+ "description": "Result returned from ListLogMetrics.",
+ "type": "object",
+ "properties": {
+ "metrics": {
+ "description": "A list of logs-based metrics.",
+ "type": "array",
+ "items": {
+ "$ref": "LogMetric"
+ }
+ },
+ "nextPageToken": {
+ "description": "If there might be more results than appear in this response, then nextPageToken is included. To get the next set of results, call this method again using the value of nextPageToken as pageToken.",
+ "type": "string"
+ }
+ },
+ "id": "ListLogMetricsResponse"
+ },
+ "MonitoredResourceDescriptor": {
+ "description": "An object that describes the schema of a MonitoredResource object using a type name and a set of labels. For example, the monitored resource descriptor for Google Compute Engine VM instances has a type of \"gce_instance\" and specifies the use of the labels \"instance_id\" and \"zone\" to identify particular VM instances.Different APIs can support different monitored resource types. APIs generally provide a list method that returns the monitored resource descriptors used by the API.",
+ "type": "object",
+ "properties": {
+ "displayName": {
+ "description": "Optional. A concise name for the monitored resource type that might be displayed in user interfaces. It should be a Title Cased Noun Phrase, without any article or other determiners. For example, \"Google Cloud SQL Database\".",
+ "type": "string"
+ },
+ "description": {
+ "description": "Optional. A detailed description of the monitored resource type that might be used in documentation.",
+ "type": "string"
+ },
+ "labels": {
+ "description": "Required. A set of labels used to describe instances of this monitored resource type. For example, an individual Google Cloud SQL database is identified by values for the labels \"database_id\" and \"zone\".",
+ "type": "array",
+ "items": {
+ "$ref": "LabelDescriptor"
+ }
+ },
+ "type": {
+ "description": "Required. The monitored resource type. For example, the type \"cloudsql_database\" represents databases in Google Cloud SQL. The maximum length of this value is 256 characters.",
+ "type": "string"
+ },
+ "name": {
+ "description": "Optional. The resource name of the monitored resource descriptor: \"projects/{project_id}/monitoredResourceDescriptors/{type}\" where {type} is the value of the type field in this object and {project_id} is a project ID that provides API-specific context for accessing the type. APIs that do not use project information can use the resource name format \"monitoredResourceDescriptors/{type}\".",
+ "type": "string"
+ }
+ },
+ "id": "MonitoredResourceDescriptor"
+ },
+ "ListMonitoredResourceDescriptorsResponse": {
+ "description": "Result returned from ListMonitoredResourceDescriptors.",
+ "type": "object",
+ "properties": {
+ "nextPageToken": {
+ "description": "If there might be more results than those appearing in this response, then nextPageToken is included. To get the next set of results, call this method again using the value of nextPageToken as pageToken.",
+ "type": "string"
+ },
+ "resourceDescriptors": {
+ "description": "A list of resource descriptors.",
+ "type": "array",
+ "items": {
+ "$ref": "MonitoredResourceDescriptor"
+ }
+ }
+ },
+ "id": "ListMonitoredResourceDescriptorsResponse"
+ },
+ "LogEntryOperation": {
+ "description": "Additional information about a potentially long-running operation with which a log entry is associated.",
+ "type": "object",
+ "properties": {
+ "producer": {
+ "description": "Optional. An arbitrary producer identifier. The combination of id and producer must be globally unique. Examples for producer: \"MyDivision.MyBigCompany.com\", \"github.com/MyProject/MyApplication\".",
+ "type": "string"
+ },
+ "last": {
+ "description": "Optional. Set this to True if this is the last log entry in the operation.",
+ "type": "boolean"
+ },
+ "first": {
+ "description": "Optional. Set this to True if this is the first log entry in the operation.",
+ "type": "boolean"
+ },
+ "id": {
+ "description": "Optional. An arbitrary operation identifier. Log entries with the same identifier are assumed to be part of the same operation.",
+ "type": "string"
+ }
+ },
+ "id": "LogEntryOperation"
+ },
+ "Empty": {
+ "description": "A generic empty message that you can re-use to avoid defining duplicated empty messages in your APIs. A typical example is to use it as the request or the response type of an API method. For instance:\nservice Foo {\n rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty);\n}\nThe JSON representation for Empty is empty JSON object {}.",
+ "type": "object",
+ "properties": {},
+ "id": "Empty"
+ },
+ "HttpRequest": {
+ "description": "A common proto for logging HTTP requests. Only contains semantics defined by the HTTP specification. Product-specific logging information MUST be defined in a separate message.",
+ "type": "object",
+ "properties": {
+ "cacheLookup": {
+ "description": "Whether or not a cache lookup was attempted.",
+ "type": "boolean"
+ },
+ "responseSize": {
+ "description": "The size of the HTTP response message sent back to the client, in bytes, including the response headers and the response body.",
+ "type": "string",
+ "format": "int64"
+ },
+ "status": {
+ "description": "The response code indicating the status of response. Examples: 200, 404.",
+ "type": "integer",
+ "format": "int32"
+ },
+ "cacheValidatedWithOriginServer": {
+ "description": "Whether or not the response was validated with the origin server before being served from cache. This field is only meaningful if cache_hit is True.",
+ "type": "boolean"
+ },
+ "referer": {
+ "description": "The referer URL of the request, as defined in HTTP/1.1 Header Field Definitions (http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html).",
+ "type": "string"
+ },
+ "cacheHit": {
+ "description": "Whether or not an entity was served from cache (with or without validation).",
+ "type": "boolean"
+ },
+ "requestUrl": {
+ "description": "The scheme (http, https), the host name, the path and the query portion of the URL that was requested. Example: \"http://example.com/some/info?color=red\".",
+ "type": "string"
+ },
+ "latency": {
+ "description": "The request processing latency on the server, from the time the request was received until the response was sent.",
+ "type": "string",
+ "format": "google-duration"
+ },
+ "cacheFillBytes": {
+ "description": "The number of HTTP response bytes inserted into cache. Set only when a cache fill was attempted.",
+ "type": "string",
+ "format": "int64"
+ },
+ "requestMethod": {
+ "description": "The request method. Examples: \"GET\", \"HEAD\", \"PUT\", \"POST\".",
+ "type": "string"
+ },
+ "remoteIp": {
+ "description": "The IP address (IPv4 or IPv6) of the client that issued the HTTP request. Examples: \"192.168.1.1\", \"FE80::0202:B3FF:FE1E:8329\".",
+ "type": "string"
+ },
+ "serverIp": {
+ "description": "The IP address (IPv4 or IPv6) of the origin server that the request was sent to.",
+ "type": "string"
+ },
+ "userAgent": {
+ "description": "The user agent sent by the client. Example: \"Mozilla/4.0 (compatible; MSIE 6.0; Windows 98; Q312461; .NET CLR 1.0.3705)\".",
+ "type": "string"
+ },
+ "requestSize": {
+ "description": "The size of the HTTP request message in bytes, including the request headers and the request body.",
+ "type": "string",
+ "format": "int64"
+ }
+ },
+ "id": "HttpRequest"
+ },
+ "LogEntrySourceLocation": {
+ "description": "Additional information about the source code location that produced the log entry.",
+ "type": "object",
+ "properties": {
+ "function": {
+ "description": "Optional. Human-readable name of the function or method being invoked, with optional context such as the class or package name. This information may be used in contexts such as the logs viewer, where a file and line number are less meaningful. The format can vary by language. For example: qual.if.ied.Class.method (Java), dir/package.func (Go), function (Python).",
+ "type": "string"
+ },
+ "file": {
+ "description": "Optional. Source file name. Depending on the runtime environment, this might be a simple name or a fully-qualified name.",
+ "type": "string"
+ },
+ "line": {
+ "description": "Optional. Line within the source file. 1-based; 0 indicates no line number available.",
+ "type": "string",
+ "format": "int64"
+ }
+ },
+ "id": "LogEntrySourceLocation"
+ },
+ "RequestLog": {
+ "description": "Complete log information about a single HTTP request to an App Engine application.",
+ "type": "object",
+ "properties": {
+ "responseSize": {
+ "description": "Size in bytes sent back to client by request.",
+ "type": "string",
+ "format": "int64"
+ },
+ "requestId": {
+ "description": "Globally unique identifier for a request, which is based on the request start time. Request IDs for requests which started later will compare greater as strings than those for requests which started earlier.",
+ "type": "string"
+ },
+ "first": {
+ "description": "Whether this is the first RequestLog entry for this request. If an active request has several RequestLog entries written to Stackdriver Logging, then this field will be set for one of them.",
+ "type": "boolean"
+ },
+ "method": {
+ "description": "Request method. Example: \"GET\", \"HEAD\", \"PUT\", \"POST\", \"DELETE\".",
+ "type": "string"
+ },
+ "versionId": {
+ "description": "Version of the application that handled this request.",
+ "type": "string"
+ },
+ "status": {
+ "description": "HTTP response status code. Example: 200, 404.",
+ "type": "integer",
+ "format": "int32"
+ },
+ "wasLoadingRequest": {
+ "description": "Whether this was a loading request for the instance.",
+ "type": "boolean"
+ },
+ "ip": {
+ "description": "Origin IP address.",
+ "type": "string"
+ },
+ "nickname": {
+ "description": "The logged-in user who made the request.Most likely, this is the part of the user's email before the @ sign. The field value is the same for different requests from the same user, but different users can have similar names. This information is also available to the application via the App Engine Users API.This field will be populated starting with App Engine 1.9.21.",
+ "type": "string"
+ },
+ "taskQueueName": {
+ "description": "Queue name of the request, in the case of an offline request.",
+ "type": "string"
+ },
+ "pendingTime": {
+ "description": "Time this request spent in the pending request queue.",
+ "type": "string",
+ "format": "google-duration"
+ },
+ "instanceIndex": {
+ "description": "If the instance processing this request belongs to a manually scaled module, then this is the 0-based index of the instance. Otherwise, this value is -1.",
+ "type": "integer",
+ "format": "int32"
+ },
+ "sourceReference": {
+ "description": "Source code for the application that handled this request. There can be more than one source reference per deployed application if source code is distributed among multiple repositories.",
+ "type": "array",
+ "items": {
+ "$ref": "SourceReference"
+ }
+ },
+ "moduleId": {
+ "description": "Module of the application that handled this request.",
+ "type": "string"
+ },
+ "host": {
+ "description": "Internet host and port number of the resource being requested.",
+ "type": "string"
+ },
+ "latency": {
+ "description": "Latency of the request.",
+ "type": "string",
+ "format": "google-duration"
+ },
+ "urlMapEntry": {
+ "description": "File or class that handled the request.",
+ "type": "string"
+ },
+ "endTime": {
+ "description": "Time when the request finished.",
+ "type": "string",
+ "format": "google-datetime"
+ },
+ "line": {
+ "description": "A list of log lines emitted by the application while serving this request.",
+ "type": "array",
+ "items": {
+ "$ref": "LogLine"
+ }
+ },
+ "megaCycles": {
+ "description": "Number of CPU megacycles used to process request.",
+ "type": "string",
+ "format": "int64"
+ },
+ "appId": {
+ "description": "Application that handled this request.",
+ "type": "string"
+ },
+ "traceId": {
+ "description": "Stackdriver Trace identifier for this request.",
+ "type": "string"
+ },
+ "taskName": {
+ "description": "Task name of the request, in the case of an offline request.",
+ "type": "string"
+ },
+ "cost": {
+ "description": "An indication of the relative cost of serving this request.",
+ "type": "number",
+ "format": "double"
+ },
+ "instanceId": {
+ "description": "An identifier for the instance that handled the request.",
+ "type": "string"
+ },
+ "startTime": {
+ "description": "Time when the request started.",
+ "type": "string",
+ "format": "google-datetime"
+ },
+ "appEngineRelease": {
+ "description": "App Engine release version.",
+ "type": "string"
+ },
+ "resource": {
+ "description": "Contains the path and query portion of the URL that was requested. For example, if the URL was \"http://example.com/app?name=val\", the resource would be \"/app?name=val\". The fragment identifier, which is identified by the # character, is not included.",
+ "type": "string"
+ },
+ "httpVersion": {
+ "description": "HTTP version of request. Example: \"HTTP/1.1\".",
+ "type": "string"
+ },
+ "referrer": {
+ "description": "Referrer URL of request.",
+ "type": "string"
+ },
+ "userAgent": {
+ "description": "User agent that made the request.",
+ "type": "string"
+ },
+ "finished": {
+ "description": "Whether this request is finished or active.",
+ "type": "boolean"
+ }
+ },
+ "id": "RequestLog"
+ },
+ "WriteLogEntriesResponse": {
+ "description": "Result returned from WriteLogEntries. empty",
+ "type": "object",
+ "properties": {},
+ "id": "WriteLogEntriesResponse"
+ },
+ "ListLogEntriesRequest": {
+ "description": "The parameters to ListLogEntries.",
+ "type": "object",
+ "properties": {
+ "filter": {
+ "description": "Optional. A filter that chooses which log entries to return. See Advanced Logs Filters. Only log entries that match the filter are returned. An empty filter matches all log entries in the resources listed in resource_names. Referencing a parent resource that is not listed in resource_names will cause the filter to return no results. The maximum length of the filter is 20000 characters.",
+ "type": "string"
+ },
+ "projectIds": {
+ "description": "Deprecated. Use resource_names instead. One or more project identifiers or project numbers from which to retrieve log entries. Example: \"my-project-1A\". If present, these project identifiers are converted to resource name format and added to the list of resources in resource_names.",
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ },
+ "resourceNames": {
+ "description": "Required. Names of one or more resources from which to retrieve log entries:\n\"projects/[PROJECT_ID]\"\n\"organizations/[ORGANIZATION_ID]\"\nProjects listed in the project_ids field are added to this list.",
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ },
+ "pageSize": {
+ "description": "Optional. The maximum number of results to return from this request. Non-positive values are ignored. The presence of nextPageToken in the response indicates that more results might be available.",
+ "type": "integer",
+ "format": "int32"
+ },
+ "orderBy": {
+ "description": "Optional. How the results should be sorted. Presently, the only permitted values are \"timestamp asc\" (default) and \"timestamp desc\". The first option returns entries in order of increasing values of LogEntry.timestamp (oldest first), and the second option returns entries in order of decreasing timestamps (newest first). Entries with equal timestamps are returned in order of LogEntry.insertId.",
+ "type": "string"
+ },
+ "pageToken": {
+ "description": "Optional. If present, then retrieve the next batch of results from the preceding call to this method. pageToken must be the value of nextPageToken from the previous response. The values of other method parameters should be identical to those in the previous call.",
+ "type": "string"
+ }
+ },
+ "id": "ListLogEntriesRequest"
+ }
+ },
+ "revision": "20170103",
+ "basePath": "",
+ "icons": {
+ "x32": "http://www.google.com/images/icons/product/search-32.gif",
+ "x16": "http://www.google.com/images/icons/product/search-16.gif"
+ },
+ "version_module": "True",
+ "canonicalName": "Logging",
+ "discoveryVersion": "v1",
+ "baseUrl": "https://logging.googleapis.com/",
+ "name": "logging",
+ "parameters": {
+ "access_token": {
+ "description": "OAuth access token.",
+ "type": "string",
+ "location": "query"
+ },
+ "prettyPrint": {
+ "description": "Returns response with indentations and line breaks.",
+ "default": "true",
+ "type": "boolean",
+ "location": "query"
+ },
+ "key": {
+ "description": "API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.",
+ "type": "string",
+ "location": "query"
+ },
+ "quotaUser": {
+ "description": "Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.",
+ "type": "string",
+ "location": "query"
+ },
+ "pp": {
+ "description": "Pretty-print response.",
+ "default": "true",
+ "type": "boolean",
+ "location": "query"
+ },
+ "fields": {
+ "description": "Selector specifying which fields to include in a partial response.",
+ "type": "string",
+ "location": "query"
+ },
+ "alt": {
+ "description": "Data format for response.",
+ "location": "query",
+ "enum": [
+ "json",
+ "media",
+ "proto"
+ ],
+ "default": "json",
+ "enumDescriptions": [
+ "Responses with Content-Type of application/json",
+ "Media download with context-dependent Content-Type",
+ "Responses with Content-Type of application/x-protobuf"
+ ],
+ "type": "string"
+ },
+ "$.xgafv": {
+ "description": "V1 error format.",
+ "enum": [
+ "1",
+ "2"
+ ],
+ "enumDescriptions": [
+ "v1 error format",
+ "v2 error format"
+ ],
+ "type": "string",
+ "location": "query"
+ },
+ "callback": {
+ "description": "JSONP",
+ "type": "string",
+ "location": "query"
+ },
+ "oauth_token": {
+ "description": "OAuth 2.0 token for the current user.",
+ "type": "string",
+ "location": "query"
+ },
+ "uploadType": {
+ "description": "Legacy upload protocol for media (e.g. \"media\", \"multipart\").",
+ "type": "string",
+ "location": "query"
+ },
+ "bearer_token": {
+ "description": "OAuth bearer token.",
+ "type": "string",
+ "location": "query"
+ },
+ "upload_protocol": {
+ "description": "Upload protocol for media (e.g. \"raw\", \"multipart\").",
+ "type": "string",
+ "location": "query"
+ }
+ },
+ "documentationLink": "https://cloud.google.com/logging/docs/",
+ "ownerDomain": "google.com",
+ "batchPath": "batch",
+ "servicePath": "",
+ "ownerName": "Google",
+ "version": "v2",
+ "rootUrl": "https://logging.googleapis.com/",
+ "kind": "discovery#restDescription"
+}
diff --git a/tests/test_discovery.py b/tests/test_discovery.py
index ec66bc6..89b0dd7 100644
--- a/tests/test_discovery.py
+++ b/tests/test_discovery.py
@@ -74,6 +74,7 @@
from googleapiclient.http import MediaUpload
from googleapiclient.http import MediaUploadProgress
from googleapiclient.http import tunnel_patch
+from googleapiclient.model import JsonModel
from oauth2client import GOOGLE_TOKEN_URI
from oauth2client.client import OAuth2Credentials, GoogleCredentials
@@ -1408,10 +1409,45 @@
q = parse_qs(parsed[4])
self.assertEqual(q['pageToken'][0], '123abc')
+ def test_next_successful_with_next_page_token_alternate_name(self):
+ self.http = HttpMock(datafile('bigquery.json'), {'status': '200'})
+ bigquery = build('bigquery', 'v2', http=self.http)
+ request = bigquery.tabledata().list(datasetId='', projectId='', tableId='')
+ next_request = bigquery.tabledata().list_next(
+ request, {'pageToken': '123abc'})
+ parsed = list(urlparse(next_request.uri))
+ q = parse_qs(parsed[4])
+ self.assertEqual(q['pageToken'][0], '123abc')
+
+ def test_next_successful_with_next_page_token_in_body(self):
+ self.http = HttpMock(datafile('logging.json'), {'status': '200'})
+ logging = build('logging', 'v2', http=self.http)
+ request = logging.entries().list(body={})
+ next_request = logging.entries().list_next(
+ request, {'nextPageToken': '123abc'})
+ body = JsonModel().deserialize(next_request.body)
+ self.assertEqual(body['pageToken'], '123abc')
+
def test_next_with_method_with_no_properties(self):
self.http = HttpMock(datafile('latitude.json'), {'status': '200'})
service = build('latitude', 'v1', http=self.http)
- request = service.currentLocation().get()
+ service.currentLocation().get()
+
+ def test_next_nonexistent_with_no_next_page_token(self):
+ self.http = HttpMock(datafile('drive.json'), {'status': '200'})
+ drive = build('drive', 'v3', http=self.http)
+ drive.changes().watch(body={})
+ self.assertFalse(callable(getattr(drive.changes(), 'watch_next', None)))
+
+ def test_next_successful_with_next_page_token_required(self):
+ self.http = HttpMock(datafile('drive.json'), {'status': '200'})
+ drive = build('drive', 'v3', http=self.http)
+ request = drive.changes().list(pageToken='startPageToken')
+ next_request = drive.changes().list_next(
+ request, {'nextPageToken': '123abc'})
+ parsed = list(urlparse(next_request.uri))
+ q = parse_qs(parsed[4])
+ self.assertEqual(q['pageToken'][0], '123abc')
class MediaGet(unittest.TestCase):