1- import { CommonPluginErrors } from 'every-plugin' ;
21import { oc } from 'every-plugin/orpc' ;
32import { z } from 'every-plugin/zod' ;
43import * as AuthSchemas from './schemas/auth' ;
5- import * as PostSchemas from './schemas/post' ;
64import * as MediaSchemas from './schemas/media' ;
5+ import * as PostSchemas from './schemas/post' ;
76import * as ProfileSchemas from './schemas/profile' ;
87import * as RateLimitSchemas from './schemas/rate-limit' ;
98
@@ -13,115 +12,88 @@ import * as RateLimitSchemas from './schemas/rate-limit';
1312 */
1413export const platformContract = oc . router ( {
1514 // AUTH DOMAIN - OAuth flow operations
16- auth : oc . router ( {
15+ auth : {
1716 getAuthUrl : oc
1817 . route ( { method : 'GET' , path : '/auth/url' } )
1918 . input ( AuthSchemas . GetAuthUrlInputSchema )
20- . output ( z . string ( ) )
21- . errors ( CommonPluginErrors ) ,
22-
19+ . output ( z . string ( ) ) ,
2320 exchangeCodeForToken : oc
2421 . route ( { method : 'POST' , path : '/auth/token' } )
2522 . input ( AuthSchemas . ExchangeCodeInputSchema )
26- . output ( AuthSchemas . AuthTokenSchema )
27- . errors ( CommonPluginErrors ) ,
28-
23+ . output ( AuthSchemas . AuthTokenSchema ) ,
2924 refreshToken : oc
3025 . route ( { method : 'POST' , path : '/auth/refresh' } )
3126 . input ( AuthSchemas . RefreshTokenInputSchema )
32- . output ( AuthSchemas . AuthTokenSchema )
33- . errors ( CommonPluginErrors ) ,
34-
27+ . output ( AuthSchemas . AuthTokenSchema ) ,
3528 revokeToken : oc
3629 . route ( { method : 'DELETE' , path : '/auth/token' } )
3730 . input ( AuthSchemas . RevokeTokenInputSchema )
3831 . output ( z . boolean ( ) )
39- . errors ( CommonPluginErrors ) ,
40- } ) ,
32+ } ,
4133
4234 // POST DOMAIN - Social media post operations
43- post : oc . router ( {
35+ post : {
4436 create : oc
4537 . route ( { method : 'POST' , path : '/post' } )
4638 . input ( PostSchemas . CreatePostInputSchema )
47- . output ( PostSchemas . PostResultSchema )
48- . errors ( CommonPluginErrors ) ,
49-
39+ . output ( PostSchemas . PostResultSchema ) ,
5040 delete : oc
5141 . route ( { method : 'DELETE' , path : '/post/{postId}' } )
5242 . input ( PostSchemas . DeletePostInputSchema )
53- . output ( PostSchemas . DeleteResultSchema )
54- . errors ( CommonPluginErrors ) ,
55-
43+ . output ( PostSchemas . DeleteResultSchema ) ,
5644 repost : oc
5745 . route ( { method : 'POST' , path : '/post/{postId}/repost' } )
5846 . input ( PostSchemas . RepostInputSchema )
59- . output ( PostSchemas . PostResultSchema )
60- . errors ( CommonPluginErrors ) ,
61-
47+ . output ( PostSchemas . PostResultSchema ) ,
6248 quote : oc
6349 . route ( { method : 'POST' , path : '/post/{postId}/quote' } )
6450 . input ( PostSchemas . QuotePostInputSchema )
65- . output ( PostSchemas . PostResultSchema )
66- . errors ( CommonPluginErrors ) ,
67-
51+ . output ( PostSchemas . PostResultSchema ) ,
6852 reply : oc
6953 . route ( { method : 'POST' , path : '/post/{postId}/reply' } )
7054 . input ( PostSchemas . ReplyInputSchema )
71- . output ( PostSchemas . PostResultSchema )
72- . errors ( CommonPluginErrors ) ,
73-
55+ . output ( PostSchemas . PostResultSchema ) ,
7456 like : oc
7557 . route ( { method : 'POST' , path : '/post/{postId}/like' } )
7658 . input ( PostSchemas . LikeInputSchema )
77- . output ( PostSchemas . LikeResultSchema )
78- . errors ( CommonPluginErrors ) ,
79-
59+ . output ( PostSchemas . LikeResultSchema ) ,
8060 unlike : oc
8161 . route ( { method : 'DELETE' , path : '/post/{postId}/like' } )
8262 . input ( PostSchemas . UnlikeInputSchema )
8363 . output ( PostSchemas . LikeResultSchema )
84- . errors ( CommonPluginErrors ) ,
85- } ) ,
64+ } ,
8665
8766 // MEDIA DOMAIN - Media upload and management
88- media : oc . router ( {
67+ media : {
8968 upload : oc
9069 . route ( { method : 'POST' , path : '/media' } )
9170 . input ( MediaSchemas . UploadMediaInputSchema )
92- . output ( MediaSchemas . MediaUploadResultSchema )
93- . errors ( CommonPluginErrors ) ,
94-
71+ . output ( MediaSchemas . MediaUploadResultSchema ) ,
9572 getStatus : oc
9673 . route ( { method : 'GET' , path : '/media/{mediaId}/status' } )
9774 . input ( MediaSchemas . GetMediaStatusInputSchema )
98- . output ( MediaSchemas . MediaStatusResultSchema )
99- . errors ( CommonPluginErrors ) ,
100-
75+ . output ( MediaSchemas . MediaStatusResultSchema ) ,
10176 updateMetadata : oc
10277 . route ( { method : 'PUT' , path : '/media/{mediaId}/metadata' } )
10378 . input ( MediaSchemas . UpdateMediaMetadataInputSchema )
10479 . output ( z . boolean ( ) )
105- . errors ( CommonPluginErrors ) ,
106- } ) ,
80+ } ,
10781
10882 // PROFILE DOMAIN - User profile operations
109- profile : oc . router ( {
83+ profile : {
11084 get : oc
11185 . route ( { method : 'GET' , path : '/profile' } )
11286 . input ( ProfileSchemas . GetProfileInputSchema )
11387 . output ( ProfileSchemas . UserProfileSchema )
114- . errors ( CommonPluginErrors ) ,
115- } ) ,
88+ } ,
11689
11790 // RATE LIMIT DOMAIN - Rate limit checking
118- rateLimit : oc . router ( {
91+ rateLimit : {
11992 check : oc
12093 . route ( { method : 'GET' , path : '/rate-limit' } )
12194 . input ( RateLimitSchemas . CheckRateLimitInputSchema )
12295 . output ( RateLimitSchemas . RateLimitStatusSchema )
123- . errors ( CommonPluginErrors ) ,
124- } ) ,
96+ } ,
12597} ) ;
12698
12799export type PlatformContract = typeof platformContract ;
0 commit comments