Share via


ConfidentialLedgerClient.GetCollections(RequestContext) Method

Definition

[Protocol Method] Retrieves a list of collection ids present in the Confidential Ledger

  • This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
public virtual Azure.Pageable<BinaryData> GetCollections (Azure.RequestContext context = default);
abstract member GetCollections : Azure.RequestContext -> Azure.Pageable<BinaryData>
override this.GetCollections : Azure.RequestContext -> Azure.Pageable<BinaryData>
Public Overridable Function GetCollections (Optional context As RequestContext = Nothing) As Pageable(Of BinaryData)

Parameters

context
RequestContext

The request context, which can override default behaviors of the client pipeline on a per-call basis.

Returns

The Pageable<T> from the service containing a list of BinaryData objects. Details of the body schema for each item in the collection are in the Remarks section below.

Exceptions

Service returned a non-success status code.

Examples

This sample shows how to call GetCollections and parse the result.

TokenCredential credential = new DefaultAzureCredential();
ConfidentialLedgerClient client = new ConfidentialLedgerClient(new Uri("http://localhost:3000"), credential);

foreach (BinaryData item in client.GetCollections())
{
    JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement;
    Console.WriteLine(result.GetProperty("collectionId").ToString());
}

This sample shows how to call GetCollections with all request content and parse the result.

TokenCredential credential = new DefaultAzureCredential();
ConfidentialLedgerClient client = new ConfidentialLedgerClient(new Uri("http://localhost:3000"), credential);

foreach (BinaryData item in client.GetCollections())
{
    JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement;
    Console.WriteLine(result.GetProperty("collectionId").ToString());
}

Remarks

Collection ids are user-created collections of ledger entries

Below is the JSON schema for one item in the pageable response.

Response Body:

Schema for PagedCollections:

{
  collectionId: string, # Required.
}

Applies to