DocumentIntelligenceAdministrationClient.GetModels Method

Definition

Overloads

GetModels(RequestContext)

[Protocol Method] List all document models

  • This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
  • Please try the simpler GetModels(CancellationToken) convenience overload with strongly typed models first.
GetModels(CancellationToken)

List all document models.

GetModels(RequestContext)

Source:
DocumentIntelligenceAdministrationClient.cs

[Protocol Method] List all document models

  • This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
  • Please try the simpler GetModels(CancellationToken) convenience overload with strongly typed models first.
public virtual Azure.Pageable<BinaryData> GetModels (Azure.RequestContext context);
abstract member GetModels : Azure.RequestContext -> Azure.Pageable<BinaryData>
override this.GetModels : Azure.RequestContext -> Azure.Pageable<BinaryData>
Public Overridable Function GetModels (context As RequestContext) 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 GetModels and parse the result.

Uri endpoint = new Uri("<https://my-service.azure.com>");
AzureKeyCredential credential = new AzureKeyCredential("<key>");
DocumentIntelligenceAdministrationClient client = new DocumentIntelligenceAdministrationClient(endpoint, credential);

foreach (BinaryData item in client.GetModels(null))
{
    JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement;
    Console.WriteLine(result.GetProperty("modelId").ToString());
    Console.WriteLine(result.GetProperty("createdDateTime").ToString());
}

This sample shows how to call GetModels with all parameters and parse the result.

Uri endpoint = new Uri("<https://my-service.azure.com>");
AzureKeyCredential credential = new AzureKeyCredential("<key>");
DocumentIntelligenceAdministrationClient client = new DocumentIntelligenceAdministrationClient(endpoint, credential);

