Skip to content

Commit 3af5300

Browse files
dessalinesNutomicrenovate[bot]MV-GH
authored
Search optimizations 1 (#882)
* Adding list_persons, updating types from main * 1.0.0-search-optimizations-1.0 * Search optimizations 1 nutomic (#904) * Update dependency lint-staged to v16.4.0 (#893) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * Update dependency @redocly/cli to v2.21.1 (#892) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * Update pnpm to v10.32.1 (#894) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * Update typescript-eslint monorepo to v8.57.0 (#895) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * Fix deleteMediaAdmin & deleteMedia wrong OpenAPI documentation #884 (#885) * Fix #887 adding missing async to endpoints (#888) * Fix #890 Some endpoints use 'object' instead of the actual type (#891) * Remove sleepless from codeowners. (#899) * Remove sleepless from codeowners. * Add @Nutomic as a code owner * Rename to importUserSettings & exportUserSettings (#900) * Update typescript-eslint monorepo to v8.57.1 (#901) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * Update dependency @redocly/cli to v2.24.1 (#902) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * Update dependency eslint to v10.1.0 (#903) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * Enable more lints (#897) * Enable more lints (fixes #896) * review * format * Add nodeinfo (fixes #459) (#898) * Add nodeinfo (fixes #459) * review * ternary * route * fix routes, add superclass * fmt * update * 1.0.0-search.0 * fix tsoa --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Maarten Vercruysse <67873169+MV-GH@users.noreply.github.com> Co-authored-by: Dessalines <dessalines@users.noreply.github.com> --------- Co-authored-by: Nutomic <me@nutomic.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Maarten Vercruysse <67873169+MV-GH@users.noreply.github.com>
1 parent dcf9c67 commit 3af5300

15 files changed

Lines changed: 88 additions & 76 deletions

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "lemmy-js-client",
33
"description": "A javascript / typescript client for Lemmy",
4-
"version": "1.0.0-delete-pm-recipient.3",
4+
"version": "1.0.0-search.0",
55
"author": "Dessalines",
66
"license": "AGPL-3.0",
77
"main": "./dist/index.js",

src/http.ts

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,11 @@ import {
4444
ListReportsI,
4545
ListTaglinesI,
4646
ResolveObjectI,
47-
SearchI,
4847
UploadImage,
4948
VERSION,
5049
GetFederatedInstancesI,
50+
ListPersonsI,
51+
SearchI,
5152
} from "./other_types";
5253
import { AddAdmin } from "./types/AddAdmin";
5354
import { AddAdminResponse } from "./types/AddAdminResponse";
@@ -142,8 +143,6 @@ import { ResolvePrivateMessageReport } from "./types/ResolvePrivateMessageReport
142143
import { SaveComment } from "./types/SaveComment";
143144
import { SavePost } from "./types/SavePost";
144145
import { SaveUserSettings } from "./types/SaveUserSettings";
145-
import { Search } from "./types/Search";
146-
import { SearchResponse } from "./types/SearchResponse";
147146
import { SiteResponse } from "./types/SiteResponse";
148147
import { TransferCommunity } from "./types/TransferCommunity";
149148
import { VerifyEmail } from "./types/VerifyEmail";
@@ -221,10 +220,15 @@ import { UnreadCountsResponse } from "./types/UnreadCountsResponse";
221220
import { AdminOAuthProvider } from "./types/AdminOAuthProvider";
222221
import { CreatePostWarning } from "./types/CreatePostWarning";
223222
import { CreateCommentWarning } from "./types/CreateCommentWarning";
223+
import { ResolveObjectView } from "./types/ResolveObjectView";
224+
import { ListPersons } from "./types/ListPersons";
225+
import { PersonView } from "./types/PersonView";
224226
import { GetMultiCommunity } from "./types/GetMultiCommunity";
225227
import { ListMultiCommunities } from "./types/ListMultiCommunities";
226228
import { NodeInfo } from "./types/NodeInfo";
227229
import { UserSettingsBackup } from "./types/UserSettingsBackup";
230+
import { SearchResponse } from "./types/SearchResponse";
231+
import { Search } from "./types/Search";
228232

229233
enum HttpType {
230234
Get = "GET",
@@ -667,7 +671,7 @@ export class LemmyHttp extends LemmyController {
667671
@Queries() form: ResolveObjectI,
668672
@Inject() options?: RequestOptions,
669673
) {
670-
return this.wrapper<ResolveObject, SearchResponse>(
674+
return this.wrapper<ResolveObject, ResolveObjectView>(
671675
HttpType.Get,
672676
"/resolve_object",
673677
form,
@@ -1786,6 +1790,25 @@ export class LemmyHttp extends LemmyController {
17861790
);
17871791
}
17881792

1793+
/**
1794+
* @summary List persons.
1795+
*/
1796+
@Security("bearerAuth")
1797+
@Security({})
1798+
@Get("/person/list")
1799+
@Tags("Person")
1800+
async listPersons(
1801+
@Queries() form: ListPersonsI = {},
1802+
@Inject() options?: RequestOptions,
1803+
) {
1804+
return this.wrapper<ListPersons, PagedResponse<PersonView>>(
1805+
HttpType.Get,
1806+
"/person/list",
1807+
form,
1808+
options,
1809+
);
1810+
}
1811+
17891812
/**
17901813
* @summary Ban a person from your site.
17911814
*/

src/index.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@ export { ListPersonHidden } from "./types/ListPersonHidden";
157157
export { ListPersonLiked } from "./types/ListPersonLiked";
158158
export { ListPersonRead } from "./types/ListPersonRead";
159159
export { ListPersonSaved } from "./types/ListPersonSaved";
160+
export { ListPersons } from "./types/ListPersons";
160161
export { ListPostLikes } from "./types/ListPostLikes";
161162
export { ListRegistrationApplications } from "./types/ListRegistrationApplications";
162163
export { ListReports } from "./types/ListReports";
@@ -220,7 +221,9 @@ export { Person } from "./types/Person";
220221
export { PersonActions } from "./types/PersonActions";
221222
export { PersonContentType } from "./types/PersonContentType";
222223
export { PersonId } from "./types/PersonId";
224+
export { PersonListingType } from "./types/PersonListingType";
223225
export { PersonResponse } from "./types/PersonResponse";
226+
export { PersonSortType } from "./types/PersonSortType";
224227
export { PersonView } from "./types/PersonView";
225228
export { PluginMetadata } from "./types/PluginMetadata";
226229
export { Post } from "./types/Post";
@@ -266,16 +269,15 @@ export { ResendVerificationEmail } from "./types/ResendVerificationEmail";
266269
export { ResolveCommentReport } from "./types/ResolveCommentReport";
267270
export { ResolveCommunityReport } from "./types/ResolveCommunityReport";
268271
export { ResolveObject } from "./types/ResolveObject";
272+
export { ResolveObjectView } from "./types/ResolveObjectView";
269273
export { ResolvePostReport } from "./types/ResolvePostReport";
270274
export { ResolvePrivateMessageReport } from "./types/ResolvePrivateMessageReport";
271275
export { SaveComment } from "./types/SaveComment";
272276
export { SavePost } from "./types/SavePost";
273277
export { SaveUserSettings } from "./types/SaveUserSettings";
274278
export { Search } from "./types/Search";
275-
export { SearchCombinedView } from "./types/SearchCombinedView";
276279
export { SearchResponse } from "./types/SearchResponse";
277280
export { SearchSortType } from "./types/SearchSortType";
278-
export { SearchType } from "./types/SearchType";
279281
export { SensitiveString } from "./types/SensitiveString";
280282
export { Site } from "./types/Site";
281283
export { SiteId } from "./types/SiteId";

src/other_types.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,9 @@ import { ListRegistrationApplications } from "./types/ListRegistrationApplicatio
3030
import { ListReports } from "./types/ListReports";
3131
import { ListTaglines } from "./types/ListTaglines";
3232
import { ResolveObject } from "./types/ResolveObject";
33-
import { Search } from "./types/Search";
3433
import { GetFederatedInstances } from "./types/GetFederatedInstances";
34+
import { ListPersons } from "./types/ListPersons";
35+
import { Search } from "./types/Search";
3536

3637
export const VERSION = "v4";
3738

@@ -43,7 +44,6 @@ export interface UploadImage {
4344
// https://github.com/lukeautry/tsoa/issues/1743
4445
export interface ListMediaI extends ListMedia {}
4546
export interface GetModlogI extends GetModlog {}
46-
export interface SearchI extends Search {}
4747
export interface ResolveObjectI extends ResolveObject {}
4848
export interface GetCommunityI extends GetCommunity {}
4949
export interface ListCommunitiesI extends ListCommunities {}
@@ -58,6 +58,7 @@ export interface GetCommentsI extends GetComments {}
5858
export interface GetCommentI extends GetComment {}
5959
export interface GetPersonDetailsI extends GetPersonDetails {}
6060
export interface ListPersonContentI extends ListPersonContent {}
61+
export interface ListPersonsI extends ListPersons {}
6162
export interface ListNotificationsI extends ListNotifications {}
6263
export interface ListPersonSavedI extends ListPersonSaved {}
6364
export interface ListPersonReadI extends ListPersonRead {}
@@ -74,3 +75,4 @@ export interface CommunityIdQueryI extends CommunityIdQuery {}
7475
export interface ListMultiCommunitiesI extends ListMultiCommunities {}
7576
export interface GetMultiCommunityI extends GetMultiCommunity {}
7677
export interface GetFederatedInstancesI extends GetFederatedInstances {}
78+
export interface SearchI extends Search {}

src/types/GetComments.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,5 @@ export type GetComments = {
2424
community_name?: string;
2525
post_id?: PostId;
2626
parent_id?: CommentId;
27+
search_term?: string;
2728
};

src/types/GetPosts.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ export type GetPosts = {
4242
* If true, then only show posts with no comments
4343
*/
4444
no_comments_only?: boolean;
45+
search_term?: string;
46+
search_title_only?: boolean;
47+
search_url_only?: boolean;
4548
page_cursor?: PaginationCursor;
4649
limit?: number;
4750
};

src/types/ListCommunities.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
22
import type { CommunitySortType } from "./CommunitySortType";
33
import type { ListingType } from "./ListingType";
4+
import type { MultiCommunityId } from "./MultiCommunityId";
45
import type { PaginationCursor } from "./PaginationCursor";
56

67
/**
@@ -15,6 +16,9 @@ export type ListCommunities = {
1516
*/
1617
time_range_seconds?: number;
1718
show_nsfw?: boolean;
19+
multi_community_id?: MultiCommunityId;
20+
search_term?: string;
21+
search_title_only?: boolean;
1822
page_cursor?: PaginationCursor;
1923
limit?: number;
2024
};

src/types/ListMultiCommunities.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ export type ListMultiCommunities = {
1313
* IE 60 would give results for the past minute.
1414
*/
1515
time_range_seconds?: number;
16+
search_term?: string;
17+
search_title_only?: boolean;
1618
page_cursor?: PaginationCursor;
1719
limit?: number;
1820
};

src/types/ListPersons.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
2+
import type { PaginationCursor } from "./PaginationCursor";
3+
import type { PersonListingType } from "./PersonListingType";
4+
import type { PersonSortType } from "./PersonSortType";
5+
6+
export type ListPersons = {
7+
type_?: PersonListingType;
8+
sort?: PersonSortType;
9+
search_term?: string;
10+
search_title_only?: boolean;
11+
page_cursor?: PaginationCursor;
12+
limit?: number;
13+
};

src/types/PersonListingType.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
2+
3+
/**
4+
* A listing type for person fetches
5+
*/
6+
export type PersonListingType = "all" | "local";

0 commit comments

Comments
 (0)