// Before running the sample:
// - Enable the API at:
// https://console.developers.google.com/apis/api/docs.googleapis.com
// - Login into gcloud by running:
// `$ gcloud auth application-default login`
// - Install the npm module by running:
// `$ npm install googleapis`
const {google} = require('googleapis');
const docs = google.docs('v1');
async function main() {
const auth = new google.auth.GoogleAuth({
// Scopes can be specified either as an array or as a single, space-delimited string.
scopes: [
'https://www.googleapis.com/auth/documents',
'https://www.googleapis.com/auth/drive',
'https://www.googleapis.com/auth/drive.file',
],
});
// Acquire an auth client, and bind it to all future calls
const authClient = await auth.getClient();
google.options({auth: authClient});
// Do the magic
const res = await docs.documents.batchUpdate({
// The ID of the document to update.
documentId: 'placeholder-value',
// Request body metadata
requestBody: {
// request body parameters
// {
// "requests": [],
// "writeControl": {}
// }
},
});
console.log(res.data);
// Example response
// {
// "documentId": "my_documentId",
// "replies": [],
// "writeControl": {}
// }
}
main().catch(e => {
console.error(e);
throw e;
});
// Before running the sample:
// - Enable the API at:
// https://console.developers.google.com/apis/api/docs.googleapis.com
// - Login into gcloud by running:
// `$ gcloud auth application-default login`
// - Install the npm module by running:
// `$ npm install googleapis`
const {google} = require('googleapis');
const docs = google.docs('v1');
async function main() {
const auth = new google.auth.GoogleAuth({
// Scopes can be specified either as an array or as a single, space-delimited string.
scopes: [
'https://www.googleapis.com/auth/documents',
'https://www.googleapis.com/auth/drive',
'https://www.googleapis.com/auth/drive.file',
],
});
// Acquire an auth client, and bind it to all future calls
const authClient = await auth.getClient();
google.options({auth: authClient});
// Do the magic
const res = await docs.documents.create({
// Request body metadata
requestBody: {
// request body parameters
// {
// "body": {},
// "documentId": "my_documentId",
// "documentStyle": {},
// "footers": {},
// "footnotes": {},
// "headers": {},
// "inlineObjects": {},
// "lists": {},
// "namedRanges": {},
// "namedStyles": {},
// "positionedObjects": {},
// "revisionId": "my_revisionId",
// "suggestedDocumentStyleChanges": {},
// "suggestedNamedStylesChanges": {},
// "suggestionsViewMode": "my_suggestionsViewMode",
// "title": "my_title"
// }
},
});
console.log(res.data);
// Example response
// {
// "body": {},
// "documentId": "my_documentId",
// "documentStyle": {},
// "footers": {},
// "footnotes": {},
// "headers": {},
// "inlineObjects": {},
// "lists": {},
// "namedRanges": {},
// "namedStyles": {},
// "positionedObjects": {},
// "revisionId": "my_revisionId",
// "suggestedDocumentStyleChanges": {},
// "suggestedNamedStylesChanges": {},
// "suggestionsViewMode": "my_suggestionsViewMode",
// "title": "my_title"
// }
}
main().catch(e => {
console.error(e);
throw e;
});
// Before running the sample:
// - Enable the API at:
// https://console.developers.google.com/apis/api/people.googleapis.com
// - Login into gcloud by running:
// `$ gcloud auth application-default login`
// - Install the npm module by running:
// `$ npm install googleapis`
const {google} = require('googleapis');
const people = google.people('v1');
async function main() {
const auth = new google.auth.GoogleAuth({
// Scopes can be specified either as an array or as a single, space-delimited string.
scopes: ['https://www.googleapis.com/auth/contacts'],
});
// Acquire an auth client, and bind it to all future calls
const authClient = await auth.getClient();
google.options({auth: authClient});
// Do the magic
const res = await people.people.batchUpdateContacts({
// Request body metadata
requestBody: {
// request body parameters
// {
// "contacts": {},
// "readMask": "my_readMask",
// "sources": [],
// "updateMask": "my_updateMask"
// }
},
});
console.log(res.data);
// Example response
// {
// "updateResult": {}
// }
}
main().catch(e => {
console.error(e);
throw e;
});
// Before running the sample:
// - Enable the API at:
// https://console.developers.google.com/apis/api/dialogflow.googleapis.com
// - Login into gcloud by running:
// `$ gcloud auth application-default login`
// - Install the npm module by running:
// `$ npm install googleapis`
const {google} = require('googleapis');
const dialogflow = google.dialogflow('v2beta1');
async function main() {
const auth = new google.auth.GoogleAuth({
// Scopes can be specified either as an array or as a single, space-delimited string.
scopes: [
'https://www.googleapis.com/auth/cloud-platform',
'https://www.googleapis.com/auth/dialogflow',
],
});
// Acquire an auth client, and bind it to all future calls
const authClient = await auth.getClient();
google.options({auth: authClient});
// Do the magic
const res = await dialogflow.projects.locations.agent.intents.batchUpdate({
// Required. The name of the agent to update or create intents in. Supported formats: - `projects//agent` - `projects//locations//agent`
parent: 'projects/my-project/locations/my-location/agent',
// Request body metadata
requestBody: {
// request body parameters
// {
// "intentBatchInline": {},
// "intentBatchUri": "my_intentBatchUri",
// "intentView": "my_intentView",
// "languageCode": "my_languageCode",
// "updateMask": "my_updateMask"
// }
},
});
console.log(res.data);
// Example response
// {
// "done": false,
// "error": {},
// "metadata": {},
// "name": "my_name",
// "response": {}
// }
}
main().catch(e => {
console.error(e);
throw e;
});
// Before running the sample:
// - Enable the API at:
// https://console.developers.google.com/apis/api/dialogflow.googleapis.com
// - Login into gcloud by running:
// `$ gcloud auth application-default login`
// - Install the npm module by running:
// `$ npm install googleapis`
const {google} = require('googleapis');
const dialogflow = google.dialogflow('v2beta1');
async function main() {
const auth = new google.auth.GoogleAuth({
// Scopes can be specified either as an array or as a single, space-delimited string.
scopes: [
'https://www.googleapis.com/auth/cloud-platform',
'https://www.googleapis.com/auth/dialogflow',
],
});
// Acquire an auth client, and bind it to all future calls
const authClient = await auth.getClient();
google.options({auth: authClient});
// Do the magic
const res = await dialogflow.projects.agent.entityTypes.batchUpdate({
// Required. The name of the agent to update or create entity types in. Supported formats: - `projects//agent` - `projects//locations//agent`
parent: 'projects/my-project/agent',
// Request body metadata
requestBody: {
// request body parameters
// {
// "entityTypeBatchInline": {},
// "entityTypeBatchUri": "my_entityTypeBatchUri",
// "languageCode": "my_languageCode",
// "updateMask": "my_updateMask"
// }
},
});
console.log(res.data);
// Example response
// {
// "done": false,
// "error": {},
// "metadata": {},
// "name": "my_name",
// "response": {}
// }
}
main().catch(e => {
console.error(e);
throw e;
});