使用相应的Node.js client package访问Google API时,例如Cloud Vision API @google-cloud/vision
,如何指定在其中调用此资源的region ?
我问是因为其他提供程序允许您将区域指定为客户端类构造函数的一部分,例如AWS JavaScript SDK:
var s3 = new AWS.S3({apiVersion: '2006-03-01', region: 'us-west-2'});
但是,我在ImageAnnotatorClient中找不到类似的参数:
// Imports the Google Cloud client library
const vision = require('@google-cloud/vision');
// Creates a client
const client = new vision.ImageAnnotatorClient();
// Performs label detection on the image file
client
.labelDetection('./resources/wakeupcat.jpg')
.then(results => {
// do something with the results
})
.catch(err => {
console.error('ERROR:', err);
});