Show / Hide Table of Contents

Class ProgramsServiceClient

ProgramsService client wrapper, for convenient use.

Inheritance
object
ProgramsServiceClient
ProgramsServiceClientImpl
Inherited Members
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ToString()
Namespace: Google.Shopping.Merchant.Accounts.V1
Assembly: Google.Shopping.Merchant.Accounts.V1.dll
Syntax
public abstract class ProgramsServiceClient
Remarks

Service for program management.

Programs provide a mechanism for adding functionality to merchant accounts. A typical example of this is the Free product listings program, which enables products from a merchant's store to be shown across Google for free.

This service exposes methods to retrieve a business's participation in all available programs, in addition to methods for explicitly enabling or disabling participation in each program.

Properties

DefaultEndpoint

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

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

DefaultScopes

The default ProgramsService scopes.

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

The default ProgramsService scopes are:

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

GrpcClient

The underlying gRPC ProgramsService client

Declaration
public virtual ProgramsService.ProgramsServiceClient GrpcClient { get; }
Property Value
Type Description
ProgramsService.ProgramsServiceClient

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 ProgramsServiceClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use ProgramsServiceClientBuilder.

Declaration
public static ProgramsServiceClient Create()
Returns
Type Description
ProgramsServiceClient

The created ProgramsServiceClient.

CreateAsync(CancellationToken)

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

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

The CancellationToken to use while creating the client.

Returns
Type Description
Task<ProgramsServiceClient>

The task representing the created ProgramsServiceClient.

DisableProgram(DisableProgramRequest, CallSettings)

Disable participation in the specified program for the account.

Declaration
public virtual Program DisableProgram(DisableProgramRequest request, CallSettings callSettings = null)
Parameters
Type Name Description
DisableProgramRequest 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
Program

The RPC response.

Sample code
// Create client
ProgramsServiceClient programsServiceClient = ProgramsServiceClient.Create();
// Initialize request argument(s)
DisableProgramRequest request = new DisableProgramRequest
{
    ProgramName = ProgramName.FromAccountProgram("[ACCOUNT]", "[PROGRAM]"),
};
// Make the request
Program response = programsServiceClient.DisableProgram(request);

DisableProgram(ProgramName, CallSettings)

Disable participation in the specified program for the account.

Declaration
public virtual Program DisableProgram(ProgramName name, CallSettings callSettings = null)
Parameters
Type Name Description
ProgramName name

Required. The name of the program for which to disable participation for the given account. Format: accounts/{account}/programs/{program}. For example, accounts/123456/programs/free-listings.

CallSettings callSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Program

The RPC response.

Sample code
// Create client
ProgramsServiceClient programsServiceClient = ProgramsServiceClient.Create();
// Initialize request argument(s)
ProgramName name = ProgramName.FromAccountProgram("[ACCOUNT]", "[PROGRAM]");
// Make the request
Program response = programsServiceClient.DisableProgram(name);

DisableProgram(string, CallSettings)

Disable participation in the specified program for the account.

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

Required. The name of the program for which to disable participation for the given account. Format: accounts/{account}/programs/{program}. For example, accounts/123456/programs/free-listings.

CallSettings callSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Program

The RPC response.

Sample code
// Create client
ProgramsServiceClient programsServiceClient = ProgramsServiceClient.Create();
// Initialize request argument(s)
string name = "accounts/[ACCOUNT]/programs/[PROGRAM]";
// Make the request
Program response = programsServiceClient.DisableProgram(name);

DisableProgramAsync(DisableProgramRequest, CallSettings)

Disable participation in the specified program for the account.

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

A Task containing the RPC response.

Sample code
// Create client
ProgramsServiceClient programsServiceClient = await ProgramsServiceClient.CreateAsync();
// Initialize request argument(s)
DisableProgramRequest request = new DisableProgramRequest
{
    ProgramName = ProgramName.FromAccountProgram("[ACCOUNT]", "[PROGRAM]"),
};
// Make the request
Program response = await programsServiceClient.DisableProgramAsync(request);

DisableProgramAsync(DisableProgramRequest, CancellationToken)

Disable participation in the specified program for the account.

Declaration
public virtual Task<Program> DisableProgramAsync(DisableProgramRequest request, CancellationToken cancellationToken)
Parameters
Type Name Description
DisableProgramRequest 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<Program>

A Task containing the RPC response.

