Class TeamServiceClient (0.5.0)

GitHub RepositoryProduct Reference

Service Description: Provides methods for handling Team objects.

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:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (TeamServiceClient teamServiceClient = TeamServiceClient.create()) {
   TeamName name = TeamName.of("[NETWORK_CODE]", "[TEAM]");
   Team response = teamServiceClient.getTeam(name);
 }
 

Note: close() needs to be called on the TeamServiceClient object to clean up resources such as threads. In the example above, try-with-resources is used, which automatically calls close().

Methods
Method Description Method Variants

GetTeam

API to retrieve a Team object.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • getTeam(GetTeamRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • getTeam(TeamName name)

  • getTeam(String name)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • getTeamCallable()

ListTeams

API to retrieve a list of Team objects.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • listTeams(ListTeamsRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • listTeams(NetworkName parent)

  • listTeams(String parent)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • listTeamsPagedCallable()

  • listTeamsCallable()

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 TeamServiceSettings to create(). For example:

To customize credentials:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 TeamServiceSettings teamServiceSettings =
     TeamServiceSettings.newBuilder()
         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
         .build();
 TeamServiceClient teamServiceClient = TeamServiceClient.create(teamServiceSettings);
 

To customize the endpoint:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 TeamServiceSettings teamServiceSettings =
     TeamServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
 TeamServiceClient teamServiceClient = TeamServiceClient.create(teamServiceSettings);
 

Please refer to the GitHub repository's samples for more quickstart code snippets.

Inheritance

java.lang.Object > TeamServiceClient

Static Methods

create()

public static final TeamServiceClient create()

Constructs an instance of TeamServiceClient with default settings.

Returns
Type Description
TeamServiceClient
Exceptions
Type Description
IOException

create(TeamServiceSettings settings)

public static final TeamServiceClient create(TeamServiceSettings settings)

Constructs an instance of TeamServiceClient, using the given settings. The channels are created based on the settings passed in, or defaults for any settings that are not set.

Parameter
Name Description
settings TeamServiceSettings
Returns
Type Description
TeamServiceClient
Exceptions
Type Description
IOException

create(TeamServiceStub stub)

public static final TeamServiceClient create(TeamServiceStub stub)

Constructs an instance of TeamServiceClient, using the given stub for making calls. This is for advanced usage - prefer using create(TeamServiceSettings).

Parameter
Name Description
stub TeamServiceStub
Returns
Type Description
TeamServiceClient

Constructors

TeamServiceClient(TeamServiceSettings settings)

protected TeamServiceClient(TeamServiceSettings settings)

Constructs an instance of TeamServiceClient, 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.

Parameter
Name Description
settings TeamServiceSettings

TeamServiceClient(TeamServiceStub stub)

protected TeamServiceClient(TeamServiceStub stub)
Parameter
Name Description
stub TeamServiceStub

Methods

awaitTermination(long duration, TimeUnit unit)

public boolean awaitTermination(long duration, TimeUnit unit)
Parameters
Name Description
duration long
unit TimeUnit
Returns
Type Description
boolean
Exceptions
Type Description
InterruptedException

close()

public final void close()

getSettings()

public final TeamServiceSettings getSettings()
Returns
Type Description
TeamServiceSettings

getStub()

public TeamServiceStub getStub()
Returns
Type Description
TeamServiceStub

getTeam(GetTeamRequest request)

public final Team getTeam(GetTeamRequest request)

API to retrieve a Team object.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (TeamServiceClient teamServiceClient = TeamServiceClient.create()) {
   GetTeamRequest request =
       GetTeamRequest.newBuilder()
           .setName(TeamName.of("[NETWORK_CODE]", "[TEAM]").toString())
           .build();
   Team response = teamServiceClient.getTeam(request);
 }
 
Parameter
Name Description
request GetTeamRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
Team

getTeam(TeamName name)

public final Team getTeam(TeamName name)

API to retrieve a Team object.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (TeamServiceClient teamServiceClient = TeamServiceClient.create()) {
   TeamName name = TeamName.of("[NETWORK_CODE]", "[TEAM]");
   Team response = teamServiceClient.getTeam(name);
 }
 
Parameter
Name Description
name TeamName

Required. The resource name of the Team. Format: networks/{network_code}/teams/{team_id}

Returns
Type Description
Team

getTeam(String name)

public final Team getTeam(String name)

API to retrieve a Team object.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (TeamServiceClient teamServiceClient = TeamServiceClient.create()) {
   String name = TeamName.of("[NETWORK_CODE]", "[TEAM]").toString();
   Team response = teamServiceClient.getTeam(name);
 }
 
Parameter
Name Description
name String

Required. The resource name of the Team. Format: networks/{network_code}/teams/{team_id}

Returns
Type Description
Team

getTeamCallable()

public final UnaryCallable<GetTeamRequest,Team> getTeamCallable()

API to retrieve a Team object.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (TeamServiceClient teamServiceClient = TeamServiceClient.create()) {
   GetTeamRequest request =
       GetTeamRequest.newBuilder()
           .setName(TeamName.of("[NETWORK_CODE]", "[TEAM]").toString())
           .build();
   ApiFuture<Team> future = teamServiceClient.getTeamCallable().futureCall(request);
   // Do something.
   Team response = future.get();
 }
 
Returns
Type Description
UnaryCallable<GetTeamRequest,Team>

isShutdown()

public boolean isShutdown()
Returns
Type Description
boolean

isTerminated()

public boolean isTerminated()
Returns
Type Description
boolean

listTeams(ListTeamsRequest request)

public final TeamServiceClient.ListTeamsPagedResponse listTeams(ListTeamsRequest request)

API to retrieve a list of Team objects.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (TeamServiceClient teamServiceClient = TeamServiceClient.create()) {
   ListTeamsRequest request =
       ListTeamsRequest.newBuilder()
           .setParent(NetworkName.of("[NETWORK_CODE]").toString())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .setFilter("filter-1274492040")
           .setOrderBy("orderBy-1207110587")
           .setSkip(3532159)
           .build();
   for (Team element : teamServiceClient.listTeams(request).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
Name Description
request ListTeamsRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
TeamServiceClient.ListTeamsPagedResponse

listTeams(NetworkName parent)

public final TeamServiceClient.ListTeamsPagedResponse listTeams(NetworkName parent)

API to retrieve a list of Team objects.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (TeamServiceClient teamServiceClient = TeamServiceClient.create()) {
   NetworkName parent = NetworkName.of("[NETWORK_CODE]");
   for (Team element : teamServiceClient.listTeams(parent).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
Name Description
parent NetworkName

Required. The parent, which owns this collection of Teams. Format: networks/{network_code}

Returns
Type Description
TeamServiceClient.ListTeamsPagedResponse

listTeams(String parent)

public final TeamServiceClient.ListTeamsPagedResponse listTeams(String parent)

API to retrieve a list of Team objects.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (TeamServiceClient teamServiceClient = TeamServiceClient.create()) {
   String parent = NetworkName.of("[NETWORK_CODE]").toString();
   for (Team element : teamServiceClient.listTeams(parent).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
Name Description
parent String

Required. The parent, which owns this collection of Teams. Format: networks/{network_code}

Returns
Type Description
TeamServiceClient.ListTeamsPagedResponse

listTeamsCallable()

public final UnaryCallable<ListTeamsRequest,ListTeamsResponse> listTeamsCallable()

API to retrieve a list of Team objects.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (TeamServiceClient teamServiceClient = TeamServiceClient.create()) {
   ListTeamsRequest request =
       ListTeamsRequest.newBuilder()
           .setParent(NetworkName.of("[NETWORK_CODE]").toString())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .setFilter("filter-1274492040")
           .setOrderBy("orderBy-1207110587")
           .setSkip(3532159)
           .build();
   while (true) {
     ListTeamsResponse response = teamServiceClient.listTeamsCallable().call(request);
     for (Team element : response.getTeamsList()) {
       // doThingsWith(element);
     }
     String nextPageToken = response.getNextPageToken();
     if (!Strings.isNullOrEmpty(nextPageToken)) {
       request = request.toBuilder().setPageToken(nextPageToken).build();
     } else {
       break;
     }
   }
 }
 
Returns
Type Description
UnaryCallable<ListTeamsRequest,ListTeamsResponse>

listTeamsPagedCallable()

public final UnaryCallable<ListTeamsRequest,TeamServiceClient.ListTeamsPagedResponse> listTeamsPagedCallable()

API to retrieve a list of Team objects.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (TeamServiceClient teamServiceClient = TeamServiceClient.create()) {
   ListTeamsRequest request =
       ListTeamsRequest.newBuilder()
           .setParent(NetworkName.of("[NETWORK_CODE]").toString())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .setFilter("filter-1274492040")
           .setOrderBy("orderBy-1207110587")
           .setSkip(3532159)
           .build();
   ApiFuture<Team> future = teamServiceClient.listTeamsPagedCallable().futureCall(request);
   // Do something.
   for (Team element : future.get().iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Returns
Type Description
UnaryCallable<ListTeamsRequest,ListTeamsPagedResponse>

shutdown()

public void shutdown()

shutdownNow()

public void shutdownNow()