/// <summary>Snippet for TrainAgentAsync</summary>
        public async Task TrainAgentAsync()
        {
            // Snippet: TrainAgentAsync(ProjectName,CallSettings)
            // Additional: TrainAgentAsync(ProjectName,CancellationToken)
            // Create client
            AgentsClient agentsClient = await AgentsClient.CreateAsync();

            // Initialize request argument(s)
            ProjectName parent = new ProjectName("[PROJECT]");
            // Make the request
            Operation <Empty, Struct> response =
                await agentsClient.TrainAgentAsync(parent);

            // Poll until the returned long-running operation is complete
            Operation <Empty, Struct> completedResponse =
                await response.PollUntilCompletedAsync();

            // The long-running operation is now complete.

            // Or get the name of the operation
            string operationName = response.Name;
            // This name can be stored, then the long-running operation retrieved later by name
            Operation <Empty, Struct> retrievedResponse =
                await agentsClient.PollOnceTrainAgentAsync(operationName);

            // Check if the retrieved long-running operation has completed
            if (retrievedResponse.IsCompleted)
            {
                // The long-running operation is now complete.
            }
            // End snippet
        }
        /// <summary>Snippet for TrainAgentAsync</summary>
        public async Task TrainAgentRequestObjectAsync()
        {
            // Snippet: TrainAgentAsync(TrainAgentRequest, CallSettings)
            // Additional: TrainAgentAsync(TrainAgentRequest, CancellationToken)
            // Create client
            AgentsClient agentsClient = await AgentsClient.CreateAsync();

            // Initialize request argument(s)
            TrainAgentRequest request = new TrainAgentRequest
            {
                ParentAsProjectName = ProjectName.FromProject("[PROJECT]"),
            };
            // Make the request
            Operation <Empty, Struct> response = await agentsClient.TrainAgentAsync(request);

            // Poll until the returned long-running operation is complete
            Operation <Empty, Struct> completedResponse = await response.PollUntilCompletedAsync();

            // Retrieve the operation result
            Empty result = completedResponse.Result;

            // Or get the name of the operation
            string operationName = response.Name;
            // This name can be stored, then the long-running operation retrieved later by name
            Operation <Empty, Struct> retrievedResponse = await agentsClient.PollOnceTrainAgentAsync(operationName);

            // Check if the retrieved long-running operation has completed
            if (retrievedResponse.IsCompleted)
            {
                // If it has completed, then access the result
                Empty retrievedResult = retrievedResponse.Result;
            }
            // End snippet
        }
