你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn。
ConfidentialLedgerClient.GetLedgerEntries 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
[协议方法]从对应于某个范围的集合中获取账本条目。
- 此 协议方法 允许显式创建请求并处理高级方案的响应。
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。 仅返回指定 (或默认) 集合中的条目。
下面是可分页响应中一项的 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.
}