Merge remote-tracking branch 'origin/main' into release/v0.19

This commit is contained in:
Dessalines 2024-06-06 18:27:44 -04:00
commit 5b3c7ebcfa
76 changed files with 2723 additions and 2372 deletions

View file

@ -1,44 +0,0 @@
{
"root": true,
"env": {
"browser": true
},
"plugins": ["@typescript-eslint"],
"extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended"],
"parser": "@typescript-eslint/parser",
"ignorePatterns": ["putTypesInIndex.js"],
"parserOptions": {
"project": "./tsconfig.json",
"warnOnUnsupportedTypeScriptVersion": false
},
"rules": {
"@typescript-eslint/no-empty-interface": 0,
"@typescript-eslint/no-empty-function": 0,
"@typescript-eslint/ban-ts-comment": 0,
"@typescript-eslint/no-explicit-any": 0,
"@typescript-eslint/explicit-module-boundary-types": 0,
"arrow-body-style": 0,
"curly": 0,
"eol-last": 0,
"eqeqeq": 0,
"func-style": 0,
"import/no-duplicates": 0,
"max-statements": 0,
"max-params": 0,
"new-cap": 0,
"no-console": 0,
"no-duplicate-imports": 0,
"no-extra-parens": 0,
"no-return-assign": 0,
"no-throw-literal": 1,
"no-trailing-spaces": 0,
"no-unused-expressions": 0,
"no-useless-constructor": 0,
"no-useless-escape": 0,
"no-var": 0,
"prefer-const": 0,
"prefer-rest-params": 0,
"quote-props": 0,
"unicorn/filename-case": 0
}
}

View file

@ -1,4 +1 @@
#!/bin/sh pnpm lint-staged
. "$(dirname "$0")/_/husky.sh"
yarn lint-staged

View file

@ -1,20 +1,31 @@
pipeline: variables:
yarn: - &install_pnpm "corepack enable pnpm"
image: node:alpine
commands:
- yarn
yarn_lint: steps:
install:
image: node:alpine image: node:alpine
commands: commands:
- yarn lint - *install_pnpm
- pnpm i
when:
- event: pull_request
lint:
image: node:alpine
commands:
- *install_pnpm
- pnpm lint
when:
- event: pull_request
npm_publish: npm_publish:
image: node:alpine image: node:alpine
commands: commands:
- *install_pnpm
- pnpm i
- echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> .npmrc - echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> .npmrc
- echo "email = tyhou13@gmx.com" >> ~/.npmrc - echo "email = tyhou13@gmx.com" >> ~/.npmrc
- npm publish - npm publish
secrets: [npm_token] secrets: [npm_token]
when: when:
event: tag - event: tag

View file

