-
-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathpost.ts
70 lines (69 loc) · 3.21 KB
/
post.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
import type { MoveMessageBetween } from '@boluo/server-bindings/MoveMessageBetween';
import { type PreSign } from '@boluo/server-bindings/PreSign';
import { type PreSignResult } from '@boluo/server-bindings/PreSignResult';
import type { Empty } from '@boluo/utils';
import type {
AddChannelMember,
Channel,
ChannelMember,
ChannelWithMember,
CreateChannel,
EditChannel,
EditChannelMember,
GrantOrRemoveChannelMaster,
JoinChannel,
KickFromChannel,
} from './types/channels';
import type { Message, NewMessage } from './types/messages';
import type {
CreateSpace,
EditSpace,
KickFromSpace,
Space,
SpaceMemberWithUser,
SpaceWithMember,
} from './types/spaces';
import type {
EditUser,
LoginData,
LoginReturn,
RegisterData,
ResetPassword,
ResetPasswordConfirm,
User,
} from './types/users';
export interface Post {
// users
'/users/login': { payload: LoginData; query: null; result: LoginReturn };
'/users/register': { payload: RegisterData; query: null; result: User };
'/users/edit': { payload: Partial<EditUser>; query: null; result: User };
'/users/remove_avatar': { payload: null; query: null; result: User };
'/users/reset_password': { payload: ResetPassword; query: null; result: null };
'/users/reset_password_confirm': { payload: ResetPasswordConfirm; query: null; result: null };
// spaces
'/spaces/create': { payload: CreateSpace; query: null; result: SpaceWithMember };
'/spaces/edit': { payload: EditSpace; query: null; result: Space };
'/spaces/delete': { payload: Empty; query: { id: string }; result: Space };
'/spaces/refresh_token': { payload: Empty; query: { id: string }; result: string };
'/spaces/join': { payload: Empty; result: SpaceWithMember; query: { spaceId: string; token?: string } };
'/spaces/leave': { payload: Empty; query: { id: string }; result: true };
'/spaces/kick': { payload: Empty; query: KickFromSpace; result: Record<string, SpaceMemberWithUser> };
'/spaces/update_settings': { payload: unknown; query: { id: string }; result: unknown };
// messages
'/messages/send': { payload: NewMessage; query: null; result: Message };
'/messages/move_between': { payload: MoveMessageBetween; query: null; result: Message };
'/messages/delete': { payload: Empty; query: { id: string }; result: Message };
'/messages/toggle_fold': { payload: Empty; query: { id: string }; result: Message };
// channels
'/channels/create': { payload: CreateChannel; query: null; result: ChannelWithMember };
'/channels/join': { payload: JoinChannel; query: null; result: ChannelWithMember };
'/channels/leave': { payload: Empty; query: { id: string }; result: true };
'/channels/kick': { payload: Empty; query: KickFromChannel; result: true };
'/channels/edit': { payload: EditChannel; query: null; result: Channel };
'/channels/delete': { payload: Empty; query: { id: string }; result: Channel };
'/channels/edit_member': { payload: EditChannelMember; query: null; result: ChannelMember };
'/channels/add_member': { payload: AddChannelMember; query: null; result: ChannelWithMember };
'/channels/edit_master': { payload: GrantOrRemoveChannelMaster; query: null; result: true };
// meida
'/media/presigned': { query: PreSign; payload: Empty; result: PreSignResult };
}