(projectId, location, productSetId, productSetDisplayName)
| 15 | 'use strict'; |
| 16 | |
| 17 | function main(projectId, location, productSetId, productSetDisplayName) { |
| 18 | // [START vision_product_search_create_product_set] |
| 19 | // Imports the Google Cloud client library |
| 20 | const vision = require('@google-cloud/vision'); |
| 21 | |
| 22 | // Creates a client |
| 23 | const client = new vision.ProductSearchClient(); |
| 24 | |
| 25 | async function createProductSet() { |
| 26 | /** |
| 27 | * TODO(developer): Uncomment the following line before running the sample. |
| 28 | */ |
| 29 | // const projectId = 'Your Google Cloud project Id'; |
| 30 | // const location = 'A compute region name'; |
| 31 | // const productSetId = 'Id of the product set'; |
| 32 | // const productSetDisplayName = 'Display name of the product set'; |
| 33 | |
| 34 | // Resource path that represents Google Cloud Platform location. |
| 35 | const locationPath = client.locationPath(projectId, location); |
| 36 | |
| 37 | const productSet = { |
| 38 | displayName: productSetDisplayName, |
| 39 | }; |
| 40 | |
| 41 | const request = { |
| 42 | parent: locationPath, |
| 43 | productSet: productSet, |
| 44 | productSetId: productSetId, |
| 45 | }; |
| 46 | |
| 47 | const [createdProductSet] = await client.createProductSet(request); |
| 48 | console.log(`Product Set name: ${createdProductSet.name}`); |
| 49 | } |
| 50 | createProductSet(); |
| 51 | // [END vision_product_search_create_product_set] |
| 52 | } |
| 53 | |
| 54 | process.on('unhandledRejection', err => { |
| 55 | console.error(err.message); |
no test coverage detected