Show / Hide Table of Contents

Class UserServiceClient

UserService client wrapper, for convenient use.

Inheritance
object
UserServiceClient
UserServiceClientImpl
Inherited Members
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ToString()
Namespace: Google.Ads.AdManager.V1
Assembly: Google.Ads.AdManager.V1.dll
Syntax
public abstract class UserServiceClient
Remarks

Provides methods for handling User objects.

Properties

DefaultEndpoint

The default endpoint for the UserService service, which is a host of "admanager.googleapis.com" and a port of 443.

Declaration
public static string DefaultEndpoint { get; }
Property Value
Type Description
string

DefaultScopes

The default UserService scopes.

Declaration
public static IReadOnlyList<string> DefaultScopes { get; }
Property Value
Type Description
IReadOnlyList<string>
Remarks

The default UserService scopes are:

  • https://www.googleapis.com/auth/admanager

GrpcClient

The underlying gRPC UserService client

Declaration
public virtual UserService.UserServiceClient GrpcClient { get; }
Property Value
Type Description
UserService.UserServiceClient

ServiceMetadata

The service metadata associated with this client type.

Declaration
public static ServiceMetadata ServiceMetadata { get; }
Property Value
Type Description
ServiceMetadata

Methods

Create()

Synchronously creates a UserServiceClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use UserServiceClientBuilder.

Declaration
public static UserServiceClient Create()
Returns
Type Description
UserServiceClient

The created UserServiceClient.

CreateAsync(CancellationToken)

Asynchronously creates a UserServiceClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use UserServiceClientBuilder.

Declaration
public static Task<UserServiceClient> CreateAsync(CancellationToken cancellationToken = default)
Parameters
Type Name Description
CancellationToken cancellationToken

The CancellationToken to use while creating the client.

Returns
Type Description
Task<UserServiceClient>

The task representing the created UserServiceClient.

GetUser(GetUserRequest, CallSettings)

API to retrieve a User object.

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

Declaration
public virtual User GetUser(GetUserRequest request, CallSettings callSettings = null)
Parameters
Type Name Description
GetUserRequest 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
User

The RPC response.

Sample code
// Create client
UserServiceClient userServiceClient = UserServiceClient.Create();
// Initialize request argument(s)
GetUserRequest request = new GetUserRequest
{
    UserName = UserName.FromNetworkCodeUser("[NETWORK_CODE]", "[USER]"),
};
// Make the request
User response = userServiceClient.GetUser(request);

GetUser(UserName, CallSettings)

API to retrieve a User object.

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

Declaration
public virtual User GetUser(UserName name, CallSettings callSettings = null)
Parameters
Type Name Description
UserName name

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

CallSettings callSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
User

The RPC response.

Sample code
// Create client
UserServiceClient userServiceClient = UserServiceClient.Create();
// Initialize request argument(s)
UserName name = UserName.FromNetworkCodeUser("[NETWORK_CODE]", "[USER]");
// Make the request
User response = userServiceClient.GetUser(name);

GetUser(string, CallSettings)

API to retrieve a User object.

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

Declaration
public virtual User GetUser(string name, CallSettings callSettings = null)
Parameters
Type Name Description
string name

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

CallSettings callSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
User

The RPC response.

Sample code
// Create client
UserServiceClient userServiceClient = UserServiceClient.Create();
// Initialize request argument(s)
string name = "networks/[NETWORK_CODE]/users/[USER]";
// Make the request
User response = userServiceClient.GetUser(name);

GetUserAsync(GetUserRequest, CallSettings)

API to retrieve a User object.

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

Declaration
public virtual Task<User> GetUserAsync(GetUserRequest request, CallSettings callSettings = null)
Parameters
Type Name Description
GetUserRequest 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
Task<User>

A Task containing the RPC response.

Sample code
// Create client
UserServiceClient userServiceClient = await UserServiceClient.CreateAsync();
// Initialize request argument(s)
GetUserRequest request = new GetUserRequest
{
    UserName = UserName.FromNetworkCodeUser("[NETWORK_CODE]", "[USER]"),
};
// Make the request
User response = await userServiceClient.GetUserAsync(request);

GetUserAsync(GetUserRequest, CancellationToken)

API to retrieve a User object.

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

Declaration
public virtual Task<User> GetUserAsync(GetUserRequest request, CancellationToken cancellationToken)
Parameters
Type Name Description
GetUserRequest request

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

CancellationToken cancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
Task<User>

A Task containing the RPC response.

Sample code
// Create client
UserServiceClient userServiceClient = await UserServiceClient.CreateAsync();
// Initialize request argument(s)
GetUserRequest request = new GetUserRequest
{
    UserName = UserName.FromNetworkCodeUser("[NETWORK_CODE]", "[USER]"),
};
// Make the request
User response = await userServiceClient.GetUserAsync(request);

GetUserAsync(UserName, CallSettings)

API to retrieve a User object.

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

Declaration
public virtual Task<User> GetUserAsync(UserName name, CallSettings callSettings = null)
Parameters
Type Name Description
UserName name

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

CallSettings callSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Task<User>

A Task containing the RPC response.

Sample code
// Create client
UserServiceClient userServiceClient = await UserServiceClient.CreateAsync();
// Initialize request argument(s)
UserName name = UserName.FromNetworkCodeUser("[NETWORK_CODE]", "[USER]");
// Make the request
User response = await userServiceClient.GetUserAsync(name);

GetUserAsync(UserName, CancellationToken)

API to retrieve a User object.

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

Declaration
public virtual Task<User> GetUserAsync(UserName name, CancellationToken cancellationToken)
Parameters
Type Name Description
UserName name

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

CancellationToken cancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
Task<User>

A Task containing the RPC response.

Sample code
// Create client
UserServiceClient userServiceClient = await UserServiceClient.CreateAsync();
// Initialize request argument(s)
UserName name = UserName.FromNetworkCodeUser("[NETWORK_CODE]", "[USER]");
// Make the request
User response = await userServiceClient.GetUserAsync(name);

GetUserAsync(string, CallSettings)

API to retrieve a User object.

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

Declaration
public virtual Task<User> GetUserAsync(string name, CallSettings callSettings = null)
Parameters
Type Name Description
string name

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

CallSettings callSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Task<User>

A Task containing the RPC response.

Sample code
// Create client
UserServiceClient userServiceClient = await UserServiceClient.CreateAsync();
// Initialize request argument(s)
string name = "networks/[NETWORK_CODE]/users/[USER]";
// Make the request
User response = await userServiceClient.GetUserAsync(name);

GetUserAsync(string, CancellationToken)

API to retrieve a User object.

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

Declaration
public virtual Task<User> GetUserAsync(string name, CancellationToken cancellationToken)
Parameters
Type Name Description
string name

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

CancellationToken cancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
Task<User>

A Task containing the RPC response.

Sample code
// Create client
UserServiceClient userServiceClient = await UserServiceClient.CreateAsync();
// Initialize request argument(s)
string name = "networks/[NETWORK_CODE]/users/[USER]";
// Make the request
User response = await userServiceClient.GetUserAsync(name);

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
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.

In this article
Back to top Generated by DocFX