Removing auth and useless interfaces. (#181)

* Removing auth and useless interfaces.

* v0.19.0-rc.8

* v0.19.0-rc.10

* Changing jwt cookie to auth.

* Adding a few types merged from main.

* v0.19.0-rc.11

* Adding blockInstance fn.

* v0.19.0-rc.12
This commit is contained in:
Dessalines 2023-09-25 21:47:28 -04:00 committed by GitHub
parent f439a7ceda
commit ab7af88a2b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
103 changed files with 66 additions and 225 deletions

View file

@ -1,5 +1,10 @@
#!/bin/bash #!/bin/bash
# Remove the old bindings
pushd ../lemmy/crates
rm -rf **/bindings
popd
# First re-generate the types by running cargo test on lemmy # First re-generate the types by running cargo test on lemmy
pushd ../lemmy/scripts pushd ../lemmy/scripts
./test.sh ./test.sh
@ -24,5 +29,5 @@ find src/types -type f -name '*.ts' -exec sed -i 's/bigint/number/g' {} +
node putTypesInIndex.js node putTypesInIndex.js
prettier -w src/types prettier -w src/types src/index.ts

View file

@ -1,6 +1,6 @@
{ {
"name": "lemmy-js-client", "name": "lemmy-js-client",
"version": "0.19.0-rc.9", "version": "0.19.0-rc.12",
"description": "A javascript / typescript client for Lemmy", "description": "A javascript / typescript client for Lemmy",
"repository": "https://github.com/LemmyNet/lemmy-js-client", "repository": "https://github.com/LemmyNet/lemmy-js-client",
"license": "AGPL-3.0", "license": "AGPL-3.0",

View file

@ -48,15 +48,12 @@ import { EditPrivateMessage } from "./types/EditPrivateMessage";
import { EditSite } from "./types/EditSite"; import { EditSite } from "./types/EditSite";
import { FeaturePost } from "./types/FeaturePost"; import { FeaturePost } from "./types/FeaturePost";
import { FollowCommunity } from "./types/FollowCommunity"; import { FollowCommunity } from "./types/FollowCommunity";
import { GetBannedPersons } from "./types/GetBannedPersons";
import { GetCaptcha } from "./types/GetCaptcha";
import { GetCaptchaResponse } from "./types/GetCaptchaResponse"; import { GetCaptchaResponse } from "./types/GetCaptchaResponse";
import { GetComment } from "./types/GetComment"; import { GetComment } from "./types/GetComment";
import { GetComments } from "./types/GetComments"; import { GetComments } from "./types/GetComments";
import { GetCommentsResponse } from "./types/GetCommentsResponse"; import { GetCommentsResponse } from "./types/GetCommentsResponse";
import { GetCommunity } from "./types/GetCommunity"; import { GetCommunity } from "./types/GetCommunity";
import { GetCommunityResponse } from "./types/GetCommunityResponse"; import { GetCommunityResponse } from "./types/GetCommunityResponse";
import { GetFederatedInstances } from "./types/GetFederatedInstances";
import { GetFederatedInstancesResponse } from "./types/GetFederatedInstancesResponse"; import { GetFederatedInstancesResponse } from "./types/GetFederatedInstancesResponse";
import { GetModlog } from "./types/GetModlog"; import { GetModlog } from "./types/GetModlog";
import { GetModlogResponse } from "./types/GetModlogResponse"; import { GetModlogResponse } from "./types/GetModlogResponse";
@ -73,15 +70,11 @@ import { GetReplies } from "./types/GetReplies";
import { GetRepliesResponse } from "./types/GetRepliesResponse"; import { GetRepliesResponse } from "./types/GetRepliesResponse";
import { GetReportCount } from "./types/GetReportCount"; import { GetReportCount } from "./types/GetReportCount";
import { GetReportCountResponse } from "./types/GetReportCountResponse"; import { GetReportCountResponse } from "./types/GetReportCountResponse";
import { GetSite } from "./types/GetSite";
import { GetSiteMetadata } from "./types/GetSiteMetadata"; import { GetSiteMetadata } from "./types/GetSiteMetadata";
import { GetSiteMetadataResponse } from "./types/GetSiteMetadataResponse"; import { GetSiteMetadataResponse } from "./types/GetSiteMetadataResponse";
import { GetSiteResponse } from "./types/GetSiteResponse"; import { GetSiteResponse } from "./types/GetSiteResponse";
import { GetUnreadCount } from "./types/GetUnreadCount";
import { GetUnreadCountResponse } from "./types/GetUnreadCountResponse"; import { GetUnreadCountResponse } from "./types/GetUnreadCountResponse";
import { GetUnreadRegistrationApplicationCount } from "./types/GetUnreadRegistrationApplicationCount";
import { GetUnreadRegistrationApplicationCountResponse } from "./types/GetUnreadRegistrationApplicationCountResponse"; import { GetUnreadRegistrationApplicationCountResponse } from "./types/GetUnreadRegistrationApplicationCountResponse";
import { LeaveAdmin } from "./types/LeaveAdmin";
import { ListCommentReports } from "./types/ListCommentReports"; import { ListCommentReports } from "./types/ListCommentReports";
import { ListCommentReportsResponse } from "./types/ListCommentReportsResponse"; import { ListCommentReportsResponse } from "./types/ListCommentReportsResponse";
import { ListCommunities } from "./types/ListCommunities"; import { ListCommunities } from "./types/ListCommunities";
@ -95,7 +88,6 @@ import { ListRegistrationApplicationsResponse } from "./types/ListRegistrationAp
import { LockPost } from "./types/LockPost"; import { LockPost } from "./types/LockPost";
import { Login } from "./types/Login"; import { Login } from "./types/Login";
import { LoginResponse } from "./types/LoginResponse"; import { LoginResponse } from "./types/LoginResponse";
import { MarkAllAsRead } from "./types/MarkAllAsRead";
import { MarkCommentReplyAsRead } from "./types/MarkCommentReplyAsRead"; import { MarkCommentReplyAsRead } from "./types/MarkCommentReplyAsRead";
import { MarkPersonMentionAsRead } from "./types/MarkPersonMentionAsRead"; import { MarkPersonMentionAsRead } from "./types/MarkPersonMentionAsRead";
import { MarkPostAsRead } from "./types/MarkPostAsRead"; import { MarkPostAsRead } from "./types/MarkPostAsRead";
@ -134,9 +126,9 @@ import { TransferCommunity } from "./types/TransferCommunity";
import { VerifyEmail } from "./types/VerifyEmail"; import { VerifyEmail } from "./types/VerifyEmail";
import { VerifyEmailResponse } from "./types/VerifyEmailResponse"; import { VerifyEmailResponse } from "./types/VerifyEmailResponse";
import { UploadImage, UploadImageResponse, VERSION } from "./types/others"; import { UploadImage, UploadImageResponse, VERSION } from "./types/others";
import { HideCommunity } from "./types/HideCommunity";
import { BlockInstance } from "./types/BlockInstance"; import { BlockInstance } from "./types/BlockInstance";
import { BlockInstanceResponse } from "./types/BlockInstanceResponse"; import { BlockInstanceResponse } from "./types/BlockInstanceResponse";
import { HideCommunity } from "./types/HideCommunity";
enum HttpType { enum HttpType {
Get = "GET", Get = "GET",
@ -181,8 +173,8 @@ export class LemmyHttp {
* *
* `HTTP.GET /site` * `HTTP.GET /site`
*/ */
getSite(form: GetSite = {}) { getSite() {
return this.#wrapper<GetSite, GetSiteResponse>(HttpType.Get, "/site", form); return this.#wrapper<object, GetSiteResponse>(HttpType.Get, "/site", {});
} }
/** /**
@ -212,11 +204,11 @@ export class LemmyHttp {
* *
* `HTTP.POST /user/leave_admin` * `HTTP.POST /user/leave_admin`
*/ */
leaveAdmin(form: LeaveAdmin) { leaveAdmin() {
return this.#wrapper<LeaveAdmin, GetSiteResponse>( return this.#wrapper<object, GetSiteResponse>(
HttpType.Post, HttpType.Post,
"/user/leave_admin", "/user/leave_admin",
form, {},
); );
} }
@ -964,11 +956,11 @@ export class LemmyHttp {
* *
* `HTTP.GET /user/banned` * `HTTP.GET /user/banned`
*/ */
getBannedPersons(form: GetBannedPersons) { getBannedPersons() {
return this.#wrapper<GetBannedPersons, BannedPersonsResponse>( return this.#wrapper<object, BannedPersonsResponse>(
HttpType.Get, HttpType.Get,
"/user/banned", "/user/banned",
form, {},
); );
} }
@ -990,11 +982,11 @@ export class LemmyHttp {
* *
* `HTTP.GET /user/get_captcha` * `HTTP.GET /user/get_captcha`
*/ */
getCaptcha(form: GetCaptcha = {}) { getCaptcha() {
return this.#wrapper<GetCaptcha, GetCaptchaResponse>( return this.#wrapper<object, GetCaptchaResponse>(
HttpType.Get, HttpType.Get,
"/user/get_captcha", "/user/get_captcha",
form, {},
); );
} }
@ -1042,11 +1034,11 @@ export class LemmyHttp {
* *
* `HTTP.POST /user/mark_all_as_read` * `HTTP.POST /user/mark_all_as_read`
*/ */
markAllAsRead(form: MarkAllAsRead) { markAllAsRead() {
return this.#wrapper<MarkAllAsRead, GetRepliesResponse>( return this.#wrapper<object, GetRepliesResponse>(
HttpType.Post, HttpType.Post,
"/user/mark_all_as_read", "/user/mark_all_as_read",
form, {},
); );
} }
@ -1094,11 +1086,11 @@ export class LemmyHttp {
* *
* `HTTP.GET /user/unread_count` * `HTTP.GET /user/unread_count`
*/ */
getUnreadCount(form: GetUnreadCount) { getUnreadCount() {
return this.#wrapper<GetUnreadCount, GetUnreadCountResponse>( return this.#wrapper<object, GetUnreadCountResponse>(
HttpType.Get, HttpType.Get,
"/user/unread_count", "/user/unread_count",
form, {},
); );
} }
@ -1133,13 +1125,12 @@ export class LemmyHttp {
* *
* `HTTP.GET /admin/registration_application/count` * `HTTP.GET /admin/registration_application/count`
*/ */
getUnreadRegistrationApplicationCount( getUnreadRegistrationApplicationCount() {
form: GetUnreadRegistrationApplicationCount, return this.#wrapper<object, GetUnreadRegistrationApplicationCountResponse>(
) { HttpType.Get,
return this.#wrapper< "/admin/registration_application/count",
GetUnreadRegistrationApplicationCount, {},
GetUnreadRegistrationApplicationCountResponse );
>(HttpType.Get, "/admin/registration_application/count", form);
} }
/** /**
@ -1262,18 +1253,18 @@ export class LemmyHttp {
* *
* `HTTP.Get /federated_instances` * `HTTP.Get /federated_instances`
*/ */
getFederatedInstances(form: GetFederatedInstances = {}) { getFederatedInstances() {
return this.#wrapper<GetFederatedInstances, GetFederatedInstancesResponse>( return this.#wrapper<object, GetFederatedInstancesResponse>(
HttpType.Get, HttpType.Get,
"/federated_instances", "/federated_instances",
form, {},
); );
} }
/** /**
* Block an instance * Block an instance.
* *
* `HTTP.POST /site/block` * `HTTP.Post /site/block`
*/ */
blockInstance(form: BlockInstance) { blockInstance(form: BlockInstance) {
return this.#wrapper<BlockInstance, BlockInstanceResponse>( return this.#wrapper<BlockInstance, BlockInstanceResponse>(
@ -1292,13 +1283,13 @@ export class LemmyHttp {
}: UploadImage): Promise<UploadImageResponse> { }: UploadImage): Promise<UploadImageResponse> {
const formData = createFormData(image); const formData = createFormData(image);
// If jwt cookie not already set by browser, set it with passed in auth // If auth cookie not already set by browser, set it with passed in auth
const headers = {} as any; const headers = {} as any;
if ( if (
!globalThis?.document?.cookie?.includes("jwt=") && !globalThis?.document?.cookie?.includes("auth=") &&
!this.#headers?.Cookie?.includes("jwt=") !this.#headers?.Cookie?.includes("auth=")
) { ) {
headers.Cookie = `jwt=${auth}`; headers.Cookie = `auth=${auth}`;
} }
let url: string | undefined = undefined; let url: string | undefined = undefined;

View file

@ -45,8 +45,6 @@ export { CommunityBlockId } from "./types/CommunityBlockId";
export { CommunityBlockView } from "./types/CommunityBlockView"; export { CommunityBlockView } from "./types/CommunityBlockView";
export { CommunityFollowerView } from "./types/CommunityFollowerView"; export { CommunityFollowerView } from "./types/CommunityFollowerView";
export { CommunityId } from "./types/CommunityId"; export { CommunityId } from "./types/CommunityId";
export { CommunityJoin } from "./types/CommunityJoin";
export { CommunityJoinResponse } from "./types/CommunityJoinResponse";
export { CommunityModeratorView } from "./types/CommunityModeratorView"; export { CommunityModeratorView } from "./types/CommunityModeratorView";
export { CommunityResponse } from "./types/CommunityResponse"; export { CommunityResponse } from "./types/CommunityResponse";
export { CommunityView } from "./types/CommunityView"; export { CommunityView } from "./types/CommunityView";
@ -84,15 +82,12 @@ export { EditSite } from "./types/EditSite";
export { FeaturePost } from "./types/FeaturePost"; export { FeaturePost } from "./types/FeaturePost";
export { FederatedInstances } from "./types/FederatedInstances"; export { FederatedInstances } from "./types/FederatedInstances";
export { FollowCommunity } from "./types/FollowCommunity"; export { FollowCommunity } from "./types/FollowCommunity";
export { GetBannedPersons } from "./types/GetBannedPersons";
export { GetCaptcha } from "./types/GetCaptcha";
export { GetCaptchaResponse } from "./types/GetCaptchaResponse"; export { GetCaptchaResponse } from "./types/GetCaptchaResponse";
export { GetComment } from "./types/GetComment"; export { GetComment } from "./types/GetComment";
export { GetComments } from "./types/GetComments"; export { GetComments } from "./types/GetComments";
export { GetCommentsResponse } from "./types/GetCommentsResponse"; export { GetCommentsResponse } from "./types/GetCommentsResponse";
export { GetCommunity } from "./types/GetCommunity"; export { GetCommunity } from "./types/GetCommunity";
export { GetCommunityResponse } from "./types/GetCommunityResponse"; export { GetCommunityResponse } from "./types/GetCommunityResponse";
export { GetFederatedInstances } from "./types/GetFederatedInstances";
export { GetFederatedInstancesResponse } from "./types/GetFederatedInstancesResponse"; export { GetFederatedInstancesResponse } from "./types/GetFederatedInstancesResponse";
export { GetModlog } from "./types/GetModlog"; export { GetModlog } from "./types/GetModlog";
export { GetModlogResponse } from "./types/GetModlogResponse"; export { GetModlogResponse } from "./types/GetModlogResponse";
@ -109,21 +104,19 @@ export { GetReplies } from "./types/GetReplies";
export { GetRepliesResponse } from "./types/GetRepliesResponse"; export { GetRepliesResponse } from "./types/GetRepliesResponse";
export { GetReportCount } from "./types/GetReportCount"; export { GetReportCount } from "./types/GetReportCount";
export { GetReportCountResponse } from "./types/GetReportCountResponse"; export { GetReportCountResponse } from "./types/GetReportCountResponse";
export { GetSite } from "./types/GetSite";
export { GetSiteMetadata } from "./types/GetSiteMetadata"; export { GetSiteMetadata } from "./types/GetSiteMetadata";
export { GetSiteMetadataResponse } from "./types/GetSiteMetadataResponse"; export { GetSiteMetadataResponse } from "./types/GetSiteMetadataResponse";
export { GetSiteResponse } from "./types/GetSiteResponse"; export { GetSiteResponse } from "./types/GetSiteResponse";
export { GetUnreadCount } from "./types/GetUnreadCount";
export { GetUnreadCountResponse } from "./types/GetUnreadCountResponse"; export { GetUnreadCountResponse } from "./types/GetUnreadCountResponse";
export { GetUnreadRegistrationApplicationCount } from "./types/GetUnreadRegistrationApplicationCount";
export { GetUnreadRegistrationApplicationCountResponse } from "./types/GetUnreadRegistrationApplicationCountResponse"; export { GetUnreadRegistrationApplicationCountResponse } from "./types/GetUnreadRegistrationApplicationCountResponse";
export { HideCommunity } from "./types/HideCommunity"; export { HideCommunity } from "./types/HideCommunity";
export { ImageUpload } from "./types/ImageUpload";
export { ImageUploadId } from "./types/ImageUploadId";
export { Instance } from "./types/Instance"; export { Instance } from "./types/Instance";
export { InstanceBlockView } from "./types/InstanceBlockView"; export { InstanceBlockView } from "./types/InstanceBlockView";
export { InstanceId } from "./types/InstanceId"; export { InstanceId } from "./types/InstanceId";
export { Language } from "./types/Language"; export { Language } from "./types/Language";
export { LanguageId } from "./types/LanguageId"; export { LanguageId } from "./types/LanguageId";
export { LeaveAdmin } from "./types/LeaveAdmin";
export { LemmyErrorType } from "./types/LemmyErrorType"; export { LemmyErrorType } from "./types/LemmyErrorType";
export { ListCommentReports } from "./types/ListCommentReports"; export { ListCommentReports } from "./types/ListCommentReports";
export { ListCommentReportsResponse } from "./types/ListCommentReportsResponse"; export { ListCommentReportsResponse } from "./types/ListCommentReportsResponse";
@ -145,7 +138,6 @@ export { LocalUserView } from "./types/LocalUserView";
export { LockPost } from "./types/LockPost"; export { LockPost } from "./types/LockPost";
export { Login } from "./types/Login"; export { Login } from "./types/Login";
export { LoginResponse } from "./types/LoginResponse"; export { LoginResponse } from "./types/LoginResponse";
export { MarkAllAsRead } from "./types/MarkAllAsRead";
export { MarkCommentReplyAsRead } from "./types/MarkCommentReplyAsRead"; export { MarkCommentReplyAsRead } from "./types/MarkCommentReplyAsRead";
export { MarkPersonMentionAsRead } from "./types/MarkPersonMentionAsRead"; export { MarkPersonMentionAsRead } from "./types/MarkPersonMentionAsRead";
export { MarkPostAsRead } from "./types/MarkPostAsRead"; export { MarkPostAsRead } from "./types/MarkPostAsRead";
@ -162,8 +154,6 @@ export { ModFeaturePost } from "./types/ModFeaturePost";
export { ModFeaturePostView } from "./types/ModFeaturePostView"; export { ModFeaturePostView } from "./types/ModFeaturePostView";
export { ModHideCommunity } from "./types/ModHideCommunity"; export { ModHideCommunity } from "./types/ModHideCommunity";
export { ModHideCommunityView } from "./types/ModHideCommunityView"; export { ModHideCommunityView } from "./types/ModHideCommunityView";
export { ModJoin } from "./types/ModJoin";
export { ModJoinResponse } from "./types/ModJoinResponse";
export { ModLockPost } from "./types/ModLockPost"; export { ModLockPost } from "./types/ModLockPost";
export { ModLockPostView } from "./types/ModLockPostView"; export { ModLockPostView } from "./types/ModLockPostView";
export { ModRemoveComment } from "./types/ModRemoveComment"; export { ModRemoveComment } from "./types/ModRemoveComment";
@ -177,6 +167,7 @@ export { ModTransferCommunityView } from "./types/ModTransferCommunityView";
export { ModlogActionType } from "./types/ModlogActionType"; export { ModlogActionType } from "./types/ModlogActionType";
export { ModlogListParams } from "./types/ModlogListParams"; export { ModlogListParams } from "./types/ModlogListParams";
export { MyUserInfo } from "./types/MyUserInfo"; export { MyUserInfo } from "./types/MyUserInfo";
export { PaginationCursor } from "./types/PaginationCursor";
export { PasswordChangeAfterReset } from "./types/PasswordChangeAfterReset"; export { PasswordChangeAfterReset } from "./types/PasswordChangeAfterReset";
export { PasswordReset } from "./types/PasswordReset"; export { PasswordReset } from "./types/PasswordReset";
export { PasswordResetResponse } from "./types/PasswordResetResponse"; export { PasswordResetResponse } from "./types/PasswordResetResponse";
@ -195,10 +186,7 @@ export { Post } from "./types/Post";
export { PostAggregates } from "./types/PostAggregates"; export { PostAggregates } from "./types/PostAggregates";
export { PostFeatureType } from "./types/PostFeatureType"; export { PostFeatureType } from "./types/PostFeatureType";
export { PostId } from "./types/PostId"; export { PostId } from "./types/PostId";
export { PostJoin } from "./types/PostJoin";
export { PostJoinResponse } from "./types/PostJoinResponse";
export { PostListingMode } from "./types/PostListingMode"; export { PostListingMode } from "./types/PostListingMode";
export { PostOrCommentId } from "./types/PostOrCommentId";
export { PostReport } from "./types/PostReport"; export { PostReport } from "./types/PostReport";
export { PostReportId } from "./types/PostReportId"; export { PostReportId } from "./types/PostReportId";
export { PostReportResponse } from "./types/PostReportResponse"; export { PostReportResponse } from "./types/PostReportResponse";
@ -248,8 +236,6 @@ export { SortType } from "./types/SortType";
export { SubscribedType } from "./types/SubscribedType"; export { SubscribedType } from "./types/SubscribedType";
export { Tagline } from "./types/Tagline"; export { Tagline } from "./types/Tagline";
export { TransferCommunity } from "./types/TransferCommunity"; export { TransferCommunity } from "./types/TransferCommunity";
export { UserJoin } from "./types/UserJoin";
export { UserJoinResponse } from "./types/UserJoinResponse";
export { VerifyEmail } from "./types/VerifyEmail"; export { VerifyEmail } from "./types/VerifyEmail";
export { VerifyEmailResponse } from "./types/VerifyEmailResponse"; export { VerifyEmailResponse } from "./types/VerifyEmailResponse";
export { UploadImage, UploadImageResponse, ImageFile } from "./types/others"; export { UploadImage, UploadImageResponse, ImageFile } from "./types/others";

View file

@ -4,5 +4,4 @@ import type { PersonId } from "./PersonId";
export interface AddAdmin { export interface AddAdmin {
person_id: PersonId; person_id: PersonId;
added: boolean; added: boolean;
auth: string;
} }

View file

@ -6,5 +6,4 @@ export interface AddModToCommunity {
community_id: CommunityId; community_id: CommunityId;
person_id: PersonId; person_id: PersonId;
added: boolean; added: boolean;
auth: string;
} }

