Skip to content
This repository has been archived by the owner on Jul 15, 2024. It is now read-only.

enhance: add more types to fix packages/sw type errors #56

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 41 additions & 12 deletions etc/misskey-js.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -1860,6 +1860,8 @@ export type Endpoints = {
'notifications/read': {
req: {
notificationId: Notification_2['id'];
} | {
notificationIds: Notification_2['id'][];
};
res: null;
};
Expand Down Expand Up @@ -2174,6 +2176,7 @@ declare namespace entities {
Notification_2 as Notification,
MessagingMessage,
CustomEmoji,
Policies,
LiteInstanceMetadata,
DetailedInstanceMetadata,
InstanceMetadata,
Expand Down Expand Up @@ -2247,17 +2250,17 @@ type FollowRequest = {
// @public (undocumented)
type GalleryPost = {
id: ID;
createdAt: DateString;
updatedAt: DateString;
userId: User['id'];
user: User;
title: string;
description: string | null;
fileIds: DriveFile['id'][];
files: DriveFile[];
isSensitive: boolean;
likedCount: number;
isLiked?: boolean;
createdAt: DateString;
updatedAt: DateString;
userId: User['id'];
user: User;
title: string;
description: string | null;
fileIds: DriveFile['id'][];
files: DriveFile[];
isSensitive: boolean;
likedCount: number;
isLiked?: boolean;
};

// @public (undocumented)
Expand Down Expand Up @@ -2348,6 +2351,7 @@ type LiteInstanceMetadata = {
imageUrl: string;
}[];
translatorAvailable: boolean;
policies: Policies;
};

// @public (undocumented)
Expand Down Expand Up @@ -2493,6 +2497,11 @@ type Notification_2 = {
user: User;
userId: User['id'];
note: Note;
} | {
type: 'pollEnded';
user: User;
userId: User['id'];
note: Note;
} | {
type: 'follow';
user: User;
Expand Down Expand Up @@ -2558,6 +2567,26 @@ type PageEvent = {
// @public (undocumented)
export const permissions: string[];

// @public (undocumented)
type Policies = {
gtlAvailable: boolean;
ltlAvailable: boolean;
canPublicNote: boolean;
canInvite: boolean;
canManageCustomEmojis: boolean;
canHideAds: boolean;
driveCapacityMb: number;
pinLimit: number;
antennaLimit: number;
wordMuteLimit: number;
webhookLimit: number;
clipLimit: number;
noteEachClipsLimit: number;
userListLimit: number;
userEachUserListsLimit: number;
rateLimitFactor: number;
};

// @public (undocumented)
type ServerInfo = {
machine: string;
Expand Down Expand Up @@ -2714,7 +2743,7 @@ type UserSorting = '+follower' | '-follower' | '+createdAt' | '-createdAt' | '+u
//
// src/api.types.ts:16:32 - (ae-forgotten-export) The symbol "TODO" needs to be exported by the entry point index.d.ts
// src/api.types.ts:18:25 - (ae-forgotten-export) The symbol "NoParams" needs to be exported by the entry point index.d.ts
// src/api.types.ts:595:18 - (ae-forgotten-export) The symbol "ShowUserReq" needs to be exported by the entry point index.d.ts
// src/api.types.ts:598:18 - (ae-forgotten-export) The symbol "ShowUserReq" needs to be exported by the entry point index.d.ts
// src/streaming.types.ts:35:4 - (ae-forgotten-export) The symbol "FIXME" needs to be exported by the entry point index.d.ts

// (No @packageDocumentation comment for this package)
Expand Down
5 changes: 4 additions & 1 deletion src/api.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,10 @@ export type Endpoints = {
// notifications
'notifications/create': { req: { body: string; header?: string | null; icon?: string | null; }; res: null; };
'notifications/mark-all-as-read': { req: NoParams; res: null; };
'notifications/read': { req: { notificationId: Notification['id']; }; res: null; };
'notifications/read': {
req: { notificationId: Notification['id']; } | { notificationIds: Notification['id'][]; };
res: null;
};

// page-push
'page-push': { req: { pageId: Page['id']; event: string; var?: any; }; res: null; };
Expand Down
25 changes: 25 additions & 0 deletions src/entities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,11 @@ export type Notification = {
user: User;
userId: User['id'];
note: Note;
} | {
type: 'pollEnded';
user: User;
userId: User['id'];
note: Note;
} | {
type: 'follow';
user: User;
Expand Down Expand Up @@ -266,6 +271,25 @@ export type CustomEmoji = {
aliases: string[];
};

export type Policies = {
gtlAvailable: boolean;
ltlAvailable: boolean;
canPublicNote: boolean;
canInvite: boolean;
canManageCustomEmojis: boolean;
canHideAds: boolean;
driveCapacityMb: number;
pinLimit: number;
antennaLimit: number;
wordMuteLimit: number;
webhookLimit: number;
clipLimit: number;
noteEachClipsLimit: number;
userListLimit: number;
userEachUserListsLimit: number;
rateLimitFactor: number;
};

export type LiteInstanceMetadata = {
maintainerName: string | null;
maintainerEmail: string | null;
Expand Down Expand Up @@ -314,6 +338,7 @@ export type LiteInstanceMetadata = {
imageUrl: string;
}[];
translatorAvailable: boolean;
policies: Policies;
};

export type DetailedInstanceMetadata = LiteInstanceMetadata & {
Expand Down