コード例 #1
0
        /// <summary>Snippet for DeleteAllContextsAsync</summary>
        public async Task DeleteAllContextsAsync()
        {
            // Snippet: DeleteAllContextsAsync(string, CallSettings)
            // Additional: DeleteAllContextsAsync(string, CancellationToken)
            // Create client
            ContextsClient contextsClient = await ContextsClient.CreateAsync();

            // Initialize request argument(s)
            string parent = "projects/[PROJECT]/agent/sessions/[SESSION]";
            // Make the request
            await contextsClient.DeleteAllContextsAsync(parent);

            // End snippet
        }
コード例 #2
0
        /// <summary>Snippet for DeleteAllContextsAsync</summary>
        public async Task DeleteAllContextsResourceNamesAsync()
        {
            // Snippet: DeleteAllContextsAsync(SessionName, CallSettings)
            // Additional: DeleteAllContextsAsync(SessionName, CancellationToken)
            // Create client
            ContextsClient contextsClient = await ContextsClient.CreateAsync();

            // Initialize request argument(s)
            SessionName parent = SessionName.FromProjectSession("[PROJECT]", "[SESSION]");
            // Make the request
            await contextsClient.DeleteAllContextsAsync(parent);

            // End snippet
        }
コード例 #3
0
        /// <summary>Snippet for DeleteContextAsync</summary>
        public async Task DeleteContextResourceNamesAsync()
        {
            // Snippet: DeleteContextAsync(ContextName, CallSettings)
            // Additional: DeleteContextAsync(ContextName, CancellationToken)
            // Create client
            ContextsClient contextsClient = await ContextsClient.CreateAsync();

            // Initialize request argument(s)
            ContextName name = ContextName.FromProjectSessionContext("[PROJECT]", "[SESSION]", "[CONTEXT]");
            // Make the request
            await contextsClient.DeleteContextAsync(name);

            // End snippet
        }
コード例 #4
0
        /// <summary>Snippet for UpdateContextAsync</summary>
        public async Task UpdateContextAsync()
        {
            // Snippet: UpdateContextAsync(Context,CallSettings)
            // Additional: UpdateContextAsync(Context,CancellationToken)
            // Create client
            ContextsClient contextsClient = await ContextsClient.CreateAsync();

            // Initialize request argument(s)
            Context context = new Context();
            // Make the request
            Context response = await contextsClient.UpdateContextAsync(context);

            // End snippet
        }
コード例 #5
0
        /// <summary>Snippet for GetContextAsync</summary>
        public async Task GetContextAsync()
        {
            // Snippet: GetContextAsync(string, CallSettings)
            // Additional: GetContextAsync(string, CancellationToken)
            // Create client
            ContextsClient contextsClient = await ContextsClient.CreateAsync();

            // Initialize request argument(s)
            string name = "projects/[PROJECT]/agent/sessions/[SESSION]/contexts/[CONTEXT]";
            // Make the request
            Context response = await contextsClient.GetContextAsync(name);

            // End snippet
        }
コード例 #6
0
        /// <summary>Snippet for GetContextAsync</summary>
        public async Task GetContextAsync()
        {
            // Snippet: GetContextAsync(ContextName,CallSettings)
            // Additional: GetContextAsync(ContextName,CancellationToken)
            // Create client
            ContextsClient contextsClient = await ContextsClient.CreateAsync();

            // Initialize request argument(s)
            ContextName name = new ContextName("[PROJECT]", "[SESSION]", "[CONTEXT]");
            // Make the request
            Context response = await contextsClient.GetContextAsync(name);

            // End snippet
        }
コード例 #7
0
        /// <summary>Snippet for CreateContextAsync</summary>
        public async Task CreateContextResourceNamesAsync()
        {
            // Snippet: CreateContextAsync(SessionName, Context, CallSettings)
            // Additional: CreateContextAsync(SessionName, Context, CancellationToken)
            // Create client
            ContextsClient contextsClient = await ContextsClient.CreateAsync();

            // Initialize request argument(s)
            SessionName parent  = SessionName.FromProjectSession("[PROJECT]", "[SESSION]");
            Context     context = new Context();
            // Make the request
            Context response = await contextsClient.CreateContextAsync(parent, context);

            // End snippet
        }
コード例 #8
0
        /// <summary>Snippet for CreateContextAsync</summary>
        public async Task CreateContextAsync()
        {
            // Snippet: CreateContextAsync(string, Context, CallSettings)
            // Additional: CreateContextAsync(string, Context, CancellationToken)
            // Create client
            ContextsClient contextsClient = await ContextsClient.CreateAsync();

            // Initialize request argument(s)
            string  parent  = "projects/[PROJECT]/agent/sessions/[SESSION]";
            Context context = new Context();
            // Make the request
            Context response = await contextsClient.CreateContextAsync(parent, context);

            // End snippet
        }