Esempio n. 3
0
        internal TookanClient(IConnection connection)
        {
            var apiConnection = new ApiConnection(connection);

            Agents = new AgentsClient(apiConnection);
            Teams  = new TeamsClient(apiConnection);
        }
        /// <summary>Snippet for ExportAgent</summary>
        public void ExportAgent()
        {
            // Snippet: ExportAgent(ProjectName,CallSettings)
            // Create client
            AgentsClient agentsClient = AgentsClient.Create();
            // Initialize request argument(s)
            ProjectName parent = new ProjectName("[PROJECT]");
            // Make the request
            Operation <ExportAgentResponse, Struct> response =
                agentsClient.ExportAgent(parent);

            // Poll until the returned long-running operation is complete
            Operation <ExportAgentResponse, Struct> completedResponse =
                response.PollUntilCompleted();
            // Retrieve the operation result
            ExportAgentResponse result = completedResponse.Result;

            // Or get the name of the operation
            string operationName = response.Name;
            // This name can be stored, then the long-running operation retrieved later by name
            Operation <ExportAgentResponse, Struct> retrievedResponse =
                agentsClient.PollOnceExportAgent(operationName);

            // Check if the retrieved long-running operation has completed
            if (retrievedResponse.IsCompleted)
            {
                // If it has completed, then access the result
                ExportAgentResponse retrievedResult = retrievedResponse.Result;
            }
            // End snippet
        }
        /// <summary>Snippet for ExportAgentAsync</summary>
        public async Task ExportAgentRequestObjectAsync()
        {
            // Snippet: ExportAgentAsync(ExportAgentRequest, CallSettings)
            // Additional: ExportAgentAsync(ExportAgentRequest, CancellationToken)
            // Create client
            AgentsClient agentsClient = await AgentsClient.CreateAsync();

            // Initialize request argument(s)
            ExportAgentRequest request = new ExportAgentRequest
            {
                AgentName = AgentName.FromProjectLocationAgent("[PROJECT]", "[LOCATION]", "[AGENT]"),
                AgentUri  = "",
            };
            // Make the request
            Operation <ExportAgentResponse, Struct> response = await agentsClient.ExportAgentAsync(request);

            // Poll until the returned long-running operation is complete
            Operation <ExportAgentResponse, Struct> completedResponse = await response.PollUntilCompletedAsync();

            // Retrieve the operation result
            ExportAgentResponse result = completedResponse.Result;

            // Or get the name of the operation
            string operationName = response.Name;
            // This name can be stored, then the long-running operation retrieved later by name
            Operation <ExportAgentResponse, Struct> retrievedResponse = await agentsClient.PollOnceExportAgentAsync(operationName);

            // Check if the retrieved long-running operation has completed
            if (retrievedResponse.IsCompleted)
            {
                // If it has completed, then access the result
                ExportAgentResponse retrievedResult = retrievedResponse.Result;
            }
            // End snippet
        }
        /// <summary>Snippet for RestoreAgent</summary>
        public void RestoreAgentRequestObject()
        {
            // Snippet: RestoreAgent(RestoreAgentRequest, CallSettings)
            // Create client
            AgentsClient agentsClient = AgentsClient.Create();
            // Initialize request argument(s)
            RestoreAgentRequest request = new RestoreAgentRequest
            {
                AgentName    = AgentName.FromProjectLocationAgent("[PROJECT]", "[LOCATION]", "[AGENT]"),
                AgentUri     = "",
                AgentContent = ByteString.Empty,
            };
            // Make the request
            Operation <Empty, Struct> response = agentsClient.RestoreAgent(request);

            // Poll until the returned long-running operation is complete
            Operation <Empty, Struct> completedResponse = response.PollUntilCompleted();
            // Retrieve the operation result
            Empty result = completedResponse.Result;

            // Or get the name of the operation
            string operationName = response.Name;
            // This name can be stored, then the long-running operation retrieved later by name
            Operation <Empty, Struct> retrievedResponse = agentsClient.PollOnceRestoreAgent(operationName);

            // Check if the retrieved long-running operation has completed
            if (retrievedResponse.IsCompleted)
            {
                // If it has completed, then access the result
                Empty retrievedResult = retrievedResponse.Result;
            }
            // End snippet
        }
        /// <summary>Snippet for ExportAgentAsync</summary>
        public async Task ExportAgentAsync()
        {
            // Snippet: ExportAgentAsync(string, CallSettings)
            // Additional: ExportAgentAsync(string, CancellationToken)
            // Create client
            AgentsClient agentsClient = await AgentsClient.CreateAsync();

            // Initialize request argument(s)
            string parent = "projects/[PROJECT]";
            // Make the request
            Operation <ExportAgentResponse, Struct> response = await agentsClient.ExportAgentAsync(parent);

            // Poll until the returned long-running operation is complete
            Operation <ExportAgentResponse, Struct> completedResponse = await response.PollUntilCompletedAsync();

            // Retrieve the operation result
            ExportAgentResponse result = completedResponse.Result;

            // Or get the name of the operation
            string operationName = response.Name;
            // This name can be stored, then the long-running operation retrieved later by name
            Operation <ExportAgentResponse, Struct> retrievedResponse = await agentsClient.PollOnceExportAgentAsync(operationName);

            // Check if the retrieved long-running operation has completed
            if (retrievedResponse.IsCompleted)
            {
                // If it has completed, then access the result
                ExportAgentResponse retrievedResult = retrievedResponse.Result;
            }
            // End snippet
        }
        /// <summary>Snippet for RestoreAgent</summary>
        public void RestoreAgent_RequestObject()
        {
            // Snippet: RestoreAgent(RestoreAgentRequest,CallSettings)
            // Create client
            AgentsClient agentsClient = AgentsClient.Create();
            // Initialize request argument(s)
            RestoreAgentRequest request = new RestoreAgentRequest
            {
                ParentAsProjectName = new ProjectName("[PROJECT]"),
            };
            // Make the request
            Operation <Empty, Struct> response =
                agentsClient.RestoreAgent(request);

            // Poll until the returned long-running operation is complete
            Operation <Empty, Struct> completedResponse =
                response.PollUntilCompleted();
            // The long-running operation is now complete.

            // Or get the name of the operation
            string operationName = response.Name;
            // This name can be stored, then the long-running operation retrieved later by name
            Operation <Empty, Struct> retrievedResponse =
                agentsClient.PollOnceRestoreAgent(operationName);

            // Check if the retrieved long-running operation has completed
            if (retrievedResponse.IsCompleted)
            {
                // The long-running operation is now complete.
            }
            // End snippet
        }
 /// <summary>Snippet for GetAgent</summary>
 public void GetAgent()
 {
     // Snippet: GetAgent(string, CallSettings)
     // Create client
     AgentsClient agentsClient = AgentsClient.Create();
     // Initialize request argument(s)
     string parent = "projects/[PROJECT]";
     // Make the request
     Agent response = agentsClient.GetAgent(parent);
     // End snippet
 }
 /// <summary>Snippet for SetAgent</summary>
 public void SetAgent()
 {
     // Snippet: SetAgent(Agent, CallSettings)
     // Create client
     AgentsClient agentsClient = AgentsClient.Create();
     // Initialize request argument(s)
     Agent agent = new Agent();
     // Make the request
     Agent response = agentsClient.SetAgent(agent);
     // End snippet
 }
