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