次の方法で共有


ConfidentialLedgerClient.GetLedgerEntries メソッド

定義

[プロトコルメソッド]範囲に対応するコレクションから台帳エントリを取得します。

  • この プロトコルメソッド を使用すると、高度なシナリオで応答の要求と処理を明示的に作成できます。
public virtual Azure.Pageable<BinaryData> GetLedgerEntries (string collectionId = default, string fromTransactionId = default, string toTransactionId = default, Azure.RequestContext context = default);
abstract member GetLedgerEntries : string * string * string * Azure.RequestContext -> Azure.Pageable<BinaryData>
override this.GetLedgerEntries : string * string * string * Azure.RequestContext -> Azure.Pageable<BinaryData>
Public Overridable Function GetLedgerEntries (Optional collectionId As String = Nothing, Optional fromTransactionId As String = Nothing, Optional toTransactionId As String = Nothing, Optional context As RequestContext = Nothing) As Pageable(Of BinaryData)

パラメーター

collectionId
String

コレクション ID。

fromTransactionId
String

範囲内の最初のトランザクション ID を指定します。

toTransactionId
String

範囲内の最後のトランザクション ID を指定します。

context
RequestContext

要求コンテキスト。これは、呼び出しごとにクライアント パイプラインの既定の動作をオーバーライドできます。

戻り値

Pageable<T>オブジェクトの一覧を含むサービスの BinaryData 。 コレクション内の各項目の本文スキーマの詳細については、以下の「解説」セクションを参照してください。

例外

サービスから成功以外の状態コードが返されました。

このサンプルでは、GetLedgerEntries を呼び出して結果を解析する方法を示します。

var credential = new DefaultAzureCredential();
var endpoint = new Uri("<https://my-service.azure.com>");
var client = new ConfidentialLedgerClient(endpoint, credential);

foreach (var item in client.GetLedgerEntries())
{
    JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement;
    Console.WriteLine(result.GetProperty("contents").ToString());
}

このサンプルでは、すべてのパラメーターを使用して GetLedgerEntries を呼び出す方法と、結果を解析する方法を示します。

var credential = new DefaultAzureCredential();
var endpoint = new Uri("<https://my-service.azure.com>");
var client = new ConfidentialLedgerClient(endpoint, credential);

foreach (var item in client.GetLedgerEntries("<collectionId>", "<fromTransactionId>", "<toTransactionId>"))
{
    JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement;
    Console.WriteLine(result.GetProperty("contents").ToString());
    Console.WriteLine(result.GetProperty("collectionId").ToString());
    Console.WriteLine(result.GetProperty("transactionId").ToString());
}

注釈

必要に応じて、コレクション ID を指定できます。 指定した (または既定の) コレクション内のエントリのみが返されます。

ページング可能な応答の 1 つの項目の JSON スキーマを次に示します。

応答本文:

LedgerEntriesスキーマ:

{
  contents: string, # Required. Contents of the ledger entry.
  collectionId: string, # Optional.
  transactionId: string, # Optional. A unique identifier for the state of the ledger. If returned as part of a LedgerEntry, it indicates the state from which the entry was read.
}

適用対象