-
Notifications
You must be signed in to change notification settings - Fork 598
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs(samples): add auto-generated samples for Node with api short nam…
…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
1 parent
30f062e
commit 9e787f2
Showing
209 changed files
with
11,742 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
packages/google-cloud-dialogflow-cx/samples/generated/v3/agents.create_agent.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)); |
53 changes: 53 additions & 0 deletions
53
packages/google-cloud-dialogflow-cx/samples/generated/v3/agents.delete_agent.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)); |
67 changes: 67 additions & 0 deletions
67
packages/google-cloud-dialogflow-cx/samples/generated/v3/agents.export_agent.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)); |
53 changes: 53 additions & 0 deletions
53
packages/google-cloud-dialogflow-cx/samples/generated/v3/agents.get_agent.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)); |
58 changes: 58 additions & 0 deletions
58
...ges/google-cloud-dialogflow-cx/samples/generated/v3/agents.get_agent_validation_result.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)); |
64 changes: 64 additions & 0 deletions
64
packages/google-cloud-dialogflow-cx/samples/generated/v3/agents.list_agents.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)); |
Oops, something went wrong.