DefinitelyTyped/types/gapi.client.bigquery/gapi.client.bigquery-tests.ts
Alexey Bolisov 4f8a3d571b Add Google APIs typings (#19083)
* Add Google APIs typings

* [gapi.cliebt.* ] Add version as part of typings name and fix gapi.client tslint errors

* versions should not get their own folders
fixing a few typos
using /** syntax so comments show up in editors
export only actual (last) version for now

* export only actual (last) version for now

* merge namespaces and remove unnecessary namespace qualifiers

* remove namespace qualifier for gapi.client.Request from nested namespaces and change Request base interface to Promise

* disable await-promise rule

* fix collision between gapi.client.Request and Request from nested namespace
disable no-irregular-whitespace rule

* sort properties and namespace resources

* remove empty comments
sort resources amd methods in tests and readme.md

* update 'this is autogenerated file' banner to remove this text from gapi.client namespace hint
use multiline comments when comment has several lines

* implement no-trailing-whitespace, no-padding, max-line-length, await-promise, no-irregular-whitespace rules

* add strictFunctionTypes to tsconfig

* fix "Whitespace within parentheses is not allowed" rule

* fix ts-lint rules

* fixes

* remove deprecated replicapool and replicapoolupdater api

* fix no-irregular-whitespace

* fix no-irregular-whitespace
2017-10-09 14:55:04 -07:00

203 lines
8.9 KiB
TypeScript

/* This is stub file for gapi.client.{{=it.name}} definition tests */
/* IMPORTANT.
* This file was automatically generated by https://github.com/Bolisov/google-api-typings-generator. Please do not edit it manually.
* In case of any problems please post issue to https://github.com/Bolisov/google-api-typings-generator
**/
gapi.load('client', () => {
/** now we can use gapi.client */
gapi.client.load('bigquery', 'v2', () => {
/** now we can use gapi.client.bigquery */
/** don't forget to authenticate your client before sending any request to resources: */
/** declare client_id registered in Google Developers Console */
const client_id = '<<PUT YOUR CLIENT ID HERE>>';
const scope = [
/** View and manage your data in Google BigQuery */
'https://www.googleapis.com/auth/bigquery',
/** Insert data into Google BigQuery */
'https://www.googleapis.com/auth/bigquery.insertdata',
/** View and manage your data across Google Cloud Platform services */
'https://www.googleapis.com/auth/cloud-platform',
/** View your data across Google Cloud Platform services */
'https://www.googleapis.com/auth/cloud-platform.read-only',
/** Manage your data and permissions in Google Cloud Storage */
'https://www.googleapis.com/auth/devstorage.full_control',
/** View your data in Google Cloud Storage */
'https://www.googleapis.com/auth/devstorage.read_only',
/** Manage your data in Google Cloud Storage */
'https://www.googleapis.com/auth/devstorage.read_write',
];
const immediate = true;
gapi.auth.authorize({ client_id, scope, immediate }, authResult => {
if (authResult && !authResult.error) {
/** handle succesfull authorization */
run();
} else {
/** handle authorization error */
}
});
run();
});
async function run() {
/**
* 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.
*/
await gapi.client.datasets.delete({
datasetId: "datasetId",
deleteContents: true,
projectId: "projectId",
});
/** Returns the dataset specified by datasetID. */
await gapi.client.datasets.get({
datasetId: "datasetId",
projectId: "projectId",
});
/** Creates a new empty dataset. */
await gapi.client.datasets.insert({
projectId: "projectId",
});
/** Lists all datasets in the specified project to which you have been granted the READER dataset role. */
await gapi.client.datasets.list({
all: true,
filter: "filter",
maxResults: 3,
pageToken: "pageToken",
projectId: "projectId",
});
/**
* 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.
*/
await gapi.client.datasets.patch({
datasetId: "datasetId",
projectId: "projectId",
});
/**
* 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.
*/
await gapi.client.datasets.update({
datasetId: "datasetId",
projectId: "projectId",
});
/**
* 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.
*/
await gapi.client.jobs.cancel({
jobId: "jobId",
projectId: "projectId",
});
/**
* 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.
*/
await gapi.client.jobs.get({
jobId: "jobId",
projectId: "projectId",
});
/** Retrieves the results of a query job. */
await gapi.client.jobs.getQueryResults({
jobId: "jobId",
maxResults: 2,
pageToken: "pageToken",
projectId: "projectId",
startIndex: "startIndex",
timeoutMs: 6,
});
/** Starts a new asynchronous job. Requires the Can View project role. */
await gapi.client.jobs.insert({
projectId: "projectId",
});
/**
* 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.
*/
await gapi.client.jobs.list({
allUsers: true,
maxResults: 2,
pageToken: "pageToken",
projectId: "projectId",
projection: "projection",
stateFilter: "stateFilter",
});
/** Runs a BigQuery SQL query synchronously and returns query results if the query completes within a specified timeout. */
await gapi.client.jobs.query({
projectId: "projectId",
});
/** Returns the email address of the service account for your project used for interactions with Google Cloud KMS. */
await gapi.client.projects.getServiceAccount({
projectId: "projectId",
});
/** Lists all projects to which you have been granted any project role. */
await gapi.client.projects.list({
maxResults: 1,
pageToken: "pageToken",
});
/** Streams data into BigQuery one record at a time without needing to run a load job. Requires the WRITER dataset role. */
await gapi.client.tabledata.insertAll({
datasetId: "datasetId",
projectId: "projectId",
tableId: "tableId",
});
/** Retrieves table data from a specified set of rows. Requires the READER dataset role. */
await gapi.client.tabledata.list({
datasetId: "datasetId",
maxResults: 2,
pageToken: "pageToken",
projectId: "projectId",
selectedFields: "selectedFields",
startIndex: "startIndex",
tableId: "tableId",
});
/** Deletes the table specified by tableId from the dataset. If the table contains data, all the data will be deleted. */
await gapi.client.tables.delete({
datasetId: "datasetId",
projectId: "projectId",
tableId: "tableId",
});
/**
* 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.
*/
await gapi.client.tables.get({
datasetId: "datasetId",
projectId: "projectId",
selectedFields: "selectedFields",
tableId: "tableId",
});
/** Creates a new, empty table in the dataset. */
await gapi.client.tables.insert({
datasetId: "datasetId",
projectId: "projectId",
});
/** Lists all tables in the specified dataset. Requires the READER dataset role. */
await gapi.client.tables.list({
datasetId: "datasetId",
maxResults: 2,
pageToken: "pageToken",
projectId: "projectId",
});
/**
* 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.
*/
await gapi.client.tables.patch({
datasetId: "datasetId",
projectId: "projectId",
tableId: "tableId",
});
/**
* 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.
*/
await gapi.client.tables.update({
datasetId: "datasetId",
projectId: "projectId",
tableId: "tableId",
});
}
});