public void CreatePageResourceNames()
        {
            moq::Mock <Pages.PagesClient> mockGrpcClient = new moq::Mock <Pages.PagesClient>(moq::MockBehavior.Strict);
            CreatePageRequest             request        = new CreatePageRequest
            {
                ParentAsFlowName = FlowName.FromProjectLocationAgentFlow("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]"),
                Page             = new Page(),
            };
            Page expectedResponse = new Page
            {
                PageName         = PageName.FromProjectLocationAgentFlowPage("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[PAGE]"),
                DisplayName      = "display_name137f65c2",
                Form             = new Form(),
                EntryFulfillment = new Fulfillment(),
                TransitionRoutes =
                {
                    new TransitionRoute(),
                },
                EventHandlers = { new EventHandler(), },
                TransitionRouteGroupsAsTransitionRouteGroupNames =
                {
                    TransitionRouteGroupName.FromProjectLocationAgentFlowTransitionRouteGroup("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[TRANSITION_ROUTE_GROUP]"),
                },
            };

            mockGrpcClient.Setup(x => x.CreatePage(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            PagesClient client   = new PagesClientImpl(mockGrpcClient.Object, null);
            Page        response = client.CreatePage(request.ParentAsFlowName, request.Page);

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
        /// <summary>Snippet for TrainFlowAsync</summary>
        public async Task TrainFlowResourceNamesAsync()
        {
            // Snippet: TrainFlowAsync(FlowName, CallSettings)
            // Additional: TrainFlowAsync(FlowName, CancellationToken)
            // Create client
            FlowsClient flowsClient = await FlowsClient.CreateAsync();

            // Initialize request argument(s)
            FlowName name = FlowName.FromProjectLocationAgentFlow("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]");
            // Make the request
            Operation <Empty, Struct> response = await flowsClient.TrainFlowAsync(name);

            // 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 flowsClient.PollOnceTrainFlowAsync(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
        }
        public async stt::Task CreatePageAsync()
        {
            moq::Mock <Pages.PagesClient> mockGrpcClient = new moq::Mock <Pages.PagesClient>(moq::MockBehavior.Strict);
            CreatePageRequest             request        = new CreatePageRequest
            {
                ParentAsFlowName = FlowName.FromProjectLocationAgentFlow("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]"),
                Page             = new Page(),
            };
            Page expectedResponse = new Page
            {
                PageName         = PageName.FromProjectLocationAgentFlowPage("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[PAGE]"),
                DisplayName      = "display_name137f65c2",
                Form             = new Form(),
                EntryFulfillment = new Fulfillment(),
                TransitionRoutes =
                {
                    new TransitionRoute(),
                },
                EventHandlers = { new EventHandler(), },
                TransitionRouteGroupsAsTransitionRouteGroupNames =
                {
                    TransitionRouteGroupName.FromProjectLocationAgentFlowTransitionRouteGroup("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[TRANSITION_ROUTE_GROUP]"),
                },
            };

            mockGrpcClient.Setup(x => x.CreatePageAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <Page>(stt::Task.FromResult(expectedResponse), null, null, null, null));
            PagesClient client = new PagesClientImpl(mockGrpcClient.Object, null);
            Page        responseCallSettings = await client.CreatePageAsync(request.Parent, request.Page, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None));

            xunit::Assert.Same(expectedResponse, responseCallSettings);
            Page responseCancellationToken = await client.CreatePageAsync(request.Parent, request.Page, st::CancellationToken.None);

            xunit::Assert.Same(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }
        /// <summary>Snippet for TrainFlow</summary>
        public void TrainFlowRequestObject()
        {
            // Snippet: TrainFlow(TrainFlowRequest, CallSettings)
            // Create client
            FlowsClient flowsClient = FlowsClient.Create();
            // Initialize request argument(s)
            TrainFlowRequest request = new TrainFlowRequest
            {
                FlowName = FlowName.FromProjectLocationAgentFlow("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]"),
            };
            // Make the request
            Operation <Empty, Struct> response = flowsClient.TrainFlow(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 = flowsClient.PollOnceTrainFlow(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 CreateVersionAsync</summary>
        public async Task CreateVersionResourceNamesAsync()
        {
            // Snippet: CreateVersionAsync(FlowName, Version, CallSettings)
            // Additional: CreateVersionAsync(FlowName, Version, CancellationToken)
            // Create client
            VersionsClient versionsClient = await VersionsClient.CreateAsync();

            // Initialize request argument(s)
            FlowName       parent  = FlowName.FromProjectLocationAgentFlow("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]");
            gcdcv::Version version = new gcdcv::Version();
            // Make the request
            Operation <gcdcv::Version, CreateVersionOperationMetadata> response = await versionsClient.CreateVersionAsync(parent, version);

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

            // Retrieve the operation result
            gcdcv::Version 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 <gcdcv::Version, CreateVersionOperationMetadata> retrievedResponse = await versionsClient.PollOnceCreateVersionAsync(operationName);

            // Check if the retrieved long-running operation has completed
            if (retrievedResponse.IsCompleted)
            {
                // If it has completed, then access the result
                gcdcv::Version retrievedResult = retrievedResponse.Result;
            }
            // End snippet
        }
        /// <summary>Snippet for CreateVersion</summary>
        public void CreateVersionRequestObject()
        {
            // Snippet: CreateVersion(CreateVersionRequest, CallSettings)
            // Create client
            VersionsClient versionsClient = VersionsClient.Create();
            // Initialize request argument(s)
            CreateVersionRequest request = new CreateVersionRequest
            {
                ParentAsFlowName = FlowName.FromProjectLocationAgentFlow("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]"),
                Version          = new gcdcv::Version(),
            };
            // Make the request
            Operation <gcdcv::Version, CreateVersionOperationMetadata> response = versionsClient.CreateVersion(request);

            // Poll until the returned long-running operation is complete
            Operation <gcdcv::Version, CreateVersionOperationMetadata> completedResponse = response.PollUntilCompleted();
            // Retrieve the operation result
            gcdcv::Version 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 <gcdcv::Version, CreateVersionOperationMetadata> retrievedResponse = versionsClient.PollOnceCreateVersion(operationName);

            // Check if the retrieved long-running operation has completed
            if (retrievedResponse.IsCompleted)
            {
                // If it has completed, then access the result
                gcdcv::Version retrievedResult = retrievedResponse.Result;
            }
            // End snippet
        }
Beispiel #7
0
        public async stt::Task CreateTransitionRouteGroupResourceNamesAsync()
        {
            moq::Mock <TransitionRouteGroups.TransitionRouteGroupsClient> mockGrpcClient = new moq::Mock <TransitionRouteGroups.TransitionRouteGroupsClient>(moq::MockBehavior.Strict);
            CreateTransitionRouteGroupRequest request = new CreateTransitionRouteGroupRequest
            {
                ParentAsFlowName     = FlowName.FromProjectLocationAgentFlow("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]"),
                TransitionRouteGroup = new TransitionRouteGroup(),
            };
            TransitionRouteGroup expectedResponse = new TransitionRouteGroup
            {
                TransitionRouteGroupName = TransitionRouteGroupName.FromProjectLocationAgentFlowTransitionRouteGroup("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[TRANSITION_ROUTE_GROUP]"),
                DisplayName      = "display_name137f65c2",
                TransitionRoutes =
                {
                    new TransitionRoute(),
                },
            };

            mockGrpcClient.Setup(x => x.CreateTransitionRouteGroupAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <TransitionRouteGroup>(stt::Task.FromResult(expectedResponse), null, null, null, null));
            TransitionRouteGroupsClient client = new TransitionRouteGroupsClientImpl(mockGrpcClient.Object, null);
            TransitionRouteGroup        responseCallSettings = await client.CreateTransitionRouteGroupAsync(request.ParentAsFlowName, request.TransitionRouteGroup, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None));

            xunit::Assert.Same(expectedResponse, responseCallSettings);
            TransitionRouteGroup responseCancellationToken = await client.CreateTransitionRouteGroupAsync(request.ParentAsFlowName, request.TransitionRouteGroup, st::CancellationToken.None);

            xunit::Assert.Same(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }
Beispiel #8
0
        public void CreateTransitionRouteGroupResourceNames()
        {
            moq::Mock <TransitionRouteGroups.TransitionRouteGroupsClient> mockGrpcClient = new moq::Mock <TransitionRouteGroups.TransitionRouteGroupsClient>(moq::MockBehavior.Strict);
            CreateTransitionRouteGroupRequest request = new CreateTransitionRouteGroupRequest
            {
                ParentAsFlowName     = FlowName.FromProjectLocationAgentFlow("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]"),
                TransitionRouteGroup = new TransitionRouteGroup(),
            };
            TransitionRouteGroup expectedResponse = new TransitionRouteGroup
            {
                TransitionRouteGroupName = TransitionRouteGroupName.FromProjectLocationAgentFlowTransitionRouteGroup("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[TRANSITION_ROUTE_GROUP]"),
                DisplayName      = "display_name137f65c2",
                TransitionRoutes =
                {
                    new TransitionRoute(),
                },
            };

            mockGrpcClient.Setup(x => x.CreateTransitionRouteGroup(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            TransitionRouteGroupsClient client   = new TransitionRouteGroupsClientImpl(mockGrpcClient.Object, null);
            TransitionRouteGroup        response = client.CreateTransitionRouteGroup(request.ParentAsFlowName, request.TransitionRouteGroup);

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
Beispiel #9
0
 /// <summary>Snippet for GetFlow</summary>
 public void GetFlowResourceNames()
 {
     // Snippet: GetFlow(FlowName, CallSettings)
     // Create client
     FlowsClient flowsClient = FlowsClient.Create();
     // Initialize request argument(s)
     FlowName name = FlowName.FromProjectLocationAgentFlow("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]");
     // Make the request
     Flow response = flowsClient.GetFlow(name);
     // End snippet
 }
Beispiel #10
0
 /// <summary>Snippet for CreateTransitionRouteGroup</summary>
 public void CreateTransitionRouteGroupResourceNames()
 {
     // Snippet: CreateTransitionRouteGroup(FlowName, TransitionRouteGroup, CallSettings)
     // Create client
     TransitionRouteGroupsClient transitionRouteGroupsClient = TransitionRouteGroupsClient.Create();
     // Initialize request argument(s)
     FlowName             parent = FlowName.FromProjectLocationAgentFlow("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]");
     TransitionRouteGroup transitionRouteGroup = new TransitionRouteGroup();
     // Make the request
     TransitionRouteGroup response = transitionRouteGroupsClient.CreateTransitionRouteGroup(parent, transitionRouteGroup);
     // End snippet
 }
Beispiel #11
0
 /// <summary>Snippet for CreatePage</summary>
 public void CreatePageResourceNames()
 {
     // Snippet: CreatePage(FlowName, Page, CallSettings)
     // Create client
     PagesClient pagesClient = PagesClient.Create();
     // Initialize request argument(s)
     FlowName parent = FlowName.FromProjectLocationAgentFlow("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]");
     Page     page   = new Page();
     // Make the request
     Page response = pagesClient.CreatePage(parent, page);
     // End snippet
 }
Beispiel #12
0
        /// <summary>Snippet for GetFlowAsync</summary>
        public async Task GetFlowResourceNamesAsync()
        {
            // Snippet: GetFlowAsync(FlowName, CallSettings)
            // Additional: GetFlowAsync(FlowName, CancellationToken)
            // Create client
            FlowsClient flowsClient = await FlowsClient.CreateAsync();

            // Initialize request argument(s)
            FlowName name = FlowName.FromProjectLocationAgentFlow("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]");
            // Make the request
            Flow response = await flowsClient.GetFlowAsync(name);

            // End snippet
        }
Beispiel #13
0
        /// <summary>Snippet for ListTransitionRouteGroupsAsync</summary>
        public async Task ListTransitionRouteGroupsRequestObjectAsync()
        {
            // Snippet: ListTransitionRouteGroupsAsync(ListTransitionRouteGroupsRequest, CallSettings)
            // Create client
            TransitionRouteGroupsClient transitionRouteGroupsClient = await TransitionRouteGroupsClient.CreateAsync();

            // Initialize request argument(s)
            ListTransitionRouteGroupsRequest request = new ListTransitionRouteGroupsRequest
            {
                ParentAsFlowName = FlowName.FromProjectLocationAgentFlow("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]"),
                LanguageCode     = "",
            };
            // Make the request
            PagedAsyncEnumerable <ListTransitionRouteGroupsResponse, TransitionRouteGroup> response = transitionRouteGroupsClient.ListTransitionRouteGroupsAsync(request);

            // Iterate over all response items, lazily performing RPCs as required
            await response.ForEachAsync((TransitionRouteGroup item) =>
            {
                // Do something with each item
                Console.WriteLine(item);
            });

            // Or iterate over pages (of server-defined size), performing one RPC per page
            await response.AsRawResponses().ForEachAsync((ListTransitionRouteGroupsResponse page) =>
            {
                // Do something with each page of items
                Console.WriteLine("A page of results:");
                foreach (TransitionRouteGroup item in page)
                {
                    // Do something with each item
                    Console.WriteLine(item);
                }
            });

            // Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
            int pageSize = 10;
            Page <TransitionRouteGroup> singlePage = await response.ReadPageAsync(pageSize);

            // Do something with the page of items
            Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
            foreach (TransitionRouteGroup item in singlePage)
            {
                // Do something with each item
                Console.WriteLine(item);
            }
            // Store the pageToken, for when the next page is required.
            string nextPageToken = singlePage.NextPageToken;
            // End snippet
        }
Beispiel #14
0
        /// <summary>Snippet for CreateTransitionRouteGroupAsync</summary>
        public async Task CreateTransitionRouteGroupResourceNamesAsync()
        {
            // Snippet: CreateTransitionRouteGroupAsync(FlowName, TransitionRouteGroup, CallSettings)
            // Additional: CreateTransitionRouteGroupAsync(FlowName, TransitionRouteGroup, CancellationToken)
            // Create client
            TransitionRouteGroupsClient transitionRouteGroupsClient = await TransitionRouteGroupsClient.CreateAsync();

            // Initialize request argument(s)
            FlowName             parent = FlowName.FromProjectLocationAgentFlow("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]");
            TransitionRouteGroup transitionRouteGroup = new TransitionRouteGroup();
            // Make the request
            TransitionRouteGroup response = await transitionRouteGroupsClient.CreateTransitionRouteGroupAsync(parent, transitionRouteGroup);

            // End snippet
        }
Beispiel #15
0
 /// <summary>Snippet for ValidateFlow</summary>
 public void ValidateFlowRequestObject()
 {
     // Snippet: ValidateFlow(ValidateFlowRequest, CallSettings)
     // Create client
     FlowsClient flowsClient = FlowsClient.Create();
     // Initialize request argument(s)
     ValidateFlowRequest request = new ValidateFlowRequest
     {
         FlowName     = FlowName.FromProjectLocationAgentFlow("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]"),
         LanguageCode = "",
     };
     // Make the request
     FlowValidationResult response = flowsClient.ValidateFlow(request);
     // End snippet
 }
Beispiel #16
0
        /// <summary>Snippet for CreatePageAsync</summary>
        public async Task CreatePageResourceNamesAsync()
        {
            // Snippet: CreatePageAsync(FlowName, Page, CallSettings)
            // Additional: CreatePageAsync(FlowName, Page, CancellationToken)
            // Create client
            PagesClient pagesClient = await PagesClient.CreateAsync();

            // Initialize request argument(s)
            FlowName parent = FlowName.FromProjectLocationAgentFlow("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]");
            Page     page   = new Page();
            // Make the request
            Page response = await pagesClient.CreatePageAsync(parent, page);

            // End snippet
        }
Beispiel #17
0
        /// <summary>Snippet for ListPages</summary>
        public void ListPagesRequestObject()
        {
            // Snippet: ListPages(ListPagesRequest, CallSettings)
            // Create client
            PagesClient pagesClient = PagesClient.Create();
            // Initialize request argument(s)
            ListPagesRequest request = new ListPagesRequest
            {
                ParentAsFlowName = FlowName.FromProjectLocationAgentFlow("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]"),
                LanguageCode     = "",
            };
            // Make the request
            PagedEnumerable <ListPagesResponse, Page> response = pagesClient.ListPages(request);

            // Iterate over all response items, lazily performing RPCs as required
            foreach (Page item in response)
            {
                // Do something with each item
                Console.WriteLine(item);
            }

            // Or iterate over pages (of server-defined size), performing one RPC per page
            foreach (ListPagesResponse page in response.AsRawResponses())
            {
                // Do something with each page of items
                Console.WriteLine("A page of results:");
                foreach (Page item in page)
                {
                    // Do something with each item
                    Console.WriteLine(item);
                }
            }

            // Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
            int         pageSize   = 10;
            Page <Page> singlePage = response.ReadPage(pageSize);

            // Do something with the page of items
            Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
            foreach (Page item in singlePage)
            {
                // Do something with each item
                Console.WriteLine(item);
            }
            // Store the pageToken, for when the next page is required.
            string nextPageToken = singlePage.NextPageToken;
            // End snippet
        }
Beispiel #18
0
 /// <summary>Snippet for CreatePage</summary>
 public void CreatePageRequestObject()
 {
     // Snippet: CreatePage(CreatePageRequest, CallSettings)
     // Create client
     PagesClient pagesClient = PagesClient.Create();
     // Initialize request argument(s)
     CreatePageRequest request = new CreatePageRequest
     {
         ParentAsFlowName = FlowName.FromProjectLocationAgentFlow("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]"),
         Page             = new Page(),
         LanguageCode     = "",
     };
     // Make the request
     Page response = pagesClient.CreatePage(request);
     // End snippet
 }
Beispiel #19
0
        /// <summary>Snippet for DeleteFlow</summary>
        public void DeleteFlowRequestObject()
        {
            // Snippet: DeleteFlow(DeleteFlowRequest, CallSettings)
            // Create client
            FlowsClient flowsClient = FlowsClient.Create();
            // Initialize request argument(s)
            DeleteFlowRequest request = new DeleteFlowRequest
            {
                FlowName = FlowName.FromProjectLocationAgentFlow("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]"),
                Force    = false,
            };

            // Make the request
            flowsClient.DeleteFlow(request);
            // End snippet
        }
Beispiel #20
0
 /// <summary>Snippet for CreateTransitionRouteGroup</summary>
 public void CreateTransitionRouteGroupRequestObject()
 {
     // Snippet: CreateTransitionRouteGroup(CreateTransitionRouteGroupRequest, CallSettings)
     // Create client
     TransitionRouteGroupsClient transitionRouteGroupsClient = TransitionRouteGroupsClient.Create();
     // Initialize request argument(s)
     CreateTransitionRouteGroupRequest request = new CreateTransitionRouteGroupRequest
     {
         ParentAsFlowName     = FlowName.FromProjectLocationAgentFlow("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]"),
         TransitionRouteGroup = new TransitionRouteGroup(),
         LanguageCode         = "",
     };
     // Make the request
     TransitionRouteGroup response = transitionRouteGroupsClient.CreateTransitionRouteGroup(request);
     // End snippet
 }
Beispiel #21
0
        /// <summary>Snippet for ListVersionsAsync</summary>
        public async Task ListVersionsResourceNamesAsync()
        {
            // Snippet: ListVersionsAsync(FlowName, string, int?, CallSettings)
            // Create client
            VersionsClient versionsClient = await VersionsClient.CreateAsync();

            // Initialize request argument(s)
            FlowName parent = FlowName.FromProjectLocationAgentFlow("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]");
            // Make the request
            PagedAsyncEnumerable <ListVersionsResponse, gcdcv::Version> response = versionsClient.ListVersionsAsync(parent);

            // Iterate over all response items, lazily performing RPCs as required
            await response.ForEachAsync((gcdcv::Version item) =>
            {
                // Do something with each item
                Console.WriteLine(item);
            });

            // Or iterate over pages (of server-defined size), performing one RPC per page
            await response.AsRawResponses().ForEachAsync((ListVersionsResponse page) =>
            {
                // Do something with each page of items
                Console.WriteLine("A page of results:");
                foreach (gcdcv::Version item in page)
                {
                    // Do something with each item
                    Console.WriteLine(item);
                }
            });

            // Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
            int pageSize = 10;
            Page <gcdcv::Version> singlePage = await response.ReadPageAsync(pageSize);

            // Do something with the page of items
            Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
            foreach (gcdcv::Version item in singlePage)
            {
                // Do something with each item
                Console.WriteLine(item);
            }
            // Store the pageToken, for when the next page is required.
            string nextPageToken = singlePage.NextPageToken;
            // End snippet
        }
        public void DeleteFlowResourceNames()
        {
            moq::Mock <Flows.FlowsClient> mockGrpcClient = new moq::Mock <Flows.FlowsClient>(moq::MockBehavior.Strict);

            mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object);
            DeleteFlowRequest request = new DeleteFlowRequest
            {
                FlowName = FlowName.FromProjectLocationAgentFlow("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]"),
            };
            wkt::Empty expectedResponse = new wkt::Empty {
            };

            mockGrpcClient.Setup(x => x.DeleteFlow(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            FlowsClient client = new FlowsClientImpl(mockGrpcClient.Object, null);

            client.DeleteFlow(request.FlowName);
            mockGrpcClient.VerifyAll();
        }
Beispiel #23
0
        /// <summary>Snippet for DeleteFlowAsync</summary>
        public async Task DeleteFlowRequestObjectAsync()
        {
            // Snippet: DeleteFlowAsync(DeleteFlowRequest, CallSettings)
            // Additional: DeleteFlowAsync(DeleteFlowRequest, CancellationToken)
            // Create client
            FlowsClient flowsClient = await FlowsClient.CreateAsync();

            // Initialize request argument(s)
            DeleteFlowRequest request = new DeleteFlowRequest
            {
                FlowName = FlowName.FromProjectLocationAgentFlow("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]"),
                Force    = false,
            };
            // Make the request
            await flowsClient.DeleteFlowAsync(request);

            // End snippet
        }
Beispiel #24
0
        /// <summary>Snippet for ValidateFlowAsync</summary>
        public async Task ValidateFlowRequestObjectAsync()
        {
            // Snippet: ValidateFlowAsync(ValidateFlowRequest, CallSettings)
            // Additional: ValidateFlowAsync(ValidateFlowRequest, CancellationToken)
            // Create client
            FlowsClient flowsClient = await FlowsClient.CreateAsync();

            // Initialize request argument(s)
            ValidateFlowRequest request = new ValidateFlowRequest
            {
                FlowName     = FlowName.FromProjectLocationAgentFlow("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]"),
                LanguageCode = "",
            };
            // Make the request
            FlowValidationResult response = await flowsClient.ValidateFlowAsync(request);

            // End snippet
        }
Beispiel #25
0
        /// <summary>Snippet for ListTransitionRouteGroups</summary>
        public void ListTransitionRouteGroupsResourceNames()
        {
            // Snippet: ListTransitionRouteGroups(FlowName, string, int?, CallSettings)
            // Create client
            TransitionRouteGroupsClient transitionRouteGroupsClient = TransitionRouteGroupsClient.Create();
            // Initialize request argument(s)
            FlowName parent = FlowName.FromProjectLocationAgentFlow("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]");
            // Make the request
            PagedEnumerable <ListTransitionRouteGroupsResponse, TransitionRouteGroup> response = transitionRouteGroupsClient.ListTransitionRouteGroups(parent);

            // Iterate over all response items, lazily performing RPCs as required
            foreach (TransitionRouteGroup item in response)
            {
                // Do something with each item
                Console.WriteLine(item);
            }

            // Or iterate over pages (of server-defined size), performing one RPC per page
            foreach (ListTransitionRouteGroupsResponse page in response.AsRawResponses())
            {
                // Do something with each page of items
                Console.WriteLine("A page of results:");
                foreach (TransitionRouteGroup item in page)
                {
                    // Do something with each item
                    Console.WriteLine(item);
                }
            }

            // Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
            int pageSize = 10;
            Page <TransitionRouteGroup> singlePage = response.ReadPage(pageSize);

            // Do something with the page of items
            Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
            foreach (TransitionRouteGroup item in singlePage)
            {
                // Do something with each item
                Console.WriteLine(item);
            }
            // Store the pageToken, for when the next page is required.
            string nextPageToken = singlePage.NextPageToken;
            // End snippet
        }
Beispiel #26
0
        /// <summary>Snippet for CreateTransitionRouteGroupAsync</summary>
        public async Task CreateTransitionRouteGroupRequestObjectAsync()
        {
            // Snippet: CreateTransitionRouteGroupAsync(CreateTransitionRouteGroupRequest, CallSettings)
            // Additional: CreateTransitionRouteGroupAsync(CreateTransitionRouteGroupRequest, CancellationToken)
            // Create client
            TransitionRouteGroupsClient transitionRouteGroupsClient = await TransitionRouteGroupsClient.CreateAsync();

            // Initialize request argument(s)
            CreateTransitionRouteGroupRequest request = new CreateTransitionRouteGroupRequest
            {
                ParentAsFlowName     = FlowName.FromProjectLocationAgentFlow("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]"),
                TransitionRouteGroup = new TransitionRouteGroup(),
                LanguageCode         = "",
            };
            // Make the request
            TransitionRouteGroup response = await transitionRouteGroupsClient.CreateTransitionRouteGroupAsync(request);

            // End snippet
        }
        public async stt::Task DeleteFlowResourceNamesAsync()
        {
            moq::Mock <Flows.FlowsClient> mockGrpcClient = new moq::Mock <Flows.FlowsClient>(moq::MockBehavior.Strict);

            mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object);
            DeleteFlowRequest request = new DeleteFlowRequest
            {
                FlowName = FlowName.FromProjectLocationAgentFlow("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]"),
            };
            wkt::Empty expectedResponse = new wkt::Empty {
            };

            mockGrpcClient.Setup(x => x.DeleteFlowAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <wkt::Empty>(stt::Task.FromResult(expectedResponse), null, null, null, null));
            FlowsClient client = new FlowsClientImpl(mockGrpcClient.Object, null);
            await client.DeleteFlowAsync(request.FlowName, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None));

            await client.DeleteFlowAsync(request.FlowName, st::CancellationToken.None);

            mockGrpcClient.VerifyAll();
        }
Beispiel #28
0
        /// <summary>Snippet for ExportFlowAsync</summary>
        public async Task ExportFlowRequestObjectAsync()
        {
            // Snippet: ExportFlowAsync(ExportFlowRequest, CallSettings)
            // Additional: ExportFlowAsync(ExportFlowRequest, CancellationToken)
            // Create client
            FlowsClient flowsClient = await FlowsClient.CreateAsync();

            // Initialize request argument(s)
            ExportFlowRequest request = new ExportFlowRequest
            {
                FlowName = FlowName.FromProjectLocationAgentFlow("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]"),
                FlowUri  = "",
                IncludeReferencedFlows = false,
            };
            // Make the request
            Operation <ExportFlowResponse, Struct> response = await flowsClient.ExportFlowAsync(request);

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

            // Retrieve the operation result
            ExportFlowResponse 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 <ExportFlowResponse, Struct> retrievedResponse = await flowsClient.PollOnceExportFlowAsync(operationName);

            // Check if the retrieved long-running operation has completed
            if (retrievedResponse.IsCompleted)
            {
                // If it has completed, then access the result
                ExportFlowResponse retrievedResult = retrievedResponse.Result;
            }
            // End snippet
        }