From 13ed39d527548995c14139b458ee31db362bd9fd Mon Sep 17 00:00:00 2001 From: Anon Date: Fri, 13 Jan 2023 17:51:10 -0600 Subject: [PATCH] Fixes for monads --- src/http.ts | 23 +++-------------------- src/interfaces/api/custom_emoji.ts | 1 - src/interfaces/api/site.ts | 2 +- src/interfaces/source.ts | 5 +---- src/interfaces/views.ts | 2 -- 5 files changed, 5 insertions(+), 28 deletions(-) diff --git a/src/http.ts b/src/http.ts index 1e1d870..47d4f94 100644 --- a/src/http.ts +++ b/src/http.ts @@ -36,9 +36,7 @@ import { } from "./interfaces/api/community"; import { CreateCustomEmoji, - CustomEmojiResponse, DeleteCustomEmoji, - DeleteCustomEmojiResponse, EditCustomEmoji, } from "./interfaces/api/custom_emoji"; import { @@ -1167,12 +1165,7 @@ export class LemmyHttp { * `HTTP.POST /custom_emoji` */ async createCustomEmoji(form: CreateCustomEmoji) { - return this.wrapper( - HttpType.Post, - "/custom_emoji", - form, - CustomEmojiResponse - ); + return this.wrapper(HttpType.Post, "/custom_emoji", form); } /** @@ -1181,12 +1174,7 @@ export class LemmyHttp { * `HTTP.PUT /custom_emoji` */ async editCustomEmoji(form: EditCustomEmoji) { - return this.wrapper( - HttpType.Put, - "/custom_emoji", - form, - CustomEmojiResponse - ); + return this.wrapper(HttpType.Put, "/custom_emoji", form); } /** @@ -1195,12 +1183,7 @@ export class LemmyHttp { * `HTTP.Post /custom_emoji/delete` */ async deleteCustomEmoji(form: DeleteCustomEmoji) { - return this.wrapper( - HttpType.Post, - "/custom_emoji/delete", - form, - DeleteCustomEmojiResponse - ); + return this.wrapper(HttpType.Post, "/custom_emoji/delete", form); } private buildFullUrl(endpoint: string): string { diff --git a/src/interfaces/api/custom_emoji.ts b/src/interfaces/api/custom_emoji.ts index 47386b0..df1bbef 100644 --- a/src/interfaces/api/custom_emoji.ts +++ b/src/interfaces/api/custom_emoji.ts @@ -1,4 +1,3 @@ -import "reflect-metadata"; import { CustomEmojiView } from "../views"; export class CreateCustomEmoji { diff --git a/src/interfaces/api/site.ts b/src/interfaces/api/site.ts index e5c59a9..7c2401d 100644 --- a/src/interfaces/api/site.ts +++ b/src/interfaces/api/site.ts @@ -194,7 +194,7 @@ export interface GetSiteResponse { federated_instances?: FederatedInstances; all_languages: Language[]; discussion_languages: number[]; - taglines?: Tagline[]; + taglines: Tagline[]; custom_emojis: CustomEmojiView[]; } diff --git a/src/interfaces/source.ts b/src/interfaces/source.ts index 110d8e6..1cc66be 100644 --- a/src/interfaces/source.ts +++ b/src/interfaces/source.ts @@ -395,10 +395,7 @@ export class CustomEmoji { alt_text: string; category: string; published: string; - @Transform(({ value }) => toOption(value), { toClassOnly: true }) - @Transform(({ value }) => toUndefined(value), { toPlainOnly: true }) - @Expose() - updated: Option; + updated: string; } export class CustomEmojiKeyword { diff --git a/src/interfaces/views.ts b/src/interfaces/views.ts index 18bce41..b1caddf 100644 --- a/src/interfaces/views.ts +++ b/src/interfaces/views.ts @@ -293,8 +293,6 @@ export interface PrivateMessageReportView { } export class CustomEmojiView { - @Type(() => CustomEmoji) custom_emoji: CustomEmoji; - @Type(() => CustomEmojiKeyword) keywords: CustomEmojiKeyword[]; }