From 82be99929f9cd7116a11e81ff424b4e95c1e96d6 Mon Sep 17 00:00:00 2001 From: Dessalines Date: Tue, 14 Jan 2025 18:00:28 -0500 Subject: [PATCH] Adding combined inbox and routes. --- src/http.ts | 102 +++++++----------- src/index.ts | 25 ++--- src/types/CommentReplyResponse.ts | 7 -- src/types/GetPersonMentions.ts | 12 --- src/types/GetPersonMentionsResponse.ts | 7 -- src/types/GetPrivateMessages.ts | 12 --- src/types/GetReplies.ts | 12 --- src/types/GetRepliesResponse.ts | 7 -- src/types/GetUnreadCountResponse.ts | 8 +- src/types/InboxCombinedPaginationCursor.ts | 6 ++ src/types/InboxCombinedView.ts | 11 ++ src/types/InboxDataType.ts | 11 ++ src/types/LemmyErrorType.ts | 2 +- src/types/ListInbox.ts | 13 +++ src/types/ListInboxResponse.ts | 7 ++ src/types/MarkPersonCommentMentionAsRead.ts | 10 ++ ...Read.ts => MarkPersonPostMentionAsRead.ts} | 6 +- ...rsonMention.ts => PersonCommentMention.ts} | 6 +- src/types/PersonCommentMentionId.ts | 6 ++ ...ionView.ts => PersonCommentMentionView.ts} | 8 +- src/types/PersonMentionResponse.ts | 7 -- src/types/PersonPostMention.ts | 15 +++ ...sonMentionId.ts => PersonPostMentionId.ts} | 4 +- src/types/PersonPostMentionView.ts | 32 ++++++ src/types/PrivateMessagesResponse.ts | 9 -- 25 files changed, 175 insertions(+), 170 deletions(-) delete mode 100644 src/types/CommentReplyResponse.ts delete mode 100644 src/types/GetPersonMentions.ts delete mode 100644 src/types/GetPersonMentionsResponse.ts delete mode 100644 src/types/GetPrivateMessages.ts delete mode 100644 src/types/GetReplies.ts delete mode 100644 src/types/GetRepliesResponse.ts create mode 100644 src/types/InboxCombinedPaginationCursor.ts create mode 100644 src/types/InboxCombinedView.ts create mode 100644 src/types/InboxDataType.ts create mode 100644 src/types/ListInbox.ts create mode 100644 src/types/ListInboxResponse.ts create mode 100644 src/types/MarkPersonCommentMentionAsRead.ts rename src/types/{MarkPersonMentionAsRead.ts => MarkPersonPostMentionAsRead.ts} (52%) rename src/types/{PersonMention.ts => PersonCommentMention.ts} (69%) create mode 100644 src/types/PersonCommentMentionId.ts rename src/types/{PersonMentionView.ts => PersonCommentMentionView.ts} (80%) delete mode 100644 src/types/PersonMentionResponse.ts create mode 100644 src/types/PersonPostMention.ts rename src/types/{PersonMentionId.ts => PersonPostMentionId.ts} (61%) create mode 100644 src/types/PersonPostMentionView.ts delete mode 100644 src/types/PrivateMessagesResponse.ts diff --git a/src/http.ts b/src/http.ts index cb4d36e..81ea6d8 100644 --- a/src/http.ts +++ b/src/http.ts @@ -14,7 +14,6 @@ import { BlockCommunityResponse } from "./types/BlockCommunityResponse"; import { BlockPerson } from "./types/BlockPerson"; import { BlockPersonResponse } from "./types/BlockPersonResponse"; import { ChangePassword } from "./types/ChangePassword"; -import { CommentReplyResponse } from "./types/CommentReplyResponse"; import { CommentReportResponse } from "./types/CommentReportResponse"; import { CommentResponse } from "./types/CommentResponse"; import { CommunityResponse } from "./types/CommunityResponse"; @@ -60,15 +59,10 @@ import { GetModlog } from "./types/GetModlog"; import { GetModlogResponse } from "./types/GetModlogResponse"; import { GetPersonDetails } from "./types/GetPersonDetails"; import { GetPersonDetailsResponse } from "./types/GetPersonDetailsResponse"; -import { GetPersonMentions } from "./types/GetPersonMentions"; -import { GetPersonMentionsResponse } from "./types/GetPersonMentionsResponse"; import { GetPost } from "./types/GetPost"; import { GetPostResponse } from "./types/GetPostResponse"; import { GetPosts } from "./types/GetPosts"; import { GetPostsResponse } from "./types/GetPostsResponse"; -import { GetPrivateMessages } from "./types/GetPrivateMessages"; -import { GetReplies } from "./types/GetReplies"; -import { GetRepliesResponse } from "./types/GetRepliesResponse"; import { GetReportCount } from "./types/GetReportCount"; import { GetReportCountResponse } from "./types/GetReportCountResponse"; import { GetSiteMetadata } from "./types/GetSiteMetadata"; @@ -84,17 +78,14 @@ import { LockPost } from "./types/LockPost"; import { Login } from "./types/Login"; import { LoginResponse } from "./types/LoginResponse"; import { MarkCommentReplyAsRead } from "./types/MarkCommentReplyAsRead"; -import { MarkPersonMentionAsRead } from "./types/MarkPersonMentionAsRead"; import { MarkPostAsRead } from "./types/MarkPostAsRead"; import { MarkPrivateMessageAsRead } from "./types/MarkPrivateMessageAsRead"; import { PasswordChangeAfterReset } from "./types/PasswordChangeAfterReset"; import { PasswordReset } from "./types/PasswordReset"; -import { PersonMentionResponse } from "./types/PersonMentionResponse"; import { PostReportResponse } from "./types/PostReportResponse"; import { PostResponse } from "./types/PostResponse"; import { PrivateMessageReportResponse } from "./types/PrivateMessageReportResponse"; import { PrivateMessageResponse } from "./types/PrivateMessageResponse"; -import { PrivateMessagesResponse } from "./types/PrivateMessagesResponse"; import { PurgeComment } from "./types/PurgeComment"; import { PurgeCommunity } from "./types/PurgeCommunity"; import { PurgePerson } from "./types/PurgePerson"; @@ -160,6 +151,10 @@ import { ListPersonSaved } from "./types/ListPersonSaved"; import { ListPersonSavedResponse } from "./types/ListPersonSavedResponse"; import { DeleteImageParams } from "./types/DeleteImageParams"; import { UploadImageResponse } from "./types/UploadImageResponse"; +import { ListInboxResponse } from "./types/ListInboxResponse"; +import { ListInbox } from "./types/ListInbox"; +import { MarkPersonCommentMentionAsRead } from "./types/MarkPersonCommentMentionAsRead"; +import { MarkPersonPostMentionAsRead } from "./types/MarkPersonPostMentionAsRead"; enum HttpType { Get = "GET", @@ -949,7 +944,7 @@ export class LemmyHttp { form: MarkCommentReplyAsRead, options?: RequestOptions, ) { - return this.#wrapper( + return this.#wrapper( HttpType.Post, "/comment/mark_as_read", form, @@ -1069,20 +1064,6 @@ export class LemmyHttp { ); } - /** - * Get / fetch private messages. - * - * `HTTP.GET /private_message/list` - */ - getPrivateMessages(form: GetPrivateMessages, options?: RequestOptions) { - return this.#wrapper( - HttpType.Get, - "/private_message/list", - form, - options, - ); - } - /** * Create a private message. * @@ -1242,60 +1223,35 @@ export class LemmyHttp { ); } - /** - * Get mentions for your user. - * - * `HTTP.GET /account/mention` - */ - getPersonMentions(form: GetPersonMentions, options?: RequestOptions) { - return this.#wrapper( - HttpType.Get, - "/account/mention", - form, - options, - ); - } - /** * Mark a person mention as read. * - * `HTTP.POST /account/mention/mark_as_read` + * `HTTP.POST /account/mention/comment/mark_as_read` */ - markPersonMentionAsRead( - form: MarkPersonMentionAsRead, + markCommentMentionAsRead( + form: MarkPersonCommentMentionAsRead, options?: RequestOptions, ) { - return this.#wrapper( + return this.#wrapper( HttpType.Post, - "/account/mention/mark_as_read", + "/account/mention/comment/mark_as_read", form, options, ); } /** - * Mark a person mention as read. + * Mark a person post body mention as read. * - * `HTTP.POST /account/mention/mark_as_read` + * `HTTP.POST /account/mention/post/mark_as_read` */ - markPersonAllMentionAsRead(options?: RequestOptions) { - return this.#wrapper( + markPostMentionAsRead( + form: MarkPersonPostMentionAsRead, + options?: RequestOptions, + ) { + return this.#wrapper( HttpType.Post, - "/account/mention/mark_as_read", - {}, - options, - ); - } - - /** - * Get comment replies. - * - * `HTTP.GET /account/replies` - */ - getReplies(form: GetReplies, options?: RequestOptions) { - return this.#wrapper( - HttpType.Get, - "/account/replies", + "/account/mention/post/mark_as_read", form, options, ); @@ -1405,12 +1361,12 @@ export class LemmyHttp { /** * Mark all replies as read. * - * `HTTP.POST /account/mention/mark_as_read/all` + * `HTTP.POST /account/mark_as_read/all` */ - markAllAsRead(options?: RequestOptions) { - return this.#wrapper( + markAllNotificationsAsRead(options?: RequestOptions) { + return this.#wrapper( HttpType.Post, - "/account/mention/mark_as_read/all", + "/account/mark_as_read/all", {}, options, ); @@ -1472,6 +1428,20 @@ export class LemmyHttp { ); } + /** + * Get your inbox (replies, comment mentions, post mentions, and messages) + * + * `HTTP.GET /account/inbox` + */ + listInbox(form: ListInbox, options?: RequestOptions) { + return this.#wrapper( + HttpType.Get, + "/account/inbox", + form, + options, + ); + } + /** * Verify your email * diff --git a/src/index.ts b/src/index.ts index 6edddaa..edca287 100644 --- a/src/index.ts +++ b/src/index.ts @@ -44,7 +44,6 @@ export { CommentAggregates } from "./types/CommentAggregates"; export { CommentId } from "./types/CommentId"; export { CommentReply } from "./types/CommentReply"; export { CommentReplyId } from "./types/CommentReplyId"; -export { CommentReplyResponse } from "./types/CommentReplyResponse"; export { CommentReplyView } from "./types/CommentReplyView"; export { CommentReport } from "./types/CommentReport"; export { CommentReportId } from "./types/CommentReportId"; @@ -122,17 +121,12 @@ export { GetModlog } from "./types/GetModlog"; export { GetModlogResponse } from "./types/GetModlogResponse"; export { GetPersonDetails } from "./types/GetPersonDetails"; export { GetPersonDetailsResponse } from "./types/GetPersonDetailsResponse"; -export { GetPersonMentions } from "./types/GetPersonMentions"; -export { GetPersonMentionsResponse } from "./types/GetPersonMentionsResponse"; export { GetPost } from "./types/GetPost"; export { GetPostResponse } from "./types/GetPostResponse"; export { GetPosts } from "./types/GetPosts"; export { GetPostsResponse } from "./types/GetPostsResponse"; -export { GetPrivateMessages } from "./types/GetPrivateMessages"; export { GetRandomCommunity } from "./types/GetRandomCommunity"; export { GetRegistrationApplication } from "./types/GetRegistrationApplication"; -export { GetReplies } from "./types/GetReplies"; -export { GetRepliesResponse } from "./types/GetRepliesResponse"; export { GetReportCount } from "./types/GetReportCount"; export { GetReportCountResponse } from "./types/GetReportCountResponse"; export { GetSiteMetadata } from "./types/GetSiteMetadata"; @@ -145,6 +139,9 @@ export { HidePost } from "./types/HidePost"; export { ImageDetails } from "./types/ImageDetails"; export { ImageGetParams } from "./types/ImageGetParams"; export { ImageProxyParams } from "./types/ImageProxyParams"; +export { InboxCombinedPaginationCursor } from "./types/InboxCombinedPaginationCursor"; +export { InboxCombinedView } from "./types/InboxCombinedView"; +export { InboxDataType } from "./types/InboxDataType"; export { Instance } from "./types/Instance"; export { InstanceId } from "./types/InstanceId"; export { InstanceWithFederationState } from "./types/InstanceWithFederationState"; @@ -160,6 +157,8 @@ export { ListCommunityPendingFollows } from "./types/ListCommunityPendingFollows export { ListCommunityPendingFollowsResponse } from "./types/ListCommunityPendingFollowsResponse"; export { ListCustomEmojis } from "./types/ListCustomEmojis"; export { ListCustomEmojisResponse } from "./types/ListCustomEmojisResponse"; +export { ListInbox } from "./types/ListInbox"; +export { ListInboxResponse } from "./types/ListInboxResponse"; export { ListLoginsResponse } from "./types/ListLoginsResponse"; export { ListMedia } from "./types/ListMedia"; export { ListMediaResponse } from "./types/ListMediaResponse"; @@ -192,7 +191,8 @@ export { LoginResponse } from "./types/LoginResponse"; export { LoginToken } from "./types/LoginToken"; export { MarkCommentReplyAsRead } from "./types/MarkCommentReplyAsRead"; export { MarkManyPostsAsRead } from "./types/MarkManyPostsAsRead"; -export { MarkPersonMentionAsRead } from "./types/MarkPersonMentionAsRead"; +export { MarkPersonCommentMentionAsRead } from "./types/MarkPersonCommentMentionAsRead"; +export { MarkPersonPostMentionAsRead } from "./types/MarkPersonPostMentionAsRead"; export { MarkPostAsRead } from "./types/MarkPostAsRead"; export { MarkPrivateMessageAsRead } from "./types/MarkPrivateMessageAsRead"; export { ModAdd } from "./types/ModAdd"; @@ -242,14 +242,16 @@ export { PasswordReset } from "./types/PasswordReset"; export { PendingFollow } from "./types/PendingFollow"; export { Person } from "./types/Person"; export { PersonAggregates } from "./types/PersonAggregates"; +export { PersonCommentMention } from "./types/PersonCommentMention"; +export { PersonCommentMentionId } from "./types/PersonCommentMentionId"; +export { PersonCommentMentionView } from "./types/PersonCommentMentionView"; export { PersonContentCombinedPaginationCursor } from "./types/PersonContentCombinedPaginationCursor"; export { PersonContentCombinedView } from "./types/PersonContentCombinedView"; export { PersonContentType } from "./types/PersonContentType"; export { PersonId } from "./types/PersonId"; -export { PersonMention } from "./types/PersonMention"; -export { PersonMentionId } from "./types/PersonMentionId"; -export { PersonMentionResponse } from "./types/PersonMentionResponse"; -export { PersonMentionView } from "./types/PersonMentionView"; +export { PersonPostMention } from "./types/PersonPostMention"; +export { PersonPostMentionId } from "./types/PersonPostMentionId"; +export { PersonPostMentionView } from "./types/PersonPostMentionView"; export { PersonSavedCombinedPaginationCursor } from "./types/PersonSavedCombinedPaginationCursor"; export { PersonView } from "./types/PersonView"; export { Post } from "./types/Post"; @@ -273,7 +275,6 @@ export { PrivateMessageReportResponse } from "./types/PrivateMessageReportRespon export { PrivateMessageReportView } from "./types/PrivateMessageReportView"; export { PrivateMessageResponse } from "./types/PrivateMessageResponse"; export { PrivateMessageView } from "./types/PrivateMessageView"; -export { PrivateMessagesResponse } from "./types/PrivateMessagesResponse"; export { PublicOAuthProvider } from "./types/PublicOAuthProvider"; export { PurgeComment } from "./types/PurgeComment"; export { PurgeCommunity } from "./types/PurgeCommunity"; diff --git a/src/types/CommentReplyResponse.ts b/src/types/CommentReplyResponse.ts deleted file mode 100644 index 40c58a7..0000000 --- a/src/types/CommentReplyResponse.ts +++ /dev/null @@ -1,7 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { CommentReplyView } from "./CommentReplyView"; - -/** - * The response for a comment reply action. - */ -export type CommentReplyResponse = { comment_reply_view: CommentReplyView }; diff --git a/src/types/GetPersonMentions.ts b/src/types/GetPersonMentions.ts deleted file mode 100644 index 82153c2..0000000 --- a/src/types/GetPersonMentions.ts +++ /dev/null @@ -1,12 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { CommentSortType } from "./CommentSortType"; - -/** - * Get mentions for your user. - */ -export type GetPersonMentions = { - sort?: CommentSortType; - page?: number; - limit?: number; - unread_only?: boolean; -}; diff --git a/src/types/GetPersonMentionsResponse.ts b/src/types/GetPersonMentionsResponse.ts deleted file mode 100644 index 5331356..0000000 --- a/src/types/GetPersonMentionsResponse.ts +++ /dev/null @@ -1,7 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { PersonMentionView } from "./PersonMentionView"; - -/** - * The response of mentions for your user. - */ -export type GetPersonMentionsResponse = { mentions: Array }; diff --git a/src/types/GetPrivateMessages.ts b/src/types/GetPrivateMessages.ts deleted file mode 100644 index 2e8aa60..0000000 --- a/src/types/GetPrivateMessages.ts +++ /dev/null @@ -1,12 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { PersonId } from "./PersonId"; - -/** - * Get your private messages. - */ -export type GetPrivateMessages = { - unread_only?: boolean; - page?: number; - limit?: number; - creator_id?: PersonId; -}; diff --git a/src/types/GetReplies.ts b/src/types/GetReplies.ts deleted file mode 100644 index 49c1c37..0000000 --- a/src/types/GetReplies.ts +++ /dev/null @@ -1,12 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { CommentSortType } from "./CommentSortType"; - -/** - * Get comment replies. - */ -export type GetReplies = { - sort?: CommentSortType; - page?: number; - limit?: number; - unread_only?: boolean; -}; diff --git a/src/types/GetRepliesResponse.ts b/src/types/GetRepliesResponse.ts deleted file mode 100644 index 64b1200..0000000 --- a/src/types/GetRepliesResponse.ts +++ /dev/null @@ -1,7 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { CommentReplyView } from "./CommentReplyView"; - -/** - * Fetches your replies. - */ -export type GetRepliesResponse = { replies: Array }; diff --git a/src/types/GetUnreadCountResponse.ts b/src/types/GetUnreadCountResponse.ts index e9a9dc6..f5e4459 100644 --- a/src/types/GetUnreadCountResponse.ts +++ b/src/types/GetUnreadCountResponse.ts @@ -1,10 +1,6 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. /** - * A response containing counts for your notifications. + * A response containing a count of unread notifications. */ -export type GetUnreadCountResponse = { - replies: number; - mentions: number; - private_messages: number; -}; +export type GetUnreadCountResponse = { count: number }; diff --git a/src/types/InboxCombinedPaginationCursor.ts b/src/types/InboxCombinedPaginationCursor.ts new file mode 100644 index 0000000..6244d69 --- /dev/null +++ b/src/types/InboxCombinedPaginationCursor.ts @@ -0,0 +1,6 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +/** + * like PaginationCursor but for the report_combined table + */ +export type InboxCombinedPaginationCursor = string; diff --git a/src/types/InboxCombinedView.ts b/src/types/InboxCombinedView.ts new file mode 100644 index 0000000..0178a4f --- /dev/null +++ b/src/types/InboxCombinedView.ts @@ -0,0 +1,11 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { CommentReplyView } from "./CommentReplyView"; +import type { PersonCommentMentionView } from "./PersonCommentMentionView"; +import type { PersonPostMentionView } from "./PersonPostMentionView"; +import type { PrivateMessageView } from "./PrivateMessageView"; + +export type InboxCombinedView = + | ({ type_: "CommentReply" } & CommentReplyView) + | ({ type_: "CommentMention" } & PersonCommentMentionView) + | ({ type_: "PostMention" } & PersonPostMentionView) + | ({ type_: "PrivateMessage" } & PrivateMessageView); diff --git a/src/types/InboxDataType.ts b/src/types/InboxDataType.ts new file mode 100644 index 0000000..392e942 --- /dev/null +++ b/src/types/InboxDataType.ts @@ -0,0 +1,11 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +/** + * A list of possible types for the inbox. + */ +export type InboxDataType = + | "All" + | "CommentReply" + | "CommentMention" + | "PostMention" + | "PrivateMessage"; diff --git a/src/types/LemmyErrorType.ts b/src/types/LemmyErrorType.ts index 5b9e0df..acd7c8f 100644 --- a/src/types/LemmyErrorType.ts +++ b/src/types/LemmyErrorType.ts @@ -98,7 +98,7 @@ export type LemmyErrorType = | { error: "couldnt_hide_post" } | { error: "couldnt_update_community" } | { error: "couldnt_update_replies" } - | { error: "couldnt_update_person_mentions" } + | { error: "couldnt_update_person_comment_mentions" } | { error: "couldnt_create_post" } | { error: "couldnt_create_private_message" } | { error: "couldnt_update_private" } diff --git a/src/types/ListInbox.ts b/src/types/ListInbox.ts new file mode 100644 index 0000000..7aefafd --- /dev/null +++ b/src/types/ListInbox.ts @@ -0,0 +1,13 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { InboxCombinedPaginationCursor } from "./InboxCombinedPaginationCursor"; +import type { InboxDataType } from "./InboxDataType"; + +/** + * Get your inbox (replies, comment mentions, post mentions, and messages) + */ +export type ListInbox = { + type_?: InboxDataType; + unread_only?: boolean; + page_cursor?: InboxCombinedPaginationCursor; + page_back?: boolean; +}; diff --git a/src/types/ListInboxResponse.ts b/src/types/ListInboxResponse.ts new file mode 100644 index 0000000..4afe7b0 --- /dev/null +++ b/src/types/ListInboxResponse.ts @@ -0,0 +1,7 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { InboxCombinedView } from "./InboxCombinedView"; + +/** + * Get your inbox (replies, comment mentions, post mentions, and messages) + */ +export type ListInboxResponse = { inbox: Array }; diff --git a/src/types/MarkPersonCommentMentionAsRead.ts b/src/types/MarkPersonCommentMentionAsRead.ts new file mode 100644 index 0000000..4a302e2 --- /dev/null +++ b/src/types/MarkPersonCommentMentionAsRead.ts @@ -0,0 +1,10 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { PersonCommentMentionId } from "./PersonCommentMentionId"; + +/** + * Mark a person mention as read. + */ +export type MarkPersonCommentMentionAsRead = { + person_comment_mention_id: PersonCommentMentionId; + read: boolean; +}; diff --git a/src/types/MarkPersonMentionAsRead.ts b/src/types/MarkPersonPostMentionAsRead.ts similarity index 52% rename from src/types/MarkPersonMentionAsRead.ts rename to src/types/MarkPersonPostMentionAsRead.ts index 98b94c9..3606d1d 100644 --- a/src/types/MarkPersonMentionAsRead.ts +++ b/src/types/MarkPersonPostMentionAsRead.ts @@ -1,10 +1,10 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { PersonMentionId } from "./PersonMentionId"; +import type { PersonPostMentionId } from "./PersonPostMentionId"; /** * Mark a person mention as read. */ -export type MarkPersonMentionAsRead = { - person_mention_id: PersonMentionId; +export type MarkPersonPostMentionAsRead = { + person_post_mention_id: PersonPostMentionId; read: boolean; }; diff --git a/src/types/PersonMention.ts b/src/types/PersonCommentMention.ts similarity index 69% rename from src/types/PersonMention.ts rename to src/types/PersonCommentMention.ts index 7c9e9c6..ab0c561 100644 --- a/src/types/PersonMention.ts +++ b/src/types/PersonCommentMention.ts @@ -1,13 +1,13 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. import type { CommentId } from "./CommentId"; +import type { PersonCommentMentionId } from "./PersonCommentMentionId"; import type { PersonId } from "./PersonId"; -import type { PersonMentionId } from "./PersonMentionId"; /** * A person mention. */ -export type PersonMention = { - id: PersonMentionId; +export type PersonCommentMention = { + id: PersonCommentMentionId; recipient_id: PersonId; comment_id: CommentId; read: boolean; diff --git a/src/types/PersonCommentMentionId.ts b/src/types/PersonCommentMentionId.ts new file mode 100644 index 0000000..65225f1 --- /dev/null +++ b/src/types/PersonCommentMentionId.ts @@ -0,0 +1,6 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +/** + * The person comment mention id. + */ +export type PersonCommentMentionId = number; diff --git a/src/types/PersonMentionView.ts b/src/types/PersonCommentMentionView.ts similarity index 80% rename from src/types/PersonMentionView.ts rename to src/types/PersonCommentMentionView.ts index 83df6ae..7dfc764 100644 --- a/src/types/PersonMentionView.ts +++ b/src/types/PersonCommentMentionView.ts @@ -3,15 +3,15 @@ import type { Comment } from "./Comment"; import type { CommentAggregates } from "./CommentAggregates"; import type { Community } from "./Community"; import type { Person } from "./Person"; -import type { PersonMention } from "./PersonMention"; +import type { PersonCommentMention } from "./PersonCommentMention"; import type { Post } from "./Post"; import type { SubscribedType } from "./SubscribedType"; /** - * A person mention view. + * A person comment mention view. */ -export type PersonMentionView = { - person_mention: PersonMention; +export type PersonCommentMentionView = { + person_comment_mention: PersonCommentMention; comment: Comment; creator: Person; post: Post; diff --git a/src/types/PersonMentionResponse.ts b/src/types/PersonMentionResponse.ts deleted file mode 100644 index f097510..0000000 --- a/src/types/PersonMentionResponse.ts +++ /dev/null @@ -1,7 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { PersonMentionView } from "./PersonMentionView"; - -/** - * The response for a person mention action. - */ -export type PersonMentionResponse = { person_mention_view: PersonMentionView }; diff --git a/src/types/PersonPostMention.ts b/src/types/PersonPostMention.ts new file mode 100644 index 0000000..5b57048 --- /dev/null +++ b/src/types/PersonPostMention.ts @@ -0,0 +1,15 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { PersonId } from "./PersonId"; +import type { PersonPostMentionId } from "./PersonPostMentionId"; +import type { PostId } from "./PostId"; + +/** + * A person mention. + */ +export type PersonPostMention = { + id: PersonPostMentionId; + recipient_id: PersonId; + post_id: PostId; + read: boolean; + published: string; +}; diff --git a/src/types/PersonMentionId.ts b/src/types/PersonPostMentionId.ts similarity index 61% rename from src/types/PersonMentionId.ts rename to src/types/PersonPostMentionId.ts index 4341f87..ace55aa 100644 --- a/src/types/PersonMentionId.ts +++ b/src/types/PersonPostMentionId.ts @@ -1,6 +1,6 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. /** - * The person mention id. + * The person post mention id. */ -export type PersonMentionId = number; +export type PersonPostMentionId = number; diff --git a/src/types/PersonPostMentionView.ts b/src/types/PersonPostMentionView.ts new file mode 100644 index 0000000..8626208 --- /dev/null +++ b/src/types/PersonPostMentionView.ts @@ -0,0 +1,32 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { Community } from "./Community"; +import type { ImageDetails } from "./ImageDetails"; +import type { Person } from "./Person"; +import type { PersonPostMention } from "./PersonPostMention"; +import type { Post } from "./Post"; +import type { PostAggregates } from "./PostAggregates"; +import type { SubscribedType } from "./SubscribedType"; + +/** + * A person post mention view. + */ +export type PersonPostMentionView = { + person_post_mention: PersonPostMention; + post: Post; + creator: Person; + community: Community; + image_details?: ImageDetails; + recipient: Person; + counts: PostAggregates; + creator_banned_from_community: boolean; + banned_from_community: boolean; + creator_is_moderator: boolean; + creator_is_admin: boolean; + subscribed: SubscribedType; + saved: boolean; + read: boolean; + hidden: boolean; + creator_blocked: boolean; + my_vote?: number; + unread_comments: number; +}; diff --git a/src/types/PrivateMessagesResponse.ts b/src/types/PrivateMessagesResponse.ts deleted file mode 100644 index 948e412..0000000 --- a/src/types/PrivateMessagesResponse.ts +++ /dev/null @@ -1,9 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { PrivateMessageView } from "./PrivateMessageView"; - -/** - * The private messages response. - */ -export type PrivateMessagesResponse = { - private_messages: Array; -};