mirror of
https://github.com/LemmyNet/lemmy-js-client.git
synced 2025-02-10 19:04:44 +00:00
Combined reports (#419)
* Adding list reports. * 0.20.0-reports-combined.0 * Fix comment. * Use internal tagging. * 0.20.0-reports-combined.1 * 0.20.0-reports-combined.2 * 0.20.0-reports-combined.3
This commit is contained in:
parent
56652a2c42
commit
32b5582df2
18 changed files with 72 additions and 125 deletions
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "lemmy-js-client",
|
"name": "lemmy-js-client",
|
||||||
"description": "A javascript / typescript client for Lemmy",
|
"description": "A javascript / typescript client for Lemmy",
|
||||||
"version": "0.20.0-api-v4.17",
|
"version": "0.20.0-reports-combined.3",
|
||||||
"author": "Dessalines <tyhou13@gmx.com>",
|
"author": "Dessalines <tyhou13@gmx.com>",
|
||||||
"license": "AGPL-3.0",
|
"license": "AGPL-3.0",
|
||||||
"main": "./dist/index.js",
|
"main": "./dist/index.js",
|
||||||
|
|
65
src/http.ts
65
src/http.ts
|
@ -76,14 +76,8 @@ import { GetSiteMetadataResponse } from "./types/GetSiteMetadataResponse";
|
||||||
import { GetSiteResponse } from "./types/GetSiteResponse";
|
import { GetSiteResponse } from "./types/GetSiteResponse";
|
||||||
import { GetUnreadCountResponse } from "./types/GetUnreadCountResponse";
|
import { GetUnreadCountResponse } from "./types/GetUnreadCountResponse";
|
||||||
import { GetUnreadRegistrationApplicationCountResponse } from "./types/GetUnreadRegistrationApplicationCountResponse";
|
import { GetUnreadRegistrationApplicationCountResponse } from "./types/GetUnreadRegistrationApplicationCountResponse";
|
||||||
import { ListCommentReports } from "./types/ListCommentReports";
|
|
||||||
import { ListCommentReportsResponse } from "./types/ListCommentReportsResponse";
|
|
||||||
import { ListCommunities } from "./types/ListCommunities";
|
import { ListCommunities } from "./types/ListCommunities";
|
||||||
import { ListCommunitiesResponse } from "./types/ListCommunitiesResponse";
|
import { ListCommunitiesResponse } from "./types/ListCommunitiesResponse";
|
||||||
import { ListPostReports } from "./types/ListPostReports";
|
|
||||||
import { ListPostReportsResponse } from "./types/ListPostReportsResponse";
|
|
||||||
import { ListPrivateMessageReports } from "./types/ListPrivateMessageReports";
|
|
||||||
import { ListPrivateMessageReportsResponse } from "./types/ListPrivateMessageReportsResponse";
|
|
||||||
import { ListRegistrationApplications } from "./types/ListRegistrationApplications";
|
import { ListRegistrationApplications } from "./types/ListRegistrationApplications";
|
||||||
import { ListRegistrationApplicationsResponse } from "./types/ListRegistrationApplicationsResponse";
|
import { ListRegistrationApplicationsResponse } from "./types/ListRegistrationApplicationsResponse";
|
||||||
import { LockPost } from "./types/LockPost";
|
import { LockPost } from "./types/LockPost";
|
||||||
|
@ -159,6 +153,8 @@ import { GetCommunityPendingFollowsCountResponse } from "./types/GetCommunityPen
|
||||||
import { ListCommunityPendingFollowsResponse } from "./types/ListCommunityPendingFollowsResponse";
|
import { ListCommunityPendingFollowsResponse } from "./types/ListCommunityPendingFollowsResponse";
|
||||||
import { ListCommunityPendingFollows } from "./types/ListCommunityPendingFollows";
|
import { ListCommunityPendingFollows } from "./types/ListCommunityPendingFollows";
|
||||||
import { CommunityId } from "./types/CommunityId";
|
import { CommunityId } from "./types/CommunityId";
|
||||||
|
import { ListReports } from "./types/ListReports";
|
||||||
|
import { ListReportsResponse } from "./types/ListReportsResponse";
|
||||||
import { MyUserInfo } from "./types/MyUserInfo";
|
import { MyUserInfo } from "./types/MyUserInfo";
|
||||||
import { UserBlockInstanceParams } from "./types/UserBlockInstanceParams";
|
import { UserBlockInstanceParams } from "./types/UserBlockInstanceParams";
|
||||||
import { AdminAllowInstanceParams } from "./types/AdminAllowInstanceParams";
|
import { AdminAllowInstanceParams } from "./types/AdminAllowInstanceParams";
|
||||||
|
@ -874,20 +870,6 @@ export class LemmyHttp {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* List post reports.
|
|
||||||
*
|
|
||||||
* `HTTP.GET /post/report/list`
|
|
||||||
*/
|
|
||||||
listPostReports(form: ListPostReports, options?: RequestOptions) {
|
|
||||||
return this.#wrapper<ListPostReports, ListPostReportsResponse>(
|
|
||||||
HttpType.Get,
|
|
||||||
"/post/report/list",
|
|
||||||
form,
|
|
||||||
options,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fetch metadata for any given site.
|
* Fetch metadata for any given site.
|
||||||
*
|
*
|
||||||
|
@ -1087,20 +1069,6 @@ export class LemmyHttp {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* List comment reports.
|
|
||||||
*
|
|
||||||
* `HTTP.GET /comment/report/list`
|
|
||||||
*/
|
|
||||||
listCommentReports(form: ListCommentReports, options?: RequestOptions) {
|
|
||||||
return this.#wrapper<ListCommentReports, ListCommentReportsResponse>(
|
|
||||||
HttpType.Get,
|
|
||||||
"/comment/report/list",
|
|
||||||
form,
|
|
||||||
options,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get / fetch private messages.
|
* Get / fetch private messages.
|
||||||
*
|
*
|
||||||
|
@ -1204,21 +1172,6 @@ export class LemmyHttp {
|
||||||
>(HttpType.Put, "/private_message/report/resolve", form, options);
|
>(HttpType.Put, "/private_message/report/resolve", form, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* List private message reports.
|
|
||||||
*
|
|
||||||
* `HTTP.GET /private_message/report/list`
|
|
||||||
*/
|
|
||||||
listPrivateMessageReports(
|
|
||||||
form: ListPrivateMessageReports,
|
|
||||||
options?: RequestOptions,
|
|
||||||
) {
|
|
||||||
return this.#wrapper<
|
|
||||||
ListPrivateMessageReports,
|
|
||||||
ListPrivateMessageReportsResponse
|
|
||||||
>(HttpType.Get, "/private_message/report/list", form, options);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Register a new user.
|
* Register a new user.
|
||||||
*
|
*
|
||||||
|
@ -1830,6 +1783,20 @@ export class LemmyHttp {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* List user reports.
|
||||||
|
*
|
||||||
|
* `HTTP.GET /report/list`
|
||||||
|
*/
|
||||||
|
listReports(form: ListReports, options?: RequestOptions) {
|
||||||
|
return this.#wrapper<ListReports, ListReportsResponse>(
|
||||||
|
HttpType.Get,
|
||||||
|
"/report/list",
|
||||||
|
form,
|
||||||
|
options,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Block an instance as user.
|
* Block an instance as user.
|
||||||
*
|
*
|
||||||
|
|
12
src/index.ts
12
src/index.ts
|
@ -147,8 +147,6 @@ export { LemmyErrorType } from "./types/LemmyErrorType";
|
||||||
export { LinkMetadata } from "./types/LinkMetadata";
|
export { LinkMetadata } from "./types/LinkMetadata";
|
||||||
export { ListCommentLikes } from "./types/ListCommentLikes";
|
export { ListCommentLikes } from "./types/ListCommentLikes";
|
||||||
export { ListCommentLikesResponse } from "./types/ListCommentLikesResponse";
|
export { ListCommentLikesResponse } from "./types/ListCommentLikesResponse";
|
||||||
export { ListCommentReports } from "./types/ListCommentReports";
|
|
||||||
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 { ListCommunityPendingFollows } from "./types/ListCommunityPendingFollows";
|
export { ListCommunityPendingFollows } from "./types/ListCommunityPendingFollows";
|
||||||
|
@ -160,12 +158,10 @@ export { ListMedia } from "./types/ListMedia";
|
||||||
export { ListMediaResponse } from "./types/ListMediaResponse";
|
export { ListMediaResponse } from "./types/ListMediaResponse";
|
||||||
export { ListPostLikes } from "./types/ListPostLikes";
|
export { ListPostLikes } from "./types/ListPostLikes";
|
||||||
export { ListPostLikesResponse } from "./types/ListPostLikesResponse";
|
export { ListPostLikesResponse } from "./types/ListPostLikesResponse";
|
||||||
export { ListPostReports } from "./types/ListPostReports";
|
|
||||||
export { ListPostReportsResponse } from "./types/ListPostReportsResponse";
|
|
||||||
export { ListPrivateMessageReports } from "./types/ListPrivateMessageReports";
|
|
||||||
export { ListPrivateMessageReportsResponse } from "./types/ListPrivateMessageReportsResponse";
|
|
||||||
export { ListRegistrationApplications } from "./types/ListRegistrationApplications";
|
export { ListRegistrationApplications } from "./types/ListRegistrationApplications";
|
||||||
export { ListRegistrationApplicationsResponse } from "./types/ListRegistrationApplicationsResponse";
|
export { ListRegistrationApplicationsResponse } from "./types/ListRegistrationApplicationsResponse";
|
||||||
|
export { ListReports } from "./types/ListReports";
|
||||||
|
export { ListReportsResponse } from "./types/ListReportsResponse";
|
||||||
export { ListTaglines } from "./types/ListTaglines";
|
export { ListTaglines } from "./types/ListTaglines";
|
||||||
export { ListTaglinesResponse } from "./types/ListTaglinesResponse";
|
export { ListTaglinesResponse } from "./types/ListTaglinesResponse";
|
||||||
export { ListingType } from "./types/ListingType";
|
export { ListingType } from "./types/ListingType";
|
||||||
|
@ -265,6 +261,10 @@ export { RegistrationMode } from "./types/RegistrationMode";
|
||||||
export { RemoveComment } from "./types/RemoveComment";
|
export { RemoveComment } from "./types/RemoveComment";
|
||||||
export { RemoveCommunity } from "./types/RemoveCommunity";
|
export { RemoveCommunity } from "./types/RemoveCommunity";
|
||||||
export { RemovePost } from "./types/RemovePost";
|
export { RemovePost } from "./types/RemovePost";
|
||||||
|
export { ReportCombined } from "./types/ReportCombined";
|
||||||
|
export { ReportCombinedId } from "./types/ReportCombinedId";
|
||||||
|
export { ReportCombinedPaginationCursor } from "./types/ReportCombinedPaginationCursor";
|
||||||
|
export { ReportCombinedView } from "./types/ReportCombinedView";
|
||||||
export { ResolveCommentReport } from "./types/ResolveCommentReport";
|
export { ResolveCommentReport } from "./types/ResolveCommentReport";
|
||||||
export { ResolveObject } from "./types/ResolveObject";
|
export { ResolveObject } from "./types/ResolveObject";
|
||||||
export { ResolveObjectResponse } from "./types/ResolveObjectResponse";
|
export { ResolveObjectResponse } from "./types/ResolveObjectResponse";
|
||||||
|
|
|
@ -8,5 +8,5 @@ export type AdminAllowInstance = {
|
||||||
admin_person_id: PersonId;
|
admin_person_id: PersonId;
|
||||||
allowed: boolean;
|
allowed: boolean;
|
||||||
reason?: string;
|
reason?: string;
|
||||||
published: string;
|
when_: string;
|
||||||
};
|
};
|
||||||
|
|
|
@ -9,5 +9,5 @@ export type AdminBlockInstance = {
|
||||||
blocked: boolean;
|
blocked: boolean;
|
||||||
reason?: string;
|
reason?: string;
|
||||||
expires?: string;
|
expires?: string;
|
||||||
published: string;
|
when_: string;
|
||||||
};
|
};
|
||||||
|
|
|
@ -6,7 +6,6 @@ import type { OAuthProviderId } from "./OAuthProviderId";
|
||||||
*/
|
*/
|
||||||
export type AuthenticateWithOauth = {
|
export type AuthenticateWithOauth = {
|
||||||
code: string;
|
code: string;
|
||||||
pkce_code_verifier?: string;
|
|
||||||
oauth_provider_id: OAuthProviderId;
|
oauth_provider_id: OAuthProviderId;
|
||||||
redirect_uri: string;
|
redirect_uri: string;
|
||||||
show_nsfw?: boolean;
|
show_nsfw?: boolean;
|
||||||
|
@ -18,4 +17,5 @@ export type AuthenticateWithOauth = {
|
||||||
* An answer is mandatory if require application is enabled on the server
|
* An answer is mandatory if require application is enabled on the server
|
||||||
*/
|
*/
|
||||||
answer?: string;
|
answer?: string;
|
||||||
|
pkce_code_verifier?: string;
|
||||||
};
|
};
|
||||||
|
|
|
@ -38,4 +38,5 @@ export type GetPosts = {
|
||||||
*/
|
*/
|
||||||
no_comments_only?: boolean;
|
no_comments_only?: boolean;
|
||||||
page_cursor?: PaginationCursor;
|
page_cursor?: PaginationCursor;
|
||||||
|
page_back?: boolean;
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,12 +1,6 @@
|
||||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
// 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";
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A response for the number of reports.
|
* A response for the number of reports.
|
||||||
*/
|
*/
|
||||||
export type GetReportCountResponse = {
|
export type GetReportCountResponse = { count: number };
|
||||||
community_id?: CommunityId;
|
|
||||||
comment_reports: number;
|
|
||||||
post_reports: number;
|
|
||||||
private_message_reports?: number;
|
|
||||||
};
|
|
||||||
|
|
|
@ -1,9 +0,0 @@
|
||||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
|
||||||
import type { CommentReportView } from "./CommentReportView";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The comment report list response.
|
|
||||||
*/
|
|
||||||
export type ListCommentReportsResponse = {
|
|
||||||
comment_reports: Array<CommentReportView>;
|
|
||||||
};
|
|
|
@ -1,20 +0,0 @@
|
||||||
// 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";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* List post reports.
|
|
||||||
*/
|
|
||||||
export type ListPostReports = {
|
|
||||||
page?: number;
|
|
||||||
limit?: number;
|
|
||||||
/**
|
|
||||||
* Only shows the unresolved reports
|
|
||||||
*/
|
|
||||||
unresolved_only?: boolean;
|
|
||||||
/**
|
|
||||||
* if no community is given, it returns reports for all communities moderated by the auth user
|
|
||||||
*/
|
|
||||||
community_id?: CommunityId;
|
|
||||||
post_id?: PostId;
|
|
||||||
};
|
|
|
@ -1,13 +0,0 @@
|
||||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
|
||||||
|
|
||||||
/**
|
|
||||||
* List private message reports.
|
|
||||||
*/
|
|
||||||
export type ListPrivateMessageReports = {
|
|
||||||
page?: number;
|
|
||||||
limit?: number;
|
|
||||||
/**
|
|
||||||
* Only shows the unresolved reports
|
|
||||||
*/
|
|
||||||
unresolved_only?: boolean;
|
|
||||||
};
|
|
|
@ -1,9 +0,0 @@
|
||||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
|
||||||
import type { PrivateMessageReportView } from "./PrivateMessageReportView";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The response for list private message reports.
|
|
||||||
*/
|
|
||||||
export type ListPrivateMessageReportsResponse = {
|
|
||||||
private_message_reports: Array<PrivateMessageReportView>;
|
|
||||||
};
|
|
|
@ -1,14 +1,11 @@
|
||||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
// 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";
|
|
||||||
import type { CommunityId } from "./CommunityId";
|
import type { CommunityId } from "./CommunityId";
|
||||||
|
import type { ReportCombinedPaginationCursor } from "./ReportCombinedPaginationCursor";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* List comment reports.
|
* List reports.
|
||||||
*/
|
*/
|
||||||
export type ListCommentReports = {
|
export type ListReports = {
|
||||||
comment_id?: CommentId;
|
|
||||||
page?: number;
|
|
||||||
limit?: number;
|
|
||||||
/**
|
/**
|
||||||
* Only shows the unresolved reports
|
* Only shows the unresolved reports
|
||||||
*/
|
*/
|
||||||
|
@ -17,4 +14,6 @@ export type ListCommentReports = {
|
||||||
* if no community is given, it returns reports for all communities moderated by the auth user
|
* if no community is given, it returns reports for all communities moderated by the auth user
|
||||||
*/
|
*/
|
||||||
community_id?: CommunityId;
|
community_id?: CommunityId;
|
||||||
|
page_cursor?: ReportCombinedPaginationCursor;
|
||||||
|
page_back?: boolean;
|
||||||
};
|
};
|
|
@ -1,7 +1,7 @@
|
||||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||||
import type { PostReportView } from "./PostReportView";
|
import type { ReportCombinedView } from "./ReportCombinedView";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The post reports response.
|
* The post reports response.
|
||||||
*/
|
*/
|
||||||
export type ListPostReportsResponse = { post_reports: Array<PostReportView> };
|
export type ListReportsResponse = { reports: Array<ReportCombinedView> };
|
16
src/types/ReportCombined.ts
Normal file
16
src/types/ReportCombined.ts
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||||
|
import type { CommentReportId } from "./CommentReportId";
|
||||||
|
import type { PostReportId } from "./PostReportId";
|
||||||
|
import type { PrivateMessageReportId } from "./PrivateMessageReportId";
|
||||||
|
import type { ReportCombinedId } from "./ReportCombinedId";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A combined reports table.
|
||||||
|
*/
|
||||||
|
export type ReportCombined = {
|
||||||
|
id: ReportCombinedId;
|
||||||
|
published: string;
|
||||||
|
post_report_id?: PostReportId;
|
||||||
|
comment_report_id?: CommentReportId;
|
||||||
|
private_message_report_id?: PrivateMessageReportId;
|
||||||
|
};
|
6
src/types/ReportCombinedId.ts
Normal file
6
src/types/ReportCombinedId.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 report combined id
|
||||||
|
*/
|
||||||
|
export type ReportCombinedId = number;
|
6
src/types/ReportCombinedPaginationCursor.ts
Normal file
6
src/types/ReportCombinedPaginationCursor.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 report_combined table
|
||||||
|
*/
|
||||||
|
export type ReportCombinedPaginationCursor = string;
|
9
src/types/ReportCombinedView.ts
Normal file
9
src/types/ReportCombinedView.ts
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||||
|
import type { CommentReportView } from "./CommentReportView";
|
||||||
|
import type { PostReportView } from "./PostReportView";
|
||||||
|
import type { PrivateMessageReportView } from "./PrivateMessageReportView";
|
||||||
|
|
||||||
|
export type ReportCombinedView =
|
||||||
|
| ({ type_: "Post" } & PostReportView)
|
||||||
|
| ({ type_: "Comment" } & CommentReportView)
|
||||||
|
| ({ type_: "PrivateMessage" } & PrivateMessageReportView);
|
Loading…
Reference in a new issue