import * as coreClient from "@azure/core-client" ; import * as Parameters from "./models/parameters" ; import * as Mappers from "./models/mappers" ; import { GeneratedClientOptionalParams , AnalyzeOptionalParams , AnalyzeResponse , AnalyzeStatusOptionalParams , AnalyzeStatusResponse , HealthStatusOptionalParams , HealthStatusResponse , CancelHealthJobOptionalParams , CancelHealthJobResponse , MultiLanguageBatchInput , HealthOptionalParams , HealthResponse , EntitiesRecognitionGeneralOptionalParams , EntitiesRecognitionGeneralResponse , EntitiesRecognitionPiiOptionalParams , EntitiesRecognitionPiiResponse , EntitiesLinkingOptionalParams , EntitiesLinkingResponse , KeyPhrasesOptionalParams , KeyPhrasesResponse , LanguageBatchInput , LanguagesOptionalParams , LanguagesResponse , SentimentOptionalParams , SentimentOperationResponse } from "./models" ; internal export class GeneratedClient extends coreClient . ServiceClient { endpoint : string ; param endpoint param options constructor ( endpoint , options ? ) { if ( endpoint === undefined ) { throw new Error ( "'endpoint' cannot be null" ) ; } if ( ! options ) { options = { } ; } const defaults = { requestContentType : "application/json; charset=utf-8" } ; const packageDetails = `azsdk-js-textanalytics/1.0.0-preview1` ; const userAgentPrefix = options . userAgentOptions && options . userAgentOptions . userAgentPrefix ? `${ options . userAgentOptions . userAgentPrefix } ${ packageDetails }` : `${ packageDetails }` ; const optionsWithDefaults = { ... defaults , ... options , userAgentOptions : { userAgentPrefix } , baseUri : options . endpoint || "{Endpoint}/text/analytics/v3.1-preview.4" } ; super ( optionsWithDefaults ) ; this . endpoint = endpoint ; } param options analyze ( options ? ) { return this . sendOperationRequest ( { options } , analyzeOperationSpec ) ; } param jobId param options analyzeStatus ( jobId , options ? ) { return this . sendOperationRequest ( { jobId , options } , analyzeStatusOperationSpec ) ; } param jobId param options healthStatus ( jobId , options ? ) { return this . sendOperationRequest ( { jobId , options } , healthStatusOperationSpec ) ; } param jobId param options cancelHealthJob ( jobId , options ? ) { return this . sendOperationRequest ( { jobId , options } , cancelHealthJobOperationSpec ) ; } param input param options health ( input , options ? ) { return this . sendOperationRequest ( { input , options } , healthOperationSpec ) ; } param input param options entitiesRecognitionGeneral ( input , options ? ) { return this . sendOperationRequest ( { input , options } , entitiesRecognitionGeneralOperationSpec ) ; } param input param options entitiesRecognitionPii ( input , options ? ) { return this . sendOperationRequest ( { input , options } , entitiesRecognitionPiiOperationSpec ) ; } param input param options entitiesLinking ( input , options ? ) { return this . sendOperationRequest ( { input , options } , entitiesLinkingOperationSpec ) ; } param input param options keyPhrases ( input , options ? ) { return this . sendOperationRequest ( { input , options } , keyPhrasesOperationSpec ) ; } param input param options languages ( input , options ? ) { return this . sendOperationRequest ( { input , options } , languagesOperationSpec ) ; } param input param options sentiment ( input , options ? ) { return this . sendOperationRequest ( { input , options } , sentimentOperationSpec ) ; } } const serializer = coreClient . createSerializer ( Mappers , false ) ; const analyzeOperationSpec = { path : "/analyze" , httpMethod : "POST" , responses : { 202 : { headersMapper : Mappers . GeneratedClientAnalyzeHeaders } , 400 : { bodyMapper : Mappers . ErrorResponse , isError : true } , 500 : { bodyMapper : Mappers . ErrorResponse , isError : true } } , requestBody : Parameters . body , urlParameters : [ Parameters . endpoint ] , headerParameters : [ Parameters . contentType , Parameters . accept ] , mediaType : "json" , serializer } ; const analyzeStatusOperationSpec = { path : "/analyze/jobs/{jobId}" , httpMethod : "GET" , responses : { 200 : { bodyMapper : Mappers . AnalyzeJobState } , 404 : { bodyMapper : Mappers . ErrorResponse , isError : true } , 500 : { bodyMapper : Mappers . ErrorResponse , isError : true } } , queryParameters : [ Parameters . includeStatistics , Parameters . top , Parameters . skip ] , urlParameters : [ Parameters . endpoint , Parameters . jobId ] , headerParameters : [ Parameters . accept ] , serializer } ; const healthStatusOperationSpec = { path : "/entities/health/jobs/{jobId}" , httpMethod : "GET" , responses : { 200 : { bodyMapper : Mappers . HealthcareJobState } , 404 : { bodyMapper : Mappers . ErrorResponse , isError : true } , 500 : { bodyMapper : Mappers . ErrorResponse , isError : true } } , queryParameters : [ Parameters . includeStatistics , Parameters . top , Parameters . skip ] , urlParameters : [ Parameters . endpoint , Parameters . jobId1 ] , headerParameters : [ Parameters . accept ] , serializer } ; const cancelHealthJobOperationSpec = { path : "/entities/health/jobs/{jobId}" , httpMethod : "DELETE" , responses : { 202 : { headersMapper : Mappers . GeneratedClientCancelHealthJobHeaders } , 404 : { bodyMapper : Mappers . ErrorResponse , isError : true } , 500 : { bodyMapper : Mappers . ErrorResponse , isError : true } } , urlParameters : [ Parameters . endpoint , Parameters . jobId1 ] , headerParameters : [ Parameters . accept ] , serializer } ; const healthOperationSpec = { path : "/entities/health/jobs" , httpMethod : "POST" , responses : { 202 : { headersMapper : Mappers . GeneratedClientHealthHeaders } , 400 : { bodyMapper : Mappers . ErrorResponse , isError : true } , 500 : { bodyMapper : Mappers . ErrorResponse , isError : true } } , requestBody : Parameters . input , queryParameters : [ Parameters . modelVersion , Parameters . stringIndexType ] , urlParameters : [ Parameters . endpoint ] , headerParameters : [ Parameters . contentType , Parameters . accept ] , mediaType : "json" , serializer } ; const entitiesRecognitionGeneralOperationSpec = { path : "/entities/recognition/general" , httpMethod : "POST" , responses : { 200 : { bodyMapper : Mappers . EntitiesResult } , 400 : { bodyMapper : Mappers . ErrorResponse , isError : true } , 500 : { bodyMapper : Mappers . ErrorResponse , isError : true } } , requestBody : Parameters . input , queryParameters : [ Parameters . includeStatistics , Parameters . modelVersion , Parameters . stringIndexType ] , urlParameters : [ Parameters . endpoint ] , headerParameters : [ Parameters . contentType , Parameters . accept ] , mediaType : "json" , serializer } ; const entitiesRecognitionPiiOperationSpec = { path : "/entities/recognition/pii" , httpMethod : "POST" , responses : { 200 : { bodyMapper : Mappers . PiiResult } , 400 : { bodyMapper : Mappers . ErrorResponse , isError : true } , 500 : { bodyMapper : Mappers . ErrorResponse , isError : true } } , requestBody : Parameters . input , queryParameters : [ Parameters . includeStatistics , Parameters . modelVersion , Parameters . stringIndexType , Parameters . domain , Parameters . piiCategories ] , urlParameters : [ Parameters . endpoint ] , headerParameters : [ Parameters . contentType , Parameters . accept ] , mediaType : "json" , serializer } ; const entitiesLinkingOperationSpec = { path : "/entities/linking" , httpMethod : "POST" , responses : { 200 : { bodyMapper : Mappers . EntityLinkingResult } , 400 : { bodyMapper : Mappers . ErrorResponse , isError : true } , 500 : { bodyMapper : Mappers . ErrorResponse , isError : true } } , requestBody : Parameters . input , queryParameters : [ Parameters . includeStatistics , Parameters . modelVersion , Parameters . stringIndexType ] , urlParameters : [ Parameters . endpoint ] , headerParameters : [ Parameters . contentType , Parameters . accept ] , mediaType : "json" , serializer } ; const keyPhrasesOperationSpec = { path : "/keyPhrases" , httpMethod : "POST" , responses : { 200 : { bodyMapper : Mappers . KeyPhraseResult } , 400 : { bodyMapper : Mappers . ErrorResponse , isError : true } , 500 : { bodyMapper : Mappers . ErrorResponse , isError : true } } , requestBody : Parameters . input , queryParameters : [ Parameters . includeStatistics , Parameters . modelVersion ] , urlParameters : [ Parameters . endpoint ] , headerParameters : [ Parameters . contentType , Parameters . accept ] , mediaType : "json" , serializer } ; const languagesOperationSpec = { path : "/languages" , httpMethod : "POST" , responses : { 200 : { bodyMapper : Mappers . LanguageResult } , 400 : { bodyMapper : Mappers . ErrorResponse , isError : true } , 500 : { bodyMapper : Mappers . ErrorResponse , isError : true } } , requestBody : Parameters . input1 , queryParameters : [ Parameters . includeStatistics , Parameters . modelVersion ] , urlParameters : [ Parameters . endpoint ] , headerParameters : [ Parameters . contentType , Parameters . accept ] , mediaType : "json" , serializer } ; const sentimentOperationSpec = { path : "/sentiment" , httpMethod : "POST" , responses : { 200 : { bodyMapper : Mappers . SentimentResponse } , 400 : { bodyMapper : Mappers . ErrorResponse , isError : true } , 500 : { bodyMapper : Mappers . ErrorResponse , isError : true } } , requestBody : Parameters . input , queryParameters : [ Parameters . includeStatistics , Parameters . modelVersion , Parameters . stringIndexType , Parameters . opinionMining ] , urlParameters : [ Parameters . endpoint ] , headerParameters : [ Parameters . contentType , Parameters . accept ] , mediaType : "json" , serializer } ;