- 0.64.0 (latest)
- 0.63.0
- 0.62.0
- 0.60.0
- 0.59.0
- 0.58.0
- 0.57.0
- 0.56.0
- 0.55.0
- 0.54.0
- 0.53.0
- 0.52.0
- 0.51.0
- 0.50.0
- 0.48.0
- 0.47.0
- 0.46.0
- 0.45.0
- 0.44.0
- 0.43.0
- 0.42.0
- 0.41.0
- 0.40.0
- 0.39.0
- 0.38.0
- 0.35.0
- 0.34.0
- 0.33.0
- 0.32.0
- 0.31.0
- 0.30.0
- 0.29.0
- 0.28.0
- 0.27.0
- 0.26.0
- 0.25.0
- 0.24.0
- 0.23.0
- 0.22.0
- 0.20.0
- 0.19.0
- 0.18.0
- 0.17.0
- 0.16.0
- 0.15.0
- 0.14.7
- 0.13.1
- 0.12.1
- 0.11.5
public class PagesClient implements BackgroundResource
Service Description: Service for managing Pages.
This class provides the ability to make remote calls to the backing service through method calls that map to API methods. Sample code to get started:
try (PagesClient pagesClient = PagesClient.create()) {
PageName name = PageName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[PAGE]");
Page response = pagesClient.getPage(name);
}
Note: close() needs to be called on the PagesClient object to clean up resources such as threads. In the example above, try-with-resources is used, which automatically calls close().
The surface of this class includes several types of Java methods for each of the API's methods:
- A "flattened" method. With this type of method, the fields of the request type have been converted into function parameters. It may be the case that not all fields are available as parameters, and not every API method will have a flattened method entry point.
- A "request object" method. This type of method only takes one parameter, a request object, which must be constructed before the call. Not every API method will have a request object method.
- A "callable" method. This type of method takes no parameters and returns an immutable API callable object, which can be used to initiate calls to the service.
See the individual methods for example code.
Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parse method to extract the individual identifiers contained within names that are returned.
This class can be customized by passing in a custom instance of PagesSettings to create(). For example:
To customize credentials:
PagesSettings pagesSettings =
PagesSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
PagesClient pagesClient = PagesClient.create(pagesSettings);
To customize the endpoint:
PagesSettings pagesSettings = PagesSettings.newBuilder().setEndpoint(myEndpoint).build();
PagesClient pagesClient = PagesClient.create(pagesSettings);
Please refer to the GitHub repository's samples for more quickstart code snippets.
Implements
BackgroundResourceStatic Methods
create()
public static final PagesClient create()
Constructs an instance of PagesClient with default settings.
Type | Description |
PagesClient |
Type | Description |
IOException |
create(PagesSettings settings)
public static final PagesClient create(PagesSettings settings)
Constructs an instance of PagesClient, using the given settings. The channels are created based on the settings passed in, or defaults for any settings that are not set.
Name | Description |
settings | PagesSettings |
Type | Description |
PagesClient |
Type | Description |
IOException |
create(PagesStub stub)
public static final PagesClient create(PagesStub stub)
Constructs an instance of PagesClient, using the given stub for making calls. This is for advanced usage - prefer using create(PagesSettings).
Name | Description |
stub | PagesStub |
Type | Description |
PagesClient |
Constructors
PagesClient(PagesSettings settings)
protected PagesClient(PagesSettings settings)
Constructs an instance of PagesClient, using the given settings. This is protected so that it is easy to make a subclass, but otherwise, the static factory methods should be preferred.
Name | Description |
settings | PagesSettings |
PagesClient(PagesStub stub)
protected PagesClient(PagesStub stub)
Name | Description |
stub | PagesStub |
Methods
awaitTermination(long duration, TimeUnit unit)
public boolean awaitTermination(long duration, TimeUnit unit)
Name | Description |
duration | long |
unit | TimeUnit |
Type | Description |
boolean |
Type | Description |
InterruptedException |
close()
public final void close()
createPage(CreatePageRequest request)
public final Page createPage(CreatePageRequest request)
Creates a page in the specified flow.
Note: You should always train a flow prior to sending it queries. See the training documentation.
Sample code:
try (PagesClient pagesClient = PagesClient.create()) {
CreatePageRequest request =
CreatePageRequest.newBuilder()
.setParent(FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]").toString())
.setPage(Page.newBuilder().build())
.setLanguageCode("languageCode-2092349083")
.build();
Page response = pagesClient.createPage(request);
}
Name | Description |
request | CreatePageRequest The request object containing all of the parameters for the API call. |
Type | Description |
Page |
createPage(FlowName parent, Page page)
public final Page createPage(FlowName parent, Page page)
Creates a page in the specified flow.
Note: You should always train a flow prior to sending it queries. See the training documentation.
Sample code:
try (PagesClient pagesClient = PagesClient.create()) {
FlowName parent = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]");
Page page = Page.newBuilder().build();
Page response = pagesClient.createPage(parent, page);
}
Name | Description |
parent | FlowName Required. The flow to create a page for. Format: |
page | Page Required. The page to create. |
Type | Description |
Page |
createPage(String parent, Page page)
public final Page createPage(String parent, Page page)
Creates a page in the specified flow.
Note: You should always train a flow prior to sending it queries. See the training documentation.
Sample code:
try (PagesClient pagesClient = PagesClient.create()) {
String parent = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]").toString();
Page page = Page.newBuilder().build();
Page response = pagesClient.createPage(parent, page);
}
Name | Description |
parent | String Required. The flow to create a page for. Format: |
page | Page Required. The page to create. |
Type | Description |
Page |
createPageCallable()
public final UnaryCallable<CreatePageRequest,Page> createPageCallable()
Creates a page in the specified flow.
Note: You should always train a flow prior to sending it queries. See the training documentation.
Sample code:
try (PagesClient pagesClient = PagesClient.create()) {
CreatePageRequest request =
CreatePageRequest.newBuilder()
.setParent(FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]").toString())
.setPage(Page.newBuilder().build())
.setLanguageCode("languageCode-2092349083")
.build();
ApiFuture<Page> future = pagesClient.createPageCallable().futureCall(request);
// Do something.
Page response = future.get();
}
Type | Description |
UnaryCallable<CreatePageRequest,Page> |
deletePage(DeletePageRequest request)
public final void deletePage(DeletePageRequest request)
Deletes the specified page.
Note: You should always train a flow prior to sending it queries. See the training documentation.
Sample code:
try (PagesClient pagesClient = PagesClient.create()) {
DeletePageRequest request =
DeletePageRequest.newBuilder()
.setName(
PageName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[PAGE]").toString())
.setForce(true)
.build();
pagesClient.deletePage(request);
}
Name | Description |
request | DeletePageRequest The request object containing all of the parameters for the API call. |
deletePage(PageName name)
public final void deletePage(PageName name)
Deletes the specified page.
Note: You should always train a flow prior to sending it queries. See the training documentation.
Sample code:
try (PagesClient pagesClient = PagesClient.create()) {
PageName name = PageName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[PAGE]");
pagesClient.deletePage(name);
}
Name | Description |
name | PageName Required. The name of the page to delete. Format: |
deletePage(String name)
public final void deletePage(String name)
Deletes the specified page.
Note: You should always train a flow prior to sending it queries. See the training documentation.
Sample code:
try (PagesClient pagesClient = PagesClient.create()) {
String name =
PageName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[PAGE]").toString();
pagesClient.deletePage(name);
}
Name | Description |
name | String Required. The name of the page to delete. Format: |
deletePageCallable()
public final UnaryCallable<DeletePageRequest,Empty> deletePageCallable()
Deletes the specified page.
Note: You should always train a flow prior to sending it queries. See the training documentation.
Sample code:
try (PagesClient pagesClient = PagesClient.create()) {
DeletePageRequest request =
DeletePageRequest.newBuilder()
.setName(
PageName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[PAGE]").toString())
.setForce(true)
.build();
ApiFuture<Empty> future = pagesClient.deletePageCallable().futureCall(request);
// Do something.
future.get();
}
Type | Description |
UnaryCallable<DeletePageRequest,Empty> |
getPage(GetPageRequest request)
public final Page getPage(GetPageRequest request)
Retrieves the specified page.
Sample code:
try (PagesClient pagesClient = PagesClient.create()) {
GetPageRequest request =
GetPageRequest.newBuilder()
.setName(
PageName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[PAGE]").toString())
.setLanguageCode("languageCode-2092349083")
.build();
Page response = pagesClient.getPage(request);
}
Name | Description |
request | GetPageRequest The request object containing all of the parameters for the API call. |
Type | Description |
Page |
getPage(PageName name)
public final Page getPage(PageName name)
Retrieves the specified page.
Sample code:
try (PagesClient pagesClient = PagesClient.create()) {
PageName name = PageName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[PAGE]");
Page response = pagesClient.getPage(name);
}
Name | Description |
name | PageName Required. The name of the page. Format: |
Type | Description |
Page |
getPage(String name)
public final Page getPage(String name)
Retrieves the specified page.
Sample code:
try (PagesClient pagesClient = PagesClient.create()) {
String name =
PageName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[PAGE]").toString();
Page response = pagesClient.getPage(name);
}
Name | Description |
name | String Required. The name of the page. Format: |
Type | Description |
Page |
getPageCallable()
public final UnaryCallable<GetPageRequest,Page> getPageCallable()
Retrieves the specified page.
Sample code:
try (PagesClient pagesClient = PagesClient.create()) {
GetPageRequest request =
GetPageRequest.newBuilder()
.setName(
PageName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[PAGE]").toString())
.setLanguageCode("languageCode-2092349083")
.build();
ApiFuture<Page> future = pagesClient.getPageCallable().futureCall(request);
// Do something.
Page response = future.get();
}
Type | Description |
UnaryCallable<GetPageRequest,Page> |
getSettings()
public final PagesSettings getSettings()
Type | Description |
PagesSettings |
getStub()
public PagesStub getStub()
Type | Description |
PagesStub |
isShutdown()
public boolean isShutdown()
Type | Description |
boolean |
isTerminated()
public boolean isTerminated()
Type | Description |
boolean |
listPages(FlowName parent)
public final PagesClient.ListPagesPagedResponse listPages(FlowName parent)
Returns the list of all pages in the specified flow.
Sample code:
try (PagesClient pagesClient = PagesClient.create()) {
FlowName parent = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]");
for (Page element : pagesClient.listPages(parent).iterateAll()) {
// doThingsWith(element);
}
}
Name | Description |
parent | FlowName Required. The flow to list all pages for. Format: |
Type | Description |
PagesClient.ListPagesPagedResponse |
listPages(ListPagesRequest request)
public final PagesClient.ListPagesPagedResponse listPages(ListPagesRequest request)
Returns the list of all pages in the specified flow.
Sample code:
try (PagesClient pagesClient = PagesClient.create()) {
ListPagesRequest request =
ListPagesRequest.newBuilder()
.setParent(FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]").toString())
.setLanguageCode("languageCode-2092349083")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
for (Page element : pagesClient.listPages(request).iterateAll()) {
// doThingsWith(element);
}
}
Name | Description |
request | ListPagesRequest The request object containing all of the parameters for the API call. |
Type | Description |
PagesClient.ListPagesPagedResponse |
listPages(String parent)
public final PagesClient.ListPagesPagedResponse listPages(String parent)
Returns the list of all pages in the specified flow.
Sample code:
try (PagesClient pagesClient = PagesClient.create()) {
String parent = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]").toString();
for (Page element : pagesClient.listPages(parent).iterateAll()) {
// doThingsWith(element);
}
}
Name | Description |
parent | String Required. The flow to list all pages for. Format: |
Type | Description |
PagesClient.ListPagesPagedResponse |
listPagesCallable()
public final UnaryCallable<ListPagesRequest,ListPagesResponse> listPagesCallable()
Returns the list of all pages in the specified flow.
Sample code:
try (PagesClient pagesClient = PagesClient.create()) {
ListPagesRequest request =
ListPagesRequest.newBuilder()
.setParent(FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]").toString())
.setLanguageCode("languageCode-2092349083")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
while (true) {
ListPagesResponse response = pagesClient.listPagesCallable().call(request);
for (Page element : response.getResponsesList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
Type | Description |
UnaryCallable<ListPagesRequest,ListPagesResponse> |
listPagesPagedCallable()
public final UnaryCallable<ListPagesRequest,PagesClient.ListPagesPagedResponse> listPagesPagedCallable()
Returns the list of all pages in the specified flow.
Sample code:
try (PagesClient pagesClient = PagesClient.create()) {
ListPagesRequest request =
ListPagesRequest.newBuilder()
.setParent(FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]").toString())
.setLanguageCode("languageCode-2092349083")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
ApiFuture<Page> future = pagesClient.listPagesPagedCallable().futureCall(request);
// Do something.
for (Page element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
Type | Description |
UnaryCallable<ListPagesRequest,ListPagesPagedResponse> |
shutdown()
public void shutdown()
shutdownNow()
public void shutdownNow()
updatePage(Page page, FieldMask updateMask)
public final Page updatePage(Page page, FieldMask updateMask)
Updates the specified page.
Note: You should always train a flow prior to sending it queries. See the training documentation.
Sample code:
try (PagesClient pagesClient = PagesClient.create()) {
Page page = Page.newBuilder().build();
FieldMask updateMask = FieldMask.newBuilder().build();
Page response = pagesClient.updatePage(page, updateMask);
}
Name | Description |
page | Page Required. The page to update. |
updateMask | FieldMask The mask to control which fields get updated. If the mask is not present, all fields will be updated. |
Type | Description |
Page |
updatePage(UpdatePageRequest request)
public final Page updatePage(UpdatePageRequest request)
Updates the specified page.
Note: You should always train a flow prior to sending it queries. See the training documentation.
Sample code:
try (PagesClient pagesClient = PagesClient.create()) {
UpdatePageRequest request =
UpdatePageRequest.newBuilder()
.setPage(Page.newBuilder().build())
.setLanguageCode("languageCode-2092349083")
.setUpdateMask(FieldMask.newBuilder().build())
.build();
Page response = pagesClient.updatePage(request);
}
Name | Description |
request | UpdatePageRequest The request object containing all of the parameters for the API call. |
Type | Description |
Page |
updatePageCallable()
public final UnaryCallable<UpdatePageRequest,Page> updatePageCallable()
Updates the specified page.
Note: You should always train a flow prior to sending it queries. See the training documentation.
Sample code:
try (PagesClient pagesClient = PagesClient.create()) {
UpdatePageRequest request =
UpdatePageRequest.newBuilder()
.setPage(Page.newBuilder().build())
.setLanguageCode("languageCode-2092349083")
.setUpdateMask(FieldMask.newBuilder().build())
.build();
ApiFuture<Page> future = pagesClient.updatePageCallable().futureCall(request);
// Do something.
Page response = future.get();
}
Type | Description |
UnaryCallable<UpdatePageRequest,Page> |