Add list media (#247)

* Adding listMedia, and a few more additions from main.

* 0.19.4-alpha.7

* Make local_user optional.

* Adding listAllMedia.

* 0.19.4-alpha.9

* Default param.

* 0.19.4-alpha.10

* Move list_media to /account/

* 0.19.4-alpha.12

* Adding other is_banned fields.

* 0.19.4-alpha.13

* Adding more from main.

---------

Co-authored-by: SleeplessOne1917 <28871516+SleeplessOne1917@users.noreply.github.com>
This commit is contained in:
Dessalines 2024-03-26 18:36:20 -04:00 committed by GitHub
parent 18b6b849a0
commit 5157c28aba
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 55 additions and 0 deletions

View file

@ -137,6 +137,8 @@ import { ListPostLikesResponse } from "./types/ListPostLikesResponse";
import { ListCommentLikes } from "./types/ListCommentLikes";
import { ListCommentLikesResponse } from "./types/ListCommentLikesResponse";
import { HidePost } from "./types/HidePost";
import { ListMedia } from "./types/ListMedia";
import { ListMediaResponse } from "./types/ListMediaResponse";
enum HttpType {
Get = "GET",
@ -288,6 +290,32 @@ export class LemmyHttp {
);
}
/**
* List all the media for your user
*
* `HTTP.GET /account/list_media`
*/
listMedia(form: ListMedia = {}) {
return this.#wrapper<ListMedia, ListMediaResponse>(
HttpType.Get,
"/account/list_media",
form,
);
}
/**
* List all the media known to your instance.
*
* `HTTP.GET /admin/list_all_media`
*/
listAllMedia(form: ListMedia = {}) {
return this.#wrapper<ListMedia, ListMediaResponse>(
HttpType.Get,
"/admin/list_all_media",
form,
);
}
/**
* Enable / Disable TOTP / two-factor authentication.
*

View file

@ -125,6 +125,8 @@ export { ListCommentReports } from "./types/ListCommentReports";
export { ListCommentReportsResponse } from "./types/ListCommentReportsResponse";
export { ListCommunities } from "./types/ListCommunities";
export { ListCommunitiesResponse } from "./types/ListCommunitiesResponse";
export { ListMedia } from "./types/ListMedia";
export { ListMediaResponse } from "./types/ListMediaResponse";
export { ListPostLikes } from "./types/ListPostLikes";
export { ListPostLikesResponse } from "./types/ListPostLikesResponse";
export { ListPostReports } from "./types/ListPostReports";
@ -134,6 +136,7 @@ export { ListPrivateMessageReportsResponse } from "./types/ListPrivateMessageRep
export { ListRegistrationApplications } from "./types/ListRegistrationApplications";
export { ListRegistrationApplicationsResponse } from "./types/ListRegistrationApplicationsResponse";
export { ListingType } from "./types/ListingType";
export { LocalImage } from "./types/LocalImage";
export { LocalSite } from "./types/LocalSite";
export { LocalSiteId } from "./types/LocalSiteId";
export { LocalSiteRateLimit } from "./types/LocalSiteRateLimit";

View file

@ -16,6 +16,7 @@ export interface CommentReplyView {
recipient: Person;
counts: CommentAggregates;
creator_banned_from_community: boolean;
banned_from_community: boolean;
creator_is_moderator: boolean;
creator_is_admin: boolean;
subscribed: SubscribedType;

6
src/types/ListMedia.ts Normal file
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.
export interface ListMedia {
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 { LocalImage } from "./LocalImage";
export interface ListMediaResponse {
images: Array<LocalImage>;
}

9
src/types/LocalImage.ts Normal file
View 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 { LocalUserId } from "./LocalUserId";
export interface LocalImage {
local_user_id?: LocalUserId;
pictrs_alias: string;
pictrs_delete_token: string;
published: string;
}

View file

@ -16,6 +16,7 @@ export interface PersonMentionView {
recipient: Person;
counts: CommentAggregates;
creator_banned_from_community: boolean;
banned_from_community: boolean;
creator_is_moderator: boolean;
creator_is_admin: boolean;
subscribed: SubscribedType;

View file

@ -3,5 +3,6 @@ import type { Person } from "./Person";
export interface VoteView {
creator: Person;
creator_banned_from_community: boolean;
score: number;
}