View file

@ -4,5 +4,4 @@ export interface ApproveRegistrationApplication {
id: number; id: number;
approve: boolean; approve: boolean;
deny_reason?: string; deny_reason?: string;
auth: string;
} }

View file

@ -9,5 +9,4 @@ export interface BanFromCommunity {
remove_data?: boolean; remove_data?: boolean;
reason?: string; reason?: string;
expires?: number; expires?: number;
auth: string;
} }

View file

@ -7,5 +7,4 @@ export interface BanPerson {
remove_data?: boolean; remove_data?: boolean;
reason?: string; reason?: string;
expires?: number; expires?: number;
auth: string;
} }

View file

@ -4,5 +4,4 @@ import type { CommunityId } from "./CommunityId";
export interface BlockCommunity { export interface BlockCommunity {
community_id: CommunityId; community_id: CommunityId;
block: boolean; block: boolean;
auth: string;
} }

View file

@ -4,5 +4,4 @@ import type { InstanceId } from "./InstanceId";
export interface BlockInstance { export interface BlockInstance {
instance_id: InstanceId; instance_id: InstanceId;
block: boolean; block: boolean;
auth: string;
} }

View file

@ -4,5 +4,4 @@ import type { PersonId } from "./PersonId";
export interface BlockPerson { export interface BlockPerson {
person_id: PersonId; person_id: PersonId;
block: boolean; block: boolean;
auth: string;
} }

