From 7cb160611627633e90082a69d2f6106fa0e4f891 Mon Sep 17 00:00:00 2001 From: phiresky Date: Fri, 7 Feb 2025 22:14:19 +0100 Subject: [PATCH 1/2] add post tags functions --- copy_generated_types_from_lemmy.sh | 2 +- src/http.ts | 98 ++++++++++++++++++++++++++ src/index.ts | 7 ++ src/types/CommunityTagResponse.ts | 9 +++ src/types/CreateCommunityTag.ts | 11 +++ src/types/DeleteCommunityTag.ts | 7 ++ src/types/EditPost.ts | 2 - src/types/ListCommunityTags.ts | 7 ++ src/types/ListCommunityTagsResponse.ts | 4 ++ src/types/PostTags.ts | 2 +- src/types/UpdateCommunityTag.ts | 7 ++ src/types/UpdatePostTags.ts | 8 +++ tsconfig.json | 2 +- 13 files changed, 161 insertions(+), 5 deletions(-) create mode 100644 src/types/CommunityTagResponse.ts create mode 100644 src/types/CreateCommunityTag.ts create mode 100644 src/types/DeleteCommunityTag.ts create mode 100644 src/types/ListCommunityTags.ts create mode 100644 src/types/ListCommunityTagsResponse.ts create mode 100644 src/types/UpdateCommunityTag.ts create mode 100644 src/types/UpdatePostTags.ts diff --git a/copy_generated_types_from_lemmy.sh b/copy_generated_types_from_lemmy.sh index a8955284..5b045584 100755 --- a/copy_generated_types_from_lemmy.sh +++ b/copy_generated_types_from_lemmy.sh @@ -35,5 +35,5 @@ find src/types -type f -name '*.ts' -exec sed -i 's/bigint/number/g' {} + node putTypesInIndex.js -prettier -w src +pnpm prettier -w src diff --git a/src/http.ts b/src/http.ts index 06bb90cb..7c7c5764 100644 --- a/src/http.ts +++ b/src/http.ts @@ -21,6 +21,7 @@ import { CreateComment } from "./types/CreateComment"; import { CreateCommentLike } from "./types/CreateCommentLike"; import { CreateCommentReport } from "./types/CreateCommentReport"; import { CreateCommunity } from "./types/CreateCommunity"; +import { CreateCommunityTag } from "./types/CreateCommunityTag"; import { CreateCustomEmoji } from "./types/CreateCustomEmoji"; import { CreateOAuthProvider } from "./types/CreateOAuthProvider"; import { CreatePost } from "./types/CreatePost"; @@ -33,6 +34,7 @@ import { CustomEmojiResponse } from "./types/CustomEmojiResponse"; import { DeleteAccount } from "./types/DeleteAccount"; import { DeleteComment } from "./types/DeleteComment"; import { DeleteCommunity } from "./types/DeleteCommunity"; +import { DeleteCommunityTag } from "./types/DeleteCommunityTag"; import { DeleteCustomEmoji } from "./types/DeleteCustomEmoji"; import { DeleteOAuthProvider } from "./types/DeleteOAuthProvider"; import { DeletePost } from "./types/DeletePost"; @@ -72,6 +74,8 @@ import { GetUnreadCountResponse } from "./types/GetUnreadCountResponse"; import { GetUnreadRegistrationApplicationCountResponse } from "./types/GetUnreadRegistrationApplicationCountResponse"; import { ListCommunities } from "./types/ListCommunities"; import { ListCommunitiesResponse } from "./types/ListCommunitiesResponse"; +import { ListCommunityTags } from "./types/ListCommunityTags"; +import { ListCommunityTagsResponse } from "./types/ListCommunityTagsResponse"; import { ListRegistrationApplications } from "./types/ListRegistrationApplications"; import { ListRegistrationApplicationsResponse } from "./types/ListRegistrationApplicationsResponse"; import { LockPost } from "./types/LockPost"; @@ -107,6 +111,8 @@ import { Search } from "./types/Search"; import { SearchResponse } from "./types/SearchResponse"; import { SiteResponse } from "./types/SiteResponse"; import { TransferCommunity } from "./types/TransferCommunity"; +import { UpdateCommunityTag } from "./types/UpdateCommunityTag"; +import { UpdatePostTags } from "./types/UpdatePostTags"; import { VerifyEmail } from "./types/VerifyEmail"; import { DeleteImageParamsI, @@ -199,6 +205,7 @@ import { Security, Tags, } from "tsoa"; +import { CommunityTagResponse } from "./types/CommunityTagResponse"; enum HttpType { Get = "GET", @@ -2068,6 +2075,97 @@ export class LemmyHttp extends Controller { ); } + /** + * @summary Create a community tag. + */ + @Security("bearerAuth") + @Post("/community/post_tag") + @Tags("Community") + createCommunityTag( + @Body() form: CreateCommunityTag, + @Inject() options?: RequestOptions, + ) { + return this.#wrapper( + HttpType.Post, + "/community/post_tag", + form, + options, + ); + } + + /** + * @summary Update a community tag. + */ + @Security("bearerAuth") + @Put("/community/post_tag") + @Tags("Community") + updateCommunityTag( + @Body() form: UpdateCommunityTag, + @Inject() options?: RequestOptions, + ) { + return this.#wrapper( + HttpType.Put, + "/community/post_tag", + form, + options, + ); + } + + /** + * @summary List community tags. + */ + @Security("bearerAuth") + @Security({}) + @Get("/community/post_tag/list") + @Tags("Community") + listCommunityTags( + @Queries() form: ListCommunityTags, + @Inject() options?: RequestOptions, + ) { + return this.#wrapper( + HttpType.Get, + "/community/post_tag/list", + form, + options, + ); + } + + /** + * @summary Delete a community tag. + */ + @Security("bearerAuth") + @Post("/community/post_tag") + @Tags("Community") + deleteCommunityTag( + @Body() form: DeleteCommunityTag, + @Inject() options?: RequestOptions, + ) { + return this.#wrapper( + HttpType.Delete, + "/community/post_tag", + form, + options, + ); + } + + /** + * @summary Update post tags. + */ + @Security("bearerAuth") + @Put("/post/tags") + @Tags("Post") + updatePostTags( + @Body() form: UpdatePostTags, + @Inject() options?: RequestOptions, + ) { + return this.#wrapper( + HttpType.Put, + "/post/tags", + form, + options, + ); + } + /** * @summary Create a new oauth provider method */ diff --git a/src/index.ts b/src/index.ts index e6f5c5b2..01baf29e 100644 --- a/src/index.ts +++ b/src/index.ts @@ -64,12 +64,14 @@ export { CommunityReportId } from "./types/CommunityReportId"; export { CommunityReportView } from "./types/CommunityReportView"; export { CommunityResponse } from "./types/CommunityResponse"; export { CommunitySortType } from "./types/CommunitySortType"; +export { CommunityTagResponse } from "./types/CommunityTagResponse"; export { CommunityView } from "./types/CommunityView"; export { CommunityVisibility } from "./types/CommunityVisibility"; export { CreateComment } from "./types/CreateComment"; export { CreateCommentLike } from "./types/CreateCommentLike"; export { CreateCommentReport } from "./types/CreateCommentReport"; export { CreateCommunity } from "./types/CreateCommunity"; +export { CreateCommunityTag } from "./types/CreateCommunityTag"; export { CreateCustomEmoji } from "./types/CreateCustomEmoji"; export { CreateOAuthProvider } from "./types/CreateOAuthProvider"; export { CreatePost } from "./types/CreatePost"; @@ -88,6 +90,7 @@ export { DbUrl } from "./types/DbUrl"; export { DeleteAccount } from "./types/DeleteAccount"; export { DeleteComment } from "./types/DeleteComment"; export { DeleteCommunity } from "./types/DeleteCommunity"; +export { DeleteCommunityTag } from "./types/DeleteCommunityTag"; export { DeleteCustomEmoji } from "./types/DeleteCustomEmoji"; export { DeleteImageParams } from "./types/DeleteImageParams"; export { DeleteOAuthProvider } from "./types/DeleteOAuthProvider"; @@ -157,6 +160,8 @@ export { ListCommunities } from "./types/ListCommunities"; export { ListCommunitiesResponse } from "./types/ListCommunitiesResponse"; export { ListCommunityPendingFollows } from "./types/ListCommunityPendingFollows"; export { ListCommunityPendingFollowsResponse } from "./types/ListCommunityPendingFollowsResponse"; +export { ListCommunityTags } from "./types/ListCommunityTags"; +export { ListCommunityTagsResponse } from "./types/ListCommunityTagsResponse"; export { ListCustomEmojis } from "./types/ListCustomEmojis"; export { ListCustomEmojisResponse } from "./types/ListCustomEmojisResponse"; export { ListInbox } from "./types/ListInbox"; @@ -323,6 +328,8 @@ export { Tagline } from "./types/Tagline"; export { TaglineId } from "./types/TaglineId"; export { TaglineResponse } from "./types/TaglineResponse"; export { TransferCommunity } from "./types/TransferCommunity"; +export { UpdateCommunityTag } from "./types/UpdateCommunityTag"; +export { UpdatePostTags } from "./types/UpdatePostTags"; export { UpdateTagline } from "./types/UpdateTagline"; export { UpdateTotp } from "./types/UpdateTotp"; export { UpdateTotpResponse } from "./types/UpdateTotpResponse"; diff --git a/src/types/CommunityTagResponse.ts b/src/types/CommunityTagResponse.ts new file mode 100644 index 00000000..e6022019 --- /dev/null +++ b/src/types/CommunityTagResponse.ts @@ -0,0 +1,9 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { CommunityId } from "./CommunityId"; +import type { TagId } from "./TagId"; + +export type CommunityTagResponse = { + id: TagId; + name: string; + community_id: CommunityId; +}; diff --git a/src/types/CreateCommunityTag.ts b/src/types/CreateCommunityTag.ts new file mode 100644 index 00000000..59f5932a --- /dev/null +++ b/src/types/CreateCommunityTag.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 { CommunityId } from "./CommunityId"; + +/** + * Create a tag for a community. + */ +export type CreateCommunityTag = { + community_id: CommunityId; + id_slug: string; + name: string; +}; diff --git a/src/types/DeleteCommunityTag.ts b/src/types/DeleteCommunityTag.ts new file mode 100644 index 00000000..9c0e505f --- /dev/null +++ b/src/types/DeleteCommunityTag.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 { TagId } from "./TagId"; + +/** + * Delete a community tag. + */ +export type DeleteCommunityTag = { tag_id: TagId }; diff --git a/src/types/EditPost.ts b/src/types/EditPost.ts index a70e2b65..6b1f37d4 100644 --- a/src/types/EditPost.ts +++ b/src/types/EditPost.ts @@ -1,7 +1,6 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. import type { LanguageId } from "./LanguageId"; import type { PostId } from "./PostId"; -import type { TagId } from "./TagId"; /** * Edit a post. @@ -24,7 +23,6 @@ export type EditPost = { * Instead of fetching a thumbnail, use a custom one. */ custom_thumbnail?: string; - tags?: Array; /** * Time when this post should be scheduled. Null means publish immediately. */ diff --git a/src/types/ListCommunityTags.ts b/src/types/ListCommunityTags.ts new file mode 100644 index 00000000..bdf4f972 --- /dev/null +++ b/src/types/ListCommunityTags.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 { CommunityId } from "./CommunityId"; + +/** + * List tags for a community. + */ +export type ListCommunityTags = { community_id: CommunityId }; diff --git a/src/types/ListCommunityTagsResponse.ts b/src/types/ListCommunityTagsResponse.ts new file mode 100644 index 00000000..3b51b712 --- /dev/null +++ b/src/types/ListCommunityTagsResponse.ts @@ -0,0 +1,4 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { CommunityTagResponse } from "./CommunityTagResponse"; + +export type ListCommunityTagsResponse = { tags: Array }; diff --git a/src/types/PostTags.ts b/src/types/PostTags.ts index 4c88826f..58896467 100644 --- a/src/types/PostTags.ts +++ b/src/types/PostTags.ts @@ -4,4 +4,4 @@ import type { Tag } from "./Tag"; /** * we wrap this in a struct so we can implement FromSqlRow for it */ -export type PostTags = { tags: Array }; +export type PostTags = Array; diff --git a/src/types/UpdateCommunityTag.ts b/src/types/UpdateCommunityTag.ts new file mode 100644 index 00000000..efe88a69 --- /dev/null +++ b/src/types/UpdateCommunityTag.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 { TagId } from "./TagId"; + +/** + * Update a community tag. + */ +export type UpdateCommunityTag = { tag_id: TagId; name: string }; diff --git a/src/types/UpdatePostTags.ts b/src/types/UpdatePostTags.ts new file mode 100644 index 00000000..51cf8b73 --- /dev/null +++ b/src/types/UpdatePostTags.ts @@ -0,0 +1,8 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { PostId } from "./PostId"; +import type { TagId } from "./TagId"; + +/** + * Update tags for a post. + */ +export type UpdatePostTags = { post_id: PostId; tags: Array }; diff --git a/tsconfig.json b/tsconfig.json index d9c7f76e..c1275523 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -6,7 +6,7 @@ "noImplicitAny": true, "lib": ["es2017", "es7", "es6", "dom"], "outDir": "./dist", - "target": "ES2015", + "target": "ES2020", "experimentalDecorators": true, "strictNullChecks": true, "moduleResolution": "Node", From 1cd1a9dff1c113834cb72255ac6407baa32a94c9 Mon Sep 17 00:00:00 2001 From: phiresky Date: Tue, 11 Feb 2025 16:56:06 +0100 Subject: [PATCH 2/2] update --- src/http.ts | 54 ++++---------------------- src/index.ts | 6 +-- src/types/CommentView.ts | 2 +- src/types/CommunitySortType.ts | 26 +++++-------- src/types/CommunityTagResponse.ts | 9 ----- src/types/CommunityView.ts | 2 + src/types/CreateCommunityTag.ts | 6 +-- src/types/EditPost.ts | 2 + src/types/ListCommunityTags.ts | 7 ---- src/types/ListCommunityTagsResponse.ts | 4 -- src/types/PersonPostMentionView.ts | 4 +- src/types/PostView.ts | 6 +-- src/types/{PostTags.ts => TagsView.ts} | 2 +- src/types/UpdatePostTags.ts | 8 ---- 14 files changed, 29 insertions(+), 109 deletions(-) delete mode 100644 src/types/CommunityTagResponse.ts delete mode 100644 src/types/ListCommunityTags.ts delete mode 100644 src/types/ListCommunityTagsResponse.ts rename src/types/{PostTags.ts => TagsView.ts} (86%) delete mode 100644 src/types/UpdatePostTags.ts diff --git a/src/http.ts b/src/http.ts index 7c7c5764..a56d3302 100644 --- a/src/http.ts +++ b/src/http.ts @@ -74,8 +74,6 @@ import { GetUnreadCountResponse } from "./types/GetUnreadCountResponse"; import { GetUnreadRegistrationApplicationCountResponse } from "./types/GetUnreadRegistrationApplicationCountResponse"; import { ListCommunities } from "./types/ListCommunities"; import { ListCommunitiesResponse } from "./types/ListCommunitiesResponse"; -import { ListCommunityTags } from "./types/ListCommunityTags"; -import { ListCommunityTagsResponse } from "./types/ListCommunityTagsResponse"; import { ListRegistrationApplications } from "./types/ListRegistrationApplications"; import { ListRegistrationApplicationsResponse } from "./types/ListRegistrationApplicationsResponse"; import { LockPost } from "./types/LockPost"; @@ -112,7 +110,6 @@ import { SearchResponse } from "./types/SearchResponse"; import { SiteResponse } from "./types/SiteResponse"; import { TransferCommunity } from "./types/TransferCommunity"; import { UpdateCommunityTag } from "./types/UpdateCommunityTag"; -import { UpdatePostTags } from "./types/UpdatePostTags"; import { VerifyEmail } from "./types/VerifyEmail"; import { DeleteImageParamsI, @@ -205,7 +202,7 @@ import { Security, Tags, } from "tsoa"; -import { CommunityTagResponse } from "./types/CommunityTagResponse"; +import { Tag } from "./types/Tag"; enum HttpType { Get = "GET", @@ -2076,7 +2073,7 @@ export class LemmyHttp extends Controller { } /** - * @summary Create a community tag. + * @summary Create a community post tag. */ @Security("bearerAuth") @Post("/community/post_tag") @@ -2085,7 +2082,7 @@ export class LemmyHttp extends Controller { @Body() form: CreateCommunityTag, @Inject() options?: RequestOptions, ) { - return this.#wrapper( + return this.#wrapper( HttpType.Post, "/community/post_tag", form, @@ -2094,7 +2091,7 @@ export class LemmyHttp extends Controller { } /** - * @summary Update a community tag. + * @summary Update a community post tag. */ @Security("bearerAuth") @Put("/community/post_tag") @@ -2103,7 +2100,7 @@ export class LemmyHttp extends Controller { @Body() form: UpdateCommunityTag, @Inject() options?: RequestOptions, ) { - return this.#wrapper( + return this.#wrapper( HttpType.Put, "/community/post_tag", form, @@ -2112,26 +2109,7 @@ export class LemmyHttp extends Controller { } /** - * @summary List community tags. - */ - @Security("bearerAuth") - @Security({}) - @Get("/community/post_tag/list") - @Tags("Community") - listCommunityTags( - @Queries() form: ListCommunityTags, - @Inject() options?: RequestOptions, - ) { - return this.#wrapper( - HttpType.Get, - "/community/post_tag/list", - form, - options, - ); - } - - /** - * @summary Delete a community tag. + * @summary Delete a post tag in a community. */ @Security("bearerAuth") @Post("/community/post_tag") @@ -2140,7 +2118,7 @@ export class LemmyHttp extends Controller { @Body() form: DeleteCommunityTag, @Inject() options?: RequestOptions, ) { - return this.#wrapper( + return this.#wrapper( HttpType.Delete, "/community/post_tag", form, @@ -2148,24 +2126,6 @@ export class LemmyHttp extends Controller { ); } - /** - * @summary Update post tags. - */ - @Security("bearerAuth") - @Put("/post/tags") - @Tags("Post") - updatePostTags( - @Body() form: UpdatePostTags, - @Inject() options?: RequestOptions, - ) { - return this.#wrapper( - HttpType.Put, - "/post/tags", - form, - options, - ); - } - /** * @summary Create a new oauth provider method */ diff --git a/src/index.ts b/src/index.ts index 01baf29e..e89cc09e 100644 --- a/src/index.ts +++ b/src/index.ts @@ -64,7 +64,6 @@ export { CommunityReportId } from "./types/CommunityReportId"; export { CommunityReportView } from "./types/CommunityReportView"; export { CommunityResponse } from "./types/CommunityResponse"; export { CommunitySortType } from "./types/CommunitySortType"; -export { CommunityTagResponse } from "./types/CommunityTagResponse"; export { CommunityView } from "./types/CommunityView"; export { CommunityVisibility } from "./types/CommunityVisibility"; export { CreateComment } from "./types/CreateComment"; @@ -160,8 +159,6 @@ export { ListCommunities } from "./types/ListCommunities"; export { ListCommunitiesResponse } from "./types/ListCommunitiesResponse"; export { ListCommunityPendingFollows } from "./types/ListCommunityPendingFollows"; export { ListCommunityPendingFollowsResponse } from "./types/ListCommunityPendingFollowsResponse"; -export { ListCommunityTags } from "./types/ListCommunityTags"; -export { ListCommunityTagsResponse } from "./types/ListCommunityTagsResponse"; export { ListCustomEmojis } from "./types/ListCustomEmojis"; export { ListCustomEmojisResponse } from "./types/ListCustomEmojisResponse"; export { ListInbox } from "./types/ListInbox"; @@ -272,7 +269,6 @@ export { PostReportResponse } from "./types/PostReportResponse"; export { PostReportView } from "./types/PostReportView"; export { PostResponse } from "./types/PostResponse"; export { PostSortType } from "./types/PostSortType"; -export { PostTags } from "./types/PostTags"; export { PostView } from "./types/PostView"; export { PrivateMessage } from "./types/PrivateMessage"; export { PrivateMessageId } from "./types/PrivateMessageId"; @@ -327,9 +323,9 @@ export { TagId } from "./types/TagId"; export { Tagline } from "./types/Tagline"; export { TaglineId } from "./types/TaglineId"; export { TaglineResponse } from "./types/TaglineResponse"; +export { TagsView } from "./types/TagsView"; export { TransferCommunity } from "./types/TransferCommunity"; export { UpdateCommunityTag } from "./types/UpdateCommunityTag"; -export { UpdatePostTags } from "./types/UpdatePostTags"; export { UpdateTagline } from "./types/UpdateTagline"; export { UpdateTotp } from "./types/UpdateTotp"; export { UpdateTotpResponse } from "./types/UpdateTotpResponse"; diff --git a/src/types/CommentView.ts b/src/types/CommentView.ts index 43090872..56812a6f 100644 --- a/src/types/CommentView.ts +++ b/src/types/CommentView.ts @@ -20,7 +20,7 @@ export type CommentView = { creator_is_moderator: boolean; creator_is_admin: boolean; subscribed: SubscribedType; - saved: boolean; + saved?: string; creator_blocked: boolean; my_vote?: number; }; diff --git a/src/types/CommunitySortType.ts b/src/types/CommunitySortType.ts index 951895b7..e7606216 100644 --- a/src/types/CommunitySortType.ts +++ b/src/types/CommunitySortType.ts @@ -4,24 +4,16 @@ * The community sort types. See here for descriptions: https://join-lemmy.org/docs/en/users/03-votes-and-ranking.html */ export type CommunitySortType = - | "Active" + | "ActiveSixMonths" + | "ActiveMonthly" + | "ActiveWeekly" + | "ActiveDaily" | "Hot" | "New" | "Old" - | "TopDay" - | "TopWeek" - | "TopMonth" - | "TopYear" - | "TopAll" - | "MostComments" - | "NewComments" - | "TopHour" - | "TopSixHour" - | "TopTwelveHour" - | "TopThreeMonths" - | "TopSixMonths" - | "TopNineMonths" - | "Controversial" - | "Scaled" | "NameAsc" - | "NameDesc"; + | "NameDesc" + | "Comments" + | "Posts" + | "Subscribers" + | "SubscribersLocal"; diff --git a/src/types/CommunityTagResponse.ts b/src/types/CommunityTagResponse.ts deleted file mode 100644 index e6022019..00000000 --- a/src/types/CommunityTagResponse.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 { CommunityId } from "./CommunityId"; -import type { TagId } from "./TagId"; - -export type CommunityTagResponse = { - id: TagId; - name: string; - community_id: CommunityId; -}; diff --git a/src/types/CommunityView.ts b/src/types/CommunityView.ts index f3ead03f..fc6085b0 100644 --- a/src/types/CommunityView.ts +++ b/src/types/CommunityView.ts @@ -2,6 +2,7 @@ import type { Community } from "./Community"; import type { CommunityAggregates } from "./CommunityAggregates"; import type { SubscribedType } from "./SubscribedType"; +import type { TagsView } from "./TagsView"; /** * A community view. @@ -12,4 +13,5 @@ export type CommunityView = { blocked: boolean; counts: CommunityAggregates; banned_from_community: boolean; + post_tags: TagsView; }; diff --git a/src/types/CreateCommunityTag.ts b/src/types/CreateCommunityTag.ts index 59f5932a..b8670348 100644 --- a/src/types/CreateCommunityTag.ts +++ b/src/types/CreateCommunityTag.ts @@ -4,8 +4,4 @@ import type { CommunityId } from "./CommunityId"; /** * Create a tag for a community. */ -export type CreateCommunityTag = { - community_id: CommunityId; - id_slug: string; - name: string; -}; +export type CreateCommunityTag = { community_id: CommunityId; name: string }; diff --git a/src/types/EditPost.ts b/src/types/EditPost.ts index 6b1f37d4..4a8d6528 100644 --- a/src/types/EditPost.ts +++ b/src/types/EditPost.ts @@ -1,6 +1,7 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. import type { LanguageId } from "./LanguageId"; import type { PostId } from "./PostId"; +import type { TagId } from "./TagId"; /** * Edit a post. @@ -27,4 +28,5 @@ export type EditPost = { * Time when this post should be scheduled. Null means publish immediately. */ scheduled_publish_time?: number; + tags?: Array; }; diff --git a/src/types/ListCommunityTags.ts b/src/types/ListCommunityTags.ts deleted file mode 100644 index bdf4f972..00000000 --- a/src/types/ListCommunityTags.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 { CommunityId } from "./CommunityId"; - -/** - * List tags for a community. - */ -export type ListCommunityTags = { community_id: CommunityId }; diff --git a/src/types/ListCommunityTagsResponse.ts b/src/types/ListCommunityTagsResponse.ts deleted file mode 100644 index 3b51b712..00000000 --- a/src/types/ListCommunityTagsResponse.ts +++ /dev/null @@ -1,4 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { CommunityTagResponse } from "./CommunityTagResponse"; - -export type ListCommunityTagsResponse = { tags: Array }; diff --git a/src/types/PersonPostMentionView.ts b/src/types/PersonPostMentionView.ts index 385dd561..f9813f6e 100644 --- a/src/types/PersonPostMentionView.ts +++ b/src/types/PersonPostMentionView.ts @@ -5,8 +5,8 @@ import type { Person } from "./Person"; import type { PersonPostMention } from "./PersonPostMention"; import type { Post } from "./Post"; import type { PostAggregates } from "./PostAggregates"; -import type { PostTags } from "./PostTags"; import type { SubscribedType } from "./SubscribedType"; +import type { TagsView } from "./TagsView"; /** * A person post mention view. @@ -30,5 +30,5 @@ export type PersonPostMentionView = { creator_blocked: boolean; my_vote?: number; unread_comments: number; - post_tags: PostTags; + post_tags: TagsView; }; diff --git a/src/types/PostView.ts b/src/types/PostView.ts index 7c74e727..c003a792 100644 --- a/src/types/PostView.ts +++ b/src/types/PostView.ts @@ -4,8 +4,8 @@ import type { ImageDetails } from "./ImageDetails"; import type { Person } from "./Person"; import type { Post } from "./Post"; import type { PostAggregates } from "./PostAggregates"; -import type { PostTags } from "./PostTags"; import type { SubscribedType } from "./SubscribedType"; +import type { TagsView } from "./TagsView"; /** * A post view. @@ -21,11 +21,11 @@ export type PostView = { creator_is_admin: boolean; counts: PostAggregates; subscribed: SubscribedType; - saved: boolean; + saved?: string; read: boolean; hidden: boolean; creator_blocked: boolean; my_vote?: number; unread_comments: number; - tags: PostTags; + tags: TagsView; }; diff --git a/src/types/PostTags.ts b/src/types/TagsView.ts similarity index 86% rename from src/types/PostTags.ts rename to src/types/TagsView.ts index 58896467..6ca48e6e 100644 --- a/src/types/PostTags.ts +++ b/src/types/TagsView.ts @@ -4,4 +4,4 @@ import type { Tag } from "./Tag"; /** * we wrap this in a struct so we can implement FromSqlRow for it */ -export type PostTags = Array; +export type TagsView = Array; diff --git a/src/types/UpdatePostTags.ts b/src/types/UpdatePostTags.ts deleted file mode 100644 index 51cf8b73..00000000 --- a/src/types/UpdatePostTags.ts +++ /dev/null @@ -1,8 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { PostId } from "./PostId"; -import type { TagId } from "./TagId"; - -/** - * Update tags for a post. - */ -export type UpdatePostTags = { post_id: PostId; tags: Array };