Merge branch 'main' into release/v0.19

This commit is contained in:
Dessalines 2024-01-10 10:48:45 -05:00
commit 6d5b48705f
11 changed files with 78 additions and 12 deletions

View file

@ -1,15 +1,13 @@
{ {
"name": "lemmy-js-client", "name": "lemmy-js-client",
"version": "0.19.0", "version": "0.19.2-alpha.3",
"description": "A javascript / typescript client for Lemmy", "description": "A javascript / typescript client for Lemmy",
"repository": "https://github.com/LemmyNet/lemmy-js-client", "repository": "https://github.com/LemmyNet/lemmy-js-client",
"license": "AGPL-3.0", "license": "AGPL-3.0",
"author": "Dessalines <tyhou13@gmx.com>", "author": "Dessalines <tyhou13@gmx.com>",
"main": "./dist/index.js", "main": "./dist/index.js",
"types": "./dist/index.d.ts", "types": "./dist/index.d.ts",
"files": [ "files": ["/dist"],
"/dist"
],
"scripts": { "scripts": {
"build": "tsc", "build": "tsc",
"docs": "typedoc src/index.ts", "docs": "typedoc src/index.ts",
@ -17,13 +15,8 @@
"prepare": "yarn run build && husky install" "prepare": "yarn run build && husky install"
}, },
"lint-staged": { "lint-staged": {
"*.{ts,tsx,js}": [ "*.{ts,tsx,js}": ["prettier --write", "eslint --fix"],
"prettier --write", "package.json": ["sortpack"]
"eslint --fix"
],
"package.json": [
"sortpack"
]
}, },
"dependencies": { "dependencies": {
"cross-fetch": "^3.1.5", "cross-fetch": "^3.1.5",

View file

@ -134,6 +134,10 @@ import { UpdateTotp } from "./types/UpdateTotp";
import { UpdateTotpResponse } from "./types/UpdateTotpResponse"; import { UpdateTotpResponse } from "./types/UpdateTotpResponse";
import { SuccessResponse } from "./types/SuccessResponse"; import { SuccessResponse } from "./types/SuccessResponse";
import { LoginToken } from "./types/LoginToken"; import { LoginToken } from "./types/LoginToken";
import { ListPostLikes } from "./types/ListPostLikes";
import { ListPostLikesResponse } from "./types/ListPostLikesResponse";
import { ListCommentLikes } from "./types/ListCommentLikes";
import { ListCommentLikesResponse } from "./types/ListCommentLikesResponse";
enum HttpType { enum HttpType {
Get = "GET", Get = "GET",
@ -239,7 +243,7 @@ export class LemmyHttp {
* `HTTP.GET /user/export_settings` * `HTTP.GET /user/export_settings`
*/ */
exportSettings() { exportSettings() {
return this.#wrapper<object, any>( return this.#wrapper<object, string>(
HttpType.Get, HttpType.Get,
"/user/export_settings", "/user/export_settings",
{}, {},
@ -615,6 +619,19 @@ export class LemmyHttp {
); );
} }
/**
* List a post's likes. Admin-only.
*
* `HTTP.GET /post/like`
*/
listPostLikes(form: ListPostLikes) {
return this.#wrapper<ListPostLikes, ListPostLikesResponse>(
HttpType.Get,
"/post/like/list",
form,
);
}
/** /**
* Save a post. * Save a post.
* *
@ -758,6 +775,19 @@ export class LemmyHttp {
); );
} }
/**
* List a comment's likes. Admin-only.
*
* `HTTP.GET //like`
*/
listCommentLikes(form: ListCommentLikes) {
return this.#wrapper<ListCommentLikes, ListCommentLikesResponse>(
HttpType.Get,
"/comment/like/list",
form,
);
}
/** /**
* Save a comment. * Save a comment.
* *

View file

@ -117,10 +117,14 @@ export { InstanceWithFederationState } from "./types/InstanceWithFederationState
export { Language } from "./types/Language"; export { Language } from "./types/Language";
export { LanguageId } from "./types/LanguageId"; export { LanguageId } from "./types/LanguageId";
export { LemmyErrorType } from "./types/LemmyErrorType"; export { LemmyErrorType } from "./types/LemmyErrorType";
export { ListCommentLikes } from "./types/ListCommentLikes";
export { ListCommentLikesResponse } from "./types/ListCommentLikesResponse";
export { ListCommentReports } from "./types/ListCommentReports"; export { ListCommentReports } from "./types/ListCommentReports";
export { ListCommentReportsResponse } from "./types/ListCommentReportsResponse"; export { ListCommentReportsResponse } from "./types/ListCommentReportsResponse";
export { ListCommunities } from "./types/ListCommunities"; export { ListCommunities } from "./types/ListCommunities";
export { ListCommunitiesResponse } from "./types/ListCommunitiesResponse"; export { ListCommunitiesResponse } from "./types/ListCommunitiesResponse";
export { ListPostLikes } from "./types/ListPostLikes";
export { ListPostLikesResponse } from "./types/ListPostLikesResponse";
export { ListPostReports } from "./types/ListPostReports"; export { ListPostReports } from "./types/ListPostReports";
export { ListPostReportsResponse } from "./types/ListPostReportsResponse"; export { ListPostReportsResponse } from "./types/ListPostReportsResponse";
export { ListPrivateMessageReports } from "./types/ListPrivateMessageReports"; export { ListPrivateMessageReports } from "./types/ListPrivateMessageReports";
@ -238,6 +242,7 @@ export { TransferCommunity } from "./types/TransferCommunity";
export { UpdateTotp } from "./types/UpdateTotp"; 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 { export {
UploadImage, UploadImage,
UploadImageResponse, UploadImageResponse,

View file

@ -11,4 +11,5 @@ export interface CommunityAggregates {
users_active_week: /* integer */ number; users_active_week: /* integer */ number;
users_active_month: /* integer */ number; users_active_month: /* integer */ number;
users_active_half_year: /* integer */ number; users_active_half_year: /* integer */ number;
subscribers_local: /* integer */ number;
} }

View file

@ -10,4 +10,5 @@ export interface CreateCommunity {
nsfw?: boolean; nsfw?: boolean;
posting_restricted_to_mods?: boolean; posting_restricted_to_mods?: boolean;
discussion_languages?: Array<LanguageId>; discussion_languages?: Array<LanguageId>;
local_only?: boolean;
} }

View file

@ -11,4 +11,5 @@ export interface EditCommunity {
nsfw?: boolean; nsfw?: boolean;
posting_restricted_to_mods?: boolean; posting_restricted_to_mods?: boolean;
discussion_languages?: Array<LanguageId>; discussion_languages?: Array<LanguageId>;
local_only?: boolean;
} }

View file

@ -0,0 +1,8 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { CommentId } from "./CommentId";
export interface ListCommentLikes {
comment_id: CommentId;
page?: /* integer */ number;
limit?: /* integer */ number;
}

View file

@ -0,0 +1,6 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { VoteView } from "./VoteView";
export interface ListCommentLikesResponse {
comment_likes: Array<VoteView>;
}

View file

@ -0,0 +1,8 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { PostId } from "./PostId";
export interface ListPostLikes {
post_id: PostId;
page?: /* integer */ number;
limit?: /* integer */ number;
}

View file

@ -0,0 +1,6 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { VoteView } from "./VoteView";
export interface ListPostLikesResponse {
post_likes: Array<VoteView>;
}

7
src/types/VoteView.ts Normal file
View file

@ -0,0 +1,7 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { Person } from "./Person";
export interface VoteView {
creator: Person;
score: number;
}