コード例 #9
0
        /// <summary>Snippet for ListContexts</summary>
        public async Task ListContextsRequestObjectAsync()
        {
            // Snippet: ListContextsAsync(ListContextsRequest, CallSettings)
            // Create client
            ContextsClient contextsClient = await ContextsClient.CreateAsync();

            // Initialize request argument(s)
            ListContextsRequest request = new ListContextsRequest
            {
                ParentAsSessionName = SessionName.FromProjectSession("[PROJECT]", "[SESSION]"),
            };
            // Make the request
            PagedAsyncEnumerable <ListContextsResponse, Context> response = contextsClient.ListContextsAsync(request);

            // Iterate over all response items, lazily performing RPCs as required
            await response.ForEachAsync((Context 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((ListContextsResponse page) =>
            {
                // Do something with each page of items
                Console.WriteLine("A page of results:");
                foreach (Context 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 <Context> 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 (Context 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
        }
コード例 #10
0
        /// <summary>Snippet for DeleteAllContextsAsync</summary>
        public async Task DeleteAllContextsRequestObjectAsync()
        {
            // Snippet: DeleteAllContextsAsync(DeleteAllContextsRequest, CallSettings)
            // Additional: DeleteAllContextsAsync(DeleteAllContextsRequest, CancellationToken)
            // Create client
            ContextsClient contextsClient = await ContextsClient.CreateAsync();

            // Initialize request argument(s)
            DeleteAllContextsRequest request = new DeleteAllContextsRequest {
                Parent = "",
            };
            // Make the request
            await contextsClient.DeleteAllContextsAsync(request);

            // End snippet
        }
コード例 #11
0
        /// <summary>Snippet for DeleteAllContextsAsync</summary>
        public async Task DeleteAllContextsRequestObjectAsync()
        {
            // Snippet: DeleteAllContextsAsync(DeleteAllContextsRequest, CallSettings)
            // Additional: DeleteAllContextsAsync(DeleteAllContextsRequest, CancellationToken)
            // Create client
            ContextsClient contextsClient = await ContextsClient.CreateAsync();

            // Initialize request argument(s)
            DeleteAllContextsRequest request = new DeleteAllContextsRequest
            {
                ParentAsSessionName = SessionName.FromProjectSession("[PROJECT]", "[SESSION]"),
            };
            // Make the request
            await contextsClient.DeleteAllContextsAsync(request);

            // End snippet
        }
コード例 #12
0
        /// <summary>Snippet for GetContextAsync</summary>
        public async Task GetContextRequestObjectAsync()
        {
            // Snippet: GetContextAsync(GetContextRequest, CallSettings)
            // Additional: GetContextAsync(GetContextRequest, CancellationToken)
            // Create client
            ContextsClient contextsClient = await ContextsClient.CreateAsync();

            // Initialize request argument(s)
            GetContextRequest request = new GetContextRequest
            {
                ContextName = ContextName.FromProjectSessionContext("[PROJECT]", "[SESSION]", "[CONTEXT]"),
            };
            // Make the request
            Context response = await contextsClient.GetContextAsync(request);

            // End snippet
        }
コード例 #13
0
        /// <summary>Snippet for DeleteContextAsync</summary>
        public async Task DeleteContextAsync_RequestObject()
        {
            // Snippet: DeleteContextAsync(DeleteContextRequest,CallSettings)
            // Additional: DeleteContextAsync(DeleteContextRequest,CancellationToken)
            // Create client
            ContextsClient contextsClient = await ContextsClient.CreateAsync();

            // Initialize request argument(s)
            DeleteContextRequest request = new DeleteContextRequest
            {
                ContextName = new ContextName("[PROJECT]", "[SESSION]", "[CONTEXT]"),
            };
            // Make the request
            await contextsClient.DeleteContextAsync(request);

            // End snippet
        }
コード例 #14
0
        /// <summary>Snippet for UpdateContextAsync</summary>
        public async Task UpdateContextRequestObjectAsync()
        {
            // Snippet: UpdateContextAsync(UpdateContextRequest, CallSettings)
            // Additional: UpdateContextAsync(UpdateContextRequest, CancellationToken)
            // Create client
            ContextsClient contextsClient = await ContextsClient.CreateAsync();

            // Initialize request argument(s)
            UpdateContextRequest request = new UpdateContextRequest
            {
                Context    = new Context(),
                UpdateMask = new FieldMask(),
            };
            // Make the request
            Context response = await contextsClient.UpdateContextAsync(request);

            // End snippet
        }
コード例 #15
0
        /// <summary>Snippet for CreateContextAsync</summary>
        public async Task CreateContextRequestObjectAsync()
        {
            // Snippet: CreateContextAsync(CreateContextRequest, CallSettings)
            // Additional: CreateContextAsync(CreateContextRequest, CancellationToken)
            // Create client
            ContextsClient contextsClient = await ContextsClient.CreateAsync();

            // Initialize request argument(s)
            CreateContextRequest request = new CreateContextRequest
            {
                ParentAsSessionName = SessionName.FromProjectSession("[PROJECT]", "[SESSION]"),
                Context             = new Context(),
            };
            // Make the request
            Context response = await contextsClient.CreateContextAsync(request);

            // End snippet
        }
コード例 #16
0
        /// <summary>Snippet for CreateContextAsync</summary>
        public async Task CreateContextRequestObjectAsync()
        {
            // Snippet: CreateContextAsync(CreateContextRequest, CallSettings)
            // Additional: CreateContextAsync(CreateContextRequest, CancellationToken)
            // Create client
            ContextsClient contextsClient = await ContextsClient.CreateAsync();

            // Initialize request argument(s)
            CreateContextRequest request = new CreateContextRequest
            {
                Parent  = "",
                Context = new Context(),
            };
            // Make the request
            Context response = await contextsClient.CreateContextAsync(request);

            // End snippet
        }