mirror of
https://github.com/LemmyNet/lemmy-js-client.git
synced 2024-11-26 06:11:14 +00:00
Add more type info.
This commit is contained in:
parent
f2b52372ab
commit
3f0e4ef05d
4 changed files with 18 additions and 5 deletions
|
@ -1,5 +1,5 @@
|
|||
import { Option, Some } from "@sniptt/monads";
|
||||
import { Expose, Transform } from "class-transformer";
|
||||
import { Expose, Transform, Type } from "class-transformer";
|
||||
import { toUndefined } from "../../utils";
|
||||
import { ListingType, SortType } from "../others";
|
||||
import { Site } from "../source";
|
||||
|
@ -38,6 +38,7 @@ export class GetCommunityResponse {
|
|||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||
@Expose()
|
||||
@Type(() => Site)
|
||||
site: Option<Site>;
|
||||
moderators: CommunityModeratorView[];
|
||||
online: number;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { Option, Some } from "@sniptt/monads";
|
||||
import { Expose, Transform } from "class-transformer";
|
||||
import { Expose, Transform, Type } from "class-transformer";
|
||||
import { toUndefined } from "../../utils";
|
||||
import { SortType } from "../others";
|
||||
import {
|
||||
|
@ -71,6 +71,7 @@ export class GetCaptchaResponse {
|
|||
/**
|
||||
* Will be undefined if captchas are disabled.
|
||||
*/
|
||||
@Type(() => CaptchaResponse)
|
||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||
@Expose()
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { Option, Some } from "@sniptt/monads";
|
||||
import { Expose, Transform } from "class-transformer";
|
||||
import { Expose, Transform, Type } from "class-transformer";
|
||||
import { toUndefined } from "../../utils";
|
||||
import { ListingType, SearchType, SortType } from "../others";
|
||||
import {
|
||||
|
@ -286,6 +286,7 @@ export class GetSiteResponse {
|
|||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||
@Expose()
|
||||
@Type(() => SiteView)
|
||||
site_view: Option<SiteView>;
|
||||
admins: PersonViewSafe[];
|
||||
online: number;
|
||||
|
@ -296,17 +297,19 @@ export class GetSiteResponse {
|
|||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||
@Expose()
|
||||
@Type(() => MyUserInfo)
|
||||
my_user: Option<MyUserInfo>;
|
||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||
@Expose()
|
||||
@Type(() => FederatedInstances)
|
||||
federated_instances: Option<FederatedInstances>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Your user info, such as blocks, follows, etc.
|
||||
*/
|
||||
export interface MyUserInfo {
|
||||
export class MyUserInfo {
|
||||
local_user_view: LocalUserSettingsView;
|
||||
follows: CommunityFollowerView[];
|
||||
moderates: CommunityModeratorView[];
|
||||
|
@ -375,18 +378,22 @@ export class ResolveObjectResponse {
|
|||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||
@Expose()
|
||||
@Type(() => CommentView)
|
||||
comment: Option<CommentView>;
|
||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||
@Expose()
|
||||
@Type(() => PostView)
|
||||
post: Option<PostView>;
|
||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||
@Expose()
|
||||
@Type(() => CommunityView)
|
||||
community: Option<CommunityView>;
|
||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||
@Expose()
|
||||
@Type(() => PersonViewSafe)
|
||||
person: Option<PersonViewSafe>;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { Option, Some } from "@sniptt/monads";
|
||||
import { Expose, Transform } from "class-transformer";
|
||||
import { Expose, Transform, Type } from "class-transformer";
|
||||
import { toUndefined } from "../utils";
|
||||
import {
|
||||
CommentAggregates,
|
||||
|
@ -103,6 +103,7 @@ export class PostReportView {
|
|||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||
@Expose()
|
||||
@Type(() => PersonSafe)
|
||||
resolver: Option<PersonSafe>;
|
||||
}
|
||||
|
||||
|
@ -112,6 +113,7 @@ export class CommentView {
|
|||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||
@Expose()
|
||||
@Type(() => PersonSafe)
|
||||
recipient: Option<PersonSafe>;
|
||||
post: Post;
|
||||
community: CommunitySafe;
|
||||
|
@ -142,6 +144,7 @@ export class CommentReportView {
|
|||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||
@Expose()
|
||||
@Type(() => PersonSafe)
|
||||
resolver: Option<PersonSafe>;
|
||||
}
|
||||
|
||||
|
@ -253,5 +256,6 @@ export class RegistrationApplicationView {
|
|||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||
@Expose()
|
||||
@Type(() => PersonSafe)
|
||||
admin: Option<PersonSafe>;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue