Add endpoints #6

Closed
marihachi wants to merge 1 commit from work/add-endpoints-1 into master
2 changed files with 15 additions and 2 deletions

View file

@ -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; };
};

View file

@ -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';