Add endpoints
This commit is contained in:
parent
deab5bce91
commit
6365bac891
2 changed files with 15 additions and 2 deletions
|
@ -1,8 +1,18 @@
|
|||
import { Instance, User } from './types';
|
||||
import { ID, Instance, Note, OriginType, User, UserSorting } from './types';
|
||||
|
||||
type TODO = Record<string, any>;
|
||||
|
||||
type ShowUserReq = { username: string; host?: string; } | { userId: ID; };
|
||||
|
||||
export type Endpoints = {
|
||||
'i': { req: TODO; res: User; };
|
||||
'meta': { req: { detail?: boolean; }; res: Instance; };
|
||||
|
||||
'users': { req: { limit?: number; offset?: number; sort?: UserSorting; origin?: OriginType; }; res: User[]; };
|
||||
'users/show': { req: ShowUserReq; res: User; } | { req: { userIds: ID[]; }; res: User[]; };
|
||||
|
||||
'notes': { req: { limit?: number; sinceId?: ID; untilId?: ID; }; res: Note[]; };
|
||||
'notes/create': { req: TODO; res: { createdNote: Note }; };
|
||||
'notes/delete': { req: { noteId: ID; }; res: null; };
|
||||
'notes/show': { req: { noteId: ID; }; res: Note; };
|
||||
};
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
type ID = string;
|
||||
export type ID = string;
|
||||
|
||||
export type User = {
|
||||
id: ID;
|
||||
|
@ -71,3 +71,6 @@ export type Instance = {
|
|||
imageUrl: string;
|
||||
}[];
|
||||
};
|
||||
|
||||
export type UserSorting = '+follower' | '-follower' | '+createdAt' | '-createdAt' | '+updatedAt' | '-updatedAt';
|
||||
export type OriginType = 'combined' | 'local' | 'remote';
|
||||
|
|
Reference in a new issue