/**
 * Language API
 * OCI Language Service solutions can help enterprise customers integrate AI into their products immediately using our proven,
    pre-trained and custom models or containers, without a need to set up an house team of AI and ML experts.
    This allows enterprises to focus on business drivers and development work rather than AI and ML operations, which shortens the time to market.

 * OpenAPI spec version: 20210101
 *
 *
 * NOTE: This class is auto generated by OracleSDKGenerator.
 * Do not edit the class manually.
 *
 * Copyright (c) 2020, 2022, Oracle and/or its affiliates.  All rights reserved.
 * This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.
 */ import common = require ( "oci-common" ) ; import * as requests from "./request" ; import * as model from "./model" ; import * as responses from "./response" ; import { composeResponse , composeRequest , GenericRetrier } from "oci-common" ; export enum AIServiceLanguageApiKeys { } /**
 * This service client uses  common . CircuitBreaker . DefaultConfiguration for all the operations by default if no circuit breaker configuration is defined by the user.
  export class AIServiceLanguageClient { protected static serviceEndpointTemplate = "https://language.aiservice.{region}.oci.{secondLevelDomain}" ; protected "_endpoint" : string = "" ; protected "_defaultHeaders" : any = { } ; protected "_clientConfiguration" : common . ClientConfiguration ; protected _circuitBreaker = null ; protected _httpClient : common . HttpClient ; constructor ( params , clientConfiguration ? ) { const requestSigner = params . authenticationDetailsProvider ? new common . DefaultRequestSigner ( params . authenticationDetailsProvider ) : null ; if ( clientConfiguration ) { this . _clientConfiguration = clientConfiguration ; this . _circuitBreaker = clientConfiguration . circuitBreaker ? clientConfiguration . circuitBreaker ! . circuit : null ; } const specCircuitBreakerEnabled = true ; if ( ! this . _circuitBreaker && common . utils . isCircuitBreakerSystemEnabled ( clientConfiguration ! ) && ( specCircuitBreakerEnabled || common . CircuitBreaker . DefaultCircuitBreakerOverriden ) ) { this . _circuitBreaker = new common . CircuitBreaker ( ) . circuit ; } this . _httpClient = params . httpClient || new common . FetchHttpClient ( requestSigner , this . _circuitBreaker ) ; if ( params . authenticationDetailsProvider && common . isRegionProvider ( params . authenticationDetailsProvider ) ) { const provider = params . authenticationDetailsProvider ; if ( provider . getRegion ( ) ) { this . region = provider . getRegion ( ) ; } } } /**
     * Get the endpoint that is being used to call (ex, https://www.example.com).
     */ public get endpoint ( ) { return this . _endpoint ; } param endpoint public set endpoint ( endpoint ) { this . _endpoint = endpoint ; this . _endpoint = this . _endpoint + "/20210101" ; if ( this . logger ) this . logger . info ( `AIServiceLanguageClient endpoint set to ${ this . _endpoint }` ) ; } public get logger ( ) { return common . LOG . logger ; } /**
     * Sets the region to call (ex, Region.US_PHOENIX_1).
     * Note, this will call  {@link #endpoint(String) endpoint} after resolving the endpoint.
     *  param region public set region ( region ) { this . endpoint = common . EndpointBuilder . createEndpointFromRegion ( AIServiceLanguageClient . serviceEndpointTemplate , region ) ; } /**
     * Sets the regionId to call (ex, 'us-phoenix-1').
     *
     * Note, this will first try to map the region ID to a known Region and call  {@link #region(Region) region} .
     * If no known Region could be determined, it will create an endpoint assuming its in default Realm OC1
     * and then call  {@link #endpoint(String) endpoint} .
     *  param regionId public set regionId ( regionId ) { this . endpoint = common . EndpointBuilder . createEndpointFromRegionId ( AIServiceLanguageClient . serviceEndpointTemplate , regionId ) ; } param BatchDetectDominantLanguageRequest return throws example Click  https to see how to use BatchDetectDominantLanguage API.
      public async batchDetectDominantLanguage ( batchDetectDominantLanguageRequest ) { if ( this . logger ) this . logger . debug ( "Calling operation AIServiceLanguageClient#batchDetectDominantLanguage." ) ; const pathParams = { } ; const queryParams = { } ; let headerParams = { "Content-Type" : common . Constants . APPLICATION_JSON , "opc-request-id" : batchDetectDominantLanguageRequest . opcRequestId } ; const specRetryConfiguration = common . NoRetryConfigurationDetails ; const retrier = GenericRetrier . createPreferredRetrier ( this . _clientConfiguration ? this . _clientConfiguration . retryConfiguration : undefined , batchDetectDominantLanguageRequest . retryConfiguration , specRetryConfiguration ) ; if ( this . logger ) retrier . logger = this . logger ; const request = await composeRequest ( { baseEndpoint : this . _endpoint , defaultHeaders : this . _defaultHeaders , path : "/actions/batchDetectDominantLanguage" , method : "POST" , bodyContent : common . ObjectSerializer . serialize ( batchDetectDominantLanguageRequest . batchDetectDominantLanguageDetails , "BatchDetectDominantLanguageDetails" , model . BatchDetectDominantLanguageDetails . getJsonObj ) , pathParams : pathParams , headerParams : headerParams , queryParams : queryParams } ) ; try { const response = await retrier . makeServiceCall ( this . _httpClient , request ) ; const sdkResponse = composeResponse ( { responseObject : < responses . BatchDetectDominantLanguageResponse > { } , body : await response . json ( ) , bodyKey : "batchDetectDominantLanguageResult" , bodyModel : model . BatchDetectDominantLanguageResult , type : "model.BatchDetectDominantLanguageResult" , responseHeaders : [ { value : response . headers . get ( "opc-request-id" ) , key : "opcRequestId" , dataType : "string" } ] } ) ; return sdkResponse ; } catch ( err ) { throw err ; } } param BatchDetectLanguageEntitiesRequest return throws example Click  https to see how to use BatchDetectLanguageEntities API.
      public async batchDetectLanguageEntities ( batchDetectLanguageEntitiesRequest ) { if ( this . logger ) this . logger . debug ( "Calling operation AIServiceLanguageClient#batchDetectLanguageEntities." ) ; const pathParams = { } ; const queryParams = { } ; let headerParams = { "Content-Type" : common . Constants . APPLICATION_JSON , "opc-request-id" : batchDetectLanguageEntitiesRequest . opcRequestId } ; const specRetryConfiguration = common . NoRetryConfigurationDetails ; const retrier = GenericRetrier . createPreferredRetrier ( this . _clientConfiguration ? this . _clientConfiguration . retryConfiguration : undefined , batchDetectLanguageEntitiesRequest . retryConfiguration , specRetryConfiguration ) ; if ( this . logger ) retrier . logger = this . logger ; const request = await composeRequest ( { baseEndpoint : this . _endpoint , defaultHeaders : this . _defaultHeaders , path : "/actions/batchDetectLanguageEntities" , method : "POST" , bodyContent : common . ObjectSerializer . serialize ( batchDetectLanguageEntitiesRequest . batchDetectLanguageEntitiesDetails , "BatchDetectLanguageEntitiesDetails" , model . BatchDetectLanguageEntitiesDetails . getJsonObj ) , pathParams : pathParams , headerParams : headerParams , queryParams : queryParams } ) ; try { const response = await retrier . makeServiceCall ( this . _httpClient , request ) ; const sdkResponse = composeResponse ( { responseObject : < responses . BatchDetectLanguageEntitiesResponse > { } , body : await response . json ( ) , bodyKey : "batchDetectLanguageEntitiesResult" , bodyModel : model . BatchDetectLanguageEntitiesResult , type : "model.BatchDetectLanguageEntitiesResult" , responseHeaders : [ { value : response . headers . get ( "opc-request-id" ) , key : "opcRequestId" , dataType : "string" } ] } ) ; return sdkResponse ; } catch ( err ) { throw err ; } } param BatchDetectLanguageKeyPhrasesRequest return throws example Click  https to see how to use BatchDetectLanguageKeyPhrases API.
      public async batchDetectLanguageKeyPhrases ( batchDetectLanguageKeyPhrasesRequest ) { if ( this . logger ) this . logger . debug ( "Calling operation AIServiceLanguageClient#batchDetectLanguageKeyPhrases." ) ; const pathParams = { } ; const queryParams = { } ; let headerParams = { "Content-Type" : common . Constants . APPLICATION_JSON , "opc-request-id" : batchDetectLanguageKeyPhrasesRequest . opcRequestId } ; const specRetryConfiguration = common . NoRetryConfigurationDetails ; const retrier = GenericRetrier . createPreferredRetrier ( this . _clientConfiguration ? this . _clientConfiguration . retryConfiguration : undefined , batchDetectLanguageKeyPhrasesRequest . retryConfiguration , specRetryConfiguration ) ; if ( this . logger ) retrier . logger = this . logger ; const request = await composeRequest ( { baseEndpoint : this . _endpoint , defaultHeaders : this . _defaultHeaders , path : "/actions/batchDetectLanguageKeyPhrases" , method : "POST" , bodyContent : common . ObjectSerializer . serialize ( batchDetectLanguageKeyPhrasesRequest . batchDetectLanguageKeyPhrasesDetails , "BatchDetectLanguageKeyPhrasesDetails" , model . BatchDetectLanguageKeyPhrasesDetails . getJsonObj ) , pathParams : pathParams , headerParams : headerParams , queryParams : queryParams } ) ; try { const response = await retrier . makeServiceCall ( this . _httpClient , request ) ; const sdkResponse = composeResponse ( { responseObject : < responses . BatchDetectLanguageKeyPhrasesResponse > { } , body : await response . json ( ) , bodyKey : "batchDetectLanguageKeyPhrasesResult" , bodyModel : model . BatchDetectLanguageKeyPhrasesResult , type : "model.BatchDetectLanguageKeyPhrasesResult" , responseHeaders : [ { value : response . headers . get ( "opc-request-id" ) , key : "opcRequestId" , dataType : "string" } ] } ) ; return sdkResponse ; } catch ( err ) { throw err ; } } param BatchDetectLanguageSentimentsRequest return throws example Click  https to see how to use BatchDetectLanguageSentiments API.
      public async batchDetectLanguageSentiments ( batchDetectLanguageSentimentsRequest ) { if ( this . logger ) this . logger . debug ( "Calling operation AIServiceLanguageClient#batchDetectLanguageSentiments." ) ; const pathParams = { } ; const queryParams = { "level" : batchDetectLanguageSentimentsRequest . level } ; let headerParams = { "Content-Type" : common . Constants . APPLICATION_JSON , "opc-request-id" : batchDetectLanguageSentimentsRequest . opcRequestId } ; const specRetryConfiguration = common . NoRetryConfigurationDetails ; const retrier = GenericRetrier . createPreferredRetrier ( this . _clientConfiguration ? this . _clientConfiguration . retryConfiguration : undefined , batchDetectLanguageSentimentsRequest . retryConfiguration , specRetryConfiguration ) ; if ( this . logger ) retrier . logger = this . logger ; const request = await composeRequest ( { baseEndpoint : this . _endpoint , defaultHeaders : this . _defaultHeaders , path : "/actions/batchDetectLanguageSentiments" , method : "POST" , bodyContent : common . ObjectSerializer . serialize ( batchDetectLanguageSentimentsRequest . batchDetectLanguageSentimentsDetails , "BatchDetectLanguageSentimentsDetails" , model . BatchDetectLanguageSentimentsDetails . getJsonObj ) , pathParams : pathParams , headerParams : headerParams , queryParams : queryParams } ) ; try { const response = await retrier . makeServiceCall ( this . _httpClient , request ) ; const sdkResponse = composeResponse ( { responseObject : < responses . BatchDetectLanguageSentimentsResponse > { } , body : await response . json ( ) , bodyKey : "batchDetectLanguageSentimentsResult" , bodyModel : model . BatchDetectLanguageSentimentsResult , type : "model.BatchDetectLanguageSentimentsResult" , responseHeaders : [ { value : response . headers . get ( "opc-request-id" ) , key : "opcRequestId" , dataType : "string" } ] } ) ; return sdkResponse ; } catch ( err ) { throw err ; } } param BatchDetectLanguageTextClassificationRequest return throws example Click  https to see how to use BatchDetectLanguageTextClassification API.
      public async batchDetectLanguageTextClassification ( batchDetectLanguageTextClassificationRequest ) { if ( this . logger ) this . logger . debug ( "Calling operation AIServiceLanguageClient#batchDetectLanguageTextClassification." ) ; const pathParams = { } ; const queryParams = { } ; let headerParams = { "Content-Type" : common . Constants . APPLICATION_JSON , "opc-request-id" : batchDetectLanguageTextClassificationRequest . opcRequestId } ; const specRetryConfiguration = common . NoRetryConfigurationDetails ; const retrier = GenericRetrier . createPreferredRetrier ( this . _clientConfiguration ? this . _clientConfiguration . retryConfiguration : undefined , batchDetectLanguageTextClassificationRequest . retryConfiguration , specRetryConfiguration ) ; if ( this . logger ) retrier . logger = this . logger ; const request = await composeRequest ( { baseEndpoint : this . _endpoint , defaultHeaders : this . _defaultHeaders , path : "/actions/batchDetectLanguageTextClassification" , method : "POST" , bodyContent : common . ObjectSerializer . serialize ( batchDetectLanguageTextClassificationRequest . batchDetectLanguageTextClassificationDetails , "BatchDetectLanguageTextClassificationDetails" , model . BatchDetectLanguageTextClassificationDetails . getJsonObj ) , pathParams : pathParams , headerParams : headerParams , queryParams : queryParams } ) ; try { const response = await retrier . makeServiceCall ( this . _httpClient , request ) ; const sdkResponse = composeResponse ( { responseObject : < responses . BatchDetectLanguageTextClassificationResponse > { } , body : await response . json ( ) , bodyKey : "batchDetectLanguageTextClassificationResult" , bodyModel : model . BatchDetectLanguageTextClassificationResult , type : "model.BatchDetectLanguageTextClassificationResult" , responseHeaders : [ { value : response . headers . get ( "opc-request-id" ) , key : "opcRequestId" , dataType : "string" } ] } ) ; return sdkResponse ; } catch ( err ) { throw err ; } } param DetectDominantLanguageRequest return throws example Click  https to see how to use DetectDominantLanguage API.
      public async detectDominantLanguage ( detectDominantLanguageRequest ) { if ( this . logger ) this . logger . debug ( "Calling operation AIServiceLanguageClient#detectDominantLanguage." ) ; const pathParams = { } ; const queryParams = { } ; let headerParams = { "Content-Type" : common . Constants . APPLICATION_JSON , "opc-request-id" : detectDominantLanguageRequest . opcRequestId } ; const specRetryConfiguration = common . NoRetryConfigurationDetails ; const retrier = GenericRetrier . createPreferredRetrier ( this . _clientConfiguration ? this . _clientConfiguration . retryConfiguration : undefined , detectDominantLanguageRequest . retryConfiguration , specRetryConfiguration ) ; if ( this . logger ) retrier . logger = this . logger ; const request = await composeRequest ( { baseEndpoint : this . _endpoint , defaultHeaders : this . _defaultHeaders , path : "/actions/detectDominantLanguage" , method : "POST" , bodyContent : common . ObjectSerializer . serialize ( detectDominantLanguageRequest . detectDominantLanguageDetails , "DetectDominantLanguageDetails" , model . DetectDominantLanguageDetails . getJsonObj ) , pathParams : pathParams , headerParams : headerParams , queryParams : queryParams } ) ; try { const response = await retrier . makeServiceCall ( this . _httpClient , request ) ; const sdkResponse = composeResponse ( { responseObject : < responses . DetectDominantLanguageResponse > { } , body : await response . json ( ) , bodyKey : "detectDominantLanguageResult" , bodyModel : model . DetectDominantLanguageResult , type : "model.DetectDominantLanguageResult" , responseHeaders : [ { value : response . headers . get ( "opc-request-id" ) , key : "opcRequestId" , dataType : "string" } ] } ) ; return sdkResponse ; } catch ( err ) { throw err ; } } param DetectLanguageEntitiesRequest return throws example Click  https to see how to use DetectLanguageEntities API.
      public async detectLanguageEntities ( detectLanguageEntitiesRequest ) { if ( this . logger ) this . logger . debug ( "Calling operation AIServiceLanguageClient#detectLanguageEntities." ) ; const pathParams = { } ; const queryParams = { "modelVersion" : detectLanguageEntitiesRequest . modelVersion , "isPii" : detectLanguageEntitiesRequest . isPii } ; let headerParams = { "Content-Type" : common . Constants . APPLICATION_JSON , "opc-request-id" : detectLanguageEntitiesRequest . opcRequestId } ; const specRetryConfiguration = common . NoRetryConfigurationDetails ; const retrier = GenericRetrier . createPreferredRetrier ( this . _clientConfiguration ? this . _clientConfiguration . retryConfiguration : undefined , detectLanguageEntitiesRequest . retryConfiguration , specRetryConfiguration ) ; if ( this . logger ) retrier . logger = this . logger ; const request = await composeRequest ( { baseEndpoint : this . _endpoint , defaultHeaders : this . _defaultHeaders , path : "/actions/detectLanguageEntities" , method : "POST" , bodyContent : common . ObjectSerializer . serialize ( detectLanguageEntitiesRequest . detectLanguageEntitiesDetails , "DetectLanguageEntitiesDetails" , model . DetectLanguageEntitiesDetails . getJsonObj ) , pathParams : pathParams , headerParams : headerParams , queryParams : queryParams } ) ; try { const response = await retrier . makeServiceCall ( this . _httpClient , request ) ; const sdkResponse = composeResponse ( { responseObject : < responses . DetectLanguageEntitiesResponse > { } , body : await response . json ( ) , bodyKey : "detectLanguageEntitiesResult" , bodyModel : model . DetectLanguageEntitiesResult , type : "model.DetectLanguageEntitiesResult" , responseHeaders : [ { value : response . headers . get ( "opc-request-id" ) , key : "opcRequestId" , dataType : "string" } ] } ) ; return sdkResponse ; } catch ( err ) { throw err ; } } param DetectLanguageKeyPhrasesRequest return throws example Click  https to see how to use DetectLanguageKeyPhrases API.
      public async detectLanguageKeyPhrases ( detectLanguageKeyPhrasesRequest ) { if ( this . logger ) this . logger . debug ( "Calling operation AIServiceLanguageClient#detectLanguageKeyPhrases." ) ; const pathParams = { } ; const queryParams = { } ; let headerParams = { "Content-Type" : common . Constants . APPLICATION_JSON , "opc-request-id" : detectLanguageKeyPhrasesRequest . opcRequestId } ; const specRetryConfiguration = common . NoRetryConfigurationDetails ; const retrier = GenericRetrier . createPreferredRetrier ( this . _clientConfiguration ? this . _clientConfiguration . retryConfiguration : undefined , detectLanguageKeyPhrasesRequest . retryConfiguration , specRetryConfiguration ) ; if ( this . logger ) retrier . logger = this . logger ; const request = await composeRequest ( { baseEndpoint : this . _endpoint , defaultHeaders : this . _defaultHeaders , path : "/actions/detectLanguageKeyPhrases" , method : "POST" , bodyContent : common . ObjectSerializer . serialize ( detectLanguageKeyPhrasesRequest . detectLanguageKeyPhrasesDetails , "DetectLanguageKeyPhrasesDetails" , model . DetectLanguageKeyPhrasesDetails . getJsonObj ) , pathParams : pathParams , headerParams : headerParams , queryParams : queryParams } ) ; try { const response = await retrier . makeServiceCall ( this . _httpClient , request ) ; const sdkResponse = composeResponse ( { responseObject : < responses . DetectLanguageKeyPhrasesResponse > { } , body : await response . json ( ) , bodyKey : "detectLanguageKeyPhrasesResult" , bodyModel : model . DetectLanguageKeyPhrasesResult , type : "model.DetectLanguageKeyPhrasesResult" , responseHeaders : [ { value : response . headers . get ( "opc-request-id" ) , key : "opcRequestId" , dataType : "string" } ] } ) ; return sdkResponse ; } catch ( err ) { throw err ; } } param DetectLanguageSentimentsRequest return throws example Click  https to see how to use DetectLanguageSentiments API.
      public async detectLanguageSentiments ( detectLanguageSentimentsRequest ) { if ( this . logger ) this . logger . debug ( "Calling operation AIServiceLanguageClient#detectLanguageSentiments." ) ; const pathParams = { } ; const queryParams = { } ; let headerParams = { "Content-Type" : common . Constants . APPLICATION_JSON , "opc-request-id" : detectLanguageSentimentsRequest . opcRequestId } ; const specRetryConfiguration = common . NoRetryConfigurationDetails ; const retrier = GenericRetrier . createPreferredRetrier ( this . _clientConfiguration ? this . _clientConfiguration . retryConfiguration : undefined , detectLanguageSentimentsRequest . retryConfiguration , specRetryConfiguration ) ; if ( this . logger ) retrier . logger = this . logger ; const request = await composeRequest ( { baseEndpoint : this . _endpoint , defaultHeaders : this . _defaultHeaders , path : "/actions/detectLanguageSentiments" , method : "POST" , bodyContent : common . ObjectSerializer . serialize ( detectLanguageSentimentsRequest . detectLanguageSentimentsDetails , "DetectLanguageSentimentsDetails" , model . DetectLanguageSentimentsDetails . getJsonObj ) , pathParams : pathParams , headerParams : headerParams , queryParams : queryParams } ) ; try { const response = await retrier . makeServiceCall ( this . _httpClient , request ) ; const sdkResponse = composeResponse ( { responseObject : < responses . DetectLanguageSentimentsResponse > { } , body : await response . json ( ) , bodyKey : "detectLanguageSentimentsResult" , bodyModel : model . DetectLanguageSentimentsResult , type : "model.DetectLanguageSentimentsResult" , responseHeaders : [ { value : response . headers . get ( "opc-request-id" ) , key : "opcRequestId" , dataType : "string" } ] } ) ; return sdkResponse ; } catch ( err ) { throw err ; } } param DetectLanguageTextClassificationRequest return throws example Click  https to see how to use DetectLanguageTextClassification API.
      public async detectLanguageTextClassification ( detectLanguageTextClassificationRequest ) { if ( this . logger ) this . logger . debug ( "Calling operation AIServiceLanguageClient#detectLanguageTextClassification." ) ; const pathParams = { } ; const queryParams = { } ; let headerParams = { "Content-Type" : common . Constants . APPLICATION_JSON , "opc-request-id" : detectLanguageTextClassificationRequest . opcRequestId } ; const specRetryConfiguration = common . NoRetryConfigurationDetails ; const retrier = GenericRetrier . createPreferredRetrier ( this . _clientConfiguration ? this . _clientConfiguration . retryConfiguration : undefined , detectLanguageTextClassificationRequest . retryConfiguration , specRetryConfiguration ) ; if ( this . logger ) retrier . logger = this . logger ; const request = await composeRequest ( { baseEndpoint : this . _endpoint , defaultHeaders : this . _defaultHeaders , path : "/actions/detectLanguageTextClassification" , method : "POST" , bodyContent : common . ObjectSerializer . serialize ( detectLanguageTextClassificationRequest . detectLanguageTextClassificationDetails , "DetectLanguageTextClassificationDetails" , model . DetectLanguageTextClassificationDetails . getJsonObj ) , pathParams : pathParams , headerParams : headerParams , queryParams : queryParams } ) ; try { const response = await retrier . makeServiceCall ( this . _httpClient , request ) ; const sdkResponse = composeResponse ( { responseObject : < responses . DetectLanguageTextClassificationResponse > { } , body : await response . json ( ) , bodyKey : "detectLanguageTextClassificationResult" , bodyModel : model . DetectLanguageTextClassificationResult , type : "model.DetectLanguageTextClassificationResult" , responseHeaders : [ { value : response . headers . get ( "opc-request-id" ) , key : "opcRequestId" , dataType : "string" } ] } ) ; return sdkResponse ; } catch ( err ) { throw err ; } } }