View file

@ -4,5 +4,4 @@ export interface ChangePassword {
new_password: string; new_password: string;
new_password_verify: string; new_password_verify: string;
old_password: string; old_password: string;
auth: string;
} }

View file

@ -16,8 +16,6 @@ export interface Community {
local: boolean; local: boolean;
icon?: string; icon?: string;
banner?: string; banner?: string;
followers_url: string;
inbox_url: string;
hidden: boolean; hidden: boolean;
posting_restricted_to_mods: boolean; posting_restricted_to_mods: boolean;
instance_id: InstanceId; instance_id: InstanceId;

View file

@ -1,6 +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";
export interface CommunityJoin {
community_id: CommunityId;
}

View file

@ -1,5 +0,0 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
export interface CommunityJoinResponse {
joined: boolean;
}

View file

@ -8,5 +8,4 @@ export interface CreateComment {
post_id: PostId; post_id: PostId;
parent_id?: CommentId; parent_id?: CommentId;
language_id?: LanguageId; language_id?: LanguageId;
auth: string;
} }

View file

@ -4,5 +4,4 @@ import type { CommentId } from "./CommentId";
export interface CreateCommentLike { export interface CreateCommentLike {
comment_id: CommentId; comment_id: CommentId;
score: number; score: number;
auth: string;
} }