Sample code
// Create client
ProgramsServiceClient programsServiceClient = await ProgramsServiceClient.CreateAsync();
// Initialize request argument(s)
DisableProgramRequest request = new DisableProgramRequest
{
    ProgramName = ProgramName.FromAccountProgram("[ACCOUNT]", "[PROGRAM]"),
};
// Make the request
Program response = await programsServiceClient.DisableProgramAsync(request);

DisableProgramAsync(ProgramName, CallSettings)

Disable participation in the specified program for the account.

Declaration
public virtual Task<Program> DisableProgramAsync(ProgramName name, CallSettings callSettings = null)
Parameters
Type Name Description
ProgramName name

Required. The name of the program for which to disable participation for the given account. Format: accounts/{account}/programs/{program}. For example, accounts/123456/programs/free-listings.

CallSettings callSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Task<Program>

A Task containing the RPC response.

Sample code
// Create client
ProgramsServiceClient programsServiceClient = await ProgramsServiceClient.CreateAsync();
// Initialize request argument(s)
ProgramName name = ProgramName.FromAccountProgram("[ACCOUNT]", "[PROGRAM]");
// Make the request
Program response = await programsServiceClient.DisableProgramAsync(name);

DisableProgramAsync(ProgramName, CancellationToken)

Disable participation in the specified program for the account.

Declaration
public virtual Task<Program> DisableProgramAsync(ProgramName name, CancellationToken cancellationToken)
Parameters
Type Name Description
ProgramName name

Required. The name of the program for which to disable participation for the given account. Format: accounts/{account}/programs/{program}. For example, accounts/123456/programs/free-listings.

CancellationToken cancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
Task<Program>

A Task containing the RPC response.

Sample code
// Create client
ProgramsServiceClient programsServiceClient = await ProgramsServiceClient.CreateAsync();
// Initialize request argument(s)
ProgramName name = ProgramName.FromAccountProgram("[ACCOUNT]", "[PROGRAM]");
// Make the request
Program response = await programsServiceClient.DisableProgramAsync(name);

DisableProgramAsync(string, CallSettings)

Disable participation in the specified program for the account.

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

Required. The name of the program for which to disable participation for the given account. Format: accounts/{account}/programs/{program}. For example, accounts/123456/programs/free-listings.

CallSettings callSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Task<Program>

A Task containing the RPC response.

Sample code
// Create client
ProgramsServiceClient programsServiceClient = await ProgramsServiceClient.CreateAsync();
// Initialize request argument(s)
string name = "accounts/[ACCOUNT]/programs/[PROGRAM]";
// Make the request
Program response = await programsServiceClient.DisableProgramAsync(name);

DisableProgramAsync(string, CancellationToken)

Disable participation in the specified program for the account.

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

Required. The name of the program for which to disable participation for the given account. Format: accounts/{account}/programs/{program}. For example, accounts/123456/programs/free-listings.

CancellationToken cancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
Task<Program>

A Task containing the RPC response.

Sample code
// Create client
ProgramsServiceClient programsServiceClient = await ProgramsServiceClient.CreateAsync();
// Initialize request argument(s)
string name = "accounts/[ACCOUNT]/programs/[PROGRAM]";
// Make the request
Program response = await programsServiceClient.DisableProgramAsync(name);

EnableProgram(EnableProgramRequest, CallSettings)

Enable participation in the specified program for the account.

Declaration
public virtual Program EnableProgram(EnableProgramRequest request, CallSettings callSettings = null)
Parameters
Type Name Description
EnableProgramRequest 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
Program

The RPC response.

Sample code
// Create client
ProgramsServiceClient programsServiceClient = ProgramsServiceClient.Create();
// Initialize request argument(s)
EnableProgramRequest request = new EnableProgramRequest
{
    ProgramName = ProgramName.FromAccountProgram("[ACCOUNT]", "[PROGRAM]"),
};
// Make the request
Program response = programsServiceClient.EnableProgram(request);

EnableProgram(ProgramName, CallSettings)

Enable participation in the specified program for the account.

Declaration
public virtual Program EnableProgram(ProgramName name, CallSettings callSettings = null)
Parameters
Type Name Description
ProgramName name

Required. The name of the program for which to enable participation for the given account. Format: accounts/{account}/programs/{program}. For example, accounts/123456/programs/free-listings.

CallSettings callSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Program

The RPC response.

