Update types 3 (#359)

* Updating types from main.

* 0.20.0-alpha.13

* 0.20.0-alpha.14

* Adding tagline http calls.

* 0.20.0-alpha.15

* Regenerating types from main.

- Also adding exports from other_types to node script.

* 0.20.0-alpha.16

* Add list custom emojis (#360)

* 0.20.0-alpha.17

---------

Co-authored-by: matc-pub <161147791+matc-pub@users.noreply.github.com>
This commit is contained in:
Dessalines 2024-09-30 08:14:59 -04:00 committed by GitHub
parent ce9d43dfeb
commit 3398af0f19
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
15 changed files with 129 additions and 90 deletions

View file

@ -1,7 +1,7 @@
{ {
"name": "lemmy-js-client", "name": "lemmy-js-client",
"description": "A javascript / typescript client for Lemmy", "description": "A javascript / typescript client for Lemmy",
"version": "0.20.0-alpha.10", "version": "0.20.0-alpha.17",
"author": "Dessalines <tyhou13@gmx.com>", "author": "Dessalines <tyhou13@gmx.com>",
"license": "AGPL-3.0", "license": "AGPL-3.0",
"main": "./dist/index.js", "main": "./dist/index.js",
@ -19,10 +19,10 @@
"url": "git+https://github.com/LemmyNet/lemmy-js-client.git" "url": "git+https://github.com/LemmyNet/lemmy-js-client.git"
}, },
"devDependencies": { "devDependencies": {
"@types/node": "^22.1.0", "@types/node": "^22.7.4",
"@typescript-eslint/eslint-plugin": "^8.0.0", "@typescript-eslint/eslint-plugin": "^8.7.0",
"@typescript-eslint/parser": "^8.0.0", "@typescript-eslint/parser": "^8.7.0",
"eslint": "^9.8.0", "eslint": "^9.11.1",
"eslint-plugin-prettier": "^5.2.1", "eslint-plugin-prettier": "^5.2.1",
"husky": "^9.1.4", "husky": "^9.1.4",
"lint-staged": "^15.2.7", "lint-staged": "^15.2.7",
@ -33,7 +33,7 @@
"sortpack": "^2.4.0", "sortpack": "^2.4.0",
"typedoc": "^0.26.5", "typedoc": "^0.26.5",
"typescript": "^5.5.4", "typescript": "^5.5.4",
"typescript-eslint": "^8.0.0" "typescript-eslint": "^8.7.0"
}, },
"packageManager": "pnpm@9.11.0", "packageManager": "pnpm@9.11.0",
"types": "./dist/index.d.ts", "types": "./dist/index.d.ts",

View file

@ -9,16 +9,16 @@ importers:
.: .:
devDependencies: devDependencies:
'@types/node': '@types/node':
specifier: ^22.1.0 specifier: ^22.7.4
version: 22.7.4 version: 22.7.4
'@typescript-eslint/eslint-plugin': '@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) 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': '@typescript-eslint/parser':
specifier: ^8.0.0 specifier: ^8.7.0
version: 8.7.0(eslint@9.11.1)(typescript@5.6.2) version: 8.7.0(eslint@9.11.1)(typescript@5.6.2)
eslint: eslint:
specifier: ^9.8.0 specifier: ^9.11.1
version: 9.11.1 version: 9.11.1
eslint-plugin-prettier: eslint-plugin-prettier:
specifier: ^5.2.1 specifier: ^5.2.1
@ -51,7 +51,7 @@ importers:
specifier: ^5.5.4 specifier: ^5.5.4
version: 5.6.2 version: 5.6.2
typescript-eslint: typescript-eslint:
specifier: ^8.0.0 specifier: ^8.7.0
version: 8.7.0(eslint@9.11.1)(typescript@5.6.2) version: 8.7.0(eslint@9.11.1)(typescript@5.6.2)
packages: packages:
@ -509,16 +509,16 @@ packages:
eslint-config-prettier: eslint-config-prettier:
optional: true optional: true
eslint-scope@8.1.0: eslint-scope@8.0.2:
resolution: {integrity: sha512-14dSvlhaVhKKsa9Fx1l8A17s7ah7Ef7wCakJ10LYk6+GYmP9yDti2oq2SEwcyndt6knfcZyhyxwY3i9yL78EQw==} resolution: {integrity: sha512-6E4xmrTw5wtxnLA5wYL3WDfhZ/1bUBGOXV0zQvVRDOtrR8D0p6W7fs3JweNYhwRYeGvd/1CKX2se0/2s7Q/nJA==}
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
eslint-visitor-keys@3.4.3: eslint-visitor-keys@3.4.3:
resolution: {integrity: sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==} resolution: {integrity: sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
eslint-visitor-keys@4.1.0: eslint-visitor-keys@4.0.0:
resolution: {integrity: sha512-Q7lok0mqMUSf5a/AdAZkA5a/gHcO6snwQClVNNvFKCAVlxXucdU8pKydU5ZVZjBx5xr37vGbFFWtLQYreLzrZg==} resolution: {integrity: sha512-OtIRv/2GyiF6o/d8K7MYKKbXrOUBIK6SfkIRM4Z0dY3w+LiQ0vy3F57m0Z71bjbyeiWFiHJ8brqnmE6H6/jEuw==}
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
eslint@9.11.1: eslint@9.11.1:
@ -531,8 +531,8 @@ packages:
jiti: jiti:
optional: true optional: true
espree@10.2.0: espree@10.1.0:
resolution: {integrity: sha512-upbkBJbckcCNBDBDXEbuhjbP68n+scUd3k/U2EkyM9nw+I/jPiL4cLF/Al06CF96wRltFda16sxDFrxsI1v0/g==} resolution: {integrity: sha512-M1M6CpiE6ffoigIOWYO9UDP8TMUw9kqb21tf+08IgDYjCsOvCuDt4jQcZmoYxx+w7zlKw9/N0KXfto+I8/FrXA==}
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
esprima@4.0.1: esprima@4.0.1:
@ -1337,7 +1337,7 @@ snapshots:
dependencies: dependencies:
ajv: 6.12.6 ajv: 6.12.6
debug: 4.3.7 debug: 4.3.7
espree: 10.2.0 espree: 10.1.0
globals: 14.0.0 globals: 14.0.0
ignore: 5.3.2 ignore: 5.3.2
import-fresh: 3.3.0 import-fresh: 3.3.0
@ -1674,14 +1674,14 @@ snapshots:
optionalDependencies: optionalDependencies:
eslint-config-prettier: 9.1.0(eslint@9.11.1) eslint-config-prettier: 9.1.0(eslint@9.11.1)
eslint-scope@8.1.0: eslint-scope@8.0.2:
dependencies: dependencies:
esrecurse: 4.3.0 esrecurse: 4.3.0
estraverse: 5.3.0 estraverse: 5.3.0
eslint-visitor-keys@3.4.3: {} eslint-visitor-keys@3.4.3: {}
eslint-visitor-keys@4.1.0: {} eslint-visitor-keys@4.0.0: {}
eslint@9.11.1: eslint@9.11.1:
dependencies: dependencies:
@ -1702,9 +1702,9 @@ snapshots:
cross-spawn: 7.0.3 cross-spawn: 7.0.3
debug: 4.3.7 debug: 4.3.7
escape-string-regexp: 4.0.0 escape-string-regexp: 4.0.0
eslint-scope: 8.1.0 eslint-scope: 8.0.2
eslint-visitor-keys: 4.1.0 eslint-visitor-keys: 4.0.0
espree: 10.2.0 espree: 10.1.0
esquery: 1.6.0 esquery: 1.6.0
esutils: 2.0.3 esutils: 2.0.3
fast-deep-equal: 3.1.3 fast-deep-equal: 3.1.3
@ -1725,11 +1725,11 @@ snapshots:
transitivePeerDependencies: transitivePeerDependencies:
- supports-color - supports-color
espree@10.2.0: espree@10.1.0:
dependencies: dependencies:
acorn: 8.12.1 acorn: 8.12.1
acorn-jsx: 5.3.2(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: {} esprima@4.0.1: {}

View file

@ -3,7 +3,10 @@ const path = require("path");
const exportRegex = /export\s+(?:enum|interface|type)\s+([A-Za-z0-9_]+)/g; 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() { async function putTypesInIndex() {
const typeFiles = await fs.readdir(path.resolve("./src/types")); const typeFiles = await fs.readdir(path.resolve("./src/types"));

View file

@ -145,6 +145,14 @@ import { ListMedia } from "./types/ListMedia";
import { ListMediaResponse } from "./types/ListMediaResponse"; import { ListMediaResponse } from "./types/ListMediaResponse";
import { AuthenticateWithOauth } from "./types/AuthenticateWithOauth"; import { AuthenticateWithOauth } from "./types/AuthenticateWithOauth";
import { GetRegistrationApplication } from "./types/GetRegistrationApplication"; 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 { enum HttpType {
Get = "GET", Get = "GET",
@ -1439,6 +1447,71 @@ export class LemmyHttp {
); );
} }
/**
* List custom emojis
*
* `HTTP.GET /custom_emoji/list`
*/
listCustomEmojis(form: ListCustomEmojis) {
return this.#wrapper<ListCustomEmojis, ListCustomEmojisResponse>(
HttpType.Get,
"/custom_emoji/list",
form,
);
}
/**
* Create a new tagline
*
* `HTTP.POST /admin/tagline`
*/
createTagline(form: CreateTagline) {
return this.#wrapper<CreateTagline, TaglineResponse>(
HttpType.Post,
"/admin/tagline",
form,
);
}
/**
* Edit an existing tagline
*
* `HTTP.PUT /admin/tagline`
*/
editTagline(form: UpdateTagline) {
return this.#wrapper<UpdateTagline, TaglineResponse>(
HttpType.Put,
"/admin/tagline",
form,
);
}
/**
* Delete a tagline
*
* `HTTP.Post /admin/tagline/delete`
*/
deleteTagline(form: DeleteTagline) {
return this.#wrapper<DeleteTagline, SuccessResponse>(
HttpType.Post,
"/admin/tagline/delete",
form,
);
}
/**
* List taglines
*
* `HTTP.GET /admin/tagline/list`
*/
listTaglines(form: ListTaglines) {
return this.#wrapper<ListTaglines, ListTaglinesResponse>(
HttpType.Get,
"/admin/tagline/list",
form,
);
}
/** /**
* Create a new oauth provider method * Create a new oauth provider method
* *

View file

@ -1,4 +1,10 @@
export * from "./http"; export * from "./http";
export {
UploadImage,
UploadImageResponse,
ImageFile,
DeleteImage,
} from "./other_types";
export { ActivityId } from "./types/ActivityId"; export { ActivityId } from "./types/ActivityId";
export { AddAdmin } from "./types/AddAdmin"; export { AddAdmin } from "./types/AddAdmin";
export { AddAdminResponse } from "./types/AddAdminResponse"; export { AddAdminResponse } from "./types/AddAdminResponse";
@ -193,8 +199,6 @@ export { MyUserInfo } from "./types/MyUserInfo";
export { OAuthAccount } from "./types/OAuthAccount"; export { OAuthAccount } from "./types/OAuthAccount";
export { OAuthProvider } from "./types/OAuthProvider"; export { OAuthProvider } from "./types/OAuthProvider";
export { OAuthProviderId } from "./types/OAuthProviderId"; export { OAuthProviderId } from "./types/OAuthProviderId";
export { OAuthProviderInsertForm } from "./types/OAuthProviderInsertForm";
export { OAuthProviderUpdateForm } from "./types/OAuthProviderUpdateForm";
export { OpenGraphData } from "./types/OpenGraphData"; export { OpenGraphData } from "./types/OpenGraphData";
export { PaginationCursor } from "./types/PaginationCursor"; export { PaginationCursor } from "./types/PaginationCursor";
export { PasswordChangeAfterReset } from "./types/PasswordChangeAfterReset"; export { PasswordChangeAfterReset } from "./types/PasswordChangeAfterReset";
@ -270,9 +274,3 @@ export { UpdateTotp } from "./types/UpdateTotp";
export { UpdateTotpResponse } from "./types/UpdateTotpResponse"; export { UpdateTotpResponse } from "./types/UpdateTotpResponse";
export { VerifyEmail } from "./types/VerifyEmail"; export { VerifyEmail } from "./types/VerifyEmail";
export { VoteView } from "./types/VoteView"; export { VoteView } from "./types/VoteView";
export {
UploadImage,
UploadImageResponse,
ImageFile,
DeleteImage,
} from "./other_types";

View file

@ -10,7 +10,7 @@ export interface CreateOAuthProvider {
client_id: string; client_id: string;
client_secret: string; client_secret: string;
scopes: string; scopes: string;
auto_verify_email: boolean; auto_verify_email?: boolean;
account_linking_enabled: boolean; account_linking_enabled?: boolean;
enabled: boolean; enabled?: boolean;
} }

View file

@ -3,14 +3,14 @@ import type { OAuthProviderId } from "./OAuthProviderId";
export interface EditOAuthProvider { export interface EditOAuthProvider {
id: OAuthProviderId; id: OAuthProviderId;
display_name: string | null; display_name?: string;
authorization_endpoint: string | null; authorization_endpoint?: string;
token_endpoint: string | null; token_endpoint?: string;
userinfo_endpoint: string | null; userinfo_endpoint?: string;
id_claim: string | null; id_claim?: string;
client_secret: string | null; client_secret?: string;
scopes: string | null; scopes?: string;
auto_verify_email: boolean | null; auto_verify_email?: boolean;
account_linking_enabled: boolean | null; account_linking_enabled?: boolean;
enabled: boolean | null; enabled?: boolean;
} }

View file

@ -159,7 +159,7 @@ export type LemmyErrorType =
| { error: "couldnt_delete_oauth_provider" } | { error: "couldnt_delete_oauth_provider" }
| { error: "unknown"; message: string } | { error: "unknown"; message: string }
| { error: "cant_delete_site" } | { error: "cant_delete_site" }
| { error: "url_length_overflow" }
| { error: "post_schedule_time_must_be_in_future" } | { error: "post_schedule_time_must_be_in_future" }
| { error: "too_many_scheduled_posts" } | { error: "too_many_scheduled_posts" }
| { error: "url_length_overflow" }
| { error: "not_found" }; | { error: "not_found" };

View file

@ -23,7 +23,6 @@ export interface LocalUser {
accepted_application: boolean; accepted_application: boolean;
open_links_in_new_tab: boolean; open_links_in_new_tab: boolean;
blur_nsfw: boolean; blur_nsfw: boolean;
auto_expand: boolean;
infinite_scroll_enabled: boolean; infinite_scroll_enabled: boolean;
admin: boolean; admin: boolean;
post_listing_mode: PostListingMode; post_listing_mode: PostListingMode;

View file

@ -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;
}

View file

@ -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;
}

View file

@ -28,5 +28,5 @@ export interface Post {
featured_local: boolean; featured_local: boolean;
url_content_type?: string; url_content_type?: string;
alt_text?: string; alt_text?: string;
scheduled_publish_time?: number; scheduled_publish_time?: string;
} }

View file

@ -8,7 +8,6 @@ import type { PostSortType } from "./PostSortType";
export interface SaveUserSettings { export interface SaveUserSettings {
show_nsfw?: boolean; show_nsfw?: boolean;
blur_nsfw?: boolean; blur_nsfw?: boolean;
auto_expand?: boolean;
theme?: string; theme?: string;
default_listing_type?: ListingType; default_listing_type?: ListingType;
post_listing_mode?: PostListingMode; post_listing_mode?: PostListingMode;

View file

@ -15,5 +15,9 @@ export interface Search {
listing_type?: ListingType; listing_type?: ListingType;
page?: number; page?: number;
limit?: number; limit?: number;
post_title_only?: boolean; title_only?: boolean;
post_url_only?: boolean;
saved_only?: boolean;
liked_only?: boolean;
disliked_only?: boolean;
} }

View file

@ -1,9 +1,3 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
export type SearchType = export type SearchType = "All" | "Comments" | "Posts" | "Communities" | "Users";
| "All"
| "Comments"
| "Posts"
| "Communities"
| "Users"
| "Url";