View file

@ -4,5 +4,4 @@ import type { CommentId } from "./CommentId";
export interface CreateCommentReport { export interface CreateCommentReport {
comment_id: CommentId; comment_id: CommentId;
reason: string; reason: string;
auth: string;
} }

View file

@ -10,5 +10,4 @@ export interface CreateCommunity {
nsfw?: boolean; nsfw?: boolean;
posting_restricted_to_mods?: boolean; posting_restricted_to_mods?: boolean;
discussion_languages?: Array<LanguageId>; discussion_languages?: Array<LanguageId>;
auth: string;
} }

View file

@ -6,5 +6,4 @@ export interface CreateCustomEmoji {
image_url: string; image_url: string;
alt_text: string; alt_text: string;
keywords: Array<string>; keywords: Array<string>;
auth: string;
} }

View file

@ -10,5 +10,4 @@ export interface CreatePost {
honeypot?: string; honeypot?: string;
nsfw?: boolean; nsfw?: boolean;
language_id?: LanguageId; language_id?: LanguageId;
auth: string;
} }

View file

@ -4,5 +4,4 @@ import type { PostId } from "./PostId";
export interface CreatePostLike { export interface CreatePostLike {
post_id: PostId; post_id: PostId;
score: number; score: number;
auth: string;
} }

