From 5670d9d8040b386bdb184565202f3229af6b4286 Mon Sep 17 00:00:00 2001 From: Dessalines Date: Wed, 20 Sep 2023 08:39:37 -0400 Subject: [PATCH] Adding a few types merged from main. --- copy_generated_types_from_lemmy.sh | 2 +- src/index.ts | 6 ++++++ src/types/BlockInstance.ts | 8 ++++++++ src/types/BlockInstanceResponse.ts | 5 +++++ src/types/Community.ts | 2 -- src/types/DeleteAccountResponse.ts | 2 +- src/types/GetPosts.ts | 2 ++ src/types/GetPostsResponse.ts | 2 ++ src/types/InstanceBlockView.ts | 10 ++++++++++ src/types/MyUserInfo.ts | 2 ++ src/types/PaginationCursor.ts | 3 +++ src/types/PasswordResetResponse.ts | 2 +- src/types/Person.ts | 1 - src/types/PostAggregates.ts | 3 +++ src/types/SortType.ts | 3 ++- src/types/VerifyEmailResponse.ts | 2 +- 16 files changed, 47 insertions(+), 8 deletions(-) create mode 100644 src/types/BlockInstance.ts create mode 100644 src/types/BlockInstanceResponse.ts create mode 100644 src/types/InstanceBlockView.ts create mode 100644 src/types/PaginationCursor.ts diff --git a/copy_generated_types_from_lemmy.sh b/copy_generated_types_from_lemmy.sh index fbad06a..b472a8f 100755 --- a/copy_generated_types_from_lemmy.sh +++ b/copy_generated_types_from_lemmy.sh @@ -29,5 +29,5 @@ find src/types -type f -name '*.ts' -exec sed -i 's/bigint/number/g' {} + node putTypesInIndex.js -prettier -w src/types +prettier -w src/types src/index.ts diff --git a/src/index.ts b/src/index.ts index 360a8d3..ae1dd63 100644 --- a/src/index.ts +++ b/src/index.ts @@ -19,6 +19,8 @@ export { BanPersonResponse } from "./types/BanPersonResponse"; export { BannedPersonsResponse } from "./types/BannedPersonsResponse"; export { BlockCommunity } from "./types/BlockCommunity"; export { BlockCommunityResponse } from "./types/BlockCommunityResponse"; +export { BlockInstance } from "./types/BlockInstance"; +export { BlockInstanceResponse } from "./types/BlockInstanceResponse"; export { BlockPerson } from "./types/BlockPerson"; export { BlockPersonResponse } from "./types/BlockPersonResponse"; export { CaptchaResponse } from "./types/CaptchaResponse"; @@ -111,9 +113,11 @@ export { HideCommunity } from "./types/HideCommunity"; export { ImageUpload } from "./types/ImageUpload"; export { ImageUploadId } from "./types/ImageUploadId"; export { Instance } from "./types/Instance"; +export { InstanceBlockView } from "./types/InstanceBlockView"; export { InstanceId } from "./types/InstanceId"; export { Language } from "./types/Language"; export { LanguageId } from "./types/LanguageId"; +export { LemmyErrorType } from "./types/LemmyErrorType"; export { ListCommentReports } from "./types/ListCommentReports"; export { ListCommentReportsResponse } from "./types/ListCommentReportsResponse"; export { ListCommunities } from "./types/ListCommunities"; @@ -163,6 +167,7 @@ export { ModTransferCommunityView } from "./types/ModTransferCommunityView"; export { ModlogActionType } from "./types/ModlogActionType"; export { ModlogListParams } from "./types/ModlogListParams"; export { MyUserInfo } from "./types/MyUserInfo"; +export { PaginationCursor } from "./types/PaginationCursor"; export { PasswordChangeAfterReset } from "./types/PasswordChangeAfterReset"; export { PasswordReset } from "./types/PasswordReset"; export { PasswordResetResponse } from "./types/PasswordResetResponse"; @@ -233,3 +238,4 @@ export { Tagline } from "./types/Tagline"; export { TransferCommunity } from "./types/TransferCommunity"; export { VerifyEmail } from "./types/VerifyEmail"; export { VerifyEmailResponse } from "./types/VerifyEmailResponse"; +export { UploadImage, UploadImageResponse, ImageFile } from "./types/others"; diff --git a/src/types/BlockInstance.ts b/src/types/BlockInstance.ts new file mode 100644 index 0000000..a69a880 --- /dev/null +++ b/src/types/BlockInstance.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 { InstanceId } from "./InstanceId"; + +export interface BlockInstance { + instance_id: InstanceId; + block: boolean; + auth: string; +} diff --git a/src/types/BlockInstanceResponse.ts b/src/types/BlockInstanceResponse.ts new file mode 100644 index 0000000..88e4323 --- /dev/null +++ b/src/types/BlockInstanceResponse.ts @@ -0,0 +1,5 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export interface BlockInstanceResponse { + blocked: boolean; +} diff --git a/src/types/Community.ts b/src/types/Community.ts index 7d8022d..31f0859 100644 --- a/src/types/Community.ts +++ b/src/types/Community.ts @@ -16,8 +16,6 @@ export interface Community { local: boolean; icon?: string; banner?: string; - followers_url: string; - inbox_url: string; hidden: boolean; posting_restricted_to_mods: boolean; instance_id: InstanceId; diff --git a/src/types/DeleteAccountResponse.ts b/src/types/DeleteAccountResponse.ts index 5b4d05e..f6f0fcd 100644 --- a/src/types/DeleteAccountResponse.ts +++ b/src/types/DeleteAccountResponse.ts @@ -1,3 +1,3 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -export type DeleteAccountResponse = null; +export type DeleteAccountResponse = Record; diff --git a/src/types/GetPosts.ts b/src/types/GetPosts.ts index 87511a3..bacdef2 100644 --- a/src/types/GetPosts.ts +++ b/src/types/GetPosts.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 { CommunityId } from "./CommunityId"; import type { ListingType } from "./ListingType"; +import type { PaginationCursor } from "./PaginationCursor"; import type { SortType } from "./SortType"; export interface GetPosts { @@ -13,4 +14,5 @@ export interface GetPosts { saved_only?: boolean; liked_only?: boolean; disliked_only?: boolean; + page_cursor?: PaginationCursor; } diff --git a/src/types/GetPostsResponse.ts b/src/types/GetPostsResponse.ts index 9038edc..f7c10eb 100644 --- a/src/types/GetPostsResponse.ts +++ b/src/types/GetPostsResponse.ts @@ -1,6 +1,8 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { PaginationCursor } from "./PaginationCursor"; import type { PostView } from "./PostView"; export interface GetPostsResponse { posts: Array; + next_page?: PaginationCursor; } diff --git a/src/types/InstanceBlockView.ts b/src/types/InstanceBlockView.ts new file mode 100644 index 0000000..38087ca --- /dev/null +++ b/src/types/InstanceBlockView.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 { Instance } from "./Instance"; +import type { Person } from "./Person"; +import type { Site } from "./Site"; + +export interface InstanceBlockView { + person: Person; + instance: Instance; + site?: Site; +} diff --git a/src/types/MyUserInfo.ts b/src/types/MyUserInfo.ts index fb2c3d9..ddde119 100644 --- a/src/types/MyUserInfo.ts +++ b/src/types/MyUserInfo.ts @@ -2,6 +2,7 @@ import type { CommunityBlockView } from "./CommunityBlockView"; import type { CommunityFollowerView } from "./CommunityFollowerView"; import type { CommunityModeratorView } from "./CommunityModeratorView"; +import type { InstanceBlockView } from "./InstanceBlockView"; import type { LanguageId } from "./LanguageId"; import type { LocalUserView } from "./LocalUserView"; import type { PersonBlockView } from "./PersonBlockView"; @@ -11,6 +12,7 @@ export interface MyUserInfo { follows: Array; moderates: Array; community_blocks: Array; + instance_blocks: Array; person_blocks: Array; discussion_languages: Array; } diff --git a/src/types/PaginationCursor.ts b/src/types/PaginationCursor.ts new file mode 100644 index 0000000..790f62c --- /dev/null +++ b/src/types/PaginationCursor.ts @@ -0,0 +1,3 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type PaginationCursor = string; diff --git a/src/types/PasswordResetResponse.ts b/src/types/PasswordResetResponse.ts index 66587f5..e76960c 100644 --- a/src/types/PasswordResetResponse.ts +++ b/src/types/PasswordResetResponse.ts @@ -1,3 +1,3 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -export type PasswordResetResponse = null; +export type PasswordResetResponse = Record; diff --git a/src/types/Person.ts b/src/types/Person.ts index 137cfe4..6fee0e2 100644 --- a/src/types/Person.ts +++ b/src/types/Person.ts @@ -15,7 +15,6 @@ export interface Person { local: boolean; banner?: string; deleted: boolean; - inbox_url: string; matrix_user_id?: string; bot_account: boolean; ban_expires?: string; diff --git a/src/types/PostAggregates.ts b/src/types/PostAggregates.ts index 4c00789..ec975ed 100644 --- a/src/types/PostAggregates.ts +++ b/src/types/PostAggregates.ts @@ -1,5 +1,6 @@ // 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 { InstanceId } from "./InstanceId"; import type { PersonId } from "./PersonId"; import type { PostId } from "./PostId"; @@ -20,4 +21,6 @@ export interface PostAggregates { community_id: CommunityId; creator_id: PersonId; controversy_rank: number; + instance_id: InstanceId; + scaled_rank: number; } diff --git a/src/types/SortType.ts b/src/types/SortType.ts index da0a064..ee868e7 100644 --- a/src/types/SortType.ts +++ b/src/types/SortType.ts @@ -18,4 +18,5 @@ export type SortType = | "TopThreeMonths" | "TopSixMonths" | "TopNineMonths" - | "Controversial"; + | "Controversial" + | "Scaled"; diff --git a/src/types/VerifyEmailResponse.ts b/src/types/VerifyEmailResponse.ts index b96e381..2f0bd27 100644 --- a/src/types/VerifyEmailResponse.ts +++ b/src/types/VerifyEmailResponse.ts @@ -1,3 +1,3 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -export type VerifyEmailResponse = null; +export type VerifyEmailResponse = Record;