Skip to content
This repository was archived by the owner on Jul 20, 2023. It is now read-only.

Commit

Permalink
feat: adds projectAgentEnvironmentPathTemplate and projectAgentEnviro…
Browse files Browse the repository at this point in the history
…nmentUserSessionContextPathTemplate
  • Loading branch information
yoshi-automation authored Jul 8, 2020
1 parent e0787c0 commit c204d9c
Show file tree
Hide file tree
Showing 21 changed files with 2,286 additions and 848 deletions.
12 changes: 9 additions & 3 deletions protos/google/cloud/dialogflow/v2beta1/environment.proto
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ message Environment {
option (google.api.resource) = {
type: "dialogflow.googleapis.com/Environment"
pattern: "projects/{project}/agent/environments/{environment}"
pattern: "projects/{project}/locations/{location}/agent/environments/{environment}"
};

// Represents an environment state. When an environment is pointed to a new
Expand All @@ -78,8 +79,10 @@ message Environment {
}

// Output only. The unique identifier of this agent environment.
// Format: `projects/<Project ID>/agent/environments/<Environment ID>`.
// For Environment ID, "-" is reserved for 'draft' environment.
// Format:
// - `projects/<Project Number / ID>/agent/environments/<Environment ID>`
// - `projects/<Project Number / ID>/locations/<Location
// ID>/agent/environments/<Environment ID>`
string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY];

