Beispiel #1
0
        public void List()
        {
            moq::Mock <Addresses.AddressesClient> mockGrpcClient = new moq::Mock <Addresses.AddressesClient>(moq::MockBehavior.Strict);
            ListAddressesRequest request = new ListAddressesRequest
            {
                Region  = "regionedb20d96",
                Project = "projectaa6ff846",
            };
            AddressList expectedResponse = new AddressList
            {
                Id            = "id74b70bb8",
                Kind          = "kindf7aa39d9",
                Warning       = new Warning(),
                NextPageToken = "next_page_tokendbee0940",
                Items         = { new Address(), },
                SelfLink      = "self_link7e87f12d",
            };

            mockGrpcClient.Setup(x => x.List(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            AddressesClient client   = new AddressesClientImpl(mockGrpcClient.Object, null);
            AddressList     response = client.List(request.Project, request.Region);

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
Beispiel #2
0
        public async stt::Task ListAsync()
        {
            moq::Mock <Addresses.AddressesClient> mockGrpcClient = new moq::Mock <Addresses.AddressesClient>(moq::MockBehavior.Strict);
            ListAddressesRequest request = new ListAddressesRequest
            {
                Region  = "regionedb20d96",
                Project = "projectaa6ff846",
            };
            AddressList expectedResponse = new AddressList
            {
                Id            = "id74b70bb8",
                Kind          = "kindf7aa39d9",
                Warning       = new Warning(),
                NextPageToken = "next_page_tokendbee0940",
                Items         = { new Address(), },
                SelfLink      = "self_link7e87f12d",
            };

            mockGrpcClient.Setup(x => x.ListAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <AddressList>(stt::Task.FromResult(expectedResponse), null, null, null, null));
            AddressesClient client = new AddressesClientImpl(mockGrpcClient.Object, null);
            AddressList     responseCallSettings = await client.ListAsync(request.Project, request.Region, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None));

            xunit::Assert.Same(expectedResponse, responseCallSettings);
            AddressList responseCancellationToken = await client.ListAsync(request.Project, request.Region, st::CancellationToken.None);

            xunit::Assert.Same(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }
Beispiel #3
0
        public void ListRequestObject()
        {
            moq::Mock <Addresses.AddressesClient> mockGrpcClient = new moq::Mock <Addresses.AddressesClient>(moq::MockBehavior.Strict);
            ListAddressesRequest request = new ListAddressesRequest
            {
                PageToken            = "page_tokenf09e5538",
                MaxResults           = 2806814450U,
                Region               = "regionedb20d96",
                OrderBy              = "order_byb4d33ada",
                Project              = "projectaa6ff846",
                Filter               = "filtere47ac9b2",
                ReturnPartialSuccess = false,
            };
            AddressList expectedResponse = new AddressList
            {
                Id            = "id74b70bb8",
                Kind          = "kindf7aa39d9",
                Warning       = new Warning(),
                NextPageToken = "next_page_tokendbee0940",
                Items         = { new Address(), },
                SelfLink      = "self_link7e87f12d",
            };

            mockGrpcClient.Setup(x => x.List(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            AddressesClient client   = new AddressesClientImpl(mockGrpcClient.Object, null);
            AddressList     response = client.List(request);

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
Beispiel #4
0
        public BaseResponse <ListAddressesResponse> ListAddresses(ListAddressesRequest request)
        {
            var method   = HttpMethod.Get;
            var endpoint = $"/customers/{request.CustomerId}/addresses";
            var query    = request.ToDictionary();

            return(this.HttpClientUtil.SendRequest <ListAddressesResponse>(method, endpoint, query));
        }
        /// <summary>Snippet for ListAsync</summary>
        public async Task ListRequestObjectAsync()
        {
            // Snippet: ListAsync(ListAddressesRequest, CallSettings)
            // Create client
            AddressesClient addressesClient = await AddressesClient.CreateAsync();

            // Initialize request argument(s)
            ListAddressesRequest request = new ListAddressesRequest
            {
                Region  = "",
                OrderBy = "",
                Project = "",
                Filter  = "",
                ReturnPartialSuccess = false,
            };
            // Make the request
            PagedAsyncEnumerable <AddressList, Address> response = addressesClient.ListAsync(request);

            // 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
        }
Beispiel #6
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
 }
Beispiel #7
0
        /// <summary>Snippet for ListAsync</summary>
        public async Task ListRequestObjectAsync()
        {
            // Snippet: ListAsync(ListAddressesRequest, CallSettings)
            // Additional: ListAsync(ListAddressesRequest, CancellationToken)
            // Create client
            AddressesClient addressesClient = await AddressesClient.CreateAsync();

            // Initialize request argument(s)
            ListAddressesRequest request = new ListAddressesRequest
            {
                PageToken            = "",
                MaxResults           = 0U,
                Filter               = "",
                Region               = "",
                OrderBy              = "",
                Project              = "",
                ReturnPartialSuccess = false,
            };
            // Make the request
            AddressList response = await addressesClient.ListAsync(request);

            // End snippet
        }
Beispiel #8
0
 /// <summary>
 /// Lists addresses for a specific currency. Permission required: Generate New Address
 /// </summary>
 /// <returns><typeparamref name="PagedResult"/> of addresses</returns>
 public async Task <PagedResult <AddressModel> > ListAddresses(ListAddressesRequest listAddressesRequest)
 {
     return(await PostAsync <PagedResult <AddressModel> >("listaddresses", listAddressesRequest));
 }
 /// <summary>
 /// Retrieves a list of addresses contained within the specified region.
 /// </summary>
 /// <param name="request">The request object containing all of the parameters for the API call.</param>
 /// <param name="callSettings">If not null, applies overrides to this RPC call.</param>
 /// <returns>A Task containing the RPC response.</returns>
 public override stt::Task <AddressList> ListAsync(ListAddressesRequest request, gaxgrpc::CallSettings callSettings = null)
 {
     Modify_ListAddressesRequest(ref request, ref callSettings);
     return(_callList.Async(request, callSettings));
 }
 /// <summary>
 /// Retrieves a list of addresses contained within the specified region.
 /// </summary>
 /// <param name="request">The request object containing all of the parameters for the API call.</param>
 /// <param name="callSettings">If not null, applies overrides to this RPC call.</param>
 /// <returns>The RPC response.</returns>
 public override AddressList List(ListAddressesRequest request, gaxgrpc::CallSettings callSettings = null)
 {
     Modify_ListAddressesRequest(ref request, ref callSettings);
     return(_callList.Sync(request, callSettings));
 }
 partial void Modify_ListAddressesRequest(ref ListAddressesRequest request, ref gaxgrpc::CallSettings settings);
 /// <summary>
 /// Retrieves a list of addresses contained within the specified region.
 /// </summary>
 /// <param name="request">The request object containing all of the parameters for the API call.</param>
 /// <param name="cancellationToken">A <see cref="st::CancellationToken"/> to use for this RPC.</param>
 /// <returns>A Task containing the RPC response.</returns>
 public virtual stt::Task <AddressList> ListAsync(ListAddressesRequest request, st::CancellationToken cancellationToken) =>
 ListAsync(request, gaxgrpc::CallSettings.FromCancellationToken(cancellationToken));
 /// <summary>
 /// Retrieves a list of addresses contained within the specified region.
 /// </summary>
 /// <param name="request">The request object containing all of the parameters for the API call.</param>
 /// <param name="callSettings">If not null, applies overrides to this RPC call.</param>
 /// <returns>A Task containing the RPC response.</returns>
 public virtual stt::Task <AddressList> ListAsync(ListAddressesRequest request, gaxgrpc::CallSettings callSettings = null) =>
 throw new sys::NotImplementedException();
Beispiel #14
0
 /// <summary>
 /// Retrieves a list of addresses contained within the specified region.
 /// </summary>
 /// <param name="request">The request object containing all of the parameters for the API call.</param>
 /// <param name="callSettings">If not null, applies overrides to this RPC call.</param>
 /// <returns>A pageable asynchronous sequence of <see cref="Address"/> resources.</returns>
 public override gax::PagedAsyncEnumerable <AddressList, Address> ListAsync(ListAddressesRequest request, gaxgrpc::CallSettings callSettings = null)
 {
     Modify_ListAddressesRequest(ref request, ref callSettings);
     return(new gaxgrpc::GrpcPagedAsyncEnumerable <ListAddressesRequest, AddressList, Address>(_callList, request, callSettings));
 }
 /// <summary>
 /// Retrieves a list of addresses contained within the specified region.
 /// </summary>
 /// <param name="request">The request object containing all of the parameters for the API call.</param>
 /// <param name="callSettings">If not null, applies overrides to this RPC call.</param>
 /// <returns>The RPC response.</returns>
 public virtual AddressList List(ListAddressesRequest request, gaxgrpc::CallSettings callSettings = null) =>
 throw new sys::NotImplementedException();
        public BaseResponse <PagingResponse <GetAddressResponse>, MundipaggErrorsResponse> ListAddresses(ListAddressesRequest request)
        {
            var method   = HttpMethod.Get;
            var endpoint = $"/customers/{request.CustomerId}/addresses";
            var query    = request.ToDictionary();

            return(this.SendRequest <PagingResponse <GetAddressResponse> >(method, endpoint, query));
        }
Beispiel #17
0
 /// <summary>
 /// Retrieves a list of addresses contained within the specified region.
 /// </summary>
 /// <param name="request">The request object containing all of the parameters for the API call.</param>
 /// <param name="callSettings">If not null, applies overrides to this RPC call.</param>
 /// <returns>A pageable asynchronous sequence of <see cref="Address"/> resources.</returns>
 public virtual gax::PagedAsyncEnumerable <AddressList, Address> ListAsync(ListAddressesRequest request, gaxgrpc::CallSettings callSettings = null) =>
 throw new sys::NotImplementedException();