Adding combined modlog

This commit is contained in:
Dessalines 2025-01-05 17:58:59 -05:00
parent 65567952d4
commit 5bb5a6c189
71 changed files with 324 additions and 123 deletions

View file

@ -159,6 +159,10 @@ import { MyUserInfo } from "./types/MyUserInfo";
import { UserBlockInstanceParams } from "./types/UserBlockInstanceParams";
import { AdminAllowInstanceParams } from "./types/AdminAllowInstanceParams";
import { AdminBlockInstanceParams } from "./types/AdminBlockInstanceParams";
import { ListPersonContent } from "./types/ListPersonContent";
import { ListPersonContentResponse } from "./types/ListPersonContentResponse";
import { ListPersonSaved } from "./types/ListPersonSaved";
import { ListPersonSavedResponse } from "./types/ListPersonSavedResponse";
enum HttpType {
Get = "GET",
@ -1228,6 +1232,20 @@ export class LemmyHttp {
);
}
/**
* List the content for a person.
*
* `HTTP.GET /person/content`
*/
listPersonContent(form: ListPersonContent = {}, options?: RequestOptions) {
return this.#wrapper<ListPersonContent, ListPersonContentResponse>(
HttpType.Get,
"/person/content",
form,
options,
);
}
/**
* Get mentions for your user.
*
@ -1472,6 +1490,20 @@ export class LemmyHttp {
);
}
/**
* List your saved content.
*
* `HTTP.GET /account/auth/saved`
*/
listPersonSaved(form: ListPersonSaved, options?: RequestOptions) {
return this.#wrapper<ListPersonSaved, ListPersonSavedResponse>(
HttpType.Post,
"/account/auth/saved",
form,
options,
);
}
/**
* Add an admin to your site.
*

View file

@ -11,18 +11,24 @@ export { AddAdminResponse } from "./types/AddAdminResponse";
export { AddModToCommunity } from "./types/AddModToCommunity";
export { AddModToCommunityResponse } from "./types/AddModToCommunityResponse";
export { AdminAllowInstance } from "./types/AdminAllowInstance";
export { AdminAllowInstanceId } from "./types/AdminAllowInstanceId";
export { AdminAllowInstanceParams } from "./types/AdminAllowInstanceParams";
export { AdminAllowInstanceView } from "./types/AdminAllowInstanceView";
export { AdminBlockInstance } from "./types/AdminBlockInstance";
export { AdminBlockInstanceId } from "./types/AdminBlockInstanceId";
export { AdminBlockInstanceParams } from "./types/AdminBlockInstanceParams";
export { AdminBlockInstanceView } from "./types/AdminBlockInstanceView";
export { AdminPurgeComment } from "./types/AdminPurgeComment";
export { AdminPurgeCommentId } from "./types/AdminPurgeCommentId";
export { AdminPurgeCommentView } from "./types/AdminPurgeCommentView";
export { AdminPurgeCommunity } from "./types/AdminPurgeCommunity";
export { AdminPurgeCommunityId } from "./types/AdminPurgeCommunityId";
export { AdminPurgeCommunityView } from "./types/AdminPurgeCommunityView";
export { AdminPurgePerson } from "./types/AdminPurgePerson";
export { AdminPurgePersonId } from "./types/AdminPurgePersonId";
export { AdminPurgePersonView } from "./types/AdminPurgePersonView";
export { AdminPurgePost } from "./types/AdminPurgePost";
export { AdminPurgePostId } from "./types/AdminPurgePostId";
export { AdminPurgePostView } from "./types/AdminPurgePostView";
export { ApproveCommunityPendingFollower } from "./types/ApproveCommunityPendingFollower";
export { ApproveRegistrationApplication } from "./types/ApproveRegistrationApplication";
@ -156,6 +162,10 @@ export { ListCustomEmojisResponse } from "./types/ListCustomEmojisResponse";
export { ListLoginsResponse } from "./types/ListLoginsResponse";
export { ListMedia } from "./types/ListMedia";
export { ListMediaResponse } from "./types/ListMediaResponse";
export { ListPersonContent } from "./types/ListPersonContent";
export { ListPersonContentResponse } from "./types/ListPersonContentResponse";
export { ListPersonSaved } from "./types/ListPersonSaved";
export { ListPersonSavedResponse } from "./types/ListPersonSavedResponse";
export { ListPostLikes } from "./types/ListPostLikes";
export { ListPostLikesResponse } from "./types/ListPostLikesResponse";
export { ListRegistrationApplications } from "./types/ListRegistrationApplications";
@ -186,28 +196,40 @@ export { MarkPostAsRead } from "./types/MarkPostAsRead";
export { MarkPrivateMessageAsRead } from "./types/MarkPrivateMessageAsRead";
export { ModAdd } from "./types/ModAdd";
export { ModAddCommunity } from "./types/ModAddCommunity";
export { ModAddCommunityId } from "./types/ModAddCommunityId";
export { ModAddCommunityView } from "./types/ModAddCommunityView";
export { ModAddId } from "./types/ModAddId";
export { ModAddView } from "./types/ModAddView";
export { ModBan } from "./types/ModBan";
export { ModBanFromCommunity } from "./types/ModBanFromCommunity";
export { ModBanFromCommunityId } from "./types/ModBanFromCommunityId";
export { ModBanFromCommunityView } from "./types/ModBanFromCommunityView";
export { ModBanId } from "./types/ModBanId";
export { ModBanView } from "./types/ModBanView";
export { ModFeaturePost } from "./types/ModFeaturePost";
export { ModFeaturePostId } from "./types/ModFeaturePostId";
export { ModFeaturePostView } from "./types/ModFeaturePostView";
export { ModHideCommunity } from "./types/ModHideCommunity";
export { ModHideCommunityId } from "./types/ModHideCommunityId";
export { ModHideCommunityView } from "./types/ModHideCommunityView";
export { ModLockPost } from "./types/ModLockPost";
export { ModLockPostId } from "./types/ModLockPostId";
export { ModLockPostView } from "./types/ModLockPostView";
export { ModRemoveComment } from "./types/ModRemoveComment";
export { ModRemoveCommentId } from "./types/ModRemoveCommentId";
export { ModRemoveCommentView } from "./types/ModRemoveCommentView";
export { ModRemoveCommunity } from "./types/ModRemoveCommunity";
export { ModRemoveCommunityId } from "./types/ModRemoveCommunityId";
export { ModRemoveCommunityView } from "./types/ModRemoveCommunityView";
export { ModRemovePost } from "./types/ModRemovePost";
export { ModRemovePostId } from "./types/ModRemovePostId";
export { ModRemovePostView } from "./types/ModRemovePostView";
export { ModTransferCommunity } from "./types/ModTransferCommunity";
export { ModTransferCommunityId } from "./types/ModTransferCommunityId";
export { ModTransferCommunityView } from "./types/ModTransferCommunityView";
export { ModlogActionType } from "./types/ModlogActionType";
export { ModlogListParams } from "./types/ModlogListParams";
export { ModlogCombinedPaginationCursor } from "./types/ModlogCombinedPaginationCursor";
export { ModlogCombinedView } from "./types/ModlogCombinedView";
export { MyUserInfo } from "./types/MyUserInfo";
export { OAuthAccount } from "./types/OAuthAccount";
export { OAuthProvider } from "./types/OAuthProvider";
@ -219,11 +241,15 @@ export { PasswordReset } from "./types/PasswordReset";
export { PendingFollow } from "./types/PendingFollow";
export { Person } from "./types/Person";
export { PersonAggregates } from "./types/PersonAggregates";
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 { PersonSavedCombinedPaginationCursor } from "./types/PersonSavedCombinedPaginationCursor";
export { PersonView } from "./types/PersonView";
export { Post } from "./types/Post";
export { PostAggregates } from "./types/PostAggregates";
@ -236,6 +262,7 @@ 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";
@ -261,8 +288,6 @@ export { RegistrationMode } from "./types/RegistrationMode";
export { RemoveComment } from "./types/RemoveComment";
export { RemoveCommunity } from "./types/RemoveCommunity";
export { RemovePost } from "./types/RemovePost";
export { ReportCombined } from "./types/ReportCombined";
export { ReportCombinedId } from "./types/ReportCombinedId";
export { ReportCombinedPaginationCursor } from "./types/ReportCombinedPaginationCursor";
export { ReportCombinedView } from "./types/ReportCombinedView";
export { ResolveCommentReport } from "./types/ResolveCommentReport";
@ -284,6 +309,8 @@ export { SiteResponse } from "./types/SiteResponse";
export { SiteView } from "./types/SiteView";
export { SubscribedType } from "./types/SubscribedType";
export { SuccessResponse } from "./types/SuccessResponse";
export { Tag } from "./types/Tag";
export { TagId } from "./types/TagId";
export { Tagline } from "./types/Tagline";
export { TaglineId } from "./types/TaglineId";
export { TaglineResponse } from "./types/TaglineResponse";

View file

@ -1,9 +1,10 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { AdminAllowInstanceId } from "./AdminAllowInstanceId";
import type { InstanceId } from "./InstanceId";
import type { PersonId } from "./PersonId";
export type AdminAllowInstance = {
id: number;
id: AdminAllowInstanceId;
instance_id: InstanceId;
admin_person_id: PersonId;
allowed: boolean;

View file

@ -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 AdminAllowInstanceId = number;

View file

@ -7,7 +7,7 @@ import type { Person } from "./Person";
* When an admin purges a post.
*/
export type AdminAllowInstanceView = {
admin_block_instance: AdminAllowInstance;
admin_allow_instance: AdminAllowInstance;
instance: Instance;
admin?: Person;
};

