UNPKG

ts-api-core

Version:

Nodejs api framework core

64 lines 2.59 kB
"use strict"; var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; Object.defineProperty(exports, "__esModule", { value: true }); exports.ApiBasePc = void 0; const api_base_1 = require("./api.base"); /** * PC端接口访问基类 */ class ApiBasePc extends api_base_1.ApiBase { constructor(context, esn, token) { super(context); this.esn = esn; this.token = token; } /** 获取自定义头部信息 */ GetHeader() { var _a, _b; if (!this._header) { this._header = { esn: (_a = this.esn) !== null && _a !== void 0 ? _a : "", token: (_b = this.token) !== null && _b !== void 0 ? _b : "", "client-src": "pcweb", }; } return this._header; } /** * get请求 * @param actionPath 接口路径 斜杠开始 * @param params url参数 选填 支持Map对象/普通对象。 */ Get(actionPath, params, pick, onCheckResult, respType) { const _super = Object.create(null, { Get: { get: () => super.Get } }); return __awaiter(this, void 0, void 0, function* () { return _super.Get.call(this, actionPath, params, pick, onCheckResult, this.GetHeader(), respType); }); } /** * post请求 * @param actionPath 接口路径 * @param body body参数 * @param params url参数 选填 支持Map对象/普通对象。 */ Post(actionPath, body, params, pick, onCheckResult, respType) { const _super = Object.create(null, { Post: { get: () => super.Post } }); return __awaiter(this, void 0, void 0, function* () { return _super.Post.call(this, actionPath, body, params, pick, onCheckResult, this.GetHeader(), respType); }); } } exports.ApiBasePc = ApiBasePc; //# sourceMappingURL=api.base.pc.js.map