@google-cloud/vision v0.13.0
This is the (hopefully) final release candidate before declaring a stable release.
⚠️ Breaking Changes!
Request Format
We learned from a few mistakes we made in the previous release, and have updated the API to be simpler and more consistent. We now require the entire AnnotateImageRequest
to be sent to annotateImage
, rather than just the image
component. This allows for cases where you need to specify something else (e.g. imageContext
) without having to fall back on the batch method.
To make up for this, we also reinstated the ability to send a simple string or buffer in lieu of the entire request in the single-feature methods (#5), which should make this a net reduction of code.
Simple Cases
Here is a migration guide for simple cases:
Before
var image = {
source: {imageUri: 'gs://path/to/image.jpg'},
};
vision.labelDetection(image).then(data => {
let apiResponse = data[0];
// ...
});
After
vision.labelDetection('gs://path/to/image.jpg').then(data => {
let apiResponse = data[0];
// ...
});
Complex Cases
In complex cases (for example, where you needed another key in the request), you will need to send the entire request object, except for the parts that get added in by the method (e.g. the features
key).
Carrying forward the previous example:
Before
var image = {
source: {imageUri: 'gs://path/to/image.jpg'},
};
vision.labelDetection(image).then(data => {
let apiResponse = data[0];
// ...
});
After
var request = {
image: {
source: {imageUri: 'gs://path/to/image.jpg'},
},
};
vision.labelDetection(request).then(data => {
let apiResponse = data[0];
// ...
});
Refer to the nodejs-vision API reference documentation for details.
Features
Runnable samples
There are now runnable samples in the samples/
directory. These samples demonstrate the use of this API and offer an additional resource for getting started. These also power the readme, and are automatically tested to ensure that they are up-to-date and correct.
Implementation Details
- Change to a new linter (ESLint) and code style formatter (prettify).
- Update docs to use JSDoc 3.
- Migrate to the
googleapis/nodejs-vision
repository.