Merge remote-tracking branch 'origin/main' into search_combined

This commit is contained in:
Dessalines 2025-01-31 15:41:25 -05:00
commit 68d36439e3
15 changed files with 4407 additions and 431 deletions

2
.gitignore vendored
View file

@ -2,3 +2,5 @@ dist
package
node_modules
docs
tsoa_build
redoc-static.html

View file

@ -21,6 +21,7 @@ export default [
"@typescript-eslint/ban-ts-comment": 0,
"@typescript-eslint/no-explicit-any": 0,
"@typescript-eslint/explicit-module-boundary-types": 0,
"@typescript-eslint/no-empty-object-type": 0,
"arrow-body-style": 0,
curly: 0,
"eol-last": 0,

View file

@ -2,7 +2,7 @@
"name": "lemmy-js-client",
"description": "A javascript / typescript client for Lemmy",
"version": "0.20.0-search-combined.1",
"author": "Dessalines <tyhou13@gmx.com>",
"author": "Dessalines",
"license": "AGPL-3.0",
"main": "./dist/index.js",
"files": [
@ -12,13 +12,16 @@
"build": "tsc",
"docs": "typedoc src/index.ts",
"lint": "tsc --noEmit && eslint --report-unused-disable-directives && prettier --check src",
"prepare": "pnpm run build && husky"
"prepare": "pnpm run build && husky",
"tsoa": "tsoa spec-and-routes && tsc && redocly build-docs tsoa_build/swagger.json"
},
"repository": {
"type": "git",
"url": "git+https://github.com/LemmyNet/lemmy-js-client.git"
},
"devDependencies": {
"@redocly/cli": "^1.27.2",
"@types/joi": "^17.2.3",
"@types/node": "^22.7.4",
"@typescript-eslint/eslint-plugin": "^8.7.0",
"@typescript-eslint/parser": "^8.7.0",
@ -31,6 +34,7 @@
"prettier-plugin-organize-imports": "^4.0.0",
"prettier-plugin-packagejson": "^2.5.1",
"sortpack": "^2.4.0",
"tsoa": "^6.6.0",
"typedoc": "^0.27.0",
"typescript": "^5.5.4",
"typescript-eslint": "^8.7.0"

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -50,6 +50,7 @@ export { CommentReportId } from "./types/CommentReportId";
export { CommentReportResponse } from "./types/CommentReportResponse";
export { CommentReportView } from "./types/CommentReportView";
export { CommentResponse } from "./types/CommentResponse";
export { CommentSlimView } from "./types/CommentSlimView";
export { CommentSortType } from "./types/CommentSortType";
export { CommentView } from "./types/CommentView";
export { Community } from "./types/Community";
@ -112,6 +113,7 @@ export { GetCaptchaResponse } from "./types/GetCaptchaResponse";
export { GetComment } from "./types/GetComment";
export { GetComments } from "./types/GetComments";
export { GetCommentsResponse } from "./types/GetCommentsResponse";
export { GetCommentsSlimResponse } from "./types/GetCommentsSlimResponse";
export { GetCommunity } from "./types/GetCommunity";
export { GetCommunityPendingFollowsCount } from "./types/GetCommunityPendingFollowsCount";
export { GetCommunityPendingFollowsCountResponse } from "./types/GetCommunityPendingFollowsCountResponse";
@ -292,6 +294,7 @@ export { RemoveCommunity } from "./types/RemoveCommunity";
export { RemovePost } from "./types/RemovePost";
export { ReportCombinedPaginationCursor } from "./types/ReportCombinedPaginationCursor";
export { ReportCombinedView } from "./types/ReportCombinedView";
export { ReportType } from "./types/ReportType";
export { ResolveCommentReport } from "./types/ResolveCommentReport";
export { ResolveObject } from "./types/ResolveObject";
export { ResolveObjectResponse } from "./types/ResolveObjectResponse";
@ -301,7 +304,6 @@ export { SaveComment } from "./types/SaveComment";
export { SavePost } from "./types/SavePost";
export { SaveUserSettings } from "./types/SaveUserSettings";
export { Search } from "./types/Search";
export { SearchCombinedId } from "./types/SearchCombinedId";
export { SearchCombinedPaginationCursor } from "./types/SearchCombinedPaginationCursor";
export { SearchCombinedView } from "./types/SearchCombinedView";
export { SearchResponse } from "./types/SearchResponse";

View file

@ -1,5 +1,67 @@
import { DeleteImageParams } from "./types/DeleteImageParams";
import { GetComment } from "./types/GetComment";
import { GetComments } from "./types/GetComments";
import { GetCommunity } from "./types/GetCommunity";
import { GetCommunityPendingFollowsCount } from "./types/GetCommunityPendingFollowsCount";
import { GetModlog } from "./types/GetModlog";
import { GetPersonDetails } from "./types/GetPersonDetails";
import { GetPost } from "./types/GetPost";
import { GetPosts } from "./types/GetPosts";
import { GetRandomCommunity } from "./types/GetRandomCommunity";
import { GetRegistrationApplication } from "./types/GetRegistrationApplication";
import { GetReportCount } from "./types/GetReportCount";
import { GetSiteMetadata } from "./types/GetSiteMetadata";
import { ListCommentLikes } from "./types/ListCommentLikes";
import { ListCommunities } from "./types/ListCommunities";
import { ListCommunityPendingFollows } from "./types/ListCommunityPendingFollows";
import { ListCustomEmojis } from "./types/ListCustomEmojis";
import { ListInbox } from "./types/ListInbox";
import { ListMedia } from "./types/ListMedia";
import { ListPersonContent } from "./types/ListPersonContent";
import { ListPersonSaved } from "./types/ListPersonSaved";
import { ListPostLikes } from "./types/ListPostLikes";
import { ListRegistrationApplications } from "./types/ListRegistrationApplications";
import { ListReports } from "./types/ListReports";
import { ListTaglines } from "./types/ListTaglines";
import { ResolveObject } from "./types/ResolveObject";
import { Search } from "./types/Search";
export const VERSION = "v4";
export interface UploadImage {
image: File | Buffer;
}
// tsoa doesn't currently support types in GET queries, so these need to be extended.
// https://github.com/lukeautry/tsoa/issues/1743
export interface ListMediaI extends ListMedia {}
export interface GetModlogI extends GetModlog {}
export interface SearchI extends Search {}
export interface ResolveObjectI extends ResolveObject {}
export interface GetCommunityI extends GetCommunity {}
export interface ListCommunitiesI extends ListCommunities {}
export interface GetCommunityPendingFollowsCountI
extends GetCommunityPendingFollowsCount {}
export interface ListCommunityPendingFollowsI
extends ListCommunityPendingFollows {}
export interface GetRandomCommunityI extends GetRandomCommunity {}
export interface GetPostI extends GetPost {}
export interface GetPostsI extends GetPosts {}
export interface ListPostLikesI extends ListPostLikes {}
export interface GetSiteMetadataI extends GetSiteMetadata {}
export interface ListCommentLikesI extends ListCommentLikes {}
export interface GetCommentsI extends GetComments {}
export interface GetCommentI extends GetComment {}
export interface GetPersonDetailsI extends GetPersonDetails {}
export interface ListPersonContentI extends ListPersonContent {}
export interface GetReportCountI extends GetReportCount {}
export interface ListInboxI extends ListInbox {}
export interface ListPersonSavedI extends ListPersonSaved {}
export interface ListRegistrationApplicationsI
extends ListRegistrationApplications {}
export interface GetRegistrationApplicationI
extends GetRegistrationApplication {}
export interface ListCustomEmojisI extends ListCustomEmojis {}
export interface ListTaglinesI extends ListTaglines {}
export interface ListReportsI extends ListReports {}
export interface DeleteImageParamsI extends DeleteImageParams {}

View file

@ -0,0 +1,22 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { Comment } from "./Comment";
import type { CommentAggregates } from "./CommentAggregates";
import type { Person } from "./Person";
import type { SubscribedType } from "./SubscribedType";
/**
* A slimmer comment view, without the post, or community.
*/
export type CommentSlimView = {
comment: Comment;
creator: Person;
counts: CommentAggregates;
creator_banned_from_community: boolean;
banned_from_community: boolean;
creator_is_moderator: boolean;
creator_is_admin: boolean;
subscribed: SubscribedType;
saved: boolean;
creator_blocked: boolean;
my_vote?: number;
};

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 { CommentSlimView } from "./CommentSlimView";
/**
* A slimmer comment list response, without the post or community.
*/
export type GetCommentsSlimResponse = { comments: Array<CommentSlimView> };

View file

@ -1,6 +1,8 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { CommunityId } from "./CommunityId";
import type { PostId } from "./PostId";
import type { ReportCombinedPaginationCursor } from "./ReportCombinedPaginationCursor";
import type { ReportType } from "./ReportType";
/**
* List reports.
@ -10,6 +12,14 @@ export type ListReports = {
* Only shows the unresolved reports
*/
unresolved_only?: boolean;
/**
* Filter the type of report.
*/
type_?: ReportType;
/**
* Filter by the post id. Can return either comment or post reports.
*/
post_id?: PostId;
/**
* if no community is given, it returns reports for all communities moderated by the auth user
*/

View file

@ -1,6 +1,6 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
/**
* A list of possible types for the various modlog actions.
* A list of possible types for a person's content.
*/
export type PersonContentType = "All" | "Comments" | "Posts";

11
src/types/ReportType.ts Normal file
View file

@ -0,0 +1,11 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
/**
* A list of possible types for reports.
*/
export type ReportType =
| "All"
| "Posts"
| "Comments"
| "PrivateMessages"
| "Communities";

View file

@ -1,6 +0,0 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
/**
* The search combined id
*/
export type SearchCombinedId = number;

View file

@ -1,6 +1,6 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
/**
* Saves settings for your user.
* A response that completes successfully.
*/
export type SuccessResponse = { success: boolean };

19
tsoa.json Normal file
View file

@ -0,0 +1,19 @@
{
"entryFile": "src/http.ts",
"noImplicitAdditionalProperties": "throw-on-extras",
"controllerPathGlobs": ["src/http.ts"],
"spec": {
"outputDirectory": "tsoa_build",
"specVersion": 3,
"securityDefinitions": {
"bearerAuth": {
"type": "http",
"scheme": "bearer",
"bearerFormat": "JWT"
}
}
},
"routes": {
"routesDir": "tsoa_build"
}
}