(projectId, location, productId, referenceImageId)
| 15 | 'use strict'; |
| 16 | |
| 17 | function main(projectId, location, productId, referenceImageId) { |
| 18 | // [START vision_product_search_get_reference_image] |
| 19 | const vision = require('@google-cloud/vision'); |
| 20 | |
| 21 | const client = new vision.ProductSearchClient(); |
| 22 | |
| 23 | async function getReferenceImage() { |
| 24 | /** |
| 25 | * TODO(developer): Uncomment the following line before running the sample. |
| 26 | */ |
| 27 | // const projectId = 'Your Google Cloud project Id'; |
| 28 | // const location = 'A compute region name'; |
| 29 | // const productId = 'Id of the product'; |
| 30 | // const referenceImageId = 'Id of the reference image'; |
| 31 | |
| 32 | const formattedName = client.referenceImagePath( |
| 33 | projectId, |
| 34 | location, |
| 35 | productId, |
| 36 | referenceImageId |
| 37 | ); |
| 38 | |
| 39 | const request = { |
| 40 | name: formattedName, |
| 41 | }; |
| 42 | |
| 43 | const response = await client.getReferenceImage(request); |
| 44 | console.log(`response.name: ${response.name}`); |
| 45 | console.log(`response.uri: ${response.uri}`); |
| 46 | } |
| 47 | getReferenceImage(); |
| 48 | // [END vision_product_search_get_reference_image] |
| 49 | } |
| 50 | |
| 51 | process.on('unhandledRejection', err => { |
| 52 | console.error(err.message); |
no test coverage detected