Class OnlineReturnPolicyServiceClient
OnlineReturnPolicyService client wrapper, for convenient use.
Namespace: Google.Shopping.Merchant.Accounts.V1Beta
Assembly: Google.Shopping.Merchant.Accounts.V1Beta.dll
Syntax
public abstract class OnlineReturnPolicyServiceClient
Remarks
The service facilitates the management of a merchant's remorse return policy configuration, encompassing return policies for both ads and free listings
programs. This API defines the following resource model:
[OnlineReturnPolicy][google.shopping.merchant.accounts.v1.OnlineReturnPolicy]
Properties
DefaultEndpoint
The default endpoint for the OnlineReturnPolicyService service, which is a host of "merchantapi.googleapis.com" and a port of 443.
Declaration
public static string DefaultEndpoint { get; }
Property Value
Type | Description |
---|---|
string |
DefaultScopes
The default OnlineReturnPolicyService scopes.
Declaration
public static IReadOnlyList<string> DefaultScopes { get; }
Property Value
Type | Description |
---|---|
IReadOnlyList<string> |
Remarks
The default OnlineReturnPolicyService scopes are:
- https://www.googleapis.com/auth/content
GrpcClient
The underlying gRPC OnlineReturnPolicyService client
Declaration
public virtual OnlineReturnPolicyService.OnlineReturnPolicyServiceClient GrpcClient { get; }
Property Value
Type | Description |
---|---|
OnlineReturnPolicyService.OnlineReturnPolicyServiceClient |
ServiceMetadata
The service metadata associated with this client type.
Declaration
public static ServiceMetadata ServiceMetadata { get; }
Property Value
Type | Description |
---|---|
ServiceMetadata |
Methods
Create()
Synchronously creates a OnlineReturnPolicyServiceClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use OnlineReturnPolicyServiceClientBuilder.
Declaration
public static OnlineReturnPolicyServiceClient Create()
Returns
Type | Description |
---|---|
OnlineReturnPolicyServiceClient | The created OnlineReturnPolicyServiceClient. |
CreateAsync(CancellationToken)
Asynchronously creates a OnlineReturnPolicyServiceClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use OnlineReturnPolicyServiceClientBuilder.
Declaration
public static Task<OnlineReturnPolicyServiceClient> CreateAsync(CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | cancellationToken | The CancellationToken to use while creating the client. |
Returns
Type | Description |
---|---|
Task<OnlineReturnPolicyServiceClient> | The task representing the created OnlineReturnPolicyServiceClient. |
GetOnlineReturnPolicy(GetOnlineReturnPolicyRequest, CallSettings)
Gets an existing return policy.
Declaration
public virtual OnlineReturnPolicy GetOnlineReturnPolicy(GetOnlineReturnPolicyRequest request, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
GetOnlineReturnPolicyRequest | request | The request object containing all of the parameters for the API call. |
CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Returns
Type | Description |
---|---|
OnlineReturnPolicy | The RPC response. |
Sample code
// Create client
OnlineReturnPolicyServiceClient onlineReturnPolicyServiceClient = OnlineReturnPolicyServiceClient.Create();
// Initialize request argument(s)
GetOnlineReturnPolicyRequest request = new GetOnlineReturnPolicyRequest
{
OnlineReturnPolicyName = OnlineReturnPolicyName.FromAccountReturnPolicy("[ACCOUNT]", "[RETURN_POLICY]"),
};
// Make the request
OnlineReturnPolicy response = onlineReturnPolicyServiceClient.GetOnlineReturnPolicy(request);
GetOnlineReturnPolicy(OnlineReturnPolicyName, CallSettings)
Gets an existing return policy.
Declaration
public virtual OnlineReturnPolicy GetOnlineReturnPolicy(OnlineReturnPolicyName name, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
OnlineReturnPolicyName | name | Required. The name of the return policy to retrieve.
Format: |
CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Returns
Type | Description |
---|---|
OnlineReturnPolicy | The RPC response. |
Sample code
// Create client
OnlineReturnPolicyServiceClient onlineReturnPolicyServiceClient = OnlineReturnPolicyServiceClient.Create();
// Initialize request argument(s)
OnlineReturnPolicyName name = OnlineReturnPolicyName.FromAccountReturnPolicy("[ACCOUNT]", "[RETURN_POLICY]");
// Make the request
OnlineReturnPolicy response = onlineReturnPolicyServiceClient.GetOnlineReturnPolicy(name);
GetOnlineReturnPolicy(string, CallSettings)
Gets an existing return policy.
Declaration
public virtual OnlineReturnPolicy GetOnlineReturnPolicy(string name, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
string | name | Required. The name of the return policy to retrieve.
Format: |
CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Returns
Type | Description |
---|---|
OnlineReturnPolicy | The RPC response. |
Sample code
// Create client
OnlineReturnPolicyServiceClient onlineReturnPolicyServiceClient = OnlineReturnPolicyServiceClient.Create();
// Initialize request argument(s)
string name = "accounts/[ACCOUNT]/onlineReturnPolicies/[RETURN_POLICY]";
// Make the request
OnlineReturnPolicy response = onlineReturnPolicyServiceClient.GetOnlineReturnPolicy(name);
GetOnlineReturnPolicyAsync(GetOnlineReturnPolicyRequest, CallSettings)
Gets an existing return policy.
Declaration
public virtual Task<OnlineReturnPolicy> GetOnlineReturnPolicyAsync(GetOnlineReturnPolicyRequest request, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
GetOnlineReturnPolicyRequest | request | The request object containing all of the parameters for the API call. |
CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Returns
Type | Description |
---|---|
Task<OnlineReturnPolicy> | A Task containing the RPC response. |
Sample code
// Create client
OnlineReturnPolicyServiceClient onlineReturnPolicyServiceClient = await OnlineReturnPolicyServiceClient.CreateAsync();
// Initialize request argument(s)
GetOnlineReturnPolicyRequest request = new GetOnlineReturnPolicyRequest
{
OnlineReturnPolicyName = OnlineReturnPolicyName.FromAccountReturnPolicy("[ACCOUNT]", "[RETURN_POLICY]"),
};
// Make the request
OnlineReturnPolicy response = await onlineReturnPolicyServiceClient.GetOnlineReturnPolicyAsync(request);
GetOnlineReturnPolicyAsync(GetOnlineReturnPolicyRequest, CancellationToken)
Gets an existing return policy.
Declaration
public virtual Task<OnlineReturnPolicy> GetOnlineReturnPolicyAsync(GetOnlineReturnPolicyRequest request, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
GetOnlineReturnPolicyRequest | request | The request object containing all of the parameters for the API call. |
CancellationToken | cancellationToken | A CancellationToken to use for this RPC. |
Returns
Type | Description |
---|---|
Task<OnlineReturnPolicy> | A Task containing the RPC response. |
Sample code
// Create client
OnlineReturnPolicyServiceClient onlineReturnPolicyServiceClient = await OnlineReturnPolicyServiceClient.CreateAsync();
// Initialize request argument(s)
GetOnlineReturnPolicyRequest request = new GetOnlineReturnPolicyRequest
{
OnlineReturnPolicyName = OnlineReturnPolicyName.FromAccountReturnPolicy("[ACCOUNT]", "[RETURN_POLICY]"),
};
// Make the request
OnlineReturnPolicy response = await onlineReturnPolicyServiceClient.GetOnlineReturnPolicyAsync(request);
GetOnlineReturnPolicyAsync(OnlineReturnPolicyName, CallSettings)
Gets an existing return policy.
Declaration
public virtual Task<OnlineReturnPolicy> GetOnlineReturnPolicyAsync(OnlineReturnPolicyName name, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
OnlineReturnPolicyName | name | Required. The name of the return policy to retrieve.
Format: |
CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Returns
Type | Description |
---|---|
Task<OnlineReturnPolicy> | A Task containing the RPC response. |
Sample code
// Create client
OnlineReturnPolicyServiceClient onlineReturnPolicyServiceClient = await OnlineReturnPolicyServiceClient.CreateAsync();
// Initialize request argument(s)
OnlineReturnPolicyName name = OnlineReturnPolicyName.FromAccountReturnPolicy("[ACCOUNT]", "[RETURN_POLICY]");
// Make the request
OnlineReturnPolicy response = await onlineReturnPolicyServiceClient.GetOnlineReturnPolicyAsync(name);
GetOnlineReturnPolicyAsync(OnlineReturnPolicyName, CancellationToken)
Gets an existing return policy.
Declaration
public virtual Task<OnlineReturnPolicy> GetOnlineReturnPolicyAsync(OnlineReturnPolicyName name, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
OnlineReturnPolicyName | name | Required. The name of the return policy to retrieve.
Format: |
CancellationToken | cancellationToken | A CancellationToken to use for this RPC. |
Returns
Type | Description |
---|---|
Task<OnlineReturnPolicy> | A Task containing the RPC response. |
Sample code
// Create client
OnlineReturnPolicyServiceClient onlineReturnPolicyServiceClient = await OnlineReturnPolicyServiceClient.CreateAsync();
// Initialize request argument(s)
OnlineReturnPolicyName name = OnlineReturnPolicyName.FromAccountReturnPolicy("[ACCOUNT]", "[RETURN_POLICY]");
// Make the request
OnlineReturnPolicy response = await onlineReturnPolicyServiceClient.GetOnlineReturnPolicyAsync(name);
GetOnlineReturnPolicyAsync(string, CallSettings)
Gets an existing return policy.
Declaration
public virtual Task<OnlineReturnPolicy> GetOnlineReturnPolicyAsync(string name, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
string | name | Required. The name of the return policy to retrieve.
Format: |
CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Returns
Type | Description |
---|---|
Task<OnlineReturnPolicy> | A Task containing the RPC response. |
Sample code
// Create client
OnlineReturnPolicyServiceClient onlineReturnPolicyServiceClient = await OnlineReturnPolicyServiceClient.CreateAsync();
// Initialize request argument(s)
string name = "accounts/[ACCOUNT]/onlineReturnPolicies/[RETURN_POLICY]";
// Make the request
OnlineReturnPolicy response = await onlineReturnPolicyServiceClient.GetOnlineReturnPolicyAsync(name);
GetOnlineReturnPolicyAsync(string, CancellationToken)
Gets an existing return policy.
Declaration
public virtual Task<OnlineReturnPolicy> GetOnlineReturnPolicyAsync(string name, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
string | name | Required. The name of the return policy to retrieve.
Format: |
CancellationToken | cancellationToken | A CancellationToken to use for this RPC. |
Returns
Type | Description |
---|---|
Task<OnlineReturnPolicy> | A Task containing the RPC response. |
Sample code
// Create client
OnlineReturnPolicyServiceClient onlineReturnPolicyServiceClient = await OnlineReturnPolicyServiceClient.CreateAsync();
// Initialize request argument(s)
string name = "accounts/[ACCOUNT]/onlineReturnPolicies/[RETURN_POLICY]";
// Make the request
OnlineReturnPolicy response = await onlineReturnPolicyServiceClient.GetOnlineReturnPolicyAsync(name);
ListOnlineReturnPolicies(AccountName, string, int?, CallSettings)
Lists all existing return policies.
Declaration
public virtual PagedEnumerable<ListOnlineReturnPoliciesResponse, OnlineReturnPolicy> ListOnlineReturnPolicies(AccountName parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
AccountName | parent | Required. The merchant account for which to list return policies.
Format: |
string | pageToken | The token returned from the previous request. A value of |
int? | pageSize | The size of page to request. The response will not be larger than this, but may be smaller. A value of
|
CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Returns
Type | Description |
---|---|
PagedEnumerable<ListOnlineReturnPoliciesResponse, OnlineReturnPolicy> | A pageable sequence of OnlineReturnPolicy resources. |
Sample code
// Create client
OnlineReturnPolicyServiceClient onlineReturnPolicyServiceClient = OnlineReturnPolicyServiceClient.Create();
// Initialize request argument(s)
AccountName parent = AccountName.FromAccount("[ACCOUNT]");
// Make the request
PagedEnumerable<ListOnlineReturnPoliciesResponse, OnlineReturnPolicy> response = onlineReturnPolicyServiceClient.ListOnlineReturnPolicies(parent);
// Iterate over all response items, lazily performing RPCs as required
foreach (OnlineReturnPolicy 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 (ListOnlineReturnPoliciesResponse page in response.AsRawResponses())
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (OnlineReturnPolicy 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<OnlineReturnPolicy> 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 (OnlineReturnPolicy 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;
ListOnlineReturnPolicies(ListOnlineReturnPoliciesRequest, CallSettings)
Lists all existing return policies.
Declaration
public virtual PagedEnumerable<ListOnlineReturnPoliciesResponse, OnlineReturnPolicy> ListOnlineReturnPolicies(ListOnlineReturnPoliciesRequest request, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
ListOnlineReturnPoliciesRequest | request | The request object containing all of the parameters for the API call. |
CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Returns
Type | Description |
---|---|
PagedEnumerable<ListOnlineReturnPoliciesResponse, OnlineReturnPolicy> | A pageable sequence of OnlineReturnPolicy resources. |
Sample code
// Create client
OnlineReturnPolicyServiceClient onlineReturnPolicyServiceClient = OnlineReturnPolicyServiceClient.Create();
// Initialize request argument(s)
ListOnlineReturnPoliciesRequest request = new ListOnlineReturnPoliciesRequest
{
ParentAsAccountName = AccountName.FromAccount("[ACCOUNT]"),
};
// Make the request
PagedEnumerable<ListOnlineReturnPoliciesResponse, OnlineReturnPolicy> response = onlineReturnPolicyServiceClient.ListOnlineReturnPolicies(request);
// Iterate over all response items, lazily performing RPCs as required
foreach (OnlineReturnPolicy 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 (ListOnlineReturnPoliciesResponse page in response.AsRawResponses())
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (OnlineReturnPolicy 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<OnlineReturnPolicy> 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 (OnlineReturnPolicy 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;
ListOnlineReturnPolicies(string, string, int?, CallSettings)
Lists all existing return policies.
Declaration
public virtual PagedEnumerable<ListOnlineReturnPoliciesResponse, OnlineReturnPolicy> ListOnlineReturnPolicies(string parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
string | parent | Required. The merchant account for which to list return policies.
Format: |
string | pageToken | The token returned from the previous request. A value of |
int? | pageSize | The size of page to request. The response will not be larger than this, but may be smaller. A value of
|
CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Returns
Type | Description |
---|---|
PagedEnumerable<ListOnlineReturnPoliciesResponse, OnlineReturnPolicy> | A pageable sequence of OnlineReturnPolicy resources. |
Sample code
// Create client
OnlineReturnPolicyServiceClient onlineReturnPolicyServiceClient = OnlineReturnPolicyServiceClient.Create();
// Initialize request argument(s)
string parent = "accounts/[ACCOUNT]";
// Make the request
PagedEnumerable<ListOnlineReturnPoliciesResponse, OnlineReturnPolicy> response = onlineReturnPolicyServiceClient.ListOnlineReturnPolicies(parent);
// Iterate over all response items, lazily performing RPCs as required
foreach (OnlineReturnPolicy 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 (ListOnlineReturnPoliciesResponse page in response.AsRawResponses())
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (OnlineReturnPolicy 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<OnlineReturnPolicy> 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 (OnlineReturnPolicy 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;
ListOnlineReturnPoliciesAsync(AccountName, string, int?, CallSettings)
Lists all existing return policies.
Declaration
public virtual PagedAsyncEnumerable<ListOnlineReturnPoliciesResponse, OnlineReturnPolicy> ListOnlineReturnPoliciesAsync(AccountName parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
AccountName | parent | Required. The merchant account for which to list return policies.
Format: |
string | pageToken | The token returned from the previous request. A value of |
int? | pageSize | The size of page to request. The response will not be larger than this, but may be smaller. A value of
|
CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Returns
Type | Description |
---|---|
PagedAsyncEnumerable<ListOnlineReturnPoliciesResponse, OnlineReturnPolicy> | A pageable asynchronous sequence of OnlineReturnPolicy resources. |
Sample code
// Create client
OnlineReturnPolicyServiceClient onlineReturnPolicyServiceClient = await OnlineReturnPolicyServiceClient.CreateAsync();
// Initialize request argument(s)
AccountName parent = AccountName.FromAccount("[ACCOUNT]");
// Make the request
PagedAsyncEnumerable<ListOnlineReturnPoliciesResponse, OnlineReturnPolicy> response = onlineReturnPolicyServiceClient.ListOnlineReturnPoliciesAsync(parent);
// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((OnlineReturnPolicy 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((ListOnlineReturnPoliciesResponse page) =>
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (OnlineReturnPolicy 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<OnlineReturnPolicy> 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 (OnlineReturnPolicy 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;
ListOnlineReturnPoliciesAsync(ListOnlineReturnPoliciesRequest, CallSettings)
Lists all existing return policies.
Declaration
public virtual PagedAsyncEnumerable<ListOnlineReturnPoliciesResponse, OnlineReturnPolicy> ListOnlineReturnPoliciesAsync(ListOnlineReturnPoliciesRequest request, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
ListOnlineReturnPoliciesRequest | request | The request object containing all of the parameters for the API call. |
CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Returns
Type | Description |
---|---|
PagedAsyncEnumerable<ListOnlineReturnPoliciesResponse, OnlineReturnPolicy> | A pageable asynchronous sequence of OnlineReturnPolicy resources. |
Sample code
// Create client
OnlineReturnPolicyServiceClient onlineReturnPolicyServiceClient = await OnlineReturnPolicyServiceClient.CreateAsync();
// Initialize request argument(s)
ListOnlineReturnPoliciesRequest request = new ListOnlineReturnPoliciesRequest
{
ParentAsAccountName = AccountName.FromAccount("[ACCOUNT]"),
};
// Make the request
PagedAsyncEnumerable<ListOnlineReturnPoliciesResponse, OnlineReturnPolicy> response = onlineReturnPolicyServiceClient.ListOnlineReturnPoliciesAsync(request);
// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((OnlineReturnPolicy 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((ListOnlineReturnPoliciesResponse page) =>
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (OnlineReturnPolicy 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<OnlineReturnPolicy> 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 (OnlineReturnPolicy 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;
ListOnlineReturnPoliciesAsync(string, string, int?, CallSettings)
Lists all existing return policies.
Declaration
public virtual PagedAsyncEnumerable<ListOnlineReturnPoliciesResponse, OnlineReturnPolicy> ListOnlineReturnPoliciesAsync(string parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
string | parent | Required. The merchant account for which to list return policies.
Format: |
string | pageToken | The token returned from the previous request. A value of |
int? | pageSize | The size of page to request. The response will not be larger than this, but may be smaller. A value of
|
CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Returns
Type | Description |
---|---|
PagedAsyncEnumerable<ListOnlineReturnPoliciesResponse, OnlineReturnPolicy> | A pageable asynchronous sequence of OnlineReturnPolicy resources. |
Sample code
// Create client
OnlineReturnPolicyServiceClient onlineReturnPolicyServiceClient = await OnlineReturnPolicyServiceClient.CreateAsync();
// Initialize request argument(s)
string parent = "accounts/[ACCOUNT]";
// Make the request
PagedAsyncEnumerable<ListOnlineReturnPoliciesResponse, OnlineReturnPolicy> response = onlineReturnPolicyServiceClient.ListOnlineReturnPoliciesAsync(parent);
// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((OnlineReturnPolicy 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((ListOnlineReturnPoliciesResponse page) =>
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (OnlineReturnPolicy 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<OnlineReturnPolicy> 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 (OnlineReturnPolicy 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;
ShutdownDefaultChannelsAsync()
Shuts down any channels automatically created by Create() and CreateAsync(CancellationToken). Channels which weren't automatically created are not affected.
Declaration
public static Task ShutdownDefaultChannelsAsync()
Returns
Type | Description |
---|---|
Task | A task representing the asynchronous shutdown operation. |
Remarks
After calling this method, further calls to Create() and CreateAsync(CancellationToken) will create new channels, which could in turn be shut down by another call to this method.