View file

@ -4,5 +4,4 @@ import type { PostId } from "./PostId";
export interface CreatePostReport { export interface CreatePostReport {
post_id: PostId; post_id: PostId;
reason: string; reason: string;
auth: string;
} }

View file

@ -4,5 +4,4 @@ import type { PersonId } from "./PersonId";
export interface CreatePrivateMessage { export interface CreatePrivateMessage {
content: string; content: string;
recipient_id: PersonId; recipient_id: PersonId;
auth: string;
} }

View file

@ -4,5 +4,4 @@ import type { PrivateMessageId } from "./PrivateMessageId";
export interface CreatePrivateMessageReport { export interface CreatePrivateMessageReport {
private_message_id: PrivateMessageId; private_message_id: PrivateMessageId;
reason: string; reason: string;
auth: string;
} }

View file

@ -43,5 +43,4 @@ export interface CreateSite {
blocked_instances?: Array<string>; blocked_instances?: Array<string>;
taglines?: Array<string>; taglines?: Array<string>;
registration_mode?: RegistrationMode; registration_mode?: RegistrationMode;
auth: string;
} }

View file

@ -3,5 +3,4 @@
export interface DeleteAccount { export interface DeleteAccount {
password: string; password: string;
delete_content: boolean; delete_content: boolean;
auth: string;
} }

