Skip to content

Commit 22ad61a

Browse files
authored
feat(cli): compatible with new apis (#1211)
* feat: compatible with new apis * feat: rm websocket field
1 parent 708f021 commit 22ad61a

File tree

16 files changed

+1155
-276
lines changed

16 files changed

+1155
-276
lines changed

cli/src/action/application/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ async function getRegionMap(): Promise<Map<string, any>> {
5050
const regionMap = new Map<string, any>()
5151
const regions = await regionControllerGetRegions()
5252
for (let region of regions) {
53-
regionMap.set(region.id, region)
53+
regionMap.set(region._id, region)
5454
}
5555
return regionMap
5656
}

cli/src/action/function/index.ts

+4-6
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ export async function create(
3434
const createDto: CreateFunctionDto = {
3535
name: funcName,
3636
description: options.description,
37-
websocket: options.websocket,
3837
methods: options.methods,
3938
code: `\nimport cloud from '@lafjs/cloud'\n\nexport default async function (ctx: FunctionContext) {\n console.log('Hello World')\n return { data: 'hi, laf' }\n}\n`,
4039
tags: options.tags,
@@ -114,7 +113,6 @@ async function push(funcName: string, isCreate: boolean) {
114113
const createDto: CreateFunctionDto = {
115114
name: funcName,
116115
description: funcSchema.description || '',
117-
websocket: funcSchema.websocket,
118116
methods: funcSchema.methods as any,
119117
code,
120118
tags: funcSchema.tags,
@@ -123,7 +121,6 @@ async function push(funcName: string, isCreate: boolean) {
123121
} else {
124122
const updateDto: UpdateFunctionDto = {
125123
description: funcSchema.description || '',
126-
websocket: funcSchema.websocket,
127124
methods: funcSchema.methods as any,
128125
code,
129126
tags: funcSchema.tags,
@@ -248,15 +245,16 @@ export async function exec(
248245

249246
// print log
250247
if (options.log) {
251-
await printLog(appSchema.appid, res.requestId, options.log)
248+
await printLog(appSchema.appid, res.requestId)
252249
}
253250
}
254251

255-
async function printLog(appid: string, requestId: string, limit: string) {
252+
async function printLog(appid: string, requestId: string) {
256253
const data = await logControllerGetLogs({
257254
appid,
258255
requestId,
259-
limit: limit,
256+
page: '1',
257+
pageSize: '100',
260258
})
261259
for (let log of data.list) {
262260
console.log(`[${formatDate(log.createdAt)}] ${log.data}`)

cli/src/api/v1/account.ts

+72
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
import { request, RequestParams } from "../../util/request";
2+
import { AccountControllerWechatNotifyData, CreateChargeOrderDto } from "./data-contracts";
3+
4+
/**
5+
* No description
6+
*
7+
* @tags Account
8+
* @name AccountControllerFindOne
9+
* @summary Get account info
10+
* @request GET:/v1/accounts
11+
* @secure
12+
*/
13+
export async function accountControllerFindOne(configParams: RequestParams = {}): Promise<any> {
14+
return request({
15+
url: `/v1/accounts`,
16+
method: "GET",
17+
...configParams,
18+
});
19+
}
20+
/**
21+
* No description
22+
*
23+
* @tags Account
24+
* @name AccountControllerGetChargeOrder
25+
* @summary Get charge order
26+
* @request GET:/v1/accounts/charge-order/{id}
27+
* @secure
28+
*/
29+
export async function accountControllerGetChargeOrder(id: string, configParams: RequestParams = {}): Promise<any> {
30+
return request({
31+
url: `/v1/accounts/charge-order/${id}`,
32+
method: "GET",
33+
...configParams,
34+
});
35+
}
36+
/**
37+
* No description
38+
*
39+
* @tags Account
40+
* @name AccountControllerCharge
41+
* @summary Create charge order
42+
* @request POST:/v1/accounts/charge-order
43+
* @secure
44+
*/
45+
export async function accountControllerCharge(
46+
data: CreateChargeOrderDto,
47+
configParams: RequestParams = {},
48+
): Promise<any> {
49+
return request({
50+
url: `/v1/accounts/charge-order`,
51+
method: "POST",
52+
data: data,
53+
...configParams,
54+
});
55+
}
56+
/**
57+
* No description
58+
*
59+
* @tags Account
60+
* @name AccountControllerWechatNotify
61+
* @request POST:/v1/accounts/payment/wechat-notify
62+
* @secure
63+
*/
64+
export async function accountControllerWechatNotify(
65+
configParams: RequestParams = {},
66+
): Promise<AccountControllerWechatNotifyData> {
67+
return request({
68+
url: `/v1/accounts/payment/wechat-notify`,
69+
method: "POST",
70+
...configParams,
71+
});
72+
}

0 commit comments

Comments
 (0)