"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.OpenapiCaller=void 0,exports.createOpenapiCaller=createOpenapiCaller,exports.createOpenapi=createOpenapi;const snake_case_1=require("snake-case"),constant_1=require("../constant"),errors_1=require("../errors"),caller_1=require("./caller");var caller_2=require("./caller");Object.defineProperty(exports,"OpenapiCaller",{enumerable:!0,get:function(){return caller_2.OpenapiCaller}});function createOpenapiCaller(e){return new caller_1.OpenapiCaller(e)}const createOpenapiProxy=(e,t)=>new Proxy(e,{get(s,r){if(typeof r!="string"||r.length>constant_1.MAX_OPENAPI_NAME_LENGTH)throw errors_1.errors.INVALID_PARAM("openapi","\u65B9\u6CD5\u540D\u4E0D\u6B63\u786E");const n=(0,snake_case_1.snakeCase)(r,{delimiter:"."});return{request:a=>t.request(n,a),sdkExecute:a=>t.sdkExecute(n,a)}}});function createOpenapi(e){const t=createOpenapiCaller({config:e});function s(r){const n=createOpenapiCaller({config:e,version:r?.version,sandbox:r?.sandbox});return createOpenapiProxy({},n)}return createOpenapiProxy(s,t)}