View file

@ -1,3 +1,3 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. // 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<string, never>;

View file

@ -4,5 +4,4 @@ import type { CommentId } from "./CommentId";
export interface DeleteComment { export interface DeleteComment {
comment_id: CommentId; comment_id: CommentId;
deleted: boolean; deleted: boolean;
auth: string;
} }

View file

@ -4,5 +4,4 @@ import type { CommunityId } from "./CommunityId";
export interface DeleteCommunity { export interface DeleteCommunity {
community_id: CommunityId; community_id: CommunityId;
deleted: boolean; deleted: boolean;
auth: string;
} }

View file

@ -3,5 +3,4 @@ import type { CustomEmojiId } from "./CustomEmojiId";
export interface DeleteCustomEmoji { export interface DeleteCustomEmoji {
id: CustomEmojiId; id: CustomEmojiId;
auth: string;
} }

View file

@ -4,5 +4,4 @@ import type { PostId } from "./PostId";
export interface DeletePost { export interface DeletePost {
post_id: PostId; post_id: PostId;
deleted: boolean; deleted: boolean;
auth: string;
} }

View file

@ -4,5 +4,4 @@ import type { PrivateMessageId } from "./PrivateMessageId";
export interface DeletePrivateMessage { export interface DeletePrivateMessage {
private_message_id: PrivateMessageId; private_message_id: PrivateMessageId;
deleted: boolean; deleted: boolean;
auth: string;
} }

View file

@ -4,5 +4,4 @@ import type { CommentId } from "./CommentId";
export interface DistinguishComment { export interface DistinguishComment {
comment_id: CommentId; comment_id: CommentId;
distinguished: boolean; distinguished: boolean;
auth: string;
} }

View file

@ -6,5 +6,4 @@ export interface EditComment {
comment_id: CommentId; comment_id: CommentId;
content?: string; content?: string;
language_id?: LanguageId; language_id?: LanguageId;
auth: string;
} }

View file

@ -11,5 +11,4 @@ export interface EditCommunity {
nsfw?: boolean; nsfw?: boolean;
posting_restricted_to_mods?: boolean; posting_restricted_to_mods?: boolean;
discussion_languages?: Array<LanguageId>; discussion_languages?: Array<LanguageId>;
auth: string;
} }

View file

@ -7,5 +7,4 @@ export interface EditCustomEmoji {
image_url: string; image_url: string;
alt_text: string; alt_text: string;
keywords: Array<string>; keywords: Array<string>;
auth: string;
} }

View file

@ -9,5 +9,4 @@ export interface EditPost {
body?: string; body?: string;
nsfw?: boolean; nsfw?: boolean;
language_id?: LanguageId; language_id?: LanguageId;
auth: string;
} }

View file

@ -4,5 +4,4 @@ import type { PrivateMessageId } from "./PrivateMessageId";
export interface EditPrivateMessage { export interface EditPrivateMessage {
private_message_id: PrivateMessageId; private_message_id: PrivateMessageId;
content: string; content: string;
auth: string;
} }

View file

@ -44,5 +44,4 @@ export interface EditSite {
taglines?: Array<string>; taglines?: Array<string>;
registration_mode?: RegistrationMode; registration_mode?: RegistrationMode;
reports_email_admins?: boolean; reports_email_admins?: boolean;
auth: string;
} }

View file

@ -6,5 +6,4 @@ export interface FeaturePost {
post_id: PostId; post_id: PostId;
featured: boolean; featured: boolean;
feature_type: PostFeatureType; feature_type: PostFeatureType;
auth: string;
} }

View file

@ -4,5 +4,4 @@ import type { CommunityId } from "./CommunityId";
export interface FollowCommunity { export interface FollowCommunity {
community_id: CommunityId; community_id: CommunityId;
follow: boolean; follow: boolean;
auth: string;
} }

View file

@ -1,5 +0,0 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
export interface GetBannedPersons {
auth: string;
}

View file

@ -1,5 +0,0 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
export interface GetCaptcha {
auth?: string;
}

View file

@ -3,5 +3,4 @@ import type { CommentId } from "./CommentId";
export interface GetComment { export interface GetComment {
id: CommentId; id: CommentId;
auth?: string;
} }

View file

@ -18,5 +18,4 @@ export interface GetComments {
saved_only?: boolean; saved_only?: boolean;
liked_only?: boolean; liked_only?: boolean;
disliked_only?: boolean; disliked_only?: boolean;
auth?: string;
} }

View file

@ -4,5 +4,4 @@ import type { CommunityId } from "./CommunityId";
export interface GetCommunity { export interface GetCommunity {
id?: CommunityId; id?: CommunityId;
name?: string; name?: string;
auth?: string;
} }

View file

@ -1,5 +0,0 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
export interface GetFederatedInstances {
auth?: string;
}

View file

@ -10,5 +10,4 @@ export interface GetModlog {
limit?: number; limit?: number;
type_?: ModlogActionType; type_?: ModlogActionType;
other_person_id?: PersonId; other_person_id?: PersonId;
auth?: string;
} }

View file

@ -11,5 +11,4 @@ export interface GetPersonDetails {
limit?: number; limit?: number;
community_id?: CommunityId; community_id?: CommunityId;
saved_only?: boolean; saved_only?: boolean;
auth?: string;
} }

