@lobehub/lobehub 2.0.0-next.225 → 2.0.0-next.226
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +25 -0
- package/changelog/v1.json +9 -0
- package/locales/en-US/setting.json +4 -0
- package/locales/zh-CN/setting.json +4 -0
- package/package.json +2 -2
- package/src/app/[variants]/(main)/chat/profile/features/Header/AgentPublishButton/ForkConfirmModal.tsx +67 -0
- package/src/app/[variants]/(main)/chat/profile/features/Header/AgentPublishButton/PublishButton.tsx +92 -105
- package/src/app/[variants]/(main)/chat/profile/features/Header/AgentPublishButton/index.tsx +13 -48
- package/src/app/[variants]/(main)/chat/profile/features/Header/AgentPublishButton/useMarketPublish.ts +69 -93
- package/src/layout/AuthProvider/MarketAuth/MarketAuthProvider.tsx +11 -28
- package/src/layout/AuthProvider/MarketAuth/ProfileSetupModal.tsx +30 -25
- package/src/layout/AuthProvider/MarketAuth/useMarketUserProfile.ts +4 -9
- package/src/libs/trpc/lambda/middleware/index.ts +1 -0
- package/src/libs/trpc/lambda/middleware/marketSDK.ts +68 -0
- package/src/locales/default/setting.ts +5 -0
- package/src/server/routers/lambda/market/agent.ts +504 -0
- package/src/server/routers/lambda/market/index.ts +17 -0
- package/src/server/routers/lambda/market/oidc.ts +169 -0
- package/src/server/routers/lambda/market/social.ts +532 -0
- package/src/server/routers/lambda/market/user.ts +123 -0
- package/src/services/marketApi.ts +24 -84
- package/src/services/social.ts +70 -166
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
type AgentCreateResponse,
|
|
3
|
+
type AgentItemDetail,
|
|
4
|
+
type AgentListResponse,
|
|
5
|
+
} from '@lobehub/market-sdk';
|
|
2
6
|
|
|
3
|
-
import {
|
|
7
|
+
import { lambdaClient } from '@/libs/trpc/client';
|
|
4
8
|
|
|
5
9
|
interface GetOwnAgentsParams {
|
|
6
10
|
page?: number;
|
|
@@ -8,49 +12,15 @@ interface GetOwnAgentsParams {
|
|
|
8
12
|
}
|
|
9
13
|
|
|
10
14
|
export class MarketApiService {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
headers.set('content-type', 'application/json');
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
if (this.accessToken && !headers.has('authorization')) {
|
|
22
|
-
headers.set('authorization', `Bearer ${this.accessToken}`);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
const response = await fetch(endpoint, {
|
|
26
|
-
...init,
|
|
27
|
-
credentials: init?.credentials ?? 'same-origin',
|
|
28
|
-
headers,
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
if (!response.ok) {
|
|
32
|
-
let message = 'Unknown error';
|
|
33
|
-
|
|
34
|
-
try {
|
|
35
|
-
const errorBody = await response.json();
|
|
36
|
-
message = errorBody?.message ?? message;
|
|
37
|
-
} catch {
|
|
38
|
-
message = await response.text();
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
throw new Error(message || 'Market request failed');
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
if (response.status === 204) {
|
|
45
|
-
return undefined as T;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
return (await response.json()) as T;
|
|
15
|
+
/**
|
|
16
|
+
* @deprecated This method is no longer needed as authentication is now handled
|
|
17
|
+
* automatically through tRPC middleware. Keeping for backward compatibility.
|
|
18
|
+
*/
|
|
19
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
20
|
+
setAccessToken(_token: string) {
|
|
21
|
+
// No-op: Authentication is now handled through tRPC authedProcedure middleware
|
|
49
22
|
}
|
|
50
23
|
|
|
51
|
-
setAccessToken(token: string) {
|
|
52
|
-
this.accessToken = token;
|
|
53
|
-
}
|
|
54
24
|
// Create new agent
|
|
55
25
|
async createAgent(agentData: {
|
|
56
26
|
homepage?: string;
|
|
@@ -60,18 +30,15 @@ export class MarketApiService {
|
|
|
60
30
|
status?: 'published' | 'unpublished' | 'archived' | 'deprecated';
|
|
61
31
|
tokenUsage?: number;
|
|
62
32
|
visibility?: 'public' | 'private' | 'internal';
|
|
63
|
-
}): Promise<
|
|
64
|
-
return
|
|
65
|
-
body: JSON.stringify(agentData),
|
|
66
|
-
method: 'POST',
|
|
67
|
-
});
|
|
33
|
+
}): Promise<AgentCreateResponse> {
|
|
34
|
+
return lambdaClient.market.agent.createAgent.mutate(agentData);
|
|
68
35
|
}
|
|
69
36
|
|
|
70
37
|
// Get agent detail by identifier
|
|
71
38
|
async getAgentDetail(identifier: string): Promise<AgentItemDetail> {
|
|
72
|
-
return
|
|
73
|
-
|
|
74
|
-
})
|
|
39
|
+
return lambdaClient.market.agent.getAgentDetail.query({
|
|
40
|
+
identifier,
|
|
41
|
+
}) as Promise<AgentItemDetail>;
|
|
75
42
|
}
|
|
76
43
|
|
|
77
44
|
// Check if agent exists (returns true if exists, false if not)
|
|
@@ -111,55 +78,28 @@ export class MarketApiService {
|
|
|
111
78
|
supportsAuthenticatedExtendedCard?: boolean;
|
|
112
79
|
tokenUsage?: number;
|
|
113
80
|
url?: string;
|
|
114
|
-
})
|
|
115
|
-
|
|
116
|
-
const targetIdentifier = identifier;
|
|
117
|
-
if (!targetIdentifier) throw new Error('Identifier is required');
|
|
118
|
-
|
|
119
|
-
return this.request(MARKET_ENDPOINTS.createAgentVersion, {
|
|
120
|
-
body: JSON.stringify({
|
|
121
|
-
identifier: targetIdentifier,
|
|
122
|
-
...rest,
|
|
123
|
-
}),
|
|
124
|
-
method: 'POST',
|
|
125
|
-
});
|
|
81
|
+
}) {
|
|
82
|
+
return lambdaClient.market.agent.createAgentVersion.mutate(versionData);
|
|
126
83
|
}
|
|
127
84
|
|
|
128
85
|
// Publish agent (make it visible in marketplace)
|
|
129
86
|
async publishAgent(identifier: string): Promise<void> {
|
|
130
|
-
|
|
131
|
-
method: 'POST',
|
|
132
|
-
});
|
|
87
|
+
await lambdaClient.market.agent.publishAgent.mutate({ identifier });
|
|
133
88
|
}
|
|
134
89
|
|
|
135
90
|
// Unpublish agent (hide from marketplace, can be republished)
|
|
136
91
|
async unpublishAgent(identifier: string): Promise<void> {
|
|
137
|
-
|
|
138
|
-
method: 'POST',
|
|
139
|
-
});
|
|
92
|
+
await lambdaClient.market.agent.unpublishAgent.mutate({ identifier });
|
|
140
93
|
}
|
|
141
94
|
|
|
142
95
|
// Deprecate agent (permanently hide, cannot be republished)
|
|
143
96
|
async deprecateAgent(identifier: string): Promise<void> {
|
|
144
|
-
|
|
145
|
-
method: 'POST',
|
|
146
|
-
});
|
|
97
|
+
await lambdaClient.market.agent.deprecateAgent.mutate({ identifier });
|
|
147
98
|
}
|
|
148
99
|
|
|
149
100
|
// Get own agents (requires authentication)
|
|
150
101
|
async getOwnAgents(params?: GetOwnAgentsParams): Promise<AgentListResponse> {
|
|
151
|
-
|
|
152
|
-
if (params?.page) searchParams.set('page', String(params.page));
|
|
153
|
-
if (params?.pageSize) searchParams.set('pageSize', String(params.pageSize));
|
|
154
|
-
|
|
155
|
-
const queryString = searchParams.toString();
|
|
156
|
-
const url = queryString
|
|
157
|
-
? `${MARKET_ENDPOINTS.getOwnAgents}?${queryString}`
|
|
158
|
-
: MARKET_ENDPOINTS.getOwnAgents;
|
|
159
|
-
|
|
160
|
-
return this.request(url, {
|
|
161
|
-
method: 'GET',
|
|
162
|
-
});
|
|
102
|
+
return lambdaClient.market.agent.getOwnAgents.query(params) as Promise<AgentListResponse>;
|
|
163
103
|
}
|
|
164
104
|
}
|
|
165
105
|
|
package/src/services/social.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { lambdaClient } from '@/libs/trpc/client';
|
|
2
2
|
|
|
3
3
|
export type SocialTargetType = 'agent' | 'plugin';
|
|
4
4
|
|
|
@@ -74,108 +74,57 @@ export interface FavoritePluginItem {
|
|
|
74
74
|
}
|
|
75
75
|
|
|
76
76
|
class SocialService {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
headers.set('content-type', 'application/json');
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
if (this.accessToken && !headers.has('authorization')) {
|
|
88
|
-
headers.set('authorization', `Bearer ${this.accessToken}`);
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
const response = await fetch(endpoint, {
|
|
92
|
-
...init,
|
|
93
|
-
credentials: init?.credentials ?? 'same-origin',
|
|
94
|
-
headers,
|
|
95
|
-
});
|
|
96
|
-
|
|
97
|
-
if (!response.ok) {
|
|
98
|
-
let message = 'Unknown error';
|
|
99
|
-
|
|
100
|
-
try {
|
|
101
|
-
const errorBody = await response.json();
|
|
102
|
-
message = errorBody?.message ?? message;
|
|
103
|
-
} catch {
|
|
104
|
-
message = await response.text();
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
throw new Error(message || 'Social request failed');
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
if (response.status === 204) {
|
|
111
|
-
return undefined as T;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
return (await response.json()) as T;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
setAccessToken(token: string | undefined) {
|
|
118
|
-
this.accessToken = token;
|
|
77
|
+
/**
|
|
78
|
+
* @deprecated This method is no longer needed as authentication is now handled
|
|
79
|
+
* automatically through tRPC middleware. Keeping for backward compatibility.
|
|
80
|
+
*/
|
|
81
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
82
|
+
setAccessToken(_token: string | undefined) {
|
|
83
|
+
// No-op: Authentication is now handled through tRPC authedProcedure middleware
|
|
119
84
|
}
|
|
120
85
|
|
|
121
86
|
// ==================== Follow ====================
|
|
122
87
|
|
|
123
88
|
async follow(followingId: number): Promise<void> {
|
|
124
|
-
await
|
|
125
|
-
body: JSON.stringify({ followingId }),
|
|
126
|
-
method: 'POST',
|
|
127
|
-
});
|
|
89
|
+
await lambdaClient.market.social.follow.mutate({ followingId });
|
|
128
90
|
}
|
|
129
91
|
|
|
130
92
|
async unfollow(followingId: number): Promise<void> {
|
|
131
|
-
await
|
|
132
|
-
body: JSON.stringify({ followingId }),
|
|
133
|
-
method: 'POST',
|
|
134
|
-
});
|
|
93
|
+
await lambdaClient.market.social.unfollow.mutate({ followingId });
|
|
135
94
|
}
|
|
136
95
|
|
|
137
96
|
async checkFollowStatus(userId: number): Promise<FollowStatus> {
|
|
138
|
-
return
|
|
139
|
-
|
|
140
|
-
})
|
|
97
|
+
return lambdaClient.market.social.checkFollowStatus.query({
|
|
98
|
+
targetUserId: userId,
|
|
99
|
+
}) as Promise<FollowStatus>;
|
|
141
100
|
}
|
|
142
101
|
|
|
143
102
|
async getFollowCounts(userId: number): Promise<FollowCounts> {
|
|
144
|
-
return
|
|
145
|
-
|
|
146
|
-
})
|
|
103
|
+
return lambdaClient.market.social.getFollowCounts.query({
|
|
104
|
+
userId,
|
|
105
|
+
}) as Promise<FollowCounts>;
|
|
147
106
|
}
|
|
148
107
|
|
|
149
108
|
async getFollowing(
|
|
150
109
|
userId: number,
|
|
151
110
|
params?: PaginationParams,
|
|
152
111
|
): Promise<PaginatedResponse<FollowUserItem>> {
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
const url = queryString
|
|
159
|
-
? `${MARKET_ENDPOINTS.following(userId)}?${queryString}`
|
|
160
|
-
: MARKET_ENDPOINTS.following(userId);
|
|
161
|
-
|
|
162
|
-
return this.request(url, { method: 'GET' });
|
|
112
|
+
return lambdaClient.market.social.getFollowing.query({
|
|
113
|
+
limit: params?.pageSize,
|
|
114
|
+
offset: params?.page ? (params.page - 1) * (params.pageSize || 10) : undefined,
|
|
115
|
+
userId,
|
|
116
|
+
}) as unknown as Promise<PaginatedResponse<FollowUserItem>>;
|
|
163
117
|
}
|
|
164
118
|
|
|
165
119
|
async getFollowers(
|
|
166
120
|
userId: number,
|
|
167
121
|
params?: PaginationParams,
|
|
168
122
|
): Promise<PaginatedResponse<FollowUserItem>> {
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
const url = queryString
|
|
175
|
-
? `${MARKET_ENDPOINTS.followers(userId)}?${queryString}`
|
|
176
|
-
: MARKET_ENDPOINTS.followers(userId);
|
|
177
|
-
|
|
178
|
-
return this.request(url, { method: 'GET' });
|
|
123
|
+
return lambdaClient.market.social.getFollowers.query({
|
|
124
|
+
limit: params?.pageSize,
|
|
125
|
+
offset: params?.page ? (params.page - 1) * (params.pageSize || 10) : undefined,
|
|
126
|
+
userId,
|
|
127
|
+
}) as unknown as Promise<PaginatedResponse<FollowUserItem>>;
|
|
179
128
|
}
|
|
180
129
|
|
|
181
130
|
// ==================== Favorite ====================
|
|
@@ -184,172 +133,127 @@ class SocialService {
|
|
|
184
133
|
targetType: SocialTargetType,
|
|
185
134
|
targetIdOrIdentifier: number | string,
|
|
186
135
|
): Promise<void> {
|
|
187
|
-
const
|
|
136
|
+
const input =
|
|
188
137
|
typeof targetIdOrIdentifier === 'string'
|
|
189
138
|
? { identifier: targetIdOrIdentifier, targetType }
|
|
190
139
|
: { targetId: targetIdOrIdentifier, targetType };
|
|
191
140
|
|
|
192
|
-
await
|
|
193
|
-
body: JSON.stringify(body),
|
|
194
|
-
method: 'POST',
|
|
195
|
-
});
|
|
141
|
+
await lambdaClient.market.social.addFavorite.mutate(input);
|
|
196
142
|
}
|
|
197
143
|
|
|
198
144
|
async removeFavorite(
|
|
199
145
|
targetType: SocialTargetType,
|
|
200
146
|
targetIdOrIdentifier: number | string,
|
|
201
147
|
): Promise<void> {
|
|
202
|
-
const
|
|
148
|
+
const input =
|
|
203
149
|
typeof targetIdOrIdentifier === 'string'
|
|
204
150
|
? { identifier: targetIdOrIdentifier, targetType }
|
|
205
151
|
: { targetId: targetIdOrIdentifier, targetType };
|
|
206
152
|
|
|
207
|
-
await
|
|
208
|
-
body: JSON.stringify(body),
|
|
209
|
-
method: 'POST',
|
|
210
|
-
});
|
|
153
|
+
await lambdaClient.market.social.removeFavorite.mutate(input);
|
|
211
154
|
}
|
|
212
155
|
|
|
213
156
|
async checkFavoriteStatus(
|
|
214
157
|
targetType: SocialTargetType,
|
|
215
158
|
targetIdOrIdentifier: number | string,
|
|
216
159
|
): Promise<FavoriteStatus> {
|
|
217
|
-
return
|
|
218
|
-
|
|
219
|
-
|
|
160
|
+
return lambdaClient.market.social.checkFavorite.query({
|
|
161
|
+
targetIdOrIdentifier,
|
|
162
|
+
targetType,
|
|
163
|
+
}) as Promise<FavoriteStatus>;
|
|
220
164
|
}
|
|
221
165
|
|
|
222
166
|
async getMyFavorites(params?: PaginationParams): Promise<PaginatedResponse<FavoriteItem>> {
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
const queryString = searchParams.toString();
|
|
228
|
-
const url = queryString
|
|
229
|
-
? `${MARKET_ENDPOINTS.myFavorites}?${queryString}`
|
|
230
|
-
: MARKET_ENDPOINTS.myFavorites;
|
|
231
|
-
|
|
232
|
-
return this.request(url, { method: 'GET' });
|
|
167
|
+
return lambdaClient.market.social.getMyFavorites.query({
|
|
168
|
+
limit: params?.pageSize,
|
|
169
|
+
offset: params?.page ? (params.page - 1) * (params.pageSize || 10) : undefined,
|
|
170
|
+
}) as unknown as Promise<PaginatedResponse<FavoriteItem>>;
|
|
233
171
|
}
|
|
234
172
|
|
|
235
173
|
async getUserFavoriteAgents(
|
|
236
174
|
userId: number,
|
|
237
175
|
params?: PaginationParams,
|
|
238
176
|
): Promise<PaginatedResponse<FavoriteAgentItem>> {
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
const url = queryString
|
|
245
|
-
? `${MARKET_ENDPOINTS.favoriteAgents(userId)}?${queryString}`
|
|
246
|
-
: MARKET_ENDPOINTS.favoriteAgents(userId);
|
|
247
|
-
|
|
248
|
-
return this.request(url, { method: 'GET' });
|
|
177
|
+
return lambdaClient.market.social.getUserFavoriteAgents.query({
|
|
178
|
+
limit: params?.pageSize,
|
|
179
|
+
offset: params?.page ? (params.page - 1) * (params.pageSize || 10) : undefined,
|
|
180
|
+
userId,
|
|
181
|
+
}) as unknown as Promise<PaginatedResponse<FavoriteAgentItem>>;
|
|
249
182
|
}
|
|
250
183
|
|
|
251
184
|
async getUserFavoritePlugins(
|
|
252
185
|
userId: number,
|
|
253
186
|
params?: PaginationParams,
|
|
254
187
|
): Promise<PaginatedResponse<FavoritePluginItem>> {
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
const url = queryString
|
|
261
|
-
? `${MARKET_ENDPOINTS.favoritePlugins(userId)}?${queryString}`
|
|
262
|
-
: MARKET_ENDPOINTS.favoritePlugins(userId);
|
|
263
|
-
|
|
264
|
-
return this.request(url, { method: 'GET' });
|
|
188
|
+
return lambdaClient.market.social.getUserFavoritePlugins.query({
|
|
189
|
+
limit: params?.pageSize,
|
|
190
|
+
offset: params?.page ? (params.page - 1) * (params.pageSize || 10) : undefined,
|
|
191
|
+
userId,
|
|
192
|
+
}) as unknown as Promise<PaginatedResponse<FavoritePluginItem>>;
|
|
265
193
|
}
|
|
266
194
|
|
|
267
195
|
// ==================== Like ====================
|
|
268
196
|
|
|
269
|
-
async like(
|
|
270
|
-
|
|
271
|
-
targetIdOrIdentifier: number | string,
|
|
272
|
-
): Promise<void> {
|
|
273
|
-
const body =
|
|
197
|
+
async like(targetType: SocialTargetType, targetIdOrIdentifier: number | string): Promise<void> {
|
|
198
|
+
const input =
|
|
274
199
|
typeof targetIdOrIdentifier === 'string'
|
|
275
200
|
? { identifier: targetIdOrIdentifier, targetType }
|
|
276
201
|
: { targetId: targetIdOrIdentifier, targetType };
|
|
277
202
|
|
|
278
|
-
await
|
|
279
|
-
body: JSON.stringify(body),
|
|
280
|
-
method: 'POST',
|
|
281
|
-
});
|
|
203
|
+
await lambdaClient.market.social.like.mutate(input);
|
|
282
204
|
}
|
|
283
205
|
|
|
284
|
-
async unlike(
|
|
285
|
-
|
|
286
|
-
targetIdOrIdentifier: number | string,
|
|
287
|
-
): Promise<void> {
|
|
288
|
-
const body =
|
|
206
|
+
async unlike(targetType: SocialTargetType, targetIdOrIdentifier: number | string): Promise<void> {
|
|
207
|
+
const input =
|
|
289
208
|
typeof targetIdOrIdentifier === 'string'
|
|
290
209
|
? { identifier: targetIdOrIdentifier, targetType }
|
|
291
210
|
: { targetId: targetIdOrIdentifier, targetType };
|
|
292
211
|
|
|
293
|
-
await
|
|
294
|
-
body: JSON.stringify(body),
|
|
295
|
-
method: 'POST',
|
|
296
|
-
});
|
|
212
|
+
await lambdaClient.market.social.unlike.mutate(input);
|
|
297
213
|
}
|
|
298
214
|
|
|
299
215
|
async checkLikeStatus(
|
|
300
216
|
targetType: SocialTargetType,
|
|
301
217
|
targetIdOrIdentifier: number | string,
|
|
302
218
|
): Promise<LikeStatus> {
|
|
303
|
-
return
|
|
304
|
-
|
|
305
|
-
|
|
219
|
+
return lambdaClient.market.social.checkLike.query({
|
|
220
|
+
targetIdOrIdentifier,
|
|
221
|
+
targetType,
|
|
222
|
+
}) as Promise<LikeStatus>;
|
|
306
223
|
}
|
|
307
224
|
|
|
308
225
|
async toggleLike(
|
|
309
226
|
targetType: SocialTargetType,
|
|
310
227
|
targetIdOrIdentifier: number | string,
|
|
311
228
|
): Promise<ToggleLikeResult> {
|
|
312
|
-
const
|
|
229
|
+
const input =
|
|
313
230
|
typeof targetIdOrIdentifier === 'string'
|
|
314
231
|
? { identifier: targetIdOrIdentifier, targetType }
|
|
315
232
|
: { targetId: targetIdOrIdentifier, targetType };
|
|
316
233
|
|
|
317
|
-
return
|
|
318
|
-
body: JSON.stringify(body),
|
|
319
|
-
method: 'POST',
|
|
320
|
-
});
|
|
234
|
+
return lambdaClient.market.social.toggleLike.mutate(input) as Promise<ToggleLikeResult>;
|
|
321
235
|
}
|
|
322
236
|
|
|
323
237
|
async getUserLikedAgents(
|
|
324
238
|
userId: number,
|
|
325
239
|
params?: PaginationParams,
|
|
326
240
|
): Promise<PaginatedResponse<FavoriteAgentItem>> {
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
const url = queryString
|
|
333
|
-
? `${MARKET_ENDPOINTS.likedAgents(userId)}?${queryString}`
|
|
334
|
-
: MARKET_ENDPOINTS.likedAgents(userId);
|
|
335
|
-
|
|
336
|
-
return this.request(url, { method: 'GET' });
|
|
241
|
+
return lambdaClient.market.social.getUserLikedAgents.query({
|
|
242
|
+
limit: params?.pageSize,
|
|
243
|
+
offset: params?.page ? (params.page - 1) * (params.pageSize || 10) : undefined,
|
|
244
|
+
userId,
|
|
245
|
+
}) as unknown as Promise<PaginatedResponse<FavoriteAgentItem>>;
|
|
337
246
|
}
|
|
338
247
|
|
|
339
248
|
async getUserLikedPlugins(
|
|
340
249
|
userId: number,
|
|
341
250
|
params?: PaginationParams,
|
|
342
251
|
): Promise<PaginatedResponse<FavoritePluginItem>> {
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
const url = queryString
|
|
349
|
-
? `${MARKET_ENDPOINTS.likedPlugins(userId)}?${queryString}`
|
|
350
|
-
: MARKET_ENDPOINTS.likedPlugins(userId);
|
|
351
|
-
|
|
352
|
-
return this.request(url, { method: 'GET' });
|
|
252
|
+
return lambdaClient.market.social.getUserLikedPlugins.query({
|
|
253
|
+
limit: params?.pageSize,
|
|
254
|
+
offset: params?.page ? (params.page - 1) * (params.pageSize || 10) : undefined,
|
|
255
|
+
userId,
|
|
256
|
+
}) as unknown as Promise<PaginatedResponse<FavoritePluginItem>>;
|
|
353
257
|
}
|
|
354
258
|
}
|
|
355
259
|
|