// 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.create({
// Required. The parent (project and location) under which to create the processor. Format: projects/{project\}/locations/{location\}
parent: 'projects/my-project/locations/my-location',
// Request body metadata
requestBody: {
// request body parameters
// {
// "createTime": "my_createTime",
// "defaultProcessorVersion": "my_defaultProcessorVersion",
// "displayName": "my_displayName",
// "kmsKeyName": "my_kmsKeyName",
// "name": "my_name",
// "processEndpoint": "my_processEndpoint",
// "state": "my_state",
// "type": "my_type"
// }
},
});
console.log(res.data);
// Example response
// {
// "createTime": "my_createTime",
// "defaultProcessorVersion": "my_defaultProcessorVersion",
// "displayName": "my_displayName",
// "kmsKeyName": "my_kmsKeyName",
// "name": "my_name",
// "processEndpoint": "my_processEndpoint",
// "state": "my_state",
// "type": "my_type"
// }
}
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.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',
// Request body metadata
requestBody: {
// request body parameters
// {
// "documentOutputConfig": {},
// "inputConfigs": [],
// "inputDocuments": {},
// "outputConfig": {},
// "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('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.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',
// 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('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;
});