From 2a84e5034e51c13134f361696bded71dbc9ffa94 Mon Sep 17 00:00:00 2001 From: syuilo Date: Thu, 24 Jun 2021 02:28:44 +0900 Subject: [PATCH] Update type definitions --- src/api.types.ts | 34 +++++++++++++++++++++++++--------- src/entities.ts | 29 +++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+), 9 deletions(-) diff --git a/src/api.types.ts b/src/api.types.ts index 4b9907592..e3e613157 100644 --- a/src/api.types.ts +++ b/src/api.types.ts @@ -1,5 +1,5 @@ import { - Ad, Announcement, Antenna, App, AuthSession, Channel, Clip, DateString, DetailedInstanceMetadata, DriveFile, DriveFolder, Following, FollowingFolloweePopulated, FollowingFollowerPopulated, FollowRequest, GalleryPost, InstanceMetadata, + Ad, Announcement, Antenna, App, AuthSession, Channel, Clip, DateString, DetailedInstanceMetadata, DriveFile, DriveFolder, Following, FollowingFolloweePopulated, FollowingFollowerPopulated, FollowRequest, GalleryPost, Instance, InstanceMetadata, LiteInstanceMetadata, MeDetailed, Note, NoteFavorite, OriginType, Page, ServerInfo, Stats, User, UserDetailed, UserGroup, UserList, UserSorting @@ -251,17 +251,17 @@ export type Endpoints = { // drive 'drive': { req: {}; res: { capacity: number; usage: number; }; }; - 'drive/files': { req: TODO; res: TODO; }; + 'drive/files': { req: { folderId?: DriveFolder['id'] | null; type?: DriveFile['type'] | null; limit?: number; sinceId?: DriveFile['id']; untilId?: DriveFile['id']; }; res: DriveFile[]; }; 'drive/files/attached-notes': { req: TODO; res: TODO; }; 'drive/files/check-existence': { req: TODO; res: TODO; }; 'drive/files/create': { req: TODO; res: TODO; }; 'drive/files/delete': { req: { fileId: DriveFile['id']; }; res: null; }; 'drive/files/find-by-hash': { req: TODO; res: TODO; }; 'drive/files/find': { req: TODO; res: TODO; }; - 'drive/files/show': { req: TODO; res: TODO; }; + 'drive/files/show': { req: { fileId?: DriveFile['id']; url?: string; }; res: DriveFile; }; 'drive/files/update': { req: TODO; res: TODO; }; 'drive/files/upload-from-url': { req: TODO; res: TODO; }; - 'drive/folders': { req: TODO; res: TODO; }; + 'drive/folders': { req: { folderId?: DriveFolder['id'] | null; limit?: number; sinceId?: DriveFile['id']; untilId?: DriveFile['id']; }; res: DriveFolder[]; }; 'drive/folders/create': { req: TODO; res: TODO; }; 'drive/folders/delete': { req: { folderId: DriveFolder['id']; }; res: null; }; 'drive/folders/find': { req: TODO; res: TODO; }; @@ -276,13 +276,29 @@ export type Endpoints = { 'endpoints': { req: {}; res: string[]; }; // federation - 'federation/dns': { req: TODO; res: TODO; }; + 'federation/dns': { req: { host: string; }; res: { + a: string[]; + aaaa: string[]; + cname: string[]; + txt: string[]; + }; }; 'federation/followers': { req: { host: string; limit?: number; sinceId?: Following['id']; untilId?: Following['id']; }; res: FollowingFolloweePopulated[]; }; 'federation/following': { req: { host: string; limit?: number; sinceId?: Following['id']; untilId?: Following['id']; }; res: FollowingFolloweePopulated[]; }; - 'federation/instances': { req: TODO; res: TODO; }; - 'federation/show-instance': { req: TODO; res: TODO; }; - 'federation/update-remote-user': { req: TODO; res: TODO; }; - 'federation/users': { req: TODO; res: TODO; }; + 'federation/instances': { req: { + host?: string | null; + blocked?: boolean | null; + notResponding?: boolean | null; + suspended?: boolean | null; + federating?: boolean | null; + subscribing?: boolean | null; + publishing?: boolean | null; + limit?: number; + offset?: number; + sort?: '+pubSub' | '-pubSub' | '+notes' | '-notes' | '+users' | '-users' | '+following' | '-following' | '+followers' | '-followers' | '+caughtAt' | '-caughtAt' | '+lastCommunicatedAt' | '-lastCommunicatedAt' | '+driveUsage' | '-driveUsage' | '+driveFiles' | '-driveFiles'; + }; res: Instance[]; }; + 'federation/show-instance': { req: { host: string; }; res: Instance; }; + 'federation/update-remote-user': { req: { userId: User['id']; }; res: null; }; + 'federation/users': { req: { host: string; limit?: number; sinceId?: User['id']; untilId?: User['id']; }; res: UserDetailed[]; }; // following 'following/create': { req: { userId: User['id'] }; res: User; }; diff --git a/src/entities.ts b/src/entities.ts index ffc0adbbf..68740d34c 100644 --- a/src/entities.ts +++ b/src/entities.ts @@ -338,5 +338,34 @@ export type FollowingFollowerPopulated = Following & { follower: UserDetailed; }; +export type Instance = { + id: ID; + caughtAt: DateString; + host: string; + usersCount: number; + notesCount: number; + followingCount: number; + followersCount: number; + driveUsage: number; + driveFiles: number; + latestRequestSentAt: DateString | null; + latestStatus: number | null; + latestRequestReceivedAt: DateString | null; + lastCommunicatedAt: DateString; + isNotResponding: boolean; + isSuspended: boolean; + softwareName: string | null; + softwareVersion: string | null; + openRegistrations: boolean | null; + name: string | null; + description: string | null; + maintainerName: string | null; + maintainerEmail: string | null; + iconUrl: string | null; + faviconUrl: string | null; + themeColor: string | null; + infoUpdatedAt: DateString | null; +}; + export type UserSorting = '+follower' | '-follower' | '+createdAt' | '-createdAt' | '+updatedAt' | '-updatedAt'; export type OriginType = 'combined' | 'local' | 'remote';