From 991af27e42e2619f50fd60609163b39bfdb3b21e Mon Sep 17 00:00:00 2001 From: Dessalines Date: Tue, 31 Oct 2023 09:00:44 -0400 Subject: [PATCH] Updating types from lemmy. (#209) --- copy_generated_types_from_lemmy.sh | 5 ++++- src/http.ts | 2 +- src/index.ts | 3 +-- src/{types/others.ts => other_types.ts} | 0 src/types/CommentView.ts | 1 + src/types/LemmyErrorType.ts | 1 + src/types/PersonAggregates.ts | 2 -- src/types/PersonSortType.ts | 9 --------- src/types/PostView.ts | 1 + 9 files changed, 9 insertions(+), 15 deletions(-) rename src/{types/others.ts => other_types.ts} (100%) delete mode 100644 src/types/PersonSortType.ts diff --git a/copy_generated_types_from_lemmy.sh b/copy_generated_types_from_lemmy.sh index 0d4e12f..8c5e05c 100755 --- a/copy_generated_types_from_lemmy.sh +++ b/copy_generated_types_from_lemmy.sh @@ -1,5 +1,8 @@ #!/bin/bash +# Remove the old types +rm -rf src/types/* + # Remove the old bindings pushd ../lemmy/crates rm -rf **/bindings @@ -29,5 +32,5 @@ find src/types -type f -name '*.ts' -exec sed -i 's/bigint/\/* integer *\/ numbe node putTypesInIndex.js -prettier -w src/types src/index.ts +prettier -w src diff --git a/src/http.ts b/src/http.ts index 66bc0b3..d78878b 100644 --- a/src/http.ts +++ b/src/http.ts @@ -125,7 +125,7 @@ import { UploadImage, UploadImageResponse, VERSION, -} from "./types/others"; +} from "./other_types"; import { HideCommunity } from "./types/HideCommunity"; import { BlockInstance } from "./types/BlockInstance"; import { BlockInstanceResponse } from "./types/BlockInstanceResponse"; diff --git a/src/index.ts b/src/index.ts index 50b3b61..ef62258 100644 --- a/src/index.ts +++ b/src/index.ts @@ -179,7 +179,6 @@ export { PersonMention } from "./types/PersonMention"; export { PersonMentionId } from "./types/PersonMentionId"; export { PersonMentionResponse } from "./types/PersonMentionResponse"; export { PersonMentionView } from "./types/PersonMentionView"; -export { PersonSortType } from "./types/PersonSortType"; export { PersonView } from "./types/PersonView"; export { Post } from "./types/Post"; export { PostAggregates } from "./types/PostAggregates"; @@ -243,4 +242,4 @@ export { UploadImageResponse, ImageFile, DeleteImage, -} from "./types/others"; +} from "./other_types"; diff --git a/src/types/others.ts b/src/other_types.ts similarity index 100% rename from src/types/others.ts rename to src/other_types.ts diff --git a/src/types/CommentView.ts b/src/types/CommentView.ts index 02d071e..82e57f6 100644 --- a/src/types/CommentView.ts +++ b/src/types/CommentView.ts @@ -13,6 +13,7 @@ export interface CommentView { community: Community; counts: CommentAggregates; creator_banned_from_community: boolean; + creator_is_moderator: boolean; subscribed: SubscribedType; saved: boolean; creator_blocked: boolean; diff --git a/src/types/LemmyErrorType.ts b/src/types/LemmyErrorType.ts index deef2b2..242e197 100644 --- a/src/types/LemmyErrorType.ts +++ b/src/types/LemmyErrorType.ts @@ -148,4 +148,5 @@ export type LemmyErrorType = | { error: "community_has_no_followers" } | { error: "ban_expiration_in_past" } | { error: "invalid_unix_time" } + | { error: "invalid_bot_action" } | { error: "unknown"; message: string }; diff --git a/src/types/PersonAggregates.ts b/src/types/PersonAggregates.ts index 584453b..47e7442 100644 --- a/src/types/PersonAggregates.ts +++ b/src/types/PersonAggregates.ts @@ -5,7 +5,5 @@ export interface PersonAggregates { id: number; person_id: PersonId; post_count: /* integer */ number; - post_score: /* integer */ number; comment_count: /* integer */ number; - comment_score: /* integer */ number; } diff --git a/src/types/PersonSortType.ts b/src/types/PersonSortType.ts deleted file mode 100644 index 54591c7..0000000 --- a/src/types/PersonSortType.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. - -export type PersonSortType = - | "New" - | "Old" - | "MostComments" - | "CommentScore" - | "PostScore" - | "PostCount"; diff --git a/src/types/PostView.ts b/src/types/PostView.ts index 91f5a95..70d8804 100644 --- a/src/types/PostView.ts +++ b/src/types/PostView.ts @@ -10,6 +10,7 @@ export interface PostView { creator: Person; community: Community; creator_banned_from_community: boolean; + creator_is_moderator: boolean; counts: PostAggregates; subscribed: SubscribedType; saved: boolean;