diff options
| author | syuilo <Syuilotan@yahoo.co.jp> | 2021-05-31 11:28:17 +0900 |
|---|---|---|
| committer | syuilo <Syuilotan@yahoo.co.jp> | 2021-05-31 11:28:17 +0900 |
| commit | b1934d95f2519cd150ae81d9d6c0efb99ae4e78c (patch) | |
| tree | ad07494e7f8a87a1d9cd1016b1e59e547e169e3c | |
| parent | 0.0.2 (diff) | |
| download | misskey-b1934d95f2519cd150ae81d9d6c0efb99ae4e78c.tar.gz misskey-b1934d95f2519cd150ae81d9d6c0efb99ae4e78c.tar.bz2 misskey-b1934d95f2519cd150ae81d9d6c0efb99ae4e78c.zip | |
Improve type definition
| -rw-r--r-- | src/endpoints.ts | 2 | ||||
| -rw-r--r-- | src/entities.ts | 31 |
2 files changed, 31 insertions, 2 deletions
diff --git a/src/endpoints.ts b/src/endpoints.ts index dbd6212d77..9998fb6225 100644 --- a/src/endpoints.ts +++ b/src/endpoints.ts @@ -257,7 +257,7 @@ export type Endpoints = { 'messaging/messages/read': { req: TODO; res: TODO; }; // meta - 'meta': { req: { detail?: boolean; }; res: InstanceMetadata; }; + 'meta': { req: { detail?: boolean; }; res: InstanceMetadata; }; // TODO: 「detail が true なら DetailedInstanceMetadata を返す」のような型付けをしたい // miauth 'miauth/gen-token': { req: TODO; res: TODO; }; diff --git a/src/entities.ts b/src/entities.ts index ff2762a98f..a8cbb28f53 100644 --- a/src/entities.ts +++ b/src/entities.ts @@ -154,7 +154,30 @@ export type MessagingMessage = { groupId: string; // TODO }; -export type InstanceMetadata = { +export type LiteInstanceMetadata = { + maintainerName: string | null; + maintainerEmail: string | null; + version: string; + name: string | null; + uri: string; + description: string | null; + tosUrl: string | null; + disableRegistration: boolean; + disableLocalTimeline: boolean; + disableGlobalTimeline: boolean; + driveCapacityPerLocalUserMb: number; + driveCapacityPerRemoteUserMb: number; + enableHcaptcha: boolean; + hcaptchaSiteKey: string | null; + enableRecaptcha: boolean; + recaptchaSiteKey: string | null; + swPublickey: string | null; + maxNoteTextLength: number; + enableEmail: boolean; + enableTwitterIntegration: boolean; + enableGithubIntegration: boolean; + enableDiscordIntegration: boolean; + enableServiceWorker: boolean; emojis: { id: string; name: string; @@ -171,6 +194,12 @@ export type InstanceMetadata = { }[]; }; +export type DetailedInstanceMetadata = LiteInstanceMetadata & { + features: Record<string, any>; +}; + +export type InstanceMetadata = LiteInstanceMetadata | DetailedInstanceMetadata; + export type ServerInfo = { machine: string; cpu: { |