@ -13,7 +13,7 @@ A javascript / typescript http client and type system for [Lemmy](https://github
## Installation ## Installation
`yarn add lemmy-js-client` `pnpm install lemmy-js-client`
## Usage ## Usage
@ -22,31 +22,34 @@ A javascript / typescript http client and type system for [Lemmy](https://github
[LemmyHttp docs](https://join-lemmy.org/api/classes/LemmyHttp.html) [LemmyHttp docs](https://join-lemmy.org/api/classes/LemmyHttp.html)
```ts ```ts
import { LemmyHttp, Login } from 'lemmy-js-client'; import { LemmyHttp, Login } from "lemmy-js-client";
let baseUrl = 'https://lemmy.ml'; // Build the client
let client: LemmyHttp = new LemmyHttp(baseUrl, headers?); const baseUrl = "https://lemmy.ml";
let loginForm: Login = { const client: LemmyHttp = new LemmyHttp(baseUrl);
// Build the login form
const loginForm: Login = {
username_or_email: "my_name", username_or_email: "my_name",
password: "my_pass", password: "my_pass",
}; };
let jwt = await client.login(loginForm).jwt;
// Login and set the client headers with your jwt
const { jwt } = await client.login(loginForm);
client.setHeaders({ Authorization: `Bearer ${jwt}` });
// Fetch top posts for the day
const getPostsForm: GetPosts = {
sort: "TopDay",
type_: "Local",
};
const posts = await client.getPosts(getPostsForm);
``` ```
## Development ## Development
You can use [yalc](https://github.com/wclr/yalc) to develop and test changes locally: Use `pnpm add` to develop and test changes locally:
``` ```
yarn global add yalc pnpm add path/to/lemmy-js-client
# Go to lemmy-js-client dir
yalc publish --push
# Go to your client dir
yalc add lemmy-js-client
# To do updates, go back to the lemmy-js-client dir
# This also updates it, in every dir you've added it.
yalc publish --push
``` ```

View file

@ -28,7 +28,7 @@ popd
rm src/types/Sensitive.ts rm src/types/Sensitive.ts
# Change all the bigints to numbers # Change all the bigints to numbers
find src/types -type f -name '*.ts' -exec sed -i 's/bigint/\/* integer *\/ number/g' {} + find src/types -type f -name '*.ts' -exec sed -i 's/bigint/number/g' {} +
node putTypesInIndex.js node putTypesInIndex.js

View file

@ -2,7 +2,7 @@
new_tag="$1" new_tag="$1"
yarn version --new-version $new_tag pnpm version $new_tag
git push git push
git tag $new_tag git tag $new_tag
git push origin $new_tag git push origin $new_tag

49
eslint.config.mjs Normal file
View file

@ -0,0 +1,49 @@
import pluginJs from "@eslint/js";
import tseslint from "typescript-eslint";
export default [
pluginJs.configs.recommended,
...tseslint.configs.recommended,
{
languageOptions: {
parser: tseslint.parser,
},
},
// For some reason this has to be in its own block
{
ignores: ["putTypesInIndex.js", "dist/*", "docs/*"],
},
{
files: ["src/**/*"],
rules: {
"@typescript-eslint/no-empty-interface": 0,
"@typescript-eslint/no-empty-function": 0,
"@typescript-eslint/ban-ts-comment": 0,
"@typescript-eslint/no-explicit-any": 0,
"@typescript-eslint/explicit-module-boundary-types": 0,
"arrow-body-style": 0,
curly: 0,
"eol-last": 0,
eqeqeq: 0,
"func-style": 0,
"import/no-duplicates": 0,
"max-statements": 0,
"max-params": 0,
"new-cap": 0,
"no-console": 0,
"no-duplicate-imports": 0,
"no-extra-parens": 0,
"no-return-assign": 0,
"no-throw-literal": 1,
"no-trailing-spaces": 0,
"no-unused-expressions": 0,
"no-useless-constructor": 0,
"no-useless-escape": 0,
"no-var": 0,
"prefer-const": 0,
"prefer-rest-params": 0,
"quote-props": 0,
"unicorn/filename-case": 0,
},
},
];

View file

@ -1,42 +1,50 @@
{ {
"name": "lemmy-js-client", "name": "lemmy-js-client",
"version": "0.19.2-alpha.3",
"description": "A javascript / typescript client for Lemmy", "description": "A javascript / typescript client for Lemmy",
"repository": "https://github.com/LemmyNet/lemmy-js-client", "version": "0.19.4",
"license": "AGPL-3.0",
"author": "Dessalines <tyhou13@gmx.com>", "author": "Dessalines <tyhou13@gmx.com>",
"license": "AGPL-3.0",
"main": "./dist/index.js", "main": "./dist/index.js",
"types": "./dist/index.d.ts", "files": [
"files": ["/dist"], "/dist"
],
"scripts": { "scripts": {
"build": "tsc", "build": "tsc",
"docs": "typedoc src/index.ts", "docs": "typedoc src/index.ts",
"lint": "tsc --noEmit && eslint --report-unused-disable-directives --ext .js,.ts,.tsx src && prettier --check src", "lint": "tsc --noEmit && eslint --report-unused-disable-directives && prettier --check src",
"prepare": "yarn run build && husky install" "prepare": "pnpm run build && husky"
}, },
"lint-staged": { "repository": {
"*.{ts,tsx,js}": ["prettier --write", "eslint --fix"], "type": "git",
"package.json": ["sortpack"] "url": "git+https://github.com/LemmyNet/lemmy-js-client.git"
},
"dependencies": {
"cross-fetch": "^3.1.5",
"form-data": "^4.0.0"
}, },
"devDependencies": { "devDependencies": {
"@types/node": "^20.10.0", "@types/node": "^20.11.19",
"@typescript-eslint/eslint-plugin": "^6.13.1", "@typescript-eslint/eslint-plugin": "^7.0.1",
"@typescript-eslint/parser": "^6.13.1", "@typescript-eslint/parser": "^7.0.1",
"eslint": "^8.54.0", "eslint": "^9.0.0",
"eslint-plugin-prettier": "^5.0.1", "eslint-plugin-prettier": "^5.1.3",
"husky": "^8.0.3", "husky": "^9.0.11",
"lint-staged": "^15.1.0", "lint-staged": "^15.2.2",
"prettier": "^3.1.0", "prettier": "^3.2.5",
"prettier-plugin-import-sort": "^0.0.7", "prettier-plugin-import-sort": "^0.0.7",
"prettier-plugin-organize-imports": "^3.2.4", "prettier-plugin-organize-imports": "^3.2.4",
"prettier-plugin-packagejson": "^2.4.6", "prettier-plugin-packagejson": "^2.4.11",
"sortpack": "^2.3.5", "sortpack": "^2.4.0",
"typedoc": "^0.24.7", "typedoc": "^0.25.8",
"typescript": "^5.3.2" "typescript": "^5.3.3",
"typescript-eslint": "^7.9.0"
},
"packageManager": "pnpm@9.1.4",
"types": "./dist/index.d.ts",
"lint-staged": {
"*.{ts,tsx,js}": [
"prettier --write",
"eslint --fix"
],
"package.json": [
"sortpack"
]
}, },
"importSort": { "importSort": {
".js, .jsx, .ts, .tsx": { ".js, .jsx, .ts, .tsx": {

2303
pnpm-lock.yaml Normal file

File diff suppressed because it is too large Load diff

5
renovate.json Normal file
View file

@ -0,0 +1,5 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": ["config:recommended"],
"schedule": ["before 4am on the first day of the month"]
}

View file

@ -1,5 +1,3 @@
import fetch from "cross-fetch";
import FormData from "form-data";
import { AddAdmin } from "./types/AddAdmin"; import { AddAdmin } from "./types/AddAdmin";
import { AddAdminResponse } from "./types/AddAdminResponse"; import { AddAdminResponse } from "./types/AddAdminResponse";
import { AddModToCommunity } from "./types/AddModToCommunity"; import { AddModToCommunity } from "./types/AddModToCommunity";
@ -138,6 +136,9 @@ import { ListPostLikes } from "./types/ListPostLikes";
import { ListPostLikesResponse } from "./types/ListPostLikesResponse"; import { ListPostLikesResponse } from "./types/ListPostLikesResponse";
import { ListCommentLikes } from "./types/ListCommentLikes"; import { ListCommentLikes } from "./types/ListCommentLikes";
import { ListCommentLikesResponse } from "./types/ListCommentLikesResponse"; import { ListCommentLikesResponse } from "./types/ListCommentLikesResponse";
import { HidePost } from "./types/HidePost";
import { ListMedia } from "./types/ListMedia";
import { ListMediaResponse } from "./types/ListMediaResponse";
enum HttpType { enum HttpType {
Get = "GET", Get = "GET",
@ -152,7 +153,7 @@ export class LemmyHttp {
#apiUrl: string; #apiUrl: string;
#headers: { [key: string]: string } = {}; #headers: { [key: string]: string } = {};
#pictrsUrl: string; #pictrsUrl: string;
#fetchFunction = fetch; #fetchFunction = fetch.bind(globalThis);
/** /**
* Generates a new instance of LemmyHttp. * Generates a new instance of LemmyHttp.
@ -289,6 +290,32 @@ export class LemmyHttp {
); );
} }
/**
* List all the media for your user
*
* `HTTP.GET /account/list_media`
*/
listMedia(form: ListMedia = {}) {
return this.#wrapper<ListMedia, ListMediaResponse>(
HttpType.Get,
"/account/list_media",
form,
);
}
/**
* List all the media known to your instance.
*
* `HTTP.GET /admin/list_all_media`
*/
listAllMedia(form: ListMedia = {}) {
return this.#wrapper<ListMedia, ListMediaResponse>(
HttpType.Get,
"/admin/list_all_media",
form,
);
}
/** /**
* Enable / Disable TOTP / two-factor authentication. * Enable / Disable TOTP / two-factor authentication.
* *
@ -567,6 +594,19 @@ export class LemmyHttp {
); );
} }
/**
* Hide a post from list views.
*
* `HTTP.POST /post/hide`
*/
hidePost(form: HidePost) {
return this.#wrapper<HidePost, SuccessResponse>(
HttpType.Post,
"/post/hide",
form,
);
}
/** /**
* A moderator can lock a post ( IE disable new comments ). * A moderator can lock a post ( IE disable new comments ).
* *
@ -622,7 +662,7 @@ export class LemmyHttp {
/** /**
* List a post's likes. Admin-only. * List a post's likes. Admin-only.
* *
* `HTTP.GET /post/like` * `HTTP.GET /post/like/list`
*/ */
listPostLikes(form: ListPostLikes) { listPostLikes(form: ListPostLikes) {
return this.#wrapper<ListPostLikes, ListPostLikesResponse>( return this.#wrapper<ListPostLikes, ListPostLikesResponse>(
@ -778,7 +818,7 @@ export class LemmyHttp {
/** /**
* List a comment's likes. Admin-only. * List a comment's likes. Admin-only.
* *
* `HTTP.GET //like` * `HTTP.GET /comment/like/list`
*/ */
listCommentLikes(form: ListCommentLikes) { listCommentLikes(form: ListCommentLikes) {
return this.#wrapper<ListCommentLikes, ListCommentLikesResponse>( return this.#wrapper<ListCommentLikes, ListCommentLikesResponse>(
@ -1006,6 +1046,11 @@ export class LemmyHttp {
); );
} }
/**
* Invalidate the currently used auth token.
*
* `HTTP.POST /user/logout`
*/
logout() { logout() {
return this.#wrapper<object, SuccessResponse>( return this.#wrapper<object, SuccessResponse>(
HttpType.Post, HttpType.Post,
@ -1502,7 +1547,7 @@ export class LemmyHttp {
function encodeGetParams<BodyType extends object>(p: BodyType): string { function encodeGetParams<BodyType extends object>(p: BodyType): string {
return Object.entries(p) return Object.entries(p)
.filter(kv => !!kv[1]) .filter(kv => kv[1] !== undefined && kv[1] !== null)
.map(kv => kv.map(encodeURIComponent).join("=")) .map(kv => kv.map(encodeURIComponent).join("="))
.join("&"); .join("&");
} }
@ -1510,11 +1555,15 @@ function encodeGetParams<BodyType extends object>(p: BodyType): string {
function createFormData(image: File | Buffer): FormData { function createFormData(image: File | Buffer): FormData {
let formData = new FormData(); let formData = new FormData();
if (image.constructor.name === "File") { if (image instanceof File) {
formData.append("images[]", image); formData.append("images[]", image);
} else { } else {
// The filename doesn't affect the file type or file name that ends up in pictrs // The filename doesn't affect the file type or file name that ends up in pictrs
formData.append("images[]", image, { filename: "image.jpg" }); formData.append(
"images[]",
new Blob([image], { type: "image/jpeg" }),
"image.jpg",
);
} }
return formData; return formData;

View file

@ -48,6 +48,7 @@ export { CommunityId } from "./types/CommunityId";
export { CommunityModeratorView } from "./types/CommunityModeratorView"; export { CommunityModeratorView } from "./types/CommunityModeratorView";
export { CommunityResponse } from "./types/CommunityResponse"; export { CommunityResponse } from "./types/CommunityResponse";
export { CommunityView } from "./types/CommunityView"; export { CommunityView } from "./types/CommunityView";
export { CommunityVisibility } from "./types/CommunityVisibility";
export { CreateComment } from "./types/CreateComment"; export { CreateComment } from "./types/CreateComment";
export { CreateCommentLike } from "./types/CreateCommentLike"; export { CreateCommentLike } from "./types/CreateCommentLike";
export { CreateCommentReport } from "./types/CreateCommentReport"; export { CreateCommentReport } from "./types/CreateCommentReport";
@ -109,7 +110,7 @@ export { GetSiteResponse } from "./types/GetSiteResponse";
export { GetUnreadCountResponse } from "./types/GetUnreadCountResponse"; export { GetUnreadCountResponse } from "./types/GetUnreadCountResponse";
export { GetUnreadRegistrationApplicationCountResponse } from "./types/GetUnreadRegistrationApplicationCountResponse"; export { GetUnreadRegistrationApplicationCountResponse } from "./types/GetUnreadRegistrationApplicationCountResponse";
export { HideCommunity } from "./types/HideCommunity"; export { HideCommunity } from "./types/HideCommunity";
export { ImageUpload } from "./types/ImageUpload"; export { HidePost } from "./types/HidePost";
export { Instance } from "./types/Instance"; export { Instance } from "./types/Instance";
export { InstanceBlockView } from "./types/InstanceBlockView"; export { InstanceBlockView } from "./types/InstanceBlockView";
export { InstanceId } from "./types/InstanceId"; export { InstanceId } from "./types/InstanceId";
@ -117,12 +118,15 @@ export { InstanceWithFederationState } from "./types/InstanceWithFederationState
export { Language } from "./types/Language"; export { Language } from "./types/Language";
export { LanguageId } from "./types/LanguageId"; export { LanguageId } from "./types/LanguageId";
export { LemmyErrorType } from "./types/LemmyErrorType"; export { LemmyErrorType } from "./types/LemmyErrorType";
export { LinkMetadata } from "./types/LinkMetadata";
export { ListCommentLikes } from "./types/ListCommentLikes"; export { ListCommentLikes } from "./types/ListCommentLikes";
export { ListCommentLikesResponse } from "./types/ListCommentLikesResponse"; export { ListCommentLikesResponse } from "./types/ListCommentLikesResponse";
export { ListCommentReports } from "./types/ListCommentReports"; export { ListCommentReports } from "./types/ListCommentReports";
export { ListCommentReportsResponse } from "./types/ListCommentReportsResponse"; export { ListCommentReportsResponse } from "./types/ListCommentReportsResponse";
export { ListCommunities } from "./types/ListCommunities"; export { ListCommunities } from "./types/ListCommunities";
export { ListCommunitiesResponse } from "./types/ListCommunitiesResponse"; export { ListCommunitiesResponse } from "./types/ListCommunitiesResponse";
export { ListMedia } from "./types/ListMedia";
export { ListMediaResponse } from "./types/ListMediaResponse";
export { ListPostLikes } from "./types/ListPostLikes"; export { ListPostLikes } from "./types/ListPostLikes";
export { ListPostLikesResponse } from "./types/ListPostLikesResponse"; export { ListPostLikesResponse } from "./types/ListPostLikesResponse";
export { ListPostReports } from "./types/ListPostReports"; export { ListPostReports } from "./types/ListPostReports";
@ -132,12 +136,16 @@ export { ListPrivateMessageReportsResponse } from "./types/ListPrivateMessageRep
export { ListRegistrationApplications } from "./types/ListRegistrationApplications"; export { ListRegistrationApplications } from "./types/ListRegistrationApplications";
export { ListRegistrationApplicationsResponse } from "./types/ListRegistrationApplicationsResponse"; export { ListRegistrationApplicationsResponse } from "./types/ListRegistrationApplicationsResponse";
export { ListingType } from "./types/ListingType"; export { ListingType } from "./types/ListingType";
export { LocalImage } from "./types/LocalImage";
export { LocalImageView } from "./types/LocalImageView";
export { LocalSite } from "./types/LocalSite"; export { LocalSite } from "./types/LocalSite";
export { LocalSiteId } from "./types/LocalSiteId"; export { LocalSiteId } from "./types/LocalSiteId";
export { LocalSiteRateLimit } from "./types/LocalSiteRateLimit"; export { LocalSiteRateLimit } from "./types/LocalSiteRateLimit";
export { LocalSiteUrlBlocklist } from "./types/LocalSiteUrlBlocklist";
export { LocalUser } from "./types/LocalUser"; export { LocalUser } from "./types/LocalUser";
export { LocalUserId } from "./types/LocalUserId"; export { LocalUserId } from "./types/LocalUserId";
export { LocalUserView } from "./types/LocalUserView"; export { LocalUserView } from "./types/LocalUserView";
export { LocalUserVoteDisplayMode } from "./types/LocalUserVoteDisplayMode";
export { LockPost } from "./types/LockPost"; export { LockPost } from "./types/LockPost";
export { Login } from "./types/Login"; export { Login } from "./types/Login";
export { LoginResponse } from "./types/LoginResponse"; export { LoginResponse } from "./types/LoginResponse";
@ -171,6 +179,7 @@ export { ModTransferCommunityView } from "./types/ModTransferCommunityView";
export { ModlogActionType } from "./types/ModlogActionType"; export { ModlogActionType } from "./types/ModlogActionType";
export { ModlogListParams } from "./types/ModlogListParams"; export { ModlogListParams } from "./types/ModlogListParams";
export { MyUserInfo } from "./types/MyUserInfo"; export { MyUserInfo } from "./types/MyUserInfo";
export { OpenGraphData } from "./types/OpenGraphData";
export { PaginationCursor } from "./types/PaginationCursor"; export { PaginationCursor } from "./types/PaginationCursor";
export { PasswordChangeAfterReset } from "./types/PasswordChangeAfterReset"; export { PasswordChangeAfterReset } from "./types/PasswordChangeAfterReset";
export { PasswordReset } from "./types/PasswordReset"; export { PasswordReset } from "./types/PasswordReset";
@ -231,7 +240,6 @@ export { SearchType } from "./types/SearchType";
export { Site } from "./types/Site"; export { Site } from "./types/Site";
export { SiteAggregates } from "./types/SiteAggregates"; export { SiteAggregates } from "./types/SiteAggregates";
export { SiteId } from "./types/SiteId"; export { SiteId } from "./types/SiteId";
export { SiteMetadata } from "./types/SiteMetadata";
export { SiteResponse } from "./types/SiteResponse"; export { SiteResponse } from "./types/SiteResponse";
export { SiteView } from "./types/SiteView"; export { SiteView } from "./types/SiteView";
export { SortType } from "./types/SortType"; export { SortType } from "./types/SortType";

View file

@ -1,3 +1,3 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
export type ActivityId = /* integer */ number; export type ActivityId = number;

View file

@ -8,5 +8,5 @@ export interface BanFromCommunity {
ban: boolean; ban: boolean;
remove_data?: boolean; remove_data?: boolean;
reason?: string; reason?: string;
expires?: /* integer */ number; expires?: number;
} }

View file

@ -6,5 +6,5 @@ export interface BanPerson {
ban: boolean; ban: boolean;
remove_data?: boolean; remove_data?: boolean;
reason?: string; reason?: string;
expires?: /* integer */ number; expires?: number;
} }

View file

@ -3,9 +3,9 @@ import type { CommentId } from "./CommentId";
export interface CommentAggregates { export interface CommentAggregates {
comment_id: CommentId; comment_id: CommentId;
score: /* integer */ number; score: number;
upvotes: /* integer */ number; upvotes: number;
downvotes: /* integer */ number; downvotes: number;
published: string; published: string;
child_count: number; child_count: number;
} }

View file

@ -16,6 +16,7 @@ export interface CommentReplyView {
recipient: Person; recipient: Person;
counts: CommentAggregates; counts: CommentAggregates;
creator_banned_from_community: boolean; creator_banned_from_community: boolean;
banned_from_community: boolean;
creator_is_moderator: boolean; creator_is_moderator: boolean;
creator_is_admin: boolean; creator_is_admin: boolean;
subscribed: SubscribedType; subscribed: SubscribedType;

View file

@ -5,6 +5,7 @@ import type { CommentReport } from "./CommentReport";
import type { Community } from "./Community"; import type { Community } from "./Community";
import type { Person } from "./Person"; import type { Person } from "./Person";
import type { Post } from "./Post"; import type { Post } from "./Post";
import type { SubscribedType } from "./SubscribedType";
export interface CommentReportView { export interface CommentReportView {
comment_report: CommentReport; comment_report: CommentReport;
@ -15,6 +16,11 @@ export interface CommentReportView {
comment_creator: Person; comment_creator: Person;
counts: CommentAggregates; counts: CommentAggregates;
creator_banned_from_community: boolean; creator_banned_from_community: boolean;
creator_is_moderator: boolean;
creator_is_admin: boolean;
creator_blocked: boolean;
subscribed: SubscribedType;
saved: boolean;
my_vote?: number; my_vote?: number;
resolver?: Person; resolver?: Person;
} }

View file

@ -13,6 +13,7 @@ export interface CommentView {
community: Community; community: Community;
counts: CommentAggregates; counts: CommentAggregates;
creator_banned_from_community: boolean; creator_banned_from_community: boolean;
banned_from_community: boolean;
creator_is_moderator: boolean; creator_is_moderator: boolean;
creator_is_admin: boolean; creator_is_admin: boolean;
subscribed: SubscribedType; subscribed: SubscribedType;

View file

@ -1,5 +1,6 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { CommunityId } from "./CommunityId"; import type { CommunityId } from "./CommunityId";
import type { CommunityVisibility } from "./CommunityVisibility";
import type { InstanceId } from "./InstanceId"; import type { InstanceId } from "./InstanceId";
export interface Community { export interface Community {
@ -19,4 +20,5 @@ export interface Community {
hidden: boolean; hidden: boolean;
posting_restricted_to_mods: boolean; posting_restricted_to_mods: boolean;
instance_id: InstanceId; instance_id: InstanceId;
visibility: CommunityVisibility;
} }

View file

@ -3,13 +3,13 @@ import type { CommunityId } from "./CommunityId";
export interface CommunityAggregates { export interface CommunityAggregates {
community_id: CommunityId; community_id: CommunityId;
subscribers: /* integer */ number; subscribers: number;
posts: /* integer */ number; posts: number;
comments: /* integer */ number; comments: number;
published: string; published: string;
users_active_day: /* integer */ number; users_active_day: number;
users_active_week: /* integer */ number; users_active_week: number;
users_active_month: /* integer */ number; users_active_month: number;
users_active_half_year: /* integer */ number; users_active_half_year: number;
subscribers_local: /* integer */ number; subscribers_local: number;
} }

View file

@ -8,4 +8,5 @@ export interface CommunityView {
subscribed: SubscribedType; subscribed: SubscribedType;
blocked: boolean; blocked: boolean;
counts: CommunityAggregates; counts: CommunityAggregates;
banned_from_community: boolean;
} }

View file

@ -0,0 +1,3 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
export type CommunityVisibility = "Public" | "LocalOnly";

View file

@ -1,4 +1,5 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { CommunityVisibility } from "./CommunityVisibility";
import type { LanguageId } from "./LanguageId"; import type { LanguageId } from "./LanguageId";
export interface CreateCommunity { export interface CreateCommunity {
@ -10,5 +11,5 @@ export interface CreateCommunity {
nsfw?: boolean; nsfw?: boolean;
posting_restricted_to_mods?: boolean; posting_restricted_to_mods?: boolean;
discussion_languages?: Array<LanguageId>; discussion_languages?: Array<LanguageId>;
local_only?: boolean; visibility?: CommunityVisibility;
} }

View file

@ -7,7 +7,9 @@ export interface CreatePost {
community_id: CommunityId; community_id: CommunityId;
url?: string; url?: string;
body?: string; body?: string;
alt_text?: string;
honeypot?: string; honeypot?: string;
nsfw?: boolean; nsfw?: boolean;
language_id?: LanguageId; language_id?: LanguageId;
custom_thumbnail?: string;
} }

View file

@ -1,7 +1,9 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { LanguageId } from "./LanguageId"; import type { LanguageId } from "./LanguageId";
import type { ListingType } from "./ListingType"; import type { ListingType } from "./ListingType";
import type { PostListingMode } from "./PostListingMode";
import type { RegistrationMode } from "./RegistrationMode"; import type { RegistrationMode } from "./RegistrationMode";
import type { SortType } from "./SortType";
export interface CreateSite { export interface CreateSite {
name: string; name: string;
@ -17,6 +19,7 @@ export interface CreateSite {
private_instance?: boolean; private_instance?: boolean;
default_theme?: string; default_theme?: string;
default_post_listing_type?: ListingType; default_post_listing_type?: ListingType;
default_sort_type?: SortType;
legal_information?: string; legal_information?: string;
application_email_admins?: boolean; application_email_admins?: boolean;
hide_modlog_mod_names?: boolean; hide_modlog_mod_names?: boolean;
@ -43,4 +46,6 @@ export interface CreateSite {
blocked_instances?: Array<string>; blocked_instances?: Array<string>;
taglines?: Array<string>; taglines?: Array<string>;
registration_mode?: RegistrationMode; registration_mode?: RegistrationMode;
content_warning?: string;
default_post_listing_mode?: PostListingMode;
} }

View file

@ -1,5 +1,6 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { CommunityId } from "./CommunityId"; import type { CommunityId } from "./CommunityId";
import type { CommunityVisibility } from "./CommunityVisibility";
import type { LanguageId } from "./LanguageId"; import type { LanguageId } from "./LanguageId";
export interface EditCommunity { export interface EditCommunity {
@ -11,5 +12,5 @@ export interface EditCommunity {
nsfw?: boolean; nsfw?: boolean;
posting_restricted_to_mods?: boolean; posting_restricted_to_mods?: boolean;
discussion_languages?: Array<LanguageId>; discussion_languages?: Array<LanguageId>;
local_only?: boolean; visibility?: CommunityVisibility;
} }

View file

@ -7,6 +7,8 @@ export interface EditPost {
name?: string; name?: string;
url?: string; url?: string;
body?: string; body?: string;
alt_text?: string;
nsfw?: boolean; nsfw?: boolean;
language_id?: LanguageId; language_id?: LanguageId;
custom_thumbnail?: string;
} }

View file

@ -1,7 +1,9 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { LanguageId } from "./LanguageId"; import type { LanguageId } from "./LanguageId";
import type { ListingType } from "./ListingType"; import type { ListingType } from "./ListingType";
import type { PostListingMode } from "./PostListingMode";
import type { RegistrationMode } from "./RegistrationMode"; import type { RegistrationMode } from "./RegistrationMode";
import type { SortType } from "./SortType";
export interface EditSite { export interface EditSite {
name?: string; name?: string;
@ -17,6 +19,7 @@ export interface EditSite {
private_instance?: boolean; private_instance?: boolean;
default_theme?: string; default_theme?: string;
default_post_listing_type?: ListingType; default_post_listing_type?: ListingType;
default_sort_type?: SortType;
legal_information?: string; legal_information?: string;
application_email_admins?: boolean; application_email_admins?: boolean;
hide_modlog_mod_names?: boolean; hide_modlog_mod_names?: boolean;
@ -41,7 +44,10 @@ export interface EditSite {
captcha_difficulty?: string; captcha_difficulty?: string;
allowed_instances?: Array<string>; allowed_instances?: Array<string>;
blocked_instances?: Array<string>; blocked_instances?: Array<string>;
blocked_urls?: Array<string>;
taglines?: Array<string>; taglines?: Array<string>;
registration_mode?: RegistrationMode; registration_mode?: RegistrationMode;
reports_email_admins?: boolean; reports_email_admins?: boolean;
content_warning?: string;
default_post_listing_mode?: PostListingMode;
} }

View file

@ -9,8 +9,8 @@ export interface GetComments {
type_?: ListingType; type_?: ListingType;
sort?: CommentSortType; sort?: CommentSortType;
max_depth?: number; max_depth?: number;
page?: /* integer */ number; page?: number;
limit?: /* integer */ number; limit?: number;
community_id?: CommunityId; community_id?: CommunityId;
community_name?: string; community_name?: string;
post_id?: PostId; post_id?: PostId;

View file

@ -1,13 +1,17 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { CommentId } from "./CommentId";
import type { CommunityId } from "./CommunityId"; import type { CommunityId } from "./CommunityId";
import type { ModlogActionType } from "./ModlogActionType"; import type { ModlogActionType } from "./ModlogActionType";
import type { PersonId } from "./PersonId"; import type { PersonId } from "./PersonId";
import type { PostId } from "./PostId";
export interface GetModlog { export interface GetModlog {
mod_person_id?: PersonId; mod_person_id?: PersonId;
community_id?: CommunityId; community_id?: CommunityId;
page?: /* integer */ number; page?: number;
limit?: /* integer */ number; limit?: number;
type_?: ModlogActionType; type_?: ModlogActionType;
other_person_id?: PersonId; other_person_id?: PersonId;
post_id?: PostId;
comment_id?: CommentId;
} }

View file

@ -7,8 +7,8 @@ export interface GetPersonDetails {
person_id?: PersonId; person_id?: PersonId;
username?: string; username?: string;
sort?: SortType; sort?: SortType;
page?: /* integer */ number; page?: number;
limit?: /* integer */ number; limit?: number;
community_id?: CommunityId; community_id?: CommunityId;
saved_only?: boolean; saved_only?: boolean;
} }

View file

@ -3,9 +3,11 @@ import type { CommentView } from "./CommentView";
import type { CommunityModeratorView } from "./CommunityModeratorView"; import type { CommunityModeratorView } from "./CommunityModeratorView";
import type { PersonView } from "./PersonView"; import type { PersonView } from "./PersonView";
import type { PostView } from "./PostView"; import type { PostView } from "./PostView";
import type { Site } from "./Site";
export interface GetPersonDetailsResponse { export interface GetPersonDetailsResponse {
person_view: PersonView; person_view: PersonView;
site?: Site;
comments: Array<CommentView>; comments: Array<CommentView>;
posts: Array<PostView>; posts: Array<PostView>;
moderates: Array<CommunityModeratorView>; moderates: Array<CommunityModeratorView>;

View file

@ -3,7 +3,7 @@ import type { CommentSortType } from "./CommentSortType";
export interface GetPersonMentions { export interface GetPersonMentions {
sort?: CommentSortType; sort?: CommentSortType;
page?: /* integer */ number; page?: number;
limit?: /* integer */ number; limit?: number;
unread_only?: boolean; unread_only?: boolean;
} }

View file

@ -7,12 +7,13 @@ import type { SortType } from "./SortType";
export interface GetPosts { export interface GetPosts {
type_?: ListingType; type_?: ListingType;
sort?: SortType; sort?: SortType;
page?: /* integer */ number; page?: number;
limit?: /* integer */ number; limit?: number;
community_id?: CommunityId; community_id?: CommunityId;
community_name?: string; community_name?: string;
saved_only?: boolean; saved_only?: boolean;
liked_only?: boolean; liked_only?: boolean;
disliked_only?: boolean; disliked_only?: boolean;
show_hidden?: boolean;
page_cursor?: PaginationCursor; page_cursor?: PaginationCursor;
} }

View file

@ -3,7 +3,7 @@ import type { PersonId } from "./PersonId";
export interface GetPrivateMessages { export interface GetPrivateMessages {
unread_only?: boolean; unread_only?: boolean;
page?: /* integer */ number; page?: number;
limit?: /* integer */ number; limit?: number;
creator_id?: PersonId; creator_id?: PersonId;
} }

View file

@ -3,7 +3,7 @@ import type { CommentSortType } from "./CommentSortType";
export interface GetReplies { export interface GetReplies {
sort?: CommentSortType; sort?: CommentSortType;
page?: /* integer */ number; page?: number;
limit?: /* integer */ number; limit?: number;
unread_only?: boolean; unread_only?: boolean;
} }

View file

@ -3,7 +3,7 @@ import type { CommunityId } from "./CommunityId";
export interface GetReportCountResponse { export interface GetReportCountResponse {
community_id?: CommunityId; community_id?: CommunityId;
comment_reports: /* integer */ number; comment_reports: number;
post_reports: /* integer */ number; post_reports: number;
private_message_reports?: /* integer */ number; private_message_reports?: number;
} }

View file

@ -1,6 +1,6 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { SiteMetadata } from "./SiteMetadata"; import type { LinkMetadata } from "./LinkMetadata";
export interface GetSiteMetadataResponse { export interface GetSiteMetadataResponse {
metadata: SiteMetadata; metadata: LinkMetadata;
} }

View file

@ -2,6 +2,7 @@
import type { CustomEmojiView } from "./CustomEmojiView"; import type { CustomEmojiView } from "./CustomEmojiView";
import type { Language } from "./Language"; import type { Language } from "./Language";
import type { LanguageId } from "./LanguageId"; import type { LanguageId } from "./LanguageId";
import type { LocalSiteUrlBlocklist } from "./LocalSiteUrlBlocklist";
import type { MyUserInfo } from "./MyUserInfo"; import type { MyUserInfo } from "./MyUserInfo";
import type { PersonView } from "./PersonView"; import type { PersonView } from "./PersonView";
import type { SiteView } from "./SiteView"; import type { SiteView } from "./SiteView";
@ -16,4 +17,5 @@ export interface GetSiteResponse {
discussion_languages: Array<LanguageId>; discussion_languages: Array<LanguageId>;
taglines: Array<Tagline>; taglines: Array<Tagline>;
custom_emojis: Array<CustomEmojiView>; custom_emojis: Array<CustomEmojiView>;
blocked_urls: Array<LocalSiteUrlBlocklist>;
} }

View file

@ -1,7 +1,7 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
export interface GetUnreadCountResponse { export interface GetUnreadCountResponse {
replies: /* integer */ number; replies: number;
mentions: /* integer */ number; mentions: number;
private_messages: /* integer */ number; private_messages: number;
} }

View file

@ -1,5 +1,5 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
export interface GetUnreadRegistrationApplicationCountResponse { export interface GetUnreadRegistrationApplicationCountResponse {
registration_applications: /* integer */ number; registration_applications: number;
} }

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

@ -0,0 +1,7 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { PostId } from "./PostId";
export interface HidePost {
post_ids: Array<PostId>;
hide: boolean;
}

View file

@ -34,6 +34,16 @@ export type LemmyErrorType =
| { error: "banned_from_community" } | { error: "banned_from_community" }
| { error: "couldnt_find_community" } | { error: "couldnt_find_community" }
| { error: "couldnt_find_person" } | { 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: "person_is_blocked" }
| { error: "community_is_blocked" } | { error: "community_is_blocked" }
| { error: "instance_is_blocked" } | { error: "instance_is_blocked" }
@ -79,9 +89,8 @@ export type LemmyErrorType =
| { error: "person_is_banned_from_site"; message: string } | { error: "person_is_banned_from_site"; message: string }
| { error: "invalid_vote_value" } | { error: "invalid_vote_value" }
| { error: "page_does_not_specify_creator" } | { error: "page_does_not_specify_creator" }
| { error: "page_does_not_specify_group" }
| { error: "no_community_found_in_cc" }
| { error: "no_email_setup" } | { error: "no_email_setup" }
| { error: "local_site_not_setup" }
| { error: "email_smtp_server_needs_a_port" } | { error: "email_smtp_server_needs_a_port" }
| { error: "missing_an_email" } | { error: "missing_an_email" }
| { error: "rate_limit_error" } | { error: "rate_limit_error" }
@ -91,6 +100,7 @@ export type LemmyErrorType =
| { error: "invalid_post_title" } | { error: "invalid_post_title" }
| { error: "invalid_body_field" } | { error: "invalid_body_field" }
| { error: "bio_length_overflow" } | { error: "bio_length_overflow" }
| { error: "alt_text_length_overflow" }
| { error: "missing_totp_token" } | { error: "missing_totp_token" }
| { error: "missing_totp_secret" } | { error: "missing_totp_secret" }
| { error: "incorrect_totp_token" } | { error: "incorrect_totp_token" }
@ -112,6 +122,7 @@ export type LemmyErrorType =
| { error: "couldnt_like_post" } | { error: "couldnt_like_post" }
| { error: "couldnt_save_post" } | { error: "couldnt_save_post" }
| { error: "couldnt_mark_post_as_read" } | { error: "couldnt_mark_post_as_read" }
| { error: "couldnt_hide_post" }
| { error: "couldnt_update_community" } | { error: "couldnt_update_community" }
| { error: "couldnt_update_replies" } | { error: "couldnt_update_replies" }
| { error: "couldnt_update_person_mentions" } | { error: "couldnt_update_person_mentions" }
@ -123,6 +134,7 @@ export type LemmyErrorType =
| { error: "couldnt_set_all_registrations_accepted" } | { error: "couldnt_set_all_registrations_accepted" }
| { error: "couldnt_set_all_email_verified" } | { error: "couldnt_set_all_email_verified" }
| { error: "banned" } | { error: "banned" }
| { error: "blocked_url" }
| { error: "couldnt_get_comments" } | { error: "couldnt_get_comments" }
| { error: "couldnt_get_posts" } | { error: "couldnt_get_posts" }
| { error: "invalid_url" } | { error: "invalid_url" }
@ -139,7 +151,6 @@ export type LemmyErrorType =
| { error: "permissive_regex" } | { error: "permissive_regex" }
| { error: "invalid_regex" } | { error: "invalid_regex" }
| { error: "captcha_incorrect" } | { error: "captcha_incorrect" }
| { error: "password_reset_limit_reached" }
| { error: "couldnt_create_audio_captcha" } | { error: "couldnt_create_audio_captcha" }
| { error: "invalid_url_scheme" } | { error: "invalid_url_scheme" }
| { error: "couldnt_send_webmention" } | { error: "couldnt_send_webmention" }
@ -151,4 +162,6 @@ export type LemmyErrorType =
| { error: "invalid_unix_time" } | { error: "invalid_unix_time" }
| { error: "invalid_bot_action" } | { error: "invalid_bot_action" }
| { error: "cant_block_local_instance" } | { error: "cant_block_local_instance" }
| { error: "url_without_domain" }
| { error: "inbox_timeout" }
| { error: "unknown"; message: string }; | { error: "unknown"; message: string };

View file

@ -0,0 +1,9 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
export interface LinkMetadata {
title?: string;
description?: string;
image?: string;
embed_video_url?: string;
content_type?: string;
}

View file

@ -3,6 +3,6 @@ import type { CommentId } from "./CommentId";
export interface ListCommentLikes { export interface ListCommentLikes {
comment_id: CommentId; comment_id: CommentId;
page?: /* integer */ number; page?: number;
limit?: /* integer */ number; limit?: number;
} }

View file

@ -1,9 +1,11 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { CommentId } from "./CommentId";
import type { CommunityId } from "./CommunityId"; import type { CommunityId } from "./CommunityId";
export interface ListCommentReports { export interface ListCommentReports {
page?: /* integer */ number; comment_id?: CommentId;
limit?: /* integer */ number; page?: number;
limit?: number;
unresolved_only?: boolean; unresolved_only?: boolean;
community_id?: CommunityId; community_id?: CommunityId;
} }

View file

@ -6,6 +6,6 @@ export interface ListCommunities {
type_?: ListingType; type_?: ListingType;
sort?: SortType; sort?: SortType;
show_nsfw?: boolean; show_nsfw?: boolean;
page?: /* integer */ number; page?: number;
limit?: /* integer */ number; limit?: number;
} }

6
src/types/ListMedia.ts Normal file
View file

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

View file

@ -0,0 +1,6 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { LocalImageView } from "./LocalImageView";
export interface ListMediaResponse {
images: Array<LocalImageView>;
}

View file

@ -3,6 +3,6 @@ import type { PostId } from "./PostId";
export interface ListPostLikes { export interface ListPostLikes {
post_id: PostId; post_id: PostId;
page?: /* integer */ number; page?: number;
limit?: /* integer */ number; limit?: number;
} }

View file

@ -1,9 +1,11 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { CommunityId } from "./CommunityId"; import type { CommunityId } from "./CommunityId";
import type { PostId } from "./PostId";
export interface ListPostReports { export interface ListPostReports {
page?: /* integer */ number; page?: number;
limit?: /* integer */ number; limit?: number;
unresolved_only?: boolean; unresolved_only?: boolean;
community_id?: CommunityId; community_id?: CommunityId;
post_id?: PostId;
} }

View file

@ -1,7 +1,7 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
export interface ListPrivateMessageReports { export interface ListPrivateMessageReports {
page?: /* integer */ number; page?: number;
limit?: /* integer */ number; limit?: number;
unresolved_only?: boolean; unresolved_only?: boolean;
} }

View file

@ -2,6 +2,6 @@
export interface ListRegistrationApplications { export interface ListRegistrationApplications {
unread_only?: boolean; unread_only?: boolean;
page?: /* integer */ number; page?: number;
limit?: /* integer */ number; limit?: number;
} }

View file

@ -1,8 +1,8 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { LocalUserId } from "./LocalUserId"; import type { LocalUserId } from "./LocalUserId";
export interface ImageUpload { export interface LocalImage {
local_user_id: LocalUserId; local_user_id?: LocalUserId;
pictrs_alias: string; pictrs_alias: string;
pictrs_delete_token: string; pictrs_delete_token: string;
published: string; published: string;

View file

@ -0,0 +1,8 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { LocalImage } from "./LocalImage";
import type { Person } from "./Person";
export interface LocalImageView {
local_image: LocalImage;
person: Person;
}

View file

@ -1,8 +1,10 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { ListingType } from "./ListingType"; import type { ListingType } from "./ListingType";
import type { LocalSiteId } from "./LocalSiteId"; import type { LocalSiteId } from "./LocalSiteId";
import type { PostListingMode } from "./PostListingMode";
import type { RegistrationMode } from "./RegistrationMode"; import type { RegistrationMode } from "./RegistrationMode";
import type { SiteId } from "./SiteId"; import type { SiteId } from "./SiteId";
import type { SortType } from "./SortType";
export interface LocalSite { export interface LocalSite {
id: LocalSiteId; id: LocalSiteId;
@ -29,4 +31,6 @@ export interface LocalSite {
registration_mode: RegistrationMode; registration_mode: RegistrationMode;
reports_email_admins: boolean; reports_email_admins: boolean;
federation_signed_fetch: boolean; federation_signed_fetch: boolean;
default_post_listing_mode: PostListingMode;
default_sort_type: SortType;
} }

View file

@ -0,0 +1,8 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
export interface LocalSiteUrlBlocklist {
id: number;
url: string;
published: string;
updated?: string;
}

View file

@ -1,10 +1,12 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { LocalUser } from "./LocalUser"; import type { LocalUser } from "./LocalUser";
import type { LocalUserVoteDisplayMode } from "./LocalUserVoteDisplayMode";
import type { Person } from "./Person"; import type { Person } from "./Person";
import type { PersonAggregates } from "./PersonAggregates"; import type { PersonAggregates } from "./PersonAggregates";
export interface LocalUserView { export interface LocalUserView {
local_user: LocalUser; local_user: LocalUser;
local_user_vote_display_mode: LocalUserVoteDisplayMode;
person: Person; person: Person;
counts: PersonAggregates; counts: PersonAggregates;
} }

View file

@ -0,0 +1,10 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { LocalUserId } from "./LocalUserId";
export interface LocalUserVoteDisplayMode {
local_user_id: LocalUserId;
score: boolean;
upvotes: boolean;
downvotes: boolean;
upvote_percentage: boolean;
}

View file

@ -2,7 +2,6 @@
import type { PostId } from "./PostId"; import type { PostId } from "./PostId";
export interface MarkPostAsRead { export interface MarkPostAsRead {
post_id?: PostId; post_ids: Array<PostId>;
post_ids?: Array<PostId>;
read: boolean; read: boolean;
} }

View file

@ -1,12 +1,16 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { CommentId } from "./CommentId";
import type { CommunityId } from "./CommunityId"; import type { CommunityId } from "./CommunityId";
import type { PersonId } from "./PersonId"; import type { PersonId } from "./PersonId";
import type { PostId } from "./PostId";
export interface ModlogListParams { export interface ModlogListParams {
community_id?: CommunityId; community_id?: CommunityId;
mod_person_id?: PersonId; mod_person_id?: PersonId;
other_person_id?: PersonId; other_person_id?: PersonId;
page?: /* integer */ number; post_id?: PostId;
limit?: /* integer */ number; comment_id?: CommentId;
page?: number;
limit?: number;
hide_modlog_names: boolean; hide_modlog_names: boolean;
} }

View file

@ -1,6 +1,6 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
export interface SiteMetadata { export interface OpenGraphData {
title?: string; title?: string;
description?: string; description?: string;
image?: string; image?: string;

View file

@ -3,6 +3,6 @@ import type { PersonId } from "./PersonId";
export interface PersonAggregates { export interface PersonAggregates {
person_id: PersonId; person_id: PersonId;
post_count: /* integer */ number; post_count: number;
comment_count: /* integer */ number; comment_count: number;
} }

View file

@ -16,6 +16,7 @@ export interface PersonMentionView {
recipient: Person; recipient: Person;
counts: CommentAggregates; counts: CommentAggregates;
creator_banned_from_community: boolean; creator_banned_from_community: boolean;
banned_from_community: boolean;
creator_is_moderator: boolean; creator_is_moderator: boolean;
creator_is_admin: boolean; creator_is_admin: boolean;
subscribed: SubscribedType; subscribed: SubscribedType;

View file

@ -26,4 +26,6 @@ export interface Post {
language_id: LanguageId; language_id: LanguageId;
featured_community: boolean; featured_community: boolean;
featured_local: boolean; featured_local: boolean;
url_content_type?: string;
alt_text?: string;
} }

View file

@ -3,9 +3,10 @@ import type { PostId } from "./PostId";
export interface PostAggregates { export interface PostAggregates {
post_id: PostId; post_id: PostId;
comments: /* integer */ number; comments: number;
score: /* integer */ number; score: number;
upvotes: /* integer */ number; upvotes: number;
downvotes: /* integer */ number; downvotes: number;
published: string; published: string;
newest_comment_time: string;
} }

View file

@ -4,6 +4,7 @@ import type { Person } from "./Person";
import type { Post } from "./Post"; import type { Post } from "./Post";
import type { PostAggregates } from "./PostAggregates"; import type { PostAggregates } from "./PostAggregates";
import type { PostReport } from "./PostReport"; import type { PostReport } from "./PostReport";
import type { SubscribedType } from "./SubscribedType";
export interface PostReportView { export interface PostReportView {
post_report: PostReport; post_report: PostReport;
@ -12,7 +13,15 @@ export interface PostReportView {
creator: Person; creator: Person;
post_creator: Person; post_creator: Person;
creator_banned_from_community: boolean; 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; my_vote?: number;
unread_comments: number;
counts: PostAggregates; counts: PostAggregates;
resolver?: Person; resolver?: Person;
} }

View file

@ -10,13 +10,15 @@ export interface PostView {
creator: Person; creator: Person;
community: Community; community: Community;
creator_banned_from_community: boolean; creator_banned_from_community: boolean;
banned_from_community: boolean;
creator_is_moderator: boolean; creator_is_moderator: boolean;
creator_is_admin: boolean; creator_is_admin: boolean;
counts: PostAggregates; counts: PostAggregates;
subscribed: SubscribedType; subscribed: SubscribedType;
saved: boolean; saved: boolean;
read: boolean; read: boolean;
hidden: boolean;
creator_blocked: boolean; creator_blocked: boolean;
my_vote?: number; my_vote?: number;
unread_comments: /* integer */ number; unread_comments: number;
} }

View file

@ -4,7 +4,7 @@ export interface Register {
username: string; username: string;
password: string; password: string;
password_verify: string; password_verify: string;
show_nsfw: boolean; show_nsfw?: boolean;
email?: string; email?: string;
captcha_uuid?: string; captcha_uuid?: string;
captcha_answer?: string; captcha_answer?: string;

View file

@ -8,7 +8,6 @@ export interface SaveUserSettings {
show_nsfw?: boolean; show_nsfw?: boolean;
blur_nsfw?: boolean; blur_nsfw?: boolean;
auto_expand?: boolean; auto_expand?: boolean;
show_scores?: boolean;
theme?: string; theme?: string;
default_sort_type?: SortType; default_sort_type?: SortType;
default_listing_type?: ListingType; default_listing_type?: ListingType;
@ -31,4 +30,8 @@ export interface SaveUserSettings {
enable_keyboard_navigation?: boolean; enable_keyboard_navigation?: boolean;
enable_animated_images?: boolean; enable_animated_images?: boolean;
collapse_bot_comments?: boolean; collapse_bot_comments?: boolean;
show_scores?: boolean;
show_upvotes?: boolean;
show_downvotes?: boolean;
show_upvote_percentage?: boolean;
} }

View file

@ -13,6 +13,6 @@ export interface Search {
type_?: SearchType; type_?: SearchType;
sort?: SortType; sort?: SortType;
listing_type?: ListingType; listing_type?: ListingType;
page?: /* integer */ number; page?: number;
limit?: /* integer */ number; limit?: number;
} }

View file

@ -14,7 +14,7 @@ export interface Site {
actor_id: string; actor_id: string;
last_refreshed_at: string; last_refreshed_at: string;
inbox_url: string; inbox_url: string;
private_key?: string;
public_key: string; public_key: string;
instance_id: InstanceId; instance_id: InstanceId;
content_warning?: string;
} }

View file

@ -3,12 +3,12 @@ import type { SiteId } from "./SiteId";
export interface SiteAggregates { export interface SiteAggregates {
site_id: SiteId; site_id: SiteId;
users: /* integer */ number; users: number;
posts: /* integer */ number; posts: number;
comments: /* integer */ number; comments: number;
communities: /* integer */ number; communities: number;
users_active_day: /* integer */ number; users_active_day: number;
users_active_week: /* integer */ number; users_active_week: number;
users_active_month: /* integer */ number; users_active_month: number;
users_active_half_year: /* integer */ number; users_active_half_year: number;
} }

View file

@ -3,5 +3,6 @@ import type { Person } from "./Person";
export interface VoteView { export interface VoteView {
creator: Person; creator: Person;
creator_banned_from_community: boolean;
score: number; score: number;
} }

2177
yarn.lock

File diff suppressed because it is too large Load diff