View file

@ -6,5 +6,4 @@ export interface GetPersonMentions {
page?: number; page?: number;
limit?: number; limit?: number;
unread_only?: boolean; unread_only?: boolean;
auth: string;
} }

View file

@ -5,5 +5,4 @@ import type { PostId } from "./PostId";
export interface GetPost { export interface GetPost {
id?: PostId; id?: PostId;
comment_id?: CommentId; comment_id?: CommentId;
auth?: string;
} }

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. // 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 { CommunityId } from "./CommunityId";
import type { ListingType } from "./ListingType"; import type { ListingType } from "./ListingType";
import type { PaginationCursor } from "./PaginationCursor";
import type { SortType } from "./SortType"; import type { SortType } from "./SortType";
export interface GetPosts { export interface GetPosts {
@ -13,5 +14,5 @@ export interface GetPosts {
saved_only?: boolean; saved_only?: boolean;
liked_only?: boolean; liked_only?: boolean;
disliked_only?: boolean; disliked_only?: boolean;
auth?: string; page_cursor?: PaginationCursor;
} }

View file

@ -1,6 +1,8 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. // 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"; import type { PostView } from "./PostView";
export interface GetPostsResponse { export interface GetPostsResponse {
posts: Array<PostView>; posts: Array<PostView>;
next_page?: PaginationCursor;
} }

View file

@ -6,5 +6,4 @@ export interface GetPrivateMessages {
page?: number; page?: number;
limit?: number; limit?: number;
creator_id?: PersonId; creator_id?: PersonId;
auth: string;
} }

View file

@ -6,5 +6,4 @@ export interface GetReplies {
page?: number; page?: number;
limit?: number; limit?: number;
unread_only?: boolean; unread_only?: boolean;
auth: string;
} }

View file

@ -3,5 +3,4 @@ import type { CommunityId } from "./CommunityId";
export interface GetReportCount { export interface GetReportCount {
community_id?: CommunityId; community_id?: CommunityId;
auth: string;
} }

View file

@ -1,5 +0,0 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
export interface GetUnreadCount {
auth: string;
}

View file

@ -1,5 +0,0 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
export interface GetUnreadRegistrationApplicationCount {
auth: string;
}

View file

@ -5,5 +5,4 @@ export interface HideCommunity {
community_id: CommunityId; community_id: CommunityId;
hidden: boolean; hidden: boolean;
reason?: string; reason?: string;
auth: string;
} }

11
src/types/ImageUpload.ts Normal file
View file

@ -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 { ImageUploadId } from "./ImageUploadId";
import type { LocalUserId } from "./LocalUserId";
export interface ImageUpload {
id: ImageUploadId;
local_user_id: LocalUserId;
pictrs_alias: string;
pictrs_delete_token: string;
published: string;
}

View file

@ -1,5 +1,3 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
export interface UserJoin { export type ImageUploadId = number;
auth: string;
}

View file

@ -1,5 +0,0 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
export interface LeaveAdmin {
auth: string;
}

View file

@ -6,5 +6,4 @@ export interface ListCommentReports {
limit?: number; limit?: number;
unresolved_only?: boolean; unresolved_only?: boolean;
community_id?: CommunityId; community_id?: CommunityId;
auth: string;
} }

View file

@ -8,5 +8,4 @@ export interface ListCommunities {
show_nsfw?: boolean; show_nsfw?: boolean;
page?: number; page?: number;
limit?: number; limit?: number;
auth?: string;
} }

View file

@ -6,5 +6,4 @@ export interface ListPostReports {
limit?: number; limit?: number;
unresolved_only?: boolean; unresolved_only?: boolean;
community_id?: CommunityId; community_id?: CommunityId;
auth: string;
} }

View file

@ -4,5 +4,4 @@ export interface ListPrivateMessageReports {
page?: number; page?: number;
limit?: number; limit?: number;
unresolved_only?: boolean; unresolved_only?: boolean;
auth: string;
} }

View file

@ -4,5 +4,4 @@ export interface ListRegistrationApplications {
unread_only?: boolean; unread_only?: boolean;
page?: number; page?: number;
limit?: number; limit?: number;
auth: string;
} }

View file

@ -4,5 +4,4 @@ import type { PostId } from "./PostId";
export interface LockPost { export interface LockPost {
post_id: PostId; post_id: PostId;
locked: boolean; locked: boolean;
auth: string;
} }

View file

@ -1,5 +0,0 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
export interface MarkAllAsRead {
auth: string;
}

View file

@ -4,5 +4,4 @@ import type { CommentReplyId } from "./CommentReplyId";
export interface MarkCommentReplyAsRead { export interface MarkCommentReplyAsRead {
comment_reply_id: CommentReplyId; comment_reply_id: CommentReplyId;
read: boolean; read: boolean;
auth: string;
} }

View file

@ -4,5 +4,4 @@ import type { PersonMentionId } from "./PersonMentionId";
export interface MarkPersonMentionAsRead { export interface MarkPersonMentionAsRead {
person_mention_id: PersonMentionId; person_mention_id: PersonMentionId;
read: boolean; read: boolean;
auth: string;
} }

View file

@ -4,5 +4,4 @@ import type { PostId } from "./PostId";
export interface MarkPostAsRead { export interface MarkPostAsRead {
post_id: PostId; post_id: PostId;
read: boolean; read: boolean;
auth: string;
} }

View file

@ -4,5 +4,4 @@ import type { PrivateMessageId } from "./PrivateMessageId";
export interface MarkPrivateMessageAsRead { export interface MarkPrivateMessageAsRead {
private_message_id: PrivateMessageId; private_message_id: PrivateMessageId;
read: boolean; read: boolean;
auth: string;
} }

