From 7fcf867bfeb2aa0d0d6c0a7fbb7cee47a5507ae0 Mon Sep 17 00:00:00 2001 From: GrapeApple0 <84321396+GrapeApple0@users.noreply.github.com> Date: Fri, 14 Jun 2024 08:17:19 +0000 Subject: [PATCH] wip: build-misskey-js-with-types --- .../backend/src/server/api/EndpointsModule.ts | 4 + packages/backend/src/server/api/endpoints.ts | 2 + packages/misskey-js/etc/misskey-js.api.md | 12 ++ .../misskey-js/src/autogen/apiClientJSDoc.ts | 11 ++ packages/misskey-js/src/autogen/endpoint.ts | 3 + packages/misskey-js/src/autogen/entities.ts | 2 + packages/misskey-js/src/autogen/models.ts | 1 + packages/misskey-js/src/autogen/types.ts | 103 ++++++++++++++++++ 8 files changed, 138 insertions(+) diff --git a/packages/backend/src/server/api/EndpointsModule.ts b/packages/backend/src/server/api/EndpointsModule.ts index 41576bedaa..7ccd212ab9 100644 --- a/packages/backend/src/server/api/EndpointsModule.ts +++ b/packages/backend/src/server/api/EndpointsModule.ts @@ -296,6 +296,7 @@ import * as ep___notes_replies from './endpoints/notes/replies.js'; import * as ep___notes_searchByTag from './endpoints/notes/search-by-tag.js'; import * as ep___notes_search from './endpoints/notes/search.js'; import * as ep___notes_show from './endpoints/notes/show.js'; +import * as ep___notes_history from './endpoints/notes/history.js'; import * as ep___notes_state from './endpoints/notes/state.js'; import * as ep___notes_threadMuting_create from './endpoints/notes/thread-muting/create.js'; import * as ep___notes_threadMuting_delete from './endpoints/notes/thread-muting/delete.js'; @@ -679,6 +680,7 @@ const $notes_replies: Provider = { provide: 'ep:notes/replies', useClass: ep___n const $notes_searchByTag: Provider = { provide: 'ep:notes/search-by-tag', useClass: ep___notes_searchByTag.default }; const $notes_search: Provider = { provide: 'ep:notes/search', useClass: ep___notes_search.default }; const $notes_show: Provider = { provide: 'ep:notes/show', useClass: ep___notes_show.default }; +const $notes_history: Provider = { provide: 'ep:notes/history', useClass: ep___notes_history.default }; const $notes_state: Provider = { provide: 'ep:notes/state', useClass: ep___notes_state.default }; const $notes_threadMuting_create: Provider = { provide: 'ep:notes/thread-muting/create', useClass: ep___notes_threadMuting_create.default }; const $notes_threadMuting_delete: Provider = { provide: 'ep:notes/thread-muting/delete', useClass: ep___notes_threadMuting_delete.default }; @@ -1066,6 +1068,7 @@ const $reversi_verify: Provider = { provide: 'ep:reversi/verify', useClass: ep__ $notes_searchByTag, $notes_search, $notes_show, + $notes_history, $notes_state, $notes_threadMuting_create, $notes_threadMuting_delete, @@ -1447,6 +1450,7 @@ const $reversi_verify: Provider = { provide: 'ep:reversi/verify', useClass: ep__ $notes_searchByTag, $notes_search, $notes_show, + $notes_history, $notes_state, $notes_threadMuting_create, $notes_threadMuting_delete, diff --git a/packages/backend/src/server/api/endpoints.ts b/packages/backend/src/server/api/endpoints.ts index 3dfb7fdad4..697c68b7e5 100644 --- a/packages/backend/src/server/api/endpoints.ts +++ b/packages/backend/src/server/api/endpoints.ts @@ -302,6 +302,7 @@ import * as ep___notes_replies from './endpoints/notes/replies.js'; import * as ep___notes_searchByTag from './endpoints/notes/search-by-tag.js'; import * as ep___notes_search from './endpoints/notes/search.js'; import * as ep___notes_show from './endpoints/notes/show.js'; +import * as ep___notes_history from './endpoints/notes/history.js'; import * as ep___notes_state from './endpoints/notes/state.js'; import * as ep___notes_threadMuting_create from './endpoints/notes/thread-muting/create.js'; import * as ep___notes_threadMuting_delete from './endpoints/notes/thread-muting/delete.js'; @@ -683,6 +684,7 @@ const eps = [ ['notes/search-by-tag', ep___notes_searchByTag], ['notes/search', ep___notes_search], ['notes/show', ep___notes_show], + ['notes/history', ep___notes_history], ['notes/state', ep___notes_state], ['notes/thread-muting/create', ep___notes_threadMuting_create], ['notes/thread-muting/delete', ep___notes_threadMuting_delete], diff --git a/packages/misskey-js/etc/misskey-js.api.md b/packages/misskey-js/etc/misskey-js.api.md index cfb1518a00..acb5b522c7 100644 --- a/packages/misskey-js/etc/misskey-js.api.md +++ b/packages/misskey-js/etc/misskey-js.api.md @@ -1624,6 +1624,8 @@ declare namespace entities { NotesSearchResponse, NotesShowRequest, NotesShowResponse, + NotesHistoryRequest, + NotesHistoryResponse, NotesStateRequest, NotesStateResponse, NotesThreadMutingCreateRequest, @@ -1770,6 +1772,7 @@ declare namespace entities { Announcement, App, Note, + NoteHistory, NoteReaction, NoteFavorite, Notification_2 as Notification, @@ -2512,6 +2515,9 @@ type Note = components['schemas']['Note']; // @public (undocumented) type NoteFavorite = components['schemas']['NoteFavorite']; +// @public (undocumented) +type NoteHistory = components['schemas']['NoteHistory']; + // @public (undocumented) type NoteReaction = components['schemas']['NoteReaction']; @@ -2560,6 +2566,12 @@ type NotesGlobalTimelineRequest = operations['notes___global-timeline']['request // @public (undocumented) type NotesGlobalTimelineResponse = operations['notes___global-timeline']['responses']['200']['content']['application/json']; +// @public (undocumented) +type NotesHistoryRequest = operations['notes___history']['requestBody']['content']['application/json']; + +// @public (undocumented) +type NotesHistoryResponse = operations['notes___history']['responses']['200']['content']['application/json']; + // @public (undocumented) type NotesHybridTimelineRequest = operations['notes___hybrid-timeline']['requestBody']['content']['application/json']; diff --git a/packages/misskey-js/src/autogen/apiClientJSDoc.ts b/packages/misskey-js/src/autogen/apiClientJSDoc.ts index e799d4a0c5..01dc727fb4 100644 --- a/packages/misskey-js/src/autogen/apiClientJSDoc.ts +++ b/packages/misskey-js/src/autogen/apiClientJSDoc.ts @@ -3238,6 +3238,17 @@ declare module '../api.js' { credential?: string | null, ): Promise>; + /** + * No description provided. + * + * **Credential required**: *No* + */ + request( + endpoint: E, + params: P, + credential?: string | null, + ): Promise>; + /** * No description provided. * diff --git a/packages/misskey-js/src/autogen/endpoint.ts b/packages/misskey-js/src/autogen/endpoint.ts index 20c8509d4c..9aff49931d 100644 --- a/packages/misskey-js/src/autogen/endpoint.ts +++ b/packages/misskey-js/src/autogen/endpoint.ts @@ -438,6 +438,8 @@ import type { NotesSearchResponse, NotesShowRequest, NotesShowResponse, + NotesHistoryRequest, + NotesHistoryResponse, NotesStateRequest, NotesStateResponse, NotesThreadMutingCreateRequest, @@ -864,6 +866,7 @@ export type Endpoints = { 'notes/search-by-tag': { req: NotesSearchByTagRequest; res: NotesSearchByTagResponse }; 'notes/search': { req: NotesSearchRequest; res: NotesSearchResponse }; 'notes/show': { req: NotesShowRequest; res: NotesShowResponse }; + 'notes/history': { req: NotesHistoryRequest; res: NotesHistoryResponse }; 'notes/state': { req: NotesStateRequest; res: NotesStateResponse }; 'notes/thread-muting/create': { req: NotesThreadMutingCreateRequest; res: EmptyResponse }; 'notes/thread-muting/delete': { req: NotesThreadMutingDeleteRequest; res: EmptyResponse }; diff --git a/packages/misskey-js/src/autogen/entities.ts b/packages/misskey-js/src/autogen/entities.ts index 357b5e9eaf..4ce70c4cb5 100644 --- a/packages/misskey-js/src/autogen/entities.ts +++ b/packages/misskey-js/src/autogen/entities.ts @@ -441,6 +441,8 @@ export type NotesSearchRequest = operations['notes___search']['requestBody']['co export type NotesSearchResponse = operations['notes___search']['responses']['200']['content']['application/json']; export type NotesShowRequest = operations['notes___show']['requestBody']['content']['application/json']; export type NotesShowResponse = operations['notes___show']['responses']['200']['content']['application/json']; +export type NotesHistoryRequest = operations['notes___history']['requestBody']['content']['application/json']; +export type NotesHistoryResponse = operations['notes___history']['responses']['200']['content']['application/json']; export type NotesStateRequest = operations['notes___state']['requestBody']['content']['application/json']; export type NotesStateResponse = operations['notes___state']['responses']['200']['content']['application/json']; export type NotesThreadMutingCreateRequest = operations['notes___thread-muting___create']['requestBody']['content']['application/json']; diff --git a/packages/misskey-js/src/autogen/models.ts b/packages/misskey-js/src/autogen/models.ts index 04574849d4..b27b896a19 100644 --- a/packages/misskey-js/src/autogen/models.ts +++ b/packages/misskey-js/src/autogen/models.ts @@ -12,6 +12,7 @@ export type Ad = components['schemas']['Ad']; export type Announcement = components['schemas']['Announcement']; export type App = components['schemas']['App']; export type Note = components['schemas']['Note']; +export type NoteHistory = components['schemas']['NoteHistory']; export type NoteReaction = components['schemas']['NoteReaction']; export type NoteFavorite = components['schemas']['NoteFavorite']; export type Notification = components['schemas']['Notification']; diff --git a/packages/misskey-js/src/autogen/types.ts b/packages/misskey-js/src/autogen/types.ts index f5903c9ea4..89fa05483f 100644 --- a/packages/misskey-js/src/autogen/types.ts +++ b/packages/misskey-js/src/autogen/types.ts @@ -2807,6 +2807,15 @@ export type paths = { */ post: operations['notes___show']; }; + '/notes/history': { + /** + * notes/history + * @description No description provided. + * + * **Credential required**: *No* + */ + post: operations['notes___history']; + }; '/notes/state': { /** * notes/state @@ -4107,6 +4116,39 @@ export type components = { clippedCount?: number; myReaction?: string | null; }; + NoteHistory: { + /** + * Format: id + * @example xxxxxxxxxx + */ + id: string; + /** + * Format: id + * @example xxxxxxxxxx + */ + targetId: string; + /** Format: date-time */ + createdAt: string; + text: string | null; + cw?: string | null; + mentions?: string[]; + fileIds?: string[]; + files?: components['schemas']['DriveFile'][]; + tags?: string[]; + poll?: ({ + /** Format: date-time */ + expiresAt?: string | null; + multiple: boolean; + choices: { + isVoted: boolean; + text: string; + votes: number; + }[]; + }) | null; + emojis?: { + [key: string]: string; + }; + }; NoteReaction: { /** * Format: id @@ -4776,6 +4818,7 @@ export type components = { gtlAvailable: boolean; ltlAvailable: boolean; canPublicNote: boolean; + canEditNote: boolean; mentionLimit: number; canInvite: boolean; inviteLimit: number; @@ -22369,6 +22412,66 @@ export type operations = { }; }; }; + /** + * notes/history + * @description No description provided. + * + * **Credential required**: *No* + */ + notes___history: { + requestBody: { + content: { + 'application/json': { + /** @default 10 */ + limit?: number; + /** Format: misskey:id */ + noteId: string; + /** Format: misskey:id */ + sinceId?: string; + /** Format: misskey:id */ + untilId?: string; + }; + }; + }; + responses: { + /** @description OK (with results) */ + 200: { + content: { + 'application/json': components['schemas']['NoteHistory'][]; + }; + }; + /** @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 Internal server error */ + 500: { + content: { + 'application/json': components['schemas']['Error']; + }; + }; + }; + }; /** * notes/state * @description No description provided.