// Optional. The developer-provided description for this environment.
Expand All @@ -102,7 +105,10 @@ message Environment {
// The request message for [Environments.ListEnvironments][google.cloud.dialogflow.v2beta1.Environments.ListEnvironments].
message ListEnvironmentsRequest {
// Required. The agent to list all environments from.
// Format: `projects/<Project ID>/agent`.
// Format:
// - `projects/<Project Number / ID>/agent`
// - `projects/<Project Number / ID>/locations/<Location
// ID>/agent
string parent = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
Expand Down
2 changes: 1 addition & 1 deletion protos/protos.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

158 changes: 117 additions & 41 deletions src/v2beta1/agents_client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,9 +192,6 @@ export class AgentsClient {
documentPathTemplate: new this._gaxModule.PathTemplate(
'projects/{project}/knowledgeBases/{knowledge_base}/documents/{document}'
),
environmentPathTemplate: new this._gaxModule.PathTemplate(
'projects/{project}/agent/environments/{environment}'
),
knowledgeBasePathTemplate: new this._gaxModule.PathTemplate(
'projects/{project}/knowledgeBases/{knowledge_base}'
),
Expand All @@ -207,6 +204,9 @@ export class AgentsClient {
projectAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate(
'projects/{project}/agent/entityTypes/{entity_type}'
),
projectAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate(
'projects/{project}/agent/environments/{environment}'
),
projectAgentEnvironmentUserSessionContextPathTemplate: new this._gaxModule.PathTemplate(
'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}'
),
Expand All @@ -228,6 +228,9 @@ export class AgentsClient {
projectLocationAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate(
'projects/{project}/locations/{location}/agent/entityTypes/{entity_type}'
),
projectLocationAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate(
'projects/{project}/locations/{location}/agent/environments/{environment}'
),
projectLocationAgentIntentPathTemplate: new this._gaxModule.PathTemplate(
'projects/{project}/locations/{location}/agent/intents/{intent}'
),
Expand Down Expand Up @@ -1658,44 +1661,6 @@ export class AgentsClient {
return this.pathTemplates.documentPathTemplate.match(documentName).document;
}

/**
* Return a fully-qualified environment resource name string.
*
* @param {string} project
* @param {string} environment
* @returns {string} Resource name string.
*/
environmentPath(project: string, environment: string) {
return this.pathTemplates.environmentPathTemplate.render({
project: project,
environment: environment,
});
}

/**
* Parse the project from Environment resource.
*
* @param {string} environmentName
* A fully-qualified path representing Environment resource.
* @returns {string} A string representing the project.
*/
matchProjectFromEnvironmentName(environmentName: string) {
return this.pathTemplates.environmentPathTemplate.match(environmentName)
.project;
}

/**
* Parse the environment from Environment resource.
*
* @param {string} environmentName
* A fully-qualified path representing Environment resource.
* @returns {string} A string representing the environment.
*/
matchEnvironmentFromEnvironmentName(environmentName: string) {
return this.pathTemplates.environmentPathTemplate.match(environmentName)
.environment;
}

/**
* Return a fully-qualified knowledgeBase resource name string.
*
Expand Down Expand Up @@ -1825,6 +1790,50 @@ export class AgentsClient {
).entity_type;
}

/**
* Return a fully-qualified projectAgentEnvironment resource name string.
*
* @param {string} project
* @param {string} environment
* @returns {string} Resource name string.
*/
projectAgentEnvironmentPath(project: string, environment: string) {
return this.pathTemplates.projectAgentEnvironmentPathTemplate.render({
project: project,
environment: environment,
});
}

/**
* Parse the project from ProjectAgentEnvironment resource.
*
* @param {string} projectAgentEnvironmentName
* A fully-qualified path representing project_agent_environment resource.
* @returns {string} A string representing the project.
*/
matchProjectFromProjectAgentEnvironmentName(
projectAgentEnvironmentName: string
) {
return this.pathTemplates.projectAgentEnvironmentPathTemplate.match(
projectAgentEnvironmentName
).project;
}

/**
* Parse the environment from ProjectAgentEnvironment resource.
*
* @param {string} projectAgentEnvironmentName
* A fully-qualified path representing project_agent_environment resource.
* @returns {string} A string representing the environment.
*/
matchEnvironmentFromProjectAgentEnvironmentName(
projectAgentEnvironmentName: string
) {
return this.pathTemplates.projectAgentEnvironmentPathTemplate.match(
projectAgentEnvironmentName
).environment;
}

/**
* Return a fully-qualified projectAgentEnvironmentUserSessionContext resource name string.
*
Expand Down Expand Up @@ -2308,6 +2317,73 @@ export class AgentsClient {
).entity_type;
}

/**
* Return a fully-qualified projectLocationAgentEnvironment resource name string.
*
* @param {string} project
* @param {string} location
* @param {string} environment
* @returns {string} Resource name string.
*/
projectLocationAgentEnvironmentPath(
project: string,
location: string,
environment: string
) {
return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render(
{
project: project,
location: location,
environment: environment,
}
);
}

/**
* Parse the project from ProjectLocationAgentEnvironment resource.
*
* @param {string} projectLocationAgentEnvironmentName
* A fully-qualified path representing project_location_agent_environment resource.
* @returns {string} A string representing the project.
*/
matchProjectFromProjectLocationAgentEnvironmentName(
projectLocationAgentEnvironmentName: string
) {
return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(
projectLocationAgentEnvironmentName
).project;
}

/**
* Parse the location from ProjectLocationAgentEnvironment resource.
*
* @param {string} projectLocationAgentEnvironmentName
* A fully-qualified path representing project_location_agent_environment resource.
* @returns {string} A string representing the location.
*/
matchLocationFromProjectLocationAgentEnvironmentName(
projectLocationAgentEnvironmentName: string
) {
return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(
projectLocationAgentEnvironmentName
).location;
}

/**
* Parse the environment from ProjectLocationAgentEnvironment resource.
*
* @param {string} projectLocationAgentEnvironmentName
* A fully-qualified path representing project_location_agent_environment resource.
* @returns {string} A string representing the environment.
*/
matchEnvironmentFromProjectLocationAgentEnvironmentName(
projectLocationAgentEnvironmentName: string
) {
return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match(
projectLocationAgentEnvironmentName
).environment;
}

/**
* Return a fully-qualified projectLocationAgentIntent resource name string.
*
Expand Down
Loading

0 comments on commit c204d9c

Please sign in to comment.