Sample code
// Create client
ProgramsServiceClient programsServiceClient = ProgramsServiceClient.Create();
// Initialize request argument(s)
ProgramName name = ProgramName.FromAccountProgram("[ACCOUNT]", "[PROGRAM]");
// Make the request
Program response = programsServiceClient.EnableProgram(name);

EnableProgram(string, CallSettings)

Enable participation in the specified program for the account.

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

Required. The name of the program for which to enable participation for the given account. Format: accounts/{account}/programs/{program}. For example, accounts/123456/programs/free-listings.

CallSettings callSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Program

The RPC response.

Sample code
// Create client
ProgramsServiceClient programsServiceClient = ProgramsServiceClient.Create();
// Initialize request argument(s)
string name = "accounts/[ACCOUNT]/programs/[PROGRAM]";
// Make the request
Program response = programsServiceClient.EnableProgram(name);

EnableProgramAsync(EnableProgramRequest, CallSettings)

Enable participation in the specified program for the account.

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

A Task containing the RPC response.

Sample code
// Create client
ProgramsServiceClient programsServiceClient = await ProgramsServiceClient.CreateAsync();
// Initialize request argument(s)
EnableProgramRequest request = new EnableProgramRequest
{
    ProgramName = ProgramName.FromAccountProgram("[ACCOUNT]", "[PROGRAM]"),
};
// Make the request
Program response = await programsServiceClient.EnableProgramAsync(request);

EnableProgramAsync(EnableProgramRequest, CancellationToken)

Enable participation in the specified program for the account.

Declaration
public virtual Task<Program> EnableProgramAsync(EnableProgramRequest request, CancellationToken cancellationToken)
Parameters
Type Name Description
EnableProgramRequest 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<Program>

A Task containing the RPC response.

Sample code
// Create client
ProgramsServiceClient programsServiceClient = await ProgramsServiceClient.CreateAsync();
// Initialize request argument(s)
EnableProgramRequest request = new EnableProgramRequest
{
    ProgramName = ProgramName.FromAccountProgram("[ACCOUNT]", "[PROGRAM]"),
};
// Make the request
Program response = await programsServiceClient.EnableProgramAsync(request);

EnableProgramAsync(ProgramName, CallSettings)

Enable participation in the specified program for the account.

Declaration
public virtual Task<Program> EnableProgramAsync(ProgramName name, CallSettings callSettings = null)
Parameters
Type Name Description
ProgramName name

Required. The name of the program for which to enable participation for the given account. Format: accounts/{account}/programs/{program}. For example, accounts/123456/programs/free-listings.

CallSettings callSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Task<Program>

A Task containing the RPC response.

Sample code
// Create client
ProgramsServiceClient programsServiceClient = await ProgramsServiceClient.CreateAsync();
// Initialize request argument(s)
ProgramName name = ProgramName.FromAccountProgram("[ACCOUNT]", "[PROGRAM]");
// Make the request
Program response = await programsServiceClient.EnableProgramAsync(name);

EnableProgramAsync(ProgramName, CancellationToken)

Enable participation in the specified program for the account.

Declaration
public virtual Task<Program> EnableProgramAsync(ProgramName name, CancellationToken cancellationToken)
Parameters
Type Name Description
ProgramName name

Required. The name of the program for which to enable participation for the given account. Format: accounts/{account}/programs/{program}. For example, accounts/123456/programs/free-listings.

CancellationToken cancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
Task<Program>

A Task containing the RPC response.

Sample code
// Create client
ProgramsServiceClient programsServiceClient = await ProgramsServiceClient.CreateAsync();
// Initialize request argument(s)
ProgramName name = ProgramName.FromAccountProgram("[ACCOUNT]", "[PROGRAM]");
// Make the request
Program response = await programsServiceClient.EnableProgramAsync(name);

EnableProgramAsync(string, CallSettings)

Enable participation in the specified program for the account.

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

Required. The name of the program for which to enable participation for the given account. Format: accounts/{account}/programs/{program}. For example, accounts/123456/programs/free-listings.

CallSettings callSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Task<Program>

A Task containing the RPC response.

Sample code
// Create client
ProgramsServiceClient programsServiceClient = await ProgramsServiceClient.CreateAsync();
// Initialize request argument(s)
string name = "accounts/[ACCOUNT]/programs/[PROGRAM]";
// Make the request
Program response = await programsServiceClient.EnableProgramAsync(name);

