Exemple #1
0
        /// <summary>Snippet for DeletePhoneNumberInstanceAsync</summary>
        public async Task DeletePhoneNumberInstanceResourceNamesAsync()
        {
            // Snippet: DeletePhoneNumberInstanceAsync(PhoneNumberInstanceName, CallSettings)
            // Additional: DeletePhoneNumberInstanceAsync(PhoneNumberInstanceName, CancellationToken)
            // Create client
            PhoneNumberInstancesClient phoneNumberInstancesClient = await PhoneNumberInstancesClient.CreateAsync();

            // Initialize request argument(s)
            PhoneNumberInstanceName name = PhoneNumberInstanceName.FromProjectPhoneNumberInstance("[PROJECT]", "[PHONE_NUMBER_INSTANCE]");
            // Make the request
            PhoneNumberInstance response = await phoneNumberInstancesClient.DeletePhoneNumberInstanceAsync(name);

            // End snippet
        }
Exemple #2
0
        /// <summary>Snippet for ListPhoneNumberInstancesAsync</summary>
        public async Task ListPhoneNumberInstancesRequestObjectAsync()
        {
            // Snippet: ListPhoneNumberInstancesAsync(ListPhoneNumberInstancesRequest, CallSettings)
            // Create client
            PhoneNumberInstancesClient phoneNumberInstancesClient = await PhoneNumberInstancesClient.CreateAsync();

            // Initialize request argument(s)
            ListPhoneNumberInstancesRequest request = new ListPhoneNumberInstancesRequest
            {
                ParentAsProjectName = ProjectName.FromProject("[PROJECT]"),
                Prefix         = "",
                IncludeDeleted = false,
            };
            // Make the request
            PagedAsyncEnumerable <ListPhoneNumberInstancesResponse, PhoneNumberInstance> response = phoneNumberInstancesClient.ListPhoneNumberInstancesAsync(request);

            // Iterate over all response items, lazily performing RPCs as required
            await response.ForEachAsync((PhoneNumberInstance 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((ListPhoneNumberInstancesResponse page) =>
            {
                // Do something with each page of items
                Console.WriteLine("A page of results:");
                foreach (PhoneNumberInstance 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 <PhoneNumberInstance> 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 (PhoneNumberInstance 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
        }
Exemple #3
0
        /// <summary>Snippet for DeletePhoneNumberInstanceAsync</summary>
        public async Task DeletePhoneNumberInstanceAsync()
        {
            // Snippet: DeletePhoneNumberInstanceAsync(string, CallSettings)
            // Additional: DeletePhoneNumberInstanceAsync(string, CancellationToken)
            // Create client
            PhoneNumberInstancesClient phoneNumberInstancesClient = await PhoneNumberInstancesClient.CreateAsync();

            // Initialize request argument(s)
            string name = "projects/[PROJECT]/phoneNumberInstances/[PHONE_NUMBER_INSTANCE]";
            // Make the request
            PhoneNumberInstance response = await phoneNumberInstancesClient.DeletePhoneNumberInstanceAsync(name);

            // End snippet
        }
Exemple #4
0
        /// <summary>Snippet for CreatePhoneNumberInstanceAsync</summary>
        public async Task CreatePhoneNumberInstanceAsync()
        {
            // Snippet: CreatePhoneNumberInstanceAsync(string, PhoneNumberInstance, CallSettings)
            // Additional: CreatePhoneNumberInstanceAsync(string, PhoneNumberInstance, CancellationToken)
            // Create client
            PhoneNumberInstancesClient phoneNumberInstancesClient = await PhoneNumberInstancesClient.CreateAsync();

            // Initialize request argument(s)
            string parent = "projects/[PROJECT]";
            PhoneNumberInstance phoneNumberInstance = new PhoneNumberInstance();
            // Make the request
            PhoneNumberInstance response = await phoneNumberInstancesClient.CreatePhoneNumberInstanceAsync(parent, phoneNumberInstance);

            // End snippet
        }
Exemple #5
0
        /// <summary>Snippet for CreatePhoneNumberInstanceAsync</summary>
        public async Task CreatePhoneNumberInstanceResourceNamesAsync()
        {
            // Snippet: CreatePhoneNumberInstanceAsync(ProjectName, PhoneNumberInstance, CallSettings)
            // Additional: CreatePhoneNumberInstanceAsync(ProjectName, PhoneNumberInstance, CancellationToken)
            // Create client
            PhoneNumberInstancesClient phoneNumberInstancesClient = await PhoneNumberInstancesClient.CreateAsync();

            // Initialize request argument(s)
            ProjectName         parent = ProjectName.FromProject("[PROJECT]");
            PhoneNumberInstance phoneNumberInstance = new PhoneNumberInstance();
            // Make the request
            PhoneNumberInstance response = await phoneNumberInstancesClient.CreatePhoneNumberInstanceAsync(parent, phoneNumberInstance);

            // End snippet
        }
Exemple #6
0
        /// <summary>Snippet for UpdatePhoneNumberInstanceAsync</summary>
        public async Task UpdatePhoneNumberInstanceResourceNamesAsync()
        {
            // Snippet: UpdatePhoneNumberInstanceAsync(PhoneNumberInstanceName, PhoneNumberInstance, FieldMask, CallSettings)
            // Additional: UpdatePhoneNumberInstanceAsync(PhoneNumberInstanceName, PhoneNumberInstance, FieldMask, CancellationToken)
            // Create client
            PhoneNumberInstancesClient phoneNumberInstancesClient = await PhoneNumberInstancesClient.CreateAsync();

            // Initialize request argument(s)
            PhoneNumberInstanceName name = PhoneNumberInstanceName.FromProjectPhoneNumberInstance("[PROJECT]", "[PHONE_NUMBER_INSTANCE]");
            PhoneNumberInstance     phoneNumberInstance = new PhoneNumberInstance();
            FieldMask updateMask = new FieldMask();
            // Make the request
            PhoneNumberInstance response = await phoneNumberInstancesClient.UpdatePhoneNumberInstanceAsync(name, phoneNumberInstance, updateMask);

            // End snippet
        }
Exemple #7
0
        /// <summary>Snippet for UpdatePhoneNumberInstanceAsync</summary>
        public async Task UpdatePhoneNumberInstanceAsync()
        {
            // Snippet: UpdatePhoneNumberInstanceAsync(string, PhoneNumberInstance, FieldMask, CallSettings)
            // Additional: UpdatePhoneNumberInstanceAsync(string, PhoneNumberInstance, FieldMask, CancellationToken)
            // Create client
            PhoneNumberInstancesClient phoneNumberInstancesClient = await PhoneNumberInstancesClient.CreateAsync();

            // Initialize request argument(s)
            string name = "projects/[PROJECT]/phoneNumberInstances/[PHONE_NUMBER_INSTANCE]";
            PhoneNumberInstance phoneNumberInstance = new PhoneNumberInstance();
            FieldMask           updateMask          = new FieldMask();
            // Make the request
            PhoneNumberInstance response = await phoneNumberInstancesClient.UpdatePhoneNumberInstanceAsync(name, phoneNumberInstance, updateMask);

            // End snippet
        }
Exemple #8
0
        /// <summary>Snippet for GetPhoneNumberInstanceAsync</summary>
        public async Task GetPhoneNumberInstanceRequestObjectAsync()
        {
            // Snippet: GetPhoneNumberInstanceAsync(GetPhoneNumberInstanceRequest, CallSettings)
            // Additional: GetPhoneNumberInstanceAsync(GetPhoneNumberInstanceRequest, CancellationToken)
            // Create client
            PhoneNumberInstancesClient phoneNumberInstancesClient = await PhoneNumberInstancesClient.CreateAsync();

            // Initialize request argument(s)
            GetPhoneNumberInstanceRequest request = new GetPhoneNumberInstanceRequest
            {
                PhoneNumberInstanceName = PhoneNumberInstanceName.FromProjectPhoneNumberInstance("[PROJECT]", "[PHONE_NUMBER_INSTANCE]"),
            };
            // Make the request
            PhoneNumberInstance response = await phoneNumberInstancesClient.GetPhoneNumberInstanceAsync(request);

            // End snippet
        }
Exemple #9
0
        /// <summary>Snippet for CreatePhoneNumberInstanceAsync</summary>
        public async Task CreatePhoneNumberInstanceRequestObjectAsync()
        {
            // Snippet: CreatePhoneNumberInstanceAsync(CreatePhoneNumberInstanceRequest, CallSettings)
            // Additional: CreatePhoneNumberInstanceAsync(CreatePhoneNumberInstanceRequest, CancellationToken)
            // Create client
            PhoneNumberInstancesClient phoneNumberInstancesClient = await PhoneNumberInstancesClient.CreateAsync();

            // Initialize request argument(s)
            CreatePhoneNumberInstanceRequest request = new CreatePhoneNumberInstanceRequest
            {
                ParentAsProjectName = ProjectName.FromProject("[PROJECT]"),
                PhoneNumberInstance = new PhoneNumberInstance(),
            };
            // Make the request
            PhoneNumberInstance response = await phoneNumberInstancesClient.CreatePhoneNumberInstanceAsync(request);

            // End snippet
        }