Adding get random community, updating types from main. (#366)

This commit is contained in:
Dessalines 2024-10-02 12:53:36 -04:00 committed by GitHub
parent 4db375dd43
commit 482e4c65d0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 45 additions and 5 deletions

View file

@ -153,6 +153,7 @@ import { ListTaglines } from "./types/ListTaglines";
import { ListTaglinesResponse } from "./types/ListTaglinesResponse";
import { ListCustomEmojis } from "./types/ListCustomEmojis";
import { ListCustomEmojisResponse } from "./types/ListCustomEmojisResponse";
import { GetRandomCommunity } from "./types/GetRandomCommunity";
enum HttpType {
Get = "GET",
@ -538,6 +539,19 @@ export class LemmyHttp {
);
}
/**
* Get a random community.
*
* `HTTP.GET /community/random`
*/
getRandomCommunity(form: GetRandomCommunity) {
return this.#wrapper<GetRandomCommunity, CommunityResponse>(
HttpType.Get,
"/community/random",
form,
);
}
/**
* Create a post.
*

View file

@ -91,6 +91,7 @@ export { EditPrivateMessage } from "./types/EditPrivateMessage";
export { EditSite } from "./types/EditSite";
export { FeaturePost } from "./types/FeaturePost";
export { FederatedInstances } from "./types/FederatedInstances";
export { FederationMode } from "./types/FederationMode";
export { FollowCommunity } from "./types/FollowCommunity";
export { GenerateTotpSecretResponse } from "./types/GenerateTotpSecretResponse";
export { GetCaptchaResponse } from "./types/GetCaptchaResponse";
@ -111,6 +112,7 @@ export { GetPostResponse } from "./types/GetPostResponse";
export { GetPosts } from "./types/GetPosts";
export { GetPostsResponse } from "./types/GetPostsResponse";
export { GetPrivateMessages } from "./types/GetPrivateMessages";
export { GetRandomCommunity } from "./types/GetRandomCommunity";
export { GetRegistrationApplication } from "./types/GetRegistrationApplication";
export { GetReplies } from "./types/GetReplies";
export { GetRepliesResponse } from "./types/GetRepliesResponse";

View file

@ -1,5 +1,6 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { CommentSortType } from "./CommentSortType";
import type { FederationMode } from "./FederationMode";
import type { LanguageId } from "./LanguageId";
import type { ListingType } from "./ListingType";
import type { PostListingMode } from "./PostListingMode";
@ -12,7 +13,6 @@ export interface CreateSite {
description?: string;
icon?: string;
banner?: string;
enable_downvotes?: boolean;
enable_nsfw?: boolean;
community_creation_admin_only?: boolean;
require_email_verification?: boolean;
@ -50,4 +50,8 @@ export interface CreateSite {
registration_mode?: RegistrationMode;
oauth_registration?: boolean;
content_warning?: string;
post_upvotes?: FederationMode;
post_downvotes?: FederationMode;
comment_upvotes?: FederationMode;
comment_downvotes?: FederationMode;
}

View file

@ -1,5 +1,6 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { CommentSortType } from "./CommentSortType";
import type { FederationMode } from "./FederationMode";
import type { LanguageId } from "./LanguageId";
import type { ListingType } from "./ListingType";
import type { PostListingMode } from "./PostListingMode";
@ -12,7 +13,6 @@ export interface EditSite {
description?: string;
icon?: string;
banner?: string;
enable_downvotes?: boolean;
enable_nsfw?: boolean;
community_creation_admin_only?: boolean;
require_email_verification?: boolean;
@ -49,7 +49,11 @@ export interface EditSite {
blocked_instances?: Array<string>;
blocked_urls?: Array<string>;
registration_mode?: RegistrationMode;
oauth_registration?: boolean;
reports_email_admins?: boolean;
content_warning?: string;
oauth_registration?: boolean;
post_upvotes?: FederationMode;
post_downvotes?: FederationMode;
comment_upvotes?: FederationMode;
comment_downvotes?: FederationMode;
}

View file

@ -0,0 +1,3 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
export type FederationMode = "All" | "Local" | "Disable";

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 { ListingType } from "./ListingType";
export interface GetRandomCommunity {
type_?: ListingType;
}

View file

@ -16,6 +16,8 @@ export interface GetSiteResponse {
my_user?: MyUserInfo;
all_languages: Array<Language>;
discussion_languages: Array<LanguageId>;
taglines: Array<null>;
custom_emojis: Array<null>;
tagline?: Tagline;
oauth_providers?: Array<PublicOAuthProvider>;
admin_oauth_providers?: Array<OAuthProvider>;

View file

@ -37,7 +37,7 @@ export type LemmyErrorType =
| { error: "person_is_blocked" }
| { error: "community_is_blocked" }
| { error: "instance_is_blocked" }
| { error: "downvotes_are_disabled" }
| { error: "vote_not_allowed" }
| { error: "instance_is_private" }
| { error: "invalid_password" }
| { error: "site_description_length_overflow" }

View file

@ -1,5 +1,6 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { CommentSortType } from "./CommentSortType";
import type { FederationMode } from "./FederationMode";
import type { ListingType } from "./ListingType";
import type { LocalSiteId } from "./LocalSiteId";
import type { PostListingMode } from "./PostListingMode";
@ -11,7 +12,6 @@ export interface LocalSite {
id: LocalSiteId;
site_id: SiteId;
site_setup: boolean;
enable_downvotes: boolean;
community_creation_admin_only: boolean;
require_email_verification: boolean;
application_question?: string;
@ -35,4 +35,8 @@ export interface LocalSite {
default_post_sort_type: PostSortType;
default_comment_sort_type: CommentSortType;
oauth_registration: boolean;
post_upvotes: FederationMode;
post_downvotes: FederationMode;
comment_upvotes: FederationMode;
comment_downvotes: FederationMode;
}

View file

@ -3,4 +3,5 @@ import type { SiteView } from "./SiteView";
export interface SiteResponse {
site_view: SiteView;
taglines: Array<null>;
}