/**
 *
 */
import Util;
import OpenApi;

import EndpointUtil;

extends OpenApi;

init(config: OpenApi.Config){
  super(config);
  @endpointRule = '';
  

  checkConfig(config);
  @endpoint = getEndpoint('nlp', @regionId, @endpointRule, @network, @suffix, @endpointMap, @endpoint);
}

function getEndpoint(productId: string, regionId: string, endpointRule: string, network: string, suffix: string, endpointMap: map[string]string, endpoint: string) throws: string{
  if (!Util.empty(endpoint)) {
    return endpoint;
  }

  if (!Util.isUnset(endpointMap) && !Util.empty(endpointMap[regionId])) {
    return endpointMap[regionId];
  }
  return EndpointUtil.getEndpointRules(productId, regionId, endpointRule, network, suffix);
}
model EntityResponse = {
  headers: map[string]string(name='headers'),
}

async function entity(Domain: string): EntityResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return entityWithOptions(Domain, headers, runtime);
}

async function entityWithOptions(Domain: string, headers: map[string]string, runtime: Util.RuntimeOptions): EntityResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  return doROARequest('Entity', '2018-04-08', 'HTTPS', 'POST', 'AK', `/nlp/api/entity/${Domain}`, 'none', req, runtime);
}

model IEResponse = {
  headers: map[string]string(name='headers'),
}

async function iE(Domain: string): IEResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return iEWithOptions(Domain, headers, runtime);
}

async function iEWithOptions(Domain: string, headers: map[string]string, runtime: Util.RuntimeOptions): IEResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  return doROARequest('IE', '2018-04-08', 'HTTPS', 'POST', 'AK', `/nlp/api/ie/${Domain}`, 'none', req, runtime);
}

model KWEResponse = {
  headers: map[string]string(name='headers'),
}

async function kWE(Domain: string): KWEResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return kWEWithOptions(Domain, headers, runtime);
}

async function kWEWithOptions(Domain: string, headers: map[string]string, runtime: Util.RuntimeOptions): KWEResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  return doROARequest('KWE', '2018-04-08', 'HTTPS', 'POST', 'AK', `/nlp/api/kwe/${Domain}`, 'none', req, runtime);
}

model ReviewAnalysisResponse = {
  headers: map[string]string(name='headers'),
}

async function reviewAnalysis(Domain: string): ReviewAnalysisResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return reviewAnalysisWithOptions(Domain, headers, runtime);
}

async function reviewAnalysisWithOptions(Domain: string, headers: map[string]string, runtime: Util.RuntimeOptions): ReviewAnalysisResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  return doROARequest('ReviewAnalysis', '2018-04-08', 'HTTPS', 'POST', 'AK', `/nlp/api/reviewanalysis/${Domain}`, 'none', req, runtime);
}

model SentimentResponse = {
  headers: map[string]string(name='headers'),
}

async function sentiment(Domain: string): SentimentResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return sentimentWithOptions(Domain, headers, runtime);
}

async function sentimentWithOptions(Domain: string, headers: map[string]string, runtime: Util.RuntimeOptions): SentimentResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  return doROARequest('Sentiment', '2018-04-08', 'HTTPS', 'POST', 'AK', `/nlp/api/sentiment/${Domain}`, 'none', req, runtime);
}

model TextStructureResponse = {
  headers: map[string]string(name='headers'),
}

async function textStructure(Domain: string): TextStructureResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return textStructureWithOptions(Domain, headers, runtime);
}

async function textStructureWithOptions(Domain: string, headers: map[string]string, runtime: Util.RuntimeOptions): TextStructureResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  return doROARequest('TextStructure', '2018-04-08', 'HTTPS', 'POST', 'AK', `/nlp/api/textstructure/${Domain}`, 'none', req, runtime);
}

model TranslateResponse = {
  headers: map[string]string(name='headers'),
}

async function translate(Domain: string): TranslateResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return translateWithOptions(Domain, headers, runtime);
}

async function translateWithOptions(Domain: string, headers: map[string]string, runtime: Util.RuntimeOptions): TranslateResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  return doROARequest('Translate', '2018-04-08', 'HTTP', 'POST', 'AK', `/nlp/api/translate/${Domain}`, 'none', req, runtime);
}

model WordPosResponse = {
  headers: map[string]string(name='headers'),
}

async function wordPos(Domain: string): WordPosResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return wordPosWithOptions(Domain, headers, runtime);
}

async function wordPosWithOptions(Domain: string, headers: map[string]string, runtime: Util.RuntimeOptions): WordPosResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  return doROARequest('WordPos', '2018-04-08', 'HTTPS', 'POST', 'AK', `/nlp/api/wordpos/${Domain}`, 'none', req, runtime);
}

model WordSegmentResponse = {
  headers: map[string]string(name='headers'),
}

async function wordSegment(Domain: string): WordSegmentResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return wordSegmentWithOptions(Domain, headers, runtime);
}

async function wordSegmentWithOptions(Domain: string, headers: map[string]string, runtime: Util.RuntimeOptions): WordSegmentResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  return doROARequest('WordSegment', '2018-04-08', 'HTTPS', 'POST', 'AK', `/nlp/api/wordsegment/${Domain}`, 'none', req, runtime);
}

