@crosspost/types 0.1.6 → 0.1.8
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/dist/index.cjs +398 -684
- package/dist/index.d.cts +1501 -5904
- package/dist/index.d.ts +1501 -5904
- package/dist/index.js +390 -660
- package/package.json +1 -1
- package/src/activity.ts +30 -115
- package/src/auth.ts +55 -73
- package/src/common.ts +8 -10
- package/src/errors.ts +97 -0
- package/src/index.ts +1 -13
- package/src/post.ts +22 -168
- package/src/rate-limit.ts +33 -72
- package/src/response.ts +48 -288
- package/src/user-profile.ts +2 -26
- package/src/errors/api-error.ts +0 -155
- package/src/errors/base-error.ts +0 -13
- package/src/errors/composite-api-error.ts +0 -33
- package/src/errors/index.ts +0 -8
- package/src/errors/platform-error.ts +0 -34
package/src/post.ts
CHANGED
@@ -1,25 +1,13 @@
|
|
1
|
-
/**
|
2
|
-
* Post Schemas and Types
|
3
|
-
* Defines Zod schemas for post-related requests and responses
|
4
|
-
* TypeScript types are derived from Zod schemas for type safety
|
5
|
-
*/
|
6
|
-
|
7
1
|
import { z } from 'zod';
|
8
2
|
import { PlatformSchema } from './common.ts';
|
9
|
-
import {
|
3
|
+
import { ErrorDetailSchema } from './errors.ts';
|
10
4
|
|
11
|
-
/**
|
12
|
-
* Media content schema
|
13
|
-
*/
|
14
5
|
export const MediaContentSchema = z.object({
|
15
6
|
data: z.union([z.string(), z.instanceof(Blob)]).describe('Media data as string or Blob'),
|
16
7
|
mimeType: z.string().optional().describe('Media MIME type'),
|
17
8
|
altText: z.string().optional().describe('Alt text for the media'),
|
18
9
|
}).describe('Media content object');
|
19
10
|
|
20
|
-
/**
|
21
|
-
* Media schema
|
22
|
-
*/
|
23
11
|
export const MediaSchema = z.object({
|
24
12
|
id: z.string().describe('Media ID'),
|
25
13
|
type: z.enum(['image', 'video', 'gif']).describe('Media type'),
|
@@ -27,9 +15,6 @@ export const MediaSchema = z.object({
|
|
27
15
|
altText: z.string().optional().describe('Alt text for the media'),
|
28
16
|
}).describe('Media object');
|
29
17
|
|
30
|
-
/**
|
31
|
-
* Post metrics schema
|
32
|
-
*/
|
33
18
|
export const PostMetricsSchema = z.object({
|
34
19
|
retweets: z.number().describe('Number of retweets'),
|
35
20
|
quotes: z.number().describe('Number of quotes'),
|
@@ -37,9 +22,6 @@ export const PostMetricsSchema = z.object({
|
|
37
22
|
replies: z.number().describe('Number of replies'),
|
38
23
|
}).describe('Post metrics');
|
39
24
|
|
40
|
-
/**
|
41
|
-
* Post schema
|
42
|
-
*/
|
43
25
|
export const PostSchema = z.object({
|
44
26
|
id: z.string().describe('Post ID'),
|
45
27
|
text: z.string().describe('Post text content'),
|
@@ -51,17 +33,11 @@ export const PostSchema = z.object({
|
|
51
33
|
quotedPostId: z.string().optional().describe('ID of the post this is quoting'),
|
52
34
|
}).describe('Post object');
|
53
35
|
|
54
|
-
/**
|
55
|
-
* Post content schema
|
56
|
-
*/
|
57
36
|
export const PostContentSchema = z.object({
|
58
37
|
text: z.string().optional().describe('Text content for the post'),
|
59
38
|
media: z.array(MediaContentSchema).optional().describe('Media attachments for the post'),
|
60
39
|
}).describe('Post content');
|
61
40
|
|
62
|
-
/**
|
63
|
-
* Post result schema
|
64
|
-
*/
|
65
41
|
export const PostResultSchema = z.object({
|
66
42
|
id: z.string().describe('Post ID'),
|
67
43
|
text: z.string().optional().describe('Post text content'),
|
@@ -73,25 +49,16 @@ export const PostResultSchema = z.object({
|
|
73
49
|
success: z.boolean().optional().describe('Whether the operation was successful'),
|
74
50
|
}).catchall(z.any()).describe('Post result');
|
75
51
|
|
76
|
-
/**
|
77
|
-
* Delete result schema
|
78
|
-
*/
|
79
52
|
export const DeleteResultSchema = z.object({
|
80
53
|
success: z.boolean().describe('Whether the deletion was successful'),
|
81
54
|
id: z.string().describe('ID of the deleted post'),
|
82
55
|
}).describe('Delete result');
|
83
56
|
|
84
|
-
/**
|
85
|
-
* Like result schema
|
86
|
-
*/
|
87
57
|
export const LikeResultSchema = z.object({
|
88
58
|
success: z.boolean().describe('Whether the like was successful'),
|
89
59
|
id: z.string().describe('ID of the liked post'),
|
90
60
|
}).describe('Like result');
|
91
61
|
|
92
|
-
/**
|
93
|
-
* Success detail schema for post operations
|
94
|
-
*/
|
95
62
|
export const PostSuccessDetailSchema = z.object({
|
96
63
|
platform: PlatformSchema,
|
97
64
|
userId: z.string().describe('User ID'),
|
@@ -100,21 +67,11 @@ export const PostSuccessDetailSchema = z.object({
|
|
100
67
|
postUrl: z.string().optional().describe('URL to the post'),
|
101
68
|
}).catchall(z.any()).describe('Post success detail');
|
102
69
|
|
103
|
-
/**
|
104
|
-
* Request schemas
|
105
|
-
*/
|
106
|
-
|
107
|
-
/**
|
108
|
-
* Target schema - common for all operations
|
109
|
-
*/
|
110
70
|
export const TargetSchema = z.object({
|
111
71
|
platform: PlatformSchema.describe('The platform to post to (e.g., "twitter")'),
|
112
72
|
userId: z.string().describe('User ID on the platform'),
|
113
73
|
}).describe('Target for posting operations');
|
114
74
|
|
115
|
-
/**
|
116
|
-
* Create post request schema
|
117
|
-
*/
|
118
75
|
export const CreatePostRequestSchema = z.object({
|
119
76
|
targets: z.array(TargetSchema).describe('Array of targets to post to (can be a single target)'),
|
120
77
|
content: z.array(PostContentSchema).describe(
|
@@ -122,18 +79,12 @@ export const CreatePostRequestSchema = z.object({
|
|
122
79
|
),
|
123
80
|
}).describe('Create post request');
|
124
81
|
|
125
|
-
/**
|
126
|
-
* Repost request schema
|
127
|
-
*/
|
128
82
|
export const RepostRequestSchema = z.object({
|
129
83
|
targets: z.array(TargetSchema).describe('Array of targets to post to'),
|
130
84
|
platform: PlatformSchema.describe('Platform of the post being reposted'),
|
131
85
|
postId: z.string().describe('ID of the post to repost'),
|
132
86
|
}).describe('Repost request');
|
133
87
|
|
134
|
-
/**
|
135
|
-
* Quote post request schema
|
136
|
-
*/
|
137
88
|
export const QuotePostRequestSchema = z.object({
|
138
89
|
targets: z.array(TargetSchema).describe(
|
139
90
|
'Array of targets to post to (must be on the same platform as the post being quoted)',
|
@@ -145,9 +96,6 @@ export const QuotePostRequestSchema = z.object({
|
|
145
96
|
),
|
146
97
|
}).describe('Quote post request');
|
147
98
|
|
148
|
-
/**
|
149
|
-
* Reply to post request schema
|
150
|
-
*/
|
151
99
|
export const ReplyToPostRequestSchema = z.object({
|
152
100
|
targets: z.array(TargetSchema).describe(
|
153
101
|
'Array of targets to post to (must be on the same platform as the post being replied to)',
|
@@ -159,26 +107,17 @@ export const ReplyToPostRequestSchema = z.object({
|
|
159
107
|
),
|
160
108
|
}).describe('Reply to post request');
|
161
109
|
|
162
|
-
/**
|
163
|
-
* Post to delete schema
|
164
|
-
*/
|
165
110
|
export const PostToDeleteSchema = z.object({
|
166
111
|
platform: PlatformSchema.describe('Platform of the post to delete'),
|
167
112
|
userId: z.string().describe('User ID on the platform'),
|
168
113
|
postId: z.string().describe('ID of the post to delete'),
|
169
114
|
}).describe('Post to delete');
|
170
115
|
|
171
|
-
/**
|
172
|
-
* Delete post request schema
|
173
|
-
*/
|
174
116
|
export const DeletePostRequestSchema = z.object({
|
175
117
|
targets: z.array(TargetSchema).describe('Array of targets to delete posts'),
|
176
118
|
posts: z.array(PostToDeleteSchema).describe('Array of posts to delete'),
|
177
119
|
}).describe('Delete post request');
|
178
120
|
|
179
|
-
/**
|
180
|
-
* Like post request schema
|
181
|
-
*/
|
182
121
|
export const LikePostRequestSchema = z.object({
|
183
122
|
targets: z.array(TargetSchema).describe(
|
184
123
|
'Array of targets to like the post (must be on the same platform as the post being liked)',
|
@@ -187,9 +126,6 @@ export const LikePostRequestSchema = z.object({
|
|
187
126
|
postId: z.string().describe('ID of the post to like'),
|
188
127
|
}).describe('Like post request');
|
189
128
|
|
190
|
-
/**
|
191
|
-
* Unlike post request schema
|
192
|
-
*/
|
193
129
|
export const UnlikePostRequestSchema = z.object({
|
194
130
|
targets: z.array(TargetSchema).describe(
|
195
131
|
'Array of targets to unlike the post (must be on the same platform as the post being unliked)',
|
@@ -198,86 +134,42 @@ export const UnlikePostRequestSchema = z.object({
|
|
198
134
|
postId: z.string().describe('ID of the post to unlike'),
|
199
135
|
}).describe('Unlike post request');
|
200
136
|
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
/**
|
206
|
-
* Post response schema
|
207
|
-
*/
|
208
|
-
export const PostResponseSchema = EnhancedResponseSchema(
|
209
|
-
z.union([PostSchema, z.array(PostSchema)]),
|
210
|
-
).describe('Post response');
|
137
|
+
export const PostResponseSchema = z.union([PostSchema, z.array(PostSchema)]).describe(
|
138
|
+
'Post response',
|
139
|
+
);
|
211
140
|
|
212
|
-
|
213
|
-
|
214
|
-
*/
|
215
|
-
export const CreatePostResponseLegacySchema = PostResponseSchema.describe(
|
216
|
-
'Create post response (legacy)',
|
141
|
+
export const CreatePostResponseSchema = PostResponseSchema.describe(
|
142
|
+
'Create post response',
|
217
143
|
);
|
218
144
|
|
219
|
-
/**
|
220
|
-
* Repost response schema
|
221
|
-
*/
|
222
145
|
export const RepostResponseSchema = PostResponseSchema.describe('Repost response');
|
223
146
|
|
224
|
-
/**
|
225
|
-
* Quote post response schema
|
226
|
-
*/
|
227
147
|
export const QuotePostResponseSchema = PostResponseSchema.describe('Quote post response');
|
228
148
|
|
229
|
-
/**
|
230
|
-
* Reply to post response schema
|
231
|
-
*/
|
232
149
|
export const ReplyToPostResponseSchema = PostResponseSchema.describe('Reply to post response');
|
233
150
|
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
export const DeletePostResponseSchema = EnhancedResponseSchema(
|
238
|
-
z.object({
|
239
|
-
success: z.boolean().describe('Whether the deletion was successful'),
|
240
|
-
id: z.string().describe('ID of the deleted post'),
|
241
|
-
}),
|
242
|
-
).describe('Delete post response');
|
151
|
+
export const DeletePostResponseSchema = z.object({
|
152
|
+
id: z.string().describe('ID of the deleted post'),
|
153
|
+
}).describe('Delete post response');
|
243
154
|
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
export const LikePostResponseSchema = EnhancedResponseSchema(
|
248
|
-
z.object({
|
249
|
-
success: z.boolean().describe('Whether the like was successful'),
|
250
|
-
id: z.string().describe('ID of the liked post'),
|
251
|
-
}),
|
252
|
-
).describe('Like post response');
|
155
|
+
export const LikePostResponseSchema = z.object({
|
156
|
+
id: z.string().describe('ID of the liked post'),
|
157
|
+
}).describe('Like post response');
|
253
158
|
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
export const UnlikePostResponseSchema = EnhancedResponseSchema(
|
258
|
-
z.object({
|
259
|
-
success: z.boolean().describe('Whether the unlike was successful'),
|
260
|
-
id: z.string().describe('ID of the unliked post'),
|
261
|
-
}),
|
262
|
-
).describe('Unlike post response');
|
159
|
+
export const UnlikePostResponseSchema = z.object({
|
160
|
+
id: z.string().describe('ID of the unliked post'),
|
161
|
+
}).describe('Unlike post response');
|
263
162
|
|
264
|
-
/**
|
265
|
-
* Multi-status response schema for batch operations
|
266
|
-
*/
|
267
163
|
export const PostMultiStatusResponseSchema = z.object({
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
succeeded: z.number().describe('Number of successful operations'),
|
273
|
-
failed: z.number().describe('Number of failed operations'),
|
274
|
-
}),
|
275
|
-
results: z.array(PostSuccessDetailSchema).describe('Successful operations'),
|
276
|
-
errors: z.array(ErrorDetailSchema).describe('Failed operations'),
|
164
|
+
summary: z.object({
|
165
|
+
total: z.number().describe('Total number of operations'),
|
166
|
+
succeeded: z.number().describe('Number of successful operations'),
|
167
|
+
failed: z.number().describe('Number of failed operations'),
|
277
168
|
}),
|
169
|
+
results: z.array(PostSuccessDetailSchema).describe('Successful operations'),
|
170
|
+
errors: z.array(ErrorDetailSchema).describe('Failed operations'),
|
278
171
|
}).describe('Multi-status response for post operations');
|
279
172
|
|
280
|
-
// Derive TypeScript types from Zod schemas
|
281
173
|
export type Media = z.infer<typeof MediaSchema>;
|
282
174
|
export type MediaContent = z.infer<typeof MediaContentSchema>;
|
283
175
|
export type PostMetrics = z.infer<typeof PostMetricsSchema>;
|
@@ -290,7 +182,6 @@ export type PostSuccessDetail = z.infer<typeof PostSuccessDetailSchema>;
|
|
290
182
|
export type Target = z.infer<typeof TargetSchema>;
|
291
183
|
export type PostToDelete = z.infer<typeof PostToDeleteSchema>;
|
292
184
|
|
293
|
-
// Request types
|
294
185
|
export type CreatePostRequest = z.infer<typeof CreatePostRequestSchema>;
|
295
186
|
export type RepostRequest = z.infer<typeof RepostRequestSchema>;
|
296
187
|
export type QuotePostRequest = z.infer<typeof QuotePostRequestSchema>;
|
@@ -299,9 +190,8 @@ export type DeletePostRequest = z.infer<typeof DeletePostRequestSchema>;
|
|
299
190
|
export type LikePostRequest = z.infer<typeof LikePostRequestSchema>;
|
300
191
|
export type UnlikePostRequest = z.infer<typeof UnlikePostRequestSchema>;
|
301
192
|
|
302
|
-
// Response types
|
303
193
|
export type PostResponse = z.infer<typeof PostResponseSchema>;
|
304
|
-
export type CreatePostResponse = z.infer<typeof
|
194
|
+
export type CreatePostResponse = z.infer<typeof CreatePostResponseSchema>;
|
305
195
|
export type RepostResponse = z.infer<typeof RepostResponseSchema>;
|
306
196
|
export type QuotePostResponse = z.infer<typeof QuotePostResponseSchema>;
|
307
197
|
export type ReplyToPostResponse = z.infer<typeof ReplyToPostResponseSchema>;
|
@@ -309,39 +199,3 @@ export type DeletePostResponse = z.infer<typeof DeletePostResponseSchema>;
|
|
309
199
|
export type LikePostResponse = z.infer<typeof LikePostResponseSchema>;
|
310
200
|
export type UnlikePostResponse = z.infer<typeof UnlikePostResponseSchema>;
|
311
201
|
export type PostMultiStatusResponse = z.infer<typeof PostMultiStatusResponseSchema>;
|
312
|
-
|
313
|
-
/**
|
314
|
-
* Create post target result schema
|
315
|
-
*/
|
316
|
-
export const CreatePostTargetResultSchema = z.object({
|
317
|
-
platform: PlatformSchema.describe('The platform the post was created on'),
|
318
|
-
userId: z.string().describe('The user ID on the platform'),
|
319
|
-
result: z.array(z.any()).describe('The result of the post creation'),
|
320
|
-
}).describe('Create post target result');
|
321
|
-
|
322
|
-
/**
|
323
|
-
* Create post target error schema
|
324
|
-
*/
|
325
|
-
export const CreatePostTargetErrorSchema = z.object({
|
326
|
-
platform: PlatformSchema.optional().describe(
|
327
|
-
'The platform where the error occurred (if applicable)',
|
328
|
-
),
|
329
|
-
userId: z.string().optional().describe('The user ID where the error occurred (if applicable)'),
|
330
|
-
error: z.string().describe('The error message'),
|
331
|
-
}).describe('Create post target error');
|
332
|
-
|
333
|
-
/**
|
334
|
-
* Create post response schema
|
335
|
-
*/
|
336
|
-
export const CreatePostResponseSchema = EnhancedResponseSchema(
|
337
|
-
z.object({
|
338
|
-
results: z.array(CreatePostTargetResultSchema).describe('Array of successful post results'),
|
339
|
-
errors: z.array(CreatePostTargetErrorSchema).optional().describe(
|
340
|
-
'Array of errors that occurred (if any)',
|
341
|
-
),
|
342
|
-
}),
|
343
|
-
).describe('Create post response');
|
344
|
-
|
345
|
-
// Additional derived types
|
346
|
-
export type CreatePostTargetResult = z.infer<typeof CreatePostTargetResultSchema>;
|
347
|
-
export type CreatePostTargetError = z.infer<typeof CreatePostTargetErrorSchema>;
|
package/src/rate-limit.ts
CHANGED
@@ -1,25 +1,12 @@
|
|
1
|
-
/**
|
2
|
-
* Rate Limit Schemas and Types
|
3
|
-
* Defines Zod schemas for rate limit-related requests and responses
|
4
|
-
* TypeScript types are derived from Zod schemas for type safety
|
5
|
-
*/
|
6
|
-
|
7
1
|
import { z } from 'zod';
|
8
|
-
import { EnhancedResponseSchema } from './response.ts';
|
9
2
|
import { PlatformSchema } from './common.ts';
|
10
3
|
|
11
|
-
/**
|
12
|
-
* Rate limit endpoint parameter schema
|
13
|
-
*/
|
14
4
|
export const RateLimitEndpointParamSchema = z.object({
|
15
5
|
endpoint: z.string().optional().describe(
|
16
6
|
'Specific endpoint to get rate limit information for (optional)',
|
17
7
|
),
|
18
8
|
}).describe('Rate limit endpoint parameter');
|
19
9
|
|
20
|
-
/**
|
21
|
-
* Rate limit endpoint schema
|
22
|
-
*/
|
23
10
|
export const RateLimitEndpointSchema = z.object({
|
24
11
|
endpoint: z.string().describe('API endpoint'),
|
25
12
|
method: z.enum(['GET', 'POST', 'PUT', 'DELETE']).describe('HTTP method'),
|
@@ -29,9 +16,6 @@ export const RateLimitEndpointSchema = z.object({
|
|
29
16
|
resetDate: z.string().describe('Reset date (ISO string)'),
|
30
17
|
}).describe('Rate limit endpoint');
|
31
18
|
|
32
|
-
/**
|
33
|
-
* Rate limit status schema
|
34
|
-
*/
|
35
19
|
export const RateLimitStatusSchema = z.object({
|
36
20
|
endpoint: z.string().describe('API endpoint or action'),
|
37
21
|
limit: z.number().describe('Maximum number of requests allowed in the time window'),
|
@@ -40,9 +24,6 @@ export const RateLimitStatusSchema = z.object({
|
|
40
24
|
resetSeconds: z.number().describe('Seconds until the rate limit will reset'),
|
41
25
|
}).describe('Rate limit status');
|
42
26
|
|
43
|
-
/**
|
44
|
-
* Platform-specific rate limit schema
|
45
|
-
*/
|
46
27
|
export const PlatformRateLimitSchema = z.object({
|
47
28
|
platform: PlatformSchema,
|
48
29
|
endpoints: z.record(z.string(), RateLimitStatusSchema).describe(
|
@@ -50,9 +31,6 @@ export const PlatformRateLimitSchema = z.object({
|
|
50
31
|
),
|
51
32
|
}).describe('Platform-specific rate limit');
|
52
33
|
|
53
|
-
/**
|
54
|
-
* Usage rate limit schema
|
55
|
-
*/
|
56
34
|
export const UsageRateLimitSchema = z.object({
|
57
35
|
endpoint: z.string().describe('API endpoint or action'),
|
58
36
|
limit: z.number().describe('Maximum number of requests allowed in the time window'),
|
@@ -62,54 +40,41 @@ export const UsageRateLimitSchema = z.object({
|
|
62
40
|
timeWindow: z.string().describe('Time window for the rate limit'),
|
63
41
|
}).describe('Usage rate limit');
|
64
42
|
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
z.object({
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
reset: z.number().describe('Reset timestamp (Unix timestamp in seconds)'),
|
77
|
-
resetDate: z.string().describe('Reset date (ISO string)'),
|
78
|
-
}).optional().describe('App-wide rate limits'),
|
79
|
-
}),
|
80
|
-
).describe('Rate limit status response');
|
43
|
+
export const RateLimitStatusResponseSchema = z.object({
|
44
|
+
platform: PlatformSchema,
|
45
|
+
userId: z.string().optional().describe('User ID'),
|
46
|
+
endpoints: z.array(RateLimitEndpointSchema).describe('Rate limits for specific endpoints'),
|
47
|
+
app: z.object({
|
48
|
+
limit: z.number().describe('App-wide rate limit'),
|
49
|
+
remaining: z.number().describe('Remaining requests'),
|
50
|
+
reset: z.number().describe('Reset timestamp (Unix timestamp in seconds)'),
|
51
|
+
resetDate: z.string().describe('Reset date (ISO string)'),
|
52
|
+
}).optional().describe('App-wide rate limits'),
|
53
|
+
}).describe('Rate limit status response');
|
81
54
|
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
z.
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
).describe('
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
}).optional().describe('App-wide rate limits'),
|
105
|
-
}),
|
106
|
-
).describe('Rate limits by platform'),
|
107
|
-
}),
|
108
|
-
).describe('All rate limits response');
|
55
|
+
export const AllRateLimitsResponseSchema = z.object({
|
56
|
+
platforms: z.record(
|
57
|
+
PlatformSchema,
|
58
|
+
z.object({
|
59
|
+
users: z.record(
|
60
|
+
z.string(),
|
61
|
+
z.object({
|
62
|
+
endpoints: z.array(RateLimitEndpointSchema).describe(
|
63
|
+
'Rate limits for specific endpoints',
|
64
|
+
),
|
65
|
+
lastUpdated: z.string().describe('Last updated date (ISO string)'),
|
66
|
+
}),
|
67
|
+
).describe('User-specific rate limits'),
|
68
|
+
app: z.object({
|
69
|
+
limit: z.number().describe('App-wide rate limit'),
|
70
|
+
remaining: z.number().describe('Remaining requests'),
|
71
|
+
reset: z.number().describe('Reset timestamp (Unix timestamp in seconds)'),
|
72
|
+
resetDate: z.string().describe('Reset date (ISO string)'),
|
73
|
+
}).optional().describe('App-wide rate limits'),
|
74
|
+
}),
|
75
|
+
).describe('Rate limits by platform'),
|
76
|
+
}).describe('All rate limits response');
|
109
77
|
|
110
|
-
/**
|
111
|
-
* Rate limit response schema
|
112
|
-
*/
|
113
78
|
export const RateLimitResponseSchema = z.object({
|
114
79
|
platformLimits: z.array(PlatformRateLimitSchema).describe('Platform-specific rate limits'),
|
115
80
|
usageLimits: z.record(z.string(), UsageRateLimitSchema).describe(
|
@@ -118,9 +83,6 @@ export const RateLimitResponseSchema = z.object({
|
|
118
83
|
signerId: z.string().describe('NEAR account ID'),
|
119
84
|
}).describe('Rate limit response');
|
120
85
|
|
121
|
-
/**
|
122
|
-
* Single endpoint rate limit response schema
|
123
|
-
*/
|
124
86
|
export const EndpointRateLimitResponseSchema = z.object({
|
125
87
|
platformLimits: z.array(
|
126
88
|
z.object({
|
@@ -133,7 +95,6 @@ export const EndpointRateLimitResponseSchema = z.object({
|
|
133
95
|
signerId: z.string().describe('NEAR account ID'),
|
134
96
|
}).describe('Endpoint rate limit response');
|
135
97
|
|
136
|
-
// Derive TypeScript types from Zod schemas
|
137
98
|
export type RateLimitEndpointParam = z.infer<typeof RateLimitEndpointParamSchema>;
|
138
99
|
export type RateLimitEndpoint = z.infer<typeof RateLimitEndpointSchema>;
|
139
100
|
export type RateLimitStatus = z.infer<typeof RateLimitStatusSchema>;
|