// Before running the sample:
// - Enable the API at:
// https://console.developers.google.com/apis/api/documentai.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 documentai = google.documentai('v1beta3');
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'],
});
// 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 documentai.projects.locations.processors.delete({
// Required. The processor resource name to be deleted.
name: 'projects/my-project/locations/my-location/processors/my-processor',
});
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/documentai.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 documentai = google.documentai('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/cloud-platform'],
});
// 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 documentai.projects.locations.processors.processorVersions.batchProcess(
{
// Required. The resource name of Processor or ProcessorVersion. Format: projects/{project\}/locations/{location\}/processors/{processor\}, or projects/{project\}/locations/{location\}/processors/{processor\}/processorVersions/{processorVersion\}
name: 'projects/my-project/locations/my-location/processors/my-processor/processorVersions/my-processorVersion',
// Request body metadata
requestBody: {
// request body parameters
// {
// "documentOutputConfig": {},
// "inputDocuments": {},
// "skipHumanReview": false
// }
},
}
);
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/documentai.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 documentai = google.documentai('v1beta3');
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'],
});
// 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 documentai.projects.locations.fetchProcessorTypes({
// Required. The project of processor type to list. The available processor types may depend on the whitelisting on projects. Format: projects/{project\}/locations/{location\}
parent: 'projects/my-project/locations/my-location',
});
console.log(res.data);
// Example response
// {
// "processorTypes": []
// }
}
main().catch(e => {
console.error(e);
throw e;
});
// Before running the sample:
// - Enable the API at:
// https://console.developers.google.com/apis/api/documentai.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 documentai = google.documentai('v1beta3');
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'],
});
// 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 documentai.projects.locations.processors.process({
// Required. The resource name of the Processor or ProcessorVersion to use for processing. If a Processor is specified, the server will use its default version. Format: projects/{project\}/locations/{location\}/processors/{processor\}, or projects/{project\}/locations/{location\}/processors/{processor\}/processorVersions/{processorVersion\}
name: 'projects/my-project/locations/my-location/processors/my-processor',
// Request body metadata
requestBody: {
// request body parameters
// {
// "document": {},
// "inlineDocument": {},
// "rawDocument": {},
// "skipHumanReview": false
// }
},
});
console.log(res.data);
// Example response
// {
// "document": {},
// "humanReviewOperation": "my_humanReviewOperation",
// "humanReviewStatus": {}
// }
}
main().catch(e => {
console.error(e);
throw e;
});
// Before running the sample:
// - Enable the API at:
// https://console.developers.google.com/apis/api/documentai.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 documentai = google.documentai('v1beta3');
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'],
});
// 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 documentai.projects.locations.processors.disable({
// Required. The processor resource name to be disabled.
name: 'projects/my-project/locations/my-location/processors/my-processor',
// Request body metadata
requestBody: {
// request body parameters
// {}
},
});
console.log(res.data);
// Example response
// {
// "done": false,
// "error": {},
// "metadata": {},
// "name": "my_name",
// "response": {}
// }
}
main().catch(e => {
console.error(e);
throw e;
});