Merge remote-tracking branch 'misskey/master' into feature/2024.9.0
This commit is contained in:
@@ -56,6 +56,10 @@ export class APIClient {
|
||||
return obj !== null && typeof obj === 'object' && !Array.isArray(obj);
|
||||
}
|
||||
|
||||
private assertSpecialEpReqType(ep: keyof Endpoints): ep is keyof typeof endpointReqTypes {
|
||||
return ep in endpointReqTypes;
|
||||
}
|
||||
|
||||
public request<E extends keyof Endpoints, P extends Endpoints[E]['req']>(
|
||||
endpoint: E,
|
||||
params: P = {} as P,
|
||||
@@ -63,9 +67,12 @@ export class APIClient {
|
||||
): Promise<SwitchCaseResponseType<E, P>> {
|
||||
return new Promise((resolve, reject) => {
|
||||
let mediaType = 'application/json';
|
||||
if (endpoint in endpointReqTypes) {
|
||||
// (autogenがバグったときのため、念の為nullチェックも行う)
|
||||
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
||||
if (this.assertSpecialEpReqType(endpoint) && endpointReqTypes[endpoint] != null) {
|
||||
mediaType = endpointReqTypes[endpoint];
|
||||
}
|
||||
|
||||
let payload: FormData | string = '{}';
|
||||
|
||||
if (mediaType === 'application/json') {
|
||||
@@ -100,7 +107,7 @@ export class APIClient {
|
||||
method: 'POST',
|
||||
body: payload,
|
||||
headers: {
|
||||
'Content-Type': endpointReqTypes[endpoint],
|
||||
'Content-Type': mediaType,
|
||||
},
|
||||
credentials: 'omit',
|
||||
cache: 'no-cache',
|
||||
|
||||
@@ -5,6 +5,8 @@ import {
|
||||
PartialRolePolicyOverride,
|
||||
SigninRequest,
|
||||
SigninResponse,
|
||||
SigninWithPasskeyRequest,
|
||||
SigninWithPasskeyResponse,
|
||||
SignupPendingRequest,
|
||||
SignupPendingResponse,
|
||||
SignupRequest,
|
||||
@@ -82,6 +84,10 @@ export type Endpoints = Overwrite<
|
||||
req: SigninRequest;
|
||||
res: SigninResponse;
|
||||
},
|
||||
'signin-with-passkey': {
|
||||
req: SigninWithPasskeyRequest;
|
||||
res: SigninWithPasskeyResponse;
|
||||
}
|
||||
'admin/roles/create': {
|
||||
req: Overwrite<AdminRolesCreateRequest, { policies: PartialRolePolicyOverride }>;
|
||||
res: AdminRolesCreateResponse;
|
||||
|
||||
@@ -1015,6 +1015,18 @@ declare module '../api.js' {
|
||||
credential?: string | null,
|
||||
): Promise<SwitchCaseResponseType<E, P>>;
|
||||
|
||||
/**
|
||||
* No description provided.
|
||||
*
|
||||
* **Internal Endpoint**: This endpoint is an API for the misskey mainframe and is not intended for use by third parties.
|
||||
* **Credential required**: *Yes* / **Permission**: *read:admin:system-webhook*
|
||||
*/
|
||||
request<E extends 'admin/system-webhook/test', P extends Endpoints[E]['req']>(
|
||||
endpoint: E,
|
||||
params: P,
|
||||
credential?: string | null,
|
||||
): Promise<SwitchCaseResponseType<E, P>>;
|
||||
|
||||
/**
|
||||
* No description provided.
|
||||
*
|
||||
@@ -2909,6 +2921,18 @@ declare module '../api.js' {
|
||||
credential?: string | null,
|
||||
): Promise<SwitchCaseResponseType<E, P>>;
|
||||
|
||||
/**
|
||||
* No description provided.
|
||||
*
|
||||
* **Internal Endpoint**: This endpoint is an API for the misskey mainframe and is not intended for use by third parties.
|
||||
* **Credential required**: *Yes* / **Permission**: *read:account*
|
||||
*/
|
||||
request<E extends 'i/webhooks/test', P extends Endpoints[E]['req']>(
|
||||
endpoint: E,
|
||||
params: P,
|
||||
credential?: string | null,
|
||||
): Promise<SwitchCaseResponseType<E, P>>;
|
||||
|
||||
/**
|
||||
* No description provided.
|
||||
*
|
||||
|
||||
@@ -122,6 +122,7 @@ import type {
|
||||
AdminSystemWebhookShowResponse,
|
||||
AdminSystemWebhookUpdateRequest,
|
||||
AdminSystemWebhookUpdateResponse,
|
||||
AdminSystemWebhookTestRequest,
|
||||
AnnouncementsRequest,
|
||||
AnnouncementsResponse,
|
||||
AnnouncementsShowRequest,
|
||||
@@ -383,6 +384,7 @@ import type {
|
||||
IWebhooksShowResponse,
|
||||
IWebhooksUpdateRequest,
|
||||
IWebhooksDeleteRequest,
|
||||
IWebhooksTestRequest,
|
||||
InviteCreateResponse,
|
||||
InviteDeleteRequest,
|
||||
InviteListRequest,
|
||||
@@ -682,6 +684,7 @@ export type Endpoints = {
|
||||
'admin/system-webhook/list': { req: AdminSystemWebhookListRequest; res: AdminSystemWebhookListResponse };
|
||||
'admin/system-webhook/show': { req: AdminSystemWebhookShowRequest; res: AdminSystemWebhookShowResponse };
|
||||
'admin/system-webhook/update': { req: AdminSystemWebhookUpdateRequest; res: AdminSystemWebhookUpdateResponse };
|
||||
'admin/system-webhook/test': { req: AdminSystemWebhookTestRequest; res: EmptyResponse };
|
||||
'announcements': { req: AnnouncementsRequest; res: AnnouncementsResponse };
|
||||
'announcements/show': { req: AnnouncementsShowRequest; res: AnnouncementsShowResponse };
|
||||
'antennas/create': { req: AntennasCreateRequest; res: AntennasCreateResponse };
|
||||
@@ -851,6 +854,7 @@ export type Endpoints = {
|
||||
'i/webhooks/show': { req: IWebhooksShowRequest; res: IWebhooksShowResponse };
|
||||
'i/webhooks/update': { req: IWebhooksUpdateRequest; res: EmptyResponse };
|
||||
'i/webhooks/delete': { req: IWebhooksDeleteRequest; res: EmptyResponse };
|
||||
'i/webhooks/test': { req: IWebhooksTestRequest; res: EmptyResponse };
|
||||
'invite/create': { req: EmptyRequest; res: InviteCreateResponse };
|
||||
'invite/delete': { req: InviteDeleteRequest; res: EmptyResponse };
|
||||
'invite/list': { req: InviteListRequest; res: InviteListResponse };
|
||||
@@ -986,398 +990,9 @@ export type Endpoints = {
|
||||
'reversi/verify': { req: ReversiVerifyRequest; res: ReversiVerifyResponse };
|
||||
}
|
||||
|
||||
export const endpointReqTypes: Record<keyof Endpoints, 'application/json' | 'multipart/form-data'> = {
|
||||
'admin/meta': 'application/json',
|
||||
'admin/abuse-user-reports': 'application/json',
|
||||
'admin/abuse-report/notification-recipient/list': 'application/json',
|
||||
'admin/abuse-report/notification-recipient/show': 'application/json',
|
||||
'admin/abuse-report/notification-recipient/create': 'application/json',
|
||||
'admin/abuse-report/notification-recipient/update': 'application/json',
|
||||
'admin/abuse-report/notification-recipient/delete': 'application/json',
|
||||
'admin/accounts/create': 'application/json',
|
||||
'admin/accounts/delete': 'application/json',
|
||||
'admin/accounts/find-by-email': 'application/json',
|
||||
'admin/ad/create': 'application/json',
|
||||
'admin/ad/delete': 'application/json',
|
||||
'admin/ad/list': 'application/json',
|
||||
'admin/ad/update': 'application/json',
|
||||
'admin/announcements/create': 'application/json',
|
||||
'admin/announcements/delete': 'application/json',
|
||||
'admin/announcements/list': 'application/json',
|
||||
'admin/announcements/update': 'application/json',
|
||||
'admin/avatar-decorations/create': 'application/json',
|
||||
'admin/avatar-decorations/delete': 'application/json',
|
||||
'admin/avatar-decorations/list': 'application/json',
|
||||
'admin/avatar-decorations/update': 'application/json',
|
||||
'admin/delete-all-files-of-a-user': 'application/json',
|
||||
'admin/unset-user-avatar': 'application/json',
|
||||
'admin/unset-user-banner': 'application/json',
|
||||
'admin/drive/clean-remote-files': 'application/json',
|
||||
'admin/drive/cleanup': 'application/json',
|
||||
'admin/drive/files': 'application/json',
|
||||
'admin/drive/show-file': 'application/json',
|
||||
'admin/emoji/add-aliases-bulk': 'application/json',
|
||||
'admin/emoji/add': 'application/json',
|
||||
'admin/emoji/copy': 'application/json',
|
||||
'admin/emoji/delete-bulk': 'application/json',
|
||||
'admin/emoji/delete': 'application/json',
|
||||
'admin/emoji/import-zip': 'application/json',
|
||||
'admin/emoji/list-remote': 'application/json',
|
||||
'admin/emoji/list': 'application/json',
|
||||
'admin/emoji/remove-aliases-bulk': 'application/json',
|
||||
'admin/emoji/set-aliases-bulk': 'application/json',
|
||||
'admin/emoji/set-category-bulk': 'application/json',
|
||||
'admin/emoji/set-license-bulk': 'application/json',
|
||||
'admin/emoji/update': 'application/json',
|
||||
'admin/federation/delete-all-files': 'application/json',
|
||||
'admin/federation/refresh-remote-instance-metadata': 'application/json',
|
||||
'admin/federation/remove-all-following': 'application/json',
|
||||
'admin/federation/update-instance': 'application/json',
|
||||
'admin/get-index-stats': 'application/json',
|
||||
'admin/get-table-stats': 'application/json',
|
||||
'admin/get-user-ips': 'application/json',
|
||||
'admin/invite/create': 'application/json',
|
||||
'admin/invite/list': 'application/json',
|
||||
'admin/promo/create': 'application/json',
|
||||
'admin/queue/clear': 'application/json',
|
||||
'admin/queue/deliver-delayed': 'application/json',
|
||||
'admin/queue/inbox-delayed': 'application/json',
|
||||
'admin/queue/promote': 'application/json',
|
||||
'admin/queue/stats': 'application/json',
|
||||
'admin/relays/add': 'application/json',
|
||||
'admin/relays/list': 'application/json',
|
||||
'admin/relays/remove': 'application/json',
|
||||
'admin/reset-password': 'application/json',
|
||||
'admin/resolve-abuse-user-report': 'application/json',
|
||||
'admin/send-email': 'application/json',
|
||||
'admin/server-info': 'application/json',
|
||||
'admin/show-moderation-logs': 'application/json',
|
||||
'admin/show-user': 'application/json',
|
||||
'admin/show-users': 'application/json',
|
||||
'admin/nsfw-user': 'application/json',
|
||||
'admin/unnsfw-user': 'application/json',
|
||||
'admin/silence-user': 'application/json',
|
||||
'admin/unsilence-user': 'application/json',
|
||||
'admin/suspend-user': 'application/json',
|
||||
'admin/approve-user': 'application/json',
|
||||
'admin/unsuspend-user': 'application/json',
|
||||
'admin/update-meta': 'application/json',
|
||||
'admin/delete-account': 'application/json',
|
||||
'admin/update-user-note': 'application/json',
|
||||
'admin/roles/create': 'application/json',
|
||||
'admin/roles/delete': 'application/json',
|
||||
'admin/roles/list': 'application/json',
|
||||
'admin/roles/show': 'application/json',
|
||||
'admin/roles/update': 'application/json',
|
||||
'admin/roles/assign': 'application/json',
|
||||
'admin/roles/unassign': 'application/json',
|
||||
'admin/roles/update-default-policies': 'application/json',
|
||||
'admin/roles/users': 'application/json',
|
||||
'admin/system-webhook/create': 'application/json',
|
||||
'admin/system-webhook/delete': 'application/json',
|
||||
'admin/system-webhook/list': 'application/json',
|
||||
'admin/system-webhook/show': 'application/json',
|
||||
'admin/system-webhook/update': 'application/json',
|
||||
'announcements': 'application/json',
|
||||
'announcements/show': 'application/json',
|
||||
'antennas/create': 'application/json',
|
||||
'antennas/delete': 'application/json',
|
||||
'antennas/list': 'application/json',
|
||||
'antennas/notes': 'application/json',
|
||||
'antennas/show': 'application/json',
|
||||
'antennas/update': 'application/json',
|
||||
'ap/get': 'application/json',
|
||||
'ap/show': 'application/json',
|
||||
'app/create': 'application/json',
|
||||
'app/show': 'application/json',
|
||||
'auth/accept': 'application/json',
|
||||
'auth/session/generate': 'application/json',
|
||||
'auth/session/show': 'application/json',
|
||||
'auth/session/userkey': 'application/json',
|
||||
'blocking/create': 'application/json',
|
||||
'blocking/delete': 'application/json',
|
||||
'blocking/list': 'application/json',
|
||||
'channels/create': 'application/json',
|
||||
'channels/featured': 'application/json',
|
||||
'channels/follow': 'application/json',
|
||||
'channels/followed': 'application/json',
|
||||
'channels/owned': 'application/json',
|
||||
'channels/show': 'application/json',
|
||||
'channels/timeline': 'application/json',
|
||||
'channels/unfollow': 'application/json',
|
||||
'channels/update': 'application/json',
|
||||
'channels/favorite': 'application/json',
|
||||
'channels/unfavorite': 'application/json',
|
||||
'channels/my-favorites': 'application/json',
|
||||
'channels/search': 'application/json',
|
||||
'charts/active-users': 'application/json',
|
||||
'charts/ap-request': 'application/json',
|
||||
'charts/drive': 'application/json',
|
||||
'charts/federation': 'application/json',
|
||||
'charts/instance': 'application/json',
|
||||
'charts/notes': 'application/json',
|
||||
'charts/user/drive': 'application/json',
|
||||
'charts/user/following': 'application/json',
|
||||
'charts/user/notes': 'application/json',
|
||||
'charts/user/pv': 'application/json',
|
||||
'charts/user/reactions': 'application/json',
|
||||
'charts/users': 'application/json',
|
||||
'clips/add-note': 'application/json',
|
||||
'clips/remove-note': 'application/json',
|
||||
'clips/create': 'application/json',
|
||||
'clips/delete': 'application/json',
|
||||
'clips/list': 'application/json',
|
||||
'clips/notes': 'application/json',
|
||||
'clips/show': 'application/json',
|
||||
'clips/update': 'application/json',
|
||||
'clips/favorite': 'application/json',
|
||||
'clips/unfavorite': 'application/json',
|
||||
'clips/my-favorites': 'application/json',
|
||||
'drive': 'application/json',
|
||||
'drive/files': 'application/json',
|
||||
'drive/files/attached-notes': 'application/json',
|
||||
'drive/files/check-existence': 'application/json',
|
||||
/**
|
||||
* NOTE: The content-type for all endpoints not listed here is application/json.
|
||||
*/
|
||||
export const endpointReqTypes = {
|
||||
'drive/files/create': 'multipart/form-data',
|
||||
'drive/files/delete': 'application/json',
|
||||
'drive/files/find-by-hash': 'application/json',
|
||||
'drive/files/find': 'application/json',
|
||||
'drive/files/show': 'application/json',
|
||||
'drive/files/update': 'application/json',
|
||||
'drive/files/upload-from-url': 'application/json',
|
||||
'drive/folders': 'application/json',
|
||||
'drive/folders/create': 'application/json',
|
||||
'drive/folders/delete': 'application/json',
|
||||
'drive/folders/find': 'application/json',
|
||||
'drive/folders/show': 'application/json',
|
||||
'drive/folders/update': 'application/json',
|
||||
'drive/stream': 'application/json',
|
||||
'email-address/available': 'application/json',
|
||||
'endpoint': 'application/json',
|
||||
'endpoints': 'application/json',
|
||||
'export-custom-emojis': 'application/json',
|
||||
'federation/followers': 'application/json',
|
||||
'federation/following': 'application/json',
|
||||
'federation/instances': 'application/json',
|
||||
'federation/show-instance': 'application/json',
|
||||
'federation/update-remote-user': 'application/json',
|
||||
'federation/users': 'application/json',
|
||||
'federation/stats': 'application/json',
|
||||
'following/create': 'application/json',
|
||||
'following/delete': 'application/json',
|
||||
'following/update': 'application/json',
|
||||
'following/update-all': 'application/json',
|
||||
'following/invalidate': 'application/json',
|
||||
'following/requests/accept': 'application/json',
|
||||
'following/requests/cancel': 'application/json',
|
||||
'following/requests/list': 'application/json',
|
||||
'following/requests/reject': 'application/json',
|
||||
'gallery/featured': 'application/json',
|
||||
'gallery/popular': 'application/json',
|
||||
'gallery/posts': 'application/json',
|
||||
'gallery/posts/create': 'application/json',
|
||||
'gallery/posts/delete': 'application/json',
|
||||
'gallery/posts/like': 'application/json',
|
||||
'gallery/posts/show': 'application/json',
|
||||
'gallery/posts/unlike': 'application/json',
|
||||
'gallery/posts/update': 'application/json',
|
||||
'get-online-users-count': 'application/json',
|
||||
'get-avatar-decorations': 'application/json',
|
||||
'hashtags/list': 'application/json',
|
||||
'hashtags/search': 'application/json',
|
||||
'hashtags/show': 'application/json',
|
||||
'hashtags/trend': 'application/json',
|
||||
'hashtags/users': 'application/json',
|
||||
'i': 'application/json',
|
||||
'i/2fa/done': 'application/json',
|
||||
'i/2fa/key-done': 'application/json',
|
||||
'i/2fa/password-less': 'application/json',
|
||||
'i/2fa/register-key': 'application/json',
|
||||
'i/2fa/register': 'application/json',
|
||||
'i/2fa/update-key': 'application/json',
|
||||
'i/2fa/remove-key': 'application/json',
|
||||
'i/2fa/unregister': 'application/json',
|
||||
'i/apps': 'application/json',
|
||||
'i/authorized-apps': 'application/json',
|
||||
'i/claim-achievement': 'application/json',
|
||||
'i/change-password': 'application/json',
|
||||
'i/delete-account': 'application/json',
|
||||
'i/export-data': 'application/json',
|
||||
'i/export-blocking': 'application/json',
|
||||
'i/export-following': 'application/json',
|
||||
'i/export-mute': 'application/json',
|
||||
'i/export-notes': 'application/json',
|
||||
'i/export-clips': 'application/json',
|
||||
'i/export-favorites': 'application/json',
|
||||
'i/export-user-lists': 'application/json',
|
||||
'i/export-antennas': 'application/json',
|
||||
'i/favorites': 'application/json',
|
||||
'i/gallery/likes': 'application/json',
|
||||
'i/gallery/posts': 'application/json',
|
||||
'i/import-blocking': 'application/json',
|
||||
'i/import-following': 'application/json',
|
||||
'i/import-notes': 'application/json',
|
||||
'i/import-muting': 'application/json',
|
||||
'i/import-user-lists': 'application/json',
|
||||
'i/import-antennas': 'application/json',
|
||||
'i/notifications': 'application/json',
|
||||
'i/notifications-grouped': 'application/json',
|
||||
'i/page-likes': 'application/json',
|
||||
'i/pages': 'application/json',
|
||||
'i/pin': 'application/json',
|
||||
'i/read-all-unread-notes': 'application/json',
|
||||
'i/read-announcement': 'application/json',
|
||||
'i/regenerate-token': 'application/json',
|
||||
'i/registry/get-all': 'application/json',
|
||||
'i/registry/get-unsecure': 'application/json',
|
||||
'i/registry/get-detail': 'application/json',
|
||||
'i/registry/get': 'application/json',
|
||||
'i/registry/keys-with-type': 'application/json',
|
||||
'i/registry/keys': 'application/json',
|
||||
'i/registry/remove': 'application/json',
|
||||
'i/registry/scopes-with-domain': 'application/json',
|
||||
'i/registry/set': 'application/json',
|
||||
'i/revoke-token': 'application/json',
|
||||
'i/signin-history': 'application/json',
|
||||
'i/unpin': 'application/json',
|
||||
'i/update-email': 'application/json',
|
||||
'i/update': 'application/json',
|
||||
'i/move': 'application/json',
|
||||
'i/webhooks/create': 'application/json',
|
||||
'i/webhooks/list': 'application/json',
|
||||
'i/webhooks/show': 'application/json',
|
||||
'i/webhooks/update': 'application/json',
|
||||
'i/webhooks/delete': 'application/json',
|
||||
'invite/create': 'application/json',
|
||||
'invite/delete': 'application/json',
|
||||
'invite/list': 'application/json',
|
||||
'invite/limit': 'application/json',
|
||||
'meta': 'application/json',
|
||||
'emojis': 'application/json',
|
||||
'emoji': 'application/json',
|
||||
'miauth/gen-token': 'application/json',
|
||||
'mute/create': 'application/json',
|
||||
'mute/delete': 'application/json',
|
||||
'mute/list': 'application/json',
|
||||
'renote-mute/create': 'application/json',
|
||||
'renote-mute/delete': 'application/json',
|
||||
'renote-mute/list': 'application/json',
|
||||
'my/apps': 'application/json',
|
||||
'notes': 'application/json',
|
||||
'notes/children': 'application/json',
|
||||
'notes/clips': 'application/json',
|
||||
'notes/conversation': 'application/json',
|
||||
'notes/create': 'application/json',
|
||||
'notes/delete': 'application/json',
|
||||
'notes/favorites/create': 'application/json',
|
||||
'notes/favorites/delete': 'application/json',
|
||||
'notes/featured': 'application/json',
|
||||
'notes/following': 'application/json',
|
||||
'notes/global-timeline': 'application/json',
|
||||
'notes/bubble-timeline': 'application/json',
|
||||
'notes/hybrid-timeline': 'application/json',
|
||||
'notes/local-timeline': 'application/json',
|
||||
'notes/mentions': 'application/json',
|
||||
'notes/polls/recommendation': 'application/json',
|
||||
'notes/polls/vote': 'application/json',
|
||||
'notes/reactions': 'application/json',
|
||||
'notes/reactions/create': 'application/json',
|
||||
'notes/reactions/delete': 'application/json',
|
||||
'notes/like': 'application/json',
|
||||
'notes/renotes': 'application/json',
|
||||
'notes/replies': 'application/json',
|
||||
'notes/search-by-tag': 'application/json',
|
||||
'notes/search': 'application/json',
|
||||
'notes/show': 'application/json',
|
||||
'notes/state': 'application/json',
|
||||
'notes/thread-muting/create': 'application/json',
|
||||
'notes/thread-muting/delete': 'application/json',
|
||||
'notes/timeline': 'application/json',
|
||||
'notes/translate': 'application/json',
|
||||
'notes/unrenote': 'application/json',
|
||||
'notes/user-list-timeline': 'application/json',
|
||||
'notes/edit': 'application/json',
|
||||
'notes/versions': 'application/json',
|
||||
'notifications/create': 'application/json',
|
||||
'notifications/flush': 'application/json',
|
||||
'notifications/mark-all-as-read': 'application/json',
|
||||
'notifications/test-notification': 'application/json',
|
||||
'page-push': 'application/json',
|
||||
'pages/create': 'application/json',
|
||||
'pages/delete': 'application/json',
|
||||
'pages/featured': 'application/json',
|
||||
'pages/like': 'application/json',
|
||||
'pages/show': 'application/json',
|
||||
'pages/unlike': 'application/json',
|
||||
'pages/update': 'application/json',
|
||||
'flash/create': 'application/json',
|
||||
'flash/delete': 'application/json',
|
||||
'flash/featured': 'application/json',
|
||||
'flash/like': 'application/json',
|
||||
'flash/show': 'application/json',
|
||||
'flash/unlike': 'application/json',
|
||||
'flash/update': 'application/json',
|
||||
'flash/my': 'application/json',
|
||||
'flash/my-likes': 'application/json',
|
||||
'ping': 'application/json',
|
||||
'pinned-users': 'application/json',
|
||||
'promo/read': 'application/json',
|
||||
'roles/list': 'application/json',
|
||||
'roles/show': 'application/json',
|
||||
'roles/users': 'application/json',
|
||||
'roles/notes': 'application/json',
|
||||
'request-reset-password': 'application/json',
|
||||
'reset-db': 'application/json',
|
||||
'reset-password': 'application/json',
|
||||
'server-info': 'application/json',
|
||||
'stats': 'application/json',
|
||||
'sw/show-registration': 'application/json',
|
||||
'sw/update-registration': 'application/json',
|
||||
'sw/register': 'application/json',
|
||||
'sw/unregister': 'application/json',
|
||||
'test': 'application/json',
|
||||
'username/available': 'application/json',
|
||||
'users': 'application/json',
|
||||
'users/clips': 'application/json',
|
||||
'users/followers': 'application/json',
|
||||
'users/following': 'application/json',
|
||||
'users/gallery/posts': 'application/json',
|
||||
'users/get-frequently-replied-users': 'application/json',
|
||||
'users/featured-notes': 'application/json',
|
||||
'users/lists/create': 'application/json',
|
||||
'users/lists/delete': 'application/json',
|
||||
'users/lists/list': 'application/json',
|
||||
'users/lists/pull': 'application/json',
|
||||
'users/lists/push': 'application/json',
|
||||
'users/lists/show': 'application/json',
|
||||
'users/lists/favorite': 'application/json',
|
||||
'users/lists/unfavorite': 'application/json',
|
||||
'users/lists/update': 'application/json',
|
||||
'users/lists/create-from-public': 'application/json',
|
||||
'users/lists/update-membership': 'application/json',
|
||||
'users/lists/get-memberships': 'application/json',
|
||||
'users/notes': 'application/json',
|
||||
'users/pages': 'application/json',
|
||||
'users/flashs': 'application/json',
|
||||
'users/reactions': 'application/json',
|
||||
'users/recommendation': 'application/json',
|
||||
'users/relation': 'application/json',
|
||||
'users/report-abuse': 'application/json',
|
||||
'users/search-by-username-and-host': 'application/json',
|
||||
'users/search': 'application/json',
|
||||
'users/show': 'application/json',
|
||||
'users/achievements': 'application/json',
|
||||
'users/update-memo': 'application/json',
|
||||
'fetch-rss': 'application/json',
|
||||
'fetch-external-resources': 'application/json',
|
||||
'retention': 'application/json',
|
||||
'sponsors': 'application/json',
|
||||
'bubble-game/register': 'application/json',
|
||||
'bubble-game/ranking': 'application/json',
|
||||
'reversi/cancel-match': 'application/json',
|
||||
'reversi/games': 'application/json',
|
||||
'reversi/match': 'application/json',
|
||||
'reversi/invitations': 'application/json',
|
||||
'reversi/show-game': 'application/json',
|
||||
'reversi/surrender': 'application/json',
|
||||
'reversi/verify': 'application/json',
|
||||
};
|
||||
} as const satisfies { [K in keyof Endpoints]?: 'multipart/form-data'; };
|
||||
|
||||
@@ -125,6 +125,7 @@ export type AdminSystemWebhookShowRequest = operations['admin___system-webhook__
|
||||
export type AdminSystemWebhookShowResponse = operations['admin___system-webhook___show']['responses']['200']['content']['application/json'];
|
||||
export type AdminSystemWebhookUpdateRequest = operations['admin___system-webhook___update']['requestBody']['content']['application/json'];
|
||||
export type AdminSystemWebhookUpdateResponse = operations['admin___system-webhook___update']['responses']['200']['content']['application/json'];
|
||||
export type AdminSystemWebhookTestRequest = operations['admin___system-webhook___test']['requestBody']['content']['application/json'];
|
||||
export type AnnouncementsRequest = operations['announcements']['requestBody']['content']['application/json'];
|
||||
export type AnnouncementsResponse = operations['announcements']['responses']['200']['content']['application/json'];
|
||||
export type AnnouncementsShowRequest = operations['announcements___show']['requestBody']['content']['application/json'];
|
||||
@@ -386,6 +387,7 @@ export type IWebhooksShowRequest = operations['i___webhooks___show']['requestBod
|
||||
export type IWebhooksShowResponse = operations['i___webhooks___show']['responses']['200']['content']['application/json'];
|
||||
export type IWebhooksUpdateRequest = operations['i___webhooks___update']['requestBody']['content']['application/json'];
|
||||
export type IWebhooksDeleteRequest = operations['i___webhooks___delete']['requestBody']['content']['application/json'];
|
||||
export type IWebhooksTestRequest = operations['i___webhooks___test']['requestBody']['content']['application/json'];
|
||||
export type InviteCreateResponse = operations['invite___create']['responses']['200']['content']['application/json'];
|
||||
export type InviteDeleteRequest = operations['invite___delete']['requestBody']['content']['application/json'];
|
||||
export type InviteListRequest = operations['invite___list']['requestBody']['content']['application/json'];
|
||||
|
||||
@@ -842,6 +842,16 @@ export type paths = {
|
||||
*/
|
||||
post: operations['admin___system-webhook___update'];
|
||||
};
|
||||
'/admin/system-webhook/test': {
|
||||
/**
|
||||
* admin/system-webhook/test
|
||||
* @description No description provided.
|
||||
*
|
||||
* **Internal Endpoint**: This endpoint is an API for the misskey mainframe and is not intended for use by third parties.
|
||||
* **Credential required**: *Yes* / **Permission**: *read:admin:system-webhook*
|
||||
*/
|
||||
post: operations['admin___system-webhook___test'];
|
||||
};
|
||||
'/announcements': {
|
||||
/**
|
||||
* announcements
|
||||
@@ -2510,6 +2520,16 @@ export type paths = {
|
||||
*/
|
||||
post: operations['i___webhooks___delete'];
|
||||
};
|
||||
'/i/webhooks/test': {
|
||||
/**
|
||||
* i/webhooks/test
|
||||
* @description No description provided.
|
||||
*
|
||||
* **Internal Endpoint**: This endpoint is an API for the misskey mainframe and is not intended for use by third parties.
|
||||
* **Credential required**: *Yes* / **Permission**: *read:account*
|
||||
*/
|
||||
post: operations['i___webhooks___test'];
|
||||
};
|
||||
'/invite/create': {
|
||||
/**
|
||||
* invite/create
|
||||
@@ -3838,7 +3858,6 @@ export type components = {
|
||||
isModerator?: boolean;
|
||||
/** @default false */
|
||||
isSystem?: boolean;
|
||||
isSilenced: boolean;
|
||||
noindex: boolean;
|
||||
isBot?: boolean;
|
||||
isCat?: boolean;
|
||||
@@ -3883,6 +3902,7 @@ export type components = {
|
||||
backgroundUrl: string | null;
|
||||
backgroundBlurhash: string | null;
|
||||
isLocked: boolean;
|
||||
isSilenced: boolean;
|
||||
/** @example false */
|
||||
isSuspended: boolean;
|
||||
/** @example Hi masters, I am Ai! */
|
||||
@@ -3918,6 +3938,7 @@ export type components = {
|
||||
/** @default false */
|
||||
securityKeys: boolean;
|
||||
roles: components['schemas']['RoleLite'][];
|
||||
followedMessage?: string | null;
|
||||
memo: string | null;
|
||||
moderationNote?: string;
|
||||
isFollowing?: boolean;
|
||||
@@ -3939,6 +3960,7 @@ export type components = {
|
||||
bannerId: string | null;
|
||||
/** Format: id */
|
||||
backgroundId: string | null;
|
||||
followedMessage: string | null;
|
||||
isModerator: boolean | null;
|
||||
isAdmin: boolean | null;
|
||||
injectFeaturedNote: boolean;
|
||||
@@ -4378,7 +4400,7 @@ export type components = {
|
||||
user: components['schemas']['UserLite'];
|
||||
/** Format: id */
|
||||
userId: string;
|
||||
} | {
|
||||
} | ({
|
||||
/** Format: id */
|
||||
id: string;
|
||||
/** Format: date-time */
|
||||
@@ -4388,7 +4410,8 @@ export type components = {
|
||||
user: components['schemas']['UserLite'];
|
||||
/** Format: id */
|
||||
userId: string;
|
||||
} | {
|
||||
message: string | null;
|
||||
}) | {
|
||||
/** Format: id */
|
||||
id: string;
|
||||
/** Format: date-time */
|
||||
@@ -4396,15 +4419,27 @@ export type components = {
|
||||
/** @enum {string} */
|
||||
type: 'roleAssigned';
|
||||
role: components['schemas']['Role'];
|
||||
} | {
|
||||
} | ({
|
||||
/** Format: id */
|
||||
id: string;
|
||||
/** Format: date-time */
|
||||
createdAt: string;
|
||||
/** @enum {string} */
|
||||
type: 'achievementEarned';
|
||||
achievement: string;
|
||||
} | {
|
||||
/** @enum {string} */
|
||||
achievement: 'notes1' | 'notes10' | 'notes100' | 'notes500' | 'notes1000' | 'notes5000' | 'notes10000' | 'notes20000' | 'notes30000' | 'notes40000' | 'notes50000' | 'notes60000' | 'notes70000' | 'notes80000' | 'notes90000' | 'notes100000' | 'login3' | 'login7' | 'login15' | 'login30' | 'login60' | 'login100' | 'login200' | 'login300' | 'login400' | 'login500' | 'login600' | 'login700' | 'login800' | 'login900' | 'login1000' | 'passedSinceAccountCreated1' | 'passedSinceAccountCreated2' | 'passedSinceAccountCreated3' | 'loggedInOnBirthday' | 'loggedInOnNewYearsDay' | 'noteClipped1' | 'noteFavorited1' | 'myNoteFavorited1' | 'profileFilled' | 'markedAsCat' | 'following1' | 'following10' | 'following50' | 'following100' | 'following300' | 'followers1' | 'followers10' | 'followers50' | 'followers100' | 'followers300' | 'followers500' | 'followers1000' | 'collectAchievements30' | 'viewAchievements3min' | 'iLoveMisskey' | 'foundTreasure' | 'client30min' | 'client60min' | 'noteDeletedWithin1min' | 'postedAtLateNight' | 'postedAt0min0sec' | 'selfQuote' | 'htl20npm' | 'viewInstanceChart' | 'outputHelloWorldOnScratchpad' | 'open3windows' | 'driveFolderCircularReference' | 'reactWithoutRead' | 'clickedClickHere' | 'justPlainLucky' | 'setNameToSyuilo' | 'cookieClicked' | 'brainDiver' | 'smashTestNotificationButton' | 'tutorialCompleted' | 'bubbleGameExplodingHead' | 'bubbleGameDoubleExplodingHead';
|
||||
}) | ({
|
||||
/** Format: id */
|
||||
id: string;
|
||||
/** Format: date-time */
|
||||
createdAt: string;
|
||||
/** @enum {string} */
|
||||
type: 'exportCompleted';
|
||||
/** @enum {string} */
|
||||
exportedEntity: 'antenna' | 'blocking' | 'clip' | 'customEmoji' | 'favorite' | 'following' | 'muting' | 'note' | 'userList';
|
||||
/** Format: id */
|
||||
fileId: string;
|
||||
}) | ({
|
||||
/** Format: id */
|
||||
id: string;
|
||||
/** Format: date-time */
|
||||
@@ -4412,9 +4447,9 @@ export type components = {
|
||||
/** @enum {string} */
|
||||
type: 'app';
|
||||
body: string;
|
||||
header: string;
|
||||
icon: string;
|
||||
} | {
|
||||
header: string | null;
|
||||
icon: string | null;
|
||||
}) | {
|
||||
/** Format: id */
|
||||
id: string;
|
||||
/** Format: date-time */
|
||||
@@ -4965,6 +5000,11 @@ export type components = {
|
||||
userEachUserListsLimit: number;
|
||||
rateLimitFactor: number;
|
||||
avatarDecorationLimit: number;
|
||||
canImportAntennas: boolean;
|
||||
canImportBlocking: boolean;
|
||||
canImportFollowing: boolean;
|
||||
canImportMuting: boolean;
|
||||
canImportUserLists: boolean;
|
||||
};
|
||||
ReversiGameLite: {
|
||||
/** Format: id */
|
||||
@@ -5117,6 +5157,7 @@ export type components = {
|
||||
*/
|
||||
noteSearchableScope: 'local' | 'global';
|
||||
trustedLinkUrlPatterns: string[];
|
||||
maxFileSize: number;
|
||||
};
|
||||
MetaDetailedOnly: {
|
||||
features?: {
|
||||
@@ -5278,6 +5319,7 @@ export type operations = {
|
||||
perRemoteUserUserTimelineCacheMax: number;
|
||||
perUserHomeTimelineCacheMax: number;
|
||||
perUserListTimelineCacheMax: number;
|
||||
enableReactionsBuffering: boolean;
|
||||
notesPerOneAd: number;
|
||||
backgroundImageUrl: string | null;
|
||||
deeplAuthKey: string | null;
|
||||
@@ -5314,6 +5356,8 @@ export type operations = {
|
||||
urlPreviewUserAgent: string | null;
|
||||
urlPreviewSummaryProxyUrl: string | null;
|
||||
trustedLinkUrlPatterns: string[];
|
||||
federation: string;
|
||||
federationHosts: string[];
|
||||
};
|
||||
};
|
||||
};
|
||||
@@ -8399,7 +8443,7 @@ export type operations = {
|
||||
/** @description OK (with results) */
|
||||
200: {
|
||||
content: {
|
||||
'application/json': ((string | number)[])[];
|
||||
'application/json': [string, number][];
|
||||
};
|
||||
};
|
||||
/** @description Client error */
|
||||
@@ -8445,7 +8489,7 @@ export type operations = {
|
||||
/** @description OK (with results) */
|
||||
200: {
|
||||
content: {
|
||||
'application/json': ((string | number)[])[];
|
||||
'application/json': [string, number][];
|
||||
};
|
||||
};
|
||||
/** @description Client error */
|
||||
@@ -9080,6 +9124,7 @@ export type operations = {
|
||||
email: string | null;
|
||||
emailVerified: boolean;
|
||||
approved: boolean;
|
||||
followedMessage: string | null;
|
||||
autoAcceptFollowed: boolean;
|
||||
noCrawle: boolean;
|
||||
preventAiLearning: boolean;
|
||||
@@ -9827,6 +9872,7 @@ export type operations = {
|
||||
perRemoteUserUserTimelineCacheMax?: number;
|
||||
perUserHomeTimelineCacheMax?: number;
|
||||
perUserListTimelineCacheMax?: number;
|
||||
enableReactionsBuffering?: boolean;
|
||||
notesPerOneAd?: number;
|
||||
silencedHosts?: string[] | null;
|
||||
mediaSilencedHosts?: string[] | null;
|
||||
@@ -9839,6 +9885,9 @@ export type operations = {
|
||||
urlPreviewUserAgent?: string | null;
|
||||
urlPreviewSummaryProxyUrl?: string | null;
|
||||
trustedLinkUrlPatterns?: string[] | null;
|
||||
/** @enum {string} */
|
||||
federation?: 'all' | 'none' | 'specified';
|
||||
federationHosts?: string[];
|
||||
};
|
||||
};
|
||||
};
|
||||
@@ -10780,6 +10829,71 @@ export type operations = {
|
||||
};
|
||||
};
|
||||
};
|
||||
/**
|
||||
* admin/system-webhook/test
|
||||
* @description No description provided.
|
||||
*
|
||||
* **Internal Endpoint**: This endpoint is an API for the misskey mainframe and is not intended for use by third parties.
|
||||
* **Credential required**: *Yes* / **Permission**: *read:admin:system-webhook*
|
||||
*/
|
||||
'admin___system-webhook___test': {
|
||||
requestBody: {
|
||||
content: {
|
||||
'application/json': {
|
||||
/** Format: misskey:id */
|
||||
webhookId: string;
|
||||
/** @enum {string} */
|
||||
type: 'abuseReport' | 'abuseReportResolved' | 'userCreated';
|
||||
override?: {
|
||||
url?: string;
|
||||
secret?: string;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
responses: {
|
||||
/** @description OK (without any results) */
|
||||
204: {
|
||||
content: never;
|
||||
};
|
||||
/** @description Client error */
|
||||
400: {
|
||||
content: {
|
||||
'application/json': components['schemas']['Error'];
|
||||
};
|
||||
};
|
||||
/** @description Authentication error */
|
||||
401: {
|
||||
content: {
|
||||
'application/json': components['schemas']['Error'];
|
||||
};
|
||||
};
|
||||
/** @description Forbidden error */
|
||||
403: {
|
||||
content: {
|
||||
'application/json': components['schemas']['Error'];
|
||||
};
|
||||
};
|
||||
/** @description I'm Ai */
|
||||
418: {
|
||||
content: {
|
||||
'application/json': components['schemas']['Error'];
|
||||
};
|
||||
};
|
||||
/** @description To many requests */
|
||||
429: {
|
||||
content: {
|
||||
'application/json': components['schemas']['Error'];
|
||||
};
|
||||
};
|
||||
/** @description Internal server error */
|
||||
500: {
|
||||
content: {
|
||||
'application/json': components['schemas']['Error'];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
/**
|
||||
* announcements
|
||||
* @description No description provided.
|
||||
@@ -15366,6 +15480,10 @@ export type operations = {
|
||||
untilId?: string;
|
||||
/** @default 10 */
|
||||
limit?: number;
|
||||
/** @default false */
|
||||
includeFollower?: boolean;
|
||||
/** @default true */
|
||||
includeFollowee?: boolean;
|
||||
};
|
||||
};
|
||||
};
|
||||
@@ -15425,6 +15543,10 @@ export type operations = {
|
||||
untilId?: string;
|
||||
/** @default 10 */
|
||||
limit?: number;
|
||||
/** @default false */
|
||||
includeFollower?: boolean;
|
||||
/** @default true */
|
||||
includeFollowee?: boolean;
|
||||
};
|
||||
};
|
||||
};
|
||||
@@ -19057,8 +19179,8 @@ export type operations = {
|
||||
untilId?: string;
|
||||
/** @default true */
|
||||
markAsRead?: boolean;
|
||||
includeTypes?: ('note' | 'follow' | 'mention' | 'reply' | 'renote' | 'quote' | 'reaction' | 'pollEnded' | 'edited' | 'receiveFollowRequest' | 'followRequestAccepted' | 'roleAssigned' | 'achievementEarned' | 'app' | 'test' | 'pollVote' | 'groupInvited')[];
|
||||
excludeTypes?: ('note' | 'follow' | 'mention' | 'reply' | 'renote' | 'quote' | 'reaction' | 'pollEnded' | 'edited' | 'receiveFollowRequest' | 'followRequestAccepted' | 'roleAssigned' | 'achievementEarned' | 'app' | 'test' | 'pollVote' | 'groupInvited')[];
|
||||
includeTypes?: ('note' | 'follow' | 'mention' | 'reply' | 'renote' | 'quote' | 'reaction' | 'pollEnded' | 'edited' | 'receiveFollowRequest' | 'followRequestAccepted' | 'roleAssigned' | 'achievementEarned' | 'exportCompleted' | 'app' | 'test' | 'pollVote' | 'groupInvited')[];
|
||||
excludeTypes?: ('note' | 'follow' | 'mention' | 'reply' | 'renote' | 'quote' | 'reaction' | 'pollEnded' | 'edited' | 'receiveFollowRequest' | 'followRequestAccepted' | 'roleAssigned' | 'achievementEarned' | 'exportCompleted' | 'app' | 'test' | 'pollVote' | 'groupInvited')[];
|
||||
};
|
||||
};
|
||||
};
|
||||
@@ -19125,8 +19247,8 @@ export type operations = {
|
||||
untilId?: string;
|
||||
/** @default true */
|
||||
markAsRead?: boolean;
|
||||
includeTypes?: ('note' | 'follow' | 'mention' | 'reply' | 'renote' | 'quote' | 'reaction' | 'pollEnded' | 'edited' | 'receiveFollowRequest' | 'followRequestAccepted' | 'roleAssigned' | 'achievementEarned' | 'app' | 'test' | 'reaction:grouped' | 'renote:grouped' | 'pollVote' | 'groupInvited')[];
|
||||
excludeTypes?: ('note' | 'follow' | 'mention' | 'reply' | 'renote' | 'quote' | 'reaction' | 'pollEnded' | 'edited' | 'receiveFollowRequest' | 'followRequestAccepted' | 'roleAssigned' | 'achievementEarned' | 'app' | 'test' | 'reaction:grouped' | 'renote:grouped' | 'pollVote' | 'groupInvited')[];
|
||||
includeTypes?: ('note' | 'follow' | 'mention' | 'reply' | 'renote' | 'quote' | 'reaction' | 'pollEnded' | 'edited' | 'receiveFollowRequest' | 'followRequestAccepted' | 'roleAssigned' | 'achievementEarned' | 'exportCompleted' | 'app' | 'test' | 'reaction:grouped' | 'renote:grouped' | 'pollVote' | 'groupInvited')[];
|
||||
excludeTypes?: ('note' | 'follow' | 'mention' | 'reply' | 'renote' | 'quote' | 'reaction' | 'pollEnded' | 'edited' | 'receiveFollowRequest' | 'followRequestAccepted' | 'roleAssigned' | 'achievementEarned' | 'exportCompleted' | 'app' | 'test' | 'reaction:grouped' | 'renote:grouped' | 'pollVote' | 'groupInvited')[];
|
||||
};
|
||||
};
|
||||
};
|
||||
@@ -20238,6 +20360,7 @@ export type operations = {
|
||||
'application/json': {
|
||||
name?: string | null;
|
||||
description?: string | null;
|
||||
followedMessage?: string | null;
|
||||
location?: string | null;
|
||||
birthday?: string | null;
|
||||
listenbrainz?: string | null;
|
||||
@@ -20830,6 +20953,71 @@ export type operations = {
|
||||
};
|
||||
};
|
||||
};
|
||||
/**
|
||||
* i/webhooks/test
|
||||
* @description No description provided.
|
||||
*
|
||||
* **Internal Endpoint**: This endpoint is an API for the misskey mainframe and is not intended for use by third parties.
|
||||
* **Credential required**: *Yes* / **Permission**: *read:account*
|
||||
*/
|
||||
i___webhooks___test: {
|
||||
requestBody: {
|
||||
content: {
|
||||
'application/json': {
|
||||
/** Format: misskey:id */
|
||||
webhookId: string;
|
||||
/** @enum {string} */
|
||||
type: 'mention' | 'unfollow' | 'follow' | 'followed' | 'note' | 'reply' | 'renote' | 'reaction' | 'edited';
|
||||
override?: {
|
||||
url?: string;
|
||||
secret?: string;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
responses: {
|
||||
/** @description OK (without any results) */
|
||||
204: {
|
||||
content: never;
|
||||
};
|
||||
/** @description Client error */
|
||||
400: {
|
||||
content: {
|
||||
'application/json': components['schemas']['Error'];
|
||||
};
|
||||
};
|
||||
/** @description Authentication error */
|
||||
401: {
|
||||
content: {
|
||||
'application/json': components['schemas']['Error'];
|
||||
};
|
||||
};
|
||||
/** @description Forbidden error */
|
||||
403: {
|
||||
content: {
|
||||
'application/json': components['schemas']['Error'];
|
||||
};
|
||||
};
|
||||
/** @description I'm Ai */
|
||||
418: {
|
||||
content: {
|
||||
'application/json': components['schemas']['Error'];
|
||||
};
|
||||
};
|
||||
/** @description To many requests */
|
||||
429: {
|
||||
content: {
|
||||
'application/json': components['schemas']['Error'];
|
||||
};
|
||||
};
|
||||
/** @description Internal server error */
|
||||
500: {
|
||||
content: {
|
||||
'application/json': components['schemas']['Error'];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
/**
|
||||
* invite/create
|
||||
* @description No description provided.
|
||||
|
||||
@@ -274,6 +274,17 @@ export type SigninRequest = {
|
||||
token?: string;
|
||||
};
|
||||
|
||||
export type SigninWithPasskeyRequest = {
|
||||
credential?: object;
|
||||
context?: string;
|
||||
};
|
||||
|
||||
export type SigninWithPasskeyResponse = {
|
||||
option?: object;
|
||||
context?: string;
|
||||
signinResponse?: SigninResponse;
|
||||
};
|
||||
|
||||
export type SigninResponse = {
|
||||
id: User['id'],
|
||||
i: string,
|
||||
|
||||
@@ -1,15 +1,6 @@
|
||||
import { type Endpoints } from './api.types.js';
|
||||
import Stream, { Connection } from './streaming.js';
|
||||
import { type Channels } from './streaming.types.js';
|
||||
import { type Acct } from './acct.js';
|
||||
import * as consts from './consts.js';
|
||||
|
||||
export type {
|
||||
Endpoints,
|
||||
Channels,
|
||||
Acct,
|
||||
};
|
||||
|
||||
export {
|
||||
Stream,
|
||||
Connection as ChannelConnection,
|
||||
@@ -31,4 +22,21 @@ import * as api from './api.js';
|
||||
import * as entities from './entities.js';
|
||||
import * as acct from './acct.js';
|
||||
import * as note from './note.js';
|
||||
export { api, entities, acct, note };
|
||||
import { nyaize } from './nyaize.js';
|
||||
export { api, entities, acct, note, nyaize };
|
||||
|
||||
//#region standalone types
|
||||
import type { Endpoints } from './api.types.js';
|
||||
import type { StreamEvents, IStream, IChannelConnection } from './streaming.js';
|
||||
import type { Channels } from './streaming.types.js';
|
||||
import type { Acct } from './acct.js';
|
||||
|
||||
export type {
|
||||
Endpoints,
|
||||
Channels,
|
||||
Acct,
|
||||
StreamEvents,
|
||||
IStream,
|
||||
IChannelConnection,
|
||||
};
|
||||
//#endregion
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: syuilo and misskey-project
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
const koRegex1 = /[나-낳]/g;
|
||||
const koRegex2 = /(다$)|(다(?=\.))|(다(?= ))|(다(?=!))|(다(?=\?))/gm;
|
||||
const koRegex3 = /(야(?=\?))|(야$)|(야(?= ))/gm;
|
||||
|
||||
function ifAfter(prefix: string, fn: (x: string) => string) {
|
||||
const preLen = prefix.length;
|
||||
const regex = new RegExp(prefix, 'i');
|
||||
return (x: string, pos: number, string: string) => {
|
||||
return pos > 0 && string.substring(pos - preLen, pos).match(regex) ? fn(x) : x;
|
||||
};
|
||||
}
|
||||
|
||||
export function nyaize(text: string): string {
|
||||
return text
|
||||
// ja-JP
|
||||
.replaceAll('な', 'にゃ').replaceAll('ナ', 'ニャ').replaceAll('ナ', 'ニャ')
|
||||
// en-US
|
||||
.replace(/a/gi, ifAfter('n', x => x === 'A' ? 'YA' : 'ya'))
|
||||
.replace(/ing/gi, ifAfter('morn', x => x === 'ING' ? 'YAN' : 'yan'))
|
||||
.replace(/one/gi, ifAfter('every', x => x === 'ONE' ? 'NYAN' : 'nyan'))
|
||||
// ko-KR
|
||||
.replace(koRegex1, match => !isNaN(match.charCodeAt(0)) ? String.fromCharCode(
|
||||
match.charCodeAt(0) + '냐'.charCodeAt(0) - '나'.charCodeAt(0),
|
||||
) : match)
|
||||
.replace(koRegex2, '다냥')
|
||||
.replace(koRegex3, '냥');
|
||||
}
|
||||
@@ -17,16 +17,32 @@ export function urlQuery(obj: Record<string, string | number | boolean | undefin
|
||||
|
||||
type AnyOf<T extends Record<PropertyKey, unknown>> = T[keyof T];
|
||||
|
||||
type StreamEvents = {
|
||||
export type StreamEvents = {
|
||||
_connected_: void;
|
||||
_disconnected_: void;
|
||||
} & BroadcastEvents;
|
||||
|
||||
export interface IStream extends EventEmitter<StreamEvents> {
|
||||
state: 'initializing' | 'reconnecting' | 'connected';
|
||||
|
||||
useChannel<C extends keyof Channels>(channel: C, params?: Channels[C]['params'], name?: string): IChannelConnection<Channels[C]>;
|
||||
removeSharedConnection(connection: SharedConnection): void;
|
||||
removeSharedConnectionPool(pool: Pool): void;
|
||||
disconnectToChannel(connection: NonSharedConnection): void;
|
||||
send(typeOrPayload: string): void;
|
||||
send(typeOrPayload: string, payload: unknown): void;
|
||||
send(typeOrPayload: Record<string, unknown> | unknown[]): void;
|
||||
send(typeOrPayload: string | Record<string, unknown> | unknown[], payload?: unknown): void;
|
||||
ping(): void;
|
||||
heartbeat(): void;
|
||||
close(): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* Misskey stream connection
|
||||
*/
|
||||
// eslint-disable-next-line import/no-default-export
|
||||
export default class Stream extends EventEmitter<StreamEvents> {
|
||||
export default class Stream extends EventEmitter<StreamEvents> implements IStream {
|
||||
private stream: _ReconnectingWebsocket.default;
|
||||
public state: 'initializing' | 'reconnecting' | 'connected' = 'initializing';
|
||||
private sharedConnectionPools: Pool[] = [];
|
||||
@@ -277,7 +293,18 @@ class Pool {
|
||||
}
|
||||
}
|
||||
|
||||
export abstract class Connection<Channel extends AnyOf<Channels> = AnyOf<Channels>> extends EventEmitter<Channel['events']> {
|
||||
export interface IChannelConnection<Channel extends AnyOf<Channels> = AnyOf<Channels>> extends EventEmitter<Channel['events']> {
|
||||
id: string;
|
||||
name?: string;
|
||||
inCount: number;
|
||||
outCount: number;
|
||||
channel: string;
|
||||
|
||||
send<T extends keyof Channel['receives']>(type: T, body: Channel['receives'][T]): void;
|
||||
dispose(): void;
|
||||
}
|
||||
|
||||
export abstract class Connection<Channel extends AnyOf<Channels> = AnyOf<Channels>> extends EventEmitter<Channel['events']> implements IChannelConnection<Channel> {
|
||||
public channel: string;
|
||||
protected stream: Stream;
|
||||
public abstract id: string;
|
||||
|
||||
@@ -140,7 +140,7 @@ export type Channels = {
|
||||
};
|
||||
hashtag: {
|
||||
params: {
|
||||
q?: string;
|
||||
q: string[][];
|
||||
};
|
||||
events: {
|
||||
note: (payload: Note) => void;
|
||||
@@ -249,7 +249,7 @@ export type Channels = {
|
||||
}
|
||||
};
|
||||
|
||||
export type NoteUpdatedEvent = {
|
||||
export type NoteUpdatedEvent = { id: Note['id'] } & ({
|
||||
type: 'reacted';
|
||||
body: {
|
||||
reaction: string;
|
||||
@@ -280,7 +280,7 @@ export type NoteUpdatedEvent = {
|
||||
choice: number;
|
||||
userId: User['id'];
|
||||
};
|
||||
};
|
||||
});
|
||||
|
||||
export type BroadcastEvents = {
|
||||
noteUpdated: (payload: NoteUpdatedEvent) => void;
|
||||
|
||||
Reference in New Issue
Block a user