Esempio n. 11
0
 /// <summary>Snippet for SetAgent</summary>
 public void SetAgent_RequestObject()
 {
     // Snippet: SetAgent(SetAgentRequest,CallSettings)
     // Create client
     AgentsClient agentsClient = AgentsClient.Create();
     // Initialize request argument(s)
     SetAgentRequest request = new SetAgentRequest();
     // Make the request
     Agent response = agentsClient.SetAgent(request);
     // End snippet
 }
 /// <summary>Snippet for GetAgentValidationResult</summary>
 public void GetAgentValidationResult()
 {
     // Snippet: GetAgentValidationResult(string, CallSettings)
     // Create client
     AgentsClient agentsClient = AgentsClient.Create();
     // Initialize request argument(s)
     string name = "projects/[PROJECT]/locations/[LOCATION]/agents/[AGENT]/validationResult";
     // Make the request
     AgentValidationResult response = agentsClient.GetAgentValidationResult(name);
     // End snippet
 }
 /// <summary>Snippet for GetAgent</summary>
 public void GetAgent()
 {
     // Snippet: GetAgent(ProjectName,CallSettings)
     // Create client
     AgentsClient agentsClient = AgentsClient.Create();
     // Initialize request argument(s)
     ProjectName parent = new ProjectName("[PROJECT]");
     // Make the request
     Agent response = agentsClient.GetAgent(parent);
     // End snippet
 }
 /// <summary>Snippet for GetAgentValidationResult</summary>
 public void GetAgentValidationResultResourceNames()
 {
     // Snippet: GetAgentValidationResult(AgentValidationResultName, CallSettings)
     // Create client
     AgentsClient agentsClient = AgentsClient.Create();
     // Initialize request argument(s)
     AgentValidationResultName name = AgentValidationResultName.FromProjectLocationAgent("[PROJECT]", "[LOCATION]", "[AGENT]");
     // Make the request
     AgentValidationResult response = agentsClient.GetAgentValidationResult(name);
     // End snippet
 }