View file

@ -1,9 +1,10 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { AdminBlockInstanceId } from "./AdminBlockInstanceId";
import type { InstanceId } from "./InstanceId";
import type { PersonId } from "./PersonId";
export type AdminBlockInstance = {
id: number;
id: AdminBlockInstanceId;
instance_id: InstanceId;
admin_person_id: PersonId;
blocked: boolean;

View file

@ -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 AdminBlockInstanceId = number;

View file

@ -1,4 +1,5 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { AdminPurgeCommentId } from "./AdminPurgeCommentId";
import type { PersonId } from "./PersonId";
import type { PostId } from "./PostId";
@ -6,7 +7,7 @@ import type { PostId } from "./PostId";
* When an admin purges a comment.
*/
export type AdminPurgeComment = {
id: number;
id: AdminPurgeCommentId;
admin_person_id: PersonId;
post_id: PostId;
reason?: string;

View file

@ -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 AdminPurgeCommentId = number;

View file

@ -1,11 +1,12 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { AdminPurgeCommunityId } from "./AdminPurgeCommunityId";
import type { PersonId } from "./PersonId";
/**
* When an admin purges a community.
*/
export type AdminPurgeCommunity = {
id: number;
id: AdminPurgeCommunityId;
admin_person_id: PersonId;
reason?: string;
when_: string;

View file

@ -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 AdminPurgeCommunityId = number;

View file

@ -1,11 +1,12 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { AdminPurgePersonId } from "./AdminPurgePersonId";
import type { PersonId } from "./PersonId";
/**
* When an admin purges a person.
*/
export type AdminPurgePerson = {
id: number;
id: AdminPurgePersonId;
admin_person_id: PersonId;
reason?: string;
when_: string;

View file

@ -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 AdminPurgePersonId = number;

View file

@ -1,4 +1,5 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { AdminPurgePostId } from "./AdminPurgePostId";
import type { CommunityId } from "./CommunityId";
import type { PersonId } from "./PersonId";
@ -6,7 +7,7 @@ import type { PersonId } from "./PersonId";
* When an admin purges a post.
*/
export type AdminPurgePost = {
id: number;
id: AdminPurgePostId;
admin_person_id: PersonId;
community_id: CommunityId;
reason?: string;

View file

@ -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 AdminPurgePostId = number;

View file

@ -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 { LanguageId } from "./LanguageId";
import type { TagId } from "./TagId";
/**
* Create a post.
@ -27,6 +28,7 @@ export type CreatePost = {
* Instead of fetching a thumbnail, use a custom one.
*/
custom_thumbnail?: string;
tags?: Array<TagId>;
/**
* Time when this post should be scheduled. Null means publish immediately.
*/

View file

@ -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.
@ -23,6 +24,7 @@ export type EditPost = {
* Instead of fetching a thumbnail, use a custom one.
*/
custom_thumbnail?: string;
tags?: Array<TagId>;
/**
* Time when this post should be scheduled. Null means publish immediately.
*/

View file

@ -18,7 +18,6 @@ export type GetComments = {
community_name?: string;
post_id?: PostId;
parent_id?: CommentId;
saved_only?: boolean;
liked_only?: boolean;
disliked_only?: boolean;
};

View file

@ -2,6 +2,7 @@
import type { CommentId } from "./CommentId";
import type { CommunityId } from "./CommunityId";
import type { ModlogActionType } from "./ModlogActionType";
import type { ModlogCombinedPaginationCursor } from "./ModlogCombinedPaginationCursor";
import type { PersonId } from "./PersonId";
import type { PostId } from "./PostId";
@ -11,10 +12,10 @@ import type { PostId } from "./PostId";
export type GetModlog = {
mod_person_id?: PersonId;
community_id?: CommunityId;
page?: number;
limit?: number;
type_?: ModlogActionType;
other_person_id?: PersonId;
modded_person_id?: PersonId;
post_id?: PostId;
comment_id?: CommentId;
page_cursor?: ModlogCombinedPaginationCursor;
page_back?: boolean;
};

View file

@ -1,41 +1,7 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { AdminAllowInstanceView } from "./AdminAllowInstanceView";
import type { AdminBlockInstanceView } from "./AdminBlockInstanceView";
import type { AdminPurgeCommentView } from "./AdminPurgeCommentView";
import type { AdminPurgeCommunityView } from "./AdminPurgeCommunityView";
import type { AdminPurgePersonView } from "./AdminPurgePersonView";
import type { AdminPurgePostView } from "./AdminPurgePostView";
import type { ModAddCommunityView } from "./ModAddCommunityView";
import type { ModAddView } from "./ModAddView";
import type { ModBanFromCommunityView } from "./ModBanFromCommunityView";
import type { ModBanView } from "./ModBanView";
import type { ModFeaturePostView } from "./ModFeaturePostView";
import type { ModHideCommunityView } from "./ModHideCommunityView";
import type { ModLockPostView } from "./ModLockPostView";
import type { ModRemoveCommentView } from "./ModRemoveCommentView";
import type { ModRemoveCommunityView } from "./ModRemoveCommunityView";
import type { ModRemovePostView } from "./ModRemovePostView";
import type { ModTransferCommunityView } from "./ModTransferCommunityView";
import type { ModlogCombinedView } from "./ModlogCombinedView";
/**
* The modlog fetch response.
*/
export type GetModlogResponse = {
removed_posts: Array<ModRemovePostView>;
locked_posts: Array<ModLockPostView>;
featured_posts: Array<ModFeaturePostView>;
removed_comments: Array<ModRemoveCommentView>;
removed_communities: Array<ModRemoveCommunityView>;
banned_from_community: Array<ModBanFromCommunityView>;
banned: Array<ModBanView>;
added_to_community: Array<ModAddCommunityView>;
transferred_to_community: Array<ModTransferCommunityView>;
added: Array<ModAddView>;
admin_purged_persons: Array<AdminPurgePersonView>;
admin_purged_communities: Array<AdminPurgeCommunityView>;
admin_purged_posts: Array<AdminPurgePostView>;
admin_purged_comments: Array<AdminPurgeCommentView>;
hidden_communities: Array<ModHideCommunityView>;
admin_block_instance: Array<AdminBlockInstanceView>;
admin_allow_instance: Array<AdminAllowInstanceView>;
};
export type GetModlogResponse = { modlog: Array<ModlogCombinedView> };

View file

@ -1,7 +1,5 @@
// 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 { PersonId } from "./PersonId";
import type { PostSortType } from "./PostSortType";
/**
* Gets a person's details.
@ -14,9 +12,4 @@ export type GetPersonDetails = {
* Example: dessalines , or dessalines@xyz.tld
*/
username?: string;
sort?: PostSortType;
page?: number;
limit?: number;
community_id?: CommunityId;
saved_only?: boolean;
};

View file

@ -1,8 +1,6 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { CommentView } from "./CommentView";
import type { CommunityModeratorView } from "./CommunityModeratorView";
import type { PersonView } from "./PersonView";
import type { PostView } from "./PostView";
import type { Site } from "./Site";
/**
@ -11,7 +9,5 @@ import type { Site } from "./Site";
export type GetPersonDetailsResponse = {
person_view: PersonView;
site?: Site;
comments: Array<CommentView>;
posts: Array<PostView>;
moderates: Array<CommunityModeratorView>;
};

View file

@ -18,6 +18,7 @@ export type GetPosts = {
community_id?: CommunityId;
community_name?: string;
saved_only?: boolean;
read_only?: boolean;
liked_only?: boolean;
disliked_only?: boolean;
show_hidden?: boolean;

View file

@ -17,14 +17,6 @@ export type GetSiteResponse = {
version: string;
all_languages: Array<Language>;
discussion_languages: Array<LanguageId>;
/**
* deprecated, use field `tagline` or /api/v3/tagline/list
*/
taglines: Array<null>;
/**
* deprecated, use /api/v3/custom_emoji/list
*/
custom_emojis: Array<null>;
/**
* If the site has any taglines, a random one is included here for displaying
*/

View file

@ -103,7 +103,6 @@ export type LemmyErrorType =
| { error: "system_err_login" }
| { error: "couldnt_set_all_registrations_accepted" }
| { error: "couldnt_set_all_email_verified" }
| { error: "banned" }
| { error: "blocked_url" }
| { error: "couldnt_get_comments" }
| { error: "couldnt_get_posts" }

View file

@ -0,0 +1,20 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { PersonContentCombinedPaginationCursor } from "./PersonContentCombinedPaginationCursor";
import type { PersonContentType } from "./PersonContentType";
import type { PersonId } from "./PersonId";
/**
* Gets a person's content (posts and comments)
*
* Either person_id, or username are required.
*/
export type ListPersonContent = {
type_?: PersonContentType;
person_id?: PersonId;
/**
* Example: dessalines , or dessalines@xyz.tld
*/
username?: string;
page_cursor?: PersonContentCombinedPaginationCursor;
page_back?: boolean;
};

View file

@ -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 { PersonContentCombinedView } from "./PersonContentCombinedView";
/**
* A person's content response.
*/
export type ListPersonContentResponse = {
content: Array<PersonContentCombinedView>;
};

View file

@ -0,0 +1,12 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { PersonContentType } from "./PersonContentType";
import type { PersonSavedCombinedPaginationCursor } from "./PersonSavedCombinedPaginationCursor";
/**
* Gets your saved posts and comments
*/
export type ListPersonSaved = {
type_?: PersonContentType;
page_cursor?: PersonSavedCombinedPaginationCursor;
page_back?: boolean;
};

View file

@ -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 { PersonContentCombinedView } from "./PersonContentCombinedView";
/**
* A person's saved content response.
*/
export type ListPersonSavedResponse = {
saved: Array<PersonContentCombinedView>;
};

View file

@ -1,11 +1,12 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { ModAddId } from "./ModAddId";
import type { PersonId } from "./PersonId";
/**
* When someone is added as a site moderator.
*/
export type ModAdd = {
id: number;
id: ModAddId;
mod_person_id: PersonId;
other_person_id: PersonId;
removed: boolean;

View file

@ -1,12 +1,13 @@
// 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 { ModAddCommunityId } from "./ModAddCommunityId";
import type { PersonId } from "./PersonId";
/**
* When someone is added as a community moderator.
*/
export type ModAddCommunity = {
id: number;
id: ModAddCommunityId;
mod_person_id: PersonId;
other_person_id: PersonId;
community_id: CommunityId;

View file

@ -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 ModAddCommunityId = number;

3
src/types/ModAddId.ts Normal file
View file

@ -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 ModAddId = number;

View file

@ -1,11 +1,12 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { ModBanId } from "./ModBanId";
import type { PersonId } from "./PersonId";
/**
* When someone is banned from the site.
*/
export type ModBan = {
id: number;
id: ModBanId;
mod_person_id: PersonId;
other_person_id: PersonId;
reason?: string;

View file

@ -1,12 +1,13 @@
// 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 { ModBanFromCommunityId } from "./ModBanFromCommunityId";
import type { PersonId } from "./PersonId";
/**
* When someone is banned from a community.
*/
export type ModBanFromCommunity = {
id: number;
id: ModBanFromCommunityId;
mod_person_id: PersonId;
other_person_id: PersonId;
community_id: CommunityId;

View file

@ -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 ModBanFromCommunityId = number;

View file

@ -10,5 +10,5 @@ export type ModBanFromCommunityView = {
mod_ban_from_community: ModBanFromCommunity;
moderator?: Person;
community: Community;
banned_person: Person;
modded_person: Person;
};

3
src/types/ModBanId.ts Normal file
View file

@ -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 ModBanId = number;

View file

@ -8,5 +8,5 @@ import type { Person } from "./Person";
export type ModBanView = {
mod_ban: ModBan;
moderator?: Person;
banned_person: Person;
modded_person: Person;
};

View file

@ -1,4 +1,5 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { ModFeaturePostId } from "./ModFeaturePostId";
import type { PersonId } from "./PersonId";
import type { PostId } from "./PostId";
@ -6,7 +7,7 @@ import type { PostId } from "./PostId";
* When a moderator features a post on a community (pins it to the top).
*/
export type ModFeaturePost = {
id: number;
id: ModFeaturePostId;
mod_person_id: PersonId;
post_id: PostId;
featured: boolean;

View file

@ -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 ModFeaturePostId = number;

View file

@ -10,6 +10,7 @@ import type { Post } from "./Post";
export type ModFeaturePostView = {
mod_feature_post: ModFeaturePost;
moderator?: Person;
modded_person: Person;
post: Post;
community: Community;
};

View file

@ -1,12 +1,13 @@
// 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 { ModHideCommunityId } from "./ModHideCommunityId";
import type { PersonId } from "./PersonId";
/**
* When a community is hidden from public view.
*/
export type ModHideCommunity = {
id: number;
id: ModHideCommunityId;
community_id: CommunityId;
mod_person_id: PersonId;
when_: string;

View file

@ -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 ModHideCommunityId = number;

View file

@ -1,4 +1,5 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { ModLockPostId } from "./ModLockPostId";
import type { PersonId } from "./PersonId";
import type { PostId } from "./PostId";
@ -6,7 +7,7 @@ import type { PostId } from "./PostId";
* When a moderator locks a post (prevents new comments being made).
*/
export type ModLockPost = {
id: number;
id: ModLockPostId;
mod_person_id: PersonId;
post_id: PostId;
locked: boolean;

View file

@ -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 ModLockPostId = number;

View file

@ -10,6 +10,7 @@ import type { Post } from "./Post";
export type ModLockPostView = {
mod_lock_post: ModLockPost;
moderator?: Person;
modded_person: Person;
post: Post;
community: Community;
};

View file

@ -1,12 +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 { ModRemoveCommentId } from "./ModRemoveCommentId";
import type { PersonId } from "./PersonId";
/**
* When a moderator removes a comment.
*/
export type ModRemoveComment = {
id: number;
id: ModRemoveCommentId;
mod_person_id: PersonId;
comment_id: CommentId;
reason?: string;

View file

@ -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 ModRemoveCommentId = number;

View file

@ -11,8 +11,8 @@ import type { Post } from "./Post";
export type ModRemoveCommentView = {
mod_remove_comment: ModRemoveComment;
moderator?: Person;
modded_person: Person;
comment: Comment;
commenter: Person;
post: Post;
community: Community;
};

View file

@ -1,12 +1,13 @@
// 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 { ModRemoveCommunityId } from "./ModRemoveCommunityId";
import type { PersonId } from "./PersonId";
/**
* When a moderator removes a community.
*/
export type ModRemoveCommunity = {
id: number;
id: ModRemoveCommunityId;
mod_person_id: PersonId;
community_id: CommunityId;
reason?: string;

View file

@ -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 ModRemoveCommunityId = number;

View file

@ -1,4 +1,5 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { ModRemovePostId } from "./ModRemovePostId";
import type { PersonId } from "./PersonId";
import type { PostId } from "./PostId";
@ -6,7 +7,7 @@ import type { PostId } from "./PostId";
* When a moderator removes a post.
*/
export type ModRemovePost = {
id: number;
id: ModRemovePostId;
mod_person_id: PersonId;
post_id: PostId;
reason?: string;

View file

@ -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 ModRemovePostId = number;

View file

@ -10,6 +10,7 @@ import type { Post } from "./Post";
export type ModRemovePostView = {
mod_remove_post: ModRemovePost;
moderator?: Person;
modded_person: Person;
post: Post;
community: Community;
};

View file

@ -1,12 +1,13 @@
// 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 { ModTransferCommunityId } from "./ModTransferCommunityId";
import type { PersonId } from "./PersonId";
/**
* When a moderator transfers a community to a new owner.
*/
export type ModTransferCommunity = {
id: number;
id: ModTransferCommunityId;
mod_person_id: PersonId;
other_person_id: PersonId;
community_id: CommunityId;

View file

@ -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 ModTransferCommunityId = number;

View file

@ -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 modlog_combined
*/
export type ModlogCombinedPaginationCursor = string;

View file

@ -0,0 +1,37 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { AdminAllowInstanceView } from "./AdminAllowInstanceView";
import type { AdminBlockInstanceView } from "./AdminBlockInstanceView";
import type { AdminPurgeCommentView } from "./AdminPurgeCommentView";
import type { AdminPurgeCommunityView } from "./AdminPurgeCommunityView";
import type { AdminPurgePersonView } from "./AdminPurgePersonView";
import type { AdminPurgePostView } from "./AdminPurgePostView";
import type { ModAddCommunityView } from "./ModAddCommunityView";
import type { ModAddView } from "./ModAddView";
import type { ModBanFromCommunityView } from "./ModBanFromCommunityView";
import type { ModBanView } from "./ModBanView";
import type { ModFeaturePostView } from "./ModFeaturePostView";
import type { ModHideCommunityView } from "./ModHideCommunityView";
import type { ModLockPostView } from "./ModLockPostView";
import type { ModRemoveCommentView } from "./ModRemoveCommentView";
import type { ModRemoveCommunityView } from "./ModRemoveCommunityView";
import type { ModRemovePostView } from "./ModRemovePostView";
import type { ModTransferCommunityView } from "./ModTransferCommunityView";
export type ModlogCombinedView =
| ({ type_: "AdminAllowInstance" } & AdminAllowInstanceView)
| ({ type_: "AdminBlockInstance" } & AdminBlockInstanceView)
| ({ type_: "AdminPurgeComment" } & AdminPurgeCommentView)
| ({ type_: "AdminPurgeCommunity" } & AdminPurgeCommunityView)
| ({ type_: "AdminPurgePerson" } & AdminPurgePersonView)
| ({ type_: "AdminPurgePost" } & AdminPurgePostView)
| ({ type_: "ModAdd" } & ModAddView)
| ({ type_: "ModAddCommunity" } & ModAddCommunityView)
| ({ type_: "ModBan" } & ModBanView)
| ({ type_: "ModBanFromCommunity" } & ModBanFromCommunityView)
| ({ type_: "ModFeaturePost" } & ModFeaturePostView)
| ({ type_: "ModHideCommunity" } & ModHideCommunityView)
| ({ type_: "ModLockPost" } & ModLockPostView)
| ({ type_: "ModRemoveComment" } & ModRemoveCommentView)
| ({ type_: "ModRemoveCommunity" } & ModRemoveCommunityView)
| ({ type_: "ModRemovePost" } & ModRemovePostView)
| ({ type_: "ModTransferCommunity" } & ModTransferCommunityView);

View file

@ -1,19 +0,0 @@
// 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 { CommunityId } from "./CommunityId";
import type { PersonId } from "./PersonId";
import type { PostId } from "./PostId";
/**
* Querying / filtering the modlog.
*/
export type ModlogListParams = {
community_id?: CommunityId;
mod_person_id?: PersonId;
other_person_id?: PersonId;
post_id?: PostId;
comment_id?: CommentId;
page?: number;
limit?: number;
hide_modlog_names: boolean;
};

View file

@ -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 person_content_combined table
*/
export type PersonContentCombinedPaginationCursor = string;

View file

@ -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 { CommentView } from "./CommentView";
import type { PostView } from "./PostView";
export type PersonContentCombinedView =
| ({ type_: "Post" } & PostView)
| ({ type_: "Comment" } & CommentView);

View file

@ -0,0 +1,6 @@
// 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 various modlog actions.
*/
export type PersonContentType = "All" | "Comments" | "Posts";

View file

@ -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 person_saved_combined table
*/
export type PersonSavedCombinedPaginationCursor = string;

7
src/types/PostTags.ts Normal file
View file

@ -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 { Tag } from "./Tag";
/**
* we wrap this in a struct so we can implement FromSqlRow<Json> for it
*/
export type PostTags = { tags: Array<Tag> };

View file

@ -4,6 +4,7 @@ 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";
/**
@ -26,4 +27,5 @@ export type PostView = {
creator_blocked: boolean;
my_vote?: number;
unread_comments: number;
tags: PostTags;
};

View file

@ -1,16 +0,0 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { CommentReportId } from "./CommentReportId";
import type { PostReportId } from "./PostReportId";
import type { PrivateMessageReportId } from "./PrivateMessageReportId";
import type { ReportCombinedId } from "./ReportCombinedId";
/**
* A combined reports table.
*/
export type ReportCombined = {
id: ReportCombinedId;
published: string;
post_report_id?: PostReportId;
comment_report_id?: CommentReportId;
private_message_report_id?: PrivateMessageReportId;
};

View file

@ -20,7 +20,6 @@ export type Search = {
limit?: number;
title_only?: boolean;
post_url_only?: boolean;
saved_only?: boolean;
liked_only?: boolean;
disliked_only?: boolean;
};

View file

@ -7,7 +7,7 @@ import type { SiteView } from "./SiteView";
export type SiteResponse = {
site_view: SiteView;
/**
* deprecated, use field `tagline` or /api/v3/tagline/list
* deprecated, use field `tagline` or /api/v4/tagline/list
*/
taglines: Array<null>;
};

29
src/types/Tag.ts Normal file
View file

@ -0,0 +1,29 @@
// 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 { DbUrl } from "./DbUrl";
import type { TagId } from "./TagId";
/**
* A tag that can be assigned to a post within a community.
* The tag object is created by the community moderators.
* The assignment happens by the post creator and can be updated by the community moderators.
*
* A tag is a federatable object that gives additional context to another object, which can be
* displayed and filtered on currently, we only have community post tags, which is a tag that is
* created by post authors as well as mods of a community, to categorize a post. in the future we
* may add more tag types, depending on the requirements, this will lead to either expansion of
* this table (community_id optional, addition of tag_type enum) or split of this table / creation
* of new tables.
*/
export type Tag = {
id: TagId;
ap_id: DbUrl;
name: string;
/**
* the community that owns this tag
*/
community_id: CommunityId;
published: string;
updated?: string;
deleted: boolean;
};

View file

@ -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 report combined id
* The internal tag id.
*/
export type ReportCombinedId = number;
export type TagId = number;