Class UserServiceClient (0.62.0)

GitHub RepositoryProduct Reference

Service Description: Provides methods for handling User 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 (UserServiceClient userServiceClient = UserServiceClient.create()) {
   UserName name = UserName.of("[NETWORK_CODE]", "[USER]");
   User response = userServiceClient.getUser(name);
 }
 

Note: close() needs to be called on the UserServiceClient 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

GetUser

Retrieves a User object.

To get the current user, the resource name networks/{networkCode}/users/me can be used.

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

  • getUser(GetUserRequest request)

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

  • getUser(UserName name)

  • getUser(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.

  • getUserCallable()

ListUsers

Lists User objects.

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

  • listUsers(ListUsersRequest request)

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

  • listUsers(NetworkName parent)

  • listUsers(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.

  • listUsersPagedCallable()

  • listUsersCallable()

CreateUser

Creates a User object.

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

  • createUser(CreateUserRequest request)

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

  • createUser(NetworkName parent, User user)

  • createUser(String parent, User user)

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

  • createUserCallable()

BatchCreateUsers

Creates User objects.

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

  • batchCreateUsers(NetworkName parent, List<CreateUserRequest> requests)

  • batchCreateUsers(String parent, List<CreateUserRequest> requests)

  • batchCreateUsers(BatchCreateUsersRequest request)

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

  • batchCreateUsersCallable()

BatchActivateUsers

Activates a list of User objects.

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

  • batchActivateUsers(BatchActivateUsersRequest request)

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

  • batchActivateUsers(NetworkName parent, List<String> names)

  • batchActivateUsers(String parent, List<String> names)

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

  • batchActivateUsersCallable()

BatchDeactivateUsers

Deactivates a list of User objects.

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

  • batchDeactivateUsers(BatchDeactivateUsersRequest request)

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

  • batchDeactivateUsers(NetworkName parent, List<String> names)

  • batchDeactivateUsers(String parent, List<String> names)

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

  • batchDeactivateUsersCallable()

UpdateUser

Updates a User object.

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

  • updateUser(UpdateUserRequest request)

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

  • updateUser(User user, FieldMask updateMask)

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

  • updateUserCallable()

BatchUpdateUsers

Batch updates User objects.

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

  • batchUpdateUsers(NetworkName parent, List<UpdateUserRequest> requests)

  • batchUpdateUsers(String parent, List<UpdateUserRequest> requests)

  • batchUpdateUsers(BatchUpdateUsersRequest request)

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

  • batchUpdateUsersCallable()

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 UserServiceSettings 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
 UserServiceSettings userServiceSettings =
     UserServiceSettings.newBuilder()
         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
         .build();
 UserServiceClient userServiceClient = UserServiceClient.create(userServiceSettings);
 

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
 UserServiceSettings userServiceSettings =
     UserServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
 UserServiceClient userServiceClient = UserServiceClient.create(userServiceSettings);
 

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

Inheritance

java.lang.Object > UserServiceClient

Static Methods

create()

public static final UserServiceClient create()

Constructs an instance of UserServiceClient with default settings.

Returns
Type Description
UserServiceClient
Exceptions
Type Description
IOException

create(UserServiceSettings settings)

public static final UserServiceClient create(UserServiceSettings settings)

Constructs an instance of UserServiceClient, 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 UserServiceSettings
Returns
Type Description
UserServiceClient
Exceptions
Type Description
IOException

create(UserServiceStub stub)

public static final UserServiceClient create(UserServiceStub stub)

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

Parameter
Name Description
stub UserServiceStub
Returns
Type Description
UserServiceClient

Constructors

UserServiceClient(UserServiceSettings settings)

protected UserServiceClient(UserServiceSettings settings)

Constructs an instance of UserServiceClient, 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 UserServiceSettings

UserServiceClient(UserServiceStub stub)

protected UserServiceClient(UserServiceStub stub)
Parameter
Name Description
stub UserServiceStub

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

batchActivateUsers(@Nullable NetworkName parent, List<String> names)

public final BatchActivateUsersResponse batchActivateUsers(@Nullable NetworkName parent, List<String> names)

Activates a list of User 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 (UserServiceClient userServiceClient = UserServiceClient.create()) {
   NetworkName parent = NetworkName.of("[NETWORK_CODE]");
   List<String> names = new ArrayList<>();
   BatchActivateUsersResponse response = userServiceClient.batchActivateUsers(parent, names);
 }
 
Parameters
Name Description
parent @org.jspecify.annotations.Nullable com.google.ads.admanager.v1.NetworkName

Required. Format: networks/{network_code}

names List<String>

Required. The resource names of the User objects to activate.

Returns
Type Description
BatchActivateUsersResponse

batchActivateUsers(BatchActivateUsersRequest request)

public final BatchActivateUsersResponse batchActivateUsers(BatchActivateUsersRequest request)

Activates a list of User 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 (UserServiceClient userServiceClient = UserServiceClient.create()) {
   BatchActivateUsersRequest request =
       BatchActivateUsersRequest.newBuilder()
           .setParent(NetworkName.of("[NETWORK_CODE]").toString())
           .addAllNames(new ArrayList<String>())
           .build();
   BatchActivateUsersResponse response = userServiceClient.batchActivateUsers(request);
 }
 
Parameter
Name Description
request BatchActivateUsersRequest

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

Returns
Type Description
BatchActivateUsersResponse

batchActivateUsers(String parent, List<String> names)

public final BatchActivateUsersResponse batchActivateUsers(String parent, List<String> names)

Activates a list of User 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 (UserServiceClient userServiceClient = UserServiceClient.create()) {
   String parent = NetworkName.of("[NETWORK_CODE]").toString();
   List<String> names = new ArrayList<>();
   BatchActivateUsersResponse response = userServiceClient.batchActivateUsers(parent, names);
 }
 
Parameters
Name Description
parent String

Required. Format: networks/{network_code}

names List<String>

Required. The resource names of the User objects to activate.

Returns
Type Description
BatchActivateUsersResponse

batchActivateUsersCallable()

public final UnaryCallable<BatchActivateUsersRequest,BatchActivateUsersResponse> batchActivateUsersCallable()

Activates a list of User 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 (UserServiceClient userServiceClient = UserServiceClient.create()) {
   BatchActivateUsersRequest request =
       BatchActivateUsersRequest.newBuilder()
           .setParent(NetworkName.of("[NETWORK_CODE]").toString())
           .addAllNames(new ArrayList<String>())
           .build();
   ApiFuture<BatchActivateUsersResponse> future =
       userServiceClient.batchActivateUsersCallable().futureCall(request);
   // Do something.
   BatchActivateUsersResponse response = future.get();
 }
 
Returns
Type Description
UnaryCallable<BatchActivateUsersRequest,BatchActivateUsersResponse>

batchCreateUsers(@Nullable NetworkName parent, List<CreateUserRequest> requests)

public final BatchCreateUsersResponse batchCreateUsers(@Nullable NetworkName parent, List<CreateUserRequest> requests)

Creates User 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 (UserServiceClient userServiceClient = UserServiceClient.create()) {
   NetworkName parent = NetworkName.of("[NETWORK_CODE]");
   List<CreateUserRequest> requests = new ArrayList<>();
   BatchCreateUsersResponse response = userServiceClient.batchCreateUsers(parent, requests);
 }
 
Parameters
Name Description
parent @org.jspecify.annotations.Nullable com.google.ads.admanager.v1.NetworkName

Required. The parent resource where Users will be created. Format: networks/{network_code} The parent field in the CreateUserRequest must match this field.

requests List<CreateUserRequest>

Required. The User objects to create. A maximum of 100 objects can be created in a batch.

Returns
Type Description
BatchCreateUsersResponse

batchCreateUsers(BatchCreateUsersRequest request)

public final BatchCreateUsersResponse batchCreateUsers(BatchCreateUsersRequest request)

Creates User 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 (UserServiceClient userServiceClient = UserServiceClient.create()) {
   BatchCreateUsersRequest request =
       BatchCreateUsersRequest.newBuilder()
           .setParent(NetworkName.of("[NETWORK_CODE]").toString())
           .addAllRequests(new ArrayList<CreateUserRequest>())
           .build();
   BatchCreateUsersResponse response = userServiceClient.batchCreateUsers(request);
 }
 
Parameter
Name Description
request BatchCreateUsersRequest

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

Returns
Type Description
BatchCreateUsersResponse

batchCreateUsers(String parent, List<CreateUserRequest> requests)

public final BatchCreateUsersResponse batchCreateUsers(String parent, List<CreateUserRequest> requests)

Creates User 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 (UserServiceClient userServiceClient = UserServiceClient.create()) {
   String parent = NetworkName.of("[NETWORK_CODE]").toString();
   List<CreateUserRequest> requests = new ArrayList<>();
   BatchCreateUsersResponse response = userServiceClient.batchCreateUsers(parent, requests);
 }
 
Parameters
Name Description
parent String

Required. The parent resource where Users will be created. Format: networks/{network_code} The parent field in the CreateUserRequest must match this field.

requests List<CreateUserRequest>

Required. The User objects to create. A maximum of 100 objects can be created in a batch.

Returns
Type Description
BatchCreateUsersResponse

batchCreateUsersCallable()

public final UnaryCallable<BatchCreateUsersRequest,BatchCreateUsersResponse> batchCreateUsersCallable()

Creates User 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 (UserServiceClient userServiceClient = UserServiceClient.create()) {
   BatchCreateUsersRequest request =
       BatchCreateUsersRequest.newBuilder()
           .setParent(NetworkName.of("[NETWORK_CODE]").toString())
           .addAllRequests(new ArrayList<CreateUserRequest>())
           .build();
   ApiFuture<BatchCreateUsersResponse> future =
       userServiceClient.batchCreateUsersCallable().futureCall(request);
   // Do something.
   BatchCreateUsersResponse response = future.get();
 }
 
Returns
Type Description
UnaryCallable<BatchCreateUsersRequest,BatchCreateUsersResponse>

batchDeactivateUsers(@Nullable NetworkName parent, List<String> names)

public final BatchDeactivateUsersResponse batchDeactivateUsers(@Nullable NetworkName parent, List<String> names)

Deactivates a list of User 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 (UserServiceClient userServiceClient = UserServiceClient.create()) {
   NetworkName parent = NetworkName.of("[NETWORK_CODE]");
   List<String> names = new ArrayList<>();
   BatchDeactivateUsersResponse response = userServiceClient.batchDeactivateUsers(parent, names);
 }
 
Parameters
Name Description
parent @org.jspecify.annotations.Nullable com.google.ads.admanager.v1.NetworkName

Required. Format: networks/{network_code}

names List<String>

Required. The resource names of the User objects to deactivate.

Returns
Type Description
BatchDeactivateUsersResponse

batchDeactivateUsers(BatchDeactivateUsersRequest request)

public final BatchDeactivateUsersResponse batchDeactivateUsers(BatchDeactivateUsersRequest request)

Deactivates a list of User 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 (UserServiceClient userServiceClient = UserServiceClient.create()) {
   BatchDeactivateUsersRequest request =
       BatchDeactivateUsersRequest.newBuilder()
           .setParent(NetworkName.of("[NETWORK_CODE]").toString())
           .addAllNames(new ArrayList<String>())
           .build();
   BatchDeactivateUsersResponse response = userServiceClient.batchDeactivateUsers(request);
 }
 
Parameter
Name Description
request BatchDeactivateUsersRequest

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

Returns
Type Description
BatchDeactivateUsersResponse

batchDeactivateUsers(String parent, List<String> names)

public final BatchDeactivateUsersResponse batchDeactivateUsers(String parent, List<String> names)

Deactivates a list of User 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 (UserServiceClient userServiceClient = UserServiceClient.create()) {
   String parent = NetworkName.of("[NETWORK_CODE]").toString();
   List<String> names = new ArrayList<>();
   BatchDeactivateUsersResponse response = userServiceClient.batchDeactivateUsers(parent, names);
 }
 
Parameters
Name Description
parent String

Required. Format: networks/{network_code}

names List<String>

Required. The resource names of the User objects to deactivate.

Returns
Type Description
BatchDeactivateUsersResponse

batchDeactivateUsersCallable()

public final UnaryCallable<BatchDeactivateUsersRequest,BatchDeactivateUsersResponse> batchDeactivateUsersCallable()

Deactivates a list of User 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 (UserServiceClient userServiceClient = UserServiceClient.create()) {
   BatchDeactivateUsersRequest request =
       BatchDeactivateUsersRequest.newBuilder()
           .setParent(NetworkName.of("[NETWORK_CODE]").toString())
           .addAllNames(new ArrayList<String>())
           .build();
   ApiFuture<BatchDeactivateUsersResponse> future =
       userServiceClient.batchDeactivateUsersCallable().futureCall(request);
   // Do something.
   BatchDeactivateUsersResponse response = future.get();
 }
 
Returns
Type Description
UnaryCallable<BatchDeactivateUsersRequest,BatchDeactivateUsersResponse>

batchUpdateUsers(@Nullable NetworkName parent, List<UpdateUserRequest> requests)

public final BatchUpdateUsersResponse batchUpdateUsers(@Nullable NetworkName parent, List<UpdateUserRequest> requests)

Batch updates User 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 (UserServiceClient userServiceClient = UserServiceClient.create()) {
   NetworkName parent = NetworkName.of("[NETWORK_CODE]");
   List<UpdateUserRequest> requests = new ArrayList<>();
   BatchUpdateUsersResponse response = userServiceClient.batchUpdateUsers(parent, requests);
 }
 
Parameters
Name Description
parent @org.jspecify.annotations.Nullable com.google.ads.admanager.v1.NetworkName

Required. The parent resource where Users will be updated. Format: networks/{network_code} The parent field in the UpdateUserRequest must match this field.

requests List<UpdateUserRequest>

Required. The User objects to update. A maximum of 100 objects can be updated in a batch.

Returns
Type Description
BatchUpdateUsersResponse

batchUpdateUsers(BatchUpdateUsersRequest request)

public final BatchUpdateUsersResponse batchUpdateUsers(BatchUpdateUsersRequest request)

Batch updates User 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 (UserServiceClient userServiceClient = UserServiceClient.create()) {
   BatchUpdateUsersRequest request =
       BatchUpdateUsersRequest.newBuilder()
           .setParent(NetworkName.of("[NETWORK_CODE]").toString())
           .addAllRequests(new ArrayList<UpdateUserRequest>())
           .build();
   BatchUpdateUsersResponse response = userServiceClient.batchUpdateUsers(request);
 }
 
Parameter
Name Description
request BatchUpdateUsersRequest

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

Returns
Type Description
BatchUpdateUsersResponse

batchUpdateUsers(String parent, List<UpdateUserRequest> requests)

public final BatchUpdateUsersResponse batchUpdateUsers(String parent, List<UpdateUserRequest> requests)

Batch updates User 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 (UserServiceClient userServiceClient = UserServiceClient.create()) {
   String parent = NetworkName.of("[NETWORK_CODE]").toString();
   List<UpdateUserRequest> requests = new ArrayList<>();
   BatchUpdateUsersResponse response = userServiceClient.batchUpdateUsers(parent, requests);
 }
 
Parameters
Name Description
parent String

Required. The parent resource where Users will be updated. Format: networks/{network_code} The parent field in the UpdateUserRequest must match this field.

requests List<UpdateUserRequest>

Required. The User objects to update. A maximum of 100 objects can be updated in a batch.

Returns
Type Description
BatchUpdateUsersResponse

batchUpdateUsersCallable()

public final UnaryCallable<BatchUpdateUsersRequest,BatchUpdateUsersResponse> batchUpdateUsersCallable()

Batch updates User 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 (UserServiceClient userServiceClient = UserServiceClient.create()) {
   BatchUpdateUsersRequest request =
       BatchUpdateUsersRequest.newBuilder()
           .setParent(NetworkName.of("[NETWORK_CODE]").toString())
           .addAllRequests(new ArrayList<UpdateUserRequest>())
           .build();
   ApiFuture<BatchUpdateUsersResponse> future =
       userServiceClient.batchUpdateUsersCallable().futureCall(request);
   // Do something.
   BatchUpdateUsersResponse response = future.get();
 }
 
Returns
Type Description
UnaryCallable<BatchUpdateUsersRequest,BatchUpdateUsersResponse>

close()

public final void close()

createUser(@Nullable NetworkName parent, User user)

public final User createUser(@Nullable NetworkName parent, User user)

Creates a User 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 (UserServiceClient userServiceClient = UserServiceClient.create()) {
   NetworkName parent = NetworkName.of("[NETWORK_CODE]");
   User user = User.newBuilder().build();
   User response = userServiceClient.createUser(parent, user);
 }
 
Parameters
Name Description
parent @org.jspecify.annotations.Nullable com.google.ads.admanager.v1.NetworkName

Required. The parent resource where this User will be created. Format: networks/{network_code}

user User

Required. The User to create.

Returns
Type Description
User

createUser(CreateUserRequest request)

public final User createUser(CreateUserRequest request)

Creates a User 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 (UserServiceClient userServiceClient = UserServiceClient.create()) {
   CreateUserRequest request =
       CreateUserRequest.newBuilder()
           .setParent(NetworkName.of("[NETWORK_CODE]").toString())
           .setUser(User.newBuilder().build())
           .build();
   User response = userServiceClient.createUser(request);
 }
 
Parameter
Name Description
request CreateUserRequest

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

Returns
Type Description
User

createUser(String parent, User user)

public final User createUser(String parent, User user)

Creates a User 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 (UserServiceClient userServiceClient = UserServiceClient.create()) {
   String parent = NetworkName.of("[NETWORK_CODE]").toString();
   User user = User.newBuilder().build();
   User response = userServiceClient.createUser(parent, user);
 }
 
Parameters
Name Description
parent String

Required. The parent resource where this User will be created. Format: networks/{network_code}

user User

Required. The User to create.

Returns
Type Description
User

createUserCallable()

public final UnaryCallable<CreateUserRequest,User> createUserCallable()

Creates a User 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 (UserServiceClient userServiceClient = UserServiceClient.create()) {
   CreateUserRequest request =
       CreateUserRequest.newBuilder()
           .setParent(NetworkName.of("[NETWORK_CODE]").toString())
           .setUser(User.newBuilder().build())
           .build();
   ApiFuture<User> future = userServiceClient.createUserCallable().futureCall(request);
   // Do something.
   User response = future.get();
 }
 
Returns
Type Description
UnaryCallable<CreateUserRequest,User>

getSettings()

public final @Nullable UserServiceSettings getSettings()
Returns
Type Description
@org.jspecify.annotations.Nullable com.google.ads.admanager.v1.UserServiceSettings

getStub()

public UserServiceStub getStub()
Returns
Type Description
UserServiceStub

getUser(@Nullable UserName name)

public final User getUser(@Nullable UserName name)

Retrieves a User object.

To get the current user, the resource name networks/{networkCode}/users/me can be used.

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 (UserServiceClient userServiceClient = UserServiceClient.create()) {
   UserName name = UserName.of("[NETWORK_CODE]", "[USER]");
   User response = userServiceClient.getUser(name);
 }
 
Parameter
Name Description
name @org.jspecify.annotations.Nullable com.google.ads.admanager.v1.UserName

Required. The resource name of the User. Format: networks/{network_code}/users/{user_id}

Returns
Type Description
User

getUser(GetUserRequest request)

public final User getUser(GetUserRequest request)

Retrieves a User object.

To get the current user, the resource name networks/{networkCode}/users/me can be used.

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 (UserServiceClient userServiceClient = UserServiceClient.create()) {
   GetUserRequest request =
       GetUserRequest.newBuilder()
           .setName(UserName.of("[NETWORK_CODE]", "[USER]").toString())
           .build();
   User response = userServiceClient.getUser(request);
 }
 
Parameter
Name Description
request GetUserRequest

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

Returns
Type Description
User

getUser(String name)

public final User getUser(String name)

Retrieves a User object.

To get the current user, the resource name networks/{networkCode}/users/me can be used.

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 (UserServiceClient userServiceClient = UserServiceClient.create()) {
   String name = UserName.of("[NETWORK_CODE]", "[USER]").toString();
   User response = userServiceClient.getUser(name);
 }
 
Parameter
Name Description
name String

Required. The resource name of the User. Format: networks/{network_code}/users/{user_id}

Returns
Type Description
User

getUserCallable()

public final UnaryCallable<GetUserRequest,User> getUserCallable()

Retrieves a User object.

To get the current user, the resource name networks/{networkCode}/users/me can be used.

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 (UserServiceClient userServiceClient = UserServiceClient.create()) {
   GetUserRequest request =
       GetUserRequest.newBuilder()
           .setName(UserName.of("[NETWORK_CODE]", "[USER]").toString())
           .build();
   ApiFuture<User> future = userServiceClient.getUserCallable().futureCall(request);
   // Do something.
   User response = future.get();
 }
 
Returns
Type Description
UnaryCallable<GetUserRequest,User>

isShutdown()

public boolean isShutdown()
Returns
Type Description
boolean

isTerminated()

public boolean isTerminated()
Returns
Type Description
boolean

listUsers(@Nullable NetworkName parent)

public final UserServiceClient.ListUsersPagedResponse listUsers(@Nullable NetworkName parent)

Lists User 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 (UserServiceClient userServiceClient = UserServiceClient.create()) {
   NetworkName parent = NetworkName.of("[NETWORK_CODE]");
   for (User element : userServiceClient.listUsers(parent).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
Name Description
parent @org.jspecify.annotations.Nullable com.google.ads.admanager.v1.NetworkName

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

Returns
Type Description
UserServiceClient.ListUsersPagedResponse

listUsers(ListUsersRequest request)

public final UserServiceClient.ListUsersPagedResponse listUsers(ListUsersRequest request)

Lists User 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 (UserServiceClient userServiceClient = UserServiceClient.create()) {
   ListUsersRequest request =
       ListUsersRequest.newBuilder()
           .setParent(NetworkName.of("[NETWORK_CODE]").toString())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .setFilter("filter-1274492040")
           .setOrderBy("orderBy-1207110587")
           .setSkip(3532159)
           .build();
   for (User element : userServiceClient.listUsers(request).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
Name Description
request ListUsersRequest

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

Returns
Type Description
UserServiceClient.ListUsersPagedResponse

listUsers(String parent)

public final UserServiceClient.ListUsersPagedResponse listUsers(String parent)

Lists User 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 (UserServiceClient userServiceClient = UserServiceClient.create()) {
   String parent = NetworkName.of("[NETWORK_CODE]").toString();
   for (User element : userServiceClient.listUsers(parent).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
Name Description
parent String

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

Returns
Type Description
UserServiceClient.ListUsersPagedResponse

listUsersCallable()

public final UnaryCallable<ListUsersRequest,ListUsersResponse> listUsersCallable()

Lists User 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 (UserServiceClient userServiceClient = UserServiceClient.create()) {
   ListUsersRequest request =
       ListUsersRequest.newBuilder()
           .setParent(NetworkName.of("[NETWORK_CODE]").toString())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .setFilter("filter-1274492040")
           .setOrderBy("orderBy-1207110587")
           .setSkip(3532159)
           .build();
   while (true) {
     ListUsersResponse response = userServiceClient.listUsersCallable().call(request);
     for (User element : response.getUsersList()) {
       // doThingsWith(element);
     }
     String nextPageToken = response.getNextPageToken();
     if (!Strings.isNullOrEmpty(nextPageToken)) {
       request = request.toBuilder().setPageToken(nextPageToken).build();
     } else {
       break;
     }
   }
 }
 
Returns
Type Description
UnaryCallable<ListUsersRequest,ListUsersResponse>

listUsersPagedCallable()

public final UnaryCallable<ListUsersRequest,UserServiceClient.ListUsersPagedResponse> listUsersPagedCallable()

Lists User 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 (UserServiceClient userServiceClient = UserServiceClient.create()) {
   ListUsersRequest request =
       ListUsersRequest.newBuilder()
           .setParent(NetworkName.of("[NETWORK_CODE]").toString())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .setFilter("filter-1274492040")
           .setOrderBy("orderBy-1207110587")
           .setSkip(3532159)
           .build();
   ApiFuture<User> future = userServiceClient.listUsersPagedCallable().futureCall(request);
   // Do something.
   for (User element : future.get().iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Returns
Type Description
UnaryCallable<ListUsersRequest,ListUsersPagedResponse>

shutdown()

public void shutdown()

shutdownNow()

public void shutdownNow()

updateUser(UpdateUserRequest request)

public final User updateUser(UpdateUserRequest request)

Updates a User 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 (UserServiceClient userServiceClient = UserServiceClient.create()) {
   UpdateUserRequest request =
       UpdateUserRequest.newBuilder()
           .setUser(User.newBuilder().build())
           .setUpdateMask(FieldMask.newBuilder().build())
           .build();
   User response = userServiceClient.updateUser(request);
 }
 
Parameter
Name Description
request UpdateUserRequest

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

Returns
Type Description
User

updateUser(User user, FieldMask updateMask)

public final User updateUser(User user, FieldMask updateMask)

Updates a User 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 (UserServiceClient userServiceClient = UserServiceClient.create()) {
   User user = User.newBuilder().build();
   FieldMask updateMask = FieldMask.newBuilder().build();
   User response = userServiceClient.updateUser(user, updateMask);
 }
 
Parameters
Name Description
user User

Required. The User to update.

updateMask FieldMask

Optional. The list of fields to update.

Returns
Type Description
User

updateUserCallable()

public final UnaryCallable<UpdateUserRequest,User> updateUserCallable()

Updates a User 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 (UserServiceClient userServiceClient = UserServiceClient.create()) {
   UpdateUserRequest request =
       UpdateUserRequest.newBuilder()
           .setUser(User.newBuilder().build())
           .setUpdateMask(FieldMask.newBuilder().build())
           .build();
   ApiFuture<User> future = userServiceClient.updateUserCallable().futureCall(request);
   // Do something.
   User response = future.get();
 }
 
Returns
Type Description
UnaryCallable<UpdateUserRequest,User>