diff --git a/package.json b/package.json index 256a9e3..4897077 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "lemmy-js-client", "description": "A javascript / typescript client for Lemmy", - "version": "0.20.0-alpha.10", + "version": "0.20.0-alpha.17", "author": "Dessalines ", "license": "AGPL-3.0", "main": "./dist/index.js", @@ -19,10 +19,10 @@ "url": "git+https://github.com/LemmyNet/lemmy-js-client.git" }, "devDependencies": { - "@types/node": "^22.1.0", - "@typescript-eslint/eslint-plugin": "^8.0.0", - "@typescript-eslint/parser": "^8.0.0", - "eslint": "^9.8.0", + "@types/node": "^22.7.4", + "@typescript-eslint/eslint-plugin": "^8.7.0", + "@typescript-eslint/parser": "^8.7.0", + "eslint": "^9.11.1", "eslint-plugin-prettier": "^5.2.1", "husky": "^9.1.4", "lint-staged": "^15.2.7", @@ -33,7 +33,7 @@ "sortpack": "^2.4.0", "typedoc": "^0.26.5", "typescript": "^5.5.4", - "typescript-eslint": "^8.0.0" + "typescript-eslint": "^8.7.0" }, "packageManager": "pnpm@9.11.0", "types": "./dist/index.d.ts", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 5487dbe..5ca1c76 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -9,16 +9,16 @@ importers: .: devDependencies: '@types/node': - specifier: ^22.1.0 + specifier: ^22.7.4 version: 22.7.4 '@typescript-eslint/eslint-plugin': - specifier: ^8.0.0 + specifier: ^8.7.0 version: 8.7.0(@typescript-eslint/parser@8.7.0(eslint@9.11.1)(typescript@5.6.2))(eslint@9.11.1)(typescript@5.6.2) '@typescript-eslint/parser': - specifier: ^8.0.0 + specifier: ^8.7.0 version: 8.7.0(eslint@9.11.1)(typescript@5.6.2) eslint: - specifier: ^9.8.0 + specifier: ^9.11.1 version: 9.11.1 eslint-plugin-prettier: specifier: ^5.2.1 @@ -51,7 +51,7 @@ importers: specifier: ^5.5.4 version: 5.6.2 typescript-eslint: - specifier: ^8.0.0 + specifier: ^8.7.0 version: 8.7.0(eslint@9.11.1)(typescript@5.6.2) packages: @@ -509,16 +509,16 @@ packages: eslint-config-prettier: optional: true - eslint-scope@8.1.0: - resolution: {integrity: sha512-14dSvlhaVhKKsa9Fx1l8A17s7ah7Ef7wCakJ10LYk6+GYmP9yDti2oq2SEwcyndt6knfcZyhyxwY3i9yL78EQw==} + eslint-scope@8.0.2: + resolution: {integrity: sha512-6E4xmrTw5wtxnLA5wYL3WDfhZ/1bUBGOXV0zQvVRDOtrR8D0p6W7fs3JweNYhwRYeGvd/1CKX2se0/2s7Q/nJA==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} eslint-visitor-keys@3.4.3: resolution: {integrity: sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} - eslint-visitor-keys@4.1.0: - resolution: {integrity: sha512-Q7lok0mqMUSf5a/AdAZkA5a/gHcO6snwQClVNNvFKCAVlxXucdU8pKydU5ZVZjBx5xr37vGbFFWtLQYreLzrZg==} + eslint-visitor-keys@4.0.0: + resolution: {integrity: sha512-OtIRv/2GyiF6o/d8K7MYKKbXrOUBIK6SfkIRM4Z0dY3w+LiQ0vy3F57m0Z71bjbyeiWFiHJ8brqnmE6H6/jEuw==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} eslint@9.11.1: @@ -531,8 +531,8 @@ packages: jiti: optional: true - espree@10.2.0: - resolution: {integrity: sha512-upbkBJbckcCNBDBDXEbuhjbP68n+scUd3k/U2EkyM9nw+I/jPiL4cLF/Al06CF96wRltFda16sxDFrxsI1v0/g==} + espree@10.1.0: + resolution: {integrity: sha512-M1M6CpiE6ffoigIOWYO9UDP8TMUw9kqb21tf+08IgDYjCsOvCuDt4jQcZmoYxx+w7zlKw9/N0KXfto+I8/FrXA==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} esprima@4.0.1: @@ -1337,7 +1337,7 @@ snapshots: dependencies: ajv: 6.12.6 debug: 4.3.7 - espree: 10.2.0 + espree: 10.1.0 globals: 14.0.0 ignore: 5.3.2 import-fresh: 3.3.0 @@ -1674,14 +1674,14 @@ snapshots: optionalDependencies: eslint-config-prettier: 9.1.0(eslint@9.11.1) - eslint-scope@8.1.0: + eslint-scope@8.0.2: dependencies: esrecurse: 4.3.0 estraverse: 5.3.0 eslint-visitor-keys@3.4.3: {} - eslint-visitor-keys@4.1.0: {} + eslint-visitor-keys@4.0.0: {} eslint@9.11.1: dependencies: @@ -1702,9 +1702,9 @@ snapshots: cross-spawn: 7.0.3 debug: 4.3.7 escape-string-regexp: 4.0.0 - eslint-scope: 8.1.0 - eslint-visitor-keys: 4.1.0 - espree: 10.2.0 + eslint-scope: 8.0.2 + eslint-visitor-keys: 4.0.0 + espree: 10.1.0 esquery: 1.6.0 esutils: 2.0.3 fast-deep-equal: 3.1.3 @@ -1725,11 +1725,11 @@ snapshots: transitivePeerDependencies: - supports-color - espree@10.2.0: + espree@10.1.0: dependencies: acorn: 8.12.1 acorn-jsx: 5.3.2(acorn@8.12.1) - eslint-visitor-keys: 4.1.0 + eslint-visitor-keys: 4.0.0 esprima@4.0.1: {} diff --git a/putTypesInIndex.js b/putTypesInIndex.js index 7936d29..8d41ef8 100644 --- a/putTypesInIndex.js +++ b/putTypesInIndex.js @@ -3,7 +3,10 @@ const path = require("path"); const exportRegex = /export\s+(?:enum|interface|type)\s+([A-Za-z0-9_]+)/g; -const baseExports = ['export * from "./http";']; +const baseExports = [ + 'export * from "./http";', + 'export {UploadImage,UploadImageResponse,ImageFile,DeleteImage} from "./other_types";', +]; async function putTypesInIndex() { const typeFiles = await fs.readdir(path.resolve("./src/types")); diff --git a/src/http.ts b/src/http.ts index c95eaf9..fbc4ef5 100644 --- a/src/http.ts +++ b/src/http.ts @@ -145,6 +145,14 @@ import { ListMedia } from "./types/ListMedia"; import { ListMediaResponse } from "./types/ListMediaResponse"; import { AuthenticateWithOauth } from "./types/AuthenticateWithOauth"; import { GetRegistrationApplication } from "./types/GetRegistrationApplication"; +import { CreateTagline } from "./types/CreateTagline"; +import { TaglineResponse } from "./types/TaglineResponse"; +import { UpdateTagline } from "./types/UpdateTagline"; +import { DeleteTagline } from "./types/DeleteTagline"; +import { ListTaglines } from "./types/ListTaglines"; +import { ListTaglinesResponse } from "./types/ListTaglinesResponse"; +import { ListCustomEmojis } from "./types/ListCustomEmojis"; +import { ListCustomEmojisResponse } from "./types/ListCustomEmojisResponse"; enum HttpType { Get = "GET", @@ -1439,6 +1447,71 @@ export class LemmyHttp { ); } + /** + * List custom emojis + * + * `HTTP.GET /custom_emoji/list` + */ + listCustomEmojis(form: ListCustomEmojis) { + return this.#wrapper( + HttpType.Get, + "/custom_emoji/list", + form, + ); + } + + /** + * Create a new tagline + * + * `HTTP.POST /admin/tagline` + */ + createTagline(form: CreateTagline) { + return this.#wrapper( + HttpType.Post, + "/admin/tagline", + form, + ); + } + + /** + * Edit an existing tagline + * + * `HTTP.PUT /admin/tagline` + */ + editTagline(form: UpdateTagline) { + return this.#wrapper( + HttpType.Put, + "/admin/tagline", + form, + ); + } + + /** + * Delete a tagline + * + * `HTTP.Post /admin/tagline/delete` + */ + deleteTagline(form: DeleteTagline) { + return this.#wrapper( + HttpType.Post, + "/admin/tagline/delete", + form, + ); + } + + /** + * List taglines + * + * `HTTP.GET /admin/tagline/list` + */ + listTaglines(form: ListTaglines) { + return this.#wrapper( + HttpType.Get, + "/admin/tagline/list", + form, + ); + } + /** * Create a new oauth provider method * diff --git a/src/index.ts b/src/index.ts index 81badb8..f3d0b1b 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,4 +1,10 @@ export * from "./http"; +export { + UploadImage, + UploadImageResponse, + ImageFile, + DeleteImage, +} from "./other_types"; export { ActivityId } from "./types/ActivityId"; export { AddAdmin } from "./types/AddAdmin"; export { AddAdminResponse } from "./types/AddAdminResponse"; @@ -193,8 +199,6 @@ export { MyUserInfo } from "./types/MyUserInfo"; export { OAuthAccount } from "./types/OAuthAccount"; export { OAuthProvider } from "./types/OAuthProvider"; export { OAuthProviderId } from "./types/OAuthProviderId"; -export { OAuthProviderInsertForm } from "./types/OAuthProviderInsertForm"; -export { OAuthProviderUpdateForm } from "./types/OAuthProviderUpdateForm"; export { OpenGraphData } from "./types/OpenGraphData"; export { PaginationCursor } from "./types/PaginationCursor"; export { PasswordChangeAfterReset } from "./types/PasswordChangeAfterReset"; @@ -270,9 +274,3 @@ export { UpdateTotp } from "./types/UpdateTotp"; export { UpdateTotpResponse } from "./types/UpdateTotpResponse"; export { VerifyEmail } from "./types/VerifyEmail"; export { VoteView } from "./types/VoteView"; -export { - UploadImage, - UploadImageResponse, - ImageFile, - DeleteImage, -} from "./other_types"; diff --git a/src/types/CreateOAuthProvider.ts b/src/types/CreateOAuthProvider.ts index 5ad31d3..4d14f3c 100644 --- a/src/types/CreateOAuthProvider.ts +++ b/src/types/CreateOAuthProvider.ts @@ -10,7 +10,7 @@ export interface CreateOAuthProvider { client_id: string; client_secret: string; scopes: string; - auto_verify_email: boolean; - account_linking_enabled: boolean; - enabled: boolean; + auto_verify_email?: boolean; + account_linking_enabled?: boolean; + enabled?: boolean; } diff --git a/src/types/EditOAuthProvider.ts b/src/types/EditOAuthProvider.ts index c90c2fc..e76520a 100644 --- a/src/types/EditOAuthProvider.ts +++ b/src/types/EditOAuthProvider.ts @@ -3,14 +3,14 @@ import type { OAuthProviderId } from "./OAuthProviderId"; export interface EditOAuthProvider { id: OAuthProviderId; - display_name: string | null; - authorization_endpoint: string | null; - token_endpoint: string | null; - userinfo_endpoint: string | null; - id_claim: string | null; - client_secret: string | null; - scopes: string | null; - auto_verify_email: boolean | null; - account_linking_enabled: boolean | null; - enabled: boolean | null; + display_name?: string; + authorization_endpoint?: string; + token_endpoint?: string; + userinfo_endpoint?: string; + id_claim?: string; + client_secret?: string; + scopes?: string; + auto_verify_email?: boolean; + account_linking_enabled?: boolean; + enabled?: boolean; } diff --git a/src/types/LemmyErrorType.ts b/src/types/LemmyErrorType.ts index 059c28d..6be9272 100644 --- a/src/types/LemmyErrorType.ts +++ b/src/types/LemmyErrorType.ts @@ -159,7 +159,7 @@ export type LemmyErrorType = | { error: "couldnt_delete_oauth_provider" } | { error: "unknown"; message: string } | { error: "cant_delete_site" } + | { error: "url_length_overflow" } | { error: "post_schedule_time_must_be_in_future" } | { error: "too_many_scheduled_posts" } - | { error: "url_length_overflow" } | { error: "not_found" }; diff --git a/src/types/LocalUser.ts b/src/types/LocalUser.ts index 773e4af..7abd575 100644 --- a/src/types/LocalUser.ts +++ b/src/types/LocalUser.ts @@ -23,7 +23,6 @@ export interface LocalUser { accepted_application: boolean; open_links_in_new_tab: boolean; blur_nsfw: boolean; - auto_expand: boolean; infinite_scroll_enabled: boolean; admin: boolean; post_listing_mode: PostListingMode; diff --git a/src/types/OAuthProviderInsertForm.ts b/src/types/OAuthProviderInsertForm.ts deleted file mode 100644 index 0a8d182..0000000 --- a/src/types/OAuthProviderInsertForm.ts +++ /dev/null @@ -1,16 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -export interface OAuthProviderInsertForm { - display_name: string; - issuer: string; - authorization_endpoint: string; - token_endpoint: string; - userinfo_endpoint: string; - id_claim: string; - client_id: string; - client_secret: string; - scopes: string; - auto_verify_email: boolean; - account_linking_enabled: boolean; - enabled: boolean; -} diff --git a/src/types/OAuthProviderUpdateForm.ts b/src/types/OAuthProviderUpdateForm.ts deleted file mode 100644 index c25f8d3..0000000 --- a/src/types/OAuthProviderUpdateForm.ts +++ /dev/null @@ -1,15 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -export interface OAuthProviderUpdateForm { - display_name: string | null; - authorization_endpoint: string; - token_endpoint: string; - userinfo_endpoint: string; - id_claim: string | null; - client_secret: string | null; - scopes: string | null; - auto_verify_email: boolean | null; - account_linking_enabled: boolean | null; - enabled: boolean | null; - updated: string | null | null; -} diff --git a/src/types/Post.ts b/src/types/Post.ts index 107adb2..0a659f6 100644 --- a/src/types/Post.ts +++ b/src/types/Post.ts @@ -28,5 +28,5 @@ export interface Post { featured_local: boolean; url_content_type?: string; alt_text?: string; - scheduled_publish_time?: number; + scheduled_publish_time?: string; } diff --git a/src/types/SaveUserSettings.ts b/src/types/SaveUserSettings.ts index b5cc617..6d95e00 100644 --- a/src/types/SaveUserSettings.ts +++ b/src/types/SaveUserSettings.ts @@ -8,7 +8,6 @@ import type { PostSortType } from "./PostSortType"; export interface SaveUserSettings { show_nsfw?: boolean; blur_nsfw?: boolean; - auto_expand?: boolean; theme?: string; default_listing_type?: ListingType; post_listing_mode?: PostListingMode; diff --git a/src/types/Search.ts b/src/types/Search.ts index 5e37d71..c19f30c 100644 --- a/src/types/Search.ts +++ b/src/types/Search.ts @@ -15,5 +15,9 @@ export interface Search { listing_type?: ListingType; page?: number; limit?: number; - post_title_only?: boolean; + title_only?: boolean; + post_url_only?: boolean; + saved_only?: boolean; + liked_only?: boolean; + disliked_only?: boolean; } diff --git a/src/types/SearchType.ts b/src/types/SearchType.ts index 82d9308..a000653 100644 --- a/src/types/SearchType.ts +++ b/src/types/SearchType.ts @@ -1,9 +1,3 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -export type SearchType = - | "All" - | "Comments" - | "Posts" - | "Communities" - | "Users" - | "Url"; +export type SearchType = "All" | "Comments" | "Posts" | "Communities" | "Users";