public abstract class EnvironmentsClient
Environments client wrapper, for convenient use.
Derived Types
Namespace
Google.Cloud.Dialogflow.V2Assembly
Google.Cloud.Dialogflow.V2.dll
Remarks
Service for managing [Environments][google.cloud.dialogflow.v2.Environment].
Properties
DefaultEndpoint
public static string DefaultEndpoint { get; }
The default endpoint for the Environments service, which is a host of "dialogflow.googleapis.com" and a port of 443.
Property Value | |
---|---|
Type | Description |
String |
DefaultScopes
public static IReadOnlyList<string> DefaultScopes { get; }
The default Environments scopes.
Property Value | |
---|---|
Type | Description |
IReadOnlyList<String> |
The default Environments scopes are:
GrpcClient
public virtual Environments.EnvironmentsClient GrpcClient { get; }
The underlying gRPC Environments client
Property Value | |
---|---|
Type | Description |
Environments.EnvironmentsClient |
Methods
Create()
public static EnvironmentsClient Create()
Synchronously creates a EnvironmentsClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use EnvironmentsClientBuilder.
Returns | |
---|---|
Type | Description |
EnvironmentsClient | The created EnvironmentsClient. |
CreateAsync(CancellationToken)
public static Task<EnvironmentsClient> CreateAsync(CancellationToken cancellationToken = default(CancellationToken))
Asynchronously creates a EnvironmentsClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use EnvironmentsClientBuilder.
Parameter | |
---|---|
Name | Description |
cancellationToken | CancellationToken The CancellationToken to use while creating the client. |
Returns | |
---|---|
Type | Description |
Task<EnvironmentsClient> | The task representing the created EnvironmentsClient. |
ListEnvironments(ListEnvironmentsRequest, CallSettings)
public virtual PagedEnumerable<ListEnvironmentsResponse, Environment> ListEnvironments(ListEnvironmentsRequest request, CallSettings callSettings = null)
Returns the list of all non-draft environments of the specified agent.
Parameters | |
---|---|
Name | Description |
request | ListEnvironmentsRequest 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<ListEnvironmentsResponse, Environment> | A pageable sequence of Environment resources. |
// Create client
EnvironmentsClient environmentsClient = EnvironmentsClient.Create();
// Initialize request argument(s)
ListEnvironmentsRequest request = new ListEnvironmentsRequest
{
ParentAsAgentName = AgentName.FromProject("[PROJECT]"),
};
// Make the request
PagedEnumerable<ListEnvironmentsResponse, gcdv::Environment> response = environmentsClient.ListEnvironments(request);
// Iterate over all response items, lazily performing RPCs as required
foreach (gcdv::Environment 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 (ListEnvironmentsResponse page in response.AsRawResponses())
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (gcdv::Environment 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<gcdv::Environment> 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 (gcdv::Environment 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;
ListEnvironmentsAsync(ListEnvironmentsRequest, CallSettings)
public virtual PagedAsyncEnumerable<ListEnvironmentsResponse, Environment> ListEnvironmentsAsync(ListEnvironmentsRequest request, CallSettings callSettings = null)
Returns the list of all non-draft environments of the specified agent.
Parameters | |
---|---|
Name | Description |
request | ListEnvironmentsRequest 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<ListEnvironmentsResponse, Environment> | A pageable asynchronous sequence of Environment resources. |
// Create client
EnvironmentsClient environmentsClient = await EnvironmentsClient.CreateAsync();
// Initialize request argument(s)
ListEnvironmentsRequest request = new ListEnvironmentsRequest
{
ParentAsAgentName = AgentName.FromProject("[PROJECT]"),
};
// Make the request
PagedAsyncEnumerable<ListEnvironmentsResponse, gcdv::Environment> response = environmentsClient.ListEnvironmentsAsync(request);
// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((gcdv::Environment 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((ListEnvironmentsResponse page) =>
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (gcdv::Environment 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<gcdv::Environment> 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 (gcdv::Environment 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()
public static Task ShutdownDefaultChannelsAsync()
Shuts down any channels automatically created by Create() and CreateAsync(CancellationToken). Channels which weren't automatically created are not affected.
Returns | |
---|---|
Type | Description |
Task | A task representing the asynchronous shutdown operation. |
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.