View file

@ -1,6 +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";
export interface ModJoin {
community_id: CommunityId;
}

View file

@ -1,5 +0,0 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
export interface ModJoinResponse {
joined: boolean;
}

View file

@ -1,5 +1,3 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
export interface GetSite { export type PaginationCursor = string;
auth?: string;
}

View file

@ -1,3 +1,3 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. // 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<string, never>;

View file

@ -15,7 +15,6 @@ export interface Person {
local: boolean; local: boolean;
banner?: string; banner?: string;
deleted: boolean; deleted: boolean;
inbox_url: string;
matrix_user_id?: string; matrix_user_id?: string;
bot_account: boolean; bot_account: boolean;
ban_expires?: string; ban_expires?: string;

View file

@ -22,4 +22,5 @@ export interface PostAggregates {
creator_id: PersonId; creator_id: PersonId;
controversy_rank: number; controversy_rank: number;
instance_id: InstanceId; instance_id: InstanceId;
scaled_rank: number;
} }

View file

@ -1,6 +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";
export interface PostJoin {
post_id: PostId;
}

View file

@ -1,5 +0,0 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
export interface PostJoinResponse {
joined: boolean;
}

View file

@ -1,5 +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 { PostId } from "./PostId";
export type PostOrCommentId = { Post: PostId } | { Comment: CommentId };

View file

@ -4,5 +4,4 @@ import type { CommentId } from "./CommentId";
export interface PurgeComment { export interface PurgeComment {
comment_id: CommentId; comment_id: CommentId;
reason?: string; reason?: string;
auth: string;
} }

View file

@ -4,5 +4,4 @@ import type { CommunityId } from "./CommunityId";
export interface PurgeCommunity { export interface PurgeCommunity {
community_id: CommunityId; community_id: CommunityId;
reason?: string; reason?: string;
auth: string;
} }

View file

@ -4,5 +4,4 @@ import type { PersonId } from "./PersonId";
export interface PurgePerson { export interface PurgePerson {
person_id: PersonId; person_id: PersonId;
reason?: string; reason?: string;
auth: string;
} }

View file

@ -4,5 +4,4 @@ import type { PostId } from "./PostId";
export interface PurgePost { export interface PurgePost {
post_id: PostId; post_id: PostId;
reason?: string; reason?: string;
auth: string;
} }

View file

@ -5,5 +5,4 @@ export interface RemoveComment {
comment_id: CommentId; comment_id: CommentId;
removed: boolean; removed: boolean;
reason?: string; reason?: string;
auth: string;
} }

View file

@ -6,5 +6,4 @@ export interface RemoveCommunity {
removed: boolean; removed: boolean;
reason?: string; reason?: string;
expires?: number; expires?: number;
auth: string;
} }

View file

@ -5,5 +5,4 @@ export interface RemovePost {
post_id: PostId; post_id: PostId;
removed: boolean; removed: boolean;
reason?: string; reason?: string;
auth: string;
} }

View file

@ -4,5 +4,4 @@ import type { CommentReportId } from "./CommentReportId";
export interface ResolveCommentReport { export interface ResolveCommentReport {
report_id: CommentReportId; report_id: CommentReportId;
resolved: boolean; resolved: boolean;
auth: string;
} }

View file

@ -2,5 +2,4 @@
export interface ResolveObject { export interface ResolveObject {
q: string; q: string;
auth: string | null;
} }

View file

@ -4,5 +4,4 @@ import type { PostReportId } from "./PostReportId";
export interface ResolvePostReport { export interface ResolvePostReport {
report_id: PostReportId; report_id: PostReportId;
resolved: boolean; resolved: boolean;
auth: string;
} }

View file

@ -4,5 +4,4 @@ import type { PrivateMessageReportId } from "./PrivateMessageReportId";
export interface ResolvePrivateMessageReport { export interface ResolvePrivateMessageReport {
report_id: PrivateMessageReportId; report_id: PrivateMessageReportId;
resolved: boolean; resolved: boolean;
auth: string;
} }

View file

@ -4,5 +4,4 @@ import type { CommentId } from "./CommentId";
export interface SaveComment { export interface SaveComment {
comment_id: CommentId; comment_id: CommentId;
save: boolean; save: boolean;
auth: string;
} }

View file

@ -4,5 +4,4 @@ import type { PostId } from "./PostId";
export interface SavePost { export interface SavePost {
post_id: PostId; post_id: PostId;
save: boolean; save: boolean;
auth: string;
} }

View file

@ -26,7 +26,6 @@ export interface SaveUserSettings {
show_new_post_notifs?: boolean; show_new_post_notifs?: boolean;
discussion_languages?: Array<LanguageId>; discussion_languages?: Array<LanguageId>;
generate_totp_2fa?: boolean; generate_totp_2fa?: boolean;
auth: string;
open_links_in_new_tab?: boolean; open_links_in_new_tab?: boolean;
infinite_scroll_enabled?: boolean; infinite_scroll_enabled?: boolean;
} }

View file

@ -15,5 +15,4 @@ export interface Search {
listing_type?: ListingType; listing_type?: ListingType;
page?: number; page?: number;
limit?: number; limit?: number;
auth?: string;
} }

View file

@ -18,4 +18,5 @@ export type SortType =
| "TopThreeMonths" | "TopThreeMonths"
| "TopSixMonths" | "TopSixMonths"
| "TopNineMonths" | "TopNineMonths"
| "Controversial"; | "Controversial"
| "Scaled";

Some files were not shown because too many files have changed in this diff Show more