EnableProgramAsync(string, CancellationToken)

Enable participation in the specified program for the account.

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

Required. The name of the program for which to enable participation for the given account. Format: accounts/{account}/programs/{program}. For example, accounts/123456/programs/free-listings.

CancellationToken cancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
Task<Program>

A Task containing the RPC response.

Sample code
// Create client
ProgramsServiceClient programsServiceClient = await ProgramsServiceClient.CreateAsync();
// Initialize request argument(s)
string name = "accounts/[ACCOUNT]/programs/[PROGRAM]";
// Make the request
Program response = await programsServiceClient.EnableProgramAsync(name);

GetProgram(GetProgramRequest, CallSettings)

Retrieves the specified program for the account.

Declaration
public virtual Program GetProgram(GetProgramRequest request, CallSettings callSettings = null)
Parameters
Type Name Description
GetProgramRequest 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
Program

The RPC response.

Sample code
// Create client
ProgramsServiceClient programsServiceClient = ProgramsServiceClient.Create();
// Initialize request argument(s)
GetProgramRequest request = new GetProgramRequest
{
    ProgramName = ProgramName.FromAccountProgram("[ACCOUNT]", "[PROGRAM]"),
};
// Make the request
Program response = programsServiceClient.GetProgram(request);

GetProgram(ProgramName, CallSettings)

Retrieves the specified program for the account.

Declaration
public virtual Program GetProgram(ProgramName name, CallSettings callSettings = null)
Parameters
Type Name Description
ProgramName name

Required. The name of the program to retrieve. Format: accounts/{account}/programs/{program}. For example, accounts/123456/programs/free-listings.

CallSettings callSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Program

The RPC response.

Sample code
// Create client
ProgramsServiceClient programsServiceClient = ProgramsServiceClient.Create();
// Initialize request argument(s)
ProgramName name = ProgramName.FromAccountProgram("[ACCOUNT]", "[PROGRAM]");
// Make the request
Program response = programsServiceClient.GetProgram(name);

GetProgram(string, CallSettings)

Retrieves the specified program for the account.

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

Required. The name of the program to retrieve. Format: accounts/{account}/programs/{program}. For example, accounts/123456/programs/free-listings.

CallSettings callSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Program

The RPC response.

Sample code
// Create client
ProgramsServiceClient programsServiceClient = ProgramsServiceClient.Create();
// Initialize request argument(s)
string name = "accounts/[ACCOUNT]/programs/[PROGRAM]";
// Make the request
Program response = programsServiceClient.GetProgram(name);

GetProgramAsync(GetProgramRequest, CallSettings)

Retrieves the specified program for the account.

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

A Task containing the RPC response.

Sample code
// Create client
ProgramsServiceClient programsServiceClient = await ProgramsServiceClient.CreateAsync();
// Initialize request argument(s)
GetProgramRequest request = new GetProgramRequest
{
    ProgramName = ProgramName.FromAccountProgram("[ACCOUNT]", "[PROGRAM]"),
};
// Make the request
Program response = await programsServiceClient.GetProgramAsync(request);

GetProgramAsync(GetProgramRequest, CancellationToken)

Retrieves the specified program for the account.

Declaration
public virtual Task<Program> GetProgramAsync(GetProgramRequest request, CancellationToken cancellationToken)
Parameters
Type Name Description
GetProgramRequest 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<Program>

A Task containing the RPC response.

Sample code
// Create client
ProgramsServiceClient programsServiceClient = await ProgramsServiceClient.CreateAsync();
// Initialize request argument(s)
GetProgramRequest request = new GetProgramRequest
{
    ProgramName = ProgramName.FromAccountProgram("[ACCOUNT]", "[PROGRAM]"),
};
// Make the request
Program response = await programsServiceClient.GetProgramAsync(request);

GetProgramAsync(ProgramName, CallSettings)

Retrieves the specified program for the account.

Declaration
public virtual Task<Program> GetProgramAsync(ProgramName name, CallSettings callSettings = null)
Parameters
Type Name Description
ProgramName name

Required. The name of the program to retrieve. Format: accounts/{account}/programs/{program}. For example, accounts/123456/programs/free-listings.

CallSettings callSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Task<Program>

A Task containing the RPC response.

