示例#1
0
        public static void TestGetAddressPerCountryAndZipCode()
        {
            Console.WriteLine("## TestGetAddressPerCountryAndZipCode");
            IAddressesClient client = new AddressesClient("https://api.mundipagg.com/maps/v1.0");

            try
            {
                var result = client.GetAddressPerCountryAndZipCode(CountryEnum.BR, "20740321");

                if (result.Data != null)
                {
                    Console.WriteLine("Street: {0}", result.Data.Street);
                    Console.WriteLine("District: {0}", result.Data.District);
                    Console.WriteLine("City: {0}", result.Data.City);
                    Console.WriteLine("Country: {0}", result.Data.Country);
                    Console.WriteLine("State: {0}", result.Data.State);
                    Console.WriteLine("ZipCode: {0}", result.Data.ZipCode);

                    foreach (var item in result.Data.Metadata)
                    {
                        Console.WriteLine("{0}: {1}", item.Key, item.Value);
                    }
                    Console.WriteLine();
                }
                else
                {
                    Console.WriteLine("Não foi possível obter resultados!");
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("-- Exception!");
                Console.WriteLine(ex.Message);
            }
        }
示例#2
0
        /// <summary>Snippet for Delete</summary>
        public void Delete()
        {
            // Snippet: Delete(string, string, string, CallSettings)
            // Create client
            AddressesClient addressesClient = AddressesClient.Create();
            // Initialize request argument(s)
            string project = "";
            string region  = "";
            string address = "";
            // Make the request
            lro::Operation <Operation, Operation> response = addressesClient.Delete(project, region, address);

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

            // Check if the retrieved long-running operation has completed
            if (retrievedResponse.IsCompleted)
            {
                // If it has completed, then access the result
                Operation retrievedResult = retrievedResponse.Result;
            }
            // End snippet
        }
示例#3
0
        public static void TestListAllCitiesPerState()
        {
            Console.WriteLine("## TestListAllCitiesPerState");
            IAddressesClient client = new AddressesClient("https://api.mundipagg.com/maps/v1.0");

            try
            {
                var result = client.ListAllCitiesPerState(CountryEnum.BR, "RJ");

                if (result.Data != null)
                {
                    result.Data.Cities.ForEach(citie => Console.WriteLine(citie));
                    Console.WriteLine();
                }
                else
                {
                    Console.WriteLine("Não foi possível obter resultados!");
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("-- Exception!");
                Console.WriteLine(ex.Message);
            }
        }
示例#4
0
        /// <summary>Snippet for Insert</summary>
        public void InsertRequestObject()
        {
            // Snippet: Insert(InsertAddressRequest, CallSettings)
            // Create client
            AddressesClient addressesClient = AddressesClient.Create();
            // Initialize request argument(s)
            InsertAddressRequest request = new InsertAddressRequest
            {
                RequestId       = "",
                Region          = "",
                Project         = "",
                AddressResource = new Address(),
            };
            // Make the request
            lro::Operation <Operation, Operation> response = addressesClient.Insert(request);

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

            // Check if the retrieved long-running operation has completed
            if (retrievedResponse.IsCompleted)
            {
                // If it has completed, then access the result
                Operation retrievedResult = retrievedResponse.Result;
            }
            // End snippet
        }
示例#5
0
        /// <summary>Snippet for InsertAsync</summary>
        public async Task InsertAsync()
        {
            // Snippet: InsertAsync(string, string, Address, CallSettings)
            // Additional: InsertAsync(string, string, Address, CancellationToken)
            // Create client
            AddressesClient addressesClient = await AddressesClient.CreateAsync();

            // Initialize request argument(s)
            string  project         = "";
            string  region          = "";
            Address addressResource = new Address();
            // Make the request
            lro::Operation <Operation, Operation> response = await addressesClient.InsertAsync(project, region, addressResource);

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

            // Retrieve the operation result
            Operation 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
            lro::Operation <Operation, Operation> retrievedResponse = await addressesClient.PollOnceInsertAsync(operationName);

            // Check if the retrieved long-running operation has completed
            if (retrievedResponse.IsCompleted)
            {
                // If it has completed, then access the result
                Operation retrievedResult = retrievedResponse.Result;
            }
            // End snippet
        }
示例#6
0
        public static void TestListAllDistrictsPerCity()
        {
            Console.WriteLine("## TestListAllDistrictsPerCity");
            IAddressesClient client = new AddressesClient("https://api.mundipagg.com/maps/v1.0");

            try
            {
                var result = client.ListAllDistrictsPerCity(CountryEnum.BR, "RJ", "Rio de Janeiro");

                if (result.Data != null)
                {
                    result.Data.Districts.ForEach(districts => Console.WriteLine(districts));
                    Console.WriteLine();
                }
                else
                {
                    Console.WriteLine("Não foi possível obter resultados!");
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("-- Exception!");
                Console.WriteLine(ex.Message);
            }
        }
示例#7
0
 /// <summary>Snippet for AggregatedList</summary>
 public void AggregatedList()
 {
     // Snippet: AggregatedList(string, CallSettings)
     // Create client
     AddressesClient addressesClient = AddressesClient.Create();
     // Initialize request argument(s)
     string project = "";
     // Make the request
     AddressAggregatedList response = addressesClient.AggregatedList(project);
     // End snippet
 }
示例#8
0
        public static void TestSearchAddresses()
        {
            Console.WriteLine("## TestSearchAddresses");
            IAddressesClient client = new AddressesClient("https://api.mundipagg.com/maps/v1.0");

            try
            {
                var request = new SearchAddressesRequest()
                {
                    Page    = 1,
                    Size    = 10,
                    Country = CountryEnum.BR,
                    State   = "RJ",
                    City    = "Rio de Janeiro",
                    Street  = "Rua Clarimundo de Melo"
                };

                var result = client.SearchAddresses(request);

                if (result.Data != null)
                {
                    result.Data.Data.ForEach(address =>
                    {
                        Console.WriteLine("Street: {0}", address.Street);
                        Console.WriteLine("District: {0}", address.District);
                        Console.WriteLine("City: {0}", address.City);
                        Console.WriteLine("Country: {0}", address.Country);
                        Console.WriteLine("State: {0}", address.State);
                        Console.WriteLine("ZipCode: {0}", address.ZipCode);

                        foreach (var item in address.Metadata)
                        {
                            Console.WriteLine("{0}: {1}", item.Key, item.Value);
                        }
                        Console.WriteLine();
                    });

                    Console.WriteLine("Pages: {0}", result.Data.Paging.Pages);
                    Console.WriteLine("FirstItem: {0}", result.Data.Paging.FirstItem);
                    Console.WriteLine("LastItem: {0}", result.Data.Paging.LastItem);
                    Console.WriteLine("TotalItems: {0}", result.Data.Paging.TotalItems);
                    Console.WriteLine();
                }
                else
                {
                    Console.WriteLine("Não foi possível obter resultados!");
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("-- Exception!");
                Console.WriteLine(ex.Message);
            }
        }
        /// <summary>Snippet for AggregatedListAsync</summary>
        public async Task AggregatedListRequestObjectAsync()
        {
            // Snippet: AggregatedListAsync(AggregatedListAddressesRequest, CallSettings)
            // Create client
            AddressesClient addressesClient = await AddressesClient.CreateAsync();

            // Initialize request argument(s)
            AggregatedListAddressesRequest request = new AggregatedListAddressesRequest
            {
                OrderBy              = "",
                Project              = "",
                Filter               = "",
                IncludeAllScopes     = false,
                ReturnPartialSuccess = false,
            };
            // Make the request
            PagedAsyncEnumerable <AddressAggregatedList, KeyValuePair <string, AddressesScopedList> > response = addressesClient.AggregatedListAsync(request);

            // Iterate over all response items, lazily performing RPCs as required
            await response.ForEachAsync((KeyValuePair <string, AddressesScopedList> 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((AddressAggregatedList page) =>
            {
                // Do something with each page of items
                Console.WriteLine("A page of results:");
                foreach (KeyValuePair <string, AddressesScopedList> 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 <KeyValuePair <string, AddressesScopedList> > 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 (KeyValuePair <string, AddressesScopedList> 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
        }
 /// <summary>Snippet for Insert</summary>
 public void Insert()
 {
     // Snippet: Insert(string, string, Address, CallSettings)
     // Create client
     AddressesClient addressesClient = AddressesClient.Create();
     // Initialize request argument(s)
     string  project         = "";
     string  region          = "";
     Address addressResource = new Address();
     // Make the request
     Operation response = addressesClient.Insert(project, region, addressResource);
     // End snippet
 }
 /// <summary>Snippet for Get</summary>
 public void Get()
 {
     // Snippet: Get(string, string, string, CallSettings)
     // Create client
     AddressesClient addressesClient = AddressesClient.Create();
     // Initialize request argument(s)
     string project = "";
     string region  = "";
     string address = "";
     // Make the request
     Address response = addressesClient.Get(project, region, address);
     // End snippet
 }
        /// <summary>Snippet for List</summary>
        public void ListRequestObject()
        {
            // Snippet: List(ListAddressesRequest, CallSettings)
            // Create client
            AddressesClient addressesClient = AddressesClient.Create();
            // Initialize request argument(s)
            ListAddressesRequest request = new ListAddressesRequest
            {
                Region  = "",
                OrderBy = "",
                Project = "",
                Filter  = "",
                ReturnPartialSuccess = false,
            };
            // Make the request
            PagedEnumerable <AddressList, Address> response = addressesClient.List(request);

            // Iterate over all response items, lazily performing RPCs as required
            foreach (Address 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 (AddressList page in response.AsRawResponses())
            {
                // Do something with each page of items
                Console.WriteLine("A page of results:");
                foreach (Address 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 <Address> 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 (Address 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
        }
示例#13
0
        /// <summary>Snippet for AggregatedListAsync</summary>
        public async Task AggregatedListAsync()
        {
            // Snippet: AggregatedListAsync(string, CallSettings)
            // Additional: AggregatedListAsync(string, CancellationToken)
            // Create client
            AddressesClient addressesClient = await AddressesClient.CreateAsync();

            // Initialize request argument(s)
            string project = "";
            // Make the request
            AddressAggregatedList response = await addressesClient.AggregatedListAsync(project);

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

            // Initialize request argument(s)
            string project = "";
            string region  = "";
            string address = "";
            // Make the request
            Address response = await addressesClient.GetAsync(project, region, address);

            // End snippet
        }
 /// <summary>Snippet for Get</summary>
 public void GetRequestObject()
 {
     // Snippet: Get(GetAddressRequest, CallSettings)
     // Create client
     AddressesClient addressesClient = AddressesClient.Create();
     // Initialize request argument(s)
     GetAddressRequest request = new GetAddressRequest
     {
         Region  = "",
         Project = "",
         Address = "",
     };
     // Make the request
     Address response = addressesClient.Get(request);
     // End snippet
 }
        /// <summary>Snippet for InsertAsync</summary>
        public async Task InsertAsync()
        {
            // Snippet: InsertAsync(string, string, Address, CallSettings)
            // Additional: InsertAsync(string, string, Address, CancellationToken)
            // Create client
            AddressesClient addressesClient = await AddressesClient.CreateAsync();

            // Initialize request argument(s)
            string  project         = "";
            string  region          = "";
            Address addressResource = new Address();
            // Make the request
            Operation response = await addressesClient.InsertAsync(project, region, addressResource);

            // End snippet
        }
示例#17
0
        public ViagogoClient(
            ProductHeaderValue product,
            IGogoKitConfiguration configuration,
            IOAuth2TokenStore tokenStore,
            IJsonSerializer serializer,
            IHttpConnection oauthConnection,
            IHttpConnection apiConnection)
        {
            Requires.ArgumentNotNull(product, nameof(product));
            Requires.ArgumentNotNull(configuration, nameof(configuration));
            Requires.ArgumentNotNull(tokenStore, nameof(tokenStore));
            Requires.ArgumentNotNull(serializer, nameof(serializer));
            Requires.ArgumentNotNull(oauthConnection, nameof(oauthConnection));
            Requires.ArgumentNotNull(apiConnection, nameof(apiConnection));

            var halKitConfiguration = new HalKitConfiguration(configuration.ViagogoApiRootEndpoint)
            {
                CaptureSynchronizationContext = configuration.CaptureSynchronizationContext
            };

            Configuration = configuration;
            TokenStore    = tokenStore;
            Hypermedia    = new HalClient(halKitConfiguration, apiConnection);
            var linkFactory = new LinkFactory(configuration);

            OAuth2         = new OAuth2Client(oauthConnection, configuration);
            User           = new UserClient(Hypermedia);
            Search         = new SearchClient(Hypermedia);
            Addresses      = new AddressesClient(User, Hypermedia, linkFactory);
            Purchases      = new PurchasesClient(User, Hypermedia, linkFactory);
            Sales          = new SalesClient(Hypermedia, linkFactory);
            Shipments      = new ShipmentsClient(Hypermedia, linkFactory);
            PaymentMethods = new PaymentMethodsClient(User, Hypermedia, linkFactory);
            Countries      = new CountriesClient(Hypermedia, linkFactory);
            Currencies     = new CurrenciesClient(Hypermedia, linkFactory);
            Categories     = new CategoriesClient(Hypermedia, linkFactory);
            Events         = new EventsClient(Hypermedia);
            Listings       = new ListingsClient(Hypermedia);
            Venues         = new VenuesClient(Hypermedia);
            SellerListings = new SellerListingsClient(Hypermedia, linkFactory);
            Webhooks       = new WebhooksClient(Hypermedia, linkFactory);

            BatchClient = new BatchClient(apiConnection,
                                          new ApiResponseFactory(serializer, halKitConfiguration),
                                          serializer,
                                          new LinkResolver());
        }
 /// <summary>Snippet for Insert</summary>
 public void InsertRequestObject()
 {
     // Snippet: Insert(InsertAddressRequest, CallSettings)
     // Create client
     AddressesClient addressesClient = AddressesClient.Create();
     // Initialize request argument(s)
     InsertAddressRequest request = new InsertAddressRequest
     {
         RequestId       = "",
         Region          = "",
         Project         = "",
         AddressResource = new Address(),
     };
     // Make the request
     Operation response = addressesClient.Insert(request);
     // End snippet
 }
 /// <summary>Snippet for Delete</summary>
 public void DeleteRequestObject()
 {
     // Snippet: Delete(DeleteAddressRequest, CallSettings)
     // Create client
     AddressesClient addressesClient = AddressesClient.Create();
     // Initialize request argument(s)
     DeleteAddressRequest request = new DeleteAddressRequest
     {
         RequestId = "",
         Region    = "",
         Project   = "",
         Address   = "",
     };
     // Make the request
     Operation response = addressesClient.Delete(request);
     // End snippet
 }
        /// <summary>Snippet for ListAsync</summary>
        public async Task ListAsync()
        {
            // Snippet: ListAsync(string, string, string, int?, CallSettings)
            // Create client
            AddressesClient addressesClient = await AddressesClient.CreateAsync();

            // Initialize request argument(s)
            string project = "";
            string region  = "";
            // Make the request
            PagedAsyncEnumerable <AddressList, Address> response = addressesClient.ListAsync(project, region);

            // Iterate over all response items, lazily performing RPCs as required
            await response.ForEachAsync((Address 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((AddressList page) =>
            {
                // Do something with each page of items
                Console.WriteLine("A page of results:");
                foreach (Address 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 <Address> 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 (Address 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
        }
        static void RunAddressesClient(IMundiAPIClient client)
        {
            //Criação + Atualização + Consulta
            Console.WriteLine("Criação + Atualização + Consulta");
            var customerId = CustomersClient.CreateCustomer(client);
            var addressId  = AddressesClient.CreateAddress(client, customerId);

            AddressesClient.UpdateAddress(client, customerId, addressId);
            AddressesClient.GetAddress(client, customerId, addressId);

            //Listagem:
            Console.WriteLine("Listagem");
            AddressesClient.GetAddresses(client, customerId);

            //Exclusão
            Console.WriteLine("Exclusão");
            AddressesClient.DeleteAddress(client, customerId, addressId);
        }
示例#22
0
        private void CleanUpAddresses()
        {
            // Note: this currently assumes that all the generated addresses will be in the first
            // page of results. When pagination is properly implemented, we'll be able to foreach over
            // all addresses easily.
            var client           = AddressesClient.Create();
            var list             = client.List(ProjectId, Region);
            var fixtureAddresses = list
                                   .Select(addr => addr.Name)
                                   .Where(name => name.StartsWith(ResourcePrefix));

            // Note: we don't wait for the operations to complete... if they've failed once, they're likely
            // to fail again anyway.
            foreach (var addressToDelete in fixtureAddresses)
            {
                client.Delete(ProjectId, Region, addressToDelete);
            }
        }
        /// <summary>Snippet for AggregatedList</summary>
        public void AggregatedList()
        {
            // Snippet: AggregatedList(string, string, int?, CallSettings)
            // Create client
            AddressesClient addressesClient = AddressesClient.Create();
            // Initialize request argument(s)
            string project = "";
            // Make the request
            PagedEnumerable <AddressAggregatedList, KeyValuePair <string, AddressesScopedList> > response = addressesClient.AggregatedList(project);

            // Iterate over all response items, lazily performing RPCs as required
            foreach (KeyValuePair <string, AddressesScopedList> 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 (AddressAggregatedList page in response.AsRawResponses())
            {
                // Do something with each page of items
                Console.WriteLine("A page of results:");
                foreach (KeyValuePair <string, AddressesScopedList> 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 <KeyValuePair <string, AddressesScopedList> > 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 (KeyValuePair <string, AddressesScopedList> 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
        }
        /// <summary>Snippet for GetAsync</summary>
        public async Task GetRequestObjectAsync()
        {
            // Snippet: GetAsync(GetAddressRequest, CallSettings)
            // Additional: GetAsync(GetAddressRequest, CancellationToken)
            // Create client
            AddressesClient addressesClient = await AddressesClient.CreateAsync();

            // Initialize request argument(s)
            GetAddressRequest request = new GetAddressRequest
            {
                Region  = "",
                Project = "",
                Address = "",
            };
            // Make the request
            Address response = await addressesClient.GetAsync(request);

            // End snippet
        }
示例#25
0
 /// <summary>Snippet for AggregatedList</summary>
 public void AggregatedListRequestObject()
 {
     // Snippet: AggregatedList(AggregatedListAddressesRequest, CallSettings)
     // Create client
     AddressesClient addressesClient = AddressesClient.Create();
     // Initialize request argument(s)
     AggregatedListAddressesRequest request = new AggregatedListAddressesRequest
     {
         PageToken            = "",
         MaxResults           = 0U,
         Filter               = "",
         IncludeAllScopes     = false,
         OrderBy              = "",
         Project              = "",
         ReturnPartialSuccess = false,
     };
     // Make the request
     AddressAggregatedList response = addressesClient.AggregatedList(request);
     // End snippet
 }
示例#26
0
 /// <summary>Snippet for List</summary>
 public void ListRequestObject()
 {
     // Snippet: List(ListAddressesRequest, CallSettings)
     // Create client
     AddressesClient addressesClient = AddressesClient.Create();
     // Initialize request argument(s)
     ListAddressesRequest request = new ListAddressesRequest
     {
         PageToken            = "",
         MaxResults           = 0U,
         Filter               = "",
         Region               = "",
         OrderBy              = "",
         Project              = "",
         ReturnPartialSuccess = false,
     };
     // Make the request
     AddressList response = addressesClient.List(request);
     // End snippet
 }
        /// <summary>Snippet for InsertAsync</summary>
        public async Task InsertRequestObjectAsync()
        {
            // Snippet: InsertAsync(InsertAddressRequest, CallSettings)
            // Additional: InsertAsync(InsertAddressRequest, CancellationToken)
            // Create client
            AddressesClient addressesClient = await AddressesClient.CreateAsync();

            // Initialize request argument(s)
            InsertAddressRequest request = new InsertAddressRequest
            {
                RequestId       = "",
                Region          = "",
                Project         = "",
                AddressResource = new Address(),
            };
            // Make the request
            Operation response = await addressesClient.InsertAsync(request);

            // End snippet
        }
        /// <summary>Snippet for DeleteAsync</summary>
        public async Task DeleteRequestObjectAsync()
        {
            // Snippet: DeleteAsync(DeleteAddressRequest, CallSettings)
            // Additional: DeleteAsync(DeleteAddressRequest, CancellationToken)
            // Create client
            AddressesClient addressesClient = await AddressesClient.CreateAsync();

            // Initialize request argument(s)
            DeleteAddressRequest request = new DeleteAddressRequest
            {
                RequestId = "",
                Region    = "",
                Project   = "",
                Address   = "",
            };
            // Make the request
            Operation response = await addressesClient.DeleteAsync(request);

            // End snippet
        }
示例#29
0
        /// <summary>Snippet for AggregatedListAsync</summary>
        public async Task AggregatedListRequestObjectAsync()
        {
            // Snippet: AggregatedListAsync(AggregatedListAddressesRequest, CallSettings)
            // Additional: AggregatedListAsync(AggregatedListAddressesRequest, CancellationToken)
            // Create client
            AddressesClient addressesClient = await AddressesClient.CreateAsync();

            // Initialize request argument(s)
            AggregatedListAddressesRequest request = new AggregatedListAddressesRequest
            {
                PageToken            = "",
                MaxResults           = 0U,
                Filter               = "",
                IncludeAllScopes     = false,
                OrderBy              = "",
                Project              = "",
                ReturnPartialSuccess = false,
            };
            // Make the request
            AddressAggregatedList response = await addressesClient.AggregatedListAsync(request);

            // End snippet
        }
示例#30
0
        /// <summary>Snippet for DeleteAsync</summary>
        public async Task DeleteRequestObjectAsync()
        {
            // Snippet: DeleteAsync(DeleteAddressRequest, CallSettings)
            // Additional: DeleteAsync(DeleteAddressRequest, CancellationToken)
            // Create client
            AddressesClient addressesClient = await AddressesClient.CreateAsync();

            // Initialize request argument(s)
            DeleteAddressRequest request = new DeleteAddressRequest
            {
                RequestId = "",
                Region    = "",
                Project   = "",
                Address   = "",
            };
            // Make the request
            lro::Operation <Operation, Operation> response = await addressesClient.DeleteAsync(request);

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

            // Retrieve the operation result
            Operation 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
            lro::Operation <Operation, Operation> retrievedResponse = await addressesClient.PollOnceDeleteAsync(operationName);

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