@azure/digital-twins-core
Version:
An isomorphic client library for Azure Digital Twins
64 lines • 2.29 kB
JavaScript
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
import * as coreClient from "@azure/core-client";
import * as Mappers from "../models/mappers.js";
import * as Parameters from "../models/parameters.js";
/** Class containing Query operations. */
export class QueryImpl {
/**
* Initialize a new instance of the class Query class.
* @param client Reference to the service client
*/
constructor(client) {
this.client = client;
}
/**
* Executes a query that allows traversing relationships and filtering by property values.
* Status codes:
* * 200 OK
* * 400 Bad Request
* * BadRequest - The continuation token is invalid.
* * SqlQueryError - The query contains some errors.
* * TimeoutError - The query execution timed out after 60 seconds. Try simplifying the query or
* adding conditions to reduce the result size.
* * 429 Too Many Requests
* * QuotaReachedError - The maximum query rate limit has been reached.
* @param querySpecification The query specification to execute.
* @param options The options parameters.
*/
queryTwins(querySpecification, options) {
return this.client.sendOperationRequest({ querySpecification, options }, queryTwinsOperationSpec);
}
}
// Operation Specifications
const serializer = coreClient.createSerializer(Mappers, /* isXml */ false);
const queryTwinsOperationSpec = {
path: "/query",
httpMethod: "POST",
responses: {
200: {
bodyMapper: Mappers.QueryResult,
headersMapper: Mappers.QueryQueryTwinsHeaders,
},
default: {
bodyMapper: Mappers.ErrorResponse,
headersMapper: Mappers.QueryQueryTwinsExceptionHeaders,
},
},
requestBody: Parameters.querySpecification,
queryParameters: [Parameters.apiVersion],
urlParameters: [Parameters.$host],
headerParameters: [
Parameters.contentType,
Parameters.accept,
Parameters.resultsPerPage,
],
mediaType: "json",
serializer,
};
//# sourceMappingURL=query.js.map