Sample code
// Create client
ProgramsServiceClient programsServiceClient = await ProgramsServiceClient.CreateAsync();
// Initialize request argument(s)
ProgramName name = ProgramName.FromAccountProgram("[ACCOUNT]", "[PROGRAM]");
// Make the request
Program response = await programsServiceClient.GetProgramAsync(name);

GetProgramAsync(ProgramName, CancellationToken)

Retrieves the specified program for the account.

Declaration
public virtual Task<Program> GetProgramAsync(ProgramName name, CancellationToken cancellationToken)
Parameters
Type Name Description
ProgramName name

Required. The name of the program to retrieve. Format: accounts/{account}/programs/{program}. For example, accounts/123456/programs/free-listings.

CancellationToken cancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
Task<Program>

A Task containing the RPC response.

Sample code
// Create client
ProgramsServiceClient programsServiceClient = await ProgramsServiceClient.CreateAsync();
// Initialize request argument(s)
ProgramName name = ProgramName.FromAccountProgram("[ACCOUNT]", "[PROGRAM]");
// Make the request
Program response = await programsServiceClient.GetProgramAsync(name);

GetProgramAsync(string, CallSettings)

Retrieves the specified program for the account.

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

Required. The name of the program to retrieve. Format: accounts/{account}/programs/{program}. For example, accounts/123456/programs/free-listings.

CallSettings callSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Task<Program>

A Task containing the RPC response.

Sample code
// Create client
ProgramsServiceClient programsServiceClient = await ProgramsServiceClient.CreateAsync();
// Initialize request argument(s)
string name = "accounts/[ACCOUNT]/programs/[PROGRAM]";
// Make the request
Program response = await programsServiceClient.GetProgramAsync(name);

GetProgramAsync(string, CancellationToken)

Retrieves the specified program for the account.

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

Required. The name of the program to retrieve. Format: accounts/{account}/programs/{program}. For example, accounts/123456/programs/free-listings.

CancellationToken cancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
Task<Program>

A Task containing the RPC response.

Sample code
// Create client
ProgramsServiceClient programsServiceClient = await ProgramsServiceClient.CreateAsync();
// Initialize request argument(s)
string name = "accounts/[ACCOUNT]/programs/[PROGRAM]";
// Make the request
Program response = await programsServiceClient.GetProgramAsync(name);

ListPrograms(AccountName, string, int?, CallSettings)

Retrieves all programs for the account.

Declaration
public virtual PagedEnumerable<ListProgramsResponse, Program> ListPrograms(AccountName parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)
Parameters
Type Name Description
AccountName parent

Required. The name of the account for which to retrieve all programs. Format: accounts/{account}

string pageToken

The token returned from the previous request. A value of null or an empty string retrieves the first page.

int? pageSize

The size of page to request. The response will not be larger than this, but may be smaller. A value of null or 0 uses a server-defined page size.

CallSettings callSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedEnumerable<ListProgramsResponse, Program>

A pageable sequence of Program resources.

Sample code
// Create client
ProgramsServiceClient programsServiceClient = ProgramsServiceClient.Create();
// Initialize request argument(s)
AccountName parent = AccountName.FromAccount("[ACCOUNT]");
// Make the request
PagedEnumerable<ListProgramsResponse, Program> response = programsServiceClient.ListPrograms(parent);

