UNPKG

@tcatche/swagger-ts

Version:

Codegen from swagger to TS & Axios Functions

366 lines (323 loc) 11.3 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) } } // InvoiceApplyEntity export interface InvoiceApplyEntity { address?: string; // 企业地址 bankAccount?: string; // 银行账号 bankName?: string; // 开户银行 createdBy?: string; createdTime?: string; deliveryStatus?: string; // 邮件发送状态 deliveryTime?: string; // 邮件发送时间 email?: string; // 接收发票邮箱 id?: number; // 唯一ID(Update必填) orderNos?: string; // 订单列表(Update必填) orderSource?: string; // 订单来源 rejectDesc?: string; // 驳回原因(Update选填) status?: string; // 开票状态(Update必填) statusCode?: string; // 开票状态代码(Update必填) taxNo?: string; // 税号 tel?: string; // 企业电话 title?: string; // 发票抬头 type?: string; // 抬头类型 updatedBy?: string; updatedTime?: string; userId?: number; // 用户ID } // InvoiceApplyOrderEntity export interface InvoiceApplyOrderEntity { actualAmount?: number; // 订单实际支付总金额,单位分 applyId?: number; // 开票流水ID createdBy?: string; createdTime?: string; id?: number; orderNo?: string; // 订单号 updatedBy?: string; updatedTime?: string; } // InvoiceApplyVO export interface InvoiceApplyVO { address?: string; // 企业地址 bankAccount?: string; // 企业银行账号 bankName?: string; // 开户银行 email?: string; // 接收发票邮箱 orderNos?: string; // 订单号列表 orderSource?: string; // 订单来源 01:加油 02:商城 taxNo?: string; // 税号 tel?: string; // 企业电话 title?: string; // 发票抬头 type?: string; // 发票类型(个人,企业) } // InvoiceDetailEntity export interface InvoiceDetailEntity { amount?: number; applyId?: number; // 开票流水ID buyerName?: string; createdBy?: string; createdTime?: string; id?: number; invCode?: string; invDt?: string; invNo?: string; // 发票号码 invoiceContent?: string; invoiceImageId?: number; // 发票图片ID invoiceImageUrl?: string; price?: number; remark?: string; serialNo?: string; updatedBy?: string; updatedTime?: string; } // InvoiceInfoVO export interface InvoiceInfoVO { applyEntity?: InvoiceApplyEntity; detailEntities?: Array<InvoiceDetailEntity>; // 发票详情信息 orderEntities?: Array<InvoiceApplyOrderEntity>; // 关联订单信息 recordEntities?: Array<InvoiceRecordEntity>; // 开票申请操作记录 } // InvoiceQueryVO export interface InvoiceQueryVO { creatTimeFrom?: string; // 起始提交时间 creatTimeTo?: string; // 截止提交时间 deliveryStatus?: string; // 邮件发送状态 deliveryTimeFrom?: string; // 起始邮件发送时间 deliveryTimeTo?: string; // 截止邮件发送时间 orderNo?: string; // 订单号 page?: string; size?: string; status?: Array<string>; // 开票状态 type?: string; // 抬头类型(个人,企业) } // InvoiceRecordEntity export interface InvoiceRecordEntity { applyId?: number; // 开票流水ID createdBy?: string; createdTime?: string; id?: number; processing?: string; // 操作 rejectDesc?: string; // 驳回原因(Update选填) updatedBy?: string; updatedTime?: string; } // InvoiceStatisticVO export interface InvoiceStatisticVO { invoiceFailNum?: number; // 开票失败总数 invoicedNum?: number; // 已开票总数 notInvoiceNum?: number; // 未开票总数 total?: number; // 总数 } // InvoiceUpdateVO export interface InvoiceUpdateVO { applyEntity?: InvoiceApplyEntity; detailEntityList?: Array<InvoiceDetailEntity>; // 开票详细信息 } // MailTempResponse export interface MailTempResponse { id: number; // 模板id isDeteleted: number; // 模板是否生效 templateCategory: number; // 模板分类 templateCode: string; // 模板code templateComments?: string; // 模板描述 templateContent: string; // 模板内容 templateTitle: string; // 模板标题 } // 公共响应对象<T> export interface 公共响应对象<T> { data?: T; errorCode?: string; // 错误码 errorMsg?: string; // 错误信息 status?: boolean; // 响应状态 } // 发票邮件模板 export interface 发票邮件模板 { templateContent: string; // 模板内容,更新时生效 templateTitle: string; // 模板标题,更新时生效 } /** * @name: InvoiceMailquery * @date: 2022/1/21 * @description: 查询邮件模板 * @return: Promise<AxiosResponse<公共响应对象<Array<MailTempResponse>>>> */ export function InvoiceMailquery(parameters: Config): Promise<AxiosResponse<公共响应对象<Array<MailTempResponse>>>> { const { $config, $domain, ...body} = parameters const host = $domain ? $domain : getDomain() let path = '/admin/api/v1/mail/query' return request('get', host + path, body, $config) } export interface InvoiceMailsendParameters { applyId?: number; // 开票申请ID email?: string; // 邮件地址 } /** * @name: InvoiceMailsend * @date: 2022/1/21 * @description: 发送邮件 * @param: {applyId} [integer] * @param: {email} [string] * @return: Promise<AxiosResponse<公共响应对象<any>>> */ export function InvoiceMailsend(parameters: Config & InvoiceMailsendParameters): Promise<AxiosResponse<公共响应对象<any>>> { const { $config, $domain, ...body} = parameters const host = $domain ? $domain : getDomain() let path = '/admin/api/v1/mail/send' return request('get', host + path, body, $config) } export interface InvoiceMailupdateParameters { query: 发票邮件模板; // query } /** * @name: InvoiceMailupdate * @date: 2022/1/21 * @description: 修改邮件模板 * @param: {query} [发票邮件模板] * @return: Promise<AxiosResponse<公共响应对象<any>>> */ export function InvoiceMailupdate(parameters: Config & InvoiceMailupdateParameters): Promise<AxiosResponse<公共响应对象<any>>> { const { $config, $domain, ...body} = parameters const host = $domain ? $domain : getDomain() let path = '/admin/api/v1/mail/update' return request('post', host + path, body, $config) } export interface InvoiceApplyexportParameters { invoiceQueryVO: InvoiceQueryVO; // invoiceQueryVO } /** * @name: InvoiceApplyexport * @date: 2022/1/21 * @description: 开票列表导出 * @param: {invoiceQueryVO} [InvoiceQueryVO] * @return: Promise<AxiosResponse<never>> */ export function InvoiceApplyexport(parameters: Config & InvoiceApplyexportParameters): Promise<AxiosResponse<never>> { const { $config, $domain, ...body} = parameters const host = $domain ? $domain : getDomain() let path = '/admin/v1/api/apply/export' return request('post', host + path, body, $config) } export interface InvoiceApplyinfoParameters { id: number; // id } /** * @name: InvoiceApplyinfo * @date: 2022/1/21 * @description: 开票详情 * @param: {id} [integer] * @return: Promise<AxiosResponse<公共响应对象<InvoiceInfoVO>>> */ export function InvoiceApplyinfo(parameters: Config & InvoiceApplyinfoParameters): Promise<AxiosResponse<公共响应对象<InvoiceInfoVO>>> { const { $config, $domain, ...body} = parameters const host = $domain ? $domain : getDomain() let path = '/admin/v1/api/apply/info' return request('post', host + path, body, $config) } export interface InvoiceApplyqueryParameters { invoiceQueryVO: InvoiceQueryVO; // invoiceQueryVO } /** * @name: InvoiceApplyquery * @date: 2022/1/21 * @description: 开票列表 * @param: {invoiceQueryVO} [InvoiceQueryVO] * @return: Promise<AxiosResponse<公共响应对象<any>>> */ export function InvoiceApplyquery(parameters: Config & InvoiceApplyqueryParameters): Promise<AxiosResponse<公共响应对象<any>>> { const { $config, $domain, ...body} = parameters const host = $domain ? $domain : getDomain() let path = '/admin/v1/api/apply/query' return request('post', host + path, body, $config) } export interface InvoiceApplystatisticInvoiceParameters { invoiceQueryVO: InvoiceQueryVO; // invoiceQueryVO } /** * @name: InvoiceApplystatisticInvoice * @date: 2022/1/21 * @description: 统计发票 * @param: {invoiceQueryVO} [InvoiceQueryVO] * @return: Promise<AxiosResponse<公共响应对象<InvoiceStatisticVO>>> */ export function InvoiceApplystatisticInvoice(parameters: Config & InvoiceApplystatisticInvoiceParameters): Promise<AxiosResponse<公共响应对象<InvoiceStatisticVO>>> { const { $config, $domain, ...body} = parameters const host = $domain ? $domain : getDomain() let path = '/admin/v1/api/apply/statistics' return request('post', host + path, body, $config) } export interface InvoiceApplyupdateParameters { invoiceUpdateVO: InvoiceUpdateVO; // invoiceUpdateVO } /** * @name: InvoiceApplyupdate * @date: 2022/1/21 * @description: 更新开票申请 * @param: {invoiceUpdateVO} [InvoiceUpdateVO] * @return: Promise<AxiosResponse<公共响应对象<any>>> */ export function InvoiceApplyupdate(parameters: Config & InvoiceApplyupdateParameters): Promise<AxiosResponse<公共响应对象<any>>> { const { $config, $domain, ...body} = parameters const host = $domain ? $domain : getDomain() let path = '/admin/v1/api/apply/update' return request('post', host + path, body, $config) } export interface InvoiceapplyParameters { invoiceApplyVO: InvoiceApplyVO; // invoiceApplyVO } /** * @name: Invoiceapply * @date: 2022/1/21 * @description: 申请开票 * @param: {invoiceApplyVO} [InvoiceApplyVO] * @return: Promise<AxiosResponse<公共响应对象<any>>> */ export function Invoiceapply(parameters: Config & InvoiceapplyParameters): Promise<AxiosResponse<公共响应对象<any>>> { const { $config, $domain, ...body} = parameters const host = $domain ? $domain : getDomain() let path = '/public/api/v1/apply' return request('post', host + path, body, $config) }