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

import EndpointUtil;

extends OpenApi;

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

  checkConfig(config);
  @endpoint = getEndpoint('snsuapi', @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 BandOfferOrderRequest {
  ownerId?: long(name='OwnerId'),
  resourceOwnerAccount?: string(name='ResourceOwnerAccount'),
  resourceOwnerId?: long(name='ResourceOwnerId'),
  bandId?: string(name='BandId'),
  offerId?: string(name='OfferId'),
}

model BandOfferOrderResponseBody = {
  resultModule?: {
    lxOrderId?: long(name='LxOrderId'),
  }(name='ResultModule'),
  requestId?: string(name='RequestId'),
  resultMessage?: string(name='ResultMessage'),
  resultCode?: string(name='ResultCode'),
}

model BandOfferOrderResponse = {
  headers: map[string]string(name='headers'),
  body: BandOfferOrderResponseBody(name='body'),
}

async function bandOfferOrderWithOptions(request: BandOfferOrderRequest, runtime: Util.RuntimeOptions): BandOfferOrderResponse {
  Util.validateModel(request);
  var req = new OpenApi.OpenApiRequest{ 
    body = Util.toMap(request),
  };
  return doRPCRequest('BandOfferOrder', '2018-07-09', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}

async function bandOfferOrder(request: BandOfferOrderRequest): BandOfferOrderResponse {
  var runtime = new Util.RuntimeOptions{};
  return bandOfferOrderWithOptions(request, runtime);
}

model BandPrecheckRequest {
  ownerId?: long(name='OwnerId'),
  resourceOwnerAccount?: string(name='ResourceOwnerAccount'),
  resourceOwnerId?: long(name='ResourceOwnerId'),
  ipAddress?: string(name='IpAddress'),
  port?: int32(name='Port'),
}

model BandPrecheckResponseBody = {
  resultModule?: {
    uploadBandwidth?: int32(name='UploadBandwidth'),
    bandId?: long(name='BandId'),
    bandOfferList?: {
      bandOfferList?: [ 
      {
        direction?: string(name='Direction'),
        offerId?: long(name='OfferId'),
        bandwidth?: int32(name='Bandwidth'),
        duration?: long(name='Duration'),
      }
    ](name='BandOfferList')
    }(name='BandOfferList'),
    downloadBandwidth?: int32(name='DownloadBandwidth'),
  }(name='ResultModule'),
  requestId?: string(name='RequestId'),
  resultMessage?: string(name='ResultMessage'),
  resultCode?: string(name='ResultCode'),
}

model BandPrecheckResponse = {
  headers: map[string]string(name='headers'),
  body: BandPrecheckResponseBody(name='body'),
}

async function bandPrecheckWithOptions(request: BandPrecheckRequest, runtime: Util.RuntimeOptions): BandPrecheckResponse {
  Util.validateModel(request);
  var req = new OpenApi.OpenApiRequest{ 
    body = Util.toMap(request),
  };
  return doRPCRequest('BandPrecheck', '2018-07-09', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}

async function bandPrecheck(request: BandPrecheckRequest): BandPrecheckResponse {
  var runtime = new Util.RuntimeOptions{};
  return bandPrecheckWithOptions(request, runtime);
}

model BandStartSpeedUpRequest {
  ownerId?: long(name='OwnerId'),
  resourceOwnerAccount?: string(name='ResourceOwnerAccount'),
  resourceOwnerId?: long(name='ResourceOwnerId'),
  ipAddress?: string(name='IpAddress'),
  port?: int32(name='Port'),
  bandId?: long(name='BandId'),
  direction?: string(name='Direction'),
  targetBandwidth?: long(name='TargetBandwidth'),
  bandScene?: string(name='BandScene'),
}

model BandStartSpeedUpResponseBody = {
  resultModule?: boolean(name='ResultModule'),
  requestId?: string(name='RequestId'),
  resultMessage?: string(name='ResultMessage'),
  resultCode?: string(name='ResultCode'),
}

model BandStartSpeedUpResponse = {
  headers: map[string]string(name='headers'),
  body: BandStartSpeedUpResponseBody(name='body'),
}

async function bandStartSpeedUpWithOptions(request: BandStartSpeedUpRequest, runtime: Util.RuntimeOptions): BandStartSpeedUpResponse {
  Util.validateModel(request);
  var req = new OpenApi.OpenApiRequest{ 
    body = Util.toMap(request),
  };
  return doRPCRequest('BandStartSpeedUp', '2018-07-09', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}

async function bandStartSpeedUp(request: BandStartSpeedUpRequest): BandStartSpeedUpResponse {
  var runtime = new Util.RuntimeOptions{};
  return bandStartSpeedUpWithOptions(request, runtime);
}

model BandStatusQueryRequest {
  ownerId?: long(name='OwnerId'),
  resourceOwnerAccount?: string(name='ResourceOwnerAccount'),
  resourceOwnerId?: long(name='ResourceOwnerId'),
  bandId?: long(name='BandId'),
}

model BandStatusQueryResponseBody = {
  resultModule?: {
    uploadTarget?: int32(name='UploadTarget'),
    downloadTarget?: int32(name='DownloadTarget'),
  }(name='ResultModule'),
  requestId?: string(name='RequestId'),
  resultMessage?: string(name='ResultMessage'),
  resultCode?: string(name='ResultCode'),
}

model BandStatusQueryResponse = {
  headers: map[string]string(name='headers'),
  body: BandStatusQueryResponseBody(name='body'),
}

async function bandStatusQueryWithOptions(request: BandStatusQueryRequest, runtime: Util.RuntimeOptions): BandStatusQueryResponse {
  Util.validateModel(request);
  var req = new OpenApi.OpenApiRequest{ 
    body = Util.toMap(request),
  };
  return doRPCRequest('BandStatusQuery', '2018-07-09', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}

async function bandStatusQuery(request: BandStatusQueryRequest): BandStatusQueryResponse {
  var runtime = new Util.RuntimeOptions{};
  return bandStatusQueryWithOptions(request, runtime);
}

model BandStopSpeedUpRequest {
  ownerId?: long(name='OwnerId'),
  resourceOwnerAccount?: string(name='ResourceOwnerAccount'),
  resourceOwnerId?: long(name='ResourceOwnerId'),
  ipAddress?: string(name='IpAddress'),
  port?: int32(name='Port'),
  bandId?: long(name='BandId'),
  direction?: string(name='Direction'),
}

model BandStopSpeedUpResponseBody = {
  resultModule?: boolean(name='ResultModule'),
  requestId?: string(name='RequestId'),
  resultMessage?: string(name='ResultMessage'),
  resultCode?: string(name='ResultCode'),
}

model BandStopSpeedUpResponse = {
  headers: map[string]string(name='headers'),
  body: BandStopSpeedUpResponseBody(name='body'),
}

async function bandStopSpeedUpWithOptions(request: BandStopSpeedUpRequest, runtime: Util.RuntimeOptions): BandStopSpeedUpResponse {
  Util.validateModel(request);
  var req = new OpenApi.OpenApiRequest{ 
    body = Util.toMap(request),
  };
  return doRPCRequest('BandStopSpeedUp', '2018-07-09', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}

async function bandStopSpeedUp(request: BandStopSpeedUpRequest): BandStopSpeedUpResponse {
  var runtime = new Util.RuntimeOptions{};
  return bandStopSpeedUpWithOptions(request, runtime);
}

model MobileStartSpeedUpRequest {
  ownerId?: long(name='OwnerId'),
  resourceOwnerAccount?: string(name='ResourceOwnerAccount'),
  resourceOwnerId?: long(name='ResourceOwnerId'),
  token?: string(name='Token'),
  duration?: string(name='Duration'),
  ip?: string(name='Ip'),
  publicIp?: string(name='PublicIp'),
  publicPort?: string(name='PublicPort'),
  destinationIpAddress?: string(name='DestinationIpAddress'),
}

model MobileStartSpeedUpResponseBody = {
  resultModule?: string(name='ResultModule'),
  requestId?: string(name='RequestId'),
  resultMessage?: string(name='ResultMessage'),
  resultCode?: string(name='ResultCode'),
}

model MobileStartSpeedUpResponse = {
  headers: map[string]string(name='headers'),
  body: MobileStartSpeedUpResponseBody(name='body'),
}

async function mobileStartSpeedUpWithOptions(request: MobileStartSpeedUpRequest, runtime: Util.RuntimeOptions): MobileStartSpeedUpResponse {
  Util.validateModel(request);
  var req = new OpenApi.OpenApiRequest{ 
    body = Util.toMap(request),
  };
  return doRPCRequest('MobileStartSpeedUp', '2018-07-09', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}

async function mobileStartSpeedUp(request: MobileStartSpeedUpRequest): MobileStartSpeedUpResponse {
  var runtime = new Util.RuntimeOptions{};
  return mobileStartSpeedUpWithOptions(request, runtime);
}

model MobileStatusQueryRequest {
  ownerId?: long(name='OwnerId'),
  resourceOwnerAccount?: string(name='ResourceOwnerAccount'),
  resourceOwnerId?: long(name='ResourceOwnerId'),
  correlationId?: string(name='CorrelationId'),
}

model MobileStatusQueryResponseBody = {
  resultModule?: boolean(name='ResultModule'),
  requestId?: string(name='RequestId'),
  resultMessage?: string(name='ResultMessage'),
  resultCode?: string(name='ResultCode'),
}

model MobileStatusQueryResponse = {
  headers: map[string]string(name='headers'),
  body: MobileStatusQueryResponseBody(name='body'),
}

async function mobileStatusQueryWithOptions(request: MobileStatusQueryRequest, runtime: Util.RuntimeOptions): MobileStatusQueryResponse {
  Util.validateModel(request);
  var req = new OpenApi.OpenApiRequest{ 
    body = Util.toMap(request),
  };
  return doRPCRequest('MobileStatusQuery', '2018-07-09', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}

async function mobileStatusQuery(request: MobileStatusQueryRequest): MobileStatusQueryResponse {
  var runtime = new Util.RuntimeOptions{};
  return mobileStatusQueryWithOptions(request, runtime);
}

model MobileStopSpeedUpRequest {
  ownerId?: long(name='OwnerId'),
  resourceOwnerAccount?: string(name='ResourceOwnerAccount'),
  resourceOwnerId?: long(name='ResourceOwnerId'),
  correlationId?: string(name='CorrelationId'),
}

model MobileStopSpeedUpResponseBody = {
  resultModule?: boolean(name='ResultModule'),
  requestId?: string(name='RequestId'),
  resultMessage?: string(name='ResultMessage'),
  resultCode?: string(name='ResultCode'),
}

model MobileStopSpeedUpResponse = {
  headers: map[string]string(name='headers'),
  body: MobileStopSpeedUpResponseBody(name='body'),
}

async function mobileStopSpeedUpWithOptions(request: MobileStopSpeedUpRequest, runtime: Util.RuntimeOptions): MobileStopSpeedUpResponse {
  Util.validateModel(request);
  var req = new OpenApi.OpenApiRequest{ 
    body = Util.toMap(request),
  };
  return doRPCRequest('MobileStopSpeedUp', '2018-07-09', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}

async function mobileStopSpeedUp(request: MobileStopSpeedUpRequest): MobileStopSpeedUpResponse {
  var runtime = new Util.RuntimeOptions{};
  return mobileStopSpeedUpWithOptions(request, runtime);
}

