mirror of
https://github.com/LemmyNet/lemmy-js-client.git
synced 2025-02-05 16:34:43 +00:00
Search combined (#457)
* Adding search combined types. * 0.20.0-search-combined.0 * 0.20.0-search-combined.1
This commit is contained in:
parent
034e4a3b5a
commit
e1bfcdcb81
23 changed files with 143 additions and 26 deletions
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "lemmy-js-client",
|
||||
"description": "A javascript / typescript client for Lemmy",
|
||||
"version": "0.20.0-inbox-combined.1",
|
||||
"version": "0.20.0-search-combined.1",
|
||||
"author": "Dessalines",
|
||||
"license": "AGPL-3.0",
|
||||
"main": "./dist/index.js",
|
||||
|
|
20
src/http.ts
20
src/http.ts
|
@ -184,6 +184,7 @@ import { ListInboxResponse } from "./types/ListInboxResponse";
|
|||
import { ListInbox } from "./types/ListInbox";
|
||||
import { MarkPersonCommentMentionAsRead } from "./types/MarkPersonCommentMentionAsRead";
|
||||
import { MarkPersonPostMentionAsRead } from "./types/MarkPersonPostMentionAsRead";
|
||||
import { GetCommentsSlimResponse } from "./types/GetCommentsSlimResponse";
|
||||
import {
|
||||
Body,
|
||||
Controller,
|
||||
|
@ -1244,6 +1245,25 @@ export class LemmyHttp extends Controller {
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get / fetch comments, but without the post or community.
|
||||
*/
|
||||
@Security("bearerAuth")
|
||||
@Security({})
|
||||
@Get("/comment/list/slim")
|
||||
@Tags("Comment")
|
||||
getCommentsSlim(
|
||||
@Queries() form: GetCommentsI = {},
|
||||
@Inject() options?: RequestOptions,
|
||||
) {
|
||||
return this.#wrapper<GetComments, GetCommentsSlimResponse>(
|
||||
HttpType.Get,
|
||||
"/comment/list/slim",
|
||||
form,
|
||||
options,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get / fetch comment.
|
||||
*/
|
||||
|
|
|
@ -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,10 @@ export { SaveComment } from "./types/SaveComment";
|
|||
export { SavePost } from "./types/SavePost";
|
||||
export { SaveUserSettings } from "./types/SaveUserSettings";
|
||||
export { Search } from "./types/Search";
|
||||
export { SearchCombinedPaginationCursor } from "./types/SearchCombinedPaginationCursor";
|
||||
export { SearchCombinedView } from "./types/SearchCombinedView";
|
||||
export { SearchResponse } from "./types/SearchResponse";
|
||||
export { SearchSortType } from "./types/SearchSortType";
|
||||
export { SearchType } from "./types/SearchType";
|
||||
export { SensitiveString } from "./types/SensitiveString";
|
||||
export { Site } from "./types/Site";
|
||||
|
|
22
src/types/CommentSlimView.ts
Normal file
22
src/types/CommentSlimView.ts
Normal 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;
|
||||
};
|
|
@ -51,4 +51,5 @@ export type CreateSite = {
|
|||
post_downvotes?: FederationMode;
|
||||
comment_upvotes?: FederationMode;
|
||||
comment_downvotes?: FederationMode;
|
||||
disable_donation_dialog?: boolean;
|
||||
};
|
||||
|
|
|
@ -156,4 +156,9 @@ export type EditSite = {
|
|||
* What kind of comment downvotes your site allows.
|
||||
*/
|
||||
comment_downvotes?: FederationMode;
|
||||
/**
|
||||
* If this is true, users will never see the dialog asking to support Lemmy development with
|
||||
* donations.
|
||||
*/
|
||||
disable_donation_dialog?: boolean;
|
||||
};
|
||||
|
|
7
src/types/GetCommentsSlimResponse.ts
Normal file
7
src/types/GetCommentsSlimResponse.ts
Normal 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> };
|
|
@ -30,6 +30,10 @@ export type GetPosts = {
|
|||
* If true, then show the nsfw posts (even if your user setting is to hide them)
|
||||
*/
|
||||
show_nsfw?: boolean;
|
||||
/**
|
||||
* If false, then show posts with media attached (even if your user setting is to hide them)
|
||||
*/
|
||||
hide_media?: boolean;
|
||||
/**
|
||||
* Whether to automatically mark fetched posts as read.
|
||||
*/
|
||||
|
|
|
@ -4,4 +4,4 @@ import type { ListingType } from "./ListingType";
|
|||
/**
|
||||
* Fetches a random community
|
||||
*/
|
||||
export type GetRandomCommunity = { type_?: ListingType };
|
||||
export type GetRandomCommunity = { type_?: ListingType; show_nsfw?: boolean };
|
||||
|
|
|
@ -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
|
||||
*/
|
||||
|
|
|
@ -115,4 +115,9 @@ export type LocalSite = {
|
|||
* What kind of comment downvotes your site allows.
|
||||
*/
|
||||
comment_downvotes: FederationMode;
|
||||
/**
|
||||
* If this is true, users will never see the dialog asking to support Lemmy development with
|
||||
* donations.
|
||||
*/
|
||||
disable_donation_dialog: boolean;
|
||||
};
|
||||
|
|
|
@ -86,4 +86,13 @@ export type LocalUser = {
|
|||
* Whether to automatically mark fetched posts as read.
|
||||
*/
|
||||
auto_mark_fetched_posts_as_read: boolean;
|
||||
/**
|
||||
* The last time a donation request was shown to this user. If this is more than a year ago,
|
||||
* a new notification request should be shown.
|
||||
*/
|
||||
last_donation_notification: string;
|
||||
/**
|
||||
* Whether to hide posts containing images/videos
|
||||
*/
|
||||
hide_media: boolean;
|
||||
};
|
||||
|
|
|
@ -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";
|
||||
|
|
|
@ -5,6 +5,7 @@ import type { Person } from "./Person";
|
|||
import type { PersonPostMention } from "./PersonPostMention";
|
||||
import type { Post } from "./Post";
|
||||
import type { PostAggregates } from "./PostAggregates";
|
||||
import type { PostTags } from "./PostTags";
|
||||
import type { SubscribedType } from "./SubscribedType";
|
||||
|
||||
/**
|
||||
|
@ -29,4 +30,5 @@ export type PersonPostMentionView = {
|
|||
creator_blocked: boolean;
|
||||
my_vote?: number;
|
||||
unread_comments: number;
|
||||
post_tags: PostTags;
|
||||
};
|
||||
|
|
11
src/types/ReportType.ts
Normal file
11
src/types/ReportType.ts
Normal 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";
|
|
@ -118,4 +118,8 @@ export type SaveUserSettings = {
|
|||
* Whether to automatically mark fetched posts as read.
|
||||
*/
|
||||
auto_mark_fetched_posts_as_read?: boolean;
|
||||
/**
|
||||
* Whether to hide posts containing images/videos.
|
||||
*/
|
||||
hide_media?: boolean;
|
||||
};
|
||||
|
|
|
@ -2,24 +2,25 @@
|
|||
import type { CommunityId } from "./CommunityId";
|
||||
import type { ListingType } from "./ListingType";
|
||||
import type { PersonId } from "./PersonId";
|
||||
import type { PostSortType } from "./PostSortType";
|
||||
import type { SearchCombinedPaginationCursor } from "./SearchCombinedPaginationCursor";
|
||||
import type { SearchSortType } from "./SearchSortType";
|
||||
import type { SearchType } from "./SearchType";
|
||||
|
||||
/**
|
||||
* Searches the site, given a query string, and some optional filters.
|
||||
* Searches the site, given a search term, and some optional filters.
|
||||
*/
|
||||
export type Search = {
|
||||
q: string;
|
||||
search_term?: string;
|
||||
community_id?: CommunityId;
|
||||
community_name?: string;
|
||||
creator_id?: PersonId;
|
||||
type_?: SearchType;
|
||||
sort?: PostSortType;
|
||||
sort?: SearchSortType;
|
||||
listing_type?: ListingType;
|
||||
page?: number;
|
||||
limit?: number;
|
||||
title_only?: boolean;
|
||||
post_url_only?: boolean;
|
||||
liked_only?: boolean;
|
||||
disliked_only?: boolean;
|
||||
page_cursor?: SearchCombinedPaginationCursor;
|
||||
page_back?: boolean;
|
||||
};
|
||||
|
|
6
src/types/SearchCombinedPaginationCursor.ts
Normal file
6
src/types/SearchCombinedPaginationCursor.ts
Normal 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.
|
||||
|
||||
/**
|
||||
* like PaginationCursor but for the modlog_combined
|
||||
*/
|
||||
export type SearchCombinedPaginationCursor = string;
|
11
src/types/SearchCombinedView.ts
Normal file
11
src/types/SearchCombinedView.ts
Normal 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.
|
||||
import type { CommentView } from "./CommentView";
|
||||
import type { CommunityView } from "./CommunityView";
|
||||
import type { PersonView } from "./PersonView";
|
||||
import type { PostView } from "./PostView";
|
||||
|
||||
export type SearchCombinedView =
|
||||
| ({ type_: "Post" } & PostView)
|
||||
| ({ type_: "Comment" } & CommentView)
|
||||
| ({ type_: "Community" } & CommunityView)
|
||||
| ({ type_: "Person" } & PersonView);
|
|
@ -1,17 +1,7 @@
|
|||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||
import type { CommentView } from "./CommentView";
|
||||
import type { CommunityView } from "./CommunityView";
|
||||
import type { PersonView } from "./PersonView";
|
||||
import type { PostView } from "./PostView";
|
||||
import type { SearchType } from "./SearchType";
|
||||
import type { SearchCombinedView } from "./SearchCombinedView";
|
||||
|
||||
/**
|
||||
* The search response, containing lists of the return type possibilities
|
||||
*/
|
||||
export type SearchResponse = {
|
||||
type_: SearchType;
|
||||
comments: Array<CommentView>;
|
||||
posts: Array<PostView>;
|
||||
communities: Array<CommunityView>;
|
||||
users: Array<PersonView>;
|
||||
};
|
||||
export type SearchResponse = { results: Array<SearchCombinedView> };
|
||||
|
|
6
src/types/SearchSortType.ts
Normal file
6
src/types/SearchSortType.ts
Normal 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.
|
||||
|
||||
/**
|
||||
* The search sort types.
|
||||
*/
|
||||
export type SearchSortType = "New" | "Top" | "Old";
|
|
@ -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 };
|
||||
|
|
|
@ -1,6 +1,3 @@
|
|||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||
|
||||
export type UploadImageResponse = {
|
||||
image_url: string;
|
||||
filename: string;
|
||||
};
|
||||
export type UploadImageResponse = { image_url: string; filename: string };
|
||||
|
|
Loading…
Reference in a new issue