From 5cf9d8a134b6cb29b5be1b4ede38eaf8cffc06a7 Mon Sep 17 00:00:00 2001 From: Dessalines Date: Tue, 22 Nov 2022 15:12:24 -0500 Subject: [PATCH] Adding some API fixes. --- .prettierrc.js | 4 ---- .prettierrc.json | 4 ++++ package.json | 2 +- src/interfaces/api/community.ts | 13 +++++++++++++ src/interfaces/api/site.ts | 9 ++++++--- 5 files changed, 24 insertions(+), 8 deletions(-) delete mode 100644 .prettierrc.js create mode 100644 .prettierrc.json diff --git a/.prettierrc.js b/.prettierrc.js deleted file mode 100644 index 8d36af3..0000000 --- a/.prettierrc.js +++ /dev/null @@ -1,4 +0,0 @@ -module.exports = Object.assign(require("eslint-plugin-prettier"), { - arrowParens: "avoid", - semi: true, -}); diff --git a/.prettierrc.json b/.prettierrc.json new file mode 100644 index 0000000..15bc4fe --- /dev/null +++ b/.prettierrc.json @@ -0,0 +1,4 @@ +{ + "arrowParens": "avoid", + "semi": true +} diff --git a/package.json b/package.json index dd0f958..8f3e341 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ "scripts": { "build": "tsc", "docs": "typedoc src/index.ts --sourcefile-url-prefix 'https://github.com/LemmyNet/lemmy-js-client/tree/main/src/'", - "lint": "tsc --noEmit && eslint --report-unused-disable-directives --ext .js,.ts,.tsx src", + "lint": "tsc --noEmit && eslint --report-unused-disable-directives --ext .js,.ts,.tsx src && prettier --check src", "prepare": "yarn run build && husky install" }, "repository": "https://github.com/LemmyNet/lemmy-js-client", diff --git a/src/interfaces/api/community.ts b/src/interfaces/api/community.ts index b4f7099..af3eb98 100644 --- a/src/interfaces/api/community.ts +++ b/src/interfaces/api/community.ts @@ -45,6 +45,11 @@ export class GetCommunityResponse { @Type(() => CommunityModeratorView) moderators: CommunityModeratorView[]; online: number; + discussion_languages: number[]; + @Transform(({ value }) => toOption(value), { toClassOnly: true }) + @Transform(({ value }) => toUndefined(value), { toPlainOnly: true }) + @Expose() + default_post_language: Option; } export class CreateCommunity { @@ -70,6 +75,10 @@ export class CreateCommunity { @Transform(({ value }) => toUndefined(value), { toPlainOnly: true }) @Expose() posting_restricted_to_mods: Option; + @Transform(({ value }) => toOption(value), { toClassOnly: true }) + @Transform(({ value }) => toUndefined(value), { toPlainOnly: true }) + @Expose() + discussion_languages: Option; auth: string; constructor(init: CreateCommunity) { @@ -195,6 +204,10 @@ export class EditCommunity { @Transform(({ value }) => toUndefined(value), { toPlainOnly: true }) @Expose() posting_restricted_to_mods: Option; + @Transform(({ value }) => toOption(value), { toClassOnly: true }) + @Transform(({ value }) => toUndefined(value), { toPlainOnly: true }) + @Expose() + discussion_languages: Option; auth: string; constructor(init: EditCommunity) { diff --git a/src/interfaces/api/site.ts b/src/interfaces/api/site.ts index a843f9c..59048c2 100644 --- a/src/interfaces/api/site.ts +++ b/src/interfaces/api/site.ts @@ -221,7 +221,6 @@ export class CreateSite { @Transform(({ value }) => toUndefined(value), { toPlainOnly: true }) @Expose() application_email_admins: Option; - auth: string; @Transform(({ value }) => toOption(value), { toClassOnly: true }) @Transform(({ value }) => toUndefined(value), { toPlainOnly: true }) @Expose() @@ -318,6 +317,11 @@ export class CreateSite { @Transform(({ value }) => toUndefined(value), { toPlainOnly: true }) @Expose() blocked_instances: Option; + @Transform(({ value }) => toOption(value), { toClassOnly: true }) + @Transform(({ value }) => toUndefined(value), { toPlainOnly: true }) + @Expose() + taglines: Option; + auth: string; constructor(init: CreateSite) { Object.assign(this, init); } @@ -555,8 +559,7 @@ export class MyUserInfo { community_blocks: CommunityBlockView[]; @Type(() => PersonBlockView) person_blocks: PersonBlockView[]; - @Type(() => Language) - discussion_languages: Language[]; + discussion_languages: number[]; } export class LeaveAdmin {