Compartir a través de


SensorDataModels.GetSensorDataModels Método

Definición

Devuelve una lista paginada de recursos del modelo de datos del sensor.

public virtual Azure.Pageable<BinaryData> GetSensorDataModels (string sensorPartnerId, System.Collections.Generic.IEnumerable<string> ids = default, System.Collections.Generic.IEnumerable<string> names = default, System.Collections.Generic.IEnumerable<string> propertyFilters = default, System.Collections.Generic.IEnumerable<string> statuses = default, DateTimeOffset? minCreatedDateTime = default, DateTimeOffset? maxCreatedDateTime = default, DateTimeOffset? minLastModifiedDateTime = default, DateTimeOffset? maxLastModifiedDateTime = default, int? maxPageSize = default, string skipToken = default, Azure.RequestContext context = default);
abstract member GetSensorDataModels : string * seq<string> * seq<string> * seq<string> * seq<string> * Nullable<DateTimeOffset> * Nullable<DateTimeOffset> * Nullable<DateTimeOffset> * Nullable<DateTimeOffset> * Nullable<int> * string * Azure.RequestContext -> Azure.Pageable<BinaryData>
override this.GetSensorDataModels : string * seq<string> * seq<string> * seq<string> * seq<string> * Nullable<DateTimeOffset> * Nullable<DateTimeOffset> * Nullable<DateTimeOffset> * Nullable<DateTimeOffset> * Nullable<int> * string * Azure.RequestContext -> Azure.Pageable<BinaryData>
Public Overridable Function GetSensorDataModels (sensorPartnerId As String, Optional ids As IEnumerable(Of String) = Nothing, Optional names As IEnumerable(Of String) = Nothing, Optional propertyFilters As IEnumerable(Of String) = Nothing, Optional statuses As IEnumerable(Of String) = Nothing, Optional minCreatedDateTime As Nullable(Of DateTimeOffset) = Nothing, Optional maxCreatedDateTime As Nullable(Of DateTimeOffset) = Nothing, Optional minLastModifiedDateTime As Nullable(Of DateTimeOffset) = Nothing, Optional maxLastModifiedDateTime As Nullable(Of DateTimeOffset) = Nothing, Optional maxPageSize As Nullable(Of Integer) = Nothing, Optional skipToken As String = Nothing, Optional context As RequestContext = Nothing) As Pageable(Of BinaryData)

Parámetros

sensorPartnerId
String

Identificador del asociado del sensor asociado.

ids
IEnumerable<String>

Identificadores del recurso.

names
IEnumerable<String>

Nombres del recurso.

propertyFilters
IEnumerable<String>

Filtra los pares clave-valor dentro del objeto Properties. P. ej. "{testKey} eq {testValue}".

statuses
IEnumerable<String>

Estados del recurso.

minCreatedDateTime
Nullable<DateTimeOffset>

Fecha mínima de creación del recurso (ambos incluidos).

maxCreatedDateTime
Nullable<DateTimeOffset>

Fecha máxima de creación del recurso (ambos incluidos).

minLastModifiedDateTime
Nullable<DateTimeOffset>

Fecha mínima de última modificación del recurso (ambos incluidos).

maxLastModifiedDateTime
Nullable<DateTimeOffset>

Fecha máxima de última modificación del recurso (inclusive).

maxPageSize
Nullable<Int32>

Número máximo de elementos necesarios (ambos incluidos). Mínimo = 10, Máximo = 1000, Valor predeterminado = 50.

skipToken
String

Omita el token para obtener el siguiente conjunto de resultados.

context
RequestContext

Contexto de solicitud, que puede invalidar los comportamientos predeterminados de la canalización de cliente por llamada.

Devoluciones

del Pageable<T> servicio que contiene una lista de BinaryData objetos. Los detalles del esquema del cuerpo de cada elemento de la colección se encuentran en la sección Comentarios a continuación.

Excepciones

sensorPartnerId es null.

sensorPartnerId es una cadena vacía y se espera que no esté vacía.

El servicio devolvió un código de estado no correcto.

Ejemplos

En este ejemplo se muestra cómo llamar a GetSensorDataModels con los parámetros necesarios y analizar el resultado.

var credential = new DefaultAzureCredential();
var client = new FarmBeatsClient(credential).GetSensorDataModelsClient(<2022-11-01-preview>);

