diff options
Diffstat (limited to 'packages/misskey-js/src')
| -rw-r--r-- | packages/misskey-js/src/acct.ts | 2 | ||||
| -rw-r--r-- | packages/misskey-js/src/api.types.ts | 37 | ||||
| -rw-r--r-- | packages/misskey-js/src/entities.ts | 30 | ||||
| -rw-r--r-- | packages/misskey-js/src/streaming.ts | 2 |
4 files changed, 67 insertions, 4 deletions
diff --git a/packages/misskey-js/src/acct.ts b/packages/misskey-js/src/acct.ts index c32cee86c9..b25bc564ea 100644 --- a/packages/misskey-js/src/acct.ts +++ b/packages/misskey-js/src/acct.ts @@ -4,7 +4,7 @@ export type Acct = { }; export function parse(acct: string): Acct { - if (acct.startsWith('@')) acct = acct.substr(1); + if (acct.startsWith('@')) acct = acct.substring(1); const split = acct.split('@', 2); return { username: split[0], host: split[1] || null }; } diff --git a/packages/misskey-js/src/api.types.ts b/packages/misskey-js/src/api.types.ts index b8c59e7b15..343977f4be 100644 --- a/packages/misskey-js/src/api.types.ts +++ b/packages/misskey-js/src/api.types.ts @@ -2,7 +2,7 @@ import type { Ad, Announcement, Antenna, App, AuthSession, Blocking, Channel, Clip, DateString, DetailedInstanceMetadata, DriveFile, DriveFolder, Following, FollowingFolloweePopulated, FollowingFollowerPopulated, FollowRequest, GalleryPost, Instance, LiteInstanceMetadata, MeDetailed, - Note, NoteFavorite, OriginType, Page, ServerInfo, Stats, User, UserDetailed, UserGroup, UserList, UserSorting, Notification, NoteReaction, Signin, MessagingMessage, + Note, NoteFavorite, OriginType, Page, ServerInfo, Stats, User, UserDetailed, MeSignup, UserGroup, UserList, UserSorting, Notification, NoteReaction, Signin, MessagingMessage, Invite, InviteLimit, } from './entities.js'; type TODO = Record<string, any> | null; @@ -20,6 +20,7 @@ export type Endpoints = { 'admin/get-table-stats': { req: TODO; res: TODO; }; 'admin/invite': { req: TODO; res: TODO; }; 'admin/logs': { req: TODO; res: TODO; }; + 'admin/meta': { req: TODO; res: TODO; }; 'admin/reset-password': { req: TODO; res: TODO; }; 'admin/resolve-abuse-user-report': { req: TODO; res: TODO; }; 'admin/resync-chart': { req: TODO; res: TODO; }; @@ -57,6 +58,8 @@ export type Endpoints = { 'admin/federation/refresh-remote-instance-metadata': { req: TODO; res: TODO; }; 'admin/federation/remove-all-following': { req: TODO; res: TODO; }; 'admin/federation/update-instance': { req: TODO; res: TODO; }; + 'admin/invite/create': { req: TODO; res: TODO; }; + 'admin/invite/list': { req: TODO; res: TODO; }; 'admin/moderators/add': { req: TODO; res: TODO; }; 'admin/moderators/remove': { req: TODO; res: TODO; }; 'admin/promo/create': { req: TODO; res: TODO; }; @@ -262,7 +265,16 @@ export type Endpoints = { '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/create': { + req: { + folderId?: string, + name?: string, + comment?: string, + isSentisive?: boolean, + force?: boolean, + }; + res: DriveFile; + }; 'drive/files/delete': { req: { fileId: DriveFile['id']; }; res: null; }; 'drive/files/find-by-hash': { req: TODO; res: TODO; }; 'drive/files/find': { req: { name: string; folderId?: DriveFolder['id'] | null; }; res: DriveFile[]; }; @@ -431,6 +443,12 @@ export type Endpoints = { 'i/2fa/remove-key': { req: TODO; res: TODO; }; 'i/2fa/unregister': { req: TODO; res: TODO; }; + // invite + 'invite/create': { req: NoParams; res: Invite; }; + 'invite/delete': { req: { inviteId: Invite['id']; }; res: null; }; + 'invite/list': { req: { limit?: number; sinceId?: Invite['id']; untilId?: Invite['id'] }; res: Invite[]; }; + 'invite/limit': { req: NoParams; res: InviteLimit; }; + // messaging 'messaging/history': { req: { limit?: number; group?: boolean; }; res: MessagingMessage[]; }; 'messaging/messages': { req: { userId?: User['id']; groupId?: UserGroup['id']; limit?: number; sinceId?: MessagingMessage['id']; untilId?: MessagingMessage['id']; markAsRead?: boolean; }; res: MessagingMessage[]; }; @@ -549,6 +567,21 @@ export type Endpoints = { 'room/show': { req: TODO; res: TODO; }; 'room/update': { req: TODO; res: TODO; }; + // signup + 'signup': { + req: { + username: string; + password: string; + host?: string; + invitationCode?: string; + emailAddress?: string; + 'hcaptcha-response'?: string; + 'g-recaptcha-response'?: string; + 'turnstile-response'?: string; + }; + res: MeSignup | null; + }; + // stats 'stats': { req: NoParams; res: Stats; }; diff --git a/packages/misskey-js/src/entities.ts b/packages/misskey-js/src/entities.ts index 383b17f0b9..ea85bedf63 100644 --- a/packages/misskey-js/src/entities.ts +++ b/packages/misskey-js/src/entities.ts @@ -107,6 +107,20 @@ export type MeDetailed = UserDetailed & { [other: string]: any; }; +export type MeDetailedWithSecret = MeDetailed & { + email: string; + emailVerified: boolean; + securityKeysList: { + id: string; + name: string; + lastUsed: string; + }[]; +}; + +export type MeSignup = MeDetailedWithSecret & { + token: string; +}; + export type DriveFile = { id: ID; createdAt: DateString; @@ -324,6 +338,7 @@ export type DetailedInstanceMetadata = LiteInstanceMetadata & { pinnedPages: string[]; pinnedClipId: string | null; cacheRemoteFiles: boolean; + cacheRemoteSensitiveFiles: boolean; requireSetup: boolean; proxyAccountName: string | null; features: Record<string, any>; @@ -502,6 +517,21 @@ export type Signin = { success: boolean; }; +export type Invite = { + id: ID; + code: string; + expiresAt: DateString | null; + createdAt: DateString; + createdBy: UserLite | null; + usedBy: UserLite | null; + usedAt: DateString | null; + used: boolean; +} + +export type InviteLimit = { + remaining: number; +} + export type UserSorting = | '+follower' | '-follower' diff --git a/packages/misskey-js/src/streaming.ts b/packages/misskey-js/src/streaming.ts index 92a220b496..c641706a4b 100644 --- a/packages/misskey-js/src/streaming.ts +++ b/packages/misskey-js/src/streaming.ts @@ -218,7 +218,7 @@ class Pool { this.dec = this.dec.bind(this); this.connect = this.connect.bind(this); this.disconnect = this.disconnect.bind(this); - + this.channel = channel; this.stream = stream; this.id = id; |