mirror of
https://github.com/LemmyNet/lemmy-js-client.git
synced 2024-11-01 01:59:55 +00:00
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:
parent
ce9d43dfeb
commit
3398af0f19
15 changed files with 129 additions and 90 deletions
12
package.json
12
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 <tyhou13@gmx.com>",
|
||||
"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",
|
||||
|
|
|
@ -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: {}
|
||||
|
||||
|
|
|
@ -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"));
|
||||
|
|
73
src/http.ts
73
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<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
|
||||
*
|
||||
|
|
14
src/index.ts
14
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";
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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" };
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
|
@ -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;
|
||||
}
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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";
|
||||
|
|
Loading…
Reference in a new issue