mirror of
https://github.com/kokonect-link/cherrypick
synced 2024-12-15 15:18:22 +09:00
Add endpoints (#7)
* Add endpoints * endpoint * endpoint: stats * endpoint * reset-password * server-info * endpoint * announcements * drive * page-push * page endpoint * page id
This commit is contained in:
parent
e43a8bf88a
commit
148730dac3
@ -1,8 +1,105 @@
|
||||
import { Instance, User } from './types';
|
||||
import { ID, Instance, Note, OriginType, Page, ServerInfo, Stats, User, UserSorting } from './types';
|
||||
|
||||
type TODO = Record<string, any>;
|
||||
|
||||
type ShowUserReq = { username: string; host?: string; } | { userId: ID; };
|
||||
|
||||
export type Endpoints = {
|
||||
// admin
|
||||
|
||||
// announcements
|
||||
'announcements': { req: { limit?: number; withUnreads?: boolean; sinceId?: ID; untilId?: ID; }; res: TODO; };
|
||||
|
||||
// antennas
|
||||
'antennas/create': { req: TODO; res: TODO; };
|
||||
|
||||
// ap
|
||||
|
||||
// app
|
||||
|
||||
// auth
|
||||
|
||||
// blocking
|
||||
|
||||
// channnels
|
||||
|
||||
// charts
|
||||
|
||||
// clips
|
||||
|
||||
// drive
|
||||
'drive': { req: null; res: { capacity: number; usage: number; }; };
|
||||
|
||||
// federation
|
||||
|
||||
// following
|
||||
|
||||
// gallery
|
||||
|
||||
// games
|
||||
|
||||
// get-online-users-count
|
||||
|
||||
// hashtags
|
||||
|
||||
// i
|
||||
'i': { req: TODO; res: User; };
|
||||
|
||||
// messaging
|
||||
|
||||
// meta
|
||||
'meta': { req: { detail?: boolean; }; res: Instance; };
|
||||
|
||||
// miauth
|
||||
|
||||
// mute
|
||||
|
||||
// my
|
||||
|
||||
// notes
|
||||
'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; };
|
||||
|
||||
// notifications
|
||||
|
||||
// page-push
|
||||
'page-push': { req: { pageId: ID; event: string; var?: any; }; res: null; };
|
||||
|
||||
// pages
|
||||
'pages/create': { req: TODO; res: Page; };
|
||||
'pages/delete': { req: { pageId: ID; }; res: null; };
|
||||
'pages/featured': { req: null; res: Page[]; };
|
||||
'pages/like': { req: { pageId: ID; }; res: null; };
|
||||
'pages/show': { req: { pageId?: ID; name?: string; username?: string; }; res: Page; };
|
||||
'pages/unlike': { req: { pageId: ID; }; res: null; };
|
||||
'pages/update': { req: TODO; res: null; };
|
||||
|
||||
// ping
|
||||
|
||||
// pinned-users
|
||||
|
||||
// promo
|
||||
|
||||
// request-reset-password
|
||||
|
||||
// reset-password
|
||||
'reset-password': { req: { token: string; password: string; }; res: null; };
|
||||
|
||||
// room
|
||||
|
||||
// stats
|
||||
'stats': { req: null; res: Stats; };
|
||||
|
||||
// server-info
|
||||
'server-info': { req: null; res: ServerInfo; };
|
||||
|
||||
// sw
|
||||
|
||||
// username
|
||||
|
||||
// users
|
||||
'users': { req: { limit?: number; offset?: number; sort?: UserSorting; origin?: OriginType; }; res: User[]; };
|
||||
'users/show': { req: ShowUserReq; res: User; } | { req: { userIds: ID[]; }; res: User[]; };
|
||||
};
|
||||
|
52
src/types.ts
52
src/types.ts
@ -1,4 +1,4 @@
|
||||
type ID = string;
|
||||
export type ID = string;
|
||||
|
||||
export type User = {
|
||||
id: ID;
|
||||
@ -71,3 +71,53 @@ export type Instance = {
|
||||
imageUrl: string;
|
||||
}[];
|
||||
};
|
||||
|
||||
export type ServerInfo = {
|
||||
machine: string;
|
||||
cpu: {
|
||||
model: string;
|
||||
cores: number;
|
||||
};
|
||||
mem: {
|
||||
total: number;
|
||||
};
|
||||
fs: {
|
||||
total: number;
|
||||
used: number;
|
||||
};
|
||||
};
|
||||
|
||||
export type Stats = {
|
||||
notesCount: number;
|
||||
originalNotesCount: number;
|
||||
usersCount: number;
|
||||
originalUsersCount: number;
|
||||
instances: number;
|
||||
driveUsageLocal: number;
|
||||
driveUsageRemote: number;
|
||||
};
|
||||
|
||||
export type Page = {
|
||||
id: ID;
|
||||
createdAt: Date;
|
||||
updatedAt: Date;
|
||||
userId: User['id'];
|
||||
user: User;
|
||||
content: Record<string, any>[];
|
||||
variables: Record<string, any>[];
|
||||
title: string;
|
||||
name: string;
|
||||
summary: string | null;
|
||||
hideTitleWhenPinned: boolean;
|
||||
alignCenter: boolean;
|
||||
font: string;
|
||||
script: string;
|
||||
eyeCatchingImageId: DriveFile['id'] | null;
|
||||
eyeCatchingImage: DriveFile | null;
|
||||
attachedFiles: any;
|
||||
likedCount: number;
|
||||
isLiked?: boolean;
|
||||
};
|
||||
|
||||
export type UserSorting = '+follower' | '-follower' | '+createdAt' | '-createdAt' | '+updatedAt' | '-updatedAt';
|
||||
export type OriginType = 'combined' | 'local' | 'remote';
|
||||
|
Loading…
Reference in New Issue
Block a user