Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
* const request = {
* image: {
* source: {imageUri: 'gs://path/to/image.jpg'}
* }
* };
*
* client
* .documentTextDetection(request)
* .then(response => {
* // doThingsWith(response);
* })
* .catch(err => {
* console.error(err);
* });
*/
methods.documentTextDetection = promisify(
_createSingleFeatureMethod(features.DOCUMENT_TEXT_DETECTION)
);
/**
* Annotate a single image with safe search detection.
*
* @see v1.ImageAnnotatorClient#batchAnnotateImages
* @see google.cloud.vision.v1.AnnotateImageRequest
*
* @method v1.ImageAnnotatorClient#safeSearchDetection
* @param {object|string|Buffer} request A representation of the request
* being sent to the Vision API. This is an
* {@link google.cloud.vision.v1.AnnotateImageRequest AnnotateImageRequest}.
* For simple cases, you may also send a string (the URL or filename of
* the image) or a buffer (the image itself).
* @param {object} request.image A dictionary-like object representing the
* const request = {
* image: {
* source: {imageUri: 'gs://path/to/image.jpg'}
* }
* };
*
* client
* .faceDetection(request)
* .then(response => {
* // doThingsWith(response);
* })
* .catch(err => {
* console.error(err);
* });
*/
methods.faceDetection = promisify(
_createSingleFeatureMethod(features.FACE_DETECTION)
);
/**
* Annotate a single image with landmark detection.
*
* @see v1.ImageAnnotatorClient#batchAnnotateImages
* @see google.cloud.vision.v1.AnnotateImageRequest
*
* @method v1.ImageAnnotatorClient#landmarkDetection
* @param {object|string|Buffer} request A representation of the request
* being sent to the Vision API. This is an
* {@link google.cloud.vision.v1.AnnotateImageRequest AnnotateImageRequest}.
* For simple cases, you may also send a string (the URL or filename of
* the image) or a buffer (the image itself).
* @param {object} request.image A dictionary-like object representing the
* const request = {
* image: {
* source: {imageUri: 'gs://path/to/image.jpg'}
* }
* };
*
* client
* .cropHints(request)
* .then(response => {
* // doThingsWith(response);
* })
* .catch(err => {
* console.error(err);
* });
*/
methods.cropHints = promisify(
_createSingleFeatureMethod(features.CROP_HINTS)
);
/**
* Annotate a single image with web detection.
*
* @see v1.ImageAnnotatorClient#batchAnnotateImages
* @see google.cloud.vision.v1.AnnotateImageRequest
*
* @method v1.ImageAnnotatorClient#webDetection
* @param {object|string|Buffer} request A representation of the request
* being sent to the Vision API. This is an
* {@link google.cloud.vision.v1.AnnotateImageRequest AnnotateImageRequest}.
* For simple cases, you may also send a string (the URL or filename of
* the image) or a buffer (the image itself).
* @param {object} request.image A dictionary-like object representing the
it('should execute callback with instance & metadata', done => {
const metadata = {} as SO.Metadata;
serviceObject.getMetadata = promisify(
(options: SO.GetMetadataOptions, callback: SO.MetadataCallback) => {
callback(null, metadata);
}
);
serviceObject.get((err, instance, metadata_) => {
assert.ifError(err);
assert.strictEqual(instance, serviceObject);
assert.strictEqual(metadata_, metadata);
done();
});
});
it('handles not getting a config', (done) => {
serviceObject.getMetadata =
promisify((_callback: SO.MetadataCallback): void => {
done();
});
(serviceObject as FakeServiceObject).get(undefined, assert.ifError);
});
callback(err, null, resp);
return;
}
const operation = compute.operation(resp.name);
operation.metadata = resp;
callback(null, operation, resp);
});
}
}
/*! Developer Documentation
*
* All async methods (except for streams) will return a Promise in the event
* that a callback is omitted.
*/
promisifyAll(Snapshot);
/**
* Reference to the {@link Snapshot} class.
* @name module:@google-cloud/compute.Snapshot
* @see Snapshot
*/
module.exports = Snapshot;
if (arguments[1]) {
self.metadata = arguments[1];
}
callback.apply(null, arguments);
}
);
});
}
}
/*! Developer Documentation
*
* All async methods (except for streams) will return a Promise in the event
* that a callback is omitted.
*/
promisifyAll(Sink);
/**
* Reference to the {@link Sink} class.
* @name module:@google-cloud/logging.Sink
* @see Sink
*/
module.exports.Sink = Sink;
{
client: 'BigtableInstanceAdminClient',
method: 'updateCluster',
reqOpts,
gaxOpts: gaxOptions,
},
callback);
}
}
/*! Developer Documentation
*
* All async methods (except for streams) will return a Promise in the event
* that a callback is omitted.
*/
promisifyAll(Cluster);
/**
* Reference to the {@link Cluster} class.
* @name module:@google-cloud/bigtable.Cluster
* @see Cluster
*/
const permissionsHash = permissions.reduce((acc, permission) => {
acc[permission] = availablePermissions.indexOf(permission) > -1;
return acc;
}, {});
callback(null, permissionsHash, resp);
});
}
}
/*! Developer Documentation
*
* All async methods (except for streams) will return a Promise in the event
* that a callback is omitted.
*/
promisifyAll(Iam);
export {Iam};
entity: {
key: ent.key,
},
method: 'save',
args: [ent],
});
});
}
}
/*! Developer Documentation
*
* All async methods (except for streams) will return a Promise in the event
* that a callback is omitted.
*/
promisifyAll(Transaction, {
exclude: ['createQuery', 'delete', 'save'],
});
/**
* Reference to the {@link Transaction} class.
* @name module:@google-cloud/datastore.Transaction
* @see Transaction
*/
export {Transaction};