// Iterate over all response items, lazily performing RPCs as required
foreach (Program 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 (ListProgramsResponse page in response.AsRawResponses())
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (Program 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<Program> 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 (Program 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;

ListPrograms(ListProgramsRequest, CallSettings)

Retrieves all programs for the account.

Declaration
public virtual PagedEnumerable<ListProgramsResponse, Program> ListPrograms(ListProgramsRequest request, CallSettings callSettings = null)
Parameters
Type Name Description
ListProgramsRequest 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
PagedEnumerable<ListProgramsResponse, Program>

A pageable sequence of Program resources.

Sample code
// Create client
ProgramsServiceClient programsServiceClient = ProgramsServiceClient.Create();
// Initialize request argument(s)
ListProgramsRequest request = new ListProgramsRequest
{
    ParentAsAccountName = AccountName.FromAccount("[ACCOUNT]"),
};
// Make the request
PagedEnumerable<ListProgramsResponse, Program> response = programsServiceClient.ListPrograms(request);

// Iterate over all response items, lazily performing RPCs as required
foreach (Program 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 (ListProgramsResponse page in response.AsRawResponses())
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (Program 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<Program> 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 (Program 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;

ListPrograms(string, string, int?, CallSettings)

Retrieves all programs for the account.

Declaration
public virtual PagedEnumerable<ListProgramsResponse, Program> ListPrograms(string parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)
Parameters
Type Name Description
string parent

Required. The name of the account for which to retrieve all programs. Format: accounts/{account}

string pageToken

The token returned from the previous request. A value of null or an empty string retrieves the first page.

int? pageSize

The size of page to request. The response will not be larger than this, but may be smaller. A value of null or 0 uses a server-defined page size.

CallSettings callSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedEnumerable<ListProgramsResponse, Program>

A pageable sequence of Program resources.

Sample code
// Create client
ProgramsServiceClient programsServiceClient = ProgramsServiceClient.Create();
// Initialize request argument(s)
string parent = "accounts/[ACCOUNT]";
// Make the request
PagedEnumerable<ListProgramsResponse, Program> response = programsServiceClient.ListPrograms(parent);

// Iterate over all response items, lazily performing RPCs as required
foreach (Program 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 (ListProgramsResponse page in response.AsRawResponses())
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (Program 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<Program> 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 (Program 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;

ListProgramsAsync(AccountName, string, int?, CallSettings)

Retrieves all programs for the account.

Declaration
public virtual PagedAsyncEnumerable<ListProgramsResponse, Program> ListProgramsAsync(AccountName parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)
Parameters
Type Name Description
AccountName parent

Required. The name of the account for which to retrieve all programs. Format: accounts/{account}

string pageToken

The token returned from the previous request. A value of null or an empty string retrieves the first page.

int? pageSize

The size of page to request. The response will not be larger than this, but may be smaller. A value of null or 0 uses a server-defined page size.

CallSettings callSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedAsyncEnumerable<ListProgramsResponse, Program>

A pageable asynchronous sequence of Program resources.

Sample code
// Create client
ProgramsServiceClient programsServiceClient = await ProgramsServiceClient.CreateAsync();
// Initialize request argument(s)
AccountName parent = AccountName.FromAccount("[ACCOUNT]");
// Make the request
PagedAsyncEnumerable<ListProgramsResponse, Program> response = programsServiceClient.ListProgramsAsync(parent);

// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((Program 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((ListProgramsResponse page) =>
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (Program 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<Program> 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 (Program 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;

ListProgramsAsync(ListProgramsRequest, CallSettings)

Retrieves all programs for the account.

Declaration
public virtual PagedAsyncEnumerable<ListProgramsResponse, Program> ListProgramsAsync(ListProgramsRequest request, CallSettings callSettings = null)
Parameters
Type Name Description
ListProgramsRequest 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
PagedAsyncEnumerable<ListProgramsResponse, Program>

A pageable asynchronous sequence of Program resources.

Sample code
// Create client
ProgramsServiceClient programsServiceClient = await ProgramsServiceClient.CreateAsync();
// Initialize request argument(s)
ListProgramsRequest request = new ListProgramsRequest
{
    ParentAsAccountName = AccountName.FromAccount("[ACCOUNT]"),
};
// Make the request
PagedAsyncEnumerable<ListProgramsResponse, Program> response = programsServiceClient.ListProgramsAsync(request);

// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((Program 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((ListProgramsResponse page) =>
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (Program 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<Program> 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 (Program 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;

ListProgramsAsync(string, string, int?, CallSettings)

Retrieves all programs for the account.

Declaration
public virtual PagedAsyncEnumerable<ListProgramsResponse, Program> ListProgramsAsync(string parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)
Parameters
Type Name Description
string parent

Required. The name of the account for which to retrieve all programs. Format: accounts/{account}

string pageToken

The token returned from the previous request. A value of null or an empty string retrieves the first page.

int? pageSize

The size of page to request. The response will not be larger than this, but may be smaller. A value of null or 0 uses a server-defined page size.

CallSettings callSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedAsyncEnumerable<ListProgramsResponse, Program>

A pageable asynchronous sequence of Program resources.

Sample code
// Create client
ProgramsServiceClient programsServiceClient = await ProgramsServiceClient.CreateAsync();
// Initialize request argument(s)
string parent = "accounts/[ACCOUNT]";
// Make the request
PagedAsyncEnumerable<ListProgramsResponse, Program> response = programsServiceClient.ListProgramsAsync(parent);

// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((Program 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((ListProgramsResponse page) =>
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (Program 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<Program> 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 (Program 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()

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