Google Cloud Support v2 API - Class CaseAttachmentServiceClient (1.0.0)

public abstract class CaseAttachmentServiceClient

Reference documentation and code samples for the Google Cloud Support v2 API class CaseAttachmentServiceClient.

CaseAttachmentService client wrapper, for convenient use.

Inheritance

object > CaseAttachmentServiceClient

Namespace

Google.Cloud.Support.V2

Assembly

Google.Cloud.Support.V2.dll

Remarks

A service to manage file attachment for Google Cloud support cases.

Properties

DefaultEndpoint

public static string DefaultEndpoint { get; }

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

Property Value
TypeDescription
string

DefaultScopes

public static IReadOnlyList<string> DefaultScopes { get; }

The default CaseAttachmentService scopes.

Property Value
TypeDescription
IReadOnlyListstring
Remarks

The default CaseAttachmentService scopes are:

GrpcClient

public virtual CaseAttachmentService.CaseAttachmentServiceClient GrpcClient { get; }

The underlying gRPC CaseAttachmentService client

Property Value
TypeDescription
CaseAttachmentServiceCaseAttachmentServiceClient

ServiceMetadata

public static ServiceMetadata ServiceMetadata { get; }

The service metadata associated with this client type.

Property Value
TypeDescription
ServiceMetadata

Methods

Create()

public static CaseAttachmentServiceClient Create()

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

Returns
TypeDescription
CaseAttachmentServiceClient

The created CaseAttachmentServiceClient.

CreateAsync(CancellationToken)

public static Task<CaseAttachmentServiceClient> CreateAsync(CancellationToken cancellationToken = default)

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

Parameter
NameDescription
cancellationTokenCancellationToken

The CancellationToken to use while creating the client.

Returns
TypeDescription
TaskCaseAttachmentServiceClient

The task representing the created CaseAttachmentServiceClient.

ListAttachments(CaseName, string, int?, CallSettings)

public virtual PagedEnumerable<ListAttachmentsResponse, Attachment> ListAttachments(CaseName parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Retrieve all attachments associated with a support case.

Parameters
NameDescription
parentCaseName

Required. The resource name of Case object for which attachments should be listed.

pageTokenstring

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

pageSizeint

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.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
PagedEnumerableListAttachmentsResponseAttachment

A pageable sequence of Attachment resources.

Example
// Create client
CaseAttachmentServiceClient caseAttachmentServiceClient = CaseAttachmentServiceClient.Create();
// Initialize request argument(s)
CaseName parent = CaseName.FromOrganizationCase("[ORGANIZATION]", "[CASE]");
// Make the request
PagedEnumerable<ListAttachmentsResponse, Attachment> response = caseAttachmentServiceClient.ListAttachments(parent);

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

ListAttachments(ListAttachmentsRequest, CallSettings)

public virtual PagedEnumerable<ListAttachmentsResponse, Attachment> ListAttachments(ListAttachmentsRequest request, CallSettings callSettings = null)

Retrieve all attachments associated with a support case.

Parameters
NameDescription
requestListAttachmentsRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
PagedEnumerableListAttachmentsResponseAttachment

A pageable sequence of Attachment resources.

Example
// Create client
CaseAttachmentServiceClient caseAttachmentServiceClient = CaseAttachmentServiceClient.Create();
// Initialize request argument(s)
ListAttachmentsRequest request = new ListAttachmentsRequest
{
    ParentAsCaseName = CaseName.FromOrganizationCase("[ORGANIZATION]", "[CASE]"),
};
// Make the request
PagedEnumerable<ListAttachmentsResponse, Attachment> response = caseAttachmentServiceClient.ListAttachments(request);

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

ListAttachments(string, string, int?, CallSettings)

public virtual PagedEnumerable<ListAttachmentsResponse, Attachment> ListAttachments(string parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Retrieve all attachments associated with a support case.

Parameters
NameDescription
parentstring

Required. The resource name of Case object for which attachments should be listed.

pageTokenstring

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

pageSizeint

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.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
PagedEnumerableListAttachmentsResponseAttachment

A pageable sequence of Attachment resources.

Example
// Create client
CaseAttachmentServiceClient caseAttachmentServiceClient = CaseAttachmentServiceClient.Create();
// Initialize request argument(s)
string parent = "organizations/[ORGANIZATION]/cases/[CASE]";
// Make the request
PagedEnumerable<ListAttachmentsResponse, Attachment> response = caseAttachmentServiceClient.ListAttachments(parent);

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

ListAttachmentsAsync(CaseName, string, int?, CallSettings)

public virtual PagedAsyncEnumerable<ListAttachmentsResponse, Attachment> ListAttachmentsAsync(CaseName parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Retrieve all attachments associated with a support case.

Parameters
NameDescription
parentCaseName

Required. The resource name of Case object for which attachments should be listed.

pageTokenstring

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

pageSizeint

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.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
PagedAsyncEnumerableListAttachmentsResponseAttachment

A pageable asynchronous sequence of Attachment resources.

Example
// Create client
CaseAttachmentServiceClient caseAttachmentServiceClient = await CaseAttachmentServiceClient.CreateAsync();
// Initialize request argument(s)
CaseName parent = CaseName.FromOrganizationCase("[ORGANIZATION]", "[CASE]");
// Make the request
PagedAsyncEnumerable<ListAttachmentsResponse, Attachment> response = caseAttachmentServiceClient.ListAttachmentsAsync(parent);

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

ListAttachmentsAsync(ListAttachmentsRequest, CallSettings)

public virtual PagedAsyncEnumerable<ListAttachmentsResponse, Attachment> ListAttachmentsAsync(ListAttachmentsRequest request, CallSettings callSettings = null)

Retrieve all attachments associated with a support case.

Parameters
NameDescription
requestListAttachmentsRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
PagedAsyncEnumerableListAttachmentsResponseAttachment

A pageable asynchronous sequence of Attachment resources.

Example
// Create client
CaseAttachmentServiceClient caseAttachmentServiceClient = await CaseAttachmentServiceClient.CreateAsync();
// Initialize request argument(s)
ListAttachmentsRequest request = new ListAttachmentsRequest
{
    ParentAsCaseName = CaseName.FromOrganizationCase("[ORGANIZATION]", "[CASE]"),
};
// Make the request
PagedAsyncEnumerable<ListAttachmentsResponse, Attachment> response = caseAttachmentServiceClient.ListAttachmentsAsync(request);

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

ListAttachmentsAsync(string, string, int?, CallSettings)

public virtual PagedAsyncEnumerable<ListAttachmentsResponse, Attachment> ListAttachmentsAsync(string parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Retrieve all attachments associated with a support case.

Parameters
NameDescription
parentstring

Required. The resource name of Case object for which attachments should be listed.

pageTokenstring

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

pageSizeint

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.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
PagedAsyncEnumerableListAttachmentsResponseAttachment

A pageable asynchronous sequence of Attachment resources.

Example
// Create client
CaseAttachmentServiceClient caseAttachmentServiceClient = await CaseAttachmentServiceClient.CreateAsync();
// Initialize request argument(s)
string parent = "organizations/[ORGANIZATION]/cases/[CASE]";
// Make the request
PagedAsyncEnumerable<ListAttachmentsResponse, Attachment> response = caseAttachmentServiceClient.ListAttachmentsAsync(parent);

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

public static Task ShutdownDefaultChannelsAsync()

Shuts down any channels automatically created by Create() and CreateAsync(CancellationToken). Channels which weren't automatically created are not affected.

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