diff --git a/.prettierrc b/.prettierrc index 188b944a..32a99389 100644 --- a/.prettierrc +++ b/.prettierrc @@ -4,7 +4,6 @@ "semi": false, "singleQuote": true, "htmlWhitespaceSensitivity": "ignore", - "plugins": ["prettier-plugin-svelte"], "overrides": [{ "files": "*.svelte", "options": { "parser": "svelte" } }] } diff --git a/README.md b/README.md index a2cfa023..36318420 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,6 @@ Jump to: Photon dark theme compact Photon light theme cozy - ## Self-hosting You selfhost a Photon frontend server for your Lemmy instance, or independently for any instance. @@ -39,6 +38,7 @@ To run an unconfigured Photon instance on port `8080`: ```sh docker run -p 8080:3000 ghcr.io/xyphyn/photon:latest ``` + ### Running natively Clone the repo: @@ -80,8 +80,11 @@ Photon lets you configure the default client settings and more. If you're hosting Photon for a Lemmy instance, you' ll almost definitely want to set these: - `PUBLIC_INSTANCE_URL` `string`: The domain which **the browser** will send API requests to. + - Example: `PUBLIC_INSTANCE_URL=fedi.phtn.app` +- `PUBLIC_INSTANCE_TYPE` `lemmyv3 | piefedalpha` (default: `lemmyv3`): If your instance is running Piefed, you must set this option to `piefedalpha`. Otherwise, you don't need to do anything. + - `PUBLIC_SSR_ENABLED` `boolean`: When enabled, will **make page requests be rendered server side first**, which allows search engine indexing, and basic non-js usage. - `PUBLIC_INTERNAL_INSTANCE` `string`: Only relevant if `PUBLIC_SSR_ENABLED=true`. This is the domain that the **server will make API requests to.** diff --git a/TODO.md b/TODO.md deleted file mode 100644 index 865ae160..00000000 --- a/TODO.md +++ /dev/null @@ -1,3 +0,0 @@ -# Todo - -- [ ] Add blocking instances and stuff diff --git a/bun.lockb b/bun.lockb index 868bcd47..76cd9658 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/eslint.config.js b/eslint.config.js index 4fd4d3a8..1a06e844 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -29,6 +29,7 @@ export default ts.config( 'svelte/prefer-writable-derived': 'off', 'no-console': 'off', '@typescript-eslint/no-explicit-any': 'off', + 'svelte/no-navigation-without-resolve': 'off', }, }, { diff --git a/package.json b/package.json index 6d915318..8f2d18c9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "photon-lemmy", - "version": "2.0.2", + "version": "2.0.3", "license": "AGPL-3.0-only", "devDependencies": { "@dicebear/core": "^8.0.1", @@ -26,6 +26,7 @@ "marked": "7.0.5", "marked-linkify-it": "^3.1.13", "nprogress": "^0.2.0", + "openapi-fetch": "^0.14.0", "postcss": "^8.4.30", "prettier": "^3.3.3", "prettier-plugin-svelte": "^3.2.7", diff --git a/src/lib/auth.svelte.ts b/src/lib/auth.svelte.ts index 43f1ea97..73ebb0c1 100644 --- a/src/lib/auth.svelte.ts +++ b/src/lib/auth.svelte.ts @@ -5,20 +5,16 @@ import { isAdmin, } from '$lib/components/lemmy/moderation/moderation.js' import { DEFAULT_INSTANCE_URL } from '$lib/instance.svelte.js' -import { client, getClient } from '$lib/lemmy.svelte.js' +import { client, getClient, site } from '$lib/client/lemmy.svelte' import { instanceToURL, moveItem } from '$lib/util.svelte' import { MINIMUM_VERSION, versionIsSupported } from '$lib/version.js' -import { - type Community, - type GetSiteResponse, - type MyUserInfo, -} from 'lemmy-js-client' import { toast } from 'mono-svelte' import { writable } from 'svelte/store' import { t } from './i18n/translations' -import { site } from './lemmy.svelte' import { errorMessage } from './lemmy/error' import { publishedToDate } from './components/util/date' +import type { Community, GetSiteResponse, MyUserInfo } from './client/types' +import { DEFAULT_CLIENT_TYPE, type ClientType } from './client/base' function getFromStorage(key: string): T | undefined { if (typeof localStorage == 'undefined') return undefined @@ -42,6 +38,7 @@ export interface ProfileInfo { avatar?: string favorites?: Community[] color?: string + client: ClientType } /** @@ -78,6 +75,7 @@ class Profile { instance: DEFAULT_INSTANCE_URL, username: 'Guest', color: '#505050', + client: DEFAULT_CLIENT_TYPE, }, ], profile: 1, @@ -92,6 +90,7 @@ class Profile { return { id: -1, instance: DEFAULT_INSTANCE_URL, + client: DEFAULT_CLIENT_TYPE, } } @@ -105,7 +104,11 @@ class Profile { const jwt = getCookie('jwt') if (jwt) { ;(async () => { - const result = await this.add(jwt, env.PUBLIC_INSTANCE_URL ?? '') + const result = await this.add( + jwt, + env.PUBLIC_INSTANCE_URL ?? '', + DEFAULT_CLIENT_TYPE, + ) if (result) toast({ @@ -221,7 +224,7 @@ class Profile { } } - async add(jwt: string, instance: string) { + async add(jwt: string, instance: string, type: ClientType) { const user = await userFromJwt(jwt, instance) .then(u => u) .catch(err => { @@ -242,6 +245,7 @@ class Profile { jwt: jwt, username: user?.user?.local_user_view.person.name, avatar: user?.user?.local_user_view.person.avatar, + client: type, }) return user diff --git a/src/lib/client/base.ts b/src/lib/client/base.ts new file mode 100644 index 00000000..2a943c70 --- /dev/null +++ b/src/lib/client/base.ts @@ -0,0 +1,238 @@ +import { env } from '$env/dynamic/public' +import * as types from './types' + +export type ClientType = + | { name: 'lemmy'; baseUrl: '/api/v3' } + | { name: 'piefed'; baseUrl: '/api/alpha' } + +export const DEFAULT_CLIENT_TYPE: ClientType = + env.PUBLIC_INSTANCE_TYPE == 'piefedalpha' + ? { + name: 'piefed', + baseUrl: '/api/alpha', + } + : { + name: 'lemmy', + baseUrl: '/api/v3', + } + +export abstract class BaseClient { + abstract type: ClientType + + abstract getSite(): Promise + abstract generateTotpSecret(): Promise + abstract listLogins(): Promise + abstract listAllMedia(form: types.ListMedia): Promise + abstract updateTotp(form: types.UpdateTotp): Promise + abstract getModlog(form: types.GetModlog): Promise + abstract search(form: types.Search): Promise + abstract resolveObject( + form: types.ResolveObject, + ): Promise + abstract createCommunity( + form: types.CreateCommunity, + ): Promise + abstract getCommunity( + form: types.GetCommunity, + ): Promise + abstract editCommunity( + form: types.EditCommunity, + ): Promise + abstract listCommunities( + form: types.ListCommunities, + ): Promise + abstract followCommunity( + form: types.FollowCommunity, + ): Promise + abstract blockCommunity( + form: types.BlockCommunity, + ): Promise + abstract deleteCommunity( + form: types.DeleteCommunity, + ): Promise + abstract hideCommunity( + form: types.HideCommunity, + ): Promise + abstract removeCommunity( + form: types.RemoveCommunity, + ): Promise + abstract banFromCommunity( + form: types.BanFromCommunity, + ): Promise + abstract addModToCommunity( + form: types.AddModToCommunity, + ): Promise + abstract createPost(form: types.CreatePost): Promise + abstract getPost(form: types.GetPost): Promise + abstract editPost(form: types.EditPost): Promise + abstract deletePost(form: types.DeletePost): Promise + abstract removePost(form: types.RemovePost): Promise + abstract markPostAsRead( + form: types.MarkPostAsRead, + ): Promise + abstract hidePost(form: types.HidePost): Promise + abstract lockPost(form: types.LockPost): Promise + abstract featurePost(form: types.FeaturePost): Promise + abstract getPosts(form: types.GetPosts): Promise + abstract likePost(form: types.CreatePostLike): Promise + abstract listPostLikes( + form: types.ListPostLikes, + ): Promise + abstract savePost(form: types.SavePost): Promise + // TODO should unify these reports probably + abstract createPostReport( + form: types.CreatePostReport, + ): Promise + abstract resolvePostReport( + form: types.ResolvePostReport, + ): Promise + abstract listPostReports( + form: types.ListPostReports, + ): Promise + abstract getSiteMetadata( + form: types.GetSiteMetadata, + ): Promise + abstract createComment( + form: types.CreateComment, + ): Promise + abstract editComment(form: types.EditComment): Promise + abstract deleteComment( + form: types.DeleteComment, + ): Promise + abstract removeComment( + form: types.RemoveComment, + ): Promise + abstract markCommentReplyAsRead( + form: types.MarkCommentReplyAsRead, + ): Promise + abstract likeComment( + form: types.CreateCommentLike, + ): Promise + abstract listCommentLikes( + form: types.ListCommentLikes, + ): Promise + // TODO unify saving with posts too + // i have options for unifying these since I'm making the API client myself now + abstract saveComment(form: types.SaveComment): Promise + abstract distinguishComment( + form: types.DistinguishComment, + ): Promise + abstract getComments( + form: types.GetComments, + ): Promise + abstract getComment(form: types.GetComment): Promise + abstract createCommentReport( + form: types.CreateCommentReport, + ): Promise + abstract resolveCommentReport( + form: types.ResolveCommentReport, + ): Promise + abstract listCommentReports( + form: types.ListCommentReports, + ): Promise + abstract getPrivateMessages( + form: types.GetPrivateMessages, + ): Promise + abstract createPrivateMessage( + form: types.CreatePrivateMessage, + ): Promise + abstract editPrivateMessage( + form: types.EditPrivateMessage, + ): Promise + abstract deletePrivateMessage( + form: types.DeletePrivateMessage, + ): Promise + abstract markPrivateMessageAsRead( + form: types.MarkPrivateMessageAsRead, + ): Promise + abstract createPrivateMessageReport( + form: types.CreatePrivateMessageReport, + ): Promise + abstract resolvePrivateMessageReport( + form: types.ResolvePrivateMessageReport, + ): Promise + abstract listPrivateMessageReports( + form: types.ListPrivateMessageReports, + ): Promise + abstract register(form: types.Register): Promise + abstract login(form: types.Login): Promise + abstract logout(): Promise + abstract getPersonDetails( + form: types.GetPersonDetails, + ): Promise + // TODO unify these inbox things too + abstract getPersonMentions( + form: types.GetPersonMentions, + ): Promise + abstract markPersonMentionAsRead( + form: types.MarkPersonMentionAsRead, + ): Promise + abstract getReplies(form: types.GetReplies): Promise + abstract banPerson(form: types.BanPerson): Promise + abstract getBannedPersons(): Promise + abstract blockPerson( + form: types.BlockPerson, + ): Promise + abstract getCaptcha(): Promise + abstract deleteAccount( + form: types.DeleteAccount, + ): Promise + abstract passwordReset( + form: types.PasswordReset, + ): Promise + abstract passwordChangeAfterReset( + form: types.PasswordChangeAfterReset, + ): Promise + abstract markAllAsRead(): Promise + abstract saveUserSettings( + form: types.SaveUserSettings, + ): Promise + abstract changePassword( + form: types.ChangePassword, + ): Promise + abstract getReportCount( + form: types.GetReportCount, + ): Promise + abstract getUnreadCount(): Promise + abstract verifyEmail(form: types.VerifyEmail): Promise + abstract addAdmin(form: types.AddAdmin): Promise + abstract getUnreadRegistrationApplicationCount(): Promise + abstract listRegistrationApplications( + form: types.ListRegistrationApplications, + ): Promise + abstract approveRegistrationApplication( + form: types.ApproveRegistrationApplication, + ): Promise + abstract getRegistrationApplication( + form: types.GetRegistrationApplication, + ): Promise + abstract purgePerson(form: types.PurgePerson): Promise + abstract purgeCommunity( + form: types.PurgeCommunity, + ): Promise + abstract purgePost(form: types.PurgePost): Promise + abstract purgeComment( + form: types.PurgeComment, + ): Promise + abstract getFederatedInstances(): Promise + abstract blockInstance( + form: types.BlockInstance, + ): Promise + abstract uploadImage( + form: types.UploadImage, + ): Promise + + abstract setFlair?(form: types.SetPersonFlair): Promise +} + +export type NullableFnArg = T extends ( + ...args: infer A +) => any + ? A + : Fallback + +export type NullableFnReturn = T extends ( + ...args: any[] +) => infer A + ? A + : Fallback diff --git a/src/lib/lemmy.svelte.ts b/src/lib/client/lemmy.svelte.ts similarity index 59% rename from src/lib/lemmy.svelte.ts rename to src/lib/client/lemmy.svelte.ts index a4eef268..17f83b5c 100644 --- a/src/lib/lemmy.svelte.ts +++ b/src/lib/client/lemmy.svelte.ts @@ -2,7 +2,10 @@ import { profile } from '$lib/auth.svelte' import { DEFAULT_INSTANCE_URL } from '$lib/instance.svelte.js' import { instanceToURL } from '$lib/util.svelte' import { error } from '@sveltejs/kit' -import { LemmyHttp, type GetSiteResponse } from 'lemmy-js-client' +import { type GetSiteResponse } from '$lib/client/types' +import { LemmyClient } from './lemmy/lemmy' +import { PiefedClient } from './piefed/piefed' +import { DEFAULT_CLIENT_TYPE, type ClientType, BaseClient } from './base' class SiteData { #data = $state() @@ -52,6 +55,7 @@ export function client({ instanceURL, func, auth, + clientType, }: { instanceURL?: string func?: ( @@ -59,22 +63,30 @@ export function client({ init?: RequestInit | undefined, ) => Promise auth?: string -} = {}) { + clientType?: ClientType +} = {}): BaseClient { if (!instanceURL) instanceURL = profile.current.instance || DEFAULT_INSTANCE_URL + if (!clientType) { + clientType = profile.current.client ?? DEFAULT_CLIENT_TYPE + } + // we use nullish coealsiaihsa something so that // we can set auth = '' to remove it + const jwt = auth ?? profile.current?.jwt // but not here, so that if jwt == '', it doesnt put a bearer const headers = jwt ? { authorization: `Bearer ${jwt}` } : {} - return new LemmyHttp(instanceToURL(instanceURL), { - fetchFunction: (input, init) => customFetch(func, input, init, jwt), - // @ts-expect-error headers thing - headers: headers, - }) + return new (clientType.name == 'piefed' ? PiefedClient : LemmyClient)( + instanceToURL(instanceURL), + { + fetchFunction: (input, init) => customFetch(func, input, init, jwt), + headers: headers, + }, + ) } // here for parts where i forgor to switch @@ -85,49 +97,25 @@ export function getClient( init?: RequestInit | undefined, ) => Promise, auth?: string, -): LemmyHttp { +) { return client({ instanceURL, func, auth }) } -export async function validateInstance(instance: string): Promise { +export async function validateInstance( + instance: string, + type: ClientType, +): Promise { if (instance == '') return false try { - await client({ instanceURL: instance, auth: '' }).getSite() + await client({ + instanceURL: instance, + clientType: type, + auth: '', + }).getSite() return true } catch { return false } } - -export function mayBeIncompatible( - minVersion: string, - availableVersion: string, -) { - if (minVersion.valueOf() === availableVersion.valueOf()) return false - - const versionFormatter = /[\d.]/ - if ( - !minVersion.match(versionFormatter) || - !availableVersion.match(availableVersion) - ) { - return true - } - - const splitMinVersion = minVersion.split('.') - const splitAvailableVersion = availableVersion.split('.') - - if (splitMinVersion.length !== splitAvailableVersion.length) return true - - for (let i = 0; i < splitMinVersion.length; ++i) { - const minVersionDigit = parseInt(splitMinVersion[i]) - const availableVersionDigit = parseInt(splitAvailableVersion[i]) - - if (availableVersionDigit === undefined) return true - if (minVersionDigit < availableVersionDigit) return false - if (availableVersionDigit < minVersionDigit) return true - } - - return false -} diff --git a/src/lib/client/lemmy/lemmy.ts b/src/lib/client/lemmy/lemmy.ts new file mode 100644 index 00000000..0be24707 --- /dev/null +++ b/src/lib/client/lemmy/lemmy.ts @@ -0,0 +1,479 @@ +import { LemmyHttp } from 'lemmy-js-client' +import type { BaseClient, ClientType } from '../base' +import { fromGetPosts, toListingType } from './rewrite' + +export class LemmyClient implements BaseClient { + type: ClientType = { name: 'lemmy', baseUrl: '/api/v3' } + + #client: LemmyHttp + + constructor( + baseUrl: string, + args: { + fetchFunction: (input: any, init: any) => Promise + headers: any + }, + ) { + this.#client = new LemmyHttp(baseUrl, args) + } + + async getSite( + ...params: Parameters + ): ReturnType { + return await this.#client.getSite(...params) + } + async generateTotpSecret( + ...params: Parameters + ): ReturnType { + return await this.#client.generateTotpSecret(...params) + } + async listLogins( + ...params: Parameters + ): ReturnType { + return await this.#client.listLogins(...params) + } + async listAllMedia( + ...params: Parameters + ): ReturnType { + return await this.#client.listAllMedia(...params) + } + async updateTotp( + ...params: Parameters + ): ReturnType { + return await this.#client.updateTotp(...params) + } + async getModlog( + ...params: Parameters + ): ReturnType { + return await this.#client.getModlog(...params) + } + async search( + params: Parameters[0], + ): ReturnType { + return await this.#client.search({ + ...params, + listing_type: toListingType(params.listing_type), + }) + } + async resolveObject( + ...params: Parameters + ): ReturnType { + return await this.#client.resolveObject(...params) + } + async createCommunity( + ...params: Parameters + ): ReturnType { + return await this.#client.createCommunity(...params) + } + async getCommunity( + ...params: Parameters + ): ReturnType { + return await this.#client.getCommunity(...params) + } + async editCommunity( + ...params: Parameters + ): ReturnType { + return await this.#client.editCommunity(...params) + } + async listCommunities( + params: Parameters[0], + ): ReturnType { + return await this.#client.listCommunities({ + ...params, + type_: toListingType(params.type_), + }) + } + async followCommunity( + ...params: Parameters + ): ReturnType { + return await this.#client.followCommunity(...params) + } + async blockCommunity( + ...params: Parameters + ): ReturnType { + return await this.#client.blockCommunity(...params) + } + async deleteCommunity( + ...params: Parameters + ): ReturnType { + return await this.#client.deleteCommunity(...params) + } + async hideCommunity( + ...params: Parameters + ): ReturnType { + return await this.#client.hideCommunity(...params) + } + async removeCommunity( + ...params: Parameters + ): ReturnType { + return await this.#client.removeCommunity(...params) + } + async banFromCommunity( + ...params: Parameters + ): ReturnType { + return await this.#client.banFromCommunity(...params) + } + async addModToCommunity( + ...params: Parameters + ): ReturnType { + return await this.#client.addModToCommunity(...params) + } + async createPost( + ...params: Parameters + ): ReturnType { + return await this.#client.createPost(...params) + } + async getPost( + ...params: Parameters + ): ReturnType { + return await this.#client.getPost(...params) + } + async editPost( + ...params: Parameters + ): ReturnType { + return await this.#client.editPost(...params) + } + async deletePost( + ...params: Parameters + ): ReturnType { + return await this.#client.deletePost(...params) + } + async removePost( + ...params: Parameters + ): ReturnType { + return await this.#client.removePost(...params) + } + async markPostAsRead( + ...params: Parameters + ): ReturnType { + return await this.#client.markPostAsRead(...params) + } + async hidePost( + ...params: Parameters + ): ReturnType { + return await this.#client.hidePost(...params) + } + async lockPost( + ...params: Parameters + ): ReturnType { + return await this.#client.lockPost(...params) + } + async featurePost( + ...params: Parameters + ): ReturnType { + return await this.#client.featurePost(...params) + } + async getPosts( + params: Parameters[0], + ): ReturnType { + return await this.#client.getPosts(fromGetPosts(params)) + } + async likePost( + ...params: Parameters + ): ReturnType { + return await this.#client.likePost(...params) + } + async listPostLikes( + ...params: Parameters + ): ReturnType { + return await this.#client.listPostLikes(...params) + } + async savePost( + ...params: Parameters + ): ReturnType { + return await this.#client.savePost(...params) + } + async createPostReport( + ...params: Parameters + ): ReturnType { + return await this.#client.createPostReport(...params) + } + async resolvePostReport( + ...params: Parameters + ): ReturnType { + return await this.#client.resolvePostReport(...params) + } + async listPostReports( + ...params: Parameters + ): ReturnType { + return await this.#client.listPostReports(...params) + } + async getSiteMetadata( + ...params: Parameters + ): ReturnType { + return await this.#client.getSiteMetadata(...params) + } + async createComment( + ...params: Parameters + ): ReturnType { + return await this.#client.createComment(...params) + } + async editComment( + ...params: Parameters + ): ReturnType { + return await this.#client.editComment(...params) + } + async deleteComment( + ...params: Parameters + ): ReturnType { + return await this.#client.deleteComment(...params) + } + async removeComment( + ...params: Parameters + ): ReturnType { + return await this.#client.removeComment(...params) + } + async markCommentReplyAsRead( + ...params: Parameters + ): ReturnType { + return await this.#client.markCommentReplyAsRead(...params) + } + async likeComment( + ...params: Parameters + ): ReturnType { + return await this.#client.likeComment(...params) + } + async listCommentLikes( + ...params: Parameters + ): ReturnType { + return await this.#client.listCommentLikes(...params) + } + async saveComment( + ...params: Parameters + ): ReturnType { + return await this.#client.saveComment(...params) + } + async distinguishComment( + ...params: Parameters + ): ReturnType { + return await this.#client.distinguishComment(...params) + } + async getComments( + params: Parameters[0], + ): ReturnType { + return await this.#client.getComments({ + ...params, + type_: toListingType(params.type_), + }) + } + async getComment( + ...params: Parameters + ): ReturnType { + return await this.#client.getComment(...params) + } + async createCommentReport( + ...params: Parameters + ): ReturnType { + return await this.#client.createCommentReport(...params) + } + async resolveCommentReport( + ...params: Parameters + ): ReturnType { + return await this.#client.resolveCommentReport(...params) + } + async listCommentReports( + ...params: Parameters + ): ReturnType { + return await this.#client.listCommentReports(...params) + } + async getPrivateMessages( + ...params: Parameters + ): ReturnType { + return await this.#client.getPrivateMessages(...params) + } + async createPrivateMessage( + ...params: Parameters + ): ReturnType { + return await this.#client.createPrivateMessage(...params) + } + async editPrivateMessage( + ...params: Parameters + ): ReturnType { + return await this.#client.editPrivateMessage(...params) + } + async deletePrivateMessage( + ...params: Parameters + ): ReturnType { + return await this.#client.deletePrivateMessage(...params) + } + async markPrivateMessageAsRead( + ...params: Parameters + ): ReturnType { + return await this.#client.markPrivateMessageAsRead(...params) + } + async createPrivateMessageReport( + ...params: Parameters + ): ReturnType { + return await this.#client.createPrivateMessageReport(...params) + } + async resolvePrivateMessageReport( + ...params: Parameters + ): ReturnType { + return await this.#client.resolvePrivateMessageReport(...params) + } + async listPrivateMessageReports( + ...params: Parameters + ): ReturnType { + return await this.#client.listPrivateMessageReports(...params) + } + async register( + ...params: Parameters + ): ReturnType { + return await this.#client.register(...params) + } + async login( + ...params: Parameters + ): ReturnType { + return await this.#client.login(...params) + } + async logout( + ...params: Parameters + ): ReturnType { + return await this.#client.logout(...params) + } + async getPersonDetails( + ...params: Parameters + ): ReturnType { + return await this.#client.getPersonDetails(...params) + } + async getPersonMentions( + ...params: Parameters + ): ReturnType { + return await this.#client.getPersonMentions(...params) + } + async markPersonMentionAsRead( + ...params: Parameters + ): ReturnType { + return await this.#client.markPersonMentionAsRead(...params) + } + async getReplies( + ...params: Parameters + ): ReturnType { + return await this.#client.getReplies(...params) + } + async banPerson( + ...params: Parameters + ): ReturnType { + return await this.#client.banPerson(...params) + } + async getBannedPersons( + ...params: Parameters + ): ReturnType { + return await this.#client.getBannedPersons(...params) + } + async blockPerson( + ...params: Parameters + ): ReturnType { + return await this.#client.blockPerson(...params) + } + async getCaptcha( + ...params: Parameters + ): ReturnType { + return await this.#client.getCaptcha(...params) + } + async deleteAccount( + ...params: Parameters + ): ReturnType { + return await this.#client.deleteAccount(...params) + } + async passwordReset( + ...params: Parameters + ): ReturnType { + return await this.#client.passwordReset(...params) + } + async passwordChangeAfterReset( + ...params: Parameters + ): ReturnType { + return await this.#client.passwordChangeAfterReset(...params) + } + async markAllAsRead( + ...params: Parameters + ): ReturnType { + return await this.#client.markAllAsRead(...params) + } + async saveUserSettings( + ...params: Parameters + ): ReturnType { + return await this.#client.saveUserSettings(...params) + } + async changePassword( + ...params: Parameters + ): ReturnType { + return await this.#client.changePassword(...params) + } + async getReportCount( + ...params: Parameters + ): ReturnType { + return await this.#client.getReportCount(...params) + } + async getUnreadCount( + ...params: Parameters + ): ReturnType { + return await this.#client.getUnreadCount(...params) + } + async verifyEmail( + ...params: Parameters + ): ReturnType { + return await this.#client.verifyEmail(...params) + } + async addAdmin( + ...params: Parameters + ): ReturnType { + return await this.#client.addAdmin(...params) + } + async getUnreadRegistrationApplicationCount( + ...params: Parameters + ): ReturnType { + return await this.#client.getUnreadRegistrationApplicationCount(...params) + } + async listRegistrationApplications( + ...params: Parameters + ): ReturnType { + return await this.#client.listRegistrationApplications(...params) + } + async approveRegistrationApplication( + ...params: Parameters + ): ReturnType { + return await this.#client.approveRegistrationApplication(...params) + } + async getRegistrationApplication( + ...params: Parameters + ): ReturnType { + return await this.#client.getRegistrationApplication(...params) + } + async purgePerson( + ...params: Parameters + ): ReturnType { + return await this.#client.purgePerson(...params) + } + async purgeCommunity( + ...params: Parameters + ): ReturnType { + return await this.#client.purgeCommunity(...params) + } + async purgePost( + ...params: Parameters + ): ReturnType { + return await this.#client.purgePost(...params) + } + async purgeComment( + ...params: Parameters + ): ReturnType { + return await this.#client.purgeComment(...params) + } + async getFederatedInstances( + ...params: Parameters + ): ReturnType { + return await this.#client.getFederatedInstances(...params) + } + async blockInstance( + ...params: Parameters + ): ReturnType { + return await this.#client.blockInstance(...params) + } + async uploadImage( + ...params: Parameters + ): ReturnType { + return await this.#client.uploadImage(...params) + } +} diff --git a/src/lib/client/lemmy/rewrite.ts b/src/lib/client/lemmy/rewrite.ts new file mode 100644 index 00000000..5fdc5cb7 --- /dev/null +++ b/src/lib/client/lemmy/rewrite.ts @@ -0,0 +1,16 @@ +import * as lemmy from 'lemmy-js-client' +import type { GetPosts, ListingType } from '../types' + +export function fromGetPosts(getPosts: GetPosts): lemmy.GetPosts { + return { + ...getPosts, + type_: getPosts.type_ == 'Popular' ? 'All' : getPosts.type_, + } +} + +export function toListingType( + listingType?: ListingType, +): lemmy.ListingType | undefined { + if (listingType == 'Popular') listingType = 'All' + return listingType +} diff --git a/src/lib/client/piefed/piefed.ts b/src/lib/client/piefed/piefed.ts new file mode 100644 index 00000000..05bd6ec1 --- /dev/null +++ b/src/lib/client/piefed/piefed.ts @@ -0,0 +1,911 @@ +import createClient from 'openapi-fetch' +import type { + BaseClient, + ClientType, + NullableFnArg, + NullableFnReturn, +} from '../base' +import { + fromCreateComment, + fromCreatePost, + fromGetComments, + fromGetPost, + fromGetPosts, + fromGetReplies, + fromListCommunities, + fromSearch, + toComment, + toCommentReplyView, + toCommentSortType, + toCommentView, + toCommunity, + toCommunityView, + toLocalSite, + toMyUser, + toPerson, + toPersonMentionView, + toPersonView, + toPost, + toPostView, + toPrivateMessageView, + toSortType, +} from './rewrite' +import type { paths } from './schema' + +export class PiefedClient implements BaseClient { + type: ClientType = { name: 'piefed', baseUrl: '/api/alpha' } + + #client: ReturnType> + + constructor( + baseUrl: string, + args: { + fetchFunction: (input: any, init: any) => Promise + headers: any + }, + ) { + this.#client = createClient({ + baseUrl: `${baseUrl}/api/alpha`, + // @ts-expect-error i dont feel like fixing this right now + fetch: args.fetchFunction, + headers: args.headers, + }) + } + + async getSite(): ReturnType { + const response = (await this.#client.GET('/site')).data! + + return { + admins: response.admins.map(toPersonView), + site_view: { + counts: { + comments: -1, + communities: -1, + posts: -1, + site_id: -1, + users: response.site.user_count ?? -1, + users_active_day: -1, + users_active_half_year: -1, + users_active_month: -1, + users_active_week: -1, + }, + local_site: toLocalSite(response.site), + site: response.site, + }, + all_languages: + (response.site.all_languages as { + code: string + id: number + name: string + }[]) ?? [], + blocked_urls: [], + custom_emojis: [], + discussion_languages: [], + taglines: [], + version: response.version, + my_user: response.my_user ? toMyUser(response.my_user) : undefined, + } + } + + async createPost( + params: Parameters[0], + ): ReturnType { + const response = ( + await this.#client.POST('/post', { + body: fromCreatePost(params), + }) + ).data! + + return { + post_view: toPostView(response.post_view), + } + } + async getPost( + params: Parameters[0], + ): ReturnType { + const response = ( + await this.#client.GET('/post', { + // @ts-expect-error same here what is happening + params: { query: fromGetPost(params) }, + }) + ).data! + + return { + community_view: toCommunityView(response.community_view), + cross_posts: response.cross_posts.map(toPostView), + moderators: response.moderators.map(i => ({ + community: toCommunity(i.community), + moderator: toPerson(i.moderator), + })), + post_view: toPostView(response.post_view), + } + } + + async editPost( + params: Parameters[0], + ): ReturnType { + const response = (await this.#client.PUT('/post', { body: params })).data! + + return { + post_view: toPostView(response.post_view), + } + } + async deletePost( + params: Parameters[0], + ): ReturnType { + const response = (await this.#client.POST('/post/delete', { body: params })) + .data! + + return { + post_view: toPostView(response.post_view), + } + } + + async removePost( + params: Parameters[0], + ): ReturnType { + const response = (await this.#client.POST('/post/remove', { body: params })) + .data! + + return { + post_view: toPostView(response.post_view), + } + } + + async getPosts( + params: Parameters[0], + ): ReturnType { + const response = ( + await this.#client.GET('/post/list', { + // @ts-expect-error same here what is happening + params: { query: fromGetPosts(params) }, + }) + ).data! + + return { + posts: response.posts.map(toPostView), + next_page: (Number(params.page_cursor ?? 1) + 1).toString(), + } + } + async likePost( + params: Parameters[0], + ): ReturnType { + const response = ( + await this.#client.POST('/post/like', { + body: { ...params }, + }) + ).data! + + return { + post_view: toPostView(response.post_view), + } + } + + async generateTotpSecret(): ReturnType { + throw new Error('unsupported') + } + async listLogins(): ReturnType { + throw new Error('unsupported') + } + async listAllMedia(): ReturnType { + throw new Error('unsupported') + } + async updateTotp(): ReturnType { + throw new Error('unsupported') + } + async getModlog(): ReturnType { + throw new Error('unsupported') + } + async search( + params: Parameters[0], + ): ReturnType { + const response = ( + await this.#client.GET('/search', { + params: { + // @ts-expect-error same here what is happening + query: fromSearch(params), + }, + }) + ).data! + + return { + comments: [], + communities: response.communities.map(toCommunityView), + posts: response.posts.map(toPostView), + users: response.users.map(toPersonView), + type_: response.type_, + } + } + async resolveObject( + params: Parameters[0], + ): ReturnType { + const response = ( + await this.#client.GET('/resolve_object', { + // @ts-expect-error same here what is happening + params: { query: params }, + }) + ).data! + + return { + comment: response.comment ? toCommentView(response.comment) : undefined, + community: response.community + ? toCommunityView(response.community) + : undefined, + post: response.post ? toPostView(response.post) : undefined, + person: response.person ? toPersonView(response.person) : undefined, + } + } + async createCommunity( + params: Parameters[0], + ): ReturnType { + const response = (await this.#client.POST('/community', { body: params })) + .data! + + return { + ...response, + community_view: toCommunityView(response.community_view), + } + } + async getCommunity( + params: Parameters[0], + ): ReturnType { + const response = ( + await this.#client.GET('/community', { + params: { + // @ts-expect-error same here what is happening + query: params, + }, + }) + ).data! + + return { + ...response, + community_view: toCommunityView(response.community_view), + moderators: response.moderators.map(i => ({ + community: toCommunity(i.community), + moderator: toPerson(i.moderator), + })), + } + } + async editCommunity( + params: Parameters[0], + ): ReturnType { + const response = ( + await this.#client.PUT('/community', { + body: { ...params, id: params.community_id }, + }) + ).data! + + return { + ...response, + community_view: toCommunityView(response.community_view), + } + } + async listCommunities( + params: Parameters[0], + ): ReturnType { + const response = ( + await this.#client.GET('/community/list', { + params: { + // @ts-expect-error same here what is happening + query: fromListCommunities(params), + }, + }) + ).data! + + return { + communities: response.communities.map(toCommunityView), + } + } + async followCommunity( + params: Parameters[0], + ): ReturnType { + const response = ( + await this.#client.POST('/community/follow', { body: params }) + ).data! + + return { + ...response, + community_view: toCommunityView(response.community_view), + } + } + async blockCommunity( + params: Parameters[0], + ): ReturnType { + const response = ( + await this.#client.POST('/community/block', { body: params }) + ).data! + + return { + ...response, + community_view: toCommunityView(response.community_view), + } + } + async deleteCommunity( + params: Parameters[0], + ): ReturnType { + const response = ( + await this.#client.POST('/community/delete', { body: params }) + ).data! + + return { + ...response, + community_view: toCommunityView(response.community_view), + } + } + async hideCommunity(): ReturnType { + throw new Error('unsupported') + } + async removeCommunity(): ReturnType { + throw new Error('unsupported') + } + async banFromCommunity( + params: Parameters[0], + ): ReturnType { + const response = // piefed has separate methods for ban/unban + ( + params.ban + ? await this.#client.POST('/community/moderate/ban', { + body: { + ...params, + expiredAt: new Date( + params.expires ?? '6767-06-07T00:00:00.000Z', + ).toISOString(), + user_id: params.person_id, + reason: params.reason ?? 'No reason provided.', + }, + }) + : await this.#client.PUT('/community/moderate/unban', { + body: { + community_id: params.community_id, + user_id: params.person_id, + }, + }) + ).data! + + return { + banned: params.ban, + person_view: { + person: toPerson(response.bannedUser), + counts: { comment_count: -1, person_id: -1, post_count: -1 }, + is_admin: false, + }, + } + } + async addModToCommunity( + params: Parameters[0], + ): ReturnType { + const response = ( + await this.#client.POST('/community/mod', { body: params }) + ).data! + + return { + moderators: response.moderators.map(i => ({ + community: toCommunity(i.community), + moderator: toPerson(i.moderator), + })), + } + } + async markPostAsRead( + params: Parameters[0], + ): ReturnType { + await this.#client.POST('/post/mark_as_read', { + body: { ...params }, + }) + + return { + success: true, + } + } + async hidePost(): ReturnType { + throw new Error('unsupported') + } + async lockPost( + params: Parameters[0], + ): ReturnType { + const response = (await this.#client.POST('/post/lock', { body: params })) + .data! + + return { + ...response, + post_view: toPostView(response.post_view), + } + } + async featurePost( + params: Parameters[0], + ): ReturnType { + const response = ( + await this.#client.POST('/post/feature', { body: params }) + ).data! + + return { + ...response, + post_view: toPostView(response.post_view), + } + } + async listPostLikes(): ReturnType { + throw new Error('unsupported') + } + async savePost( + params: Parameters[0], + ): ReturnType { + const response = (await this.#client.PUT('/post/save', { body: params })) + .data! + + return { + post_view: toPostView(response.post_view), + } + } + async createPostReport( + params: Parameters[0], + ): ReturnType { + const response = (await this.#client.POST('/post/report', { body: params })) + .data! + + return { + post_report_view: { + ...response.post_report_view, + community: toCommunity(response.post_report_view.community), + post: toPost(response.post_report_view.post), + creator: toPerson(response.post_report_view.creator), + resolver: response.post_report_view.resolver + ? toPerson(response.post_report_view.resolver) + : undefined, + post_creator: toPerson(response.post_report_view.post_creator), + read: false, + hidden: false, + creator_banned_from_community: false, + unread_comments: -1, + }, + } + } + async resolvePostReport(): ReturnType { + throw new Error('unsupported') + } + async listPostReports(): ReturnType { + throw new Error('unsupported') + } + async getSiteMetadata(): ReturnType { + throw new Error('unsupported') + } + + async createComment( + params: Parameters[0], + ): ReturnType { + const response = ( + await this.#client.POST('/comment', { + body: fromCreateComment(params), + }) + ).data! + + return { + ...response, + comment_view: toCommentView(response.comment_view), + recipient_ids: [], + } + } + async editComment( + params: Parameters[0], + ): ReturnType { + const response = (await this.#client.PUT('/comment', { body: params })) + .data! + + return { + comment_view: toCommentView(response.comment_view), + recipient_ids: [], + } + } + async deleteComment( + params: Parameters[0], + ): ReturnType { + const response = ( + await this.#client.POST('/comment/delete', { body: params }) + ).data! + + return { + comment_view: toCommentView(response.comment_view), + recipient_ids: [], + } + } + async removeComment( + params: Parameters[0], + ): ReturnType { + const response = ( + await this.#client.POST('/comment/remove', { body: params }) + ).data! + + return { + comment_view: toCommentView(response.comment_view), + recipient_ids: [], + } + } + async markCommentReplyAsRead( + params: Parameters[0], + ): ReturnType { + await this.#client.POST('/comment/mark_as_read', { + body: params, + }) + } + async likeComment( + params: Parameters[0], + ): ReturnType { + // TODO remove any + const response = ( + await this.#client.POST('/comment/like', { + body: params, + }) + ).data! + + return { + comment_view: toCommentView(response.comment_view), + recipient_ids: [], + } + } + + async listCommentLikes(): ReturnType { + throw new Error('unsupported') + } + async saveComment( + params: Parameters[0], + ): ReturnType { + const response = (await this.#client.PUT('/comment/save', { body: params })) + .data! + + return { + ...response, + comment_view: toCommentView(response.comment_view), + recipient_ids: [], + } + } + async distinguishComment(): ReturnType { + throw new Error('unsupported') + } + + async getComments( + params: Parameters[0], + ): ReturnType { + const response = ( + await this.#client.GET('/comment/list', { + // @ts-expect-error same here what is happening + params: { query: fromGetComments(params) }, + }) + ).data! + + return { + comments: response.comments.map(toCommentView), + } + } + + async getComment( + params: Parameters[0], + ): ReturnType { + const response = + // @ts-expect-error same here what is happening + (await this.#client.GET('/comment', { params: { query: params } })).data! + + return { + ...response, + comment_view: toCommentView(response.comment_view), + recipient_ids: [], + } + } + async createCommentReport( + params: Parameters[0], + ): ReturnType { + const response = ( + await this.#client.POST('/comment/report', { body: params }) + ).data! + + return { + ...response, + comment_report_view: { + ...response.comment_report_view, + comment: toComment(response.comment_report_view.comment), + community: toCommunity(response.comment_report_view.community), + comment_creator: toPerson(response.comment_report_view.comment_creator), + creator: toPerson(response.comment_report_view.creator), + post: toPost(response.comment_report_view.post), + resolver: response.comment_report_view.resolver + ? toPerson(response.comment_report_view.resolver) + : undefined, + }, + } + } + async resolveCommentReport(): ReturnType { + throw new Error('unsupported') + } + async listCommentReports(): ReturnType { + throw new Error('unsupported') + } + async getPrivateMessages( + params: Parameters[0], + ): ReturnType { + const response = ( + await this.#client.GET('/private_message/list', { + // @ts-expect-error query params are screwed up + params: { query: params }, + }) + ).data! + + return { + private_messages: response.private_messages.map(toPrivateMessageView), + } + } + async createPrivateMessage( + params: Parameters[0], + ): ReturnType { + const response = ( + await this.#client.POST('/private_message', { body: params }) + ).data! + + return { + ...response, + private_message_view: toPrivateMessageView(response.private_message_view), + } + } + async editPrivateMessage( + params: Parameters[0], + ): ReturnType { + const response = ( + await this.#client.PUT('/private_message', { body: params }) + ).data! + + return { + ...response, + private_message_view: toPrivateMessageView(response.private_message_view), + } + } + async deletePrivateMessage( + params: Parameters[0], + ): ReturnType { + const response = ( + await this.#client.POST('/private_message/delete', { body: params }) + ).data! + + return { + ...response, + private_message_view: toPrivateMessageView(response.private_message_view), + } + } + async markPrivateMessageAsRead( + params: Parameters[0], + ): ReturnType { + const response = ( + await this.#client.POST('/private_message/mark_as_read', { body: params }) + ).data! + + return { + ...response, + private_message_view: toPrivateMessageView(response.private_message_view), + } + } + async createPrivateMessageReport(): ReturnType< + BaseClient['createPrivateMessageReport'] + > { + throw new Error('unsupported') + } + async resolvePrivateMessageReport(): ReturnType< + BaseClient['resolvePrivateMessageReport'] + > { + throw new Error('unsupported') + } + async listPrivateMessageReports(): ReturnType< + BaseClient['listPrivateMessageReports'] + > { + throw new Error('unsupported') + } + async register(): ReturnType { + throw new Error('unsupported') + } + async login( + params: Parameters[0], + ): ReturnType { + const response = await this.#client.POST('/user/login', { + body: { username: params.username_or_email, password: params.password }, + })! + + return { + verify_email_sent: false, + registration_created: false, + jwt: response.data?.jwt, + } + } + async logout(): ReturnType { + throw new Error('unsupported') + } + async getPersonDetails( + params: Parameters[0], + ): ReturnType { + const response = ( + await this.#client.GET('/user', { + params: { + query: { + ...params, + // @ts-expect-error more param cursedness + include_content: true, + sort: toSortType(params.sort), + }, + }, + }) + ).data! + + return { + comments: response.comments.map(toCommentView), + moderates: response.moderates.map(i => ({ + community: toCommunity(i.community), + moderator: toPerson(i.moderator), + })), + person_view: toPersonView(response.person_view), + posts: response.posts.map(toPostView), + } + } + async getPersonMentions( + params: Parameters[0], + ): ReturnType { + const response = ( + await this.#client.GET('/user/mentions', { + // @ts-expect-error yet another query param bug + params: { query: { ...params, sort: toCommentSortType(params.sort) } }, + }) + ).data! + + return { + mentions: response.replies.map(toPersonMentionView), + } + } + async markPersonMentionAsRead( + params: Parameters[0], + ): ReturnType { + // @ts-expect-error this method isnt documented + await this.#client.POST('/mention/mark_as_read', { + body: params, + }) + } + async getReplies( + params: Parameters[0], + ): ReturnType { + const response = ( + await this.#client.GET('/user/replies', { + // @ts-expect-error same here what is happening + params: { query: fromGetReplies(params) }, + }) + ).data! + + return { + replies: response.replies.map(toCommentReplyView), + } + } + async banPerson(): ReturnType { + // this is for site view not community view + throw new Error('unsupported') + } + async getBannedPersons(): ReturnType { + // this is for site view not community view + throw new Error('unsupported') + } + async blockPerson( + params: Parameters[0], + ): ReturnType { + const response = (await this.#client.POST('/user/block', { body: params })) + .data! + + return { + ...response, + person_view: toPersonView(response.person_view), + } + } + async getCaptcha(): ReturnType { + throw new Error('unsupported') + } + async deleteAccount(): ReturnType { + throw new Error('unsupported') + } + async passwordReset(): ReturnType { + throw new Error('unsupported') + } + async passwordChangeAfterReset(): ReturnType< + BaseClient['passwordChangeAfterReset'] + > { + throw new Error('unsupported') + } + async markAllAsRead(): ReturnType { + const response = (await this.#client.POST('/user/mark_all_as_read')).data! + + return { + replies: response.replies.map(toCommentReplyView), + } + } + async saveUserSettings( + params: Parameters[0], + ): ReturnType { + return ( + await this.#client.PUT('/user/save_user_settings', { body: params }) + ).data! + } + async changePassword(): ReturnType { + throw new Error('unsupported') + } + async getReportCount(): ReturnType { + throw new Error('unsupported') + } + async getUnreadCount(): ReturnType { + return (await this.#client.GET('/user/unread_count')).data! + } + async verifyEmail(): ReturnType { + throw new Error('unsupported') + } + async addAdmin(): ReturnType { + throw new Error('unsupported') + } + async getUnreadRegistrationApplicationCount(): ReturnType< + BaseClient['getUnreadRegistrationApplicationCount'] + > { + throw new Error('unsupported') + } + async listRegistrationApplications(): ReturnType< + BaseClient['listRegistrationApplications'] + > { + throw new Error('unsupported') + } + async approveRegistrationApplication(): ReturnType< + BaseClient['approveRegistrationApplication'] + > { + throw new Error('unsupported') + } + async getRegistrationApplication(): ReturnType< + BaseClient['getRegistrationApplication'] + > { + throw new Error('unsupported') + } + async purgePerson(): ReturnType { + throw new Error('unsupported') + } + async purgeCommunity(): ReturnType { + throw new Error('unsupported') + } + async purgePost(): ReturnType { + throw new Error('unsupported') + } + async purgeComment(): ReturnType { + throw new Error('unsupported') + } + async getFederatedInstances(): ReturnType< + BaseClient['getFederatedInstances'] + > { + return (await this.#client.GET('/federated_instances')).data! + } + async blockInstance( + params: Parameters[0], + ): ReturnType { + return (await this.#client.POST('/site/block', { body: { ...params } }))! + .data! + } + async uploadImage( + params: Parameters[0], + ): ReturnType { + const formData = new FormData() + formData.append('file', params.image as File) + + const response = ( + await this.#client.POST('/upload/image', { + // @ts-expect-error this is the only working way to do this + body: formData, + }) + ).data! + + return { + ...response, + msg: 'yeah it worked i think', + } + } + + async setFlair( + params: NullableFnArg[0], + ): NullableFnReturn { + const response = ( + await this.#client.POST('/user/set_flair', { body: params }) + ).data! + + return toPersonView(response.person_view) + } +} diff --git a/src/lib/client/piefed/rewrite.ts b/src/lib/client/piefed/rewrite.ts new file mode 100644 index 00000000..769ca84c --- /dev/null +++ b/src/lib/client/piefed/rewrite.ts @@ -0,0 +1,307 @@ +import type { + Comment, + CommentReplyView, + CommentSortType, + CommentView, + Community, + CommunityView, + CreateComment, + CreatePost, + GetComments, + GetPost, + GetPosts, + GetReplies, + ListCommunities, + LocalSite, + MyUserInfo, + Person, + PersonMentionView, + PersonView, + Post, + PostView, + PrivateMessageView, + Search, + SortType, +} from '../types' +import type { components } from './schema' + +export function toPersonView( + personView: components['schemas']['PersonView'], +): PersonView { + return { + counts: personView.counts, + is_admin: personView.is_admin, + person: toPerson(personView.person), + } +} + +export function toPerson(person: components['schemas']['Person']): Person { + return { + ...person, + id: person.id, + name: person.user_name, + bot_account: person.bot, + } +} + +export function toLocalSite(site: components['schemas']['Site']): LocalSite { + if (site) return {} + return {} +} + +export function toCommunityView( + communityView: components['schemas']['CommunityView'], +): CommunityView { + return { + ...communityView, + community: toCommunity(communityView.community), + banned_from_community: false, + counts: { + comments: communityView.counts.post_reply_count, + posts: communityView.counts.post_count, + subscribers: communityView.counts.total_subscriptions_count, + published: communityView.community.published, + community_id: communityView.community.id, + subscribers_local: communityView.counts.subscriptions_count, + users_active_day: communityView.counts.active_daily, + users_active_half_year: communityView.counts.active_6monthly, + users_active_month: communityView.counts.active_monthly, + users_active_week: communityView.counts.active_weekly, + }, + } +} + +export function toCommunity( + community: components['schemas']['Community'], +): Community { + return { + ...community, + posting_restricted_to_mods: false, + visibility: 'Public', + } +} + +export function toMyUser( + myUser: components['schemas']['MyUserInfo'], +): MyUserInfo { + return { + ...myUser, + community_blocks: myUser.community_blocks.map(i => ({ + community: toCommunity(i.community), + person: toPerson(i.person), + })), + local_user_view: { + ...myUser.local_user_view, + local_user: { + ...myUser.local_user_view.local_user, + id: myUser.local_user_view.person.id, + person_id: myUser.local_user_view.person.id, + totp_2fa_enabled: false, + default_listing_type: 'All', + }, + person: toPerson(myUser.local_user_view.person), + }, + follows: myUser.follows.map(i => ({ + follower: toPerson(i.follower), + community: toCommunity(i.community), + })), + moderates: myUser.moderates.map(i => ({ + community: toCommunity(i.community), + moderator: toPerson(i.moderator), + })), + instance_blocks: myUser.instance_blocks.map(i => ({ + instance: i.instance, + person: toPerson(i.person), + })), + person_blocks: myUser.person_blocks.map(i => ({ + person: toPerson(i.person), + target: toPerson(i.target), + })), + discussion_languages: myUser.discussion_languages.map(i => i.id!), + } +} + +export function toPostView( + postView: components['schemas']['PostView'], +): PostView { + return { + ...postView, + creator: toPerson(postView.creator), + creator_blocked: false, + post: toPost(postView.post), + community: toCommunity(postView.community), + } +} + +export function toPost(post: components['schemas']['Post']): Post { + return { + ...post, + creator_id: -1, + name: post.title, + featured_community: post.sticky, + featured_local: false, + } +} + +export function toCommentView( + commentView: components['schemas']['CommentView'], +): CommentView { + return { + ...commentView, + comment: toComment(commentView.comment), + creator: toPerson(commentView.creator), + post: toPost(commentView.post), + community: toCommunity(commentView.community), + } +} + +export function toComment(comment: components['schemas']['Comment']): Comment { + return { + ...comment, + content: comment.body, + creator_id: -1, + distinguished: comment.distinguished ?? false, + } +} + +export function toCommentReplyView( + commentReplyView: components['schemas']['CommentReplyView'], +): CommentReplyView { + return { + ...commentReplyView, + banned_from_community: false, + creator_banned_from_community: false, + comment: toComment(commentReplyView.comment), + creator: toPerson(commentReplyView.creator), + post: toPost(commentReplyView.post), + community: toCommunity(commentReplyView.community), + recipient: toPerson(commentReplyView.recipient), + } +} + +export function toPrivateMessageView( + privateMessageView: components['schemas']['PrivateMessageView'], +): PrivateMessageView { + return { + ...privateMessageView, + creator: toPerson(privateMessageView.creator), + recipient: toPerson(privateMessageView.recipient), + } +} + +export function toPersonMentionView( + personMentionView: components['schemas']['CommentReplyView'], +): PersonMentionView { + return { + ...personMentionView, + person_mention: personMentionView.comment_reply, + creator_banned_from_community: false, + banned_from_community: false, + comment: toComment(personMentionView.comment), + community: toCommunity(personMentionView.community), + post: toPost(personMentionView.post), + creator: toPerson(personMentionView.creator), + recipient: toPerson(personMentionView.recipient), + } +} + +// Query calls +export function fromGetPosts( + getPosts: GetPosts, +): components['schemas']['GetPosts'] { + return { + ...getPosts, + sort: toSortType(getPosts.sort), + page_cursor: Number(getPosts.page_cursor), + } +} + +export function fromGetComments( + getComments: GetComments, +): components['schemas']['GetComments'] { + return { + ...getComments, + sort: toCommentSortType(getComments.sort), + } +} + +export function fromGetPost( + getPost: GetPost, +): components['schemas']['GetPost'] { + return getPost +} + +export function fromGetReplies( + getReplies: GetReplies, +): components['schemas']['GetReplies'] { + return { + ...getReplies, + sort: toCommentSortType(getReplies.sort), + } +} + +export function fromSearch(search: Search): components['schemas']['Search'] { + return { + ...(search as Omit & { + type_: 'Communities' | 'Users' | 'Url' | 'Posts' + }), + sort: toSortType(search.sort), + } +} + +export function fromCreatePost( + createPost: CreatePost, +): components['schemas']['CreatePost'] { + return { + ...createPost, + title: createPost.name, + } +} + +export function fromListCommunities( + listCommunities: ListCommunities, +): components['schemas']['ListCommunities'] { + return { + ...listCommunities, + // @ts-expect-error ok so the api tells me something different than the actual dev api tells me to do + sort: toCommunitiesSortType(listCommunities.sort), + } +} + +export function fromCreateComment( + createComment: CreateComment, +): components['schemas']['CreateComment'] { + return { + ...createComment, + body: createComment.content, + } +} + +// Misc +export function toSortType( + sortType?: SortType, +): components['schemas']['SortType'] | undefined { + if ( + sortType == 'Old' || + sortType == 'MostComments' || + sortType == 'Controversial' || + sortType == 'NewComments' + ) + sortType = 'New' + return sortType +} + +export function toCommentSortType( + commentSortType?: CommentSortType, +): components['schemas']['CommentSortType'] | undefined { + if (commentSortType == 'Controversial') commentSortType = undefined + return commentSortType +} + +export function toCommunitiesSortType( + sortType?: SortType, +): 'Top' | 'Hot' | 'New' | undefined { + if (sortType == 'Hot' || sortType == 'New' || sortType == undefined) + return sortType + else return 'Top' +} diff --git a/src/lib/client/piefed/schema.d.ts b/src/lib/client/piefed/schema.d.ts new file mode 100644 index 00000000..1cbd604c --- /dev/null +++ b/src/lib/client/piefed/schema.d.ts @@ -0,0 +1,5460 @@ +/** + * This file was auto-generated by openapi-typescript. + * Do not make direct changes to the file. + */ + +export interface paths { + '/site': { + parameters: { + query?: never + header?: never + path?: never + cookie?: never + } + /** Gets the site, and your user data. */ + get: { + parameters: { + query?: never + header?: never + path?: never + cookie?: never + } + requestBody?: never + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown + } + content: { + 'application/json': components['schemas']['GetSiteResponse'] + } + } + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown + } + content: { + 'application/json': components['schemas']['BadRequest'] + } + } + } + } + put?: never + post?: never + delete?: never + options?: never + head?: never + patch?: never + trace?: never + } + '/site/version': { + parameters: { + query?: never + header?: never + path?: never + cookie?: never + } + /** (instances running PieFed v1.2 or later only) Gets version of PieFed. */ + get: { + parameters: { + query?: never + header?: never + path?: never + cookie?: never + } + requestBody?: never + responses: { + /** @description OK, */ + 200: { + headers: { + [name: string]: unknown + } + content: { + 'application/json': components['schemas']['GetSiteVersionResponse'] + } + } + /** @description Bad Request, */ + 400: { + headers: { + [name: string]: unknown + } + content: { + 'application/json': components['schemas']['BadRequest'] + } + } + } + } + put?: never + post?: never + delete?: never + options?: never + head?: never + patch?: never + trace?: never + } + '/site/block': { + parameters: { + query?: never + header?: never + path?: never + cookie?: never + } + get?: never + put?: never + /** Block an instance. */ + post: { + parameters: { + query?: never + header?: never + path?: never + cookie?: never + } + requestBody?: { + content: { + 'application/json': components['schemas']['BlockInstance'] + } + } + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown + } + content: { + 'application/json': components['schemas']['BlockInstanceResponse'] + } + } + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown + } + content: { + 'application/json': components['schemas']['BadRequest'] + } + } + } + } + delete?: never + options?: never + head?: never + patch?: never + trace?: never + } + '/site/instance_chooser': { + parameters: { + query?: never + header?: never + path?: never + cookie?: never + } + /** (instances running PieFed v1.2 or later only) Gets the site info for use by other instances in the Instance Chooser functionality. */ + get: { + parameters: { + query?: never + header?: never + path?: never + cookie?: never + } + requestBody?: never + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown + } + content: { + 'application/json': components['schemas']['GetSiteInstanceChooserResponse'] + } + } + /** @description Bad Request */ + 400: { + headers: { + [name: string]: unknown + } + content: { + 'application/json': components['schemas']['BadRequest'] + } + } + } + } + put?: never + post?: never + delete?: never + options?: never + head?: never + patch?: never + trace?: never + } + '/site/instance_chooser_search': { + parameters: { + query?: never + header?: never + path?: never + cookie?: never + } + /** (instances running PieFed v1.2 or later only) Search for other instances. */ + get: { + parameters: { + query?: { + InstanceChooserSearch?: components['schemas']['InstanceChooserSearch'] + } + header?: never + path?: never + cookie?: never + } + requestBody?: never + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown + } + content: { + 'application/json': components['schemas']['GetSiteInstanceChooserSearchResponse'] + } + } + /** @description Bad Request */ + 400: { + headers: { + [name: string]: unknown + } + content: { + 'application/json': components['schemas']['BadRequest'] + } + } + } + } + put?: never + post?: never + delete?: never + options?: never + head?: never + patch?: never + trace?: never + } + '/search': { + parameters: { + query?: never + header?: never + path?: never + cookie?: never + } + /** Search PieFed. */ + get: { + parameters: { + query?: { + Search?: components['schemas']['Search'] + } + header?: never + path?: never + cookie?: never + } + requestBody?: never + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown + } + content: { + 'application/json': components['schemas']['SearchResponse'] + } + } + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown + } + content: { + 'application/json': components['schemas']['BadRequest'] + } + } + } + } + put?: never + post?: never + delete?: never + options?: never + head?: never + patch?: never + trace?: never + } + '/resolve_object': { + parameters: { + query?: never + header?: never + path?: never + cookie?: never + } + /** Fetch a non-local / federated object. */ + get: { + parameters: { + query?: { + ResolveObject?: components['schemas']['ResolveObject'] + } + header?: never + path?: never + cookie?: never + } + requestBody?: never + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown + } + content: { + 'application/json': components['schemas']['ResolveObjectResponse'] + } + } + } + } + put?: never + post?: never + delete?: never + options?: never + head?: never + patch?: never + trace?: never + } + '/federated_instances': { + parameters: { + query?: never + header?: never + path?: never + cookie?: never + } + /** Fetch federated instances. */ + get: { + parameters: { + query?: never + header?: never + path?: never + cookie?: never + } + requestBody?: never + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown + } + content: { + 'application/json': components['schemas']['GetFederatedInstancesResponse'] + } + } + } + } + put?: never + post?: never + delete?: never + options?: never + head?: never + patch?: never + trace?: never + } + '/community': { + parameters: { + query?: never + header?: never + path?: never + cookie?: never + } + /** Get / fetch a community. */ + get: { + parameters: { + query?: { + GetCommunity?: components['schemas']['GetCommunity'] + } + header?: never + path?: never + cookie?: never + } + requestBody?: never + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown + } + content: { + 'application/json': components['schemas']['GetCommunityResponse'] + } + } + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown + } + content: { + 'application/json': components['schemas']['BadRequest'] + } + } + } + } + /** Edit community. */ + put: { + parameters: { + query?: never + header?: never + path?: never + cookie?: never + } + requestBody?: { + content: { + 'application/json': components['schemas']['EditCommunity'] + } + } + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown + } + content: { + 'application/json': components['schemas']['CommunityResponse'] + } + } + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown + } + content: { + 'application/json': components['schemas']['BadRequest'] + } + } + } + } + /** Create a new community. */ + post: { + parameters: { + query?: never + header?: never + path?: never + cookie?: never + } + requestBody?: { + content: { + 'application/json': components['schemas']['CreateCommunity'] + } + } + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown + } + content: { + 'application/json': components['schemas']['CommunityResponse'] + } + } + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown + } + content: { + 'application/json': components['schemas']['BadRequest'] + } + } + /** @description You are being rate limited */ + 429: { + headers: { + [name: string]: unknown + } + content: { + 'application/json': components['schemas']['BadRequest'] + } + } + } + } + delete?: never + options?: never + head?: never + patch?: never + trace?: never + } + '/community/delete': { + parameters: { + query?: never + header?: never + path?: never + cookie?: never + } + get?: never + put?: never + /** Delete a community. */ + post: { + parameters: { + query?: never + header?: never + path?: never + cookie?: never + } + requestBody?: { + content: { + 'application/json': components['schemas']['DeleteCommunity'] + } + } + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown + } + content: { + 'application/json': components['schemas']['CommunityResponse'] + } + } + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown + } + content: { + 'application/json': components['schemas']['BadRequest'] + } + } + } + } + delete?: never + options?: never + head?: never + patch?: never + trace?: never + } + '/community/list': { + parameters: { + query?: never + header?: never + path?: never + cookie?: never + } + /** List communities, with various filters. */ + get: { + parameters: { + query?: { + ListCommunities?: components['schemas']['ListCommunities'] + } + header?: never + path?: never + cookie?: never + } + requestBody?: never + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown + } + content: { + 'application/json': components['schemas']['ListCommunitiesResponse'] + } + } + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown + } + content: { + 'application/json': components['schemas']['BadRequest'] + } + } + } + } + put?: never + post?: never + delete?: never + options?: never + head?: never + patch?: never + trace?: never + } + '/community/follow': { + parameters: { + query?: never + header?: never + path?: never + cookie?: never + } + get?: never + put?: never + /** Follow / subscribe to a community. */ + post: { + parameters: { + query?: never + header?: never + path?: never + cookie?: never + } + requestBody?: { + content: { + 'application/json': components['schemas']['FollowCommunity'] + } + } + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown + } + content: { + 'application/json': components['schemas']['CommunityResponse'] + } + } + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown + } + content: { + 'application/json': components['schemas']['BadRequest'] + } + } + } + } + delete?: never + options?: never + head?: never + patch?: never + trace?: never + } + '/community/block': { + parameters: { + query?: never + header?: never + path?: never + cookie?: never + } + get?: never + put?: never + /** Block a community. */ + post: { + parameters: { + query?: never + header?: never + path?: never + cookie?: never + } + requestBody?: { + content: { + 'application/json': components['schemas']['BlockCommunity'] + } + } + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown + } + content: { + 'application/json': components['schemas']['BlockCommunityResponse'] + } + } + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown + } + content: { + 'application/json': components['schemas']['BadRequest'] + } + } + } + } + delete?: never + options?: never + head?: never + patch?: never + trace?: never + } + '/community/mod': { + parameters: { + query?: never + header?: never + path?: never + cookie?: never + } + get?: never + put?: never + /** Add or remove a moderator for your community.. */ + post: { + parameters: { + query?: never + header?: never + path?: never + cookie?: never + } + requestBody?: { + content: { + 'application/json': components['schemas']['AddModToCommunity'] + } + } + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown + } + content: { + 'application/json': components['schemas']['AddModToCommunityResponse'] + } + } + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown + } + content: { + 'application/json': components['schemas']['BadRequest'] + } + } + } + } + delete?: never + options?: never + head?: never + patch?: never + trace?: never + } + '/community/subscribe': { + parameters: { + query?: never + header?: never + path?: never + cookie?: never + } + get?: never + /** Subscribe to activities in a community. */ + put: { + parameters: { + query?: never + header?: never + path?: never + cookie?: never + } + requestBody?: { + content: { + 'application/json': components['schemas']['SubscribeCommunity'] + } + } + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown + } + content: { + 'application/json': components['schemas']['CommunityResponse'] + } + } + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown + } + content: { + 'application/json': components['schemas']['BadRequest'] + } + } + } + } + post?: never + delete?: never + options?: never + head?: never + patch?: never + trace?: never + } + '/community/moderate/bans': { + parameters: { + query?: never + header?: never + path?: never + cookie?: never + } + /** Get the list of banned users for a community. */ + get: { + parameters: { + query?: { + GetCommunityModerationBansList?: components['schemas']['GetCommunityModerationBansList'] + } + header?: never + path?: never + cookie?: never + } + requestBody?: never + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown + } + content: { + 'application/json': components['schemas']['ModerationCommunityBansListResponse'] + } + } + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown + } + content: { + 'application/json': components['schemas']['BadRequest'] + } + } + } + } + put?: never + post?: never + delete?: never + options?: never + head?: never + patch?: never + trace?: never + } + '/community/moderate/ban': { + parameters: { + query?: never + header?: never + path?: never + cookie?: never + } + get?: never + put?: never + /** Ban a user from a community. */ + post: { + parameters: { + query?: never + header?: never + path?: never + cookie?: never + } + requestBody?: { + content: { + 'application/json': components['schemas']['ModerateCommunityBan'] + } + } + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown + } + content: { + 'application/json': components['schemas']['ModerateCommunityBanResponse'] + } + } + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown + } + content: { + 'application/json': components['schemas']['BadRequest'] + } + } + } + } + delete?: never + options?: never + head?: never + patch?: never + trace?: never + } + '/community/moderate/unban': { + parameters: { + query?: never + header?: never + path?: never + cookie?: never + } + get?: never + /** Unban a user from a community. */ + put: { + parameters: { + query?: never + header?: never + path?: never + cookie?: never + } + requestBody?: { + content: { + 'application/json': components['schemas']['ModerateCommunityUnBan'] + } + } + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown + } + content: { + 'application/json': components['schemas']['ModerateCommunityUnBanResponse'] + } + } + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown + } + content: { + 'application/json': components['schemas']['BadRequest'] + } + } + } + } + post?: never + delete?: never + options?: never + head?: never + patch?: never + trace?: never + } + '/community/moderate/post/nsfw': { + parameters: { + query?: never + header?: never + path?: never + cookie?: never + } + get?: never + put?: never + /** Mark or unmark a post as NSFW. */ + post: { + parameters: { + query?: never + header?: never + path?: never + cookie?: never + } + requestBody?: { + content: { + 'application/json': components['schemas']['ModerateCommunityPostNsfw'] + } + } + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown + } + content: { + 'application/json': components['schemas']['ModerateCommunityPostNsfwResponse'] + } + } + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown + } + content: { + 'application/json': components['schemas']['BadRequest'] + } + } + } + } + delete?: never + options?: never + head?: never + patch?: never + trace?: never + } + '/post/list': { + parameters: { + query?: never + header?: never + path?: never + cookie?: never + } + /** Get / fetch posts, with various filters. */ + get: { + parameters: { + query?: { + GetPosts?: components['schemas']['GetPosts'] + } + header?: never + path?: never + cookie?: never + } + requestBody?: never + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown + } + content: { + 'application/json': components['schemas']['GetPostsResponse'] + } + } + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown + } + content: { + 'application/json': components['schemas']['BadRequest'] + } + } + } + } + put?: never + post?: never + delete?: never + options?: never + head?: never + patch?: never + trace?: never + } + '/post': { + parameters: { + query?: never + header?: never + path?: never + cookie?: never + } + /** Get / fetch a post. */ + get: { + parameters: { + query?: { + GetPost?: components['schemas']['GetPost'] + } + header?: never + path?: never + cookie?: never + } + requestBody?: never + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown + } + content: { + 'application/json': components['schemas']['GetPostResponse'] + } + } + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown + } + content: { + 'application/json': components['schemas']['BadRequest'] + } + } + } + } + /** Edit a post. */ + put: { + parameters: { + query?: never + header?: never + path?: never + cookie?: never + } + requestBody?: { + content: { + 'application/json': components['schemas']['EditPost'] + } + } + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown + } + content: { + 'application/json': components['schemas']['PostResponse'] + } + } + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown + } + content: { + 'application/json': components['schemas']['BadRequest'] + } + } + } + } + /** Create a post. */ + post: { + parameters: { + query?: never + header?: never + path?: never + cookie?: never + } + requestBody?: { + content: { + 'application/json': components['schemas']['CreatePost'] + } + } + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown + } + content: { + 'application/json': components['schemas']['PostResponse'] + } + } + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown + } + content: { + 'application/json': components['schemas']['BadRequest'] + } + } + /** @description You are being rate limited */ + 429: { + headers: { + [name: string]: unknown + } + content: { + 'application/json': components['schemas']['BadRequest'] + } + } + } + } + delete?: never + options?: never + head?: never + patch?: never + trace?: never + } + '/post/like': { + parameters: { + query?: never + header?: never + path?: never + cookie?: never + } + get?: never + put?: never + /** Like / vote on a post. */ + post: { + parameters: { + query?: never + header?: never + path?: never + cookie?: never + } + requestBody?: { + content: { + 'application/json': components['schemas']['CreatePostLike'] + } + } + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown + } + content: { + 'application/json': components['schemas']['PostResponse'] + } + } + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown + } + content: { + 'application/json': components['schemas']['BadRequest'] + } + } + } + } + delete?: never + options?: never + head?: never + patch?: never + trace?: never + } + '/post/save': { + parameters: { + query?: never + header?: never + path?: never + cookie?: never + } + get?: never + /** Save a post. */ + put: { + parameters: { + query?: never + header?: never + path?: never + cookie?: never + } + requestBody?: { + content: { + 'application/json': components['schemas']['SavePost'] + } + } + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown + } + content: { + 'application/json': components['schemas']['PostResponse'] + } + } + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown + } + content: { + 'application/json': components['schemas']['BadRequest'] + } + } + } + } + post?: never + delete?: never + options?: never + head?: never + patch?: never + trace?: never + } + '/post/subscribe': { + parameters: { + query?: never + header?: never + path?: never + cookie?: never + } + get?: never + /** Subscribe to a post. */ + put: { + parameters: { + query?: never + header?: never + path?: never + cookie?: never + } + requestBody?: { + content: { + 'application/json': components['schemas']['SubscribePost'] + } + } + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown + } + content: { + 'application/json': components['schemas']['PostResponse'] + } + } + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown + } + content: { + 'application/json': components['schemas']['BadRequest'] + } + } + } + } + post?: never + delete?: never + options?: never + head?: never + patch?: never + trace?: never + } + '/post/delete': { + parameters: { + query?: never + header?: never + path?: never + cookie?: never + } + get?: never + put?: never + /** Delete a post. */ + post: { + parameters: { + query?: never + header?: never + path?: never + cookie?: never + } + requestBody?: { + content: { + 'application/json': components['schemas']['DeletePost'] + } + } + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown + } + content: { + 'application/json': components['schemas']['PostResponse'] + } + } + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown + } + content: { + 'application/json': components['schemas']['BadRequest'] + } + } + } + } + delete?: never + options?: never + head?: never + patch?: never + trace?: never + } + '/post/report': { + parameters: { + query?: never + header?: never + path?: never + cookie?: never + } + get?: never + put?: never + /** Report a post. */ + post: { + parameters: { + query?: never + header?: never + path?: never + cookie?: never + } + requestBody?: { + content: { + 'application/json': components['schemas']['CreatePostReport'] + } + } + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown + } + content: { + 'application/json': components['schemas']['PostReportResponse'] + } + } + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown + } + content: { + 'application/json': components['schemas']['BadRequest'] + } + } + } + } + delete?: never + options?: never + head?: never + patch?: never + trace?: never + } + '/post/lock': { + parameters: { + query?: never + header?: never + path?: never + cookie?: never + } + get?: never + put?: never + /** A moderator can lock a post ( IE disable new comments ). */ + post: { + parameters: { + query?: never + header?: never + path?: never + cookie?: never + } + requestBody?: { + content: { + 'application/json': components['schemas']['LockPost'] + } + } + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown + } + content: { + 'application/json': components['schemas']['PostResponse'] + } + } + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown + } + content: { + 'application/json': components['schemas']['BadRequest'] + } + } + } + } + delete?: never + options?: never + head?: never + patch?: never + trace?: never + } + '/post/feature': { + parameters: { + query?: never + header?: never + path?: never + cookie?: never + } + get?: never + put?: never + /** A moderator can feature a community post ( IE stick it to the top of a community ). */ + post: { + parameters: { + query?: never + header?: never + path?: never + cookie?: never + } + requestBody?: { + content: { + 'application/json': components['schemas']['FeaturePost'] + } + } + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown + } + content: { + 'application/json': components['schemas']['PostResponse'] + } + } + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown + } + content: { + 'application/json': components['schemas']['BadRequest'] + } + } + } + } + delete?: never + options?: never + head?: never + patch?: never + trace?: never + } + '/post/mark_as_read': { + parameters: { + query?: never + header?: never + path?: never + cookie?: never + } + get?: never + put?: never + /** Mark a post as read. */ + post: { + parameters: { + query?: never + header?: never + path?: never + cookie?: never + } + requestBody?: { + content: { + 'application/json': components['schemas']['MarkPostAsRead'] + } + } + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown + } + content: { + 'application/json': components['schemas']['SuccessResponse-2'] + } + } + } + } + delete?: never + options?: never + head?: never + patch?: never + trace?: never + } + '/post/remove': { + parameters: { + query?: never + header?: never + path?: never + cookie?: never + } + get?: never + put?: never + /** A moderator remove for a post. */ + post: { + parameters: { + query?: never + header?: never + path?: never + cookie?: never + } + requestBody?: { + content: { + 'application/json': components['schemas']['RemovePost'] + } + } + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown + } + content: { + 'application/json': components['schemas']['PostResponse'] + } + } + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown + } + content: { + 'application/json': components['schemas']['BadRequest'] + } + } + } + } + delete?: never + options?: never + head?: never + patch?: never + trace?: never + } + '/comment': { + parameters: { + query?: never + header?: never + path?: never + cookie?: never + } + /** Get / fetch a comment. */ + get: { + parameters: { + query?: { + GetComments?: components['schemas']['GetComment'] + } + header?: never + path?: never + cookie?: never + } + requestBody?: never + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown + } + content: { + 'application/json': components['schemas']['CommentResponse'] + } + } + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown + } + content: { + 'application/json': components['schemas']['BadRequest'] + } + } + } + } + /** Edit a comment. */ + put: { + parameters: { + query?: never + header?: never + path?: never + cookie?: never + } + requestBody?: { + content: { + 'application/json': components['schemas']['EditComment'] + } + } + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown + } + content: { + 'application/json': components['schemas']['CommentResponse'] + } + } + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown + } + content: { + 'application/json': components['schemas']['BadRequest'] + } + } + } + } + /** Create a comment. */ + post: { + parameters: { + query?: never + header?: never + path?: never + cookie?: never + } + requestBody?: { + content: { + 'application/json': components['schemas']['CreateComment'] + } + } + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown + } + content: { + 'application/json': components['schemas']['CommentResponse'] + } + } + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown + } + content: { + 'application/json': components['schemas']['BadRequest'] + } + } + /** @description You are being rate limited */ + 429: { + headers: { + [name: string]: unknown + } + content: { + 'application/json': components['schemas']['BadRequest'] + } + } + } + } + delete?: never + options?: never + head?: never + patch?: never + trace?: never + } + '/comment/list': { + parameters: { + query?: never + header?: never + path?: never + cookie?: never + } + /** Get / fetch comments. */ + get: { + parameters: { + query?: { + GetComments?: components['schemas']['GetComments'] + } + header?: never + path?: never + cookie?: never + } + requestBody?: never + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown + } + content: { + 'application/json': components['schemas']['GetCommentsResponse'] + } + } + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown + } + content: { + 'application/json': components['schemas']['BadRequest'] + } + } + } + } + put?: never + post?: never + delete?: never + options?: never + head?: never + patch?: never + trace?: never + } + '/comment/delete': { + parameters: { + query?: never + header?: never + path?: never + cookie?: never + } + get?: never + put?: never + /** Delete a comment. */ + post: { + parameters: { + query?: never + header?: never + path?: never + cookie?: never + } + requestBody?: { + content: { + 'application/json': components['schemas']['DeleteComment'] + } + } + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown + } + content: { + 'application/json': components['schemas']['CommentResponse'] + } + } + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown + } + content: { + 'application/json': components['schemas']['BadRequest'] + } + } + } + } + delete?: never + options?: never + head?: never + patch?: never + trace?: never + } + '/comment/mark_as_read': { + parameters: { + query?: never + header?: never + path?: never + cookie?: never + } + get?: never + put?: never + /** Mark a comment reply as read. */ + post: { + parameters: { + query?: never + header?: never + path?: never + cookie?: never + } + requestBody?: { + content: { + 'application/json': components['schemas']['MarkReplyAsRead'] + } + } + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown + } + content: { + 'application/json': components['schemas']['CommentReplyResponse-2'] + } + } + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown + } + content: { + 'application/json': components['schemas']['BadRequest'] + } + } + } + } + delete?: never + options?: never + head?: never + patch?: never + trace?: never + } + '/comment/remove': { + parameters: { + query?: never + header?: never + path?: never + cookie?: never + } + get?: never + put?: never + /** A moderator remove for a comment. */ + post: { + parameters: { + query?: never + header?: never + path?: never + cookie?: never + } + requestBody?: { + content: { + 'application/json': components['schemas']['RemoveComment'] + } + } + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown + } + content: { + 'application/json': components['schemas']['CommentResponse'] + } + } + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown + } + content: { + 'application/json': components['schemas']['BadRequest'] + } + } + } + } + delete?: never + options?: never + head?: never + patch?: never + trace?: never + } + '/comment/like': { + parameters: { + query?: never + header?: never + path?: never + cookie?: never + } + get?: never + put?: never + /** Like / vote on a comment. */ + post: { + parameters: { + query?: never + header?: never + path?: never + cookie?: never + } + requestBody?: { + content: { + 'application/json': components['schemas']['CreateCommentLike'] + } + } + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown + } + content: { + 'application/json': components['schemas']['CommentResponse'] + } + } + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown + } + content: { + 'application/json': components['schemas']['BadRequest'] + } + } + } + } + delete?: never + options?: never + head?: never + patch?: never + trace?: never + } + '/comment/save': { + parameters: { + query?: never + header?: never + path?: never + cookie?: never + } + get?: never + /** Save a comment. */ + put: { + parameters: { + query?: never + header?: never + path?: never + cookie?: never + } + requestBody?: { + content: { + 'application/json': components['schemas']['SaveComment'] + } + } + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown + } + content: { + 'application/json': components['schemas']['CommentResponse'] + } + } + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown + } + content: { + 'application/json': components['schemas']['BadRequest'] + } + } + } + } + post?: never + delete?: never + options?: never + head?: never + patch?: never + trace?: never + } + '/comment/subscribe': { + parameters: { + query?: never + header?: never + path?: never + cookie?: never + } + get?: never + /** Subscribe to a comment. */ + put: { + parameters: { + query?: never + header?: never + path?: never + cookie?: never + } + requestBody?: { + content: { + 'application/json': components['schemas']['SubscribeComment'] + } + } + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown + } + content: { + 'application/json': components['schemas']['CommentResponse'] + } + } + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown + } + content: { + 'application/json': components['schemas']['BadRequest'] + } + } + } + } + post?: never + delete?: never + options?: never + head?: never + patch?: never + trace?: never + } + '/comment/report': { + parameters: { + query?: never + header?: never + path?: never + cookie?: never + } + get?: never + put?: never + /** Report a comment. */ + post: { + parameters: { + query?: never + header?: never + path?: never + cookie?: never + } + requestBody?: { + content: { + 'application/json': components['schemas']['CreateCommentReport'] + } + } + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown + } + content: { + 'application/json': components['schemas']['CommentReportResponse'] + } + } + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown + } + content: { + 'application/json': components['schemas']['BadRequest'] + } + } + } + } + delete?: never + options?: never + head?: never + patch?: never + trace?: never + } + '/private_message/list': { + parameters: { + query?: never + header?: never + path?: never + cookie?: never + } + /** Get / fetch private messages. */ + get: { + parameters: { + query?: { + GetPrivateMessages?: components['schemas']['GetPrivateMessages'] + } + header?: never + path?: never + cookie?: never + } + requestBody?: never + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown + } + content: { + 'application/json': components['schemas']['PrivateMessagesResponse'] + } + } + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown + } + content: { + 'application/json': components['schemas']['BadRequest'] + } + } + } + } + put?: never + post?: never + delete?: never + options?: never + head?: never + patch?: never + trace?: never + } + '/private_message/conversation': { + parameters: { + query?: never + header?: never + path?: never + cookie?: never + } + /** Get / fetch private messages. */ + get: { + parameters: { + query?: { + GetPrivateMessagesConversation?: components['schemas']['GetPrivateMessagesConversation'] + } + header?: never + path?: never + cookie?: never + } + requestBody?: never + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown + } + content: { + 'application/json': components['schemas']['PrivateMessagesResponse'] + } + } + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown + } + content: { + 'application/json': components['schemas']['BadRequest'] + } + } + } + } + put?: never + post?: never + delete?: never + options?: never + head?: never + patch?: never + trace?: never + } + '/private_message': { + parameters: { + query?: never + header?: never + path?: never + cookie?: never + } + get?: never + /** Edit a private message. */ + put: { + parameters: { + query?: never + header?: never + path?: never + cookie?: never + } + requestBody?: { + content: { + 'application/json': components['schemas']['EditPrivateMessage'] + } + } + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown + } + content: { + 'application/json': components['schemas']['PrivateMessageResponse'] + } + } + } + } + /** Create a private message. */ + post: { + parameters: { + query?: never + header?: never + path?: never + cookie?: never + } + requestBody?: { + content: { + 'application/json': components['schemas']['CreatePrivateMessage'] + } + } + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown + } + content: { + 'application/json': components['schemas']['PrivateMessageResponse'] + } + } + } + } + delete?: never + options?: never + head?: never + patch?: never + trace?: never + } + '/private_message/mark_as_read': { + parameters: { + query?: never + header?: never + path?: never + cookie?: never + } + get?: never + put?: never + /** Mark a private message as read. */ + post: { + parameters: { + query?: never + header?: never + path?: never + cookie?: never + } + requestBody?: { + content: { + 'application/json': components['schemas']['MarkPrivateMessageAsRead'] + } + } + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown + } + content: { + 'application/json': components['schemas']['PrivateMessageResponse'] + } + } + } + } + delete?: never + options?: never + head?: never + patch?: never + trace?: never + } + '/private_message/delete': { + parameters: { + query?: never + header?: never + path?: never + cookie?: never + } + get?: never + put?: never + /** Delete a private message. */ + post: { + parameters: { + query?: never + header?: never + path?: never + cookie?: never + } + requestBody?: { + content: { + 'application/json': components['schemas']['DeletePrivateMessage'] + } + } + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown + } + content: { + 'application/json': components['schemas']['PrivateMessageResponse'] + } + } + } + } + delete?: never + options?: never + head?: never + patch?: never + trace?: never + } + '/user': { + parameters: { + query?: never + header?: never + path?: never + cookie?: never + } + /** Get the details for a person. */ + get: { + parameters: { + query?: { + GetPersonDetails?: components['schemas']['GetPersonDetails'] + } + header?: never + path?: never + cookie?: never + } + requestBody?: never + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown + } + content: { + 'application/json': components['schemas']['GetPersonDetailsResponse'] + } + } + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown + } + content: { + 'application/json': components['schemas']['BadRequest'] + } + } + } + } + put?: never + post?: never + delete?: never + options?: never + head?: never + patch?: never + trace?: never + } + '/user/replies': { + parameters: { + query?: never + header?: never + path?: never + cookie?: never + } + /** Get comment replies. */ + get: { + parameters: { + query?: { + GetReplies?: components['schemas']['GetReplies'] + } + header?: never + path?: never + cookie?: never + } + requestBody?: never + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown + } + content: { + 'application/json': components['schemas']['GetRepliesResponse'] + } + } + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown + } + content: { + 'application/json': components['schemas']['BadRequest'] + } + } + } + } + put?: never + post?: never + delete?: never + options?: never + head?: never + patch?: never + trace?: never + } + '/user/mentions': { + parameters: { + query?: never + header?: never + path?: never + cookie?: never + } + /** Get mentions of your account made in comments. */ + get: { + parameters: { + query?: { + GetReplies?: components['schemas']['GetReplies'] + } + header?: never + path?: never + cookie?: never + } + requestBody?: never + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown + } + content: { + 'application/json': components['schemas']['GetRepliesResponse'] + } + } + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown + } + content: { + 'application/json': components['schemas']['BadRequest'] + } + } + } + } + put?: never + post?: never + delete?: never + options?: never + head?: never + patch?: never + trace?: never + } + '/user/block': { + parameters: { + query?: never + header?: never + path?: never + cookie?: never + } + get?: never + put?: never + /** Block a person. */ + post: { + parameters: { + query?: never + header?: never + path?: never + cookie?: never + } + requestBody?: { + content: { + 'application/json': components['schemas']['BlockPerson'] + } + } + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown + } + content: { + 'application/json': components['schemas']['BlockPersonResponse'] + } + } + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown + } + content: { + 'application/json': components['schemas']['BadRequest'] + } + } + } + } + delete?: never + options?: never + head?: never + patch?: never + trace?: never + } + '/user/login': { + parameters: { + query?: never + header?: never + path?: never + cookie?: never + } + get?: never + put?: never + /** Log into PieFed. */ + post: { + parameters: { + query?: never + header?: never + path?: never + cookie?: never + } + requestBody?: { + content: { + 'application/json': components['schemas']['Login'] + } + } + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown + } + content: { + 'application/json': components['schemas']['LoginResponse'] + } + } + /** @description BAD REQUEST */ + 400: { + headers: { + [name: string]: unknown + } + content: { + 'application/json': components['schemas']['ErrorResponseLogin'] + } + } + } + } + delete?: never + options?: never + head?: never + patch?: never + trace?: never + } + '/user/mark_all_as_read': { + parameters: { + query?: never + header?: never + path?: never + cookie?: never + } + get?: never + put?: never + /** Mark all replies as read. */ + post: operations['markAllAsRead'] + delete?: never + options?: never + head?: never + patch?: never + trace?: never + } + '/user/unread_count': { + parameters: { + query?: never + header?: never + path?: never + cookie?: never + } + /** Get your unread counts */ + get: { + parameters: { + query?: never + header?: never + path?: never + cookie?: never + } + requestBody?: never + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown + } + content: { + 'application/json': components['schemas']['GetUnreadCountResponse'] + } + } + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown + } + content: { + 'application/json': components['schemas']['BadRequest'] + } + } + } + } + put?: never + post?: never + delete?: never + options?: never + head?: never + patch?: never + trace?: never + } + '/user/subscribe': { + parameters: { + query?: never + header?: never + path?: never + cookie?: never + } + get?: never + /** Subscribe to activities from another user */ + put: { + parameters: { + query?: never + header?: never + path?: never + cookie?: never + } + requestBody?: { + content: { + 'application/json': components['schemas']['SubscribePerson'] + } + } + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown + } + content: { + 'application/json': components['schemas']['PersonResponse'] + } + } + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown + } + content: { + 'application/json': components['schemas']['BadRequest'] + } + } + } + } + post?: never + delete?: never + options?: never + head?: never + patch?: never + trace?: never + } + '/user/set_flair': { + parameters: { + query?: never + header?: never + path?: never + cookie?: never + } + get?: never + put?: never + /** Set your flair for a community */ + post: { + parameters: { + query?: never + header?: never + path?: never + cookie?: never + } + requestBody?: { + content: { + 'application/json': components['schemas']['SetPersonFlair'] + } + } + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown + } + content: { + 'application/json': components['schemas']['PersonResponse'] + } + } + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown + } + content: { + 'application/json': components['schemas']['BadRequest'] + } + } + } + } + delete?: never + options?: never + head?: never + patch?: never + trace?: never + } + '/user/save_user_settings': { + parameters: { + query?: never + header?: never + path?: never + cookie?: never + } + get?: never + /** Save your user settings. */ + put: { + parameters: { + query?: never + header?: never + path?: never + cookie?: never + } + requestBody?: { + content: { + 'application/json': components['schemas']['SaveUserSettings'] + } + } + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown + } + content?: never + } + } + } + post?: never + delete?: never + options?: never + head?: never + patch?: never + trace?: never + } + '/user/notifications': { + parameters: { + query?: never + header?: never + path?: never + cookie?: never + } + /** Get your user notifications */ + get: { + parameters: { + query?: { + Status?: components['schemas']['GetNotificationStatus'] + } + header?: never + path?: never + cookie?: never + } + requestBody?: never + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown + } + content: { + 'application/json': components['schemas']['NotificationsResponse'] + } + } + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown + } + content: { + 'application/json': components['schemas']['BadRequest'] + } + } + } + } + put?: never + post?: never + delete?: never + options?: never + head?: never + patch?: never + trace?: never + } + '/user/notification_state': { + parameters: { + query?: never + header?: never + path?: never + cookie?: never + } + get?: never + /** Set the read status of a given notification. */ + put: { + parameters: { + query?: never + header?: never + path?: never + cookie?: never + } + requestBody?: { + content: { + 'application/json': components['schemas']['EditNotificationState'] + } + } + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown + } + content: { + 'application/json': components['schemas']['NotificationsReadStatusResponse'] + } + } + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown + } + content: { + 'application/json': components['schemas']['BadRequest'] + } + } + } + } + post?: never + delete?: never + options?: never + head?: never + patch?: never + trace?: never + } + '/user/notifications_count': { + parameters: { + query?: never + header?: never + path?: never + cookie?: never + } + /** Get user unread notifications count. */ + get: { + parameters: { + query?: never + header?: never + path?: never + cookie?: never + } + requestBody?: never + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown + } + content: { + 'application/json': components['schemas']['NotificationsCountResponse'] + } + } + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown + } + content: { + 'application/json': components['schemas']['BadRequest'] + } + } + } + } + put?: never + post?: never + delete?: never + options?: never + head?: never + patch?: never + trace?: never + } + '/user/mark_all_notifications_read': { + parameters: { + query?: never + header?: never + path?: never + cookie?: never + } + get?: never + /** Set all unread user notifications to read. */ + put: { + parameters: { + query?: never + header?: never + path?: never + cookie?: never + } + requestBody?: never + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown + } + content: { + 'application/json': components['schemas']['NotificationsMarkAllReadResponse'] + } + } + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown + } + content: { + 'application/json': components['schemas']['BadRequest'] + } + } + } + } + post?: never + delete?: never + options?: never + head?: never + patch?: never + trace?: never + } + '/user/verify_credentials': { + parameters: { + query?: never + header?: never + path?: never + cookie?: never + } + get?: never + put?: never + /** Verify username / password credentials */ + post: { + parameters: { + query?: never + header?: never + path?: never + cookie?: never + } + requestBody?: { + content: { + 'application/json': components['schemas']['Login'] + } + } + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown + } + content?: never + } + /** @description BAD REQUEST */ + 400: { + headers: { + [name: string]: unknown + } + content?: never + } + } + } + delete?: never + options?: never + head?: never + patch?: never + trace?: never + } + '/feed/list': { + parameters: { + query?: never + header?: never + path?: never + cookie?: never + } + /** Get list of feeds */ + get: { + parameters: { + query?: { + FeedList?: components['schemas']['FeedList'] + } + header?: never + path?: never + cookie?: never + } + requestBody?: never + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown + } + content: { + 'application/json': components['schemas']['FeedListResponse'] + } + } + /** @description Bad Request */ + 400: { + headers: { + [name: string]: unknown + } + content: { + 'application/json': components['schemas']['BadRequest'] + } + } + } + } + put?: never + post?: never + delete?: never + options?: never + head?: never + patch?: never + trace?: never + } + '/topic/list': { + parameters: { + query?: never + header?: never + path?: never + cookie?: never + } + /** Get list of topics */ + get: { + parameters: { + query?: { + TopicList?: components['schemas']['TopicList'] + } + header?: never + path?: never + cookie?: never + } + requestBody?: never + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown + } + content: { + 'application/json': components['schemas']['TopicListResponse'] + } + } + /** @description Bad Request */ + 400: { + headers: { + [name: string]: unknown + } + content: { + 'application/json': components['schemas']['BadRequest'] + } + } + } + } + put?: never + post?: never + delete?: never + options?: never + head?: never + patch?: never + trace?: never + } + '/upload/image': { + parameters: { + query?: never + header?: never + path?: never + cookie?: never + } + get?: never + put?: never + post: { + parameters: { + query?: never + header?: never + path?: never + cookie?: never + } + requestBody?: { + content: { + 'multipart/form-data': components['schemas']['ImageUpload'] + } + } + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown + } + content: { + 'application/json': components['schemas']['UploadResponse'] + } + } + /** @description The uploaded image was missing or invalid */ + 400: { + headers: { + [name: string]: unknown + } + content: { + 'application/json': components['schemas']['BadRequest'] + } + } + /** @description You are being rate limited */ + 429: { + headers: { + [name: string]: unknown + } + content: { + 'application/json': components['schemas']['BadRequest'] + } + } + } + } + delete?: never + options?: never + head?: never + patch?: never + trace?: never + } + '/upload/community_image': { + parameters: { + query?: never + header?: never + path?: never + cookie?: never + } + get?: never + put?: never + post: { + parameters: { + query?: never + header?: never + path?: never + cookie?: never + } + requestBody?: { + content: { + 'multipart/form-data': components['schemas']['ImageUpload'] + } + } + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown + } + content: { + 'application/json': components['schemas']['UploadResponse'] + } + } + /** @description The uploaded image was missing or invalid */ + 400: { + headers: { + [name: string]: unknown + } + content: { + 'application/json': components['schemas']['BadRequest'] + } + } + /** @description You are being rate limited */ + 429: { + headers: { + [name: string]: unknown + } + content: { + 'application/json': components['schemas']['BadRequest'] + } + } + } + } + delete?: never + options?: never + head?: never + patch?: never + trace?: never + } + '/upload/user_image': { + parameters: { + query?: never + header?: never + path?: never + cookie?: never + } + get?: never + put?: never + post: { + parameters: { + query?: never + header?: never + path?: never + cookie?: never + } + requestBody?: { + content: { + 'multipart/form-data': components['schemas']['ImageUpload'] + } + } + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown + } + content: { + 'application/json': components['schemas']['UploadResponse'] + } + } + /** @description The uploaded image was missing or invalid */ + 400: { + headers: { + [name: string]: unknown + } + content: { + 'application/json': components['schemas']['BadRequest'] + } + } + /** @description You are being rate limited */ + 429: { + headers: { + [name: string]: unknown + } + content: { + 'application/json': components['schemas']['BadRequest'] + } + } + } + } + delete?: never + options?: never + head?: never + patch?: never + trace?: never + } +} +export type webhooks = Record +export interface components { + schemas: { + /** BlockInstance */ + BlockInstance: { + /** BlockInstance.instance_id */ + instance_id: number + /** BlockInstance.block */ + block: boolean + } + /** InstanceChooserSearch */ + InstanceChooserSearch: { + /** InstanceChooserSearch.q */ + q?: string + /** + * InstanceChooserSearch.nsfw + * @example no + */ + nsfw?: string + /** + * InstanceChooserSearch.language + * @example en + */ + language?: string + /** + * InstanceChooserSearch.newbie + * @example yes + */ + newbie?: string + } + /** Search */ + Search: { + /** Search.q */ + q: string + /** Search.type_ */ + type_?: components['schemas']['SearchType'] + /** Search.sort */ + sort?: components['schemas']['SortType'] + /** Search.listing_type */ + listing_type?: components['schemas']['ListingType'] + /** Search.page */ + page?: number + /** Search.limit */ + limit?: number + } + /** ResolveObject */ + ResolveObject: { + /** ResolveObject.q */ + q: string + } + /** GetCommunity */ + GetCommunity: { + /** GetCommunity.id */ + id?: number + /** GetCommunity.name */ + name?: string + } + /** CreateCommunity */ + CreateCommunity: { + /** CreateCommunity.name */ + name: string + /** CreateCommunity.title */ + title: string + /** CreateCommunity.description */ + description?: string + /** CreateCommunity.rules */ + rules?: string + /** + * CreateCommunity.icon + * Format: url + */ + icon_url?: string + /** + * CreateCommunity.banner + * Format: url + */ + banner_url?: string + /** CreateCommunity.nsfw */ + nsfw?: boolean + /** CreateCommunity.restricted_to_mods */ + restricted_to_mods?: boolean + /** CreateCommunity.local_only */ + local_only?: boolean + /** CreateCommunity.discussion_languages */ + discussion_languages?: number[] + } + /** CreateCommunity */ + EditCommunity: { + /** CreateCommunity.id */ + id: number + /** CreateCommunity.title */ + title?: string + /** CreateCommunity.description */ + description?: string + /** CreateCommunity.rules */ + rules?: string + /** + * CreateCommunity.icon + * Format: url + */ + icon_url?: string + /** + * CreateCommunity.banner + * Format: url + */ + banner_url?: string + /** CreateCommunity.nsfw */ + nsfw?: boolean + /** CreateCommunity.restricted_to_mods */ + restricted_to_mods?: boolean + /** CreateCommunity.local_only */ + local_only?: boolean + /** CreateCommunity.discussion_languages */ + discussion_languages?: number[] + } + /** DeleteCommunity */ + DeleteCommunity: { + /** DeleteCommunity.community_id */ + community_id: number + /** DeleteCommunity.deleted */ + deleted: boolean + } + /** AddModToCommunity */ + AddModToCommunity: { + /** AddModToCommunity.community_id */ + community_id: number + /** AddModToCommunity.person_id */ + person_id: number + /** AddModToCommunity.added */ + added: boolean + } + /** ListCommunities */ + ListCommunities: { + /** ListCommunities.type_ */ + type_?: components['schemas']['ListingType'] + /** ListCommunities.sort */ + sort?: components['schemas']['CommunitySortType'] + /** ListCommunities.show_nsfw */ + show_nsfw?: boolean + /** ListCommunities.page */ + page?: number + /** ListCommunities.limit */ + limit?: number + } + /** FollowCommunity */ + FollowCommunity: { + /** FollowCommunity.community_id */ + community_id: number + /** FollowCommunity.follow */ + follow: boolean + } + /** BlockCommunity */ + BlockCommunity: { + /** BlockCommunity.community_id */ + community_id: number + /** BlockCommunity.block */ + block: boolean + } + /** SubscribeCommunity */ + SubscribeCommunity: { + /** SubscribeCommunity.community_id */ + community_id: number + /** SubscribeCommunity.subscribe */ + subscribe: boolean + } + /** GetCommunityModerationBansList */ + GetCommunityModerationBansList: { + /** + * GetCommunityModerationBansList.community_id + * @example 42 + */ + community_id?: number + /** + * GetCommunityModerationBansList.page + * @example 1 + */ + page?: number + } + /** ModerateCommunityBan */ + ModerateCommunityBan: { + /** + * PostCommunityModerateBan.community_id + * @example 42 + */ + community_id: number + /** + * PostCommunityModerateBan.user_id + * @example 1234 + */ + user_id: number + /** + * PostCommunityModerateBan.reason + * @example Violation of Rule 1. + */ + reason: string + /** + * PostCommunityModerateBan.expiredAt + * @example 2025-01-01T12:00:00 + */ + expiredAt: string + } + /** ModerateCommunityUnBan */ + ModerateCommunityUnBan: { + /** + * PutCommunityModerateUnBan.community_id + * @example 42 + */ + community_id: number + /** + * PutCommunityModerateUnBan.user_id + * @example 1234 + */ + user_id: number + } + /** ModerateCommunityPostNsfw */ + ModerateCommunityPostNsfw: { + /** + * PostCommunityModeratePostNsfw.post_id + * @example 123456 + */ + post_id: number + /** + * PostCommunityModeratePostNsfw.nsfw_status + * @example true + */ + nsfw_status: boolean + } + /** GetPosts */ + GetPosts: { + /** GetPosts.type_ */ + type_?: components['schemas']['ListingType'] + /** GetPosts.sort */ + sort?: components['schemas']['SortType'] + /** GetPosts.page_cursor */ + page_cursor?: number + /** GetPosts.limit */ + limit?: number + /** GetPosts.community_id */ + community_id?: number + /** GetPosts.person_id */ + person_id?: number + /** GetPosts.community_name */ + community_name?: string + /** GetPosts.liked_only */ + liked_only?: boolean + /** GetPosts.saved_only */ + saved_only?: boolean + } + /** GetPost */ + GetPost: { + /** GetPost.id */ + id?: number + /** GetPost.comment_id */ + comment_id?: number + } + /** EditPost */ + EditPost: { + /** EditPost.post_id */ + post_id: number + /** EditPost.title */ + title?: string + /** + * EditPost.url + * Format: url + */ + url?: string + /** EditPost.body */ + body?: string + /** EditPost.nsfw */ + nsfw?: boolean + /** EditPost.language_id */ + language_id?: number + } + /** CreatePost */ + CreatePost: { + /** CreatePost.title */ + title: string + /** CreatePost.community_id */ + community_id: number + /** + * CreatePost.url + * Format: url + */ + url?: string + /** CreatePost.body */ + body?: string + /** CreatePost.nsfw */ + nsfw?: boolean + /** CreatePost.language_id */ + language_id?: number + } + /** CreatePostLike */ + CreatePostLike: { + /** CreatePostLike.post_id */ + post_id: number + /** CreatePostLike.score */ + score: number + } + /** SavePost */ + SavePost: { + /** SavePost.post_id */ + post_id: number + /** SavePost.save */ + save: boolean + } + /** SubscribePost */ + SubscribePost: { + /** SubscribePost.post_id */ + post_id: number + /** SubscribePost.subscribe */ + subscribe: boolean + } + /** DeletePost */ + DeletePost: { + /** DeletePost.post_id */ + post_id: number + /** DeletePost.deleted */ + deleted: boolean + } + /** CreatePostReport */ + CreatePostReport: { + /** CreatePostReport.post_id */ + post_id: number + /** CreatePostReport.reason */ + reason: string + } + /** LockPost */ + LockPost: { + /** LockPost.post_id */ + post_id: number + /** LockPost.locked */ + locked: boolean + } + /** FeaturePost */ + FeaturePost: { + /** FeaturePost.post_id */ + post_id: number + /** FeaturePost.featured */ + featured: boolean + /** FeaturePost.feature_type */ + feature_type: components['schemas']['PostFeatureType'] + } + /** MarkPostAsRead */ + MarkPostAsRead: { + /** MarkPostAsRead.post_ids */ + post_ids?: number[] + /** MarkPostAsRead.post.id */ + post_id?: number + /** MarkPostAsRead.read */ + read: boolean + } + /** RemovePost */ + RemovePost: { + /** RemovePost.post_id */ + post_id: number + /** RemovePost.removed */ + removed: boolean + /** RemovePost.reason */ + reason?: string + } + /** CreateComment */ + CreateComment: { + /** CreateComment.content */ + body: string + /** CreateComment.post_id */ + post_id: number + /** CreateComment.parent_id */ + parent_id?: number + /** CreateComment.language_id */ + language_id?: number + } + /** EditComment */ + EditComment: { + /** EditComment.comment_id */ + comment_id: number + /** EditComment.content */ + body?: string + /** EditComment.language_id */ + language_id?: number + } + /** GetComment */ + GetComment: { + /** GetComment.id */ + id: number + } + /** GetComments */ + GetComments: { + /** GetComments.type_ */ + type_?: components['schemas']['ListingType'] + /** GetComments.sort */ + sort?: components['schemas']['CommentSortType'] + /** GetComments.max_depth */ + max_depth?: number + /** GetComments.page */ + page?: number + /** GetComments.limit */ + limit?: number + /** GetComments.community_id */ + community_id?: number + /** GetComments.post_id */ + post_id?: number + /** GetComments.parent_id */ + parent_id?: number + /** GetComments.person_id */ + person_id?: number + /** GetComments.liked_only */ + liked_only?: boolean + /** GetComments.saved_only */ + saved_only?: boolean + } + /** DeleteComment */ + DeleteComment: { + /** DeleteComment.comment_id */ + comment_id: number + /** DeleteComment.deleted */ + deleted: boolean + } + /** MarkReplyAsRead */ + MarkReplyAsRead: { + /** MarkReplyAsRead.comment_reply_id */ + comment_reply_id: number + read: boolean + } + /** RemoveComment */ + RemoveComment: { + /** RemoveComment.comment_id */ + comment_id: number + /** RemoveComment.removed */ + removed: boolean + /** RemoveComment.reason */ + reason?: string + } + /** CreateCommentLike */ + CreateCommentLike: { + /** CreateCommentLike.comment_id */ + comment_id: number + /** CreateCommentLike.score */ + score: number + } + /** SaveComment */ + SaveComment: { + /** SaveComment.comment_id */ + comment_id: number + /** SaveComment.save */ + save: boolean + } + /** SubscribeComment */ + SubscribeComment: { + /** SubscribeComment.comment_id */ + comment_id: number + /** SubscribeComment.subscribe */ + subscribe: boolean + } + /** CreateCommentReport */ + CreateCommentReport: { + /** CreateCommentReport.comment_id */ + comment_id: number + /** CreateCommentReport.reason */ + reason: string + } + /** GetPrivateMessages */ + GetPrivateMessages: { + /** GetPrivateMessages.unread_only */ + unread_only?: boolean + /** GetPrivateMessages.page */ + page?: number + /** GetPrivateMessages.limit */ + limit?: number + } + /** GetPrivateMessagesConversation */ + GetPrivateMessagesConversation: { + /** GetPrivateMessagesConversation.page */ + page?: number + /** GetPrivateMessagesConversation.limit */ + limit?: number + /** GetPrivateMessagesConversation.person_id */ + person_id: number + } + /** CreatePrivateMessage */ + CreatePrivateMessage: { + /** CreatePrivateMessage.content */ + content: string + /** CreatePrivateMessage.recipient_id */ + recipient_id: number + } + /** EditPrivateMessage */ + EditPrivateMessage: { + /** EditPrivateMessage.private_message_id */ + private_message_id: number + /** EditPrivateMessage.content */ + content: string + } + /** MarkPrivateMessageAsRead */ + MarkPrivateMessageAsRead: { + /** MarkPrivateMessageAsRead.private_message_id */ + private_message_id: number + /** MarkPrivateMessageAsRead.read */ + read: boolean + } + /** DeletePrivateMessage */ + DeletePrivateMessage: { + /** DeletePrivateMessage.private_message_id */ + private_message_id: number + /** DeletePrivateMessage.deleted */ + deleted: boolean + } + /** GetPersonDetails */ + GetPersonDetails: { + /** GetPersonDetails.person_id */ + person_id?: number + /** GetPersonDetails.username */ + username?: string + /** GetPersonDetails.sort */ + sort?: components['schemas']['SortType'] + /** GetPersonDetails.page */ + page?: number + /** GetPersonDetails.limit */ + limit?: number + /** GetPersonDetails.community_id */ + community_id?: number + /** GetPersonDetails.saved_only */ + saved_only?: boolean + /** GetPersonDetails.include_content */ + include_content?: boolean + } + /** GetReplies */ + GetReplies: { + /** GetReplies.sort */ + sort?: components['schemas']['CommentSortType'] + /** GetReplies.page */ + page?: number + /** GetReplies.limit */ + limit?: number + /** GetReplies.unread_only */ + unread_only?: boolean + } + /** BlockPerson */ + BlockPerson: { + /** BlockPerson.person_id */ + person_id: number + /** BlockPerson.block */ + block: boolean + } + /** Login */ + Login: { + /** Login.username */ + username: string + /** Login.password */ + password: string + } + /** GetUnreadCountResponse */ + GetUnreadCountResponse: { + /** GetUnreadCountResponse.replies */ + replies: number + /** GetUnreadCountResponse.mentions */ + mentions: number + /** GetUnreadCountResponse.private_messages */ + private_messages: number + } + /** SubscribePerson */ + SubscribePerson: { + /** SubscribePerson.person_id */ + person_id: number + /** SubscribePerson.subscribe */ + subscribe: boolean + } + /** SetPersonFlair */ + SetPersonFlair: { + /** SetPersonFlair.community_id */ + community_id: number + /** SetPersonFlair.flair_text */ + flair_text: string + } + /** SaveUserSettings */ + SaveUserSettings: { + /** SaveUserSettings.show_nsfw */ + show_nsfw?: boolean + /** SaveUserSettings.show_read_posts */ + show_read_posts?: boolean + /** SaveUserSettings.bio */ + bio?: string + } + /** GetNotificationStatus */ + GetNotificationStatus: { + /** GetNotificationStatus.status */ + status: components['schemas']['NotificationStatusType'] + /** + * GetNotificationStatus.page + * @default 1 + */ + page: number + } + /** EditNotificationState */ + EditNotificationState: { + /** GetNotificationStatus.notif_id */ + notif_id?: number + /** GetNotificationStatus.read_state */ + read_state?: boolean + } + /** FeedList */ + FeedList: { + /** + * FeedList.include_communities + * @description include list of communities in each feed with result + */ + include_communities?: boolean + /** + * FeedList.mine_only + * @description only return feeds created by the authorized user + */ + mine_only?: boolean + } + /** TopicList */ + TopicList: { + /** + * TopicList.include_communities + * @description include list of communities in each topic with result + */ + include_communities?: boolean + } + ImageUpload: { + /** Format: binary */ + file: string + } + /** SuccessResponse */ + SuccessResponse: { + success: boolean + } + BadRequest: { + /** @example An error occurred */ + error: string + } + /** GetSiteResponse */ + GetSiteResponse: { + /** GetSiteResponse.my_user */ + my_user?: components['schemas']['MyUserInfo'] + /** GetSiteResponse.site */ + site: components['schemas']['Site'] + /** GetSiteResponse.version */ + version: string + /** GetSiteResponse.admins */ + admins: components['schemas']['PersonView'][] + } + /** GetSiteVersionResponse */ + GetSiteVersionResponse: { + /** GetSiteVersionResponse.version */ + version: string + } + /** BlockInstanceResponse */ + BlockInstanceResponse: { + /** BlockInstanceResponse.blocked */ + blocked: boolean + } + GetSiteInstanceChooserResponse: { + language: components['schemas']['LanguageView'] + /** GetSiteInstanceChooserResponse.nsfw */ + nsfw: boolean + /** GetSiteInstanceChooserResponse.newbie_friendly */ + newbie_friendly: boolean + /** GetSiteInstanceChooserResponse.name */ + name: string + /** GetSiteInstanceChooserResponse.elevator_pitch */ + elevator_pitch: string + /** GetSiteInstanceChooserResponse.description */ + description: string + /** GetSiteInstanceChooserResponse.about */ + about: string + /** GetSiteInstanceChooserResponse.sidebar */ + sidebar: string + /** GetSiteInstanceChooserResponse.logo_url */ + logo_url: string + /** GetSiteInstanceChooserResponse.majority */ + maturity: string + /** GetSiteInstanceChooserResponse.tos_url */ + tos_url: string + /** GetSiteInstanceChooserResponse.mau */ + mau: number + /** GetSiteInstanceChooserResponse.can_make_communities */ + can_make_communities: boolean + /** GetSiteInstanceChooserResponse.defederation */ + defederation: string[] + /** GetSiteInstanceChooserResponse.trusts */ + trusts: string[] + /** GetSiteInstanceChooserResponse.registration_mode */ + registration_mode: string + } + GetSiteInstanceChooserSearchResponse: { + result: components['schemas']['GetSiteInstanceChooserSearchResponseItem'][] + } + /** SearchResponse */ + SearchResponse: { + /** SearchResponse.type_ */ + type_: components['schemas']['SearchType'] + /** SearchResponse.posts */ + posts: components['schemas']['PostView'][] + /** SearchResponse.communities */ + communities: components['schemas']['CommunityView'][] + /** SearchResponse.users */ + users: components['schemas']['PersonView'][] + } + /** ResolveObjectResponse */ + ResolveObjectResponse: { + /** ResolveObjectResponse.comment */ + comment?: components['schemas']['CommentView'] + /** ResolveObjectResponse.post */ + post?: components['schemas']['PostView'] + /** ResolveObjectResponse.community */ + community?: components['schemas']['CommunityView'] + /** ResolveObjectResponse.person */ + person?: components['schemas']['PersonView'] + } + /** GetFederatedInstancesResponse */ + GetFederatedInstancesResponse: { + /** GetFederatedInstancesResponse.federated_instances */ + federated_instances?: components['schemas']['FederatedInstancesView'] + } + /** GetCommunityResponse */ + GetCommunityResponse: { + /** GetCommunityResponse.community_view */ + community_view: components['schemas']['CommunityView'] + /** GetCommunityResponse.site */ + site?: components['schemas']['Site'] + /** GetCommunityResponse.moderators */ + moderators: components['schemas']['CommunityModeratorView'][] + /** GetCommunityResponse.discussion_languages */ + discussion_languages: number[] + } + /** CommunityResponse */ + CommunityResponse: { + /** CommunityResponse.community_view */ + community_view: components['schemas']['CommunityView'] + /** CommunityResponse.discussion_languages */ + discussion_languages: number[] + } + /** ListCommunitiesResponse */ + ListCommunitiesResponse: { + /** ListCommunitiesResponse.communities */ + communities: components['schemas']['CommunityView'][] + } + /** BlockCommunityResponse */ + BlockCommunityResponse: { + /** BlockCommunityResponse.community_view */ + community_view: components['schemas']['CommunityView'] + /** BlockCommunityResponse.blocked */ + blocked: boolean + } + /** AddModToCommunityResponse */ + AddModToCommunityResponse: { + /** AddModToCommunityResponse.moderators */ + moderators: components['schemas']['CommunityModeratorView'][] + } + /** ModerationCommunityBansListResponse */ + ModerationCommunityBansListResponse: { + /** GetCommunityModerationBansListResponse.items */ + items?: components['schemas']['CommunityModerationBanItem'][] + /** + * GetCommunityModerationBansListResponse.next_page + * @example 3 + */ + next_page?: string + } + /** ModerateCommunityBanResponse */ + ModerateCommunityBanResponse: components['schemas']['CommunityModerationBanItem'] + /** ModerateCommunityUnBanResponse */ + ModerateCommunityUnBanResponse: components['schemas']['CommunityModerationBanItem'] + /** ModerateCommunityPostNsfwResponse */ + ModerateCommunityPostNsfwResponse: components['schemas']['PostView'] + /** GetPostsResponse */ + GetPostsResponse: { + /** GetPostsResponse.posts */ + posts: components['schemas']['PostView'][] + } + /** GetPostResponse */ + GetPostResponse: { + /** GetPostResponse.post_view */ + post_view: components['schemas']['PostView'] + /** GetPostResponse.community_view */ + community_view: components['schemas']['CommunityView'] + /** GetPostResponse.moderators */ + moderators: components['schemas']['CommunityModeratorView'][] + /** GetPostResponse.cross_posts */ + cross_posts: components['schemas']['PostView'][] + } + /** PostResponse */ + PostResponse: { + /** PostResponse.post_view */ + post_view: components['schemas']['PostView'] + } + /** PostReportResponse */ + PostReportResponse: { + /** PostReportResponse.post_report_view */ + post_report_view: components['schemas']['PostReportView'] + } + /** CommentResponse */ + CommentResponse: { + /** CommentResponse.comment_view */ + comment_view: components['schemas']['CommentView'] + } + /** GetCommentsResponse */ + GetCommentsResponse: { + /** GetCommentsResponse.comments */ + comments: components['schemas']['CommentView'][] + } + /** CommentReportResponse */ + CommentReportResponse: { + /** CommentReportResponse.comment_report_view */ + comment_report_view: components['schemas']['CommentReportView'] + } + /** PrivateMessagesResponse */ + PrivateMessagesResponse: { + /** PrivateMessagesResponse.private_messages */ + private_messages: components['schemas']['PrivateMessageView'][] + } + /** PrivateMessageResponse */ + PrivateMessageResponse: { + /** PrivateMessageResponse.private_message_view */ + private_message_view: components['schemas']['PrivateMessageView'] + } + /** GetPersonDetailsResponse */ + GetPersonDetailsResponse: { + /** GetPersonDetailsResponse.person_view */ + person_view: components['schemas']['PersonView'] + /** GetPersonDetailsResponse.site */ + site?: components['schemas']['Site'] + /** GetPersonDetailsResponse.comments */ + comments: components['schemas']['CommentView'][] + /** GetPersonDetailsResponse.posts */ + posts: components['schemas']['PostView'][] + /** GetPersonDetailsResponse.moderates */ + moderates: components['schemas']['CommunityModeratorView'][] + } + /** GetRepliesResponse */ + GetRepliesResponse: { + /** GetRepliesResponse.replies */ + replies: components['schemas']['CommentReplyView'][] + } + /** PersonResponse */ + PersonResponse: { + /** PersonResponse.person_view */ + person_view: components['schemas']['PersonView'] + } + /** BlockPersonResponse */ + BlockPersonResponse: { + /** BlockPersonResponse.person_view */ + person_view: components['schemas']['PersonView'] + /** BlockPersonResponse.blocked */ + blocked: boolean + } + /** LoginResponse */ + LoginResponse: { + /** LoginResponse.jwt */ + jwt?: string + } + ErrorResponseLogin: { + /** @example incorrect_login */ + error?: string + } + /** NotificationsResponse */ + NotificationsResponse: { + /** NotificationsResponse.counts */ + counts: components['schemas']['NotificationsCountsView'] + /** NotificationsResponse.items */ + items: ( + | components['schemas']['NotificationsItemUserView'] + | components['schemas']['NotificationsItemCommunityView'] + | components['schemas']['NotificationsItemTopicView'] + | components['schemas']['NotificationsItemPostView'] + | components['schemas']['NotificationsItemReplyView'] + | components['schemas']['NotificationsItemFeedView'] + | components['schemas']['NotificationsItemPostMentionView'] + | components['schemas']['NotificationsItemCommentMentionView'] + )[] + /** + * NotificationsResponse.status + * @example New + */ + status: string + /** + * NotificationsResponse.user + * @example MyPieFedUserName + */ + user: string + } + /** NotificationsReadStatusResponse */ + NotificationsReadStatusResponse: + | components['schemas']['NotificationsItemUserView'] + | components['schemas']['NotificationsItemCommunityView'] + | components['schemas']['NotificationsItemTopicView'] + | components['schemas']['NotificationsItemPostView'] + | components['schemas']['NotificationsItemReplyView'] + | components['schemas']['NotificationsItemFeedView'] + | components['schemas']['NotificationsItemPostMentionView'] + | components['schemas']['NotificationsItemCommentMentionView'] + /** NotificationsCountResponse */ + NotificationsCountResponse: { + /** + * NotificationsCountResponse.count + * @example 42 + */ + count?: number + } + /** NotificationsMarkAllReadResponse */ + NotificationsMarkAllReadResponse: { + /** + * NotificationsMarkAllReadResponse.mark_all_notifications_as_read + * @example complete + */ + mark_all_notifications_as_read?: string + } + FeedListResponse: { + feeds: components['schemas']['FeedView'][] + } + TopicListResponse: { + /** TopicListResponse.topics */ + topics: components['schemas']['TopicView'][] + } + UploadResponse: { + /** + * Format: url + * @example https://preferred.social/static/media/image.png + */ + url: string + } + /** Site */ + Site: { + /** + * Site.actor_id + * Format: url + * @example https://piefed.social/ + */ + actor_id: string + /** Site.all_languages */ + all_languages?: components['schemas']['LanguageView'][] + /** Site.description */ + description?: string + /** Site.enable_downvotes */ + enable_downvotes?: boolean + /** + * Site.icon + * Format: url + */ + icon?: string + /** Site.name */ + name: string + /** Site.registration_mode */ + registration_mode?: components['schemas']['RegistrationMode'] + /** Site.sidebar */ + sidebar?: string + /** Site.user_count */ + user_count?: number + } + /** Instance */ + Instance: { + /** Instance.id */ + id: number + /** Instance.domain */ + domain: string + /** + * Instance.published + * Format: date-time + */ + published: string + /** + * Instance.updated + * Format: date-time + */ + updated?: string + /** Instance.software */ + software?: string + /** Instance.version */ + version?: string + } + /** InstanceWithoutFederationState */ + InstanceWithoutFederationState: { + /** InstanceWithoutFederationState.id */ + id: number + /** InstanceWithoutFederationState.domain */ + domain: string + /** InstanceWithoutFederationState.published */ + published: string + /** InstanceWithoutFederationState.updated */ + updated?: string + /** InstanceWithoutFederationState.software */ + software?: string + /** InstanceWithoutFederationState.version */ + version?: string + } + /** Community */ + Community: { + /** + * Community.actor_id + * Format: url + */ + actor_id: string + /** Community.ap_domain */ + ap_domain?: string + /** Community.banned */ + banned?: boolean + /** + * Community.banner + * Format: url + */ + banner?: string + /** Community.deleted */ + deleted: boolean + /** Community.description */ + description?: string + /** Community.hidden */ + hidden: boolean + /** + * Community.icon + * Format: url + */ + icon?: string + /** Community.id */ + id: number + /** Community.instance_id */ + instance_id: number + /** Community.local */ + local: boolean + /** Community.name */ + name: string + /** Community.nsfw */ + nsfw: boolean + /** Community.posting_warning */ + posting_warning?: string + /** + * Community.published + * Format: date-time + */ + published: string + /** Community.removed */ + removed: boolean + /** Community.restricted_to_mods */ + restricted_to_mods: boolean + /** Community.title */ + title: string + /** + * Community.updated + * Format: date-time + */ + updated?: string + } + /** Post */ + Post: { + /** Post.id */ + id: number + /** Post.title */ + title: string + /** + * Post.url + * Format: url + */ + url?: string + /** Post.body */ + body?: string + /** Post.user_id */ + user_id: number + /** Post.community_id */ + community_id: number + /** Post.removed */ + removed: boolean + /** Post.locked */ + locked: boolean + /** + * Post.published + * Format: date-time + */ + published: string + /** + * Post.updated + * Format: date-time + */ + updated?: string + /** Post.deleted */ + deleted: boolean + /** Post.nsfw */ + nsfw: boolean + /** + * Post.thumbnail_url + * Format: url + */ + thumbnail_url?: string + /** + * Post.small_thumbnail_url + * Format: url + */ + small_thumbnail_url?: string + /** + * Post.ap_id + * Format: url + */ + ap_id: string + /** Post.local */ + local: boolean + /** Post.language_id */ + language_id: number + /** Post.sticky */ + sticky: boolean + /** Post.alt_text */ + alt_text?: string + } + /** PostReport */ + PostReport: { + /** PostReport.id */ + id: number + /** PostReport.creator_id */ + creator_id: number + /** PostReport.post_id */ + post_id: number + /** PostReport.original_post_name */ + original_post_name: string + /** PostReport.original_post_url */ + original_post_url?: string + /** PostReport.original_post_body */ + original_post_body?: string + /** PostReport.reason */ + reason: string + /** PostReport.resolved */ + resolved: boolean + /** PostReport.resolver_id */ + resolver_id?: number + /** + * PostReport.published + * Format: date-time + */ + published: string + /** + * PostReport.updated + * Format: date-time + */ + updated?: string + } + /** Comment */ + Comment: { + /** Comment.id */ + id: number + /** Comment.user_id */ + user_id: number + /** Comment.post_id */ + post_id: number + /** Comment.body */ + body: string + /** Comment.removed */ + removed: boolean + /** + * Comment.published + * Format: date-time + */ + published: string + /** + * Comment.updated + * Format: date-time + */ + updated?: string + /** Comment.deleted */ + deleted: boolean + /** + * Comment.ap_id + * Format: url + */ + ap_id: string + /** Comment.local */ + local: boolean + /** Comment.path */ + path: string + /** Comment.distinguished */ + distinguished?: boolean + /** Comment.language_id */ + language_id: number + } + /** CommentReply */ + CommentReply: { + /** CommentReply.id */ + id: number + /** CommentReply.recipient_id */ + recipient_id: number + /** CommentReply.comment_id */ + comment_id: number + /** CommentReply.read */ + read: boolean + /** + * CommentReply.published + * Format: date-time + */ + published: string + } + /** CommentReport */ + CommentReport: { + /** CommentReport.id */ + id: number + /** CommentReport.creator_id */ + creator_id: number + /** CommentReport.comment_id */ + comment_id: number + /** CommentReport.original_comment_text */ + original_comment_text: string + /** CommentReport.reason */ + reason: string + /** CommentReport.resolved */ + resolved: boolean + /** CommentReport.resolver_id */ + resolver_id?: number + /** + * CommentReport.published + * Format: date-time + */ + published: string + /** + * CommentReport.updated + * Format: date-time + */ + updated?: string + } + /** PrivateMessage */ + PrivateMessage: { + /** PrivateMessage.id */ + id: number + /** PrivateMessage.creator_id */ + creator_id: number + /** PrivateMessage.recipient_id */ + recipient_id: number + /** PrivateMessage.content */ + content: string + /** PrivateMessage.deleted */ + deleted: boolean + /** PrivateMessage.read */ + read: boolean + /** + * PrivateMessage.published + * Format: date-time + */ + published: string + /** + * PrivateMessage.updated + * Format: date-time + */ + updated?: string + /** + * PrivateMessage.ap_id + * Format: url + */ + ap_id: string + /** PrivateMessage.local */ + local: boolean + } + /** Person */ + Person: { + /** + * Person.actor_id + * Format: url + */ + actor_id: string + /** + * Person.avatar + * Format: url + */ + avatar?: string + /** Person.banned */ + banned: boolean + /** + * Person.banner + * Format: url + */ + banner?: string + /** Person.about */ + about?: string + /** Person.bot */ + bot: boolean + /** Person.deleted */ + deleted: boolean + /** Person.flair */ + flair?: string + /** Person.id */ + id: number + /** Person.instance_id */ + instance_id: number + /** Person.local */ + local: boolean + /** + * Person.published + * Format: date-time + */ + published: string + /** Person.title */ + title?: string + /** Person.user_name */ + user_name: string + } + /** LocalUser */ + LocalUser: { + /** LocalUser.default_listing_type */ + default_listing_type: components['schemas']['ListingType'] + /** LocalUser.default_sort_type */ + default_sort_type: components['schemas']['SortType'] + /** LocalUser.show_bot_accounts */ + show_bot_accounts: boolean + /** LocalUser.show_nsfw */ + show_nsfw: boolean + /** LocalUser.show_read_posts */ + show_read_posts: boolean + /** LocalUser.show_scores */ + show_scores: boolean + } + /** MyUserInfo */ + MyUserInfo: { + /** MyUserInfo.community_blocks */ + community_blocks: components['schemas']['CommunityBlockView'][] + /** MyUserInfo.discussion_languages */ + discussion_languages: components['schemas']['LanguageView'][] + /** MyUserInfo.follows */ + follows: components['schemas']['CommunityFollowerView'][] + /** MyUserInfo.instance_blocks */ + instance_blocks: components['schemas']['InstanceBlockView'][] + /** MyUserInfo.local_user_view */ + local_user_view: components['schemas']['LocalUserView'] + /** MyUserInfo.moderates */ + moderates: components['schemas']['CommunityModeratorView'][] + /** MyUserInfo.person_blocks */ + person_blocks: components['schemas']['PersonBlockView'][] + } + GetSiteInstanceChooserSearchResponseItem: { + /** GetSiteInstanceChooserSearchResponseItem.id */ + id: number + /** GetSiteInstanceChooserSearchResponseItem.name */ + name: string + /** GetSiteInstanceChooserSearchResponseItem.domain */ + domain: string + /** GetSiteInstanceChooserSearchResponseItem.elevator_pitch */ + elevator_pitch: string + /** GetSiteInstanceChooserSearchResponseItem.description */ + description: string + /** GetSiteInstanceChooserSearchResponseItem.about */ + about: string + /** GetSiteInstanceChooserSearchResponseItem.sidebar */ + sidebar: string + /** GetSiteInstanceChooserSearchResponseItem.logo_url */ + logo_url: string + /** GetSiteInstanceChooserSearchResponseItem.maturity */ + maturity: string + /** GetSiteInstanceChooserSearchResponseItem.tos_url */ + tos_url: string + /** GetSiteInstanceChooserSearchResponseItem.uptime */ + uptime: string + /** GetSiteInstanceChooserSearchResponseItem.mau */ + mau: number + /** GetSiteInstanceChooserSearchResponseItem.can_make_communities */ + can_make_communities: boolean + /** GetSiteInstanceChooserSearchResponseItem.newbie_friendly */ + newbie_friendly: boolean + /** GetSiteInstanceChooserSearchResponseItem.defederation */ + defederation: string[] + /** GetSiteInstanceChooserSearchResponseItem.trusts */ + trusts: string[] + /** GetSiteInstanceChooserSearchResponseItem.registration_mode */ + registration_mode: string + /** GetSiteInstanceChooserSearchResponseItem.language */ + language: string + /** GetSiteInstanceChooserSearchResponseItem.monthsmonitored */ + monthsmonitored: number + } + /** FederatedInstancesView */ + FederatedInstancesView: { + /** FederatedInstances.linked */ + linked: components['schemas']['InstanceWithoutFederationState'][] + /** FederatedInstances.allowed */ + allowed: components['schemas']['InstanceWithoutFederationState'][] + /** FederatedInstances.blocked */ + blocked: components['schemas']['InstanceWithoutFederationState'][] + } + /** CommunityBlockView */ + CommunityBlockView: { + /** CommunityBlockView.community */ + community: components['schemas']['Community'] + /** CommunityBlockView.person */ + person: components['schemas']['Person'] + } + /** CommunityFollowerView */ + CommunityFollowerView: { + /** CommunityFollowerView.community */ + community: components['schemas']['Community'] + /** CommunityFollowerView.follower */ + follower: components['schemas']['Person'] + } + /** LanguageView */ + LanguageView: { + /** + * Language.code + * @example en + */ + code?: string + /** + * Language.id + * @example 2 + */ + id?: number + /** + * Language.name + * @example English + */ + name?: string + } + /** InstanceBlockView */ + InstanceBlockView: { + /** InstanceBlockView.person */ + person: components['schemas']['Person'] + /** InstanceBlockView.instance */ + instance: components['schemas']['Instance'] + /** InstanceBlockView.site */ + site?: components['schemas']['Site'] + } + /** LocalUserView */ + LocalUserView: { + /** LocalUserView.counts */ + counts: components['schemas']['PersonAggregates'] + /** LocalUserView.local_user */ + local_user: components['schemas']['LocalUser'] + /** LocalUserView.person */ + person: components['schemas']['Person'] + } + /** CommunityModeratorView */ + CommunityModeratorView: { + /** CommunityModeratorView.community */ + community: components['schemas']['Community'] + /** CommunityModeratorView.moderator */ + moderator: components['schemas']['Person'] + } + /** PersonBlockView */ + PersonBlockView: { + /** PersonBlockView.person */ + person: components['schemas']['Person'] + /** PersonBlockView.target */ + target: components['schemas']['Person'] + } + /** PersonView */ + PersonView: { + /** PersonView.person */ + person: components['schemas']['Person'] + /** PersonView.counts */ + counts: components['schemas']['PersonAggregates'] + /** PersonView.is_admin */ + is_admin: boolean + /** PersonView.activity_alert */ + activity_alert: boolean + } + /** CommentView */ + CommentView: { + /** CommentView.comment */ + comment: components['schemas']['Comment'] + /** CommentView.creator */ + creator: components['schemas']['Person'] + /** CommentView.post */ + post: components['schemas']['Post'] + /** CommentView.community */ + community: components['schemas']['Community'] + /** CommentView.counts */ + counts: components['schemas']['CommentAggregates'] + /** CommentView.creator_banned_from_community */ + creator_banned_from_community: boolean + /** CommentView.banned_from_community */ + banned_from_community: boolean + /** CommentView.creator_is_moderator */ + creator_is_moderator: boolean + /** CommentView.creator_is_admin */ + creator_is_admin: boolean + /** CommentView.subscribed */ + subscribed: components['schemas']['SubscribedType'] + /** CommentView.saved */ + saved: boolean + /** CommentView.activity_alert */ + activity_alert: boolean + /** CommentView.creator_blocked */ + creator_blocked: boolean + /** CommentView.my_vote */ + my_vote?: number + } + /** PostView */ + PostView: { + /** PostView.post */ + post: components['schemas']['Post'] + /** PostView.creator */ + creator: components['schemas']['Person'] + /** PostView.community */ + community: components['schemas']['Community'] + /** PostView.creator_banned_from_community */ + creator_banned_from_community: boolean + /** PostView.banned_from_community */ + banned_from_community: boolean + /** PostView.creator_is_moderator */ + creator_is_moderator: boolean + /** PostView.creator_is_admin */ + creator_is_admin: boolean + /** PostView.counts */ + counts: components['schemas']['PostAggregates'] + /** PostView.subscribed */ + subscribed: components['schemas']['SubscribedType'] + /** PostView.saved */ + saved: boolean + /** PostView.activity_alert */ + activity_alert?: boolean + /** PostView.read */ + read: boolean + /** PostView.hidden */ + hidden: boolean + /** PostView.my_vote */ + my_vote?: number + /** PostView.unread_comments */ + unread_comments: number + } + /** CommunityView */ + CommunityView: { + /** CommunityView.community */ + community: components['schemas']['Community'] + /** CommunityView.subscribed */ + subscribed: components['schemas']['SubscribedType'] + /** CommunityView.blocked */ + blocked: boolean + /** CommunityView.counts */ + counts: components['schemas']['CommunityAggregates'] + /** CommunityView.activity_alert */ + activity_alert: boolean + } + /** PostReportView */ + PostReportView: { + /** PostReportView.post_report */ + post_report: components['schemas']['PostReport'] + /** PostReportView.post */ + post: components['schemas']['Post'] + /** PostReportView.community */ + community: components['schemas']['Community'] + /** PostReportView.creator */ + creator: components['schemas']['Person'] + /** PostReportView.post_creator */ + post_creator: components['schemas']['Person'] + /** PostReportView.creator_banned_from_community */ + creator_banned_from_community: boolean + /** PostReportView.creator_is_moderator */ + creator_is_moderator: boolean + /** PostReportView.creator_is_admin */ + creator_is_admin: boolean + /** PostReportView.subscribed */ + subscribed: components['schemas']['SubscribedType'] + /** PostReportView.saved */ + saved: boolean + /** PostReportView.creator_blocked */ + creator_blocked: boolean + /** PostReportView.my_vote */ + my_vote?: number + /** PostReportView.counts */ + counts: components['schemas']['PostAggregates'] + /** PostReportView.resolver */ + resolver?: components['schemas']['Person'] + } + /** CommentReportView */ + CommentReportView: { + /** CommentReportView.comment_report */ + comment_report: components['schemas']['CommentReport'] + /** CommentReportView.comment */ + comment: components['schemas']['Comment'] + /** CommentReportView.post */ + post: components['schemas']['Post'] + /** CommentReportView.community */ + community: components['schemas']['Community'] + /** CommentReportView.creator */ + creator: components['schemas']['Person'] + /** CommentReportView.comment_creator */ + comment_creator: components['schemas']['Person'] + /** CommentReportView.counts */ + counts: components['schemas']['CommentAggregates'] + /** CommentReportView.creator_banned_from_community */ + creator_banned_from_community: boolean + /** CommentReportView.creator_is_moderator */ + creator_is_moderator: boolean + /** CommentReportView.creator_is_admin */ + creator_is_admin: boolean + /** CommentReportView.creator_blocked */ + creator_blocked: boolean + /** CommentReportView.subscribed */ + subscribed: components['schemas']['SubscribedType'] + /** CommentReportView.saved */ + saved: boolean + /** CommentReportView.my_vote */ + my_vote?: number + /** CommentReportView.resolver */ + resolver?: components['schemas']['Person'] + } + /** CommentReplyView */ + CommentReplyView: { + /** CommentReplyView.comment_reply */ + comment_reply: components['schemas']['CommentReply'] + /** CommentReplyView.comment */ + comment: components['schemas']['Comment'] + /** CommentReplyView.creator */ + creator: components['schemas']['Person'] + /** CommentReplyView.post */ + post: components['schemas']['Post'] + /** CommentReplyView.community */ + community: components['schemas']['Community'] + /** CommentReplyView.recipient */ + recipient: components['schemas']['Person'] + /** CommentReplyView.counts */ + counts: components['schemas']['CommentAggregates'] + /** CommentReplyView.creator_banned_from_community */ + creator_banned_from_community: boolean + /** CommentReplyView.creator_is_moderator */ + creator_is_moderator: boolean + /** CommentReplyView.creator_is_admin */ + creator_is_admin: boolean + /** CommentReplyView.subscribed */ + subscribed: components['schemas']['SubscribedType'] + /** CommentReplyView.saved */ + saved: boolean + /** CommentReplyView.creator_blocked */ + creator_blocked: boolean + /** CommentReplyView.my_vote */ + my_vote?: number + } + /** CommentReplyResponse */ + CommentReplyResponse: { + /** CommentResponse.comment_reply_view */ + comment_reply_view: components['schemas']['CommentReplyView'] + } + /** PrivateMessageView */ + PrivateMessageView: { + /** PrivateMessageView.private_message */ + private_message: components['schemas']['PrivateMessage'] + /** PrivateMessageView.creator */ + creator: components['schemas']['Person'] + /** PrivateMessageView.recipient */ + recipient: components['schemas']['Person'] + } + /** CommunityModerationBanItem */ + CommunityModerationBanItem: { + /** + * CommunityModerationBanItem.reason + * @example Violation of Rule 4 + */ + reason: string + /** + * CommunityModerationBanItem.expiredAt + * @example 2042-01-01T12:00:00 + */ + expiredAt: string + /** CommunityModerationBanItem.community */ + community: components['schemas']['Community'] + /** CommunityModerationBanItem.bannedUser */ + bannedUser: components['schemas']['Person'] + /** CommunityModerationBanItem.bannedBy */ + bannedBy: components['schemas']['Person'] + /** + * CommunityModerationBanItem.expired + * @example false + */ + expired: boolean + } + /** NotificationsCountsView */ + NotificationsCountsView: { + /** NotificationsCountsView.new_notifications */ + new_notifications: number + /** NotificationsCountsView.read_notifications */ + read_notifications: number + /** NotificationsCountsView.total_notifications */ + total_notifications?: number + } + /** NotificationsItemUserView */ + NotificationsItemUserView: { + /** + * NotificationsItemUserView.notif_id + * @example 1234 + */ + notif_id?: number + /** + * NotificationsItemUserView.notif_type + * @example 0 + */ + notif_type?: number + /** + * NotificationsItemUserView.notif_subtype + * @example new_post_from_followed_user + */ + notif_subtype?: string + /** NotificationsItemUserView.author */ + author?: components['schemas']['Person'] + /** NotificationsItemUserView.post */ + post?: components['schemas']['PostView'] + /** + * NotificationsItemUserView.post_id + * @example 1234 + */ + post_id?: number + /** + * NotificationsItemUserView.notif_body + * @example This is the body of a post. + */ + notif_body?: string + } + /** NotificationsItemCommunityView */ + NotificationsItemCommunityView: { + /** + * NotificationsItemCommunityView.notif_id + * @example 1234 + */ + notif_id?: number + /** + * NotificationsItemCommunityView.notif_type + * @example 1 + */ + notif_type?: number + /** + * NotificationsItemCommunityView.notif_subtype + * @example new_post_in_followed_community + */ + notif_subtype?: string + /** NotificationsItemCommunityView.author */ + author?: components['schemas']['Person'] + /** NotificationsItemCommunityView.post */ + post?: components['schemas']['PostView'] + /** + * NotificationsItemCommunityView.post_id + * @example 1234 + */ + post_id?: number + /** NotificationsItemCommunityView.community */ + community?: components['schemas']['CommunityView'] + /** + * NotificationsItemCommunityView.notif_body + * @example This is the body of a post. + */ + notif_body?: string + } + /** NotificationsItemTopicView */ + NotificationsItemTopicView: { + /** + * NotificationsItemTopicView.notif_id + * @example 1234 + */ + notif_id?: number + /** + * NotificationsItemTopicView.notif_type + * @example 2 + */ + notif_type?: number + /** + * NotificationsItemTopicView.notif_subtype + * @example new_post_in_followed_topic + */ + notif_subtype?: string + /** NotificationsItemTopicView.author */ + author?: components['schemas']['Person'] + /** NotificationsItemTopicView.post */ + post?: components['schemas']['PostView'] + /** + * NotificationsItemTopicView.post_id + * @example 1234 + */ + post_id?: number + /** + * NotificationsItemTopicView.notif_body + * @example This is the body of a post. + */ + notif_body?: string + } + /** NotificationsItemPostView */ + NotificationsItemPostView: { + /** + * NotificationsItemPostView.notif_id + * @example 1234 + */ + notif_id?: number + /** + * NotificationsItemPostView.notif_type + * @example 3 + */ + notif_type?: number + /** + * NotificationsItemPostView.notif_subtype + * @example top_level_comment_on_followed_post + */ + notif_subtype?: string + /** NotificationsItemPostView.author */ + author?: components['schemas']['Person'] + /** NotificationsItemPostView.post */ + post?: components['schemas']['PostView'] + /** + * NotificationsItemPostView.post_id + * @example 1234 + */ + post_id?: number + /** NotificationsItemPostView.comment */ + comment?: components['schemas']['Comment'] + /** + * NotificationsItemPostView.comment_id + * @example 1234 + */ + comment_id?: number + /** + * NotificationsItemPostView.notif_body + * @example This is the body of a comment. + */ + notif_body?: string + } + /** NotificationsItemReplyView */ + NotificationsItemReplyView: { + /** + * NotificationsItemReplyView.notif_id + * @example 1234 + */ + notif_id?: number + /** + * NotificationsItemReplyView.notif_type + * @example 4 + */ + notif_type?: number + /** + * NotificationsItemReplyView.notif_subtype + * @example new_reply_on_followed_comment + */ + notif_subtype?: string + /** NotificationsItemReplyView.author */ + author?: components['schemas']['Person'] + /** NotificationsItemReplyView.post */ + post?: components['schemas']['PostView'] + /** + * NotificationsItemReplyView.post_id + * @example 1234 + */ + post_id?: number + /** NotificationsItemReplyView.comment */ + comment?: components['schemas']['Comment'] + /** + * NotificationsItemReplyView.comment_id + * @example 1234 + */ + comment_id?: number + /** + * NotificationsItemReplyView.notif_body + * @example This is the body of a comment. + */ + notif_body?: string + } + /** NotificationsItemFeedView */ + NotificationsItemFeedView: { + /** + * NotificationsItemFeedView.notif_id + * @example 1234 + */ + notif_id?: number + /** + * NotificationsItemFeedView.notif_type + * @example 5 + */ + notif_type?: number + /** + * NotificationsItemFeedView.notif_subtype + * @example new_post_in_followed_feed + */ + notif_subtype?: string + /** NotificationsItemFeedView.author */ + author?: components['schemas']['Person'] + /** NotificationsItemFeedView.post */ + post?: components['schemas']['PostView'] + /** + * NotificationsItemFeedView.post_id + * @example 1234 + */ + post_id?: number + /** + * NotificationsItemFeedView.notif_body + * @example This is the body of a post. + */ + notif_body?: string + } + /** NotificationsItemPostMentionView */ + NotificationsItemPostMentionView: { + /** + * NotificationsItemPostMentionView.notif_id + * @example 1234 + */ + notif_id?: number + /** + * NotificationsItemPostMentionView.notif_type + * @example 6 + */ + notif_type?: number + /** + * NotificationsItemPostMentionView.notif_subtype + * @example post_mention + */ + notif_subtype?: string + /** NotificationsItemPostMentionView.author */ + author?: components['schemas']['Person'] + /** NotificationsItemPostMentionView.post */ + post?: components['schemas']['PostView'] + /** + * NotificationsItemPostMentionView.post_id + * @example 1234 + */ + post_id?: number + /** + * NotificationsItemPostMentionView.notif_body + * @example This is the body of a post. + */ + notif_body?: string + } + /** NotificationsItemCommentMentionView */ + NotificationsItemCommentMentionView: { + /** + * NotificationsItemCommentMentionView.notif_id + * @example 1234 + */ + notif_id?: number + /** + * NotificationsItemCommentMentionView.notif_type + * @example 6 + */ + notif_type?: number + /** + * NotificationsItemCommentMentionView.notif_subtype + * @example comment_mention + */ + notif_subtype?: string + /** NotificationsItemCommentMentionView.author */ + author?: components['schemas']['Person'] + /** NotificationsItemCommentMentionView.comment */ + comment?: components['schemas']['Comment'] + /** + * NotificationsItemCommentMentionView.comment_id + * @example 1234 + */ + comment_id?: number + /** + * NotificationsItemCommentMentionView.notif_body + * @example This is the body of a comment. + */ + notif_body?: string + } + FeedView: { + /** + * FeedView.actor_id + * Format: url + */ + actor_id: string + /** FeedView.ap_domain */ + ap_domain: string + /** FeedView.children */ + children: components['schemas']['FeedView'][] + /** FeedView.communities */ + communities: components['schemas']['Community'][] + /** FeedView.communities_count */ + communities_count: number + /** FeedView.id */ + id: number + /** FeedView.is_instance_feed */ + is_instance_feed: boolean + /** FeedView.local */ + local: boolean + /** FeedView.name */ + name: string + /** FeedView.nsfl */ + nsfl: boolean + /** FeedView.nsfw */ + nsfw: boolean + /** + * FeedView.owner + * @description Is the authorized user the creator of the feed? + */ + owner: boolean + /** FeedView.public */ + public: boolean + /** + * FeedView.published + * Format: datetime + * @example 2025-06-07T02:29:07.980084Z + */ + published: string + /** FeedView.show_posts_from_children */ + show_posts_from_children: boolean + /** FeedView.subscribed */ + subscribed: boolean + /** FeedView.subscriptions_count */ + subscriptions_count: number + /** FeedView.title */ + title: string + /** + * FeedView.updated + * Format: datetime + * @example 2025-06-07T02:29:07.980084Z + */ + updated: string + /** + * FeedView.user_id + * @description user_id of the feed creator/owner + */ + user_id: number + /** + * FeedView.banner + * Format: url + */ + banner?: string + /** + * FeedView.description + * Format: markdown + */ + description?: string + /** + * FeedView.description_html + * Format: html + */ + description_html?: string + /** + * FeedView.icon + * Format: url + */ + icon?: string + /** FeedView.parent_feed_id */ + parent_feed_id?: number + } + TopicView: { + /** TopicView.children */ + children: components['schemas']['TopicView'][] + /** TopicView.communities */ + communities: components['schemas']['Community'][] + /** TopicView.communities_count */ + communities_count: number + /** TopicView.id */ + id: number + /** TopicView.name */ + name: string + /** TopicView.show_posts_from_children */ + show_posts_from_children: boolean + /** TopicView.title */ + title: string + /** TopicView.parent_topic_id */ + parent_topic_id?: number + } + /** + * RegistrationMode + * @enum {string} + */ + RegistrationMode: 'Closed' | 'RequireApplication' | 'Open' + /** + * SearchType + * @enum {string} + */ + SearchType: 'Communities' | 'Posts' | 'Users' | 'Url' + /** + * CommunitySortType + * @enum {string} + */ + CommunitySortType: 'Active' | 'New' + /** + * ListingType + * @enum {string} + */ + ListingType: 'All' | 'Local' | 'Subscribed' | 'Popular' | 'ModeratorView' + /** + * SortType + * @enum {string} + */ + SortType: + | 'Active' + | 'Hot' + | 'New' + | 'TopHour' + | 'TopSixHour' + | 'TopTwelveHour' + | 'TopDay' + | 'TopWeek' + | 'TopMonth' + | 'TopThreeMonths' + | 'TopSixMonths' + | 'TopNineMonths' + | 'TopYear' + | 'TopAll' + | 'Scaled' + /** + * SubscribedType + * @enum {string} + */ + SubscribedType: 'Subscribed' | 'NotSubscribed' | 'Pending' + /** + * PostFeatureType + * @enum {string} + */ + PostFeatureType: 'Local' | 'Community' + /** + * CommentSortType + * @enum {string} + */ + CommentSortType: 'Hot' | 'Top' | 'New' | 'Old' + /** + * NotificationStatusType + * @enum {string} + */ + NotificationStatusType: 'All' | 'New' | 'Read' + /** PersonAggregates */ + PersonAggregates: { + /** PersonAggregates.comment_count */ + comment_count: number + /** PersonAggregates.person_id */ + person_id: number + /** PersonAggregates.post_count */ + post_count: number + } + /** CommentAggregates */ + CommentAggregates: { + /** CommentAggregates.comment_id */ + comment_id: number + /** CommentAggregates.score */ + score: number + /** CommentAggregates.upvotes */ + upvotes: number + /** CommentAggregates.downvotes */ + downvotes: number + /** + * CommentAggregates.published + * Format: date-time + */ + published: string + /** CommentAggregates.child_count */ + child_count: number + } + /** PostAggregates */ + PostAggregates: { + /** PostAggregates.post_id */ + post_id: number + /** PostAggregates.comments */ + comments: number + /** PostAggregates.score */ + score: number + /** PostAggregates.upvotes */ + upvotes: number + /** PostAggregates.downvotes */ + downvotes: number + /** + * PostAggregates.published + * Format: date-time + */ + published: string + /** PostAggregates.newest_comment_time */ + newest_comment_time: string + } + /** CommunityAggregates */ + CommunityAggregates: { + /** CommunityAggregates.active_6monthly */ + active_6monthly: number + /** CommunityAggregates.active_daily */ + active_daily: number + /** CommunityAggregates.active_monthly */ + active_monthly: number + /** CommunityAggregates.active_weekly */ + active_weekly: number + /** CommunityAggregates.community_id */ + id: number + /** CommunityAggregates.post_count */ + post_count: number + /** CommunityAggregates.post_reply_count */ + post_reply_count: number + /** + * CommunityAggregates.published + * Format: date-time + */ + published: string + /** CommunityAggregates.subscriptions_count */ + subscriptions_count: number + /** CommunityAggregates.total_subscriptions_count */ + total_subscriptions_count: number + } + 'SuccessResponse-2': unknown + 'CommentReplyResponse-2': unknown + } + responses: never + parameters: never + requestBodies: never + headers: never + pathItems: never +} +export type $defs = Record +export interface operations { + markAllAsRead: { + parameters: { + query?: never + header?: never + path?: never + cookie?: never + } + requestBody?: never + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown + } + content: { + 'application/json': components['schemas']['GetRepliesResponse'] + } + } + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown + } + content: { + 'application/json': components['schemas']['BadRequest'] + } + } + } + } +} diff --git a/src/lib/client/types/index.ts b/src/lib/client/types/index.ts new file mode 100644 index 00000000..455e1b73 --- /dev/null +++ b/src/lib/client/types/index.ts @@ -0,0 +1,65 @@ +export * from './schemas/AddAdminResponse' +export * from './schemas/AddModToCommunityResponse' +export * from './schemas/BanFromCommunityResponse' +export * from './schemas/BanPersonResponse' +export * from './schemas/BannedPersonsResponse' +export * from './schemas/BlockCommunityResponse' +export * from './schemas/BlockInstanceResponse' +export * from './schemas/BlockPersonResponse' +export * from './schemas/CaptchaResponse' +export * from './schemas/CommentReplyResponse' +export * from './schemas/CommentReportResponse' +export * from './schemas/CommentResponse' +export * from './schemas/CommunityResponse' +export * from './schemas/CustomEmojiResponse' +export * from './schemas/GenerateTotpSecretResponse' +export * from './schemas/GetCaptchaResponse' +export * from './schemas/GetComment' +export * from './schemas/GetComments' +export * from './schemas/GetCommentsResponse' +export * from './schemas/GetCommunity' +export * from './schemas/GetCommunityResponse' +export * from './schemas/GetFederatedInstancesResponse' +export * from './schemas/GetModlog' +export * from './schemas/GetModlogResponse' +export * from './schemas/GetPersonDetails' +export * from './schemas/GetPersonDetailsResponse' +export * from './schemas/GetPersonMentions' +export * from './schemas/GetPersonMentionsResponse' +export * from './schemas/GetPost' +export * from './schemas/GetPostResponse' +export * from './schemas/GetPosts' +export * from './schemas/GetPostsResponse' +export * from './schemas/GetPrivateMessages' +export * from './schemas/GetRegistrationApplication' +export * from './schemas/GetReplies' +export * from './schemas/GetRepliesResponse' +export * from './schemas/GetReportCount' +export * from './schemas/GetReportCountResponse' +export * from './schemas/GetSiteMetadata' +export * from './schemas/GetSiteMetadataResponse' +export * from './schemas/GetSiteResponse' +export * from './schemas/GetUnreadCountResponse' +export * from './schemas/GetUnreadRegistrationApplicationCountResponse' +export * from './schemas/ListCommentLikesResponse' +export * from './schemas/ListCommentReportsResponse' +export * from './schemas/ListCommunitiesResponse' +export * from './schemas/ListMediaResponse' +export * from './schemas/ListPostLikesResponse' +export * from './schemas/ListPostReportsResponse' +export * from './schemas/ListPrivateMessageReportsResponse' +export * from './schemas/ListRegistrationApplicationsResponse' +export * from './schemas/LoginResponse' +export * from './schemas/PersonMentionResponse' +export * from './schemas/PostReportResponse' +export * from './schemas/PostResponse' +export * from './schemas/PrivateMessageReportResponse' +export * from './schemas/PrivateMessageResponse' +export * from './schemas/PrivateMessagesResponse' +export * from './schemas/RegistrationApplicationResponse' +export * from './schemas/ResolveObjectResponse' +export * from './schemas/SearchResponse' +export * from './schemas/SiteResponse' +export * from './schemas/SuccessResponse' +export * from './schemas/UpdateTotpResponse' +export * from './schemas/schemas' diff --git a/src/lib/client/types/schemas/AddAdminResponse.ts b/src/lib/client/types/schemas/AddAdminResponse.ts new file mode 100644 index 00000000..df4c1a63 --- /dev/null +++ b/src/lib/client/types/schemas/AddAdminResponse.ts @@ -0,0 +1,4 @@ +import type { PersonView } from './schemas' +export interface AddAdminResponse { + admins: Array +} diff --git a/src/lib/client/types/schemas/AddModToCommunityResponse.ts b/src/lib/client/types/schemas/AddModToCommunityResponse.ts new file mode 100644 index 00000000..aa6e6f78 --- /dev/null +++ b/src/lib/client/types/schemas/AddModToCommunityResponse.ts @@ -0,0 +1,4 @@ +import type { CommunityModeratorView } from './schemas' +export interface AddModToCommunityResponse { + moderators: Array +} diff --git a/src/lib/client/types/schemas/BanFromCommunityResponse.ts b/src/lib/client/types/schemas/BanFromCommunityResponse.ts new file mode 100644 index 00000000..fedba8f0 --- /dev/null +++ b/src/lib/client/types/schemas/BanFromCommunityResponse.ts @@ -0,0 +1,5 @@ +import type { PersonView } from './schemas' +export interface BanFromCommunityResponse { + person_view: PersonView + banned: boolean +} diff --git a/src/lib/client/types/schemas/BanPersonResponse.ts b/src/lib/client/types/schemas/BanPersonResponse.ts new file mode 100644 index 00000000..67d826ea --- /dev/null +++ b/src/lib/client/types/schemas/BanPersonResponse.ts @@ -0,0 +1,5 @@ +import type { PersonView } from './schemas' +export interface BanPersonResponse { + person_view: PersonView + banned: boolean +} diff --git a/src/lib/client/types/schemas/BannedPersonsResponse.ts b/src/lib/client/types/schemas/BannedPersonsResponse.ts new file mode 100644 index 00000000..cbf538bd --- /dev/null +++ b/src/lib/client/types/schemas/BannedPersonsResponse.ts @@ -0,0 +1,4 @@ +import type { PersonView } from './schemas' +export interface BannedPersonsResponse { + banned: Array +} diff --git a/src/lib/client/types/schemas/BlockCommunityResponse.ts b/src/lib/client/types/schemas/BlockCommunityResponse.ts new file mode 100644 index 00000000..b63ab275 --- /dev/null +++ b/src/lib/client/types/schemas/BlockCommunityResponse.ts @@ -0,0 +1,5 @@ +import type { CommunityView } from './schemas' +export interface BlockCommunityResponse { + community_view: CommunityView + blocked: boolean +} diff --git a/src/lib/client/types/schemas/BlockInstanceResponse.ts b/src/lib/client/types/schemas/BlockInstanceResponse.ts new file mode 100644 index 00000000..a9a1f886 --- /dev/null +++ b/src/lib/client/types/schemas/BlockInstanceResponse.ts @@ -0,0 +1,3 @@ +export interface BlockInstanceResponse { + blocked: boolean; +} diff --git a/src/lib/client/types/schemas/BlockPersonResponse.ts b/src/lib/client/types/schemas/BlockPersonResponse.ts new file mode 100644 index 00000000..7336a5ef --- /dev/null +++ b/src/lib/client/types/schemas/BlockPersonResponse.ts @@ -0,0 +1,5 @@ +import type { PersonView } from './schemas' +export interface BlockPersonResponse { + person_view: PersonView + blocked: boolean +} diff --git a/src/lib/client/types/schemas/CaptchaResponse.ts b/src/lib/client/types/schemas/CaptchaResponse.ts new file mode 100644 index 00000000..60537f31 --- /dev/null +++ b/src/lib/client/types/schemas/CaptchaResponse.ts @@ -0,0 +1,5 @@ +export interface CaptchaResponse { + png: string; + wav: string; + uuid: string; +} diff --git a/src/lib/client/types/schemas/CommentReplyResponse.ts b/src/lib/client/types/schemas/CommentReplyResponse.ts new file mode 100644 index 00000000..c6668b27 --- /dev/null +++ b/src/lib/client/types/schemas/CommentReplyResponse.ts @@ -0,0 +1,4 @@ +import type { CommentReplyView } from './schemas' +export interface CommentReplyResponse { + comment_reply_view: CommentReplyView +} diff --git a/src/lib/client/types/schemas/CommentReportResponse.ts b/src/lib/client/types/schemas/CommentReportResponse.ts new file mode 100644 index 00000000..1955378e --- /dev/null +++ b/src/lib/client/types/schemas/CommentReportResponse.ts @@ -0,0 +1,4 @@ +import type { CommentReportView } from './schemas' +export interface CommentReportResponse { + comment_report_view: CommentReportView +} diff --git a/src/lib/client/types/schemas/CommentResponse.ts b/src/lib/client/types/schemas/CommentResponse.ts new file mode 100644 index 00000000..415b3dc2 --- /dev/null +++ b/src/lib/client/types/schemas/CommentResponse.ts @@ -0,0 +1,6 @@ +import type { CommentView } from './schemas' +import type { LocalUserId } from './schemas' +export interface CommentResponse { + comment_view: CommentView + recipient_ids: Array +} diff --git a/src/lib/client/types/schemas/CommunityResponse.ts b/src/lib/client/types/schemas/CommunityResponse.ts new file mode 100644 index 00000000..d74cd18d --- /dev/null +++ b/src/lib/client/types/schemas/CommunityResponse.ts @@ -0,0 +1,6 @@ +import type { CommunityView } from './schemas' +import type { LanguageId } from './schemas' +export interface CommunityResponse { + community_view: CommunityView + discussion_languages: Array +} diff --git a/src/lib/client/types/schemas/CustomEmojiResponse.ts b/src/lib/client/types/schemas/CustomEmojiResponse.ts new file mode 100644 index 00000000..56ba1ed9 --- /dev/null +++ b/src/lib/client/types/schemas/CustomEmojiResponse.ts @@ -0,0 +1,4 @@ +import type { CustomEmojiView } from './schemas' +export interface CustomEmojiResponse { + custom_emoji: CustomEmojiView +} diff --git a/src/lib/client/types/schemas/GenerateTotpSecretResponse.ts b/src/lib/client/types/schemas/GenerateTotpSecretResponse.ts new file mode 100644 index 00000000..6487ed95 --- /dev/null +++ b/src/lib/client/types/schemas/GenerateTotpSecretResponse.ts @@ -0,0 +1,3 @@ +export interface GenerateTotpSecretResponse { + totp_secret_url: string; +} diff --git a/src/lib/client/types/schemas/GetCaptchaResponse.ts b/src/lib/client/types/schemas/GetCaptchaResponse.ts new file mode 100644 index 00000000..b52c0ae9 --- /dev/null +++ b/src/lib/client/types/schemas/GetCaptchaResponse.ts @@ -0,0 +1,4 @@ +import type { CaptchaResponse } from './schemas' +export interface GetCaptchaResponse { + ok?: CaptchaResponse +} diff --git a/src/lib/client/types/schemas/GetComment.ts b/src/lib/client/types/schemas/GetComment.ts new file mode 100644 index 00000000..fc3a7568 --- /dev/null +++ b/src/lib/client/types/schemas/GetComment.ts @@ -0,0 +1,4 @@ +import type { CommentId } from './schemas' +export interface GetComment { + id: CommentId +} diff --git a/src/lib/client/types/schemas/GetComments.ts b/src/lib/client/types/schemas/GetComments.ts new file mode 100644 index 00000000..43e7cddf --- /dev/null +++ b/src/lib/client/types/schemas/GetComments.ts @@ -0,0 +1,19 @@ +import type { CommentId } from './schemas' +import type { CommentSortType } from './schemas' +import type { CommunityId } from './schemas' +import type { ListingType } from './schemas' +import type { PostId } from './schemas' +export interface GetComments { + type_?: ListingType + sort?: CommentSortType + max_depth?: number + page?: number + limit?: number + community_id?: CommunityId + community_name?: string + post_id?: PostId + parent_id?: CommentId + saved_only?: boolean + liked_only?: boolean + disliked_only?: boolean +} diff --git a/src/lib/client/types/schemas/GetCommentsResponse.ts b/src/lib/client/types/schemas/GetCommentsResponse.ts new file mode 100644 index 00000000..b614a85e --- /dev/null +++ b/src/lib/client/types/schemas/GetCommentsResponse.ts @@ -0,0 +1,4 @@ +import type { CommentView } from './schemas' +export interface GetCommentsResponse { + comments: Array +} diff --git a/src/lib/client/types/schemas/GetCommunity.ts b/src/lib/client/types/schemas/GetCommunity.ts new file mode 100644 index 00000000..1e2fcbec --- /dev/null +++ b/src/lib/client/types/schemas/GetCommunity.ts @@ -0,0 +1,5 @@ +import type { CommunityId } from './schemas' +export interface GetCommunity { + id?: CommunityId + name?: string +} diff --git a/src/lib/client/types/schemas/GetCommunityResponse.ts b/src/lib/client/types/schemas/GetCommunityResponse.ts new file mode 100644 index 00000000..24890ccf --- /dev/null +++ b/src/lib/client/types/schemas/GetCommunityResponse.ts @@ -0,0 +1,10 @@ +import type { CommunityModeratorView } from './schemas' +import type { CommunityView } from './schemas' +import type { LanguageId } from './schemas' +import type { Site } from './schemas' +export interface GetCommunityResponse { + community_view: CommunityView + site?: Site + moderators: Array + discussion_languages: Array +} diff --git a/src/lib/client/types/schemas/GetFederatedInstancesResponse.ts b/src/lib/client/types/schemas/GetFederatedInstancesResponse.ts new file mode 100644 index 00000000..72319e3c --- /dev/null +++ b/src/lib/client/types/schemas/GetFederatedInstancesResponse.ts @@ -0,0 +1,4 @@ +import type { FederatedInstances } from './schemas' +export interface GetFederatedInstancesResponse { + federated_instances?: FederatedInstances +} diff --git a/src/lib/client/types/schemas/GetModlog.ts b/src/lib/client/types/schemas/GetModlog.ts new file mode 100644 index 00000000..115caae4 --- /dev/null +++ b/src/lib/client/types/schemas/GetModlog.ts @@ -0,0 +1,15 @@ +import type { CommentId } from './schemas' +import type { CommunityId } from './schemas' +import type { ModlogActionType } from './schemas' +import type { PersonId } from './schemas' +import type { PostId } from './schemas' +export interface GetModlog { + mod_person_id?: PersonId + community_id?: CommunityId + page?: number + limit?: number + type_?: ModlogActionType + other_person_id?: PersonId + post_id?: PostId + comment_id?: CommentId +} diff --git a/src/lib/client/types/schemas/GetModlogResponse.ts b/src/lib/client/types/schemas/GetModlogResponse.ts new file mode 100644 index 00000000..953c1024 --- /dev/null +++ b/src/lib/client/types/schemas/GetModlogResponse.ts @@ -0,0 +1,32 @@ +import type { AdminPurgeCommentView } from './schemas' +import type { AdminPurgeCommunityView } from './schemas' +import type { AdminPurgePersonView } from './schemas' +import type { AdminPurgePostView } from './schemas' +import type { ModAddCommunityView } from './schemas' +import type { ModAddView } from './schemas' +import type { ModBanFromCommunityView } from './schemas' +import type { ModBanView } from './schemas' +import type { ModFeaturePostView } from './schemas' +import type { ModHideCommunityView } from './schemas' +import type { ModLockPostView } from './schemas' +import type { ModRemoveCommentView } from './schemas' +import type { ModRemoveCommunityView } from './schemas' +import type { ModRemovePostView } from './schemas' +import type { ModTransferCommunityView } from './schemas' +export interface GetModlogResponse { + removed_posts: Array + locked_posts: Array + featured_posts: Array + removed_comments: Array + removed_communities: Array + banned_from_community: Array + banned: Array + added_to_community: Array + transferred_to_community: Array + added: Array + admin_purged_persons: Array + admin_purged_communities: Array + admin_purged_posts: Array + admin_purged_comments: Array + hidden_communities: Array +} diff --git a/src/lib/client/types/schemas/GetPersonDetails.ts b/src/lib/client/types/schemas/GetPersonDetails.ts new file mode 100644 index 00000000..dc3cacef --- /dev/null +++ b/src/lib/client/types/schemas/GetPersonDetails.ts @@ -0,0 +1,12 @@ +import type { CommunityId } from './schemas' +import type { PersonId } from './schemas' +import type { SortType } from './schemas' +export interface GetPersonDetails { + person_id?: PersonId + username?: string + sort?: SortType + page?: number + limit?: number + community_id?: CommunityId + saved_only?: boolean +} diff --git a/src/lib/client/types/schemas/GetPersonDetailsResponse.ts b/src/lib/client/types/schemas/GetPersonDetailsResponse.ts new file mode 100644 index 00000000..21d9dfb9 --- /dev/null +++ b/src/lib/client/types/schemas/GetPersonDetailsResponse.ts @@ -0,0 +1,12 @@ +import type { CommentView } from './schemas' +import type { CommunityModeratorView } from './schemas' +import type { PersonView } from './schemas' +import type { PostView } from './schemas' +import type { Site } from './schemas' +export interface GetPersonDetailsResponse { + person_view: PersonView + site?: Site + comments: Array + posts: Array + moderates: Array +} diff --git a/src/lib/client/types/schemas/GetPersonMentions.ts b/src/lib/client/types/schemas/GetPersonMentions.ts new file mode 100644 index 00000000..20c1620b --- /dev/null +++ b/src/lib/client/types/schemas/GetPersonMentions.ts @@ -0,0 +1,7 @@ +import type { CommentSortType } from './schemas' +export interface GetPersonMentions { + sort?: CommentSortType + page?: number + limit?: number + unread_only?: boolean +} diff --git a/src/lib/client/types/schemas/GetPersonMentionsResponse.ts b/src/lib/client/types/schemas/GetPersonMentionsResponse.ts new file mode 100644 index 00000000..be644a7d --- /dev/null +++ b/src/lib/client/types/schemas/GetPersonMentionsResponse.ts @@ -0,0 +1,4 @@ +import type { PersonMentionView } from './schemas' +export interface GetPersonMentionsResponse { + mentions: Array +} diff --git a/src/lib/client/types/schemas/GetPost.ts b/src/lib/client/types/schemas/GetPost.ts new file mode 100644 index 00000000..cbf0190c --- /dev/null +++ b/src/lib/client/types/schemas/GetPost.ts @@ -0,0 +1,6 @@ +import type { CommentId } from './schemas' +import type { PostId } from './schemas' +export interface GetPost { + id?: PostId + comment_id?: CommentId +} diff --git a/src/lib/client/types/schemas/GetPostResponse.ts b/src/lib/client/types/schemas/GetPostResponse.ts new file mode 100644 index 00000000..5e7b8e97 --- /dev/null +++ b/src/lib/client/types/schemas/GetPostResponse.ts @@ -0,0 +1,9 @@ +import type { CommunityModeratorView } from './schemas' +import type { CommunityView } from './schemas' +import type { PostView } from './schemas' +export interface GetPostResponse { + post_view: PostView + community_view: CommunityView + moderators: Array + cross_posts: Array +} diff --git a/src/lib/client/types/schemas/GetPosts.ts b/src/lib/client/types/schemas/GetPosts.ts new file mode 100644 index 00000000..c60808a0 --- /dev/null +++ b/src/lib/client/types/schemas/GetPosts.ts @@ -0,0 +1,19 @@ +import type { CommunityId } from './schemas' +import type { ListingType } from './schemas' +import type { PaginationCursor } from './schemas' +import type { SortType } from './schemas' +export interface GetPosts { + type_?: ListingType + sort?: SortType + page?: number + limit?: number + community_id?: CommunityId + community_name?: string + saved_only?: boolean + liked_only?: boolean + disliked_only?: boolean + show_hidden?: boolean + show_read?: boolean + show_nsfw?: boolean + page_cursor?: PaginationCursor +} diff --git a/src/lib/client/types/schemas/GetPostsResponse.ts b/src/lib/client/types/schemas/GetPostsResponse.ts new file mode 100644 index 00000000..d055fb80 --- /dev/null +++ b/src/lib/client/types/schemas/GetPostsResponse.ts @@ -0,0 +1,6 @@ +import type { PaginationCursor } from './schemas' +import type { PostView } from './schemas' +export interface GetPostsResponse { + posts: Array + next_page?: PaginationCursor +} diff --git a/src/lib/client/types/schemas/GetPrivateMessages.ts b/src/lib/client/types/schemas/GetPrivateMessages.ts new file mode 100644 index 00000000..28af2df3 --- /dev/null +++ b/src/lib/client/types/schemas/GetPrivateMessages.ts @@ -0,0 +1,7 @@ +import type { PersonId } from './schemas' +export interface GetPrivateMessages { + unread_only?: boolean + page?: number + limit?: number + creator_id?: PersonId +} diff --git a/src/lib/client/types/schemas/GetRegistrationApplication.ts b/src/lib/client/types/schemas/GetRegistrationApplication.ts new file mode 100644 index 00000000..3584cce6 --- /dev/null +++ b/src/lib/client/types/schemas/GetRegistrationApplication.ts @@ -0,0 +1,4 @@ +import type { PersonId } from './schemas' +export interface GetRegistrationApplication { + person_id: PersonId +} diff --git a/src/lib/client/types/schemas/GetReplies.ts b/src/lib/client/types/schemas/GetReplies.ts new file mode 100644 index 00000000..b544804f --- /dev/null +++ b/src/lib/client/types/schemas/GetReplies.ts @@ -0,0 +1,7 @@ +import type { CommentSortType } from './schemas' +export interface GetReplies { + sort?: CommentSortType + page?: number + limit?: number + unread_only?: boolean +} diff --git a/src/lib/client/types/schemas/GetRepliesResponse.ts b/src/lib/client/types/schemas/GetRepliesResponse.ts new file mode 100644 index 00000000..3eb5a004 --- /dev/null +++ b/src/lib/client/types/schemas/GetRepliesResponse.ts @@ -0,0 +1,4 @@ +import type { CommentReplyView } from './schemas' +export interface GetRepliesResponse { + replies: Array +} diff --git a/src/lib/client/types/schemas/GetReportCount.ts b/src/lib/client/types/schemas/GetReportCount.ts new file mode 100644 index 00000000..e1cfa6e5 --- /dev/null +++ b/src/lib/client/types/schemas/GetReportCount.ts @@ -0,0 +1,4 @@ +import type { CommunityId } from './schemas' +export interface GetReportCount { + community_id?: CommunityId +} diff --git a/src/lib/client/types/schemas/GetReportCountResponse.ts b/src/lib/client/types/schemas/GetReportCountResponse.ts new file mode 100644 index 00000000..eaf63ba3 --- /dev/null +++ b/src/lib/client/types/schemas/GetReportCountResponse.ts @@ -0,0 +1,7 @@ +import type { CommunityId } from './schemas' +export interface GetReportCountResponse { + community_id?: CommunityId + comment_reports: number + post_reports: number + private_message_reports?: number +} diff --git a/src/lib/client/types/schemas/GetSiteMetadata.ts b/src/lib/client/types/schemas/GetSiteMetadata.ts new file mode 100644 index 00000000..e655e89b --- /dev/null +++ b/src/lib/client/types/schemas/GetSiteMetadata.ts @@ -0,0 +1,3 @@ +export interface GetSiteMetadata { + url: string; +} diff --git a/src/lib/client/types/schemas/GetSiteMetadataResponse.ts b/src/lib/client/types/schemas/GetSiteMetadataResponse.ts new file mode 100644 index 00000000..6a42850c --- /dev/null +++ b/src/lib/client/types/schemas/GetSiteMetadataResponse.ts @@ -0,0 +1,4 @@ +import type { LinkMetadata } from './schemas' +export interface GetSiteMetadataResponse { + metadata: LinkMetadata +} diff --git a/src/lib/client/types/schemas/GetSiteResponse.ts b/src/lib/client/types/schemas/GetSiteResponse.ts new file mode 100644 index 00000000..3d2fe303 --- /dev/null +++ b/src/lib/client/types/schemas/GetSiteResponse.ts @@ -0,0 +1,22 @@ +import type { + CustomEmojiView, + Language, + LanguageId, + LocalSiteUrlBlocklist, + MyUserInfo, + PersonView, + SiteView, + Tagline, +} from '..' + +export interface GetSiteResponse { + site_view: SiteView + admins: Array + version: string + my_user?: MyUserInfo + all_languages: Array + discussion_languages: Array + taglines: Array + custom_emojis: Array + blocked_urls: Array +} diff --git a/src/lib/client/types/schemas/GetUnreadCountResponse.ts b/src/lib/client/types/schemas/GetUnreadCountResponse.ts new file mode 100644 index 00000000..afd20066 --- /dev/null +++ b/src/lib/client/types/schemas/GetUnreadCountResponse.ts @@ -0,0 +1,5 @@ +export interface GetUnreadCountResponse { + replies: number; + mentions: number; + private_messages: number; +} diff --git a/src/lib/client/types/schemas/GetUnreadRegistrationApplicationCountResponse.ts b/src/lib/client/types/schemas/GetUnreadRegistrationApplicationCountResponse.ts new file mode 100644 index 00000000..d1a82db2 --- /dev/null +++ b/src/lib/client/types/schemas/GetUnreadRegistrationApplicationCountResponse.ts @@ -0,0 +1,3 @@ +export interface GetUnreadRegistrationApplicationCountResponse { + registration_applications: number; +} diff --git a/src/lib/client/types/schemas/ListCommentLikesResponse.ts b/src/lib/client/types/schemas/ListCommentLikesResponse.ts new file mode 100644 index 00000000..e81f383b --- /dev/null +++ b/src/lib/client/types/schemas/ListCommentLikesResponse.ts @@ -0,0 +1,4 @@ +import type { VoteView } from './schemas' +export interface ListCommentLikesResponse { + comment_likes: Array +} diff --git a/src/lib/client/types/schemas/ListCommentReportsResponse.ts b/src/lib/client/types/schemas/ListCommentReportsResponse.ts new file mode 100644 index 00000000..6fa3d306 --- /dev/null +++ b/src/lib/client/types/schemas/ListCommentReportsResponse.ts @@ -0,0 +1,4 @@ +import type { CommentReportView } from './schemas' +export interface ListCommentReportsResponse { + comment_reports: Array +} diff --git a/src/lib/client/types/schemas/ListCommunitiesResponse.ts b/src/lib/client/types/schemas/ListCommunitiesResponse.ts new file mode 100644 index 00000000..8ae06ac1 --- /dev/null +++ b/src/lib/client/types/schemas/ListCommunitiesResponse.ts @@ -0,0 +1,4 @@ +import type { CommunityView } from './schemas' +export interface ListCommunitiesResponse { + communities: Array +} diff --git a/src/lib/client/types/schemas/ListMediaResponse.ts b/src/lib/client/types/schemas/ListMediaResponse.ts new file mode 100644 index 00000000..43e5ae3f --- /dev/null +++ b/src/lib/client/types/schemas/ListMediaResponse.ts @@ -0,0 +1,4 @@ +import type { LocalImageView } from './schemas' +export interface ListMediaResponse { + images: Array +} diff --git a/src/lib/client/types/schemas/ListPostLikesResponse.ts b/src/lib/client/types/schemas/ListPostLikesResponse.ts new file mode 100644 index 00000000..9507d0fb --- /dev/null +++ b/src/lib/client/types/schemas/ListPostLikesResponse.ts @@ -0,0 +1,4 @@ +import type { VoteView } from './schemas' +export interface ListPostLikesResponse { + post_likes: Array +} diff --git a/src/lib/client/types/schemas/ListPostReportsResponse.ts b/src/lib/client/types/schemas/ListPostReportsResponse.ts new file mode 100644 index 00000000..5d988fa9 --- /dev/null +++ b/src/lib/client/types/schemas/ListPostReportsResponse.ts @@ -0,0 +1,4 @@ +import type { PostReportView } from './schemas' +export interface ListPostReportsResponse { + post_reports: Array +} diff --git a/src/lib/client/types/schemas/ListPrivateMessageReportsResponse.ts b/src/lib/client/types/schemas/ListPrivateMessageReportsResponse.ts new file mode 100644 index 00000000..9121c5e5 --- /dev/null +++ b/src/lib/client/types/schemas/ListPrivateMessageReportsResponse.ts @@ -0,0 +1,4 @@ +import type { PrivateMessageReportView } from './schemas' +export interface ListPrivateMessageReportsResponse { + private_message_reports: Array +} diff --git a/src/lib/client/types/schemas/ListRegistrationApplicationsResponse.ts b/src/lib/client/types/schemas/ListRegistrationApplicationsResponse.ts new file mode 100644 index 00000000..20b30515 --- /dev/null +++ b/src/lib/client/types/schemas/ListRegistrationApplicationsResponse.ts @@ -0,0 +1,4 @@ +import type { RegistrationApplicationView } from './schemas' +export interface ListRegistrationApplicationsResponse { + registration_applications: Array +} diff --git a/src/lib/client/types/schemas/LoginResponse.ts b/src/lib/client/types/schemas/LoginResponse.ts new file mode 100644 index 00000000..425733fb --- /dev/null +++ b/src/lib/client/types/schemas/LoginResponse.ts @@ -0,0 +1,5 @@ +export interface LoginResponse { + jwt?: string; + registration_created: boolean; + verify_email_sent: boolean; +} diff --git a/src/lib/client/types/schemas/PersonMentionResponse.ts b/src/lib/client/types/schemas/PersonMentionResponse.ts new file mode 100644 index 00000000..8943357b --- /dev/null +++ b/src/lib/client/types/schemas/PersonMentionResponse.ts @@ -0,0 +1,4 @@ +import type { PersonMentionView } from './schemas' +export interface PersonMentionResponse { + person_mention_view: PersonMentionView +} diff --git a/src/lib/client/types/schemas/PostReportResponse.ts b/src/lib/client/types/schemas/PostReportResponse.ts new file mode 100644 index 00000000..9b6e6f0e --- /dev/null +++ b/src/lib/client/types/schemas/PostReportResponse.ts @@ -0,0 +1,4 @@ +import type { PostReportView } from './schemas' +export interface PostReportResponse { + post_report_view: PostReportView +} diff --git a/src/lib/client/types/schemas/PostResponse.ts b/src/lib/client/types/schemas/PostResponse.ts new file mode 100644 index 00000000..67536631 --- /dev/null +++ b/src/lib/client/types/schemas/PostResponse.ts @@ -0,0 +1,4 @@ +import type { PostView } from './schemas' +export interface PostResponse { + post_view: PostView +} diff --git a/src/lib/client/types/schemas/PrivateMessageReportResponse.ts b/src/lib/client/types/schemas/PrivateMessageReportResponse.ts new file mode 100644 index 00000000..0898c8ed --- /dev/null +++ b/src/lib/client/types/schemas/PrivateMessageReportResponse.ts @@ -0,0 +1,4 @@ +import type { PrivateMessageReportView } from './schemas' +export interface PrivateMessageReportResponse { + private_message_report_view: PrivateMessageReportView +} diff --git a/src/lib/client/types/schemas/PrivateMessageResponse.ts b/src/lib/client/types/schemas/PrivateMessageResponse.ts new file mode 100644 index 00000000..30051909 --- /dev/null +++ b/src/lib/client/types/schemas/PrivateMessageResponse.ts @@ -0,0 +1,4 @@ +import type { PrivateMessageView } from './schemas' +export interface PrivateMessageResponse { + private_message_view: PrivateMessageView +} diff --git a/src/lib/client/types/schemas/PrivateMessagesResponse.ts b/src/lib/client/types/schemas/PrivateMessagesResponse.ts new file mode 100644 index 00000000..3fae981a --- /dev/null +++ b/src/lib/client/types/schemas/PrivateMessagesResponse.ts @@ -0,0 +1,4 @@ +import type { PrivateMessageView } from './schemas' +export interface PrivateMessagesResponse { + private_messages: Array +} diff --git a/src/lib/client/types/schemas/RegistrationApplicationResponse.ts b/src/lib/client/types/schemas/RegistrationApplicationResponse.ts new file mode 100644 index 00000000..cbba5a1f --- /dev/null +++ b/src/lib/client/types/schemas/RegistrationApplicationResponse.ts @@ -0,0 +1,4 @@ +import type { RegistrationApplicationView } from './schemas' +export interface RegistrationApplicationResponse { + registration_application: RegistrationApplicationView +} diff --git a/src/lib/client/types/schemas/ResolveObjectResponse.ts b/src/lib/client/types/schemas/ResolveObjectResponse.ts new file mode 100644 index 00000000..8d09d4ca --- /dev/null +++ b/src/lib/client/types/schemas/ResolveObjectResponse.ts @@ -0,0 +1,6 @@ +export interface ResolveObjectResponse { + comment?: CommentView + post?: PostView + community?: CommunityView + person?: PersonView +} diff --git a/src/lib/client/types/schemas/SearchResponse.ts b/src/lib/client/types/schemas/SearchResponse.ts new file mode 100644 index 00000000..7249b2d2 --- /dev/null +++ b/src/lib/client/types/schemas/SearchResponse.ts @@ -0,0 +1,12 @@ +import type { CommentView } from './schemas' +import type { CommunityView } from './schemas' +import type { PersonView } from './schemas' +import type { PostView } from './schemas' +import type { SearchType } from './schemas' +export interface SearchResponse { + type_: SearchType + comments: Array + posts: Array + communities: Array + users: Array +} diff --git a/src/lib/client/types/schemas/SiteResponse.ts b/src/lib/client/types/schemas/SiteResponse.ts new file mode 100644 index 00000000..675c1efe --- /dev/null +++ b/src/lib/client/types/schemas/SiteResponse.ts @@ -0,0 +1,6 @@ +import type { SiteView } from './schemas' +import type { Tagline } from './schemas' +export interface SiteResponse { + site_view: SiteView + taglines: Array +} diff --git a/src/lib/client/types/schemas/SuccessResponse.ts b/src/lib/client/types/schemas/SuccessResponse.ts new file mode 100644 index 00000000..e0dd3705 --- /dev/null +++ b/src/lib/client/types/schemas/SuccessResponse.ts @@ -0,0 +1,3 @@ +export interface SuccessResponse { + success: boolean; +} diff --git a/src/lib/client/types/schemas/UpdateTotpResponse.ts b/src/lib/client/types/schemas/UpdateTotpResponse.ts new file mode 100644 index 00000000..eaa16512 --- /dev/null +++ b/src/lib/client/types/schemas/UpdateTotpResponse.ts @@ -0,0 +1,3 @@ +export interface UpdateTotpResponse { + enabled: boolean; +} diff --git a/src/lib/client/types/schemas/schemas.ts b/src/lib/client/types/schemas/schemas.ts new file mode 100644 index 00000000..f49745e3 --- /dev/null +++ b/src/lib/client/types/schemas/schemas.ts @@ -0,0 +1,1992 @@ +// TODO fix +type ActivityId = any + +export interface AddAdmin { + person_id: PersonId + added: boolean +} + +export interface AddModToCommunity { + community_id: CommunityId + person_id: PersonId + added: boolean +} + +export interface AdminPurgeComment { + id: number + admin_person_id: PersonId + post_id: PostId + reason?: string + when_: string +} + +export interface AdminPurgeCommentView { + admin_purge_comment: AdminPurgeComment + admin?: Person + post: Post +} + +export interface AdminPurgeCommunity { + id: number + admin_person_id: PersonId + reason?: string + when_: string +} + +export interface AdminPurgeCommunityView { + admin_purge_community: AdminPurgeCommunity + admin?: Person +} + +export interface AdminPurgePerson { + id: number + admin_person_id: PersonId + reason?: string + when_: string +} + +export interface AdminPurgePersonView { + admin_purge_person: AdminPurgePerson + admin?: Person +} + +export interface AdminPurgePost { + id: number + admin_person_id: PersonId + community_id: CommunityId + reason?: string + when_: string +} + +export interface AdminPurgePostView { + admin_purge_post: AdminPurgePost + admin?: Person + community: Community +} + +export interface ApproveRegistrationApplication { + id: RegistrationApplicationId + approve: boolean + deny_reason?: string +} + +export interface BanFromCommunity { + community_id: CommunityId + person_id: PersonId + ban: boolean + remove_data?: boolean + reason?: string + expires?: number +} + +export interface BanPerson { + person_id: PersonId + ban: boolean + remove_data?: boolean + reason?: string + expires?: number +} + +export interface BlockCommunity { + community_id: CommunityId + block: boolean +} + +export interface BlockInstance { + instance_id: InstanceId + block: boolean +} + +export interface BlockPerson { + person_id: PersonId + block: boolean +} +export interface ChangePassword { + new_password: string + new_password_verify: string + old_password: string +} + +export interface Comment { + id: CommentId + creator_id: PersonId + post_id: PostId + content: string + removed: boolean + published: string + updated?: string + deleted: boolean + ap_id: string + local: boolean + path: string + distinguished: boolean + language_id: LanguageId +} + +export interface CommentAggregates { + comment_id: CommentId + score: number + upvotes: number + downvotes: number + published: string + child_count: number +} +export type CommentId = number + +export interface CommentReply { + id: CommentReplyId + recipient_id: PersonId + comment_id: CommentId + read: boolean + published: string +} +export type CommentReplyId = number + +export interface CommentReplyView { + comment_reply: CommentReply + comment: Comment + creator: Person + post: Post + community: Community + recipient: Person + counts: CommentAggregates + creator_banned_from_community: boolean + banned_from_community: boolean + creator_is_moderator: boolean + creator_is_admin: boolean + subscribed: SubscribedType + saved: boolean + creator_blocked: boolean + my_vote?: number +} + +export interface CommentReport { + id: CommentReportId + creator_id: PersonId + comment_id: CommentId + original_comment_text: string + reason: string + resolved: boolean + resolver_id?: PersonId + published: string + updated?: string +} +export type CommentReportId = number + +export interface CommentReportView { + comment_report: CommentReport + comment: Comment + post: Post + community: Community + creator: Person + comment_creator: Person + counts: CommentAggregates + creator_banned_from_community: boolean + creator_is_moderator: boolean + creator_is_admin: boolean + creator_blocked: boolean + subscribed: SubscribedType + saved: boolean + my_vote?: number + resolver?: Person +} +export type CommentSortType = 'Hot' | 'Top' | 'New' | 'Old' | 'Controversial' + +export interface CommentView { + comment: Comment + creator: Person + post: Post + community: Community + counts: CommentAggregates + creator_banned_from_community: boolean + banned_from_community: boolean + creator_is_moderator: boolean + creator_is_admin: boolean + subscribed: SubscribedType + saved: boolean + creator_blocked: boolean + my_vote?: number +} + +export interface Community { + id: CommunityId + name: string + title: string + description?: string + removed: boolean + published: string + updated?: string + deleted: boolean + nsfw: boolean + actor_id: string + local: boolean + icon?: string + banner?: string + hidden: boolean + posting_restricted_to_mods: boolean + instance_id: InstanceId + visibility: CommunityVisibility +} + +export interface CommunityAggregates { + community_id: CommunityId + subscribers: number + posts: number + comments: number + published: string + users_active_day: number + users_active_week: number + users_active_month: number + users_active_half_year: number + subscribers_local: number +} + +export interface CommunityBlockView { + person: Person + community: Community +} + +export interface CommunityFollowerView { + community: Community + follower: Person +} +export type CommunityId = number + +export interface CommunityModeratorView { + community: Community + moderator: Person +} + +export interface CommunityView { + community: Community + subscribed: SubscribedType + blocked: boolean + counts: CommunityAggregates + banned_from_community: boolean +} +export type CommunityVisibility = 'Public' | 'LocalOnly' + +export interface CreateComment { + content: string + post_id: PostId + parent_id?: CommentId + language_id?: LanguageId +} + +export interface CreateCommentLike { + comment_id: CommentId + score: number +} + +export interface CreateCommentReport { + comment_id: CommentId + reason: string +} + +export interface CreateCommunity { + name: string + title: string + description?: string + icon?: string + banner?: string + nsfw?: boolean + posting_restricted_to_mods?: boolean + discussion_languages?: Array + visibility?: CommunityVisibility +} +export interface CreateCustomEmoji { + category: string + shortcode: string + image_url: string + alt_text: string + keywords: Array +} + +export interface CreatePost { + name: string + community_id: CommunityId + url?: string + body?: string + alt_text?: string + honeypot?: string + nsfw?: boolean + language_id?: LanguageId + custom_thumbnail?: string +} + +export interface CreatePostLike { + post_id: PostId + score: number +} + +export interface CreatePostReport { + post_id: PostId + reason: string +} + +export interface CreatePrivateMessage { + content: string + recipient_id: PersonId +} + +export interface CreatePrivateMessageReport { + private_message_id: PrivateMessageId + reason: string +} + +export interface CreateSite { + name: string + sidebar?: string + description?: string + icon?: string + banner?: string + enable_downvotes?: boolean + enable_nsfw?: boolean + community_creation_admin_only?: boolean + require_email_verification?: boolean + application_question?: string + private_instance?: boolean + default_theme?: string + default_post_listing_type?: ListingType + default_sort_type?: SortType + legal_information?: string + application_email_admins?: boolean + hide_modlog_mod_names?: boolean + discussion_languages?: Array + slur_filter_regex?: string + actor_name_max_length?: number + rate_limit_message?: number + rate_limit_message_per_second?: number + rate_limit_post?: number + rate_limit_post_per_second?: number + rate_limit_register?: number + rate_limit_register_per_second?: number + rate_limit_image?: number + rate_limit_image_per_second?: number + rate_limit_comment?: number + rate_limit_comment_per_second?: number + rate_limit_search?: number + rate_limit_search_per_second?: number + federation_enabled?: boolean + federation_debug?: boolean + captcha_enabled?: boolean + captcha_difficulty?: string + allowed_instances?: Array + blocked_instances?: Array + taglines?: Array + registration_mode?: RegistrationMode + content_warning?: string + default_post_listing_mode?: PostListingMode +} + +export interface CustomEmoji { + id: CustomEmojiId + local_site_id: LocalSiteId + shortcode: string + image_url: string + alt_text: string + category: string + published: string + updated?: string +} +export type CustomEmojiId = number + +export interface CustomEmojiKeyword { + custom_emoji_id: CustomEmojiId + keyword: string +} + +export interface CustomEmojiView { + custom_emoji: CustomEmoji + keywords: Array +} +export interface DeleteAccount { + password: string + delete_content: boolean +} + +export interface DeleteComment { + comment_id: CommentId + deleted: boolean +} + +export interface DeleteCommunity { + community_id: CommunityId + deleted: boolean +} + +export interface DeleteCustomEmoji { + id: CustomEmojiId +} + +export interface DeletePost { + post_id: PostId + deleted: boolean +} + +export interface DeletePrivateMessage { + private_message_id: PrivateMessageId + deleted: boolean +} + +export interface DistinguishComment { + comment_id: CommentId + distinguished: boolean +} + +export interface EditComment { + comment_id: CommentId + content?: string + language_id?: LanguageId +} + +export interface EditCommunity { + community_id: CommunityId + title?: string + description?: string + icon?: string + banner?: string + nsfw?: boolean + posting_restricted_to_mods?: boolean + discussion_languages?: Array + visibility?: CommunityVisibility +} + +export interface EditCustomEmoji { + id: CustomEmojiId + category: string + image_url: string + alt_text: string + keywords: Array +} + +export interface EditPost { + post_id: PostId + name?: string + url?: string + body?: string + alt_text?: string + nsfw?: boolean + language_id?: LanguageId + custom_thumbnail?: string +} + +export interface EditPrivateMessage { + private_message_id: PrivateMessageId + content: string +} + +export interface EditSite { + name?: string + sidebar?: string + description?: string + icon?: string + banner?: string + enable_downvotes?: boolean + enable_nsfw?: boolean + community_creation_admin_only?: boolean + require_email_verification?: boolean + application_question?: string + private_instance?: boolean + default_theme?: string + default_post_listing_type?: ListingType + default_sort_type?: SortType + legal_information?: string + application_email_admins?: boolean + hide_modlog_mod_names?: boolean + discussion_languages?: Array + slur_filter_regex?: string + actor_name_max_length?: number + rate_limit_message?: number + rate_limit_message_per_second?: number + rate_limit_post?: number + rate_limit_post_per_second?: number + rate_limit_register?: number + rate_limit_register_per_second?: number + rate_limit_image?: number + rate_limit_image_per_second?: number + rate_limit_comment?: number + rate_limit_comment_per_second?: number + rate_limit_search?: number + rate_limit_search_per_second?: number + federation_enabled?: boolean + federation_debug?: boolean + captcha_enabled?: boolean + captcha_difficulty?: string + allowed_instances?: Array + blocked_instances?: Array + blocked_urls?: Array + taglines?: Array + registration_mode?: RegistrationMode + reports_email_admins?: boolean + content_warning?: string + default_post_listing_mode?: PostListingMode +} + +export interface FeaturePost { + post_id: PostId + featured: boolean + feature_type: PostFeatureType +} + +export interface FederatedInstances { + linked: Array + allowed: Array + blocked: Array +} + +export interface FollowCommunity { + community_id: CommunityId + follow: boolean +} + +export interface HideCommunity { + community_id: CommunityId + hidden: boolean + reason?: string +} + +export interface HidePost { + post_ids: Array + hide: boolean +} +export interface ImageDetails { + link: string + width: number + height: number + content_type: string +} + +export interface Instance { + id: InstanceId + domain: string + published: string + updated?: string + software?: string + version?: string +} + +export interface InstanceBlockView { + person: Person + instance: Instance + site?: Site +} +export type InstanceId = number + +export interface InstanceWithFederationState { + id: InstanceId + domain: string + published: string + updated?: string + software?: string + version?: string + federation_state?: ReadableFederationState +} + +export interface Language { + id: LanguageId + code: string + name: string +} +export type LanguageId = number +export type LemmyErrorType = + | { + error: 'report_reason_required' + } + | { + error: 'report_too_long' + } + | { + error: 'not_a_moderator' + } + | { + error: 'not_an_admin' + } + | { + error: 'cant_block_yourself' + } + | { + error: 'cant_block_admin' + } + | { + error: 'couldnt_update_user' + } + | { + error: 'passwords_do_not_match' + } + | { + error: 'email_not_verified' + } + | { + error: 'email_required' + } + | { + error: 'couldnt_update_comment' + } + | { + error: 'couldnt_update_private_message' + } + | { + error: 'cannot_leave_admin' + } + | { + error: 'no_lines_in_html' + } + | { + error: 'site_metadata_page_is_not_doctype_html' + } + | { + error: 'pictrs_response_error' + message: string + } + | { + error: 'pictrs_purge_response_error' + message: string + } + | { + error: 'pictrs_caching_disabled' + } + | { + error: 'image_url_missing_path_segments' + } + | { + error: 'image_url_missing_last_path_segment' + } + | { + error: 'pictrs_api_key_not_provided' + } + | { + error: 'no_content_type_header' + } + | { + error: 'not_an_image_type' + } + | { + error: 'not_a_mod_or_admin' + } + | { + error: 'no_admins' + } + | { + error: 'not_top_admin' + } + | { + error: 'not_top_mod' + } + | { + error: 'not_logged_in' + } + | { + error: 'not_higher_mod' + } + | { + error: 'not_higher_admin' + } + | { + error: 'site_ban' + } + | { + error: 'deleted' + } + | { + error: 'banned_from_community' + } + | { + error: 'couldnt_find_community' + } + | { + error: 'couldnt_find_person' + } + | { + error: 'couldnt_find_comment' + } + | { + error: 'couldnt_find_comment_report' + } + | { + error: 'couldnt_find_post_report' + } + | { + error: 'couldnt_find_private_message_report' + } + | { + error: 'couldnt_find_local_user' + } + | { + error: 'couldnt_find_person_mention' + } + | { + error: 'couldnt_find_registration_application' + } + | { + error: 'couldnt_find_comment_reply' + } + | { + error: 'couldnt_find_private_message' + } + | { + error: 'couldnt_find_activity' + } + | { + error: 'person_is_blocked' + } + | { + error: 'community_is_blocked' + } + | { + error: 'instance_is_blocked' + } + | { + error: 'downvotes_are_disabled' + } + | { + error: 'instance_is_private' + } + | { + error: 'invalid_password' + } + | { + error: 'site_description_length_overflow' + } + | { + error: 'honeypot_failed' + } + | { + error: 'registration_application_is_pending' + } + | { + error: 'cant_enable_private_instance_and_federation_together' + } + | { + error: 'locked' + } + | { + error: 'couldnt_create_comment' + } + | { + error: 'max_comment_depth_reached' + } + | { + error: 'no_comment_edit_allowed' + } + | { + error: 'only_admins_can_create_communities' + } + | { + error: 'community_already_exists' + } + | { + error: 'language_not_allowed' + } + | { + error: 'only_mods_can_post_in_community' + } + | { + error: 'couldnt_update_post' + } + | { + error: 'no_post_edit_allowed' + } + | { + error: 'couldnt_find_post' + } + | { + error: 'edit_private_message_not_allowed' + } + | { + error: 'site_already_exists' + } + | { + error: 'application_question_required' + } + | { + error: 'invalid_default_post_listing_type' + } + | { + error: 'registration_closed' + } + | { + error: 'registration_application_answer_required' + } + | { + error: 'email_already_exists' + } + | { + error: 'federation_forbidden_by_strict_allow_list' + } + | { + error: 'person_is_banned_from_community' + } + | { + error: 'object_is_not_public' + } + | { + error: 'invalid_community' + } + | { + error: 'cannot_create_post_or_comment_in_deleted_or_removed_community' + } + | { + error: 'cannot_receive_page' + } + | { + error: 'new_post_cannot_be_locked' + } + | { + error: 'only_local_admin_can_remove_community' + } + | { + error: 'only_local_admin_can_restore_community' + } + | { + error: 'no_id_given' + } + | { + error: 'incorrect_login' + } + | { + error: 'invalid_query' + } + | { + error: 'object_not_local' + } + | { + error: 'post_is_locked' + } + | { + error: 'person_is_banned_from_site' + message: string + } + | { + error: 'invalid_vote_value' + } + | { + error: 'page_does_not_specify_creator' + } + | { + error: 'no_email_setup' + } + | { + error: 'local_site_not_setup' + } + | { + error: 'email_smtp_server_needs_a_port' + } + | { + error: 'missing_an_email' + } + | { + error: 'rate_limit_error' + } + | { + error: 'invalid_name' + } + | { + error: 'invalid_display_name' + } + | { + error: 'invalid_matrix_id' + } + | { + error: 'invalid_post_title' + } + | { + error: 'invalid_body_field' + } + | { + error: 'bio_length_overflow' + } + | { + error: 'alt_text_length_overflow' + } + | { + error: 'missing_totp_token' + } + | { + error: 'missing_totp_secret' + } + | { + error: 'incorrect_totp_token' + } + | { + error: 'couldnt_parse_totp_secret' + } + | { + error: 'couldnt_generate_totp' + } + | { + error: 'totp_already_enabled' + } + | { + error: 'couldnt_like_comment' + } + | { + error: 'couldnt_save_comment' + } + | { + error: 'couldnt_create_report' + } + | { + error: 'couldnt_resolve_report' + } + | { + error: 'community_moderator_already_exists' + } + | { + error: 'community_user_already_banned' + } + | { + error: 'community_block_already_exists' + } + | { + error: 'community_follower_already_exists' + } + | { + error: 'couldnt_update_community_hidden_status' + } + | { + error: 'person_block_already_exists' + } + | { + error: 'user_already_exists' + } + | { + error: 'token_not_found' + } + | { + error: 'couldnt_like_post' + } + | { + error: 'couldnt_save_post' + } + | { + error: 'couldnt_mark_post_as_read' + } + | { + error: 'couldnt_hide_post' + } + | { + error: 'couldnt_update_community' + } + | { + error: 'couldnt_update_replies' + } + | { + error: 'couldnt_update_person_mentions' + } + | { + error: 'post_title_too_long' + } + | { + error: 'couldnt_create_post' + } + | { + error: 'couldnt_create_private_message' + } + | { + error: 'couldnt_update_private' + } + | { + 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' + } + | { + error: 'invalid_url' + } + | { + error: 'email_send_failed' + } + | { + error: 'slurs' + } + | { + error: 'couldnt_find_object' + } + | { + error: 'registration_denied' + message: string | null + } + | { + error: 'federation_disabled' + } + | { + error: 'domain_blocked' + message: string + } + | { + error: 'domain_not_in_allow_list' + message: string + } + | { + error: 'federation_disabled_by_strict_allow_list' + } + | { + error: 'site_name_required' + } + | { + error: 'site_name_length_overflow' + } + | { + error: 'permissive_regex' + } + | { + error: 'invalid_regex' + } + | { + error: 'captcha_incorrect' + } + | { + error: 'couldnt_create_audio_captcha' + } + | { + error: 'invalid_url_scheme' + } + | { + error: 'couldnt_send_webmention' + } + | { + error: 'contradicting_filters' + } + | { + error: 'instance_block_already_exists' + } + | { + error: 'too_many_items' + } + | { + error: 'community_has_no_followers' + } + | { + error: 'ban_expiration_in_past' + } + | { + error: 'invalid_unix_time' + } + | { + error: 'invalid_bot_action' + } + | { + error: 'cant_block_local_instance' + } + | { + error: 'url_without_domain' + } + | { + error: 'inbox_timeout' + } + | { + error: 'unknown' + message: string + } + | { + error: 'cant_delete_site' + } + | { + error: 'url_length_overflow' + } +export interface LinkMetadata { + title?: string + description?: string + image?: string + embed_video_url?: string + content_type?: string +} + +export interface ListCommentLikes { + comment_id: CommentId + page?: number + limit?: number +} + +export interface ListCommentReports { + comment_id?: CommentId + page?: number + limit?: number + unresolved_only?: boolean + community_id?: CommunityId +} + +export interface ListCommunities { + type_?: ListingType + sort?: SortType + show_nsfw?: boolean + page?: number + limit?: number +} +export type ListingType = + | 'All' + | 'Local' + | 'Subscribed' + | 'ModeratorView' + | 'Popular' +export interface ListMedia { + page?: number + limit?: number +} + +export interface ListPostLikes { + post_id: PostId + page?: number + limit?: number +} + +export interface ListPostReports { + page?: number + limit?: number + unresolved_only?: boolean + community_id?: CommunityId + post_id?: PostId +} +export interface ListPrivateMessageReports { + page?: number + limit?: number + unresolved_only?: boolean +} +export interface ListRegistrationApplications { + unread_only?: boolean + page?: number + limit?: number +} + +export interface LocalImage { + local_user_id?: LocalUserId + pictrs_alias: string + pictrs_delete_token: string + published: string +} + +export interface LocalImageView { + local_image: LocalImage + person: Person +} + +export interface LocalSite { + id?: LocalSiteId + site_id?: SiteId + site_setup?: boolean + enable_downvotes?: boolean + enable_nsfw?: boolean + community_creation_admin_only?: boolean + require_email_verification?: boolean + application_question?: string + private_instance?: boolean + default_theme?: string + default_post_listing_type?: ListingType + legal_information?: string + hide_modlog_mod_names?: boolean + application_email_admins?: boolean + slur_filter_regex?: string + actor_name_max_length?: number + federation_enabled?: boolean + captcha_enabled?: boolean + captcha_difficulty?: string + published?: string + updated?: string + registration_mode?: RegistrationMode + reports_email_admins?: boolean + federation_signed_fetch?: boolean + default_post_listing_mode?: PostListingMode + default_sort_type?: SortType +} +export type LocalSiteId = number + +export interface LocalSiteRateLimit { + local_site_id: LocalSiteId + message: number + message_per_second: number + post: number + post_per_second: number + register: number + register_per_second: number + image: number + image_per_second: number + comment: number + comment_per_second: number + search: number + search_per_second: number + published: string + updated?: string +} +export interface LocalSiteUrlBlocklist { + id: number + url: string + published: string + updated?: string +} + +export interface LocalUser { + id: LocalUserId + person_id: PersonId + email?: string + show_nsfw: boolean + default_sort_type: SortType + default_listing_type: ListingType + interface_language?: string + show_avatars?: boolean + show_scores?: boolean + show_bot_accounts?: boolean + show_read_posts?: boolean + email_verified?: boolean + accepted_application?: boolean + totp_2fa_enabled: boolean + last_donation_notification?: string +} +export type LocalUserId = number + +export interface LocalUserView { + local_user: LocalUser + local_user_vote_display_mode?: LocalUserVoteDisplayMode + person: Person + counts: PersonAggregates +} + +export interface LocalUserVoteDisplayMode { + local_user_id: LocalUserId + score: boolean + upvotes: boolean + downvotes: boolean + upvote_percentage: boolean +} + +export interface LockPost { + post_id: PostId + locked: boolean +} +export interface Login { + username_or_email: string + password: string + totp_2fa_token?: string +} + +export interface LoginToken { + user_id: LocalUserId + published: string + ip?: string + user_agent?: string +} + +export interface MarkCommentReplyAsRead { + comment_reply_id: CommentReplyId + read: boolean +} + +export interface MarkPersonMentionAsRead { + person_mention_id: PersonMentionId + read: boolean +} + +export interface MarkPostAsRead { + post_ids: Array + read: boolean +} + +export interface MarkPrivateMessageAsRead { + private_message_id: PrivateMessageId + read: boolean +} + +export interface ModAdd { + id: number + mod_person_id: PersonId + other_person_id: PersonId + removed: boolean + when_: string +} + +export interface ModAddCommunity { + id: number + mod_person_id: PersonId + other_person_id: PersonId + community_id: CommunityId + removed: boolean + when_: string +} + +export interface ModAddCommunityView { + mod_add_community: ModAddCommunity + moderator?: Person + community: Community + modded_person: Person +} + +export interface ModAddView { + mod_add: ModAdd + moderator?: Person + modded_person: Person +} + +export interface ModBan { + id: number + mod_person_id: PersonId + other_person_id: PersonId + reason?: string + banned: boolean + expires?: string + when_: string +} + +export interface ModBanFromCommunity { + id: number + mod_person_id: PersonId + other_person_id: PersonId + community_id: CommunityId + reason?: string + banned: boolean + expires?: string + when_: string +} + +export interface ModBanFromCommunityView { + mod_ban_from_community: ModBanFromCommunity + moderator?: Person + community: Community + banned_person: Person +} + +export interface ModBanView { + mod_ban: ModBan + moderator?: Person + banned_person: Person +} + +export interface ModFeaturePost { + id: number + mod_person_id: PersonId + post_id: PostId + featured: boolean + when_: string + is_featured_community: boolean +} + +export interface ModFeaturePostView { + mod_feature_post: ModFeaturePost + moderator?: Person + post: Post + community: Community +} + +export interface ModHideCommunity { + id: number + community_id: CommunityId + mod_person_id: PersonId + when_: string + reason?: string + hidden: boolean +} + +export interface ModHideCommunityView { + mod_hide_community: ModHideCommunity + admin?: Person + community: Community +} + +export interface ModLockPost { + id: number + mod_person_id: PersonId + post_id: PostId + locked: boolean + when_: string +} + +export interface ModLockPostView { + mod_lock_post: ModLockPost + moderator?: Person + post: Post + community: Community +} +export type ModlogActionType = + | 'All' + | 'ModRemovePost' + | 'ModLockPost' + | 'ModFeaturePost' + | 'ModRemoveComment' + | 'ModRemoveCommunity' + | 'ModBanFromCommunity' + | 'ModAddCommunity' + | 'ModTransferCommunity' + | 'ModAdd' + | 'ModBan' + | 'ModHideCommunity' + | 'AdminPurgePerson' + | 'AdminPurgeCommunity' + | 'AdminPurgePost' + | 'AdminPurgeComment' + +export interface 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 +} + +export interface ModRemoveComment { + id: number + mod_person_id: PersonId + comment_id: CommentId + reason?: string + removed: boolean + when_: string +} + +export interface ModRemoveCommentView { + mod_remove_comment: ModRemoveComment + moderator?: Person + comment: Comment + commenter: Person + post: Post + community: Community +} + +export interface ModRemoveCommunity { + id: number + mod_person_id: PersonId + community_id: CommunityId + reason?: string + removed: boolean + when_: string +} + +export interface ModRemoveCommunityView { + mod_remove_community: ModRemoveCommunity + moderator?: Person + community: Community +} + +export interface ModRemovePost { + id: number + mod_person_id: PersonId + post_id: PostId + reason?: string + removed: boolean + when_: string +} + +export interface ModRemovePostView { + mod_remove_post: ModRemovePost + moderator?: Person + post: Post + community: Community +} + +export interface ModTransferCommunity { + id: number + mod_person_id: PersonId + other_person_id: PersonId + community_id: CommunityId + when_: string +} + +export interface ModTransferCommunityView { + mod_transfer_community: ModTransferCommunity + moderator?: Person + community: Community + modded_person: Person +} + +export interface MyUserInfo { + local_user_view: LocalUserView + follows: Array + moderates: Array + community_blocks: Array + instance_blocks: Array + person_blocks: Array + discussion_languages: Array +} +export interface OpenGraphData { + title?: string + description?: string + image?: string + embed_video_url?: string +} +export type PaginationCursor = string +export interface PasswordChangeAfterReset { + token: string + password: string + password_verify: string +} +export interface PasswordReset { + email: string +} + +export interface Person { + id: PersonId + name: string + display_name?: string + avatar?: string + banned: boolean + published: string + updated?: string + actor_id: string + bio?: string + local: boolean + banner?: string + deleted: boolean + matrix_user_id?: string + bot_account: boolean + ban_expires?: string + instance_id: InstanceId + flair?: string +} + +export interface PersonAggregates { + person_id: PersonId + post_count: number + comment_count: number +} + +export interface PersonBlockView { + person: Person + target: Person +} +export type PersonId = number + +export interface PersonMention { + id: PersonMentionId + recipient_id: PersonId + comment_id: CommentId + read: boolean + published: string +} +export type PersonMentionId = number + +export interface PersonMentionView { + person_mention: PersonMention + comment: Comment + creator: Person + post: Post + community: Community + recipient: Person + counts: CommentAggregates + creator_banned_from_community: boolean + banned_from_community: boolean + creator_is_moderator: boolean + creator_is_admin: boolean + subscribed: SubscribedType + saved: boolean + creator_blocked: boolean + my_vote?: number +} + +export interface PersonView { + person: Person + counts: PersonAggregates + is_admin: boolean +} + +export interface Post { + id: PostId + name: string + url?: string + body?: string + creator_id: PersonId + community_id: CommunityId + removed: boolean + locked: boolean + published: string + updated?: string + deleted: boolean + nsfw: boolean + embed_title?: string + embed_description?: string + thumbnail_url?: string + ap_id: string + local: boolean + embed_video_url?: string + language_id: LanguageId + featured_community: boolean + featured_local: boolean + url_content_type?: string + alt_text?: string +} + +export interface PostAggregates { + post_id: PostId + comments: number + score: number + upvotes: number + downvotes: number + published: string + newest_comment_time: string +} +export type PostFeatureType = 'Local' | 'Community' +export type PostId = number +export type PostListingMode = 'List' | 'Card' | 'SmallCard' + +export interface PostReport { + id: PostReportId + creator_id: PersonId + post_id: PostId + original_post_name: string + original_post_url?: string + original_post_body?: string + reason: string + resolved: boolean + resolver_id?: PersonId + published: string + updated?: string +} +export type PostReportId = number + +export interface PostReportView { + post_report: PostReport + post: Post + community: Community + creator: Person + post_creator: Person + creator_banned_from_community: boolean + creator_is_moderator: boolean + creator_is_admin: boolean + subscribed: SubscribedType + saved: boolean + read: boolean + hidden: boolean + creator_blocked: boolean + my_vote?: number + unread_comments: number + counts: PostAggregates + resolver?: Person +} + +export interface PostView { + post: Post + creator: Person + community: Community + image_details?: ImageDetails + creator_banned_from_community: boolean + banned_from_community: boolean + creator_is_moderator: boolean + creator_is_admin: boolean + counts: PostAggregates + subscribed: SubscribedType + saved: boolean + read: boolean + hidden: boolean + creator_blocked: boolean + my_vote?: number + unread_comments: number +} + +export interface PrivateMessage { + id: PrivateMessageId + creator_id: PersonId + recipient_id: PersonId + content: string + deleted: boolean + read: boolean + published: string + updated?: string + ap_id: string + local: boolean +} +export type PrivateMessageId = number + +export interface PrivateMessageReport { + id: PrivateMessageReportId + creator_id: PersonId + private_message_id: PrivateMessageId + original_pm_text: string + reason: string + resolved: boolean + resolver_id?: PersonId + published: string + updated?: string +} +export type PrivateMessageReportId = number + +export interface PrivateMessageReportView { + private_message_report: PrivateMessageReport + private_message: PrivateMessage + private_message_creator: Person + creator: Person + resolver?: Person +} + +export interface PrivateMessageView { + private_message: PrivateMessage + creator: Person + recipient: Person +} + +export interface PurgeComment { + comment_id: CommentId + reason?: string +} + +export interface PurgeCommunity { + community_id: CommunityId + reason?: string +} + +export interface PurgePerson { + person_id: PersonId + reason?: string +} + +export interface PurgePost { + post_id: PostId + reason?: string +} + +export interface ReadableFederationState { + instance_id: InstanceId + last_successful_id?: ActivityId + last_successful_published_time?: string + fail_count: number + last_retry?: string + next_retry?: string +} +export interface Register { + username: string + password: string + password_verify: string + show_nsfw?: boolean + email?: string + captcha_uuid?: string + captcha_answer?: string + honeypot?: string + answer?: string +} + +export interface RegistrationApplication { + id: RegistrationApplicationId + local_user_id: LocalUserId + answer: string + admin_id?: PersonId + deny_reason?: string + published: string +} +export type RegistrationApplicationId = number + +export interface RegistrationApplicationView { + registration_application: RegistrationApplication + creator_local_user: LocalUser + creator: Person + admin?: Person +} +export type RegistrationMode = 'Closed' | 'RequireApplication' | 'Open' + +export interface RemoveComment { + comment_id: CommentId + removed: boolean + reason?: string +} + +export interface RemoveCommunity { + community_id: CommunityId + removed: boolean + reason?: string +} + +export interface RemovePost { + post_id: PostId + removed: boolean + reason?: string +} + +export interface ResolveCommentReport { + report_id: CommentReportId + resolved: boolean +} +export interface ResolveObject { + q: string +} + +export interface ResolvePostReport { + report_id: PostReportId + resolved: boolean +} + +export interface ResolvePrivateMessageReport { + report_id: PrivateMessageReportId + resolved: boolean +} + +export interface SaveComment { + comment_id: CommentId + save: boolean +} + +export interface SavePost { + post_id: PostId + save: boolean +} + +export interface SaveUserSettings { + show_nsfw?: boolean + blur_nsfw?: boolean + auto_expand?: boolean + theme?: string + default_sort_type?: SortType + default_listing_type?: ListingType + interface_language?: string + avatar?: string + banner?: string + display_name?: string + email?: string + bio?: string + matrix_user_id?: string + show_avatars?: boolean + send_notifications_to_email?: boolean + bot_account?: boolean + show_bot_accounts?: boolean + show_read_posts?: boolean + discussion_languages?: Array + open_links_in_new_tab?: boolean + infinite_scroll_enabled?: boolean + post_listing_mode?: PostListingMode + enable_keyboard_navigation?: boolean + enable_animated_images?: boolean + collapse_bot_comments?: boolean + show_scores?: boolean + show_upvotes?: boolean + show_downvotes?: boolean + show_upvote_percentage?: boolean +} + +export interface Search { + q: string + community_id?: CommunityId + community_name?: string + creator_id?: PersonId + type_?: SearchType + sort?: SortType + listing_type?: ListingType + page?: number + limit?: number + post_title_only?: boolean +} +export type SearchType = + | 'All' + | 'Comments' + | 'Posts' + | 'Communities' + | 'Users' + | 'Url' + +export interface Site { + id?: SiteId + name: string + sidebar?: string + published?: string + updated?: string + icon?: string + banner?: string + description?: string + actor_id: string + last_refreshed_at?: string + inbox_url?: string + public_key?: string + instance_id?: InstanceId + content_warning?: string +} + +export interface SiteAggregates { + site_id: SiteId + users: number + posts: number + comments: number + communities: number + users_active_day: number + users_active_week: number + users_active_month: number + users_active_half_year: number +} +export type SiteId = number + +export interface SiteView { + site: Site + local_site: LocalSite + local_site_rate_limit?: LocalSiteRateLimit + counts: SiteAggregates +} +export type SortType = + | 'Active' + | 'Hot' + | 'New' + | 'Old' + | 'TopDay' + | 'TopWeek' + | 'TopMonth' + | 'TopYear' + | 'TopAll' + | 'MostComments' + | 'NewComments' + | 'TopHour' + | 'TopSixHour' + | 'TopTwelveHour' + | 'TopThreeMonths' + | 'TopSixMonths' + | 'TopNineMonths' + | 'Controversial' + | 'Scaled' +export type SubscribedType = 'Subscribed' | 'NotSubscribed' | 'Pending' + +export interface Tagline { + id: number + local_site_id: LocalSiteId + content: string + published: string + updated?: string +} + +export interface TransferCommunity { + community_id: CommunityId + person_id: PersonId +} +export interface UpdateTotp { + totp_token: string + enabled: boolean +} +export interface VerifyEmail { + token: string +} + +export interface VoteView { + creator: Person + creator_banned_from_community: boolean + score: number +} + +export interface UploadImage { + image: File | Buffer +} +export interface UploadImageResponse { + msg: string + files?: ImageFile[] + url?: string + delete_url?: string +} +export interface ImageFile { + file: string + delete_token: string +} +export interface DeleteImage { + token: string + filename: string +} + +export interface SetPersonFlair { + community_id: number + flair_text: string +} diff --git a/src/lib/components/lemmy/ObjectAutocomplete.svelte b/src/lib/components/lemmy/ObjectAutocomplete.svelte index 133ce007..d52deca3 100644 --- a/src/lib/components/lemmy/ObjectAutocomplete.svelte +++ b/src/lib/components/lemmy/ObjectAutocomplete.svelte @@ -1,7 +1,7 @@ + {#await community_view}
{:then community_view} + + setFlair = !setFlair} /> +