Skip to content

Commit

Permalink
Add list media (#247)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
dessalines and SleeplessOne1917 committed Mar 26, 2024
1 parent 18b6b84 commit 5157c28
Show file tree
Hide file tree
Showing 8 changed files with 55 additions and 0 deletions.
28 changes: 28 additions & 0 deletions src/http.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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.
*
Expand Down
3 changes: 3 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -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";
Expand Down
1 change: 1 addition & 0 deletions src/types/CommentReplyView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 6 additions & 0 deletions src/types/ListMedia.ts
Original file line number Diff line number Diff line change
@@ -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;
}
6 changes: 6 additions & 0 deletions src/types/ListMediaResponse.ts
Original file line number Diff line number Diff line change
@@ -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 changes: 9 additions & 0 deletions src/types/LocalImage.ts
Original file line number Diff line number Diff line change
@@ -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;
}
1 change: 1 addition & 0 deletions src/types/PersonMentionView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions src/types/VoteView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@ import type { Person } from "./Person";

export interface VoteView {
creator: Person;
creator_banned_from_community: boolean;
score: number;
}

0 comments on commit 5157c28

Please sign in to comment.