foreach (BinaryData item in client.GetModels(null))
{
    JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement;
    Console.WriteLine(result.GetProperty("modelId").ToString());
    Console.WriteLine(result.GetProperty("description").ToString());
    Console.WriteLine(result.GetProperty("createdDateTime").ToString());
    Console.WriteLine(result.GetProperty("expirationDateTime").ToString());
    Console.WriteLine(result.GetProperty("apiVersion").ToString());
    Console.WriteLine(result.GetProperty("tags").GetProperty("<key>").ToString());
    Console.WriteLine(result.GetProperty("buildMode").ToString());
    Console.WriteLine(result.GetProperty("azureBlobSource").GetProperty("containerUrl").ToString());
    Console.WriteLine(result.GetProperty("azureBlobSource").GetProperty("prefix").ToString());
    Console.WriteLine(result.GetProperty("azureBlobFileListSource").GetProperty("containerUrl").ToString());
    Console.WriteLine(result.GetProperty("azureBlobFileListSource").GetProperty("fileList").ToString());
    Console.WriteLine(result.GetProperty("classifierId").ToString());
    Console.WriteLine(result.GetProperty("split").ToString());
    Console.WriteLine(result.GetProperty("docTypes").GetProperty("<key>").GetProperty("description").ToString());
    Console.WriteLine(result.GetProperty("docTypes").GetProperty("<key>").GetProperty("buildMode").ToString());
    Console.WriteLine(result.GetProperty("docTypes").GetProperty("<key>").GetProperty("fieldSchema").GetProperty("<key>").GetProperty("type").ToString());
    Console.WriteLine(result.GetProperty("docTypes").GetProperty("<key>").GetProperty("fieldSchema").GetProperty("<key>").GetProperty("description").ToString());
    Console.WriteLine(result.GetProperty("docTypes").GetProperty("<key>").GetProperty("fieldSchema").GetProperty("<key>").GetProperty("example").ToString());
    Console.WriteLine(result.GetProperty("docTypes").GetProperty("<key>").GetProperty("fieldSchema").GetProperty("<key>").GetProperty("items").GetProperty("type").ToString());
    Console.WriteLine(result.GetProperty("docTypes").GetProperty("<key>").GetProperty("fieldSchema").GetProperty("<key>").GetProperty("items").GetProperty("description").ToString());
    Console.WriteLine(result.GetProperty("docTypes").GetProperty("<key>").GetProperty("fieldSchema").GetProperty("<key>").GetProperty("items").GetProperty("example").ToString());
    Console.WriteLine(result.GetProperty("docTypes").GetProperty("<key>").GetProperty("fieldSchema").GetProperty("<key>").GetProperty("properties").GetProperty("<key>").GetProperty("type").ToString());
    Console.WriteLine(result.GetProperty("docTypes").GetProperty("<key>").GetProperty("fieldSchema").GetProperty("<key>").GetProperty("properties").GetProperty("<key>").GetProperty("description").ToString());
    Console.WriteLine(result.GetProperty("docTypes").GetProperty("<key>").GetProperty("fieldSchema").GetProperty("<key>").GetProperty("properties").GetProperty("<key>").GetProperty("example").ToString());
    Console.WriteLine(result.GetProperty("docTypes").GetProperty("<key>").GetProperty("fieldSchema").GetProperty("<key>").GetProperty("properties").GetProperty("<key>").GetProperty("items").GetProperty("type").ToString());
    Console.WriteLine(result.GetProperty("docTypes").GetProperty("<key>").GetProperty("fieldSchema").GetProperty("<key>").GetProperty("properties").GetProperty("<key>").GetProperty("items").GetProperty("description").ToString());
    Console.WriteLine(result.GetProperty("docTypes").GetProperty("<key>").GetProperty("fieldSchema").GetProperty("<key>").GetProperty("properties").GetProperty("<key>").GetProperty("items").GetProperty("example").ToString());
    Console.WriteLine(result.GetProperty("docTypes").GetProperty("<key>").GetProperty("fieldConfidence").GetProperty("<key>").ToString());
    Console.WriteLine(result.GetProperty("docTypes").GetProperty("<key>").GetProperty("modelId").ToString());
    Console.WriteLine(result.GetProperty("docTypes").GetProperty("<key>").GetProperty("confidenceThreshold").ToString());
    Console.WriteLine(result.GetProperty("docTypes").GetProperty("<key>").GetProperty("features")[0].ToString());
    Console.WriteLine(result.GetProperty("docTypes").GetProperty("<key>").GetProperty("queryFields")[0].ToString());
    Console.WriteLine(result.GetProperty("docTypes").GetProperty("<key>").GetProperty("maxDocumentsToAnalyze").ToString());
    Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("code").ToString());
    Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("message").ToString());
    Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("target").ToString());
    Console.WriteLine(result.GetProperty("trainingHours").ToString());
}

Applies to

GetModels(CancellationToken)

Source:
DocumentIntelligenceAdministrationClient.cs

List all document models.

public virtual Azure.Pageable<Azure.AI.DocumentIntelligence.DocumentModelDetails> GetModels (System.Threading.CancellationToken cancellationToken = default);
abstract member GetModels : System.Threading.CancellationToken -> Azure.Pageable<Azure.AI.DocumentIntelligence.DocumentModelDetails>
override this.GetModels : System.Threading.CancellationToken -> Azure.Pageable<Azure.AI.DocumentIntelligence.DocumentModelDetails>
Public Overridable Function GetModels (Optional cancellationToken As CancellationToken = Nothing) As Pageable(Of DocumentModelDetails)

Parameters

cancellationToken
CancellationToken

The cancellation token to use.

Returns

Examples

This sample shows how to call GetModels.

Uri endpoint = new Uri("<https://my-service.azure.com>");
AzureKeyCredential credential = new AzureKeyCredential("<key>");
DocumentIntelligenceAdministrationClient client = new DocumentIntelligenceAdministrationClient(endpoint, credential);

foreach (DocumentModelDetails item in client.GetModels())
{
}

This sample shows how to call GetModels with all parameters.

Uri endpoint = new Uri("<https://my-service.azure.com>");
AzureKeyCredential credential = new AzureKeyCredential("<key>");
DocumentIntelligenceAdministrationClient client = new DocumentIntelligenceAdministrationClient(endpoint, credential);

foreach (DocumentModelDetails item in client.GetModels())
{
}

Applies to