Class ReportServiceClient
ReportService client wrapper, for convenient use.
Namespace: Google.Shopping.Merchant.Reports.V1Beta
Assembly: Google.Shopping.Merchant.Reports.V1Beta.dll
Syntax
public abstract class ReportServiceClient
Remarks
Service for retrieving reports and insights about your products, their performance, and their competitive environment on Google.
Properties
DefaultEndpoint
The default endpoint for the ReportService 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 ReportService scopes.
Declaration
public static IReadOnlyList<string> DefaultScopes { get; }
Property Value
Type | Description |
---|---|
IReadOnlyList<string> |
Remarks
The default ReportService scopes are:
- https://www.googleapis.com/auth/content
GrpcClient
The underlying gRPC ReportService client
Declaration
public virtual ReportService.ReportServiceClient GrpcClient { get; }
Property Value
Type | Description |
---|---|
ReportService.ReportServiceClient |
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 ReportServiceClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use ReportServiceClientBuilder.
Declaration
public static ReportServiceClient Create()
Returns
Type | Description |
---|---|
ReportServiceClient | The created ReportServiceClient. |
CreateAsync(CancellationToken)
Asynchronously creates a ReportServiceClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use ReportServiceClientBuilder.
Declaration
public static Task<ReportServiceClient> CreateAsync(CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | cancellationToken | The CancellationToken to use while creating the client. |
Returns
Type | Description |
---|---|
Task<ReportServiceClient> | The task representing the created ReportServiceClient. |
Search(SearchRequest, CallSettings)
Retrieves a report defined by a search query. The response might contain
fewer rows than specified by page_size
. Rely on next_page_token
to
determine if there are more rows to be requested.
Declaration
public virtual PagedEnumerable<SearchResponse, ReportRow> Search(SearchRequest request, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
SearchRequest | 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<SearchResponse, ReportRow> | A pageable sequence of ReportRow resources. |
Sample code
// Create client
ReportServiceClient reportServiceClient = ReportServiceClient.Create();
// Initialize request argument(s)
SearchRequest request = new SearchRequest
{
Parent = "",
Query = "",
};
// Make the request
PagedEnumerable<SearchResponse, ReportRow> response = reportServiceClient.Search(request);
// Iterate over all response items, lazily performing RPCs as required
foreach (ReportRow 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 (SearchResponse page in response.AsRawResponses())
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (ReportRow 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<ReportRow> 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 (ReportRow 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;
Search(string, string, int?, CallSettings)
Retrieves a report defined by a search query. The response might contain
fewer rows than specified by page_size
. Rely on next_page_token
to
determine if there are more rows to be requested.
Declaration
public virtual PagedEnumerable<SearchResponse, ReportRow> Search(string parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
string | parent | Required. Id of the account making the call. Must be a standalone account or an MCA subaccount. Format: accounts/{account} |
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<SearchResponse, ReportRow> | A pageable sequence of ReportRow resources. |
Sample code
// Create client
ReportServiceClient reportServiceClient = ReportServiceClient.Create();
// Initialize request argument(s)
string parent = "";
// Make the request
PagedEnumerable<SearchResponse, ReportRow> response = reportServiceClient.Search(parent);
// Iterate over all response items, lazily performing RPCs as required
foreach (ReportRow 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 (SearchResponse page in response.AsRawResponses())
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (ReportRow 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<ReportRow> 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 (ReportRow 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;
SearchAsync(SearchRequest, CallSettings)
Retrieves a report defined by a search query. The response might contain
fewer rows than specified by page_size
. Rely on next_page_token
to
determine if there are more rows to be requested.
Declaration
public virtual PagedAsyncEnumerable<SearchResponse, ReportRow> SearchAsync(SearchRequest request, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
SearchRequest | 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<SearchResponse, ReportRow> | A pageable asynchronous sequence of ReportRow resources. |
Sample code
// Create client
ReportServiceClient reportServiceClient = await ReportServiceClient.CreateAsync();
// Initialize request argument(s)
SearchRequest request = new SearchRequest
{
Parent = "",
Query = "",
};
// Make the request
PagedAsyncEnumerable<SearchResponse, ReportRow> response = reportServiceClient.SearchAsync(request);
// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((ReportRow 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((SearchResponse page) =>
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (ReportRow 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<ReportRow> 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 (ReportRow 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;
SearchAsync(string, string, int?, CallSettings)
Retrieves a report defined by a search query. The response might contain
fewer rows than specified by page_size
. Rely on next_page_token
to
determine if there are more rows to be requested.
Declaration
public virtual PagedAsyncEnumerable<SearchResponse, ReportRow> SearchAsync(string parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
string | parent | Required. Id of the account making the call. Must be a standalone account or an MCA subaccount. Format: accounts/{account} |
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<SearchResponse, ReportRow> | A pageable asynchronous sequence of ReportRow resources. |
Sample code
// Create client
ReportServiceClient reportServiceClient = await ReportServiceClient.CreateAsync();
// Initialize request argument(s)
string parent = "";
// Make the request
PagedAsyncEnumerable<SearchResponse, ReportRow> response = reportServiceClient.SearchAsync(parent);
// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((ReportRow 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((SearchResponse page) =>
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (ReportRow 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<ReportRow> 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 (ReportRow 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.