# pictrs data
pictrs/
+
+# The generated typescript bindings
+bindings
# It is not intended for manual editing.
version = 3
+[[package]]
+name = "Inflector"
+version = "0.11.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "fe438c63458706e03479442743baae6c88256498e6431708f6dfc520a26515d3"
+dependencies = [
+ "lazy_static",
+ "regex",
+]
+
[[package]]
name = "activitypub_federation"
version = "0.4.0"
"serde_json",
]
+[[package]]
+name = "ast_node"
+version = "0.8.8"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "70151a5226578411132d798aa248df45b30aa34aea2e580628870b4d87be717b"
+dependencies = [
+ "darling 0.13.4",
+ "pmutil",
+ "proc-macro2 1.0.47",
+ "quote 1.0.21",
+ "swc_macros_common",
+ "syn 1.0.103",
+]
+
[[package]]
name = "async-mutex"
version = "1.4.0"
"zeroize",
]
+[[package]]
+name = "better_scoped_tls"
+version = "0.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b73e8ecdec39e98aa3b19e8cd0b8ed8f77ccb86a6b0b2dc7cd86d105438a2123"
+dependencies = [
+ "scoped-tls",
+]
+
[[package]]
name = "bit-set"
version = "0.5.3"
"pest_derive",
"regex",
"shell-words",
- "typed-arena",
+ "typed-arena 1.7.0",
"unicode_categories",
"xdg",
]
"tokio",
]
+[[package]]
+name = "debug_unreachable"
+version = "0.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9a032eac705ca39214d169f83e3d3da290af06d8d1d344d1baad2fd002dca4b3"
+dependencies = [
+ "unreachable",
+]
+
+[[package]]
+name = "deno_ast"
+version = "0.20.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "322f52615649f4f096eed78ec8e2a7eb68ff0bf5f330d59302c5479c7a8fa158"
+dependencies = [
+ "dprint-swc-ext",
+ "serde",
+ "swc_atoms",
+ "swc_common",
+ "swc_ecma_ast",
+ "swc_ecma_parser",
+ "text_lines",
+]
+
[[package]]
name = "derive_builder"
version = "0.10.2"
"syn 1.0.103",
]
+[[package]]
+name = "dprint-core"
+version = "0.59.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "84600c297cc99fc088a9a916286d71915c988fa3a6f1bbc994ad9b93dde80c03"
+dependencies = [
+ "anyhow",
+ "bumpalo",
+ "indexmap",
+ "rustc-hash",
+ "serde",
+]
+
+[[package]]
+name = "dprint-plugin-typescript"
+version = "0.77.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0e301864e67893077d67258287d90441e8b22fa5e571bd31f9b43c5de10db546"
+dependencies = [
+ "anyhow",
+ "deno_ast",
+ "dprint-core",
+ "rustc-hash",
+ "serde",
+]
+
+[[package]]
+name = "dprint-swc-ext"
+version = "0.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f8ac3ba92d2cf3b87b8f48551d1720ff63a134545c830476aaffd8cf9d80e84e"
+dependencies = [
+ "bumpalo",
+ "num-bigint",
+ "rustc-hash",
+ "swc_atoms",
+ "swc_common",
+ "swc_ecma_ast",
+ "swc_ecma_parser",
+ "text_lines",
+]
+
[[package]]
name = "dyn-clone"
version = "1.0.9"
"syn 1.0.103",
]
+[[package]]
+name = "enum_kind"
+version = "0.2.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9895954c6ec59d897ed28a64815f2ceb57653fcaaebd317f2edc78b74f5495b6"
+dependencies = [
+ "pmutil",
+ "proc-macro2 1.0.47",
+ "swc_macros_common",
+ "syn 1.0.103",
+]
+
[[package]]
name = "errno"
version = "0.2.8"
"percent-encoding",
]
+[[package]]
+name = "from_variant"
+version = "0.1.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1d449976075322384507443937df2f1d5577afbf4282f12a5a66ef29fa3e6307"
+dependencies = [
+ "pmutil",
+ "proc-macro2 1.0.47",
+ "swc_macros_common",
+ "syn 1.0.103",
+]
+
[[package]]
name = "fs2"
version = "0.4.3"
dependencies = [
"autocfg",
"hashbrown",
+ "serde",
]
[[package]]
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "879d54834c8c76457ef4293a689b2a8c59b076067ad77b15efafbb05f92a592b"
+[[package]]
+name = "is-macro"
+version = "0.2.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8a7d079e129b77477a49c5c4f1cfe9ce6c2c909ef52520693e8e811a714c7b20"
+dependencies = [
+ "Inflector",
+ "pmutil",
+ "proc-macro2 1.0.47",
+ "quote 1.0.21",
+ "syn 1.0.103",
+]
+
[[package]]
name = "is-terminal"
version = "0.4.2"
"rosetta-i18n",
"serde",
"serde_json",
+ "serde_with",
"strum",
"strum_macros",
"tracing",
+ "ts-rs",
"url",
"uuid",
"webpage",
"regex",
"serde",
"serde_json",
+ "serde_with",
"serial_test",
"sha2",
"strum",
"strum_macros",
"tokio",
"tracing",
+ "ts-rs",
"typed-builder",
"url",
]
"diesel_ltree",
"lemmy_db_schema",
"serde",
+ "serde_with",
"serial_test",
"tokio",
"tracing",
+ "ts-rs",
"typed-builder",
]
"diesel-async",
"lemmy_db_schema",
"serde",
+ "serde_with",
+ "ts-rs",
"typed-builder",
]
"diesel-async",
"lemmy_db_schema",
"serde",
+ "serde_with",
+ "ts-rs",
]
[[package]]
"socket2",
]
+[[package]]
+name = "lexical"
+version = "6.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c7aefb36fd43fef7003334742cbf77b243fcd36418a1d1bdd480d613a67968f6"
+dependencies = [
+ "lexical-core 0.8.5",
+]
+
[[package]]
name = "lexical-core"
version = "0.7.6"
"static_assertions",
]
+[[package]]
+name = "lexical-core"
+version = "0.8.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2cde5de06e8d4c2faabc400238f9ae1c74d5412d03a7bd067645ccbc47070e46"
+dependencies = [
+ "lexical-parse-float",
+ "lexical-parse-integer",
+ "lexical-util",
+ "lexical-write-float",
+ "lexical-write-integer",
+]
+
+[[package]]
+name = "lexical-parse-float"
+version = "0.8.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "683b3a5ebd0130b8fb52ba0bdc718cc56815b6a097e28ae5a6997d0ad17dc05f"
+dependencies = [
+ "lexical-parse-integer",
+ "lexical-util",
+ "static_assertions",
+]
+
+[[package]]
+name = "lexical-parse-integer"
+version = "0.8.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6d0994485ed0c312f6d965766754ea177d07f9c00c9b82a5ee62ed5b47945ee9"
+dependencies = [
+ "lexical-util",
+ "static_assertions",
+]
+
+[[package]]
+name = "lexical-util"
+version = "0.8.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5255b9ff16ff898710eb9eb63cb39248ea8a5bb036bea8085b1a767ff6c4e3fc"
+dependencies = [
+ "static_assertions",
+]
+
+[[package]]
+name = "lexical-write-float"
+version = "0.8.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "accabaa1c4581f05a3923d1b4cfd124c329352288b7b9da09e766b0668116862"
+dependencies = [
+ "lexical-util",
+ "lexical-write-integer",
+ "static_assertions",
+]
+
+[[package]]
+name = "lexical-write-integer"
+version = "0.8.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e1b6f3d1f4422866b68192d62f77bc5c700bee84f3069f2469d7bc8c77852446"
+dependencies = [
+ "lexical-util",
+ "static_assertions",
+]
+
[[package]]
name = "libc"
version = "0.2.135"
dependencies = [
"bitvec",
"funty",
- "lexical-core",
+ "lexical-core 0.7.6",
"memchr",
"version_check",
]
"autocfg",
"num-integer",
"num-traits",
+ "serde",
]
[[package]]
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1df8c4ec4b0627e53bdf214615ad287367e482558cf84b109250b37464dc03ae"
+[[package]]
+name = "pmutil"
+version = "0.5.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3894e5d549cccbe44afecf72922f277f603cd4bb0219c8342631ef18fffbe004"
+dependencies = [
+ "proc-macro2 1.0.47",
+ "quote 1.0.21",
+ "syn 1.0.103",
+]
+
[[package]]
name = "png"
version = "0.17.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7ef03e0a2b150c7a90d01faf6254c9c48a41e95fb2a8c2ac1c6f0d2b9aefc342"
+[[package]]
+name = "rustc-hash"
+version = "1.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2"
+
[[package]]
name = "rustc_version"
version = "0.4.0"
"windows-sys 0.36.1",
]
+[[package]]
+name = "scoped-tls"
+version = "1.0.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e1cf6437eb19a8f4a6cc0f7dca544973b0b78843adbfeb3683d1a94a0024a294"
+
[[package]]
name = "scopeguard"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d"
+[[package]]
+name = "stable_deref_trait"
+version = "1.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3"
+
[[package]]
name = "static_assertions"
version = "1.1.0"
"quote 1.0.21",
]
+[[package]]
+name = "string_enum"
+version = "0.3.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "91f42363e5ca94ea6f3faee9e3b5e1a4047535ae323f5c0579385fb2ae95874e"
+dependencies = [
+ "pmutil",
+ "proc-macro2 1.0.47",
+ "quote 1.0.21",
+ "swc_macros_common",
+ "syn 1.0.103",
+]
+
[[package]]
name = "stringprep"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601"
+[[package]]
+name = "swc_atoms"
+version = "0.4.23"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "01b878052680dcec3421ab50384279443dbf93651b05da38e5133e0894a18096"
+dependencies = [
+ "once_cell",
+ "rustc-hash",
+ "serde",
+ "string_cache",
+ "string_cache_codegen",
+ "triomphe",
+]
+
+[[package]]
+name = "swc_common"
+version = "0.29.10"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ebd844dfbd9969a9ef8430e954661de43edde353d65e987f935a328619698883"
+dependencies = [
+ "ahash",
+ "ast_node",
+ "better_scoped_tls",
+ "cfg-if",
+ "debug_unreachable",
+ "either",
+ "from_variant",
+ "num-bigint",
+ "once_cell",
+ "rustc-hash",
+ "serde",
+ "siphasher",
+ "string_cache",
+ "swc_atoms",
+ "swc_eq_ignore_macros",
+ "swc_visit",
+ "tracing",
+ "unicode-width",
+ "url",
+]
+
+[[package]]
+name = "swc_ecma_ast"
+version = "0.94.14"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2c3303de79adce1137e6514e5939686173e7d26c71d91c3067056caa45183547"
+dependencies = [
+ "bitflags",
+ "is-macro",
+ "num-bigint",
+ "scoped-tls",
+ "serde",
+ "string_enum",
+ "swc_atoms",
+ "swc_common",
+ "unicode-id",
+]
+
+[[package]]
+name = "swc_ecma_parser"
+version = "0.122.19"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8cec064f10003ea47bd5e97d6456a683643da9f705670b97eb1c90bc434f58f3"
+dependencies = [
+ "either",
+ "enum_kind",
+ "lexical",
+ "num-bigint",
+ "serde",
+ "smallvec",
+ "swc_atoms",
+ "swc_common",
+ "swc_ecma_ast",
+ "tracing",
+ "typed-arena 2.0.2",
+]
+
+[[package]]
+name = "swc_eq_ignore_macros"
+version = "0.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0c20468634668c2bbab581947bb8c75c97158d5a6959f4ba33df20983b20b4f6"
+dependencies = [
+ "pmutil",
+ "proc-macro2 1.0.47",
+ "quote 1.0.21",
+ "syn 1.0.103",
+]
+
+[[package]]
+name = "swc_macros_common"
+version = "0.3.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3e582c3e3c2269238524923781df5be49e011dbe29cf7683a2215d600a562ea6"
+dependencies = [
+ "pmutil",
+ "proc-macro2 1.0.47",
+ "quote 1.0.21",
+ "syn 1.0.103",
+]
+
+[[package]]
+name = "swc_visit"
+version = "0.5.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d1d5999f23421c8e21a0f2bc53a0b9e8244f3b421de89471561af2fbe40b9cca"
+dependencies = [
+ "either",
+ "swc_visit_macros",
+]
+
+[[package]]
+name = "swc_visit_macros"
+version = "0.5.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ebeed7eb0f545f48ad30f5aab314e5208b735bcea1d1464f26e20f06db904989"
+dependencies = [
+ "Inflector",
+ "pmutil",
+ "proc-macro2 1.0.47",
+ "quote 1.0.21",
+ "swc_macros_common",
+ "syn 1.0.103",
+]
+
[[package]]
name = "syn"
version = "0.14.9"
"winapi-util",
]
+[[package]]
+name = "text_lines"
+version = "0.6.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7fd5828de7deaa782e1dd713006ae96b3bee32d3279b79eb67ecf8072c059bcf"
+dependencies = [
+ "serde",
+]
+
[[package]]
name = "thiserror"
version = "1.0.37"
"tracing-serde",
]
+[[package]]
+name = "triomphe"
+version = "0.1.8"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f1ee9bd9239c339d714d657fac840c6d2a4f9c45f4f9ec7b0975113458be78db"
+dependencies = [
+ "serde",
+ "stable_deref_trait",
+]
+
[[package]]
name = "try-lock"
version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642"
+[[package]]
+name = "ts-rs"
+version = "6.2.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4added4070a4fdf9df03457206cd2e4b12417c8560a2954d91ffcbe60177a56a"
+dependencies = [
+ "chrono",
+ "dprint-plugin-typescript",
+ "thiserror",
+ "ts-rs-macros",
+]
+
+[[package]]
+name = "ts-rs-macros"
+version = "6.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9f807fdb3151fee75df7485b901a89624358cd07a67a8fb1a5831bf5a07681ff"
+dependencies = [
+ "Inflector",
+ "proc-macro2 1.0.47",
+ "quote 1.0.21",
+ "syn 1.0.103",
+ "termcolor",
+]
+
[[package]]
name = "twoway"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a9b2228007eba4120145f785df0f6c92ea538f5a3635a612ecf4e334c8c1446d"
+[[package]]
+name = "typed-arena"
+version = "2.0.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6af6ae20167a9ece4bcb41af5b80f8a1f1df981f6391189ce00fd257af04126a"
+
[[package]]
name = "typed-builder"
version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "099b7128301d285f79ddd55b9a83d5e6b9e97c92e0ea0daebee7263e932de992"
+[[package]]
+name = "unicode-id"
+version = "0.3.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d70b6494226b36008c8366c288d77190b3fad2eb4c10533139c1c1f461127f1a"
+
[[package]]
name = "unicode-ident"
version = "1.0.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "39ec24b3121d976906ece63c9daad25b85969647682eee313cb5779fdd69e14e"
+[[package]]
+name = "unreachable"
+version = "0.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1f2ae5ddb18e1c92664717616dd9549dde73f539f01bd7b77c2edb2446bdff91"
+dependencies = [
+ "void",
+]
+
[[package]]
name = "untrusted"
version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
+[[package]]
+name = "void"
+version = "1.0.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d"
+
[[package]]
name = "walkdir"
version = "2.3.2"
diesel_migrations = "2.0.0"
diesel-async = "0.1.1"
serde = { version = "1.0.147", features = ["derive"] }
+serde_with = "1.14.0"
actix-web = { version = "4.2.1", default-features = false, features = ["macros", "rustls"] }
tracing = "0.1.36"
tracing-actix-web = { version = "0.6.1", default-features = false }
tracing-log = "0.1.3"
tracing-subscriber = { version = "0.3.15", features = ["env-filter"] }
url = { version = "2.3.1", features = ["serde"] }
+url_serde = "0.2.0"
reqwest = { version = "0.11.12", features = ["json", "blocking"] }
reqwest-middleware = "0.2.0"
reqwest-tracing = "0.4.0"
opentelemetry = { version = "0.17.0", features = ["rt-tokio"] }
tracing-opentelemetry = { version = "0.17.2" }
actix = "0.13"
+ts-rs = { version = "6.2", features = ["serde-compat", "format", "chrono-impl"] }
[dependencies]
lemmy_api = { workspace = true }
"eslint": "^8.25.0",
"eslint-plugin-prettier": "^4.0.0",
"jest": "^27.0.6",
- "lemmy-js-client": "0.17.2-rc.6",
+ "lemmy-js-client": "0.17.2-rc.11",
"node-fetch": "^2.6.1",
"prettier": "^2.7.1",
"ts-jest": "^27.0.3",
jest.setTimeout(180000);
-import { CommentView } from "lemmy-js-client";
-import { PostResponse } from "lemmy-js-client";
+import { PostResponse } from "lemmy-js-client/dist/types/PostResponse";
import {
alpha,
beta,
getCommentParentId,
resolveCommunity,
} from "./shared";
+import { CommentView } from "lemmy-js-client/dist/types/CommentView";
let postRes: PostResponse;
jest.setTimeout(120000);
-import { CommunityView } from "lemmy-js-client";
+import { CommunityView } from "lemmy-js-client/dist/types/CommunityView";
import {
alpha,
beta,
jest.setTimeout(120000);
-import { SubscribedType } from "lemmy-js-client";
import {
alpha,
// Make sure the follow response went through
expect(betaCommunity?.community.local).toBe(false);
expect(betaCommunity?.community.name).toBe("main");
- expect(betaCommunity?.subscribed).toBe(SubscribedType.Subscribed);
+ expect(betaCommunity?.subscribed).toBe("Subscribed");
// Check it from local
let site = await getSite(alpha);
// Test an unfollow
let unfollow = await followCommunity(alpha, false, remoteCommunityId);
- expect(unfollow.community_view.subscribed).toBe(SubscribedType.NotSubscribed);
+ expect(unfollow.community_view.subscribed).toBe("NotSubscribed");
// Make sure you are unsubbed locally
let siteUnfollowCheck = await getSite(alpha);
jest.setTimeout(120000);
-import { PostView, CommunityView } from "lemmy-js-client";
+import { CommunityView } from "lemmy-js-client/dist/types/CommunityView";
import {
alpha,
beta,
unfollows,
resolveCommunity,
} from "./shared";
+import { PostView } from "lemmy-js-client/dist/types/PostView";
let betaCommunity: CommunityView | undefined;
-import {
- Login,
- LoginResponse,
- CreatePost,
- EditPost,
- CreateComment,
- DeletePost,
- RemovePost,
- LockPost,
- PostResponse,
- SearchResponse,
- FollowCommunity,
- CommunityResponse,
- GetPostResponse,
- Register,
- Comment,
- EditComment,
- DeleteComment,
- RemoveComment,
- Search,
- CommentResponse,
- GetCommunity,
- CreateCommunity,
- DeleteCommunity,
- RemoveCommunity,
- GetPersonMentions,
- CreateCommentLike,
- CreatePostLike,
- EditPrivateMessage,
- DeletePrivateMessage,
- GetPrivateMessages,
- GetSite,
- GetPost,
- PrivateMessageResponse,
- PrivateMessagesResponse,
- GetPersonMentionsResponse,
- SaveUserSettings,
- SortType,
- ListingType,
- GetSiteResponse,
- SearchType,
- LemmyHttp,
- BanPersonResponse,
- BanPerson,
- BanFromCommunity,
- BanFromCommunityResponse,
- Post,
- CreatePrivateMessage,
- ResolveObjectResponse,
- ResolveObject,
- CreatePostReport,
- ListPostReports,
- PostReportResponse,
- ListPostReportsResponse,
- CreateCommentReport,
- CommentReportResponse,
- ListCommentReports,
- ListCommentReportsResponse,
- DeleteAccount,
- DeleteAccountResponse,
- EditSite,
- CommentSortType,
- GetComments,
- GetCommentsResponse,
- FeaturePost,
- PostFeatureType,
- RegistrationMode,
-} from "lemmy-js-client";
+import { LemmyHttp } from "lemmy-js-client";
+import { CreatePost } from "lemmy-js-client/dist/types/CreatePost";
+import { DeletePost } from "lemmy-js-client/dist/types/DeletePost";
+import { EditPost } from "lemmy-js-client/dist/types/EditPost";
+import { EditSite } from "lemmy-js-client/dist/types/EditSite";
+import { FeaturePost } from "lemmy-js-client/dist/types/FeaturePost";
+import { GetComments } from "lemmy-js-client/dist/types/GetComments";
+import { GetCommentsResponse } from "lemmy-js-client/dist/types/GetCommentsResponse";
+import { GetPost } from "lemmy-js-client/dist/types/GetPost";
+import { GetPostResponse } from "lemmy-js-client/dist/types/GetPostResponse";
+import { LockPost } from "lemmy-js-client/dist/types/LockPost";
+import { Login } from "lemmy-js-client/dist/types/Login";
+import { Post } from "lemmy-js-client/dist/types/Post";
+import { PostResponse } from "lemmy-js-client/dist/types/PostResponse";
+import { RemovePost } from "lemmy-js-client/dist/types/RemovePost";
+import { ResolveObject } from "lemmy-js-client/dist/types/ResolveObject";
+import { ResolveObjectResponse } from "lemmy-js-client/dist/types/ResolveObjectResponse";
+import { Search } from "lemmy-js-client/dist/types/Search";
+import { SearchResponse } from "lemmy-js-client/dist/types/SearchResponse";
+import { Comment } from "lemmy-js-client/dist/types/Comment";
+import { BanPersonResponse } from "lemmy-js-client/dist/types/BanPersonResponse";
+import { BanPerson } from "lemmy-js-client/dist/types/BanPerson";
+import { BanFromCommunityResponse } from "lemmy-js-client/dist/types/BanFromCommunityResponse";
+import { BanFromCommunity } from "lemmy-js-client/dist/types/BanFromCommunity";
+import { CommunityResponse } from "lemmy-js-client/dist/types/CommunityResponse";
+import { FollowCommunity } from "lemmy-js-client/dist/types/FollowCommunity";
+import { CreatePostLike } from "lemmy-js-client/dist/types/CreatePostLike";
+import { CommentResponse } from "lemmy-js-client/dist/types/CommentResponse";
+import { CreateComment } from "lemmy-js-client/dist/types/CreateComment";
+import { EditComment } from "lemmy-js-client/dist/types/EditComment";
+import { DeleteComment } from "lemmy-js-client/dist/types/DeleteComment";
+import { RemoveComment } from "lemmy-js-client/dist/types/RemoveComment";
+import { GetPersonMentionsResponse } from "lemmy-js-client/dist/types/GetPersonMentionsResponse";
+import { GetPersonMentions } from "lemmy-js-client/dist/types/GetPersonMentions";
+import { CreateCommentLike } from "lemmy-js-client/dist/types/CreateCommentLike";
+import { CreateCommunity } from "lemmy-js-client/dist/types/CreateCommunity";
+import { GetCommunity } from "lemmy-js-client/dist/types/GetCommunity";
+import { DeleteCommunity } from "lemmy-js-client/dist/types/DeleteCommunity";
+import { RemoveCommunity } from "lemmy-js-client/dist/types/RemoveCommunity";
+import { PrivateMessageResponse } from "lemmy-js-client/dist/types/PrivateMessageResponse";
+import { CreatePrivateMessage } from "lemmy-js-client/dist/types/CreatePrivateMessage";
+import { EditPrivateMessage } from "lemmy-js-client/dist/types/EditPrivateMessage";
+import { DeletePrivateMessage } from "lemmy-js-client/dist/types/DeletePrivateMessage";
+import { LoginResponse } from "lemmy-js-client/dist/types/LoginResponse";
+import { Register } from "lemmy-js-client/dist/types/Register";
+import { SaveUserSettings } from "lemmy-js-client/dist/types/SaveUserSettings";
+import { DeleteAccount } from "lemmy-js-client/dist/types/DeleteAccount";
+import { GetSiteResponse } from "lemmy-js-client/dist/types/GetSiteResponse";
+import { DeleteAccountResponse } from "lemmy-js-client/dist/types/DeleteAccountResponse";
+import { GetSite } from "lemmy-js-client/dist/types/GetSite";
+import { PrivateMessagesResponse } from "lemmy-js-client/dist/types/PrivateMessagesResponse";
+import { GetPrivateMessages } from "lemmy-js-client/dist/types/GetPrivateMessages";
+import { PostReportResponse } from "lemmy-js-client/dist/types/PostReportResponse";
+import { CreatePostReport } from "lemmy-js-client/dist/types/CreatePostReport";
+import { ListPostReportsResponse } from "lemmy-js-client/dist/types/ListPostReportsResponse";
+import { ListPostReports } from "lemmy-js-client/dist/types/ListPostReports";
+import { CommentReportResponse } from "lemmy-js-client/dist/types/CommentReportResponse";
+import { CreateCommentReport } from "lemmy-js-client/dist/types/CreateCommentReport";
+import { ListCommentReportsResponse } from "lemmy-js-client/dist/types/ListCommentReportsResponse";
+import { ListCommentReports } from "lemmy-js-client/dist/types/ListCommentReports";
export interface API {
client: LemmyHttp;
// Registration applications are now enabled by default, need to disable them
let editSiteForm: EditSite = {
- registration_mode: RegistrationMode.Open,
+ registration_mode: "Open",
rate_limit_message: 999,
rate_limit_post: 999,
rate_limit_register: 999,
let form: FeaturePost = {
post_id: post.id,
featured,
- feature_type: PostFeatureType.Community,
+ feature_type: "Community",
auth: api.auth,
};
return api.client.featurePost(form);
): Promise<SearchResponse> {
let form: Search = {
q: post.name,
- type_: SearchType.Posts,
- sort: SortType.TopAll,
+ type_: "Posts",
+ sort: "TopAll",
auth: api.auth,
};
return api.client.search(form);
): Promise<GetCommentsResponse> {
let form: GetComments = {
post_id: post_id,
- type_: ListingType.All,
- sort: CommentSortType.New,
+ type_: "All",
+ sort: "New",
auth: api.auth,
};
return api.client.getComments(form);
api: API
): Promise<GetPersonMentionsResponse> {
let form: GetPersonMentions = {
- sort: CommentSortType.New,
+ sort: "New",
unread_only: false,
auth: api.auth,
};
let form: SaveUserSettings = {
show_nsfw: true,
theme: "darkly",
- default_sort_type: SortType.Active,
- default_listing_type: ListingType.All,
+ default_sort_type: "Active",
+ default_listing_type: "All",
interface_language: "en",
show_avatars: true,
send_notifications_to_email: false,
let bio = "a changed bio";
let form: SaveUserSettings = {
show_nsfw: false,
- default_sort_type: SortType.Hot,
- default_listing_type: ListingType.All,
+ default_sort_type: "Hot",
+ default_listing_type: "All",
interface_language: "",
avatar,
banner,
jest.setTimeout(120000);
-import { PersonView } from "lemmy-js-client";
+import { PersonView } from "lemmy-js-client/dist/types/PersonView";
import {
alpha,
beta,
resolved "https://registry.yarnpkg.com/kleur/-/kleur-3.0.3.tgz#a79c9ecc86ee1ce3fa6206d1216c501f147fc07e"
integrity sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w==
-lemmy-js-client@0.17.2-rc.6:
- version "0.17.2-rc.6"
- resolved "https://registry.yarnpkg.com/lemmy-js-client/-/lemmy-js-client-0.17.2-rc.6.tgz#cd488bc30edf7b65a02b91f1bc295d1b958e9b86"
- integrity sha512-/EdzpLJpYOq3ypCQA1MyI7sX0DmHUIA1ZUIda2XTCUUP7a5pltF7WHTicFrQ9j6JwCiFMTVkw6S/L8LzfD6cGA==
+lemmy-js-client@0.17.2-rc.11:
+ version "0.17.2-rc.11"
+ resolved "https://registry.yarnpkg.com/lemmy-js-client/-/lemmy-js-client-0.17.2-rc.11.tgz#fb23d28b5fd4349fd53832010c92755d0402ac6c"
+ integrity sha512-Dn+ZPF3lw3PAEPv+F7Y5ymnXi1vRa/rjBjyP41QzjITPREU2HSZIQN5R6nQKiUU0DyKpzySvuLGCg6Q+iA68Kw==
dependencies:
cross-fetch "^3.1.5"
form-data "^4.0.0"
[features]
full = ["tracing", "rosetta-i18n", "chrono", "actix-web", "lemmy_utils",
"lemmy_db_views/full", "lemmy_db_views_actor/full", "lemmy_db_views_moderator/full",
- "percent-encoding", "encoding", "reqwest-middleware", "webpage"]
+ "percent-encoding", "encoding", "reqwest-middleware", "webpage", "ts-rs"]
[dependencies]
lemmy_db_views = { workspace = true }
lemmy_db_schema = { workspace = true, default-features = false }
lemmy_utils = { workspace = true, optional = true }
serde = { workspace = true }
+serde_with = { workspace = true }
url = { workspace = true }
actix-web = { workspace = true, features = ["cookies"], optional = true }
chrono = { workspace = true, optional = true }
uuid = { workspace = true }
actix-rt = { workspace = true }
reqwest = { workspace = true }
+ts-rs = { workspace = true, optional = true }
};
use lemmy_db_views::structs::{CommentReportView, CommentView};
use serde::{Deserialize, Serialize};
+use serde_with::skip_serializing_none;
+#[cfg(feature = "full")]
+use ts_rs::TS;
+#[skip_serializing_none]
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct CreateComment {
pub content: String,
pub post_id: PostId,
pub auth: Sensitive<String>,
}
+#[skip_serializing_none]
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct GetComment {
pub id: CommentId,
pub auth: Option<Sensitive<String>>,
}
+#[skip_serializing_none]
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct EditComment {
pub comment_id: CommentId,
pub content: Option<String>,
pub auth: Sensitive<String>,
}
+#[skip_serializing_none]
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct DistinguishComment {
pub comment_id: CommentId,
pub distinguished: bool,
pub auth: Sensitive<String>,
}
+#[skip_serializing_none]
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct DeleteComment {
pub comment_id: CommentId,
pub deleted: bool,
pub auth: Sensitive<String>,
}
+#[skip_serializing_none]
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct RemoveComment {
pub comment_id: CommentId,
pub removed: bool,
}
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct SaveComment {
pub comment_id: CommentId,
pub save: bool,
pub auth: Sensitive<String>,
}
+#[skip_serializing_none]
#[derive(Debug, Serialize, Deserialize, Clone)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct CommentResponse {
pub comment_view: CommentView,
pub recipient_ids: Vec<LocalUserId>,
- pub form_id: Option<String>, // An optional front end ID, to tell which is coming back
+ /// An optional front end ID, to tell which is coming back
+ pub form_id: Option<String>,
}
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct CreateCommentLike {
pub comment_id: CommentId,
pub score: i16,
pub auth: Sensitive<String>,
}
+#[skip_serializing_none]
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct GetComments {
pub type_: Option<ListingType>,
pub sort: Option<CommentSortType>,
}
#[derive(Debug, Serialize, Deserialize, Clone)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct GetCommentsResponse {
pub comments: Vec<CommentView>,
}
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct CreateCommentReport {
pub comment_id: CommentId,
pub reason: String,
}
#[derive(Debug, Serialize, Deserialize, Clone)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct CommentReportResponse {
pub comment_report_view: CommentReportView,
}
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct ResolveCommentReport {
pub report_id: CommentReportId,
pub resolved: bool,
pub auth: Sensitive<String>,
}
+#[skip_serializing_none]
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct ListCommentReports {
pub page: Option<i64>,
+
pub limit: Option<i64>,
/// Only shows the unresolved reports
pub unresolved_only: Option<bool>,
}
#[derive(Debug, Serialize, Deserialize, Clone)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct ListCommentReportsResponse {
pub comment_reports: Vec<CommentReportView>,
}
};
use lemmy_db_views_actor::structs::{CommunityModeratorView, CommunityView, PersonView};
use serde::{Deserialize, Serialize};
+use serde_with::skip_serializing_none;
+#[cfg(feature = "full")]
+use ts_rs::TS;
+#[skip_serializing_none]
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct GetCommunity {
pub id: Option<CommunityId>,
/// Example: star_trek , or star_trek@xyz.tld
pub auth: Option<Sensitive<String>>,
}
+#[skip_serializing_none]
#[derive(Debug, Serialize, Deserialize, Clone)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct GetCommunityResponse {
pub community_view: CommunityView,
pub site: Option<Site>,
pub default_post_language: Option<LanguageId>,
}
+#[skip_serializing_none]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
pub struct CreateCommunity {
pub name: String,
}
#[derive(Debug, Serialize, Deserialize, Clone)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct CommunityResponse {
pub community_view: CommunityView,
pub discussion_languages: Vec<LanguageId>,
}
+#[skip_serializing_none]
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct ListCommunities {
pub type_: Option<ListingType>,
pub sort: Option<SortType>,
}
#[derive(Debug, Serialize, Deserialize, Clone)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct ListCommunitiesResponse {
pub communities: Vec<CommunityView>,
}
+#[skip_serializing_none]
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct BanFromCommunity {
pub community_id: CommunityId,
pub person_id: PersonId,
}
#[derive(Debug, Serialize, Deserialize, Clone)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct BanFromCommunityResponse {
pub person_view: PersonView,
pub banned: bool,
}
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct AddModToCommunity {
pub community_id: CommunityId,
pub person_id: PersonId,
}
#[derive(Debug, Serialize, Deserialize, Clone)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct AddModToCommunityResponse {
pub moderators: Vec<CommunityModeratorView>,
}
+#[skip_serializing_none]
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct EditCommunity {
pub community_id: CommunityId,
pub title: Option<String>,
pub auth: Sensitive<String>,
}
+#[skip_serializing_none]
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct HideCommunity {
pub community_id: CommunityId,
pub hidden: bool,
pub auth: Sensitive<String>,
}
+#[skip_serializing_none]
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct DeleteCommunity {
pub community_id: CommunityId,
pub deleted: bool,
pub auth: Sensitive<String>,
}
+#[skip_serializing_none]
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct RemoveCommunity {
pub community_id: CommunityId,
pub removed: bool,
}
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct FollowCommunity {
pub community_id: CommunityId,
pub follow: bool,
}
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct BlockCommunity {
pub community_id: CommunityId,
pub block: bool,
pub auth: Sensitive<String>,
}
+#[skip_serializing_none]
#[derive(Debug, Serialize, Deserialize, Clone)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct BlockCommunityResponse {
pub community_view: CommunityView,
pub blocked: bool,
}
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct TransferCommunity {
pub community_id: CommunityId,
pub person_id: PersonId,
use lemmy_db_schema::newtypes::CustomEmojiId;
use lemmy_db_views::structs::CustomEmojiView;
use serde::{Deserialize, Serialize};
+#[cfg(feature = "full")]
+use ts_rs::TS;
use url::Url;
#[derive(Debug, Serialize, Deserialize, Clone)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct CreateCustomEmoji {
pub category: String,
pub shortcode: String,
+ #[cfg_attr(feature = "full", ts(type = "string"))]
pub image_url: Url,
pub alt_text: String,
pub keywords: Vec<String>,
}
#[derive(Debug, Serialize, Deserialize, Clone)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct EditCustomEmoji {
pub id: CustomEmojiId,
pub category: String,
+ #[cfg_attr(feature = "full", ts(type = "string"))]
pub image_url: Url,
pub alt_text: String,
pub keywords: Vec<String>,
}
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct DeleteCustomEmoji {
pub id: CustomEmojiId,
pub auth: Sensitive<String>,
}
#[derive(Serialize, Deserialize)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct DeleteCustomEmojiResponse {
pub id: CustomEmojiId,
pub success: bool,
}
#[derive(Debug, Serialize, Deserialize, Clone)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct CustomEmojiResponse {
pub custom_emoji: CustomEmojiView,
}
PersonView,
};
use serde::{Deserialize, Serialize};
+use serde_with::skip_serializing_none;
+#[cfg(feature = "full")]
+use ts_rs::TS;
+#[skip_serializing_none]
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct Login {
pub username_or_email: Sensitive<String>,
pub password: Sensitive<String>,
pub totp_2fa_token: Option<String>,
}
+#[skip_serializing_none]
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct Register {
pub username: String,
pub password: Sensitive<String>,
}
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct GetCaptcha {}
+#[skip_serializing_none]
#[derive(Debug, Serialize, Deserialize, Clone)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct GetCaptchaResponse {
pub ok: Option<CaptchaResponse>, // Will be None if captchas are disabled
}
#[derive(Debug, Serialize, Deserialize, Clone)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct CaptchaResponse {
- pub png: String, // A Base64 encoded png
- pub wav: String, // A Base64 encoded wav audio
+ /// A Base64 encoded png
+ pub png: String,
+ /// A Base64 encoded wav audio
+ pub wav: String,
pub uuid: String,
}
+#[skip_serializing_none]
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct SaveUserSettings {
pub show_nsfw: Option<bool>,
pub show_scores: Option<bool>,
}
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct ChangePassword {
pub new_password: Sensitive<String>,
pub new_password_verify: Sensitive<String>,
pub auth: Sensitive<String>,
}
+#[skip_serializing_none]
#[derive(Debug, Serialize, Deserialize, Clone)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct LoginResponse {
/// This is None in response to `Register` if email verification is enabled, or the server requires registration applications.
pub jwt: Option<Sensitive<String>>,
pub verify_email_sent: bool,
}
+#[skip_serializing_none]
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct GetPersonDetails {
pub person_id: Option<PersonId>, // One of these two are required
/// Example: dessalines , or dessalines@xyz.tld
}
#[derive(Debug, Serialize, Deserialize, Clone)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct GetPersonDetailsResponse {
pub person_view: PersonView,
pub comments: Vec<CommentView>,
}
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct GetRepliesResponse {
pub replies: Vec<CommentReplyView>,
}
#[derive(Debug, Serialize, Deserialize, Clone)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct GetPersonMentionsResponse {
pub mentions: Vec<PersonMentionView>,
}
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct MarkAllAsRead {
pub auth: Sensitive<String>,
}
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct AddAdmin {
pub person_id: PersonId,
pub added: bool,
}
#[derive(Debug, Serialize, Deserialize, Clone)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct AddAdminResponse {
pub admins: Vec<PersonView>,
}
+#[skip_serializing_none]
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct BanPerson {
pub person_id: PersonId,
pub ban: bool,
}
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct GetBannedPersons {
- pub auth: String,
+ pub auth: Sensitive<String>,
}
#[derive(Debug, Serialize, Deserialize, Clone)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct BannedPersonsResponse {
pub banned: Vec<PersonView>,
}
#[derive(Debug, Serialize, Deserialize, Clone)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct BanPersonResponse {
pub person_view: PersonView,
pub banned: bool,
}
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct BlockPerson {
pub person_id: PersonId,
pub block: bool,
}
#[derive(Debug, Serialize, Deserialize, Clone)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct BlockPersonResponse {
pub person_view: PersonView,
pub blocked: bool,
}
+#[skip_serializing_none]
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct GetReplies {
pub sort: Option<CommentSortType>,
pub page: Option<i64>,
pub auth: Sensitive<String>,
}
+#[skip_serializing_none]
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct GetPersonMentions {
pub sort: Option<CommentSortType>,
pub page: Option<i64>,
}
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct MarkPersonMentionAsRead {
pub person_mention_id: PersonMentionId,
pub read: bool,
}
#[derive(Debug, Serialize, Deserialize, Clone)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct PersonMentionResponse {
pub person_mention_view: PersonMentionView,
}
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct MarkCommentReplyAsRead {
pub comment_reply_id: CommentReplyId,
pub read: bool,
}
#[derive(Debug, Serialize, Deserialize, Clone)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct CommentReplyResponse {
pub comment_reply_view: CommentReplyView,
}
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct DeleteAccount {
pub password: Sensitive<String>,
pub auth: Sensitive<String>,
}
#[derive(Debug, Serialize, Deserialize, Clone)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct DeleteAccountResponse {}
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct PasswordReset {
pub email: Sensitive<String>,
}
#[derive(Debug, Serialize, Deserialize, Clone)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct PasswordResetResponse {}
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct PasswordChangeAfterReset {
pub token: Sensitive<String>,
pub password: Sensitive<String>,
pub password_verify: Sensitive<String>,
}
+#[skip_serializing_none]
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct GetReportCount {
pub community_id: Option<CommunityId>,
pub auth: Sensitive<String>,
}
+#[skip_serializing_none]
#[derive(Debug, Serialize, Deserialize, Clone)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct GetReportCountResponse {
pub community_id: Option<CommunityId>,
pub comment_reports: i64,
}
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct GetUnreadCount {
pub auth: Sensitive<String>,
}
#[derive(Debug, Serialize, Deserialize, Clone)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct GetUnreadCountResponse {
pub replies: i64,
pub mentions: i64,
}
#[derive(Serialize, Deserialize, Clone, Default, Debug)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct VerifyEmail {
pub token: String,
}
#[derive(Debug, Serialize, Deserialize, Clone)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct VerifyEmailResponse {}
use lemmy_db_views::structs::{PostReportView, PostView};
use lemmy_db_views_actor::structs::{CommunityModeratorView, CommunityView};
use serde::{Deserialize, Serialize};
+use serde_with::skip_serializing_none;
+#[cfg(feature = "full")]
+use ts_rs::TS;
use url::Url;
+#[skip_serializing_none]
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct CreatePost {
pub name: String,
pub community_id: CommunityId,
+ #[cfg_attr(feature = "full", ts(type = "string"))]
pub url: Option<Url>,
pub body: Option<String>,
pub honeypot: Option<String>,
}
#[derive(Debug, Serialize, Deserialize, Clone)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct PostResponse {
pub post_view: PostView,
}
-#[derive(Debug, Serialize, Deserialize, Clone, Default)]
+#[skip_serializing_none]
+#[derive(Debug, Serialize, Deserialize, Clone)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct GetPost {
pub id: Option<PostId>,
pub comment_id: Option<CommentId>,
}
#[derive(Debug, Serialize, Deserialize, Clone)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct GetPostResponse {
pub post_view: PostView,
pub community_view: CommunityView,
pub online: usize,
}
+#[skip_serializing_none]
#[derive(Serialize, Deserialize, Debug, Clone, Default)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct GetPosts {
pub type_: Option<ListingType>,
pub sort: Option<SortType>,
}
#[derive(Serialize, Deserialize, Debug, Clone)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct GetPostsResponse {
pub posts: Vec<PostView>,
}
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct CreatePostLike {
pub post_id: PostId,
pub score: i16,
pub auth: Sensitive<String>,
}
+#[skip_serializing_none]
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct EditPost {
pub post_id: PostId,
pub name: Option<String>,
+ #[cfg_attr(feature = "full", ts(type = "string"))]
pub url: Option<Url>,
pub body: Option<String>,
pub nsfw: Option<bool>,
}
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct DeletePost {
pub post_id: PostId,
pub deleted: bool,
pub auth: Sensitive<String>,
}
+#[skip_serializing_none]
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct RemovePost {
pub post_id: PostId,
pub removed: bool,
}
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct MarkPostAsRead {
pub post_id: PostId,
pub read: bool,
}
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct LockPost {
pub post_id: PostId,
pub locked: bool,
}
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct FeaturePost {
pub post_id: PostId,
pub featured: bool,
}
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct SavePost {
pub post_id: PostId,
pub save: bool,
}
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct CreatePostReport {
pub post_id: PostId,
pub reason: String,
}
#[derive(Debug, Serialize, Deserialize, Clone)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct PostReportResponse {
pub post_report_view: PostReportView,
}
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct ResolvePostReport {
pub report_id: PostReportId,
pub resolved: bool,
pub auth: Sensitive<String>,
}
+#[skip_serializing_none]
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct ListPostReports {
pub page: Option<i64>,
pub limit: Option<i64>,
}
#[derive(Debug, Serialize, Deserialize, Clone)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct ListPostReportsResponse {
pub post_reports: Vec<PostReportView>,
}
#[derive(Debug, Serialize, Deserialize, Clone)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct GetSiteMetadata {
+ #[cfg_attr(feature = "full", ts(type = "string"))]
pub url: Url,
}
#[derive(Debug, Serialize, Deserialize, Clone)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct GetSiteMetadataResponse {
pub metadata: SiteMetadata,
}
+#[skip_serializing_none]
#[derive(Debug, Deserialize, Serialize, PartialEq, Eq, Clone)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct SiteMetadata {
pub title: Option<String>,
pub description: Option<String>,
use lemmy_db_schema::newtypes::{PersonId, PrivateMessageId, PrivateMessageReportId};
use lemmy_db_views::structs::{PrivateMessageReportView, PrivateMessageView};
use serde::{Deserialize, Serialize};
+use serde_with::skip_serializing_none;
+#[cfg(feature = "full")]
+use ts_rs::TS;
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct CreatePrivateMessage {
pub content: String,
pub recipient_id: PersonId,
}
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct EditPrivateMessage {
pub private_message_id: PrivateMessageId,
pub content: String,
}
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct DeletePrivateMessage {
pub private_message_id: PrivateMessageId,
pub deleted: bool,
}
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct MarkPrivateMessageAsRead {
pub private_message_id: PrivateMessageId,
pub read: bool,
pub auth: Sensitive<String>,
}
+#[skip_serializing_none]
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct GetPrivateMessages {
pub unread_only: Option<bool>,
pub page: Option<i64>,
}
#[derive(Debug, Serialize, Deserialize, Clone)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct PrivateMessagesResponse {
pub private_messages: Vec<PrivateMessageView>,
}
#[derive(Debug, Serialize, Deserialize, Clone)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct PrivateMessageResponse {
pub private_message_view: PrivateMessageView,
}
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct CreatePrivateMessageReport {
pub private_message_id: PrivateMessageId,
pub reason: String,
}
#[derive(Debug, Serialize, Deserialize, Clone)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct PrivateMessageReportResponse {
pub private_message_report_view: PrivateMessageReportView,
}
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct ResolvePrivateMessageReport {
pub report_id: PrivateMessageReportId,
pub resolved: bool,
pub auth: Sensitive<String>,
}
+#[skip_serializing_none]
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct ListPrivateMessageReports {
pub page: Option<i64>,
pub limit: Option<i64>,
}
#[derive(Debug, Serialize, Deserialize, Clone)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct ListPrivateMessageReportsResponse {
pub private_message_reports: Vec<PrivateMessageReportView>,
}
ops::{Deref, DerefMut},
};
+#[cfg(feature = "full")]
+use ts_rs::TS;
+
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Deserialize, Serialize, Default)]
#[serde(transparent)]
pub struct Sensitive<T>(T);
&self.0
}
}
+
+#[cfg(feature = "full")]
+impl TS for Sensitive<String> {
+ fn name() -> String {
+ "string".to_string()
+ }
+ fn name_with_type_args(_args: Vec<String>) -> String {
+ "string".to_string()
+ }
+ fn dependencies() -> Vec<ts_rs::Dependency> {
+ Vec::new()
+ }
+ fn transparent() -> bool {
+ true
+ }
+}
ModTransferCommunityView,
};
use serde::{Deserialize, Serialize};
+use serde_with::skip_serializing_none;
+#[cfg(feature = "full")]
+use ts_rs::TS;
+#[skip_serializing_none]
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct Search {
pub q: String,
pub community_id: Option<CommunityId>,
}
#[derive(Debug, Serialize, Deserialize, Clone)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct SearchResponse {
- pub type_: String,
+ pub type_: SearchType,
pub comments: Vec<CommentView>,
pub posts: Vec<PostView>,
pub communities: Vec<CommunityView>,
}
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct ResolveObject {
pub q: String,
pub auth: Sensitive<String>,
}
+#[skip_serializing_none]
#[derive(Debug, Serialize, Deserialize, Default)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
+// TODO Change this to an enum
pub struct ResolveObjectResponse {
pub comment: Option<CommentView>,
pub post: Option<PostView>,
pub person: Option<PersonView>,
}
+#[skip_serializing_none]
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct GetModlog {
pub mod_person_id: Option<PersonId>,
pub community_id: Option<CommunityId>,
pub page: Option<i64>,
pub limit: Option<i64>,
- pub auth: Option<Sensitive<String>>,
pub type_: Option<ModlogActionType>,
pub other_person_id: Option<PersonId>,
+ pub auth: Option<Sensitive<String>>,
}
#[derive(Debug, Serialize, Deserialize, Clone)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct GetModlogResponse {
pub removed_posts: Vec<ModRemovePostView>,
pub locked_posts: Vec<ModLockPostView>,
pub hidden_communities: Vec<ModHideCommunityView>,
}
+#[skip_serializing_none]
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct CreateSite {
pub name: String,
pub sidebar: Option<String>,
pub auth: Sensitive<String>,
}
+#[skip_serializing_none]
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct EditSite {
pub name: Option<String>,
pub sidebar: Option<String>,
pub auth: Sensitive<String>,
}
+#[skip_serializing_none]
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct GetSite {
pub auth: Option<Sensitive<String>>,
}
#[derive(Debug, Serialize, Deserialize, Clone)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct SiteResponse {
pub site_view: SiteView,
}
+#[skip_serializing_none]
#[derive(Debug, Serialize, Deserialize, Clone)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct GetSiteResponse {
pub site_view: SiteView,
pub admins: Vec<PersonView>,
}
#[derive(Debug, Serialize, Deserialize, Clone)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct GetFederatedInstances {}
+#[skip_serializing_none]
#[derive(Debug, Serialize, Deserialize, Clone)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct GetFederatedInstancesResponse {
pub federated_instances: Option<FederatedInstances>, // Federation may be disabled
}
#[derive(Debug, Serialize, Deserialize, Clone)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct MyUserInfo {
pub local_user_view: LocalUserView,
pub follows: Vec<CommunityFollowerView>,
}
#[derive(Debug, Serialize, Deserialize, Clone)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct LeaveAdmin {
pub auth: Sensitive<String>,
}
#[derive(Debug, Serialize, Deserialize, Clone)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct FederatedInstances {
pub linked: Vec<Instance>,
pub allowed: Vec<Instance>,
pub blocked: Vec<Instance>,
}
+#[skip_serializing_none]
#[derive(Debug, Serialize, Deserialize, Clone)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct PurgePerson {
pub person_id: PersonId,
pub reason: Option<String>,
- pub auth: String,
+ pub auth: Sensitive<String>,
}
+#[skip_serializing_none]
#[derive(Debug, Serialize, Deserialize, Clone)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct PurgeCommunity {
pub community_id: CommunityId,
pub reason: Option<String>,
- pub auth: String,
+ pub auth: Sensitive<String>,
}
+#[skip_serializing_none]
#[derive(Debug, Serialize, Deserialize, Clone)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct PurgePost {
pub post_id: PostId,
pub reason: Option<String>,
- pub auth: String,
+ pub auth: Sensitive<String>,
}
+#[skip_serializing_none]
#[derive(Debug, Serialize, Deserialize, Clone)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct PurgeComment {
pub comment_id: CommentId,
pub reason: Option<String>,
- pub auth: String,
+ pub auth: Sensitive<String>,
}
#[derive(Serialize, Deserialize)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct PurgeItemResponse {
pub success: bool,
}
+#[skip_serializing_none]
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct ListRegistrationApplications {
/// Only shows the unread applications (IE those without an admin actor)
pub unread_only: Option<bool>,
pub page: Option<i64>,
pub limit: Option<i64>,
- pub auth: String,
+ pub auth: Sensitive<String>,
}
#[derive(Debug, Serialize, Deserialize, Clone)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct ListRegistrationApplicationsResponse {
pub registration_applications: Vec<RegistrationApplicationView>,
}
+#[skip_serializing_none]
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct ApproveRegistrationApplication {
pub id: i32,
pub approve: bool,
pub deny_reason: Option<String>,
- pub auth: String,
+ pub auth: Sensitive<String>,
}
#[derive(Debug, Serialize, Deserialize, Clone)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct RegistrationApplicationResponse {
pub registration_application: RegistrationApplicationView,
}
#[derive(Debug, Serialize, Deserialize, Clone)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct GetUnreadRegistrationApplicationCount {
- pub auth: String,
+ pub auth: Sensitive<String>,
}
#[derive(Debug, Serialize, Deserialize, Clone)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct GetUnreadRegistrationApplicationCountResponse {
pub registration_applications: i64,
}
use crate::sensitive::Sensitive;
use lemmy_db_schema::newtypes::{CommunityId, PostId};
use serde::{Deserialize, Serialize};
+#[cfg(feature = "full")]
+use ts_rs::TS;
#[derive(Debug, Serialize, Deserialize, Clone)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct UserJoin {
pub auth: Sensitive<String>,
}
#[derive(Debug, Serialize, Deserialize, Clone)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct UserJoinResponse {
pub joined: bool,
}
#[derive(Debug, Serialize, Deserialize, Clone)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct CommunityJoin {
pub community_id: CommunityId,
}
#[derive(Debug, Serialize, Deserialize, Clone)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct CommunityJoinResponse {
pub joined: bool,
}
#[derive(Debug, Serialize, Deserialize, Clone)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct ModJoin {
pub community_id: CommunityId,
}
#[derive(Debug, Serialize, Deserialize, Clone)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct ModJoinResponse {
pub joined: bool,
}
#[derive(Debug, Serialize, Deserialize, Clone)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct PostJoin {
pub post_id: PostId,
}
#[derive(Debug, Serialize, Deserialize, Clone)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct PostJoinResponse {
pub joined: bool,
}
reqwest = { workspace = true }
once_cell = { workspace = true }
html2md = "0.2.13"
-serde_with = "1.14.0"
+serde_with = { workspace = true }
http-signature-normalization-actix = { version = "0.6.1", default-features = false, features = ["server", "sha-2"] }
enum_delegate = "0.2.0"
// Return the jwt
Ok(SearchResponse {
- type_: search_type.to_string(),
+ type_: search_type,
comments,
posts,
communities,
[features]
full = ["diesel", "diesel-derive-newtype", "diesel-derive-enum", "diesel_migrations", "bcrypt", "lemmy_utils",
"activitypub_federation", "sha2", "regex", "once_cell", "serde_json", "diesel_ltree",
- "diesel-async", "deadpool"]
+ "diesel-async", "deadpool", "ts-rs"]
[dependencies]
chrono = { workspace = true }
serde = { workspace = true }
+serde_with = { workspace = true }
url = { workspace = true }
strum = { workspace = true }
strum_macros = { workspace = true }
tokio = { workspace = true }
tracing = { workspace = true }
deadpool = { version = "0.9.5", features = ["rt_tokio_1"], optional = true }
+ts-rs = { workspace = true, optional = true }
[dev-dependencies]
serial_test = { workspace = true }
site_aggregates,
};
use serde::{Deserialize, Serialize};
+#[cfg(feature = "full")]
+use ts_rs::TS;
#[derive(PartialEq, Eq, Debug, Serialize, Deserialize, Clone)]
-#[cfg_attr(feature = "full", derive(Queryable, Associations, Identifiable))]
+#[cfg_attr(feature = "full", derive(Queryable, Associations, Identifiable, TS))]
#[cfg_attr(feature = "full", diesel(table_name = comment_aggregates))]
#[cfg_attr(feature = "full", diesel(belongs_to(crate::source::comment::Comment)))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct CommentAggregates {
pub id: i32,
pub comment_id: CommentId,
}
#[derive(PartialEq, Eq, Debug, Serialize, Deserialize, Clone)]
-#[cfg_attr(feature = "full", derive(Queryable, Associations, Identifiable))]
+#[cfg_attr(feature = "full", derive(Queryable, Associations, Identifiable, TS))]
#[cfg_attr(feature = "full", diesel(table_name = community_aggregates))]
#[cfg_attr(
feature = "full",
diesel(belongs_to(crate::source::community::Community))
)]
+#[cfg_attr(feature = "full", ts(export))]
pub struct CommunityAggregates {
pub id: i32,
pub community_id: CommunityId,
}
#[derive(PartialEq, Eq, Debug, Serialize, Deserialize, Clone, Default)]
-#[cfg_attr(feature = "full", derive(Queryable, Associations, Identifiable))]
+#[cfg_attr(feature = "full", derive(Queryable, Associations, Identifiable, TS))]
#[cfg_attr(feature = "full", diesel(table_name = person_aggregates))]
#[cfg_attr(feature = "full", diesel(belongs_to(crate::source::person::Person)))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct PersonAggregates {
pub id: i32,
pub person_id: PersonId,
}
#[derive(PartialEq, Eq, Debug, Serialize, Deserialize, Clone)]
-#[cfg_attr(feature = "full", derive(Queryable, Associations, Identifiable))]
+#[cfg_attr(feature = "full", derive(Queryable, Associations, Identifiable, TS))]
#[cfg_attr(feature = "full", diesel(table_name = post_aggregates))]
#[cfg_attr(feature = "full", diesel(belongs_to(crate::source::post::Post)))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct PostAggregates {
pub id: i32,
pub post_id: PostId,
}
#[derive(PartialEq, Eq, Debug, Serialize, Deserialize, Clone)]
-#[cfg_attr(feature = "full", derive(Queryable, Associations, Identifiable))]
+#[cfg_attr(feature = "full", derive(Queryable, Associations, Identifiable, TS))]
#[cfg_attr(feature = "full", diesel(table_name = site_aggregates))]
#[cfg_attr(feature = "full", diesel(belongs_to(crate::source::site::Site)))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct SiteAggregates {
pub id: i32,
pub site_id: SiteId,
use serde::{Deserialize, Serialize};
use strum_macros::{Display, EnumString};
+#[cfg(feature = "full")]
+use ts_rs::TS;
#[derive(EnumString, Display, Debug, Serialize, Deserialize, Clone, Copy, PartialEq, Eq)]
-#[cfg_attr(feature = "full", derive(DbEnum))]
+#[cfg_attr(feature = "full", derive(DbEnum, TS))]
#[cfg_attr(
feature = "full",
ExistingTypePath = "crate::schema::sql_types::SortTypeEnum"
)]
#[cfg_attr(feature = "full", DbValueStyle = "verbatim")]
+#[cfg_attr(feature = "full", ts(export))]
pub enum SortType {
Active,
Hot,
}
#[derive(EnumString, Display, Debug, Serialize, Deserialize, Clone, Copy)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub enum CommentSortType {
Hot,
Top,
}
#[derive(EnumString, Display, Debug, Serialize, Deserialize, Clone, Copy, PartialEq, Eq)]
-#[cfg_attr(feature = "full", derive(DbEnum))]
+#[cfg_attr(feature = "full", derive(DbEnum, TS))]
#[cfg_attr(
feature = "full",
ExistingTypePath = "crate::schema::sql_types::ListingTypeEnum"
)]
#[cfg_attr(feature = "full", DbValueStyle = "verbatim")]
+#[cfg_attr(feature = "full", ts(export))]
pub enum ListingType {
All,
Local,
}
#[derive(EnumString, Display, Debug, Serialize, Deserialize, Clone, Copy, PartialEq, Eq)]
-#[cfg_attr(feature = "full", derive(DbEnum))]
+#[cfg_attr(feature = "full", derive(DbEnum, TS))]
#[cfg_attr(
feature = "full",
ExistingTypePath = "crate::schema::sql_types::RegistrationModeEnum"
)]
#[cfg_attr(feature = "full", DbValueStyle = "verbatim")]
+#[cfg_attr(feature = "full", ts(export))]
pub enum RegistrationMode {
Closed,
RequireApplication,
}
#[derive(EnumString, Display, Debug, Serialize, Deserialize, Clone, Copy)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub enum SearchType {
All,
Comments,
}
#[derive(EnumString, Display, Debug, PartialEq, Eq, Serialize, Deserialize, Clone, Copy)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub enum SubscribedType {
Subscribed,
NotSubscribed,
}
#[derive(EnumString, Display, Debug, Serialize, Deserialize, Clone, Copy, PartialEq, Eq)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub enum ModlogActionType {
All,
ModRemovePost,
#[derive(
EnumString, Display, Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq,
)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub enum PostFeatureType {
#[default]
Local,
fmt::{Display, Formatter},
ops::Deref,
};
+#[cfg(feature = "full")]
+use ts_rs::TS;
use url::Url;
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Default, Serialize, Deserialize)]
-#[cfg_attr(feature = "full", derive(DieselNewType))]
+#[cfg_attr(feature = "full", derive(DieselNewType, TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct PostId(pub i32);
impl fmt::Display for PostId {
}
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Default, Serialize, Deserialize)]
-#[cfg_attr(feature = "full", derive(DieselNewType))]
+#[cfg_attr(feature = "full", derive(DieselNewType, TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct PersonId(pub i32);
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, Default)]
-#[cfg_attr(feature = "full", derive(DieselNewType))]
+#[cfg_attr(feature = "full", derive(DieselNewType, TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct CommentId(pub i32);
impl fmt::Display for CommentId {
}
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Default, Serialize, Deserialize)]
-#[cfg_attr(feature = "full", derive(DieselNewType))]
+#[cfg_attr(feature = "full", derive(DieselNewType, TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct CommunityId(pub i32);
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Default, Serialize, Deserialize)]
-#[cfg_attr(feature = "full", derive(DieselNewType))]
+#[cfg_attr(feature = "full", derive(DieselNewType, TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct LocalUserId(pub i32);
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, Default)]
-#[cfg_attr(feature = "full", derive(DieselNewType))]
+#[cfg_attr(feature = "full", derive(DieselNewType, TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct PrivateMessageId(i32);
impl fmt::Display for PrivateMessageId {
}
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, Default)]
-#[cfg_attr(feature = "full", derive(DieselNewType))]
+#[cfg_attr(feature = "full", derive(DieselNewType, TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct PersonMentionId(i32);
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, Default)]
-#[cfg_attr(feature = "full", derive(DieselNewType))]
+#[cfg_attr(feature = "full", derive(DieselNewType, TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct PersonBlockId(i32);
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, Default)]
-#[cfg_attr(feature = "full", derive(DieselNewType))]
+#[cfg_attr(feature = "full", derive(DieselNewType, TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct CommunityBlockId(i32);
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, Default)]
-#[cfg_attr(feature = "full", derive(DieselNewType))]
+#[cfg_attr(feature = "full", derive(DieselNewType, TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct CommentReportId(i32);
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, Default)]
-#[cfg_attr(feature = "full", derive(DieselNewType))]
+#[cfg_attr(feature = "full", derive(DieselNewType, TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct PostReportId(i32);
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, Default)]
-#[cfg_attr(feature = "full", derive(DieselNewType))]
+#[cfg_attr(feature = "full", derive(DieselNewType, TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct PrivateMessageReportId(i32);
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, Default)]
-#[cfg_attr(feature = "full", derive(DieselNewType))]
+#[cfg_attr(feature = "full", derive(DieselNewType, TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct SiteId(i32);
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, Default)]
-#[cfg_attr(feature = "full", derive(DieselNewType))]
+#[cfg_attr(feature = "full", derive(DieselNewType, TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct LanguageId(pub i32);
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, Default)]
pub struct CommunityLanguageId(pub i32);
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, Default)]
-#[cfg_attr(feature = "full", derive(DieselNewType))]
+#[cfg_attr(feature = "full", derive(DieselNewType, TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct CommentReplyId(i32);
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, Default)]
-#[cfg_attr(feature = "full", derive(DieselNewType))]
+#[cfg_attr(feature = "full", derive(DieselNewType, TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct InstanceId(i32);
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, Default)]
-#[cfg_attr(feature = "full", derive(DieselNewType))]
+#[cfg_attr(feature = "full", derive(DieselNewType, TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct LocalSiteId(i32);
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, Default)]
-#[cfg_attr(feature = "full", derive(DieselNewType))]
+#[cfg_attr(feature = "full", derive(DieselNewType, TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct CustomEmojiId(i32);
+#[cfg(feature = "full")]
+#[derive(Serialize, Deserialize)]
+#[serde(remote = "Ltree")]
+/// Do remote derivation for the Ltree struct
+pub struct LtreeDef(pub String);
+
#[repr(transparent)]
#[derive(Clone, PartialEq, Eq, Serialize, Deserialize, Debug)]
#[cfg_attr(feature = "full", derive(AsExpression, FromSqlRow))]
}
}
-#[cfg(feature = "full")]
-#[derive(Serialize, Deserialize)]
-#[serde(remote = "Ltree")]
-/// Do remote derivation for the Ltree struct
-pub struct LtreeDef(pub String);
-
impl Display for DbUrl {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
self.clone().0.fmt(f)
&self.0
}
}
+
+#[cfg(feature = "full")]
+impl TS for DbUrl {
+ fn name() -> String {
+ "string".to_string()
+ }
+ fn dependencies() -> Vec<ts_rs::Dependency> {
+ Vec::new()
+ }
+ fn transparent() -> bool {
+ true
+ }
+}
#[cfg(feature = "full")]
use diesel_ltree::Ltree;
use serde::{Deserialize, Serialize};
+use serde_with::skip_serializing_none;
+#[cfg(feature = "full")]
+use ts_rs::TS;
use typed_builder::TypedBuilder;
+#[skip_serializing_none]
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
-#[cfg_attr(feature = "full", derive(Queryable, Associations, Identifiable))]
+#[cfg_attr(feature = "full", derive(Queryable, Associations, Identifiable, TS))]
+#[cfg_attr(feature = "full", ts(export))]
#[cfg_attr(feature = "full", diesel(belongs_to(crate::source::post::Post)))]
#[cfg_attr(feature = "full", diesel(table_name = comment))]
pub struct Comment {
pub ap_id: DbUrl,
pub local: bool,
#[cfg(feature = "full")]
- #[serde(with = "LtreeDef")]
+ #[cfg_attr(feature = "full", serde(with = "LtreeDef"))]
+ #[cfg_attr(feature = "full", ts(type = "string"))]
pub path: Ltree,
pub distinguished: bool,
pub language_id: LanguageId,
#[cfg(feature = "full")]
use crate::schema::comment_reply;
use serde::{Deserialize, Serialize};
+#[cfg(feature = "full")]
+use ts_rs::TS;
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
-#[cfg_attr(feature = "full", derive(Queryable, Associations, Identifiable))]
+#[cfg_attr(feature = "full", derive(Queryable, Associations, Identifiable, TS))]
#[cfg_attr(feature = "full", diesel(belongs_to(crate::source::comment::Comment)))]
#[cfg_attr(feature = "full", diesel(table_name = comment_reply))]
+#[cfg_attr(feature = "full", ts(export))]
/// This table keeps a list of replies to comments and posts.
pub struct CommentReply {
pub id: CommentReplyId,
#[cfg(feature = "full")]
use crate::schema::comment_report;
use serde::{Deserialize, Serialize};
+use serde_with::skip_serializing_none;
+#[cfg(feature = "full")]
+use ts_rs::TS;
+#[skip_serializing_none]
#[derive(PartialEq, Eq, Serialize, Deserialize, Debug, Clone)]
-#[cfg_attr(feature = "full", derive(Queryable, Associations, Identifiable))]
+#[cfg_attr(feature = "full", derive(Queryable, Associations, Identifiable, TS))]
#[cfg_attr(feature = "full", diesel(belongs_to(crate::source::comment::Comment)))]
#[cfg_attr(feature = "full", diesel(table_name = comment_report))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct CommentReport {
pub id: CommentReportId,
pub creator_id: PersonId,
#[cfg(feature = "full")]
use crate::schema::{community, community_follower, community_moderator, community_person_ban};
use serde::{Deserialize, Serialize};
+use serde_with::skip_serializing_none;
+#[cfg(feature = "full")]
+use ts_rs::TS;
use typed_builder::TypedBuilder;
+#[skip_serializing_none]
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
-#[cfg_attr(feature = "full", derive(Queryable, Identifiable))]
+#[cfg_attr(feature = "full", derive(Queryable, Identifiable, TS))]
#[cfg_attr(feature = "full", diesel(table_name = community))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct Community {
pub id: CommunityId,
pub name: String,
#[cfg(feature = "full")]
use crate::schema::custom_emoji;
use serde::{Deserialize, Serialize};
+use serde_with::skip_serializing_none;
+#[cfg(feature = "full")]
+use ts_rs::TS;
use typed_builder::TypedBuilder;
+#[skip_serializing_none]
#[derive(PartialEq, Eq, Debug, Clone, Serialize, Deserialize)]
-#[cfg_attr(feature = "full", derive(Queryable, Associations, Identifiable))]
+#[cfg_attr(feature = "full", derive(Queryable, Associations, Identifiable, TS))]
#[cfg_attr(feature = "full", diesel(table_name = custom_emoji))]
#[cfg_attr(
feature = "full",
diesel(belongs_to(crate::source::local_site::LocalSite))
)]
+#[cfg_attr(feature = "full", ts(export))]
pub struct CustomEmoji {
pub id: CustomEmojiId,
pub local_site_id: LocalSiteId,
#[cfg(feature = "full")]
use crate::schema::custom_emoji_keyword;
use serde::{Deserialize, Serialize};
+#[cfg(feature = "full")]
+use ts_rs::TS;
use typed_builder::TypedBuilder;
#[derive(PartialEq, Eq, Debug, Clone, Serialize, Deserialize)]
-#[cfg_attr(feature = "full", derive(Queryable, Associations, Identifiable))]
+#[cfg_attr(feature = "full", derive(Queryable, Associations, Identifiable, TS))]
#[cfg_attr(feature = "full", diesel(table_name = custom_emoji_keyword))]
#[cfg_attr(
feature = "full",
diesel(belongs_to(crate::source::custom_emoji::CustomEmoji))
)]
+#[cfg_attr(feature = "full", ts(export))]
pub struct CustomEmojiKeyword {
pub id: i32,
pub custom_emoji_id: CustomEmojiId,
#[cfg(feature = "full")]
use crate::schema::instance;
use serde::{Deserialize, Serialize};
+use serde_with::skip_serializing_none;
use std::fmt::Debug;
+#[cfg(feature = "full")]
+use ts_rs::TS;
use typed_builder::TypedBuilder;
+#[skip_serializing_none]
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
-#[cfg_attr(feature = "full", derive(Queryable, Identifiable))]
+#[cfg_attr(feature = "full", derive(Queryable, Identifiable, TS))]
#[cfg_attr(feature = "full", diesel(table_name = instance))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct Instance {
pub id: InstanceId,
pub domain: String,
#[cfg(feature = "full")]
use crate::schema::language;
use serde::{Deserialize, Serialize};
+#[cfg(feature = "full")]
+use ts_rs::TS;
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
-#[cfg_attr(feature = "full", derive(Queryable, Identifiable))]
+#[cfg_attr(feature = "full", derive(Queryable, Identifiable, TS))]
#[cfg_attr(feature = "full", diesel(table_name = language))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct Language {
pub id: LanguageId,
pub code: String,
RegistrationMode,
};
use serde::{Deserialize, Serialize};
+use serde_with::skip_serializing_none;
+#[cfg(feature = "full")]
+use ts_rs::TS;
use typed_builder::TypedBuilder;
+#[skip_serializing_none]
#[derive(PartialEq, Eq, Debug, Clone, Serialize, Deserialize)]
-#[cfg_attr(feature = "full", derive(Queryable, Identifiable))]
+#[cfg_attr(feature = "full", derive(Queryable, Identifiable, TS))]
#[cfg_attr(feature = "full", diesel(table_name = local_site))]
#[cfg_attr(feature = "full", diesel(belongs_to(crate::source::site::Site)))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct LocalSite {
pub id: LocalSiteId,
pub site_id: SiteId,
#[cfg(feature = "full")]
use crate::schema::local_site_rate_limit;
use serde::{Deserialize, Serialize};
+use serde_with::skip_serializing_none;
+#[cfg(feature = "full")]
+use ts_rs::TS;
use typed_builder::TypedBuilder;
+#[skip_serializing_none]
#[derive(PartialEq, Eq, Debug, Clone, Serialize, Deserialize)]
-#[cfg_attr(feature = "full", derive(Queryable, Identifiable))]
+#[cfg_attr(feature = "full", derive(Queryable, Identifiable, TS))]
#[cfg_attr(feature = "full", diesel(table_name = local_site_rate_limit))]
#[cfg_attr(
feature = "full",
diesel(belongs_to(crate::source::local_site::LocalSite))
)]
+#[cfg_attr(feature = "full", ts(export))]
pub struct LocalSiteRateLimit {
pub id: i32,
pub local_site_id: LocalSiteId,
SortType,
};
use serde::{Deserialize, Serialize};
+use serde_with::skip_serializing_none;
+#[cfg(feature = "full")]
+use ts_rs::TS;
use typed_builder::TypedBuilder;
+#[skip_serializing_none]
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
-#[cfg_attr(feature = "full", derive(Queryable, Identifiable))]
+#[cfg_attr(feature = "full", derive(Queryable, Identifiable, TS))]
#[cfg_attr(feature = "full", diesel(table_name = local_user))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct LocalUser {
pub id: LocalUserId,
pub person_id: PersonId,
mod_transfer_community,
};
use serde::{Deserialize, Serialize};
+use serde_with::skip_serializing_none;
+#[cfg(feature = "full")]
+use ts_rs::TS;
+#[skip_serializing_none]
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
-#[cfg_attr(feature = "full", derive(Queryable, Identifiable))]
+#[cfg_attr(feature = "full", derive(Queryable, Identifiable, TS))]
#[cfg_attr(feature = "full", diesel(table_name = mod_remove_post))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct ModRemovePost {
pub id: i32,
pub mod_person_id: PersonId,
}
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
-#[cfg_attr(feature = "full", derive(Queryable, Identifiable))]
+#[cfg_attr(feature = "full", derive(Queryable, Identifiable, TS))]
#[cfg_attr(feature = "full", diesel(table_name = mod_lock_post))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct ModLockPost {
pub id: i32,
pub mod_person_id: PersonId,
}
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
-#[cfg_attr(feature = "full", derive(Queryable, Identifiable))]
+#[cfg_attr(feature = "full", derive(Queryable, Identifiable, TS))]
#[cfg_attr(feature = "full", diesel(table_name = mod_feature_post))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct ModFeaturePost {
pub id: i32,
pub mod_person_id: PersonId,
pub is_featured_community: bool,
}
+#[skip_serializing_none]
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
-#[cfg_attr(feature = "full", derive(Queryable, Identifiable))]
+#[cfg_attr(feature = "full", derive(Queryable, Identifiable, TS))]
#[cfg_attr(feature = "full", diesel(table_name = mod_remove_comment))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct ModRemoveComment {
pub id: i32,
pub mod_person_id: PersonId,
pub removed: Option<bool>,
}
+#[skip_serializing_none]
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
-#[cfg_attr(feature = "full", derive(Queryable, Identifiable))]
+#[cfg_attr(feature = "full", derive(Queryable, Identifiable, TS))]
#[cfg_attr(feature = "full", diesel(table_name = mod_remove_community))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct ModRemoveCommunity {
pub id: i32,
pub mod_person_id: PersonId,
pub expires: Option<chrono::NaiveDateTime>,
}
+#[skip_serializing_none]
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
-#[cfg_attr(feature = "full", derive(Queryable, Identifiable))]
+#[cfg_attr(feature = "full", derive(Queryable, Identifiable, TS))]
#[cfg_attr(feature = "full", diesel(table_name = mod_ban_from_community))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct ModBanFromCommunity {
pub id: i32,
pub mod_person_id: PersonId,
pub expires: Option<chrono::NaiveDateTime>,
}
+#[skip_serializing_none]
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
-#[cfg_attr(feature = "full", derive(Queryable, Identifiable))]
+#[cfg_attr(feature = "full", derive(Queryable, Identifiable, TS))]
#[cfg_attr(feature = "full", diesel(table_name = mod_ban))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct ModBan {
pub id: i32,
pub mod_person_id: PersonId,
pub hidden: Option<bool>,
pub reason: Option<String>,
}
+
+#[skip_serializing_none]
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
-#[cfg_attr(feature = "full", derive(Queryable, Identifiable))]
+#[cfg_attr(feature = "full", derive(Queryable, Identifiable, TS))]
#[cfg_attr(feature = "full", diesel(table_name = mod_hide_community))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct ModHideCommunity {
pub id: i32,
pub community_id: CommunityId,
}
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
-#[cfg_attr(feature = "full", derive(Queryable, Identifiable))]
+#[cfg_attr(feature = "full", derive(Queryable, Identifiable, TS))]
#[cfg_attr(feature = "full", diesel(table_name = mod_add_community))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct ModAddCommunity {
pub id: i32,
pub mod_person_id: PersonId,
}
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
-#[cfg_attr(feature = "full", derive(Queryable, Identifiable))]
+#[cfg_attr(feature = "full", derive(Queryable, Identifiable, TS))]
#[cfg_attr(feature = "full", diesel(table_name = mod_transfer_community))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct ModTransferCommunity {
pub id: i32,
pub mod_person_id: PersonId,
}
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
-#[cfg_attr(feature = "full", derive(Queryable, Identifiable))]
+#[cfg_attr(feature = "full", derive(Queryable, Identifiable, TS))]
#[cfg_attr(feature = "full", diesel(table_name = mod_add))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct ModAdd {
pub id: i32,
pub mod_person_id: PersonId,
pub removed: Option<bool>,
}
+#[skip_serializing_none]
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
-#[cfg_attr(feature = "full", derive(Queryable, Identifiable))]
+#[cfg_attr(feature = "full", derive(Queryable, Identifiable, TS))]
#[cfg_attr(feature = "full", diesel(table_name = admin_purge_person))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct AdminPurgePerson {
pub id: i32,
pub admin_person_id: PersonId,
pub reason: Option<String>,
}
+#[skip_serializing_none]
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
-#[cfg_attr(feature = "full", derive(Queryable, Identifiable))]
+#[cfg_attr(feature = "full", derive(Queryable, Identifiable, TS))]
#[cfg_attr(feature = "full", diesel(table_name = admin_purge_community))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct AdminPurgeCommunity {
pub id: i32,
pub admin_person_id: PersonId,
pub reason: Option<String>,
}
+#[skip_serializing_none]
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
-#[cfg_attr(feature = "full", derive(Queryable, Identifiable))]
+#[cfg_attr(feature = "full", derive(Queryable, Identifiable, TS))]
#[cfg_attr(feature = "full", diesel(table_name = admin_purge_post))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct AdminPurgePost {
pub id: i32,
pub admin_person_id: PersonId,
pub reason: Option<String>,
}
+#[skip_serializing_none]
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
-#[cfg_attr(feature = "full", derive(Queryable, Identifiable))]
+#[cfg_attr(feature = "full", derive(Queryable, Identifiable, TS))]
#[cfg_attr(feature = "full", diesel(table_name = admin_purge_comment))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct AdminPurgeComment {
pub id: i32,
pub admin_person_id: PersonId,
#[cfg(feature = "full")]
use crate::schema::{person, person_follower};
use serde::{Deserialize, Serialize};
+use serde_with::skip_serializing_none;
+#[cfg(feature = "full")]
+use ts_rs::TS;
use typed_builder::TypedBuilder;
+#[skip_serializing_none]
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
-#[cfg_attr(feature = "full", derive(Queryable, Identifiable))]
+#[cfg_attr(feature = "full", derive(Queryable, Identifiable, TS))]
#[cfg_attr(feature = "full", diesel(table_name = person))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct Person {
pub id: PersonId,
pub name: String,
#[cfg(feature = "full")]
use crate::schema::person_mention;
use serde::{Deserialize, Serialize};
+#[cfg(feature = "full")]
+use ts_rs::TS;
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
-#[cfg_attr(feature = "full", derive(Queryable, Associations, Identifiable))]
+#[cfg_attr(feature = "full", derive(Queryable, Associations, Identifiable, TS))]
#[cfg_attr(feature = "full", diesel(belongs_to(crate::source::comment::Comment)))]
#[cfg_attr(feature = "full", diesel(table_name = person_mention))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct PersonMention {
pub id: PersonMentionId,
pub recipient_id: PersonId,
#[cfg(feature = "full")]
use crate::schema::{post, post_like, post_read, post_saved};
use serde::{Deserialize, Serialize};
+use serde_with::skip_serializing_none;
+#[cfg(feature = "full")]
+use ts_rs::TS;
use typed_builder::TypedBuilder;
+#[skip_serializing_none]
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
-#[cfg_attr(feature = "full", derive(Queryable, Identifiable))]
+#[cfg_attr(feature = "full", derive(Queryable, Identifiable, TS))]
#[cfg_attr(feature = "full", diesel(table_name = post))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct Post {
pub id: PostId,
pub name: String,
+ #[cfg_attr(feature = "full", ts(type = "string"))]
pub url: Option<DbUrl>,
pub body: Option<String>,
pub creator_id: PersonId,
pub nsfw: bool,
pub embed_title: Option<String>,
pub embed_description: Option<String>,
+ #[cfg_attr(feature = "full", ts(type = "string"))]
pub thumbnail_url: Option<DbUrl>,
+ #[cfg_attr(feature = "full", ts(type = "string"))]
pub ap_id: DbUrl,
pub local: bool,
+ #[cfg_attr(feature = "full", ts(type = "string"))]
pub embed_video_url: Option<DbUrl>,
pub language_id: LanguageId,
pub featured_community: bool,
#[cfg(feature = "full")]
use crate::schema::post_report;
use serde::{Deserialize, Serialize};
+use serde_with::skip_serializing_none;
+#[cfg(feature = "full")]
+use ts_rs::TS;
+#[skip_serializing_none]
#[derive(PartialEq, Eq, Serialize, Deserialize, Debug, Clone)]
-#[cfg_attr(feature = "full", derive(Identifiable, Queryable, Associations))]
+#[cfg_attr(feature = "full", derive(Identifiable, Queryable, Associations, TS))]
#[cfg_attr(feature = "full", diesel(belongs_to(crate::source::post::Post)))] // Is this the right assoc?
#[cfg_attr(feature = "full", diesel(table_name = post_report))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct PostReport {
pub id: PostReportId,
pub creator_id: PersonId,
#[cfg(feature = "full")]
use crate::schema::private_message;
use serde::{Deserialize, Serialize};
+use serde_with::skip_serializing_none;
+#[cfg(feature = "full")]
+use ts_rs::TS;
use typed_builder::TypedBuilder;
+#[skip_serializing_none]
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
-#[cfg_attr(feature = "full", derive(Queryable, Associations, Identifiable))]
+#[cfg_attr(feature = "full", derive(Queryable, Associations, Identifiable, TS))]
#[cfg_attr(
feature = "full",
diesel(belongs_to(crate::source::person::Person, foreign_key = creator_id)
))] // Is this the right assoc?
#[cfg_attr(feature = "full", diesel(table_name = private_message))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct PrivateMessage {
pub id: PrivateMessageId,
pub creator_id: PersonId,
#[cfg(feature = "full")]
use crate::schema::private_message_report;
use serde::{Deserialize, Serialize};
+use serde_with::skip_serializing_none;
+#[cfg(feature = "full")]
+use ts_rs::TS;
+#[skip_serializing_none]
#[derive(PartialEq, Eq, Serialize, Deserialize, Debug, Clone)]
-#[cfg_attr(feature = "full", derive(Queryable, Associations, Identifiable))]
+#[cfg_attr(feature = "full", derive(Queryable, Associations, Identifiable, TS))]
#[cfg_attr(
feature = "full",
diesel(belongs_to(crate::source::private_message::PrivateMessage))
)]
#[cfg_attr(feature = "full", diesel(table_name = private_message_report))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct PrivateMessageReport {
pub id: PrivateMessageReportId,
pub creator_id: PersonId,
#[cfg(feature = "full")]
use crate::schema::registration_application;
use serde::{Deserialize, Serialize};
+use serde_with::skip_serializing_none;
+#[cfg(feature = "full")]
+use ts_rs::TS;
+#[skip_serializing_none]
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
-#[cfg_attr(feature = "full", derive(Queryable, Identifiable))]
+#[cfg_attr(feature = "full", derive(Queryable, Identifiable, TS))]
#[cfg_attr(feature = "full", diesel(table_name = registration_application))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct RegistrationApplication {
pub id: i32,
pub local_user_id: LocalUserId,
#[cfg(feature = "full")]
use crate::schema::site;
use serde::{Deserialize, Serialize};
+use serde_with::skip_serializing_none;
+#[cfg(feature = "full")]
+use ts_rs::TS;
use typed_builder::TypedBuilder;
+#[skip_serializing_none]
#[derive(PartialEq, Eq, Debug, Clone, Serialize, Deserialize)]
-#[cfg_attr(feature = "full", derive(Queryable, Identifiable))]
+#[cfg_attr(feature = "full", derive(Queryable, Identifiable, TS))]
#[cfg_attr(feature = "full", diesel(table_name = site))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct Site {
pub id: SiteId,
pub name: String,
#[cfg(feature = "full")]
use crate::schema::tagline;
use serde::{Deserialize, Serialize};
+use serde_with::skip_serializing_none;
+#[cfg(feature = "full")]
+use ts_rs::TS;
+#[skip_serializing_none]
#[derive(PartialEq, Eq, Debug, Clone, Serialize, Deserialize)]
-#[cfg_attr(feature = "full", derive(Queryable, Associations, Identifiable))]
+#[cfg_attr(feature = "full", derive(Queryable, Associations, Identifiable, TS))]
#[cfg_attr(feature = "full", diesel(table_name = tagline))]
#[cfg_attr(
feature = "full",
diesel(belongs_to(crate::source::local_site::LocalSite))
)]
+#[cfg_attr(feature = "full", ts(export))]
pub struct Tagline {
pub id: i32,
pub local_site_id: LocalSiteId,
doctest = false
[features]
-full = ["lemmy_db_schema/full", "diesel", "diesel-async", "diesel_ltree", "tracing"]
+full = ["lemmy_db_schema/full", "diesel", "diesel-async", "diesel_ltree", "tracing", "ts-rs"]
[dependencies]
lemmy_db_schema = { workspace = true }
diesel-async = { workspace = true, optional = true}
diesel_ltree = { workspace = true, optional = true}
serde = { workspace = true }
+serde_with = { workspace = true }
tracing = { workspace = true, optional = true }
typed-builder = { workspace = true }
+ts-rs = { workspace = true, optional = true }
[dev-dependencies]
serial_test = { workspace = true }
SubscribedType,
};
use serde::{Deserialize, Serialize};
+use serde_with::skip_serializing_none;
+#[cfg(feature = "full")]
+use ts_rs::TS;
+#[skip_serializing_none]
#[derive(Debug, PartialEq, Eq, Serialize, Deserialize, Clone)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct CommentReportView {
pub comment_report: CommentReport,
pub comment: Comment,
pub resolver: Option<Person>,
}
+#[skip_serializing_none]
#[derive(Debug, PartialEq, Eq, Serialize, Deserialize, Clone)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct CommentView {
pub comment: Comment,
pub creator: Person,
}
#[derive(Debug, Serialize, Deserialize, Clone)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct LocalUserView {
pub local_user: LocalUser,
pub person: Person,
pub counts: PersonAggregates,
}
+#[skip_serializing_none]
#[derive(Debug, PartialEq, Eq, Serialize, Deserialize, Clone)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct PostReportView {
pub post_report: PostReport,
pub post: Post,
pub resolver: Option<Person>,
}
+#[skip_serializing_none]
#[derive(Debug, PartialEq, Eq, Serialize, Deserialize, Clone)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct PostView {
pub post: Post,
pub creator: Person,
}
#[derive(Debug, PartialEq, Eq, Serialize, Deserialize, Clone)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct PrivateMessageView {
pub private_message: PrivateMessage,
pub creator: Person,
pub recipient: Person,
}
+#[skip_serializing_none]
#[derive(Debug, PartialEq, Eq, Serialize, Deserialize, Clone)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct PrivateMessageReportView {
pub private_message_report: PrivateMessageReport,
pub private_message: PrivateMessage,
pub resolver: Option<Person>,
}
+#[skip_serializing_none]
#[derive(Debug, PartialEq, Eq, Serialize, Deserialize, Clone)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct RegistrationApplicationView {
pub registration_application: RegistrationApplication,
pub creator_local_user: LocalUser,
}
#[derive(Debug, Serialize, Deserialize, Clone)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct SiteView {
pub site: Site,
pub local_site: LocalSite,
pub local_site_rate_limit: LocalSiteRateLimit,
pub counts: SiteAggregates,
}
+
#[derive(Debug, Serialize, Deserialize, Clone)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct CustomEmojiView {
pub custom_emoji: CustomEmoji,
pub keywords: Vec<CustomEmojiKeyword>,
doctest = false
[features]
-full = ["lemmy_db_schema/full", "diesel", "diesel-async"]
+full = ["lemmy_db_schema/full", "diesel", "diesel-async", "ts-rs"]
[dependencies]
lemmy_db_schema = { workspace = true }
diesel = { workspace = true, features = ["postgres","chrono","serde_json"], optional = true }
diesel-async = { workspace = true, features = ["postgres", "deadpool"], optional = true }
serde = { workspace = true }
+serde_with = { workspace = true }
typed-builder = { workspace = true }
+ts-rs = { workspace = true, optional = true }
SubscribedType,
};
use serde::{Deserialize, Serialize};
+use serde_with::skip_serializing_none;
+#[cfg(feature = "full")]
+use ts_rs::TS;
#[derive(Debug, Serialize, Deserialize, Clone)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct CommunityBlockView {
pub person: Person,
pub community: Community,
}
#[derive(Debug, Serialize, Deserialize, Clone)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct CommunityFollowerView {
pub community: Community,
pub follower: Person,
}
#[derive(Debug, Serialize, Deserialize, Clone)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct CommunityModeratorView {
pub community: Community,
pub moderator: Person,
}
#[derive(Debug, Serialize, Deserialize, Clone)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct CommunityView {
pub community: Community,
pub subscribed: SubscribedType,
}
#[derive(Debug, Serialize, Deserialize, Clone)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct PersonBlockView {
pub person: Person,
pub target: Person,
}
+#[skip_serializing_none]
#[derive(Debug, PartialEq, Eq, Serialize, Deserialize, Clone)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct PersonMentionView {
pub person_mention: PersonMention,
pub comment: Comment,
pub my_vote: Option<i16>, // Left join to CommentLike
}
+#[skip_serializing_none]
#[derive(Debug, PartialEq, Eq, Serialize, Deserialize, Clone)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct CommentReplyView {
pub comment_reply: CommentReply,
pub comment: Comment,
}
#[derive(Debug, Serialize, Deserialize, Clone)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct PersonView {
pub person: Person,
pub counts: PersonAggregates,
doctest = false
[features]
-full = ["lemmy_db_schema/full", "diesel", "diesel-async"]
+full = ["lemmy_db_schema/full", "diesel", "diesel-async", "ts-rs"]
[dependencies]
lemmy_db_schema = { workspace = true }
diesel = { workspace = true, features = ["postgres","chrono","serde_json"], optional = true }
diesel-async = { workspace = true, features = ["postgres", "deadpool"], optional = true }
serde = { workspace = true }
+serde_with = { workspace = true }
+ts-rs = { workspace = true, optional = true }
},
};
use serde::{Deserialize, Serialize};
+use serde_with::skip_serializing_none;
+#[cfg(feature = "full")]
+use ts_rs::TS;
+#[skip_serializing_none]
#[derive(Debug, Serialize, Deserialize, Clone)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct ModAddCommunityView {
pub mod_add_community: ModAddCommunity,
pub moderator: Option<Person>,
pub modded_person: Person,
}
+#[skip_serializing_none]
#[derive(Debug, Serialize, Deserialize, Clone)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct ModAddView {
pub mod_add: ModAdd,
pub moderator: Option<Person>,
pub modded_person: Person,
}
+#[skip_serializing_none]
#[derive(Debug, Serialize, Deserialize, Clone)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct ModBanFromCommunityView {
pub mod_ban_from_community: ModBanFromCommunity,
pub moderator: Option<Person>,
pub banned_person: Person,
}
+#[skip_serializing_none]
#[derive(Debug, Serialize, Deserialize, Clone)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct ModBanView {
pub mod_ban: ModBan,
pub moderator: Option<Person>,
pub banned_person: Person,
}
+#[skip_serializing_none]
#[derive(Debug, Serialize, Deserialize, Clone)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct ModHideCommunityView {
pub mod_hide_community: ModHideCommunity,
pub admin: Option<Person>,
pub community: Community,
}
+#[skip_serializing_none]
#[derive(Debug, Serialize, Deserialize, Clone)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct ModLockPostView {
pub mod_lock_post: ModLockPost,
pub moderator: Option<Person>,
pub community: Community,
}
+#[skip_serializing_none]
#[derive(Debug, Serialize, Deserialize, Clone)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct ModRemoveCommentView {
pub mod_remove_comment: ModRemoveComment,
pub moderator: Option<Person>,
pub community: Community,
}
+#[skip_serializing_none]
#[derive(Debug, Serialize, Deserialize, Clone)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct ModRemoveCommunityView {
pub mod_remove_community: ModRemoveCommunity,
pub moderator: Option<Person>,
pub community: Community,
}
+#[skip_serializing_none]
#[derive(Debug, Serialize, Deserialize, Clone)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct ModRemovePostView {
pub mod_remove_post: ModRemovePost,
pub moderator: Option<Person>,
pub community: Community,
}
+#[skip_serializing_none]
#[derive(Debug, Serialize, Deserialize, Clone)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct ModFeaturePostView {
pub mod_feature_post: ModFeaturePost,
pub moderator: Option<Person>,
pub community: Community,
}
+#[skip_serializing_none]
#[derive(Debug, Serialize, Deserialize, Clone)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct ModTransferCommunityView {
pub mod_transfer_community: ModTransferCommunity,
pub moderator: Option<Person>,
pub modded_person: Person,
}
+#[skip_serializing_none]
#[derive(Debug, Serialize, Deserialize, Clone)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct AdminPurgeCommentView {
pub admin_purge_comment: AdminPurgeComment,
pub admin: Option<Person>,
pub post: Post,
}
+#[skip_serializing_none]
#[derive(Debug, Serialize, Deserialize, Clone)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct AdminPurgeCommunityView {
pub admin_purge_community: AdminPurgeCommunity,
pub admin: Option<Person>,
}
+#[skip_serializing_none]
#[derive(Debug, Serialize, Deserialize, Clone)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct AdminPurgePersonView {
pub admin_purge_person: AdminPurgePerson,
pub admin: Option<Person>,
}
+#[skip_serializing_none]
#[derive(Debug, Serialize, Deserialize, Clone)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct AdminPurgePostView {
pub admin_purge_post: AdminPurgePost,
pub admin: Option<Person>,
pub community: Community,
}
+#[skip_serializing_none]
#[derive(Debug, Serialize, Deserialize, Clone, Copy)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
pub struct ModlogListParams {
pub community_id: Option<CommunityId>,
pub mod_person_id: Option<PersonId>,