How to use the google-gax.protobuf function in google-gax

To help you get started, we’ve selected a few google-gax examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github googleapis / nodejs-vision / src / helpers.js View on Github external
// If there is an error, handle it.
        if (err) {
          return callback(err);
        }

        // We are guaranteed to only have one response element, since we
        // only sent one image.
        const response = r.responses[0];

        // Fire the callback if applicable.
        return callback(undefined, response);
      });
    });
  });

  const protoFilesRoot = gax.protobuf.Root.fromJSON(jsonProto);
  const features = protoFilesRoot.lookup(
    `google.cloud.vision.${apiVersion}.Feature.Type`
  ).values;

  /**
   * Annotate a single image with face detection.
   *
   * @see v1.ImageAnnotatorClient#batchAnnotateImages
   * @see google.cloud.vision.v1.AnnotateImageRequest
   *
   * @method v1.ImageAnnotatorClient#faceDetection
   * @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).