示例#1
0
        /// <summary>Snippet for DeleteUnsubscriberAsync</summary>
        public async Task DeleteUnsubscriberResourceNamesAsync()
        {
            // Snippet: DeleteUnsubscriberAsync(UnsubscriberName, CallSettings)
            // Additional: DeleteUnsubscriberAsync(UnsubscriberName, CancellationToken)
            // Create client
            UnsubscribersClient unsubscribersClient = await UnsubscribersClient.CreateAsync();

            // Initialize request argument(s)
            UnsubscriberName name = UnsubscriberName.FromProjectUnsubscriber("[PROJECT]", "[UNSUBSCRIBER]");
            // Make the request
            Unsubscriber response = await unsubscribersClient.DeleteUnsubscriberAsync(name);

            // End snippet
        }
示例#2
0
        /// <summary>Snippet for DeleteUnsubscriberAsync</summary>
        public async Task DeleteUnsubscriberAsync()
        {
            // Snippet: DeleteUnsubscriberAsync(string, CallSettings)
            // Additional: DeleteUnsubscriberAsync(string, CancellationToken)
            // Create client
            UnsubscribersClient unsubscribersClient = await UnsubscribersClient.CreateAsync();

            // Initialize request argument(s)
            string name = "projects/[PROJECT]/unsubscribers/[UNSUBSCRIBER]";
            // Make the request
            Unsubscriber response = await unsubscribersClient.DeleteUnsubscriberAsync(name);

            // End snippet
        }
示例#3
0
        /// <summary>Snippet for ListUnsubscribersAsync</summary>
        public async Task ListUnsubscribersRequestObjectAsync()
        {
            // Snippet: ListUnsubscribersAsync(ListUnsubscribersRequest, CallSettings)
            // Create client
            UnsubscribersClient unsubscribersClient = await UnsubscribersClient.CreateAsync();

            // Initialize request argument(s)
            ListUnsubscribersRequest request = new ListUnsubscribersRequest
            {
                ParentAsProjectName = ProjectName.FromProject("[PROJECT]"),
                Phone = "",
            };
            // Make the request
            PagedAsyncEnumerable <ListUnsubscribersResponse, Unsubscriber> response = unsubscribersClient.ListUnsubscribersAsync(request);

            // Iterate over all response items, lazily performing RPCs as required
            await response.ForEachAsync((Unsubscriber 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((ListUnsubscribersResponse page) =>
            {
                // Do something with each page of items
                Console.WriteLine("A page of results:");
                foreach (Unsubscriber 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 <Unsubscriber> 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 (Unsubscriber 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
        }
示例#4
0
        /// <summary>Snippet for CreateUnsubscriberAsync</summary>
        public async Task CreateUnsubscriberAsync()
        {
            // Snippet: CreateUnsubscriberAsync(string, Unsubscriber, CallSettings)
            // Additional: CreateUnsubscriberAsync(string, Unsubscriber, CancellationToken)
            // Create client
            UnsubscribersClient unsubscribersClient = await UnsubscribersClient.CreateAsync();

            // Initialize request argument(s)
            string       parent       = "projects/[PROJECT]";
            Unsubscriber unsubscriber = new Unsubscriber();
            // Make the request
            Unsubscriber response = await unsubscribersClient.CreateUnsubscriberAsync(parent, unsubscriber);

            // End snippet
        }
示例#5
0
        /// <summary>Snippet for UpdateUnsubscriberAsync</summary>
        public async Task UpdateUnsubscriberAsync()
        {
            // Snippet: UpdateUnsubscriberAsync(Unsubscriber, FieldMask, CallSettings)
            // Additional: UpdateUnsubscriberAsync(Unsubscriber, FieldMask, CancellationToken)
            // Create client
            UnsubscribersClient unsubscribersClient = await UnsubscribersClient.CreateAsync();

            // Initialize request argument(s)
            Unsubscriber unsubscriber = new Unsubscriber();
            FieldMask    updateMask   = new FieldMask();
            // Make the request
            Unsubscriber response = await unsubscribersClient.UpdateUnsubscriberAsync(unsubscriber, updateMask);

            // End snippet
        }
示例#6
0
        /// <summary>Snippet for CreateUnsubscriberAsync</summary>
        public async Task CreateUnsubscriberResourceNamesAsync()
        {
            // Snippet: CreateUnsubscriberAsync(ProjectName, Unsubscriber, CallSettings)
            // Additional: CreateUnsubscriberAsync(ProjectName, Unsubscriber, CancellationToken)
            // Create client
            UnsubscribersClient unsubscribersClient = await UnsubscribersClient.CreateAsync();

            // Initialize request argument(s)
            ProjectName  parent       = ProjectName.FromProject("[PROJECT]");
            Unsubscriber unsubscriber = new Unsubscriber();
            // Make the request
            Unsubscriber response = await unsubscribersClient.CreateUnsubscriberAsync(parent, unsubscriber);

            // End snippet
        }
示例#7
0
        /// <summary>Snippet for GetUnsubscriberAsync</summary>
        public async Task GetUnsubscriberRequestObjectAsync()
        {
            // Snippet: GetUnsubscriberAsync(GetUnsubscriberRequest, CallSettings)
            // Additional: GetUnsubscriberAsync(GetUnsubscriberRequest, CancellationToken)
            // Create client
            UnsubscribersClient unsubscribersClient = await UnsubscribersClient.CreateAsync();

            // Initialize request argument(s)
            GetUnsubscriberRequest request = new GetUnsubscriberRequest
            {
                UnsubscriberName = UnsubscriberName.FromProjectUnsubscriber("[PROJECT]", "[UNSUBSCRIBER]"),
            };
            // Make the request
            Unsubscriber response = await unsubscribersClient.GetUnsubscriberAsync(request);

            // End snippet
        }
示例#8
0
        /// <summary>Snippet for UpdateUnsubscriberAsync</summary>
        public async Task UpdateUnsubscriberRequestObjectAsync()
        {
            // Snippet: UpdateUnsubscriberAsync(UpdateUnsubscriberRequest, CallSettings)
            // Additional: UpdateUnsubscriberAsync(UpdateUnsubscriberRequest, CancellationToken)
            // Create client
            UnsubscribersClient unsubscribersClient = await UnsubscribersClient.CreateAsync();

            // Initialize request argument(s)
            UpdateUnsubscriberRequest request = new UpdateUnsubscriberRequest
            {
                Unsubscriber = new Unsubscriber(),
                UpdateMask   = new FieldMask(),
            };
            // Make the request
            Unsubscriber response = await unsubscribersClient.UpdateUnsubscriberAsync(request);

            // End snippet
        }
示例#9
0
        /// <summary>Snippet for CreateUnsubscriberAsync</summary>
        public async Task CreateUnsubscriberRequestObjectAsync()
        {
            // Snippet: CreateUnsubscriberAsync(CreateUnsubscriberRequest, CallSettings)
            // Additional: CreateUnsubscriberAsync(CreateUnsubscriberRequest, CancellationToken)
            // Create client
            UnsubscribersClient unsubscribersClient = await UnsubscribersClient.CreateAsync();

            // Initialize request argument(s)
            CreateUnsubscriberRequest request = new CreateUnsubscriberRequest
            {
                ParentAsProjectName = ProjectName.FromProject("[PROJECT]"),
                Unsubscriber        = new Unsubscriber(),
            };
            // Make the request
            Unsubscriber response = await unsubscribersClient.CreateUnsubscriberAsync(request);

            // End snippet
        }