diff --git a/package.json b/package.json index d0d83d2..f587ca7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "lemmy-js-client", - "version": "0.17.2-rc.5", + "version": "0.17.2-rc.6", "description": "A javascript / typescript client for Lemmy", "repository": "https://github.com/LemmyNet/lemmy-js-client", "license": "AGPL-3.0", diff --git a/src/interfaces/api/community.ts b/src/interfaces/api/community.ts index 521cf42..2849f15 100644 --- a/src/interfaces/api/community.ts +++ b/src/interfaces/api/community.ts @@ -1,10 +1,6 @@ import { ListingType, SortType } from "../others"; import { Site } from "../source"; -import { - CommunityModeratorView, - CommunityView, - PersonViewSafe, -} from "../views"; +import { CommunityModeratorView, CommunityView, PersonView } from "../views"; /** * You can use either `id` or `name` as an id. @@ -73,7 +69,7 @@ export interface BanFromCommunity { } export interface BanFromCommunityResponse { - person_view: PersonViewSafe; + person_view: PersonView; banned: boolean; } diff --git a/src/interfaces/api/person.ts b/src/interfaces/api/person.ts index 7210955..4b3ca3e 100644 --- a/src/interfaces/api/person.ts +++ b/src/interfaces/api/person.ts @@ -1,10 +1,10 @@ -import { CommentSortType, SortType } from "../others"; +import { CommentSortType, ListingType, SortType } from "../others"; import { CommentReplyView, CommentView, CommunityModeratorView, PersonMentionView, - PersonViewSafe, + PersonView, PostView, PrivateMessageReportView, PrivateMessageView, @@ -84,14 +84,14 @@ export interface SaveUserSettings { * * The Sort types from above, zero indexed as a number */ - default_sort_type?: number; + default_sort_type?: SortType; /** * The [[ListingType]]. * * Post listing types are `All, Subscribed, Community` */ - default_listing_type?: number; + default_listing_type?: ListingType; interface_language?: string; avatar?: string; banner?: string; @@ -153,7 +153,7 @@ export interface GetPersonDetails { } export interface GetPersonDetailsResponse { - person_view: PersonViewSafe; + person_view: PersonView; comments: CommentView[]; posts: PostView[]; moderates: CommunityModeratorView[]; @@ -178,7 +178,7 @@ export interface AddAdmin { } export interface AddAdminResponse { - admins: PersonViewSafe[]; + admins: PersonView[]; } export interface BanPerson { @@ -198,7 +198,7 @@ export interface BanPerson { } export interface BanPersonResponse { - person_view: PersonViewSafe; + person_view: PersonView; banned: boolean; } @@ -365,7 +365,7 @@ export interface BlockPerson { } export interface BlockPersonResponse { - person_view: PersonViewSafe; + person_view: PersonView; blocked: boolean; } @@ -374,5 +374,5 @@ export interface GetBannedPersons { } export interface BannedPersonsResponse { - banned: PersonViewSafe[]; + banned: PersonView[]; } diff --git a/src/interfaces/api/site.ts b/src/interfaces/api/site.ts index ae6a73e..189c067 100644 --- a/src/interfaces/api/site.ts +++ b/src/interfaces/api/site.ts @@ -1,5 +1,11 @@ -import { ListingType, ModlogActionType, SearchType, SortType } from "../others"; -import { Language, RegistrationMode, Tagline } from "../source"; +import { + ListingType, + ModlogActionType, + RegistrationMode, + SearchType, + SortType, +} from "../others"; +import { Language, Tagline } from "../source"; import { AdminPurgeCommentView, AdminPurgeCommunityView, @@ -23,7 +29,7 @@ import { ModRemovePostView, ModTransferCommunityView, PersonBlockView, - PersonViewSafe, + PersonView, PostView, RegistrationApplicationView, SiteView, @@ -56,7 +62,7 @@ export interface SearchResponse { comments: CommentView[]; posts: PostView[]; communities: CommunityView[]; - users: PersonViewSafe[]; + users: PersonView[]; } export interface GetModlog { @@ -100,7 +106,7 @@ export interface CreateSite { application_question?: string; private_instance?: boolean; default_theme?: string; - default_post_listing_type?: string; + default_post_listing_type?: ListingType; application_email_admins?: boolean; reports_email_admins?: boolean; hide_modlog_mod_names?: boolean; @@ -145,7 +151,7 @@ export interface EditSite { application_question?: string; private_instance?: boolean; default_theme?: string; - default_post_listing_type?: string; + default_post_listing_type?: ListingType; legal_information?: string; application_email_admins?: boolean; reports_email_admins?: boolean; @@ -186,7 +192,7 @@ export interface SiteResponse { export interface GetSiteResponse { site_view: SiteView; - admins: PersonViewSafe[]; + admins: PersonView[]; online: number; version: string; /** @@ -231,7 +237,7 @@ export interface ResolveObjectResponse { comment?: CommentView; post?: PostView; community?: CommunityView; - person?: PersonViewSafe; + person?: PersonView; } export interface PurgePerson { diff --git a/src/interfaces/others.ts b/src/interfaces/others.ts index e7f893d..6c8b468 100644 --- a/src/interfaces/others.ts +++ b/src/interfaces/others.ts @@ -174,6 +174,15 @@ export enum ListingType { Community = "Community", } +/** + * The different types of registration modes + */ +export enum RegistrationMode { + Closed = "Closed", + RequireApplication = "RequireApplication", + Open = "Open", +} + /** * Search types for lemmy's search. */ diff --git a/src/interfaces/source.ts b/src/interfaces/source.ts index 97a1ba4..6cc9965 100644 --- a/src/interfaces/source.ts +++ b/src/interfaces/source.ts @@ -1,11 +1,13 @@ +import { ListingType, RegistrationMode, SortType } from "./others"; + export interface LocalUserSettings { id: number; person_id: number; email?: string; show_nsfw: boolean; theme: string; - default_sort_type: number; - default_listing_type: number; + default_sort_type: SortType; + default_listing_type: ListingType; interface_language: string; show_avatars: boolean; send_notifications_to_email: boolean; @@ -22,7 +24,7 @@ export interface LocalUserSettings { totp_2fa_url?: string; } -export interface PersonSafe { +export interface Person { id: number; name: string; display_name?: string; @@ -61,12 +63,6 @@ export interface Site { instance_id: number; } -export enum RegistrationMode { - Closed = "closed", - RequireApplication = "requireapplication", - Open = "open", -} - export interface LocalSite { id: number; site_id: number; @@ -79,7 +75,7 @@ export interface LocalSite { application_question?: string; private_instance: boolean; default_theme: string; - default_post_listing_type: string; + default_post_listing_type: ListingType; legal_information?: string; hide_modlog_mod_names: boolean; application_email_admins: boolean; @@ -177,7 +173,7 @@ export interface ModRemovePost { mod_person_id: number; post_id: number; reason?: string; - removed?: boolean; + removed: boolean; when_: string; } @@ -203,7 +199,7 @@ export interface ModRemoveComment { mod_person_id: number; comment_id: number; reason?: string; - removed?: boolean; + removed: boolean; when_: string; } @@ -212,7 +208,7 @@ export interface ModRemoveCommunity { mod_person_id: number; community_id: number; reason?: string; - removed?: boolean; + removed: boolean; expires?: string; when_: string; } @@ -243,7 +239,7 @@ export interface ModAddCommunity { mod_person_id: number; other_person_id: number; community_id: number; - removed?: boolean; + removed: boolean; when_: string; } @@ -252,7 +248,6 @@ export interface ModTransferCommunity { mod_person_id: number; other_person_id: number; community_id: number; - removed?: boolean; when_: string; } @@ -260,7 +255,7 @@ export interface ModAdd { id: number; mod_person_id: number; other_person_id: number; - removed?: boolean; + removed: boolean; when_: string; } @@ -294,7 +289,7 @@ export interface AdminPurgeComment { when_: string; } -export interface CommunitySafe { +export interface Community { id: number; name: string; title: string; diff --git a/src/interfaces/views.ts b/src/interfaces/views.ts index b1caddf..5f9bbbb 100644 --- a/src/interfaces/views.ts +++ b/src/interfaces/views.ts @@ -14,7 +14,7 @@ import { Comment, CommentReply, CommentReport, - CommunitySafe, + Community, CustomEmoji, CustomEmojiKeyword, LocalSite, @@ -30,8 +30,8 @@ import { ModRemoveCommunity, ModRemovePost, ModTransferCommunity, + Person, PersonMention, - PersonSafe, Post, PostReport, PrivateMessage, @@ -41,18 +41,18 @@ import { Tagline, } from "./source"; -export interface PersonViewSafe { - person: PersonSafe; +export interface PersonView { + person: Person; counts: PersonAggregates; } export interface PersonMentionView { person_mention: PersonMention; comment: Comment; - creator: PersonSafe; + creator: Person; post: Post; - community: CommunitySafe; - recipient: PersonSafe; + community: Community; + recipient: Person; counts: CommentAggregates; creator_banned_from_community: boolean; subscribed: SubscribedType; @@ -63,7 +63,7 @@ export interface PersonMentionView { export interface LocalUserSettingsView { local_user: LocalUserSettings; - person: PersonSafe; + person: Person; counts: PersonAggregates; } @@ -77,14 +77,14 @@ export interface SiteView { export interface PrivateMessageView { private_message: PrivateMessage; - creator: PersonSafe; - recipient: PersonSafe; + creator: Person; + recipient: Person; } export interface PostView { post: Post; - creator: PersonSafe; - community: CommunitySafe; + creator: Person; + community: Community; creator_banned_from_community: boolean; counts: PostAggregates; subscribed: SubscribedType; @@ -98,20 +98,20 @@ export interface PostView { export interface PostReportView { post_report: PostReport; post: Post; - community: CommunitySafe; - creator: PersonSafe; - post_creator: PersonSafe; + community: Community; + creator: Person; + post_creator: Person; creator_banned_from_community: boolean; my_vote?: number; counts: PostAggregates; - resolver?: PersonSafe; + resolver?: Person; } export interface CommentView { comment: Comment; - creator: PersonSafe; + creator: Person; post: Post; - community: CommunitySafe; + community: Community; counts: CommentAggregates; creator_banned_from_community: boolean; subscribed: SubscribedType; @@ -123,10 +123,10 @@ export interface CommentView { export interface CommentReplyView { comment_reply: CommentReply; comment: Comment; - creator: PersonSafe; + creator: Person; post: Post; - community: CommunitySafe; - recipient: PersonSafe; + community: Community; + recipient: Person; counts: CommentAggregates; creator_banned_from_community: boolean; subscribed: SubscribedType; @@ -139,133 +139,133 @@ export interface CommentReportView { comment_report: CommentReport; comment: Comment; post: Post; - community: CommunitySafe; - creator: PersonSafe; - comment_creator: PersonSafe; + community: Community; + creator: Person; + comment_creator: Person; counts: CommentAggregates; creator_banned_from_community: boolean; my_vote?: number; - resolver?: PersonSafe; + resolver?: Person; } export interface ModAddCommunityView { mod_add_community: ModAddCommunity; - moderator?: PersonSafe; - community: CommunitySafe; - modded_person: PersonSafe; + moderator?: Person; + community: Community; + modded_person: Person; } export interface ModTransferCommunityView { mod_transfer_community: ModTransferCommunity; - moderator?: PersonSafe; - community: CommunitySafe; - modded_person: PersonSafe; + moderator?: Person; + community: Community; + modded_person: Person; } export interface ModAddView { mod_add: ModAdd; - moderator?: PersonSafe; - modded_person: PersonSafe; + moderator?: Person; + modded_person: Person; } export interface ModBanFromCommunityView { mod_ban_from_community: ModBanFromCommunity; - moderator?: PersonSafe; - community: CommunitySafe; - banned_person: PersonSafe; + moderator?: Person; + community: Community; + banned_person: Person; } export interface ModBanView { mod_ban: ModBan; - moderator?: PersonSafe; - banned_person: PersonSafe; + moderator?: Person; + banned_person: Person; } export interface ModLockPostView { mod_lock_post: ModLockPost; - moderator?: PersonSafe; + moderator?: Person; post: Post; - community: CommunitySafe; + community: Community; } export interface ModRemoveCommentView { mod_remove_comment: ModRemoveComment; - moderator?: PersonSafe; + moderator?: Person; comment: Comment; - commenter: PersonSafe; + commenter: Person; post: Post; - community: CommunitySafe; + community: Community; } export interface ModRemoveCommunityView { mod_remove_community: ModRemoveCommunity; - moderator?: PersonSafe; - community: CommunitySafe; + moderator?: Person; + community: Community; } export interface ModRemovePostView { mod_remove_post: ModRemovePost; - moderator?: PersonSafe; + moderator?: Person; post: Post; - community: CommunitySafe; + community: Community; } export interface ModFeaturePostView { mod_feature_post: ModFeaturePost; - moderator?: PersonSafe; + moderator?: Person; post: Post; - community: CommunitySafe; + community: Community; } export interface AdminPurgeCommunityView { admin_purge_community: AdminPurgeCommunity; - admin?: PersonSafe; + admin?: Person; } export interface AdminPurgePersonView { admin_purge_person: AdminPurgePerson; - admin?: PersonSafe; + admin?: Person; } export interface AdminPurgePostView { admin_purge_post: AdminPurgePost; - admin?: PersonSafe; - community: CommunitySafe; + admin?: Person; + community: Community; } export interface AdminPurgeCommentView { admin_purge_comment: AdminPurgeComment; - admin?: PersonSafe; + admin?: Person; post: Post; } export interface CommunityFollowerView { - community: CommunitySafe; - follower: PersonSafe; + community: Community; + follower: Person; } export interface CommunityBlockView { - person: PersonSafe; - community: CommunitySafe; + person: Person; + community: Community; } export interface CommunityModeratorView { - community: CommunitySafe; - moderator: PersonSafe; + community: Community; + moderator: Person; } export interface CommunityPersonBanView { - community: CommunitySafe; - person: PersonSafe; + community: Community; + person: Person; } export interface PersonBlockView { - person: PersonSafe; - target: PersonSafe; + person: Person; + target: Person; } export interface CommunityView { - community: CommunitySafe; + community: Community; subscribed: SubscribedType; blocked: boolean; counts: CommunityAggregates; @@ -274,8 +274,8 @@ export interface CommunityView { export interface RegistrationApplicationView { registration_application: RegistrationApplication; creator_local_user: LocalUserSettings; - creator: PersonSafe; - admin?: PersonSafe; + creator: Person; + admin?: Person; } export interface CommentNode { @@ -287,9 +287,9 @@ export interface CommentNode { export interface PrivateMessageReportView { private_message_report: PrivateMessageReport; private_message: PrivateMessage; - private_message_creator: PersonSafe; - creator: PersonSafe; - resolver?: PersonSafe; + private_message_creator: Person; + creator: Person; + resolver?: Person; } export class CustomEmojiView {