Skip to content

Commit

Permalink
docs(samples): add example tags to generated samples (#964)
Browse files Browse the repository at this point in the history
- [ ] Regenerate this pull request now.

PiperOrigin-RevId: 408439482

Source-Link: googleapis/googleapis@b9f6184

Source-Link: googleapis/googleapis-gen@eb888bc
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiZWI4ODhiYzIxNGVmYzdiZjQzYmY0NjM0YjQ3MDI1NDU2NWE2NTlhNSJ9
  • Loading branch information
gcf-owl-bot[bot] committed Nov 10, 2021
1 parent 6319602 commit 83277ad
Show file tree
Hide file tree
Showing 81 changed files with 6,255 additions and 2,191 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
// Copyright 2021 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

'use strict';

function main(requests) {
// [START vision_v1_generated_ImageAnnotator_AsyncBatchAnnotateFiles_async]
/**
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. Individual async file annotation requests for this batch.
*/
// const requests = 1234
/**
* Optional. Target project and location to make a call.
* Format: `projects/{project-id}/locations/{location-id}`.
* If no parent is specified, a region will be chosen automatically.
* Supported location-ids:
* `us`: USA country only,
* `asia`: East asia areas, like Japan, Taiwan,
* `eu`: The European Union.
* Example: `projects/project-A/locations/eu`.
*/
// const parent = 'abc123'

// Imports the Vision library
const {ImageAnnotatorClient} = require('@google-cloud/vision').v1;

// Instantiates a client
const visionClient = new ImageAnnotatorClient();

async function callAsyncBatchAnnotateFiles() {
// Construct request
const request = {
requests,
};

// Run request
const [operation] = await visionClient.asyncBatchAnnotateFiles(request);
const [response] = await operation.promise();
console.log(response);
}

callAsyncBatchAnnotateFiles();
// [END vision_v1_generated_ImageAnnotator_AsyncBatchAnnotateFiles_async]
}

process.on('unhandledRejection', err => {
console.error(err.message);
process.exitCode = 1;
});
main(...process.argv.slice(2));
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
// Copyright 2021 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

'use strict';

function main(requests, outputConfig) {
// [START vision_v1_generated_ImageAnnotator_AsyncBatchAnnotateImages_async]
/**
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. Individual image annotation requests for this batch.
*/
// const requests = 1234
/**
* Required. The desired output location and metadata (e.g. format).
*/
// const outputConfig = {}
/**
* Optional. Target project and location to make a call.
* Format: `projects/{project-id}/locations/{location-id}`.
* If no parent is specified, a region will be chosen automatically.
* Supported location-ids:
* `us`: USA country only,
* `asia`: East asia areas, like Japan, Taiwan,
* `eu`: The European Union.
* Example: `projects/project-A/locations/eu`.
*/
// const parent = 'abc123'

// Imports the Vision library
const {ImageAnnotatorClient} = require('@google-cloud/vision').v1;

// Instantiates a client
const visionClient = new ImageAnnotatorClient();

async function callAsyncBatchAnnotateImages() {
// Construct request
const request = {
requests,
outputConfig,
};

// Run request
const [operation] = await visionClient.asyncBatchAnnotateImages(request);
const [response] = await operation.promise();
console.log(response);
}

callAsyncBatchAnnotateImages();
// [END vision_v1_generated_ImageAnnotator_AsyncBatchAnnotateImages_async]
}

process.on('unhandledRejection', err => {
console.error(err.message);
process.exitCode = 1;
});
main(...process.argv.slice(2));
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
// Copyright 2021 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

'use strict';

function main(requests) {
// [START vision_v1_generated_ImageAnnotator_BatchAnnotateFiles_async]
/**
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. The list of file annotation requests. Right now we support only
* one AnnotateFileRequest in BatchAnnotateFilesRequest.
*/
// const requests = 1234
/**
* Optional. Target project and location to make a call.
* Format: `projects/{project-id}/locations/{location-id}`.
* If no parent is specified, a region will be chosen automatically.
* Supported location-ids:
* `us`: USA country only,
* `asia`: East asia areas, like Japan, Taiwan,
* `eu`: The European Union.
* Example: `projects/project-A/locations/eu`.
*/
// const parent = 'abc123'

// Imports the Vision library
const {ImageAnnotatorClient} = require('@google-cloud/vision').v1;

// Instantiates a client
const visionClient = new ImageAnnotatorClient();

async function callBatchAnnotateFiles() {
// Construct request
const request = {
requests,
};

// Run request
const response = await visionClient.batchAnnotateFiles(request);
console.log(response);
}

callBatchAnnotateFiles();
// [END vision_v1_generated_ImageAnnotator_BatchAnnotateFiles_async]
}

process.on('unhandledRejection', err => {
console.error(err.message);
process.exitCode = 1;
});
main(...process.argv.slice(2));
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
// Copyright 2021 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

'use strict';

function main(requests) {
// [START vision_v1_generated_ImageAnnotator_BatchAnnotateImages_async]
/**
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. Individual image annotation requests for this batch.
*/
// const requests = 1234
/**
* Optional. Target project and location to make a call.
* Format: `projects/{project-id}/locations/{location-id}`.
* If no parent is specified, a region will be chosen automatically.
* Supported location-ids:
* `us`: USA country only,
* `asia`: East asia areas, like Japan, Taiwan,
* `eu`: The European Union.
* Example: `projects/project-A/locations/eu`.
*/
// const parent = 'abc123'

// Imports the Vision library
const {ImageAnnotatorClient} = require('@google-cloud/vision').v1;

// Instantiates a client
const visionClient = new ImageAnnotatorClient();

async function callBatchAnnotateImages() {
// Construct request
const request = {
requests,
};

// Run request
const response = await visionClient.batchAnnotateImages(request);
console.log(response);
}

callBatchAnnotateImages();
// [END vision_v1_generated_ImageAnnotator_BatchAnnotateImages_async]
}

process.on('unhandledRejection', err => {
console.error(err.message);
process.exitCode = 1;
});
main(...process.argv.slice(2));
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
// Copyright 2021 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

'use strict';

function main(name, product) {
// [START vision_v1_generated_ProductSearch_AddProductToProductSet_async]
/**
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. The resource name for the ProductSet to modify.
* Format is:
* `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`
*/
// const name = 'abc123'
/**
* Required. The resource name for the Product to be added to this ProductSet.
* Format is:
* `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`
*/
// const product = 'abc123'

// Imports the Vision library
const {ProductSearchClient} = require('@google-cloud/vision').v1;

// Instantiates a client
const visionClient = new ProductSearchClient();

async function callAddProductToProductSet() {
// Construct request
const request = {
name,
product,
};

// Run request
const response = await visionClient.addProductToProductSet(request);
console.log(response);
}

callAddProductToProductSet();
// [END vision_v1_generated_ProductSearch_AddProductToProductSet_async]
}

process.on('unhandledRejection', err => {
console.error(err.message);
process.exitCode = 1;
});
main(...process.argv.slice(2));
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
// Copyright 2021 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

'use strict';

function main(parent, product) {
// [START vision_v1_generated_ProductSearch_CreateProduct_async]
/**
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. The project in which the Product should be created.
* Format is
* `projects/PROJECT_ID/locations/LOC_ID`.
*/
// const parent = 'abc123'
/**
* Required. The product to create.
*/
// const product = {}
/**
* A user-supplied resource id for this Product. If set, the server will
* attempt to use this value as the resource id. If it is already in use, an
* error is returned with code ALREADY_EXISTS. Must be at most 128 characters
* long. It cannot contain the character `/`.
*/
// const productId = 'abc123'

// Imports the Vision library
const {ProductSearchClient} = require('@google-cloud/vision').v1;

// Instantiates a client
const visionClient = new ProductSearchClient();

async function callCreateProduct() {
// Construct request
const request = {
parent,
product,
};

// Run request
const response = await visionClient.createProduct(request);
console.log(response);
}

callCreateProduct();
// [END vision_v1_generated_ProductSearch_CreateProduct_async]
}

process.on('unhandledRejection', err => {
console.error(err.message);
process.exitCode = 1;
});
main(...process.argv.slice(2));
Loading

0 comments on commit 83277ad

Please sign in to comment.