foreach (var data in client.GetSensorDataModels("<sensorPartnerId>"))
{
    JsonElement result = JsonDocument.Parse(data.ToStream()).RootElement;
    Console.WriteLine(result.GetProperty("measures").GetProperty("<test>").GetProperty("dataType").ToString());
}

En este ejemplo se muestra cómo llamar a GetSensorDataModels con todos los parámetros y cómo analizar el resultado.

var credential = new DefaultAzureCredential();
var client = new FarmBeatsClient(credential).GetSensorDataModelsClient(<2022-11-01-preview>);

foreach (var data in client.GetSensorDataModels("<sensorPartnerId>", new String[]{"<ids>"}, new String[]{"<names>"}, new String[]{"<propertyFilters>"}, new String[]{"<statuses>"}, DateTimeOffset.UtcNow, DateTimeOffset.UtcNow, DateTimeOffset.UtcNow, DateTimeOffset.UtcNow, 1234, "<skipToken>"))
{
    JsonElement result = JsonDocument.Parse(data.ToStream()).RootElement;
    Console.WriteLine(result.GetProperty("type").ToString());
    Console.WriteLine(result.GetProperty("manufacturer").ToString());
    Console.WriteLine(result.GetProperty("productCode").ToString());
    Console.WriteLine(result.GetProperty("measures").GetProperty("<test>").GetProperty("description").ToString());
    Console.WriteLine(result.GetProperty("measures").GetProperty("<test>").GetProperty("dataType").ToString());
    Console.WriteLine(result.GetProperty("measures").GetProperty("<test>").GetProperty("type").ToString());
    Console.WriteLine(result.GetProperty("measures").GetProperty("<test>").GetProperty("unit").ToString());
    Console.WriteLine(result.GetProperty("measures").GetProperty("<test>").GetProperty("properties").GetProperty("<test>").ToString());
    Console.WriteLine(result.GetProperty("sensorPartnerId").ToString());
    Console.WriteLine(result.GetProperty("id").ToString());
    Console.WriteLine(result.GetProperty("status").ToString());
    Console.WriteLine(result.GetProperty("createdDateTime").ToString());
    Console.WriteLine(result.GetProperty("modifiedDateTime").ToString());
    Console.WriteLine(result.GetProperty("eTag").ToString());
    Console.WriteLine(result.GetProperty("name").ToString());
    Console.WriteLine(result.GetProperty("description").ToString());
    Console.WriteLine(result.GetProperty("createdBy").ToString());
    Console.WriteLine(result.GetProperty("modifiedBy").ToString());
    Console.WriteLine(result.GetProperty("properties").GetProperty("<test>").ToString());
}

Comentarios

A continuación se muestra el esquema JSON de un elemento de la respuesta paginable.

Cuerpo de la respuesta:

Esquema para SensorDataModelListResponseValue:

{
  type: string, # Optional. Type of sensor.
  manufacturer: string, # Optional. Sensor manufacturer.
  productCode: string, # Optional. Sensor productCode.
  measures: Dictionary<string, SensorDataModelMeasure>, # Required. Map of sensor type to sensor measures.
  sensorPartnerId: string, # Optional. Id of the associated sensor partner.
  id: string, # Optional. Id of the resource.
  status: string, # Optional. Status of the resource.
  createdDateTime: string (ISO 8601 Format), # Optional. Date-time when resource was created, sample format: yyyy-MM-ddTHH:mm:ssZ.
  modifiedDateTime: string (ISO 8601 Format), # Optional. Date-time when resource was last modified, sample format: yyyy-MM-ddTHH:mm:ssZ.
  eTag: string, # Optional. The ETag value to implement optimistic concurrency.
  name: string, # Optional. Name to identify resource.
  description: string, # Optional. Textual description of the resource.
  createdBy: string, # Optional. Created by user/tenant id.
  modifiedBy: string, # Optional. Modified by user/tenant id.
  properties: Dictionary<string, any>, # Optional. A collection of key value pairs that belongs to the resource.
Each pair must not have a key greater than 50 characters
and must not have a value greater than 150 characters.
Note: A maximum of 25 key value pairs can be provided for a resource and
only string, numeral and datetime (yyyy-MM-ddTHH:mm:ssZ) values are supported.
}

Se aplica a