UNPKG

@tcatche/swagger-ts

Version:

Codegen from swagger to TS & Axios Functions

526 lines (466 loc) 19.7 kB
/* eslint-disable */ import axios, { AxiosInstance, AxiosResponse } from 'axios' import qs from 'qs' export interface ObjectType { [key: string]: any; } export interface Config { $domain?: string; $config?: any; } export interface Parameters { [key: string]: any; } let domain = '' let axiosInstance = axios.create() export function getDomain(): string { return domain } export function setDomain($domain: string): void { domain = $domain } export function getAxiosInstance(): AxiosInstance { return axiosInstance } export function setAxiosInstance($axiosInstance: AxiosInstance): void { axiosInstance = $axiosInstance } type RequestMethod = 'get' | 'post' | 'put' | 'delete' | 'head' | 'option' | 'patch' export function request(method: RequestMethod, url: string, body?: ObjectType, config: ObjectType = {}) { let queryUrl = url if (method === 'delete') { return axiosInstance[method](queryUrl,{...config, data: body || {} }) } else if (method === 'get') { let params = body ? qs.stringify(body) : '' if (params) { if (queryUrl.indexOf('?') < 0) { params = '?' + params } else if (!queryUrl.endsWith('?')) { params = '&' + params } } return axiosInstance[method](queryUrl + params, config) } else if(method === 'post' || method === 'put' || method === 'patch'){ return axiosInstance[method](queryUrl, body, config) } else if (method === 'head' || method === 'option') { return axiosInstance[method](queryUrl, config) } } // OrderPayVO export interface OrderPayVO { actualAmount?: number; // 实际支付总金额,单位为分 amount?: number; // 订单总金额,单位为分 billId?: string; // 账单号,来自支付中心账单 discountAmount?: number; // 优惠总金额,单位为分。实际支付金额= 订单总金额-优惠金额 orderId?: string; // 订单号 payChannel?: string; // 支付渠道 01:alipay 02:wechat payStartTime?: string; // 支付发起时间 payTime?: string; // 支付时间,若未支付不返回字段 payType?: string; // 支付类型: 01:h5 02:qrcode userId?: string; // 用户ID,来自MS } // OrderProductVO export interface OrderProductVO { actualAmount?: number; // 实际售价,单位分 actualUnitAmount?: number; // 实际支付单价,单位分 amount?: number; // 商品原价,单位分 discountRatio?: number; // 折扣比例 memo?: string; // 备注信息 merchantAddress?: string; // 商家地址 merchantId?: string; // 商家id merchantName?: string; // 商家名称 orderId?: string; // 订单号 outProductId?: string; // 商品外部号 outProductName?: string; // 商品外部名称 outSkuId?: string; // 商品外部sku号 outSource?: string; // 商品外部来源 productId?: string; // 商品spu ID productImgUrl?: string; // 商品图片地址 productName?: string; // 商品spu名 productType?: string; // 商品类型 01:实物 02:虚拟 quantity?: number; // 数量 refundId?: string; // 退款单号 refundQuantity?: number; // 退款数量 skuId?: string; // 商品sku号 skuName?: string; // 商品sku名 unitAmount?: number; // 单价,单位分 userId?: string; // 用户ID,来自MS } // OrderProduct对象 export interface OrderProduct对象 { discountRatio?: number; // 折扣比例 memo?: string; // 备注信息 merchantAddress?: string; // 商家地址 merchantId?: string; // 商家id merchantName?: string; // 商家名称 outProductId?: string; // 商品外部spu号 outProductName?: string; // 商品外部spu名称 outSkuId?: string; // 商品外部sku号 outSource?: string; // 商品外部来源,01:翌擎 02:车主邦 productId?: string; // 商品spu号 productImgUrl?: string; // 商品图片地址 productName?: string; // 商品spu名 productType?: string; // 商品类型 01:实物 02:虚拟 promotions?: Array<商品促销信息>; // 商品促销信息 quantity?: number; // 数量 skuId?: string; // 商品sku号 skuName?: string; // 商品sku名 unitAmount?: number; // 商品原有单价,单位分 } // OrderRefundVO export interface OrderRefundVO { billId?: string; // 账单号 orderId?: string; // 订单号 refundAmount?: number; // 退款金额,单位分 refundReason?: string; // 退款原因 refundStartTime?: string; // 退款发起时间,来自支付中心 refundTime?: string; // 退款时间,若未退款不返回字段 refundType?: string; // 退款类型 01:待发货退款 02:退款不退货 03:退款退货 userId?: string; // 用户ID,来自MS } // Order对象 export interface Order对象 { bizId?: string; // 业务ID,如活动ID,可不填 msgFrom?: string; // 订单请求消息来源,为app server中的appName,该参数可从heder中获取,key为appName orderSource?: string; // 订单来源 01:加油 02:活动 outOrderId?: string; // 外部订单号(注意内部订单不用填写) outSource?: string; // 订单外部来源 01:翌擎 02:车主邦(注意内部订单不用填写) phone?: string; // 用户手机号 products?: Array<OrderProduct对象>; // 订单关联商品 sequenceId?: string; // 请求ID,幂等用,采用UUID方式 userId?: string; // 用户ID,来自MS,可从header中取,key为gatewayUserId } // RightProductOutDetailView export interface RightProductOutDetailView { desc?: string; // 商品描述 exchangeLink?: string; // 兑换链接 imgUrl?: string; // 商品图片地址 name?: string; // 商品名称 serialNum?: string; // 券码 skuId?: number; // 商品id } // 促销查询条件 export interface 促销查询条件 { endTime?: string; // 结束时间 promotionId?: number; // 促销id singleSkuLimit?: number; // 单品限购数 singleUserLimit?: number; // 单用户限购数 skuId?: number; // skuId startTime?: string; // 开始时间 userId?: string; // 用户ID,来自MS } // 公共响应对象<T> export interface 公共响应对象<T> { data?: T; // 业务数据 errorCode?: string; // 错误码 errorMsg?: string; // 错误信息 status?: boolean; // 响应状态 } // 商品促销信息 export interface 商品促销信息 { discountRatio?: number; // 折扣 fixedPrice?: number; // 一口价 promotionCatalog?: string; // 促销类型,对应促销表promotion_catalog中的key:ykj li zk promotionId?: number; // 促销id reducePrice?: number; // 立减 } // 支付中心查询订单响应 export interface 支付中心查询订单响应 { amount?: number; // 订单总金额,单位为分 endTime?: string; // 订单超期结束时间 invoiceStatus?: string; // 开票状态 01:未开票 02:已开票 03:部分开票 orderId?: string; // 订单号 orderSource?: string; // 订单来源 01:加油 02:商城 phone?: string; // 用户手机号 startTime?: string; // 订单创建开始时间 status?: string; // 订单状态 01:待支付 02:待发货(已支付) 03:待收货 04:已完成 05:已取消 06:已过期 07:退款中 08:已退款 09:退款失败 userId?: string; // 用户ID,来自MS } // 支付通知对象 export interface 支付通知对象 { actualAmount?: number; // 实际支付总金额,单位为分 amount?: number; // 总金额,单位分 billId?: string; // 账单号,来自支付中心账单 discountAmount?: number; // 优惠总金额,单位分 orderId?: string; // 订单号 outOrderId?: string; // 外部订单号(外部订单填写,如加油填CP订单号) outSource?: string; // 订单外部来源 01:翌擎 02:车主邦(注意外部订单如加油需要填写) payChannel?: string; // 支付渠道 01:alipay 02:wechat payStartTime?: string; // 支付发起时间 payStatus?: string; // 支付结果状态,来自支付中心账单,01 支付成功; 02 等待支付; 03 已关闭(已取消); 04 退款中; 05 退款成功; 06 已超期;07 退款失败 payTime?: string; // 支付时间,若未支付不返回字段 payType?: string; // 支付类型: 01:h5 02:qrcode refundAmount?: number; // 退款金额,单位分 refundStartTime?: string; // 退款发起时间,来自支付中心 refundTime?: string; // 退款时间,若未退款不返回字段 } // 更新订单开票状态请求 export interface 更新订单开票状态请求 { invoiceMemo?: string; // 开票备注 invoiceState?: string; // 订单发票状态 01:未开票 02:已开票 03:部分开票 04:开票中 orderId?: string; // 订单ID } // 统计订单VO export interface 统计订单VO { cumulativeActualAmount?: number; // 累计订单实际支付总金额,单位分 cumulativeDiscountAmount?: number; // 累计订单优惠总金额,单位分 cumulativeOrderNum?: number; // 累计订单数量 statisticDimensionOrderVOS?: Array<订单统计纬度VO>; // 统计详情VO totalActualAmount?: number; // 订单实际支付总金额,单位分 totalDiscountAmount?: number; // 订单优惠总金额,单位分 totalOrderNum?: number; // 订单数量 } // 订单 export interface 订单 { actualAmount?: number; // 订单实际支付总金额,单位分 amount?: number; // 订单总金额,单位为分 createdBy?: string; // 创建人 createdTime?: string; // 创建时间 discountAmount?: number; // 订单优惠总金额,单位分 id?: string; // 订单号 invoiceMemo?: string; // 开票备注 invoiceStatus?: string; // 开票状态 01:未开票 02:已开票 03:部分开票 04:开票中 05:申请中 06:已驳回 07:开票失败 msgFrom?: string; // 订单请求消息来源,为app server中的appName orderSource?: string; // 订单来源 01:加油 02:商城 outOrderNo?: string; // 外部订单号 outSource?: string; // 订单外部来源 01:翌擎 02:车主邦 payTime?: string; // 支付时间 pays?: Array<OrderPayVO>; // 订单支付信息 phone?: string; // 用户手机号 products?: Array<OrderProductVO>; // 订单管理商品列表 refunds?: Array<OrderRefundVO>; // 订单退款信息 status?: string; // 订单状态 userId?: string; // 用户ID,来自MS } // 订单查询VO export interface 订单查询VO { orders?: Array<订单>; // 订单列表 totalCount?: number; // 总条数 } // 订单查询请求 export interface 订单查询请求 { bizId?: string; // 业务ID,如活动ID createEndTime?: string; // 创建截止时间,格式YYYY-MM-DD createStartTime?: string; // 创建开始时间,格式YYYY-MM-DD currentPage?: number; id?: string; // 订单ID orderSource?: string; // 订单来源 01:加油 02:活动 outOrderId?: string; // 外部订单号 pageSize?: number; phone?: string; // 用户手机号 status?: Array<string>; // 订单状态 01:待支付 02:待发货(已支付) 03:待收货 04:已完成 05:已取消 06:已过期 07:退款中 08:已退款 09:退款失败 } // 订单统计纬度VO export interface 订单统计纬度VO { actualAmount?: number; // 订单实际支付总金额,单位分 discountAmount?: number; // 订单优惠总金额,单位分 orderNum?: number; // 订单数量 statisticTime?: string; // 统计纬度时间,日:yyyyMMdd 月:yyyyMM 季度:yyyy0x(x值为1-4) 年:yyyy } // 订单统计请求 export interface 订单统计请求 { dimension?: string; // 统计纬度: 01:年 02:季度 03:月 04:日 endTime?: string; // 统计截止时间 orderSource?: string; // 订单来源 01:加油 02:商城 startTime?: string; // 统计开始时间 } export interface OrderMainexportOrderParameters { request: 订单查询请求; // request } /** * @name: OrderMainexportOrder * @date: 2022/1/21 * @description: 导出订单 * @param: {request} [订单查询请求] * @return: Promise<AxiosResponse<never>> */ export function OrderMainexportOrder(parameters: Config & OrderMainexportOrderParameters): Promise<AxiosResponse<never>> { const { $config, $domain, ...body} = parameters const host = $domain ? $domain : getDomain() let path = '/admin/api/order/exportOrder' return request('post', host + path, body, $config) } export interface OrderMainsearchOrderParameters { request: 订单查询请求; // request } /** * @name: OrderMainsearchOrder * @date: 2022/1/21 * @description: 查询订单 * @param: {request} [订单查询请求] * @return: Promise<AxiosResponse<公共响应对象<订单查询VO>>> */ export function OrderMainsearchOrder(parameters: Config & OrderMainsearchOrderParameters): Promise<AxiosResponse<公共响应对象<订单查询VO>>> { const { $config, $domain, ...body} = parameters const host = $domain ? $domain : getDomain() let path = '/admin/api/order/searchOrder' return request('post', host + path, body, $config) } export interface OrderMainstatisticOrderParameters { request: 订单统计请求; // request } /** * @name: OrderMainstatisticOrder * @date: 2022/1/21 * @description: 统计订单 * @param: {request} [订单统计请求] * @return: Promise<AxiosResponse<公共响应对象<统计订单VO>>> */ export function OrderMainstatisticOrder(parameters: Config & OrderMainstatisticOrderParameters): Promise<AxiosResponse<公共响应对象<统计订单VO>>> { const { $config, $domain, ...body} = parameters const host = $domain ? $domain : getDomain() let path = '/admin/api/order/statisticOrder' return request('post', host + path, body, $config) } export interface OrderPaypayNotifyParameters { request: 支付通知对象; // request } /** * @name: OrderPaypayNotify * @date: 2022/1/21 * @description: 支付通知 * @param: {request} [支付通知对象] * @return: Promise<AxiosResponse<公共响应对象<string>>> */ export function OrderPaypayNotify(parameters: Config & OrderPaypayNotifyParameters): Promise<AxiosResponse<公共响应对象<string>>> { const { $config, $domain, ...body} = parameters const host = $domain ? $domain : getDomain() let path = '/internal/api/order-pay/payNotify' return request('post', host + path, body, $config) } export interface OrderPaysearchOrderForPayParameters { orderId?: string; // 订单号 } /** * @name: OrderPaysearchOrderForPay * @date: 2022/1/21 * @description: 支付中心查询订单 * @param: {orderId} [string] * @return: Promise<AxiosResponse<公共响应对象<支付中心查询订单响应>>> */ export function OrderPaysearchOrderForPay(parameters: Config & OrderPaysearchOrderForPayParameters): Promise<AxiosResponse<公共响应对象<支付中心查询订单响应>>> { const { $config, $domain, ...body} = parameters const host = $domain ? $domain : getDomain() let path = '/internal/api/order-pay/searchOrderForPay' return request('get', host + path, body, $config) } /** * @name: OrderRetryretry * @date: 2022/1/21 * @description: 定时任务处理重试 * @return: Promise<AxiosResponse<公共响应对象<any>>> */ export function OrderRetryretry(parameters: Config): Promise<AxiosResponse<公共响应对象<any>>> { const { $config, $domain, ...body} = parameters const host = $domain ? $domain : getDomain() let path = '/internal/api/order-retry/retry' return request('get', host + path, body, $config) } export interface OrderMainInternaladdOrderParameters { request: Order对象; // request } /** * @name: OrderMainInternaladdOrder * @date: 2022/1/21 * @description: 新增订单 * @param: {request} [Order对象] * @return: Promise<AxiosResponse<公共响应对象<string>>> */ export function OrderMainInternaladdOrder(parameters: Config & OrderMainInternaladdOrderParameters): Promise<AxiosResponse<公共响应对象<string>>> { const { $config, $domain, ...body} = parameters const host = $domain ? $domain : getDomain() let path = '/internal/api/order/addOrder' return request('post', host + path, body, $config) } export interface OrderMainInternalcancelOrderParameters { orderId?: string; // 订单号 } /** * @name: OrderMainInternalcancelOrder * @date: 2022/1/21 * @description: 取消订单 * @param: {orderId} [string] * @return: Promise<AxiosResponse<公共响应对象<any>>> */ export function OrderMainInternalcancelOrder(parameters: Config & OrderMainInternalcancelOrderParameters): Promise<AxiosResponse<公共响应对象<any>>> { const { $config, $domain, ...body} = parameters const host = $domain ? $domain : getDomain() let path = '/internal/api/order/cancel' return request('get', host + path, body, $config) } /** * @name: OrderMainInternaloverdueOrder * @date: 2022/1/21 * @description: 定时任务-订单超期处理 * @return: Promise<AxiosResponse<公共响应对象<any>>> */ export function OrderMainInternaloverdueOrder(parameters: Config): Promise<AxiosResponse<公共响应对象<any>>> { const { $config, $domain, ...body} = parameters const host = $domain ? $domain : getDomain() let path = '/internal/api/order/overdue' return request('get', host + path, body, $config) } export interface OrderMainInternalqueryPromotionParameters { request: 促销查询条件; // request } /** * @name: OrderMainInternalqueryPromotion * @date: 2022/1/21 * @description: 查询促销是否限购 * @param: {request} [促销查询条件] * @return: Promise<AxiosResponse<公共响应对象<any>>> */ export function OrderMainInternalqueryPromotion(parameters: Config & OrderMainInternalqueryPromotionParameters): Promise<AxiosResponse<公共响应对象<any>>> { const { $config, $domain, ...body} = parameters const host = $domain ? $domain : getDomain() let path = '/internal/api/order/promotion-limit' return request('post', host + path, body, $config) } export interface OrderMainInternalsearchOrderParameters { request: 订单查询请求; // request } /** * @name: OrderMainInternalsearchOrder * @date: 2022/1/21 * @description: 查询订单 * @param: {request} [订单查询请求] * @return: Promise<AxiosResponse<公共响应对象<订单查询VO>>> */ export function OrderMainInternalsearchOrder(parameters: Config & OrderMainInternalsearchOrderParameters): Promise<AxiosResponse<公共响应对象<订单查询VO>>> { const { $config, $domain, ...body} = parameters const host = $domain ? $domain : getDomain() let path = '/internal/api/order/searchOrder' return request('post', host + path, body, $config) } export interface OrderMainInternalupdateOrderInvoiceStateParameters { request: 更新订单开票状态请求; // request } /** * @name: OrderMainInternalupdateOrderInvoiceState * @date: 2022/1/21 * @description: 订单开票状态更新 * @param: {request} [更新订单开票状态请求] * @return: Promise<AxiosResponse<公共响应对象<any>>> */ export function OrderMainInternalupdateOrderInvoiceState(parameters: Config & OrderMainInternalupdateOrderInvoiceStateParameters): Promise<AxiosResponse<公共响应对象<any>>> { const { $config, $domain, ...body} = parameters const host = $domain ? $domain : getDomain() let path = '/internal/api/order/updateOrderInvoiceState' return request('post', host + path, body, $config) } export interface OrderProductvirtualCodeParameters { orderId?: string; // 订单号 } /** * @name: OrderProductvirtualCode * @date: 2022/1/21 * @description: 获取订单对应虚拟券码 * @param: {orderId} [string] * @return: Promise<AxiosResponse<公共响应对象<Array<RightProductOutDetailView>>>> */ export function OrderProductvirtualCode(parameters: Config & OrderProductvirtualCodeParameters): Promise<AxiosResponse<公共响应对象<Array<RightProductOutDetailView>>>> { const { $config, $domain, ...body} = parameters const host = $domain ? $domain : getDomain() let path = '/public/api/order-product/virtual-code' return request('get', host + path, body, $config) }