Class CatalogServiceClient
CatalogService client wrapper, for convenient use.
Inherited Members
Namespace: Google.Cloud.Retail.V2
Assembly: Google.Cloud.Retail.V2.dll
Syntax
public abstract class CatalogServiceClient
Remarks
Service for managing catalog configuration.
Properties
DefaultEndpoint
The default endpoint for the CatalogService service, which is a host of "retail.googleapis.com" and a port of 443.
Declaration
public static string DefaultEndpoint { get; }
Property Value
Type | Description |
---|---|
System.String |
DefaultScopes
The default CatalogService scopes.
Declaration
public static IReadOnlyList<string> DefaultScopes { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IReadOnlyList<System.String> |
Remarks
The default CatalogService scopes are:
GrpcClient
The underlying gRPC CatalogService client
Declaration
public virtual CatalogService.CatalogServiceClient GrpcClient { get; }
Property Value
Type | Description |
---|---|
CatalogService.CatalogServiceClient |
Methods
Create()
Synchronously creates a CatalogServiceClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use CatalogServiceClientBuilder.
Declaration
public static CatalogServiceClient Create()
Returns
Type | Description |
---|---|
CatalogServiceClient | The created CatalogServiceClient. |
CreateAsync(CancellationToken)
Asynchronously creates a CatalogServiceClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use CatalogServiceClientBuilder.
Declaration
public static Task<CatalogServiceClient> CreateAsync(CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
System.Threading.CancellationToken | cancellationToken | The System.Threading.CancellationToken to use while creating the client. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<CatalogServiceClient> | The task representing the created CatalogServiceClient. |
ListCatalogs(LocationName, String, Nullable<Int32>, CallSettings)
Lists all the [Catalog][google.cloud.retail.v2.Catalog]s associated with the project.
Declaration
public virtual PagedEnumerable<ListCatalogsResponse, Catalog> ListCatalogs(LocationName parent, string pageToken = null, int? pageSize = default(int? ), CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
LocationName | parent | Required. The account resource name with an associated location. If the caller does not have permission to list [Catalog][google.cloud.retail.v2.Catalog]s under this location, regardless of whether or not this location exists, a PERMISSION_DENIED error is returned. |
System.String | pageToken | The token returned from the previous request. A value of |
System.Nullable<System.Int32> | 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<ListCatalogsResponse, Catalog> | A pageable sequence of Catalog resources. |
Sample code
// Create client
CatalogServiceClient catalogServiceClient = CatalogServiceClient.Create();
// Initialize request argument(s)
LocationName parent = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]");
// Make the request
PagedEnumerable<ListCatalogsResponse, Catalog> response = catalogServiceClient.ListCatalogs(parent);
// Iterate over all response items, lazily performing RPCs as required
foreach (Catalog 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 (ListCatalogsResponse page in response.AsRawResponses())
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (Catalog 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<Catalog> 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 (Catalog 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;
ListCatalogs(ListCatalogsRequest, CallSettings)
Lists all the [Catalog][google.cloud.retail.v2.Catalog]s associated with the project.
Declaration
public virtual PagedEnumerable<ListCatalogsResponse, Catalog> ListCatalogs(ListCatalogsRequest request, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
ListCatalogsRequest | 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<ListCatalogsResponse, Catalog> | A pageable sequence of Catalog resources. |
Sample code
// Create client
CatalogServiceClient catalogServiceClient = CatalogServiceClient.Create();
// Initialize request argument(s)
ListCatalogsRequest request = new ListCatalogsRequest
{
ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
};
// Make the request
PagedEnumerable<ListCatalogsResponse, Catalog> response = catalogServiceClient.ListCatalogs(request);
// Iterate over all response items, lazily performing RPCs as required
foreach (Catalog 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 (ListCatalogsResponse page in response.AsRawResponses())
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (Catalog 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<Catalog> 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 (Catalog 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;
ListCatalogs(String, String, Nullable<Int32>, CallSettings)
Lists all the [Catalog][google.cloud.retail.v2.Catalog]s associated with the project.
Declaration
public virtual PagedEnumerable<ListCatalogsResponse, Catalog> ListCatalogs(string parent, string pageToken = null, int? pageSize = default(int? ), CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | parent | Required. The account resource name with an associated location. If the caller does not have permission to list [Catalog][google.cloud.retail.v2.Catalog]s under this location, regardless of whether or not this location exists, a PERMISSION_DENIED error is returned. |
System.String | pageToken | The token returned from the previous request. A value of |
System.Nullable<System.Int32> | 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<ListCatalogsResponse, Catalog> | A pageable sequence of Catalog resources. |
Sample code
// Create client
CatalogServiceClient catalogServiceClient = CatalogServiceClient.Create();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]";
// Make the request
PagedEnumerable<ListCatalogsResponse, Catalog> response = catalogServiceClient.ListCatalogs(parent);
// Iterate over all response items, lazily performing RPCs as required
foreach (Catalog 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 (ListCatalogsResponse page in response.AsRawResponses())
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (Catalog 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<Catalog> 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 (Catalog 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;
ListCatalogsAsync(LocationName, String, Nullable<Int32>, CallSettings)
Lists all the [Catalog][google.cloud.retail.v2.Catalog]s associated with the project.
Declaration
public virtual PagedAsyncEnumerable<ListCatalogsResponse, Catalog> ListCatalogsAsync(LocationName parent, string pageToken = null, int? pageSize = default(int? ), CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
LocationName | parent | Required. The account resource name with an associated location. If the caller does not have permission to list [Catalog][google.cloud.retail.v2.Catalog]s under this location, regardless of whether or not this location exists, a PERMISSION_DENIED error is returned. |
System.String | pageToken | The token returned from the previous request. A value of |
System.Nullable<System.Int32> | 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<ListCatalogsResponse, Catalog> | A pageable asynchronous sequence of Catalog resources. |
Sample code
// Create client
CatalogServiceClient catalogServiceClient = await CatalogServiceClient.CreateAsync();
// Initialize request argument(s)
LocationName parent = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]");
// Make the request
PagedAsyncEnumerable<ListCatalogsResponse, Catalog> response = catalogServiceClient.ListCatalogsAsync(parent);
// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((Catalog 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((ListCatalogsResponse page) =>
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (Catalog 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<Catalog> 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 (Catalog 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;
ListCatalogsAsync(ListCatalogsRequest, CallSettings)
Lists all the [Catalog][google.cloud.retail.v2.Catalog]s associated with the project.
Declaration
public virtual PagedAsyncEnumerable<ListCatalogsResponse, Catalog> ListCatalogsAsync(ListCatalogsRequest request, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
ListCatalogsRequest | 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<ListCatalogsResponse, Catalog> | A pageable asynchronous sequence of Catalog resources. |
Sample code
// Create client
CatalogServiceClient catalogServiceClient = await CatalogServiceClient.CreateAsync();
// Initialize request argument(s)
ListCatalogsRequest request = new ListCatalogsRequest
{
ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
};
// Make the request
PagedAsyncEnumerable<ListCatalogsResponse, Catalog> response = catalogServiceClient.ListCatalogsAsync(request);
// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((Catalog 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((ListCatalogsResponse page) =>
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (Catalog 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<Catalog> 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 (Catalog 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;
ListCatalogsAsync(String, String, Nullable<Int32>, CallSettings)
Lists all the [Catalog][google.cloud.retail.v2.Catalog]s associated with the project.
Declaration
public virtual PagedAsyncEnumerable<ListCatalogsResponse, Catalog> ListCatalogsAsync(string parent, string pageToken = null, int? pageSize = default(int? ), CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | parent | Required. The account resource name with an associated location. If the caller does not have permission to list [Catalog][google.cloud.retail.v2.Catalog]s under this location, regardless of whether or not this location exists, a PERMISSION_DENIED error is returned. |
System.String | pageToken | The token returned from the previous request. A value of |
System.Nullable<System.Int32> | 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<ListCatalogsResponse, Catalog> | A pageable asynchronous sequence of Catalog resources. |
Sample code
// Create client
CatalogServiceClient catalogServiceClient = await CatalogServiceClient.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]";
// Make the request
PagedAsyncEnumerable<ListCatalogsResponse, Catalog> response = catalogServiceClient.ListCatalogsAsync(parent);
// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((Catalog 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((ListCatalogsResponse page) =>
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (Catalog 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<Catalog> 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 (Catalog 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 |
---|---|
System.Threading.Tasks.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.
UpdateCatalog(Catalog, FieldMask, CallSettings)
Updates the [Catalog][google.cloud.retail.v2.Catalog]s.
Declaration
public virtual Catalog UpdateCatalog(Catalog catalog, FieldMask updateMask, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
Catalog | catalog | Required. The [Catalog][google.cloud.retail.v2.Catalog] to update. If the caller does not have permission to update the [Catalog][google.cloud.retail.v2.Catalog], regardless of whether or not it exists, a PERMISSION_DENIED error is returned. If the [Catalog][google.cloud.retail.v2.Catalog] to update does not exist, a NOT_FOUND error is returned. |
FieldMask | updateMask | Indicates which fields in the provided [Catalog][google.cloud.retail.v2.Catalog] to update. If not set, will only update the [Catalog.product_level_config][google.cloud.retail.v2.Catalog.product_level_config] field, which is also the only currently supported field to update. If an unsupported or unknown field is provided, an INVALID_ARGUMENT error is returned. |
CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Returns
Type | Description |
---|---|
Catalog | The RPC response. |
Sample code
// Create client
CatalogServiceClient catalogServiceClient = CatalogServiceClient.Create();
// Initialize request argument(s)
Catalog catalog = new Catalog();
FieldMask updateMask = new FieldMask();
// Make the request
Catalog response = catalogServiceClient.UpdateCatalog(catalog, updateMask);
UpdateCatalog(UpdateCatalogRequest, CallSettings)
Updates the [Catalog][google.cloud.retail.v2.Catalog]s.
Declaration
public virtual Catalog UpdateCatalog(UpdateCatalogRequest request, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
UpdateCatalogRequest | 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 |
---|---|
Catalog | The RPC response. |
Sample code
// Create client
CatalogServiceClient catalogServiceClient = CatalogServiceClient.Create();
// Initialize request argument(s)
UpdateCatalogRequest request = new UpdateCatalogRequest
{
Catalog = new Catalog(),
UpdateMask = new FieldMask(),
};
// Make the request
Catalog response = catalogServiceClient.UpdateCatalog(request);
UpdateCatalogAsync(Catalog, FieldMask, CallSettings)
Updates the [Catalog][google.cloud.retail.v2.Catalog]s.
Declaration
public virtual Task<Catalog> UpdateCatalogAsync(Catalog catalog, FieldMask updateMask, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
Catalog | catalog | Required. The [Catalog][google.cloud.retail.v2.Catalog] to update. If the caller does not have permission to update the [Catalog][google.cloud.retail.v2.Catalog], regardless of whether or not it exists, a PERMISSION_DENIED error is returned. If the [Catalog][google.cloud.retail.v2.Catalog] to update does not exist, a NOT_FOUND error is returned. |
FieldMask | updateMask | Indicates which fields in the provided [Catalog][google.cloud.retail.v2.Catalog] to update. If not set, will only update the [Catalog.product_level_config][google.cloud.retail.v2.Catalog.product_level_config] field, which is also the only currently supported field to update. If an unsupported or unknown field is provided, an INVALID_ARGUMENT error is returned. |
CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<Catalog> | A Task containing the RPC response. |
Sample code
// Create client
CatalogServiceClient catalogServiceClient = await CatalogServiceClient.CreateAsync();
// Initialize request argument(s)
Catalog catalog = new Catalog();
FieldMask updateMask = new FieldMask();
// Make the request
Catalog response = await catalogServiceClient.UpdateCatalogAsync(catalog, updateMask);
UpdateCatalogAsync(Catalog, FieldMask, CancellationToken)
Updates the [Catalog][google.cloud.retail.v2.Catalog]s.
Declaration
public virtual Task<Catalog> UpdateCatalogAsync(Catalog catalog, FieldMask updateMask, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
Catalog | catalog | Required. The [Catalog][google.cloud.retail.v2.Catalog] to update. If the caller does not have permission to update the [Catalog][google.cloud.retail.v2.Catalog], regardless of whether or not it exists, a PERMISSION_DENIED error is returned. If the [Catalog][google.cloud.retail.v2.Catalog] to update does not exist, a NOT_FOUND error is returned. |
FieldMask | updateMask | Indicates which fields in the provided [Catalog][google.cloud.retail.v2.Catalog] to update. If not set, will only update the [Catalog.product_level_config][google.cloud.retail.v2.Catalog.product_level_config] field, which is also the only currently supported field to update. If an unsupported or unknown field is provided, an INVALID_ARGUMENT error is returned. |
System.Threading.CancellationToken | cancellationToken | A System.Threading.CancellationToken to use for this RPC. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<Catalog> | A Task containing the RPC response. |
Sample code
// Create client
CatalogServiceClient catalogServiceClient = await CatalogServiceClient.CreateAsync();
// Initialize request argument(s)
Catalog catalog = new Catalog();
FieldMask updateMask = new FieldMask();
// Make the request
Catalog response = await catalogServiceClient.UpdateCatalogAsync(catalog, updateMask);
UpdateCatalogAsync(UpdateCatalogRequest, CallSettings)
Updates the [Catalog][google.cloud.retail.v2.Catalog]s.
Declaration
public virtual Task<Catalog> UpdateCatalogAsync(UpdateCatalogRequest request, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
UpdateCatalogRequest | 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 |
---|---|
System.Threading.Tasks.Task<Catalog> | A Task containing the RPC response. |
Sample code
// Create client
CatalogServiceClient catalogServiceClient = await CatalogServiceClient.CreateAsync();
// Initialize request argument(s)
UpdateCatalogRequest request = new UpdateCatalogRequest
{
Catalog = new Catalog(),
UpdateMask = new FieldMask(),
};
// Make the request
Catalog response = await catalogServiceClient.UpdateCatalogAsync(request);
UpdateCatalogAsync(UpdateCatalogRequest, CancellationToken)
Updates the [Catalog][google.cloud.retail.v2.Catalog]s.
Declaration
public virtual Task<Catalog> UpdateCatalogAsync(UpdateCatalogRequest request, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
UpdateCatalogRequest | request | The request object containing all of the parameters for the API call. |
System.Threading.CancellationToken | cancellationToken | A System.Threading.CancellationToken to use for this RPC. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<Catalog> | A Task containing the RPC response. |
Sample code
// Create client
CatalogServiceClient catalogServiceClient = await CatalogServiceClient.CreateAsync();
// Initialize request argument(s)
UpdateCatalogRequest request = new UpdateCatalogRequest
{
Catalog = new Catalog(),
UpdateMask = new FieldMask(),
};
// Make the request
Catalog response = await catalogServiceClient.UpdateCatalogAsync(request);