Skip to content

Commit

Permalink
docs(samples): add auto-generated samples for Node with api short nam…
Browse files Browse the repository at this point in the history
…e in region tag (#186)

- [ ] Regenerate this pull request now.

PiperOrigin-RevId: 399287285

Source-Link: googleapis/googleapis@1575986

Source-Link: googleapis/googleapis-gen@b27fff6
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYjI3ZmZmNjIzYTVkOGQ1ODZiNzAzYjVlNDkxOTg1NmFiZTdjMmViMyJ9
  • Loading branch information
gcf-owl-bot[bot] authored Oct 5, 2021
1 parent 30f062e commit 9e787f2
Show file tree
Hide file tree
Showing 209 changed files with 11,742 additions and 68 deletions.
5 changes: 1 addition & 4 deletions packages/google-cloud-dialogflow-cx/linkinator.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@
"skip": [
"https://codecov.io/gh/googleapis/",
"www.googleapis.com",
"img.shields.io",
"https://github.com/googleapis/nodejs-dialogflow-cx/blob/main/samples/create-page.js",
"https://github.com/googleapis/nodejs-dialogflow-cx/blob/main/samples/delete-page.js",
"https://github.com/googleapis/nodejs-dialogflow-cx/blob/main/samples/list-page.js"
"img.shields.io"
],
"silent": true,
"concurrency": 10
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
// 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, agent) {
// [START dialogflow_v3_generated_Agents_CreateAgent_async]
/**
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. The location to create a agent for.
* Format: `projects/<Project ID>/locations/<Location ID>`.
*/
// const parent = 'abc123'
/**
* Required. The agent to create.
*/
// const agent = ''

// Imports the Cx library
const {AgentsClient} = require('@google-cloud/dialogflow-cx').v3;

// Instantiates a client
const cxClient = new AgentsClient();

async function createAgent() {
// Construct request
const request = {
parent,
agent,
};

// Run request
const response = await cxClient.createAgent(request);
console.log(response);
}

createAgent();
// [END dialogflow_v3_generated_Agents_CreateAgent_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,53 @@
// 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) {
// [START dialogflow_v3_generated_Agents_DeleteAgent_async]
/**
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. The name of the agent to delete.
* Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>`.
*/
// const name = 'abc123'

// Imports the Cx library
const {AgentsClient} = require('@google-cloud/dialogflow-cx').v3;

// Instantiates a client
const cxClient = new AgentsClient();

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

// Run request
const response = await cxClient.deleteAgent(request);
console.log(response);
}

deleteAgent();
// [END dialogflow_v3_generated_Agents_DeleteAgent_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,67 @@
// 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) {
// [START dialogflow_v3_generated_Agents_ExportAgent_async]
/**
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. The name of the agent to export.
* Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>`.
*/
// const name = 'abc123'
/**
* Optional. The [Google Cloud Storage](https://cloud.google.com/storage/docs/) URI to
* export the agent to. The format of this URI must be
* `gs://<bucket-name>/<object-name>`.
* If left unspecified, the serialized agent is returned inline.
*/
// const agentUri = 'abc123'
/**
* Optional. Environment name. If not set, draft environment is assumed.
* Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent
* ID>/environments/<Environment ID>`.
*/
// const environment = 'abc123'

// Imports the Cx library
const {AgentsClient} = require('@google-cloud/dialogflow-cx').v3;

// Instantiates a client
const cxClient = new AgentsClient();

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

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

exportAgent();
// [END dialogflow_v3_generated_Agents_ExportAgent_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,53 @@
// 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) {
// [START dialogflow_v3_generated_Agents_GetAgent_async]
/**
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. The name of the agent.
* Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>`.
*/
// const name = 'abc123'

// Imports the Cx library
const {AgentsClient} = require('@google-cloud/dialogflow-cx').v3;

// Instantiates a client
const cxClient = new AgentsClient();

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

// Run request
const response = await cxClient.getAgent(request);
console.log(response);
}

getAgent();
// [END dialogflow_v3_generated_Agents_GetAgent_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,58 @@
// 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) {
// [START dialogflow_v3_generated_Agents_GetAgentValidationResult_async]
/**
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. The agent name.
* Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent
* ID>/validationResult`.
*/
// const name = 'abc123'
/**
* If not specified, the agent's default language is used.
*/
// const languageCode = 'abc123'

// Imports the Cx library
const {AgentsClient} = require('@google-cloud/dialogflow-cx').v3;

// Instantiates a client
const cxClient = new AgentsClient();

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

// Run request
const response = await cxClient.getAgentValidationResult(request);
console.log(response);
}

getAgentValidationResult();
// [END dialogflow_v3_generated_Agents_GetAgentValidationResult_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(parent) {
// [START dialogflow_v3_generated_Agents_ListAgents_async]
/**
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. The location to list all agents for.
* Format: `projects/<Project ID>/locations/<Location ID>`.
*/
// const parent = 'abc123'
/**
* The maximum number of items to return in a single page. By default 100 and
* at most 1000.
*/
// const pageSize = 1234
/**
* The next_page_token value returned from a previous list request.
*/
// const pageToken = 'abc123'

// Imports the Cx library
const {AgentsClient} = require('@google-cloud/dialogflow-cx').v3;

// Instantiates a client
const cxClient = new AgentsClient();

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

// Run request
const iterable = await cxClient.listAgentsAsync(request);
for await (const response of iterable) {
console.log(response);
}
}

listAgents();
// [END dialogflow_v3_generated_Agents_ListAgents_async]
}

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

0 comments on commit 9e787f2

Please sign in to comment.