Esempio n. 15
0
        /// <summary>Snippet for DeleteAgent</summary>
        public void DeleteAgent_RequestObject()
        {
            // Snippet: DeleteAgent(DeleteAgentRequest,CallSettings)
            // Create client
            AgentsClient agentsClient = AgentsClient.Create();
            // Initialize request argument(s)
            DeleteAgentRequest request = new DeleteAgentRequest();

            // Make the request
            agentsClient.DeleteAgent(request);
            // End snippet
        }
        /// <summary>Snippet for DeleteAgent</summary>
        public void DeleteAgent()
        {
            // Snippet: DeleteAgent(string, CallSettings)
            // Create client
            AgentsClient agentsClient = AgentsClient.Create();
            // Initialize request argument(s)
            string name = "projects/[PROJECT]/locations/[LOCATION]/agents/[AGENT]";

            // Make the request
            agentsClient.DeleteAgent(name);
            // End snippet
        }
 /// <summary>Snippet for UpdateAgent</summary>
 public void UpdateAgent()
 {
     // Snippet: UpdateAgent(Agent, FieldMask, CallSettings)
     // Create client
     AgentsClient agentsClient = AgentsClient.Create();
     // Initialize request argument(s)
     Agent     agent      = new Agent();
     FieldMask updateMask = new FieldMask();
     // Make the request
     Agent response = agentsClient.UpdateAgent(agent, updateMask);
     // End snippet
 }
 /// <summary>Snippet for CreateAgent</summary>
 public void CreateAgent()
 {
     // Snippet: CreateAgent(string, Agent, CallSettings)
     // Create client
     AgentsClient agentsClient = AgentsClient.Create();
     // Initialize request argument(s)
     string parent = "projects/[PROJECT]/locations/[LOCATION]";
     Agent  agent  = new Agent();
     // Make the request
     Agent response = agentsClient.CreateAgent(parent, agent);
     // End snippet
 }
        /// <summary>Snippet for DeleteAgent</summary>
        public void DeleteAgentResourceNames()
        {
            // Snippet: DeleteAgent(ProjectName, CallSettings)
            // Create client
            AgentsClient agentsClient = AgentsClient.Create();
            // Initialize request argument(s)
            ProjectName parent = ProjectName.FromProject("[PROJECT]");

            // Make the request
            agentsClient.DeleteAgent(parent);
            // End snippet
        }
 /// <summary>Snippet for CreateAgent</summary>
 public void CreateAgentResourceNames()
 {
     // Snippet: CreateAgent(LocationName, Agent, CallSettings)
     // Create client
     AgentsClient agentsClient = AgentsClient.Create();
     // Initialize request argument(s)
     LocationName parent = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]");
     Agent        agent  = new Agent();
     // Make the request
     Agent response = agentsClient.CreateAgent(parent, agent);
     // End snippet
 }
        /// <summary>Snippet for SetAgentAsync</summary>
        public async Task SetAgentAsync()
        {
            // Snippet: SetAgentAsync(Agent, CallSettings)
            // Additional: SetAgentAsync(Agent, CancellationToken)
            // Create client
            AgentsClient agentsClient = await AgentsClient.CreateAsync();

            // Initialize request argument(s)
            Agent agent = new Agent();
            // Make the request
            Agent response = await agentsClient.SetAgentAsync(agent);

            // End snippet
        }
        /// <summary>Snippet for GetAgentAsync</summary>
        public async Task GetAgentAsync()
        {
            // Snippet: GetAgentAsync(ProjectName,CallSettings)
            // Additional: GetAgentAsync(ProjectName,CancellationToken)
            // Create client
            AgentsClient agentsClient = await AgentsClient.CreateAsync();

            // Initialize request argument(s)
            ProjectName parent = new ProjectName("[PROJECT]");
            // Make the request
            Agent response = await agentsClient.GetAgentAsync(parent);

            // End snippet
        }
 /// <summary>Snippet for GetAgent</summary>
 public void GetAgentRequestObject()
 {
     // Snippet: GetAgent(GetAgentRequest, CallSettings)
     // Create client
     AgentsClient agentsClient = AgentsClient.Create();
     // Initialize request argument(s)
     GetAgentRequest request = new GetAgentRequest
     {
         AgentName = AgentName.FromProjectLocationAgent("[PROJECT]", "[LOCATION]", "[AGENT]"),
     };
     // Make the request
     Agent response = agentsClient.GetAgent(request);
     // End snippet
 }
        /// <summary>Snippet for DeleteAgentAsync</summary>
        public async Task DeleteAgentAsync()
        {
            // Snippet: DeleteAgentAsync(string, CallSettings)
            // Additional: DeleteAgentAsync(string, CancellationToken)
            // Create client
            AgentsClient agentsClient = await AgentsClient.CreateAsync();

            // Initialize request argument(s)
            string parent = "projects/[PROJECT]";
            // Make the request
            await agentsClient.DeleteAgentAsync(parent);

            // End snippet
        }
 /// <summary>Snippet for GetAgent</summary>
 public void GetAgent_RequestObject()
 {
     // Snippet: GetAgent(GetAgentRequest,CallSettings)
     // Create client
     AgentsClient agentsClient = AgentsClient.Create();
     // Initialize request argument(s)
     GetAgentRequest request = new GetAgentRequest
     {
         ParentAsProjectName = new ProjectName("[PROJECT]"),
     };
     // Make the request
     Agent response = agentsClient.GetAgent(request);
     // End snippet
 }
Esempio n. 26
0
        /// <summary>Snippet for DeleteAgentAsync</summary>
        public async Task DeleteAgentAsync_RequestObject()
        {
            // Snippet: DeleteAgentAsync(DeleteAgentRequest,CallSettings)
            // Additional: DeleteAgentAsync(DeleteAgentRequest,CancellationToken)
            // Create client
            AgentsClient agentsClient = await AgentsClient.CreateAsync();

            // Initialize request argument(s)
            DeleteAgentRequest request = new DeleteAgentRequest();
            // Make the request
            await agentsClient.DeleteAgentAsync(request);

            // End snippet
        }
        /// <summary>Snippet for GetAgentValidationResultAsync</summary>
        public async Task GetAgentValidationResultAsync()
        {
            // Snippet: GetAgentValidationResultAsync(string, CallSettings)
            // Additional: GetAgentValidationResultAsync(string, CancellationToken)
            // Create client
            AgentsClient agentsClient = await AgentsClient.CreateAsync();

            // Initialize request argument(s)
            string name = "projects/[PROJECT]/locations/[LOCATION]/agents/[AGENT]/validationResult";
            // Make the request
            AgentValidationResult response = await agentsClient.GetAgentValidationResultAsync(name);

            // End snippet
        }
        /// <summary>Snippet for GetAgentValidationResultAsync</summary>
        public async Task GetAgentValidationResultResourceNamesAsync()
        {
            // Snippet: GetAgentValidationResultAsync(AgentValidationResultName, CallSettings)
            // Additional: GetAgentValidationResultAsync(AgentValidationResultName, CancellationToken)
            // Create client
            AgentsClient agentsClient = await AgentsClient.CreateAsync();

            // Initialize request argument(s)
            AgentValidationResultName name = AgentValidationResultName.FromProjectLocationAgent("[PROJECT]", "[LOCATION]", "[AGENT]");
            // Make the request
            AgentValidationResult response = await agentsClient.GetAgentValidationResultAsync(name);

            // End snippet
        }
        /// <summary>Snippet for DeleteAgentAsync</summary>
        public async Task DeleteAgentResourceNamesAsync()
        {
            // Snippet: DeleteAgentAsync(ProjectName, CallSettings)
            // Additional: DeleteAgentAsync(ProjectName, CancellationToken)
            // Create client
            AgentsClient agentsClient = await AgentsClient.CreateAsync();

            // Initialize request argument(s)
            ProjectName parent = ProjectName.FromProject("[PROJECT]");
            // Make the request
            await agentsClient.DeleteAgentAsync(parent);

            // End snippet
        }
 /// <summary>Snippet for ValidateAgent</summary>
 public void ValidateAgentRequestObject()
 {
     // Snippet: ValidateAgent(ValidateAgentRequest, CallSettings)
     // Create client
     AgentsClient agentsClient = AgentsClient.Create();
     // Initialize request argument(s)
     ValidateAgentRequest request = new ValidateAgentRequest
     {
         AgentName    = AgentName.FromProjectLocationAgent("[PROJECT]", "[LOCATION]", "[AGENT]"),
         LanguageCode = "",
     };
     // Make the request
     AgentValidationResult response = agentsClient.ValidateAgent(request);
     // End snippet
 }