File tree 1 file changed +13
-9
lines changed
packages/google-cloud-vision/src
1 file changed +13
-9
lines changed Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ const fs = require('fs');
20
20
const is = require ( 'is' ) ;
21
21
const path = require ( 'path' ) ;
22
22
const promisify = require ( '@google-cloud/common' ) . util . promisify ;
23
+ const protobuf = require ( 'protobufjs' ) ;
23
24
24
25
const gax = require ( 'google-gax' ) ;
25
26
@@ -243,16 +244,19 @@ module.exports = apiVersion => {
243
244
} ) ;
244
245
} ) ;
245
246
246
- // Get a list of features available on the API. Although we could iterate over
247
- // them and create single-feature methods for each dynamically, for
248
- // documentation purpose, we manually list all the single-feature methods
249
- // below.
250
- const features = gax
251
- . grpc ( )
252
- . loadProto (
253
- path . join ( __dirname , '..' , 'protos' ) ,
247
+ let protoFilesRoot = new gax . grpc . GoogleProtoFilesRoot ( ) ;
248
+ protoFilesRoot = protobuf . loadSync (
249
+ path . join (
250
+ __dirname ,
251
+ '..' ,
252
+ 'protos' ,
254
253
`google/cloud/vision/${ apiVersion } /image_annotator.proto`
255
- ) . google . cloud . vision [ apiVersion ] . Feature . Type . values ;
254
+ ) ,
255
+ protoFilesRoot
256
+ ) ;
257
+ const features = protoFilesRoot . lookup (
258
+ `google.cloud.vision.${ apiVersion } .Feature.Type`
259
+ ) . values ;
256
260
257
261
/**
258
262
* Annotate a single image with face detection.
You can’t perform that action at this time.
0 commit comments