diff --git a/.woodpecker.yml b/.woodpecker.yml index 07258c9..63aeaf5 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -20,12 +20,14 @@ steps: npm_publish: image: node:alpine + environment: + NPM_TOKEN: + from_secret: npm_token commands: - *install_pnpm - pnpm i - echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> .npmrc - echo "email = tyhou13@gmx.com" >> ~/.npmrc - npm publish - secrets: [npm_token] when: - event: tag diff --git a/package.json b/package.json index dd86eb4..a1eda16 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-reports-combined.2", + "version": "0.20.0-api-v4.17", "author": "Dessalines ", "license": "AGPL-3.0", "main": "./dist/index.js", @@ -35,7 +35,7 @@ "typescript": "^5.5.4", "typescript-eslint": "^8.7.0" }, - "packageManager": "pnpm@9.14.4", + "packageManager": "pnpm@9.15.0", "types": "./dist/index.d.ts", "lint-staged": { "*.{ts,tsx,js}": [ diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index f7d4169..92665cd 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -13,16 +13,16 @@ importers: version: 22.10.1 '@typescript-eslint/eslint-plugin': specifier: ^8.7.0 - version: 8.16.0(@typescript-eslint/parser@8.16.0(eslint@9.16.0)(typescript@5.7.2))(eslint@9.16.0)(typescript@5.7.2) + version: 8.17.0(@typescript-eslint/parser@8.17.0(eslint@9.16.0)(typescript@5.7.2))(eslint@9.16.0)(typescript@5.7.2) '@typescript-eslint/parser': specifier: ^8.7.0 - version: 8.16.0(eslint@9.16.0)(typescript@5.7.2) + version: 8.17.0(eslint@9.16.0)(typescript@5.7.2) eslint: specifier: ^9.11.1 version: 9.16.0 eslint-plugin-prettier: specifier: ^5.2.1 - version: 5.2.1(eslint-config-prettier@9.1.0(eslint@9.16.0))(eslint@9.16.0)(prettier@3.4.1) + version: 5.2.1(eslint-config-prettier@9.1.0(eslint@9.16.0))(eslint@9.16.0)(prettier@3.4.2) husky: specifier: ^9.1.4 version: 9.1.7 @@ -31,28 +31,28 @@ importers: version: 15.2.10 prettier: specifier: ^3.3.3 - version: 3.4.1 + version: 3.4.2 prettier-plugin-import-sort: specifier: ^0.0.7 - version: 0.0.7(prettier@3.4.1) + version: 0.0.7(prettier@3.4.2) prettier-plugin-organize-imports: specifier: ^4.0.0 - version: 4.1.0(prettier@3.4.1)(typescript@5.7.2) + version: 4.1.0(prettier@3.4.2)(typescript@5.7.2) prettier-plugin-packagejson: specifier: ^2.5.1 - version: 2.5.6(prettier@3.4.1) + version: 2.5.6(prettier@3.4.2) sortpack: specifier: ^2.4.0 version: 2.4.0 typedoc: specifier: ^0.27.0 - version: 0.27.2(typescript@5.7.2) + version: 0.27.3(typescript@5.7.2) typescript: specifier: ^5.5.4 version: 5.7.2 typescript-eslint: specifier: ^8.7.0 - version: 8.16.0(eslint@9.16.0)(typescript@5.7.2) + version: 8.17.0(eslint@9.16.0)(typescript@5.7.2) packages: @@ -246,8 +246,8 @@ packages: '@types/unist@3.0.3': resolution: {integrity: sha512-ko/gIFJRv177XgZsZcBwnqJN5x/Gien8qNOn0D5bQU/zAzVf9Zt3BlcUiLqhV9y4ARk0GbT3tnUiPNgnTXzc/Q==} - '@typescript-eslint/eslint-plugin@8.16.0': - resolution: {integrity: sha512-5YTHKV8MYlyMI6BaEG7crQ9BhSc8RxzshOReKwZwRWN0+XvvTOm+L/UYLCYxFpfwYuAAqhxiq4yae0CMFwbL7Q==} + '@typescript-eslint/eslint-plugin@8.17.0': + resolution: {integrity: sha512-HU1KAdW3Tt8zQkdvNoIijfWDMvdSweFYm4hWh+KwhPstv+sCmWb89hCIP8msFm9N1R/ooh9honpSuvqKWlYy3w==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} peerDependencies: '@typescript-eslint/parser': ^8.0.0 || ^8.0.0-alpha.0 @@ -257,8 +257,8 @@ packages: typescript: optional: true - '@typescript-eslint/parser@8.16.0': - resolution: {integrity: sha512-D7DbgGFtsqIPIFMPJwCad9Gfi/hC0PWErRRHFnaCWoEDYi5tQUDiJCTmGUbBiLzjqAck4KcXt9Ayj0CNlIrF+w==} + '@typescript-eslint/parser@8.17.0': + resolution: {integrity: sha512-Drp39TXuUlD49F7ilHHCG7TTg8IkA+hxCuULdmzWYICxGXvDXmDmWEjJYZQYgf6l/TFfYNE167m7isnc3xlIEg==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} peerDependencies: eslint: ^8.57.0 || ^9.0.0 @@ -267,12 +267,12 @@ packages: typescript: optional: true - '@typescript-eslint/scope-manager@8.16.0': - resolution: {integrity: sha512-mwsZWubQvBki2t5565uxF0EYvG+FwdFb8bMtDuGQLdCCnGPrDEDvm1gtfynuKlnpzeBRqdFCkMf9jg1fnAK8sg==} + '@typescript-eslint/scope-manager@8.17.0': + resolution: {integrity: sha512-/ewp4XjvnxaREtqsZjF4Mfn078RD/9GmiEAtTeLQ7yFdKnqwTOgRMSvFz4et9U5RiJQ15WTGXPLj89zGusvxBg==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - '@typescript-eslint/type-utils@8.16.0': - resolution: {integrity: sha512-IqZHGG+g1XCWX9NyqnI/0CX5LL8/18awQqmkZSl2ynn8F76j579dByc0jhfVSnSnhf7zv76mKBQv9HQFKvDCgg==} + '@typescript-eslint/type-utils@8.17.0': + resolution: {integrity: sha512-q38llWJYPd63rRnJ6wY/ZQqIzPrBCkPdpIsaCfkR3Q4t3p6sb422zougfad4TFW9+ElIFLVDzWGiGAfbb/v2qw==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} peerDependencies: eslint: ^8.57.0 || ^9.0.0 @@ -281,12 +281,12 @@ packages: typescript: optional: true - '@typescript-eslint/types@8.16.0': - resolution: {integrity: sha512-NzrHj6thBAOSE4d9bsuRNMvk+BvaQvmY4dDglgkgGC0EW/tB3Kelnp3tAKH87GEwzoxgeQn9fNGRyFJM/xd+GQ==} + '@typescript-eslint/types@8.17.0': + resolution: {integrity: sha512-gY2TVzeve3z6crqh2Ic7Cr+CAv6pfb0Egee7J5UAVWCpVvDI/F71wNfolIim4FE6hT15EbpZFVUj9j5i38jYXA==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - '@typescript-eslint/typescript-estree@8.16.0': - resolution: {integrity: sha512-E2+9IzzXMc1iaBy9zmo+UYvluE3TW7bCGWSF41hVWUE01o8nzr1rvOQYSxelxr6StUvRcTMe633eY8mXASMaNw==} + '@typescript-eslint/typescript-estree@8.17.0': + resolution: {integrity: sha512-JqkOopc1nRKZpX+opvKqnM3XUlM7LpFMD0lYxTqOTKQfCWAmxw45e3qlOCsEqEB2yuacujivudOFpCnqkBDNMw==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} peerDependencies: typescript: '*' @@ -294,8 +294,8 @@ packages: typescript: optional: true - '@typescript-eslint/utils@8.16.0': - resolution: {integrity: sha512-C1zRy/mOL8Pj157GiX4kaw7iyRLKfJXBR3L82hk5kS/GyHcOFmy4YUq/zfZti72I9wnuQtA/+xzft4wCC8PJdA==} + '@typescript-eslint/utils@8.17.0': + resolution: {integrity: sha512-bQC8BnEkxqG8HBGKwG9wXlZqg37RKSMY7v/X8VEWD8JG2JuTHuNK0VFvMPMUKQcbk6B+tf05k+4AShAEtCtJ/w==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} peerDependencies: eslint: ^8.57.0 || ^9.0.0 @@ -304,8 +304,8 @@ packages: typescript: optional: true - '@typescript-eslint/visitor-keys@8.16.0': - resolution: {integrity: sha512-pq19gbaMOmFE3CbL0ZB8J8BFCo2ckfHBfaIsaOZgBIF4EoISJIdLX5xRhd0FGB0LlHReNRuzoJoMGpTjq8F2CQ==} + '@typescript-eslint/visitor-keys@8.17.0': + resolution: {integrity: sha512-1Hm7THLpO6ww5QU6H/Qp+AusUUl+z/CAm3cNZZ0jQvon9yicgO7Rwd+/WWRpMKLYV6p2UvdbR27c86rzCPpreg==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} acorn-jsx@5.3.2: @@ -988,8 +988,8 @@ packages: prettier: optional: true - prettier@3.4.1: - resolution: {integrity: sha512-G+YdqtITVZmOJje6QkXQWzl3fSfMxFwm1tjTyo9exhkmWSqC4Yhd1+lug++IlR2mvRVAxEDDWYkQdeSztajqgg==} + prettier@3.4.2: + resolution: {integrity: sha512-e9MewbtFo+Fevyuxn/4rrcDAaq0IYxPGLvObpQjiZBMAzB9IGmzlnG9RZy3FFas+eBMu2vA0CszMeduow5dIuQ==} engines: {node: '>=14'} hasBin: true @@ -1142,15 +1142,15 @@ packages: resolution: {integrity: sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==} engines: {node: '>= 0.8.0'} - typedoc@0.27.2: - resolution: {integrity: sha512-C2ima5TZJHU3ecnRIz50lKd1BsYck5LhYQIy7MRPmjuSEJreUEAt+uAVcZgY7wZsSORzEI7xW8miZIdxv/cbmw==} + typedoc@0.27.3: + resolution: {integrity: sha512-oWT7zDS5oIaxYL5yOikBX4cL99CpNAZn6mI24JZQxsYuIHbtguSSwJ7zThuzNNwSE0wqhlfTSd99HgqKu2aQXQ==} engines: {node: '>= 18'} hasBin: true peerDependencies: typescript: 5.0.x || 5.1.x || 5.2.x || 5.3.x || 5.4.x || 5.5.x || 5.6.x || 5.7.x - typescript-eslint@8.16.0: - resolution: {integrity: sha512-wDkVmlY6O2do4V+lZd0GtRfbtXbeD0q9WygwXXSJnC1xorE8eqyC2L1tJimqpSeFrOzRlYtWnUp/uzgHQOgfBQ==} + typescript-eslint@8.17.0: + resolution: {integrity: sha512-409VXvFd/f1br1DCbuKNFqQpXICoTB+V51afcwG1pn1a3Cp92MqAUges3YjwEdQ0cMUoCIodjVDAYzyD8h3SYA==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} peerDependencies: eslint: ^8.57.0 || ^9.0.0 @@ -1448,14 +1448,14 @@ snapshots: '@types/unist@3.0.3': {} - '@typescript-eslint/eslint-plugin@8.16.0(@typescript-eslint/parser@8.16.0(eslint@9.16.0)(typescript@5.7.2))(eslint@9.16.0)(typescript@5.7.2)': + '@typescript-eslint/eslint-plugin@8.17.0(@typescript-eslint/parser@8.17.0(eslint@9.16.0)(typescript@5.7.2))(eslint@9.16.0)(typescript@5.7.2)': dependencies: '@eslint-community/regexpp': 4.12.1 - '@typescript-eslint/parser': 8.16.0(eslint@9.16.0)(typescript@5.7.2) - '@typescript-eslint/scope-manager': 8.16.0 - '@typescript-eslint/type-utils': 8.16.0(eslint@9.16.0)(typescript@5.7.2) - '@typescript-eslint/utils': 8.16.0(eslint@9.16.0)(typescript@5.7.2) - '@typescript-eslint/visitor-keys': 8.16.0 + '@typescript-eslint/parser': 8.17.0(eslint@9.16.0)(typescript@5.7.2) + '@typescript-eslint/scope-manager': 8.17.0 + '@typescript-eslint/type-utils': 8.17.0(eslint@9.16.0)(typescript@5.7.2) + '@typescript-eslint/utils': 8.17.0(eslint@9.16.0)(typescript@5.7.2) + '@typescript-eslint/visitor-keys': 8.17.0 eslint: 9.16.0 graphemer: 1.4.0 ignore: 5.3.2 @@ -1466,12 +1466,12 @@ snapshots: transitivePeerDependencies: - supports-color - '@typescript-eslint/parser@8.16.0(eslint@9.16.0)(typescript@5.7.2)': + '@typescript-eslint/parser@8.17.0(eslint@9.16.0)(typescript@5.7.2)': dependencies: - '@typescript-eslint/scope-manager': 8.16.0 - '@typescript-eslint/types': 8.16.0 - '@typescript-eslint/typescript-estree': 8.16.0(typescript@5.7.2) - '@typescript-eslint/visitor-keys': 8.16.0 + '@typescript-eslint/scope-manager': 8.17.0 + '@typescript-eslint/types': 8.17.0 + '@typescript-eslint/typescript-estree': 8.17.0(typescript@5.7.2) + '@typescript-eslint/visitor-keys': 8.17.0 debug: 4.3.7 eslint: 9.16.0 optionalDependencies: @@ -1479,15 +1479,15 @@ snapshots: transitivePeerDependencies: - supports-color - '@typescript-eslint/scope-manager@8.16.0': + '@typescript-eslint/scope-manager@8.17.0': dependencies: - '@typescript-eslint/types': 8.16.0 - '@typescript-eslint/visitor-keys': 8.16.0 + '@typescript-eslint/types': 8.17.0 + '@typescript-eslint/visitor-keys': 8.17.0 - '@typescript-eslint/type-utils@8.16.0(eslint@9.16.0)(typescript@5.7.2)': + '@typescript-eslint/type-utils@8.17.0(eslint@9.16.0)(typescript@5.7.2)': dependencies: - '@typescript-eslint/typescript-estree': 8.16.0(typescript@5.7.2) - '@typescript-eslint/utils': 8.16.0(eslint@9.16.0)(typescript@5.7.2) + '@typescript-eslint/typescript-estree': 8.17.0(typescript@5.7.2) + '@typescript-eslint/utils': 8.17.0(eslint@9.16.0)(typescript@5.7.2) debug: 4.3.7 eslint: 9.16.0 ts-api-utils: 1.4.3(typescript@5.7.2) @@ -1496,12 +1496,12 @@ snapshots: transitivePeerDependencies: - supports-color - '@typescript-eslint/types@8.16.0': {} + '@typescript-eslint/types@8.17.0': {} - '@typescript-eslint/typescript-estree@8.16.0(typescript@5.7.2)': + '@typescript-eslint/typescript-estree@8.17.0(typescript@5.7.2)': dependencies: - '@typescript-eslint/types': 8.16.0 - '@typescript-eslint/visitor-keys': 8.16.0 + '@typescript-eslint/types': 8.17.0 + '@typescript-eslint/visitor-keys': 8.17.0 debug: 4.3.7 fast-glob: 3.3.2 is-glob: 4.0.3 @@ -1513,21 +1513,21 @@ snapshots: transitivePeerDependencies: - supports-color - '@typescript-eslint/utils@8.16.0(eslint@9.16.0)(typescript@5.7.2)': + '@typescript-eslint/utils@8.17.0(eslint@9.16.0)(typescript@5.7.2)': dependencies: '@eslint-community/eslint-utils': 4.4.1(eslint@9.16.0) - '@typescript-eslint/scope-manager': 8.16.0 - '@typescript-eslint/types': 8.16.0 - '@typescript-eslint/typescript-estree': 8.16.0(typescript@5.7.2) + '@typescript-eslint/scope-manager': 8.17.0 + '@typescript-eslint/types': 8.17.0 + '@typescript-eslint/typescript-estree': 8.17.0(typescript@5.7.2) eslint: 9.16.0 optionalDependencies: typescript: 5.7.2 transitivePeerDependencies: - supports-color - '@typescript-eslint/visitor-keys@8.16.0': + '@typescript-eslint/visitor-keys@8.17.0': dependencies: - '@typescript-eslint/types': 8.16.0 + '@typescript-eslint/types': 8.17.0 eslint-visitor-keys: 4.2.0 acorn-jsx@5.3.2(acorn@8.14.0): @@ -1703,10 +1703,10 @@ snapshots: eslint: 9.16.0 optional: true - eslint-plugin-prettier@5.2.1(eslint-config-prettier@9.1.0(eslint@9.16.0))(eslint@9.16.0)(prettier@3.4.1): + eslint-plugin-prettier@5.2.1(eslint-config-prettier@9.1.0(eslint@9.16.0))(eslint@9.16.0)(prettier@3.4.2): dependencies: eslint: 9.16.0 - prettier: 3.4.1 + prettier: 3.4.2 prettier-linter-helpers: 1.0.0 synckit: 0.9.1 optionalDependencies: @@ -2141,29 +2141,29 @@ snapshots: dependencies: fast-diff: 1.3.0 - prettier-plugin-import-sort@0.0.7(prettier@3.4.1): + prettier-plugin-import-sort@0.0.7(prettier@3.4.2): dependencies: import-sort: 6.0.0 import-sort-config: 6.0.0 import-sort-parser-babylon: 6.0.0 import-sort-parser-typescript: 6.0.0 - prettier: 3.4.1 + prettier: 3.4.2 transitivePeerDependencies: - supports-color - prettier-plugin-organize-imports@4.1.0(prettier@3.4.1)(typescript@5.7.2): + prettier-plugin-organize-imports@4.1.0(prettier@3.4.2)(typescript@5.7.2): dependencies: - prettier: 3.4.1 + prettier: 3.4.2 typescript: 5.7.2 - prettier-plugin-packagejson@2.5.6(prettier@3.4.1): + prettier-plugin-packagejson@2.5.6(prettier@3.4.2): dependencies: sort-package-json: 2.12.0 synckit: 0.9.2 optionalDependencies: - prettier: 3.4.1 + prettier: 3.4.2 - prettier@3.4.1: {} + prettier@3.4.2: {} punycode.js@2.3.1: {} @@ -2292,7 +2292,7 @@ snapshots: dependencies: prelude-ls: 1.2.1 - typedoc@0.27.2(typescript@5.7.2): + typedoc@0.27.3(typescript@5.7.2): dependencies: '@gerrit0/mini-shiki': 1.24.1 lunr: 2.3.9 @@ -2301,11 +2301,11 @@ snapshots: typescript: 5.7.2 yaml: 2.6.1 - typescript-eslint@8.16.0(eslint@9.16.0)(typescript@5.7.2): + typescript-eslint@8.17.0(eslint@9.16.0)(typescript@5.7.2): dependencies: - '@typescript-eslint/eslint-plugin': 8.16.0(@typescript-eslint/parser@8.16.0(eslint@9.16.0)(typescript@5.7.2))(eslint@9.16.0)(typescript@5.7.2) - '@typescript-eslint/parser': 8.16.0(eslint@9.16.0)(typescript@5.7.2) - '@typescript-eslint/utils': 8.16.0(eslint@9.16.0)(typescript@5.7.2) + '@typescript-eslint/eslint-plugin': 8.17.0(@typescript-eslint/parser@8.17.0(eslint@9.16.0)(typescript@5.7.2))(eslint@9.16.0)(typescript@5.7.2) + '@typescript-eslint/parser': 8.17.0(eslint@9.16.0)(typescript@5.7.2) + '@typescript-eslint/utils': 8.17.0(eslint@9.16.0)(typescript@5.7.2) eslint: 9.16.0 optionalDependencies: typescript: 5.7.2 diff --git a/src/http.ts b/src/http.ts index 4fbc926..c0b7294 100644 --- a/src/http.ts +++ b/src/http.ts @@ -5,6 +5,7 @@ import { AddModToCommunityResponse } from "./types/AddModToCommunityResponse"; import { ApproveRegistrationApplication } from "./types/ApproveRegistrationApplication"; import { BanFromCommunity } from "./types/BanFromCommunity"; import { BanFromCommunityResponse } from "./types/BanFromCommunityResponse"; +import { MarkManyPostsAsRead } from "./types/MarkManyPostsAsRead"; import { BanPerson } from "./types/BanPerson"; import { BanPersonResponse } from "./types/BanPersonResponse"; import { BannedPersonsResponse } from "./types/BannedPersonsResponse"; @@ -154,6 +155,7 @@ import { ListCommunityPendingFollows } from "./types/ListCommunityPendingFollows import { CommunityId } from "./types/CommunityId"; import { ListReports } from "./types/ListReports"; import { ListReportsResponse } from "./types/ListReportsResponse"; +import { MyUserInfo } from "./types/MyUserInfo"; import { UserBlockInstanceParams } from "./types/UserBlockInstanceParams"; import { AdminAllowInstanceParams } from "./types/AdminAllowInstanceParams"; import { AdminBlockInstanceParams } from "./types/AdminBlockInstanceParams"; @@ -243,12 +245,12 @@ export class LemmyHttp { /** * Leave the Site admins. * - * `HTTP.POST /user/leave_admin` + * `HTTP.POST /admin/leave` */ leaveAdmin(options?: RequestOptions) { return this.#wrapper( HttpType.Post, - "/user/leave_admin", + "/admin/leave", {}, options, ); @@ -257,14 +259,28 @@ export class LemmyHttp { /** * Generate a TOTP / two-factor secret. * - * Afterwards you need to call `/user/totp/update` with a valid token to enable it. + * Afterwards you need to call `/account/auth/totp/update` with a valid token to enable it. * - * `HTTP.POST /user/totp/generate` + * `HTTP.POST /account/auth/totp/generate` */ generateTotpSecret(options?: RequestOptions) { return this.#wrapper( HttpType.Post, - "/user/totp/generate", + "/account/auth/totp/generate", + {}, + options, + ); + } + + /** + * Get data of current user. + * + * `HTTP.GET /account` + */ + getMyUser(options?: RequestOptions) { + return this.#wrapper( + HttpType.Get, + "/account", {}, options, ); @@ -274,12 +290,12 @@ export class LemmyHttp { * Export a backup of your user settings, including your saved content, * followed communities, and blocks. * - * `HTTP.GET /user/export_settings` + * `HTTP.GET /account/settings/export` */ exportSettings(options?: RequestOptions) { return this.#wrapper( HttpType.Get, - "/user/export_settings", + "/account/settings/export", {}, options, ); @@ -288,12 +304,12 @@ export class LemmyHttp { /** * Import a backup of your user settings. * - * `HTTP.POST /user/import_settings` + * `HTTP.POST /account/settings/import` */ importSettings(form: any, options?: RequestOptions) { return this.#wrapper( HttpType.Post, - "/user/import_settings", + "/account/settings/import", form, options, ); @@ -302,12 +318,12 @@ export class LemmyHttp { /** * List login tokens for your user * - * `HTTP.GET /user/list_logins` + * `HTTP.GET /account/list_logins` */ listLogins(options?: RequestOptions) { return this.#wrapper( HttpType.Get, - "/user/list_logins", + "/account/list_logins", {}, options, ); @@ -316,12 +332,12 @@ export class LemmyHttp { /** * Returns an error message if your auth token is invalid * - * `HTTP.GET /user/validate_auth` + * `HTTP.GET /account/validate_auth` */ validateAuth(options?: RequestOptions) { return this.#wrapper( HttpType.Get, - "/user/validate_auth", + "/account/validate_auth", {}, options, ); @@ -358,16 +374,16 @@ export class LemmyHttp { /** * Enable / Disable TOTP / two-factor authentication. * - * To enable, you need to first call `/user/totp/generate` and then pass a valid token to this. + * To enable, you need to first call `/account/auth/totp/generate` and then pass a valid token to this. * * Disabling is only possible if 2FA was previously enabled. Again it is necessary to pass a valid token. * - * `HTTP.POST /user/totp/update` + * `HTTP.POST /account/auth/totp/update` */ updateTotp(form: UpdateTotp, options?: RequestOptions) { return this.#wrapper( HttpType.Post, - "/user/totp/update", + "/account/auth/totp/update", form, options, ); @@ -521,12 +537,12 @@ export class LemmyHttp { /** * Block a community. * - * `HTTP.POST /community/block` + * `HTTP.POST /account/block/community` */ blockCommunity(form: BlockCommunity, options?: RequestOptions) { return this.#wrapper( HttpType.Post, - "/community/block", + "/account/block/community", form, options, ); @@ -714,6 +730,20 @@ export class LemmyHttp { ); } + /** + * Mark multiple posts as read. + * + * `HTTP.POST /post/mark_as_read/many` + */ + markManyPostAsRead(form: MarkManyPostsAsRead, options?: RequestOptions) { + return this.#wrapper( + HttpType.Post, + "/post/mark_as_read/many", + form, + options, + ); + } + /** * Hide a post from list views. * @@ -1145,12 +1175,12 @@ export class LemmyHttp { /** * Register a new user. * - * `HTTP.POST /user/register` + * `HTTP.POST /account/auth/register` */ register(form: Register, options?: RequestOptions) { return this.#wrapper( HttpType.Post, - "/user/register", + "/account/auth/register", form, options, ); @@ -1159,12 +1189,12 @@ export class LemmyHttp { /** * Log into lemmy. * - * `HTTP.POST /user/login` + * `HTTP.POST /account/auth/login` */ login(form: Login, options?: RequestOptions) { return this.#wrapper( HttpType.Post, - "/user/login", + "/account/auth/login", form, options, ); @@ -1173,12 +1203,12 @@ export class LemmyHttp { /** * Invalidate the currently used auth token. * - * `HTTP.POST /user/logout` + * `HTTP.POST /account/auth/logout` */ logout(options?: RequestOptions) { return this.#wrapper( HttpType.Post, - "/user/logout", + "/account/auth/logout", {}, options, ); @@ -1187,12 +1217,12 @@ export class LemmyHttp { /** * Get the details for a person. * - * `HTTP.GET /user` + * `HTTP.GET /person` */ getPersonDetails(form: GetPersonDetails = {}, options?: RequestOptions) { return this.#wrapper( HttpType.Get, - "/user", + "/person", form, options, ); @@ -1201,12 +1231,12 @@ export class LemmyHttp { /** * Get mentions for your user. * - * `HTTP.GET /user/mention` + * `HTTP.GET /account/mention` */ getPersonMentions(form: GetPersonMentions, options?: RequestOptions) { return this.#wrapper( HttpType.Get, - "/user/mention", + "/account/mention", form, options, ); @@ -1215,7 +1245,7 @@ export class LemmyHttp { /** * Mark a person mention as read. * - * `HTTP.POST /user/mention/mark_as_read` + * `HTTP.POST /account/mention/mark_as_read` */ markPersonMentionAsRead( form: MarkPersonMentionAsRead, @@ -1223,21 +1253,35 @@ export class LemmyHttp { ) { return this.#wrapper( HttpType.Post, - "/user/mention/mark_as_read", + "/account/mention/mark_as_read", form, options, ); } + /** + * Mark a person mention as read. + * + * `HTTP.POST /account/mention/mark_as_read` + */ + markPersonAllMentionAsRead(options?: RequestOptions) { + return this.#wrapper( + HttpType.Post, + "/account/mention/mark_as_read", + {}, + options, + ); + } + /** * Get comment replies. * - * `HTTP.GET /user/replies` + * `HTTP.GET /account/replies` */ getReplies(form: GetReplies, options?: RequestOptions) { return this.#wrapper( HttpType.Get, - "/user/replies", + "/account/replies", form, options, ); @@ -1246,12 +1290,12 @@ export class LemmyHttp { /** * Ban a person from your site. * - * `HTTP.POST /user/ban` + * `HTTP.POST /admin/ban` */ banPerson(form: BanPerson, options?: RequestOptions) { return this.#wrapper( HttpType.Post, - "/user/ban", + "/admin/ban", form, options, ); @@ -1260,12 +1304,12 @@ export class LemmyHttp { /** * Get a list of banned users * - * `HTTP.GET /user/banned` + * `HTTP.GET /admin/banned` */ getBannedPersons(options?: RequestOptions) { return this.#wrapper( HttpType.Get, - "/user/banned", + "/admin/banned", {}, options, ); @@ -1274,12 +1318,12 @@ export class LemmyHttp { /** * Block a person. * - * `HTTP.POST /user/block` + * `HTTP.POST /account/block/person` */ blockPerson(form: BlockPerson, options?: RequestOptions) { return this.#wrapper( HttpType.Post, - "/user/block", + "/account/block/person", form, options, ); @@ -1288,12 +1332,12 @@ export class LemmyHttp { /** * Fetch a Captcha. * - * `HTTP.GET /user/get_captcha` + * `HTTP.GET /account/auth/get_captcha` */ getCaptcha(options?: RequestOptions) { return this.#wrapper( HttpType.Get, - "/user/get_captcha", + "/account/auth/get_captcha", {}, options, ); @@ -1302,12 +1346,12 @@ export class LemmyHttp { /** * Delete your account. * - * `HTTP.POST /user/delete_account` + * `HTTP.POST /account/delete` */ deleteAccount(form: DeleteAccount, options?: RequestOptions) { return this.#wrapper( HttpType.Post, - "/user/delete_account", + "/account/delete", form, options, ); @@ -1316,12 +1360,12 @@ export class LemmyHttp { /** * Reset your password. * - * `HTTP.POST /user/password_reset` + * `HTTP.POST /account/auth/password_reset` */ passwordReset(form: PasswordReset, options?: RequestOptions) { return this.#wrapper( HttpType.Post, - "/user/password_reset", + "/account/auth/password_reset", form, options, ); @@ -1330,7 +1374,7 @@ export class LemmyHttp { /** * Change your password from an email / token based reset. * - * `HTTP.POST /user/password_change` + * `HTTP.POST /account/auth/password_change` */ passwordChangeAfterReset( form: PasswordChangeAfterReset, @@ -1338,7 +1382,7 @@ export class LemmyHttp { ) { return this.#wrapper( HttpType.Post, - "/user/password_change", + "/account/auth/password_change", form, options, ); @@ -1347,12 +1391,12 @@ export class LemmyHttp { /** * Mark all replies as read. * - * `HTTP.POST /user/mark_all_as_read` + * `HTTP.POST /account/mention/mark_as_read/all` */ markAllAsRead(options?: RequestOptions) { return this.#wrapper( HttpType.Post, - "/user/mark_all_as_read", + "/account/mention/mark_as_read/all", {}, options, ); @@ -1361,12 +1405,12 @@ export class LemmyHttp { /** * Save your user settings. * - * `HTTP.PUT /user/save_user_settings` + * `HTTP.PUT /account/settings/save` */ saveUserSettings(form: SaveUserSettings, options?: RequestOptions) { return this.#wrapper( HttpType.Put, - "/user/save_user_settings", + "/account/settings/save", form, options, ); @@ -1375,12 +1419,12 @@ export class LemmyHttp { /** * Change your user password. * - * `HTTP.PUT /user/change_password` + * `HTTP.PUT /account/auth/change_password` */ changePassword(form: ChangePassword, options?: RequestOptions) { return this.#wrapper( HttpType.Put, - "/user/change_password", + "/account/auth/change_password", form, options, ); @@ -1389,12 +1433,12 @@ export class LemmyHttp { /** * Get counts for your reports * - * `HTTP.GET /user/report_count` + * `HTTP.GET /account/report_count` */ getReportCount(form: GetReportCount, options?: RequestOptions) { return this.#wrapper( HttpType.Get, - "/user/report_count", + "/account/report_count", form, options, ); @@ -1403,12 +1447,12 @@ export class LemmyHttp { /** * Get your unread counts * - * `HTTP.GET /user/unread_count` + * `HTTP.GET /account/unread_count` */ getUnreadCount(options?: RequestOptions) { return this.#wrapper( HttpType.Get, - "/user/unread_count", + "/account/unread_count", {}, options, ); @@ -1417,12 +1461,12 @@ export class LemmyHttp { /** * Verify your email * - * `HTTP.POST /user/verify_email` + * `HTTP.POST /account/auth/verify_email` */ verifyEmail(form: VerifyEmail, options?: RequestOptions) { return this.#wrapper( HttpType.Post, - "/user/verify_email", + "/account/auth/verify_email", form, options, ); @@ -1756,12 +1800,12 @@ export class LemmyHttp { /** * Block an instance as user. * - * `HTTP.Post /site/block` + * `HTTP.Post /account/block/instance` */ userBlockInstance(form: UserBlockInstanceParams, options?: RequestOptions) { return this.#wrapper( HttpType.Post, - "/site/block", + "/account/block/instance", form, options, ); @@ -1770,12 +1814,12 @@ export class LemmyHttp { /** * Globally block an instance as admin. * - * `HTTP.Post /admin/block_instance` + * `HTTP.Post /admin/instance/block` */ adminBlockInstance(form: AdminBlockInstanceParams, options?: RequestOptions) { return this.#wrapper( HttpType.Post, - "/admin/block_instance", + "/admin/instance/block", form, options, ); @@ -1784,12 +1828,12 @@ export class LemmyHttp { /** * Globally allow an instance as admin. * - * `HTTP.Post /admin/allow_instance` + * `HTTP.Post /admin/instance/allow` */ adminAllowInstance(form: AdminAllowInstanceParams, options?: RequestOptions) { return this.#wrapper( HttpType.Post, - "/admin/allow_instance", + "/admin/instance/allow", form, options, ); diff --git a/src/other_types.ts b/src/other_types.ts index 9db74ea..27e2e33 100644 --- a/src/other_types.ts +++ b/src/other_types.ts @@ -1,4 +1,4 @@ -export const VERSION = "v3"; +export const VERSION = "v4"; export interface UploadImage { image: File | Buffer; diff --git a/src/types/GetSiteResponse.ts b/src/types/GetSiteResponse.ts index 366cbfc..0119254 100644 --- a/src/types/GetSiteResponse.ts +++ b/src/types/GetSiteResponse.ts @@ -2,7 +2,6 @@ import type { Language } from "./Language"; import type { LanguageId } from "./LanguageId"; import type { LocalSiteUrlBlocklist } from "./LocalSiteUrlBlocklist"; -import type { MyUserInfo } from "./MyUserInfo"; import type { OAuthProvider } from "./OAuthProvider"; import type { PersonView } from "./PersonView"; import type { PublicOAuthProvider } from "./PublicOAuthProvider"; @@ -16,7 +15,6 @@ export type GetSiteResponse = { site_view: SiteView; admins: Array; version: string; - my_user?: MyUserInfo; all_languages: Array; discussion_languages: Array; /**