UNPKG

@azure/ai-language-text

Version:

An isomorphic client library for the text analysis features in the Azure Cognitive Language Service.

78 lines 2.51 kB
/* * 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"; import * as Parameters from "../models/parameters"; /** Class containing AnalyzeText operations. */ export class AnalyzeTextImpl { /** * Initialize a new instance of the class AnalyzeText class. * @param client Reference to the service client */ constructor(client) { this.client = client; } /** * Get the status of an analysis job. A job may consist of one or more tasks. Once all tasks are * succeeded, the job will transition to the succeeded state and results will be available for each * task. * @param jobId Job ID * @param options The options parameters. */ jobStatus(jobId, options) { return this.client.sendOperationRequest({ jobId, options }, jobStatusOperationSpec); } /** * Cancel a long-running Text Analysis job. * @param jobId Job ID * @param options The options parameters. */ cancelJob(jobId, options) { return this.client.sendOperationRequest({ jobId, options }, cancelJobOperationSpec); } } // Operation Specifications const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); const jobStatusOperationSpec = { path: "/analyze-text/jobs/{jobId}", httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.AnalyzeTextJobState }, default: { bodyMapper: Mappers.ErrorResponse } }, queryParameters: [ Parameters.apiVersion, Parameters.includeStatistics, Parameters.top, Parameters.skip ], urlParameters: [Parameters.endpoint, Parameters.jobId], headerParameters: [Parameters.accept], serializer }; const cancelJobOperationSpec = { path: "/analyze-text/jobs/{jobId}:cancel", httpMethod: "POST", responses: { 202: { headersMapper: Mappers.AnalyzeTextCancelJobHeaders }, default: { bodyMapper: Mappers.ErrorResponse } }, queryParameters: [Parameters.apiVersion], urlParameters: [Parameters.endpoint, Parameters.jobId], headerParameters: [Parameters.accept], serializer }; //# sourceMappingURL=analyzeText.js.map