diff --git a/package.json b/package.json index 07c5682..d77a71f 100644 --- a/package.json +++ b/package.json @@ -35,6 +35,7 @@ "code-inspector-plugin": "^1.2.10", "husky": "^9", "lint-staged": "^13.2.0", + "openapi2ts": "^1.1.14", "prettier": "^2.8.7", "prettier-plugin-organize-imports": "^3.2.2", "prettier-plugin-packagejson": "^2.4.3", diff --git a/src/servers/api/index.ts b/src/servers/api/index.ts index 4737f7c..a377a94 100644 --- a/src/servers/api/index.ts +++ b/src/servers/api/index.ts @@ -9,6 +9,7 @@ import * as product from './product'; import * as site from './site'; import * as statistics from './statistics'; import * as stock from './stock'; +import * as subscription from './subscription'; import * as user from './user'; import * as webhook from './webhook'; import * as wpProduct from './wpProduct'; @@ -20,6 +21,7 @@ export default { site, statistics, stock, + subscription, user, webhook, wpProduct, diff --git a/src/servers/api/subscription.ts b/src/servers/api/subscription.ts new file mode 100644 index 0000000..9f49d74 --- /dev/null +++ b/src/servers/api/subscription.ts @@ -0,0 +1,32 @@ +// @ts-ignore +/* eslint-disable */ +import { request } from 'umi'; + +/** 此处后端没有提供注释 GET /subscription/list */ +export async function subscriptioncontrollerList( + // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) + params: API.subscriptioncontrollerListParams, + options?: { [key: string]: any }, +) { + return request('/subscription/list', { + method: 'GET', + params: { + ...params, + }, + ...(options || {}), + }); +} + +/** 此处后端没有提供注释 POST /subscription/sync/${param0} */ +export async function subscriptioncontrollerSync( + // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) + params: API.subscriptioncontrollerSyncParams, + options?: { [key: string]: any }, +) { + const { siteId: param0, ...queryParams } = params; + return request(`/subscription/sync/${param0}`, { + method: 'POST', + params: { ...queryParams }, + ...(options || {}), + }); +} diff --git a/src/servers/api/typings.d.ts b/src/servers/api/typings.d.ts index f906d72..b486b9f 100644 --- a/src/servers/api/typings.d.ts +++ b/src/servers/api/typings.d.ts @@ -235,7 +235,6 @@ declare namespace API { total_tax?: number; customer_id?: number; customer_email?: string; - billing_phone?: string; order_key?: string; billing?: OrderAddress; shipping?: OrderAddress; @@ -258,6 +257,8 @@ declare namespace API { device_type?: string; source_type?: string; utm_source?: string; + is_exchange?: boolean; + exchange_frequency?: number; /** 创建时间 */ createdAt: string; /** 更新时间 */ @@ -333,9 +334,9 @@ declare namespace API { | 'after_sale_pending' | 'pending_reshipment' | 'pending_refund' - | 'refund_requested' - | 'refund_approved' - | 'refund_cancelled'; + | 'return-requested' + | 'return-approved' + | 'return-cancelled'; payment_method?: string; }; @@ -377,7 +378,6 @@ declare namespace API { total_tax?: number; customer_id?: number; customer_email?: string; - billing_phone?: string; order_key?: string; billing?: OrderAddress; shipping?: OrderAddress; @@ -400,6 +400,8 @@ declare namespace API { device_type?: string; source_type?: string; utm_source?: string; + is_exchange?: boolean; + exchange_frequency?: number; /** 创建时间 */ createdAt: string; /** 更新时间 */ @@ -861,9 +863,9 @@ declare namespace API { | 'after_sale_pending' | 'pending_reshipment' | 'pending_refund' - | 'refund_requested' - | 'refund_approved' - | 'refund_cancelled'; + | 'return-requested' + | 'return-approved' + | 'return-cancelled'; payment_method?: string; }; @@ -946,6 +948,27 @@ declare namespace API { name?: string; }; + type QuerySubscriptionDTO = { + /** 页码 */ + current?: number; + /** 每页大小 */ + pageSize?: number; + /** 站点ID */ + siteId?: string; + /** 订阅状态 */ + status?: + | 'active' + | 'pending' + | 'on-hold' + | 'cancelled' + | 'expired' + | 'pending-cancel'; + /** 客户邮箱 */ + customer_email?: string; + /** 关键字(订阅ID、邮箱等) */ + keyword?: string; + }; + type QueryWpProductDTO = { /** 页码 */ current?: number; @@ -1307,6 +1330,82 @@ declare namespace API { items?: StockRecordDTO[]; }; + type Subscription = { + id?: number; + /** 来源站点唯一标识 */ + siteId?: string; + /** WooCommerce 订阅 ID */ + externalSubscriptionId?: string; + status?: any; + currency?: string; + total?: number; + /** 计费周期 e.g. day/week/month/year */ + billing_period?: string; + /** 计费周期间隔 e.g. 1/3/12 */ + billing_interval?: number; + customer_id?: number; + customer_email?: string; + /** 父订单/父订阅ID(如有) */ + parent_id?: number; + start_date?: string; + trial_end?: string; + next_payment_date?: string; + end_date?: string; + line_items?: any; + meta_data?: any; + /** 创建时间 */ + createdAt: string; + /** 更新时间 */ + updatedAt: string; + }; + + type subscriptioncontrollerListParams = { + /** 页码 */ + current?: number; + /** 每页大小 */ + pageSize?: number; + /** 站点ID */ + siteId?: string; + /** 订阅状态 */ + status?: + | 'active' + | 'pending' + | 'on-hold' + | 'cancelled' + | 'expired' + | 'pending-cancel'; + /** 客户邮箱 */ + customer_email?: string; + /** 关键字(订阅ID、邮箱等) */ + keyword?: string; + }; + + type subscriptioncontrollerSyncParams = { + siteId: string; + }; + + type SubscriptionListRes = { + /** 状态码 */ + code?: number; + /** 是否成功 */ + success?: boolean; + /** 消息内容 */ + message?: string; + /** 响应数据 */ + data?: SubscriptionPaginatedResponse; + }; + + type SubscriptionPaginatedResponse = { + /** 当前页码 */ + page?: number; + /** 每页大小 */ + pageSize?: number; + /** 总记录数 */ + total?: number; + /** 数据列表 */ + items?: Subscription[]; + }; + type Surcharges = { type?: string; amount?: Money; @@ -1415,6 +1514,8 @@ declare namespace API { sale_price?: number; /** 是否促销中 */ on_sale?: boolean; + /** 是否删除 */ + on_delete?: boolean; /** 创建时间 */ createdAt: string; /** 更新时间 */ @@ -1448,6 +1549,10 @@ declare namespace API { | 'inherit'; }; + type wpproductcontrollerSearchproductsParams = { + name?: string; + }; + type wpproductcontrollerSetconstitutionParams = { id: number; }; @@ -1500,6 +1605,8 @@ declare namespace API { sale_price?: number; /** 是否促销中 */ on_sale?: boolean; + /** 是否删除 */ + on_delete?: boolean; /** 产品类型 */ type?: 'simple' | 'variable' | 'woosb'; /** 创建时间 */ diff --git a/src/servers/api/wpProduct.ts b/src/servers/api/wpProduct.ts index bb2e9c1..dd072dd 100644 --- a/src/servers/api/wpProduct.ts +++ b/src/servers/api/wpProduct.ts @@ -36,6 +36,21 @@ export async function wpproductcontrollerGetwpproducts( }); } +/** 此处后端没有提供注释 GET /wp_product/search */ +export async function wpproductcontrollerSearchproducts( + // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) + params: API.wpproductcontrollerSearchproductsParams, + options?: { [key: string]: any }, +) { + return request('/wp_product/search', { + method: 'GET', + params: { + ...params, + }, + ...(options || {}), + }); +} + /** 此处后端没有提供注释 PUT /wp_product/siteId/${param1}/products/${param0} */ export async function wpproductcontrollerUpdateproduct( // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)