Add language (#77)

* Add language_id for user, post, and comment creation.

* v0.17.0-rc.44
This commit is contained in:
Dessalines 2022-09-22 12:52:44 -04:00 committed by GitHub
parent ca66e1b8ba
commit c3b76c88b0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 38 additions and 6 deletions

View file

@ -1,7 +1,7 @@
{ {
"name": "lemmy-js-client", "name": "lemmy-js-client",
"description": "A javascript / typescript client for Lemmy", "description": "A javascript / typescript client for Lemmy",
"version": "0.17.0-rc.43", "version": "0.17.0-rc.44",
"author": "Dessalines <tyhou13@gmx.com>", "author": "Dessalines <tyhou13@gmx.com>",
"license": "AGPL-3.0", "license": "AGPL-3.0",
"main": "./dist/index.js", "main": "./dist/index.js",

View file

@ -11,6 +11,10 @@ export class CreateComment {
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true }) @Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
@Expose() @Expose()
parent_id: Option<number>; parent_id: Option<number>;
@Transform(({ value }) => toOption(value), { toClassOnly: true })
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
@Expose()
language_id: Option<number>;
post_id: number; post_id: number;
/** /**
* An optional front end ID, to tell which is comment is coming back. * An optional front end ID, to tell which is comment is coming back.
@ -39,6 +43,10 @@ export class EditComment {
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true }) @Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
@Expose() @Expose()
distinguished: Option<boolean>; distinguished: Option<boolean>;
@Transform(({ value }) => toOption(value), { toClassOnly: true })
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
@Expose()
language_id: Option<number>;
/** /**
* An optional front end ID, to tell which is comment is coming back. * An optional front end ID, to tell which is comment is coming back.
*/ */

View file

@ -136,7 +136,7 @@ export class SaveUserSettings {
@Transform(({ value }) => toOption(value), { toClassOnly: true }) @Transform(({ value }) => toOption(value), { toClassOnly: true })
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true }) @Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
@Expose() @Expose()
lang: Option<string>; interface_language: Option<string>;
@Transform(({ value }) => toOption(value), { toClassOnly: true }) @Transform(({ value }) => toOption(value), { toClassOnly: true })
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true }) @Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
@Expose() @Expose()
@ -189,6 +189,10 @@ export class SaveUserSettings {
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true }) @Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
@Expose() @Expose()
show_new_post_notifs: Option<boolean>; show_new_post_notifs: Option<boolean>;
@Transform(({ value }) => toOption(value), { toClassOnly: true })
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
@Expose()
discussion_languages: Option<number[]>;
auth: string; auth: string;
constructor(init: SaveUserSettings) { constructor(init: SaveUserSettings) {

View file

@ -24,6 +24,10 @@ export class CreatePost {
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true }) @Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
@Expose() @Expose()
nsfw: Option<boolean>; nsfw: Option<boolean>;
@Transform(({ value }) => toOption(value), { toClassOnly: true })
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
@Expose()
language_id: Option<number>;
community_id: number; community_id: number;
@Transform(({ value }) => toOption(value), { toClassOnly: true }) @Transform(({ value }) => toOption(value), { toClassOnly: true })
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true }) @Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
@ -149,6 +153,10 @@ export class EditPost {
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true }) @Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
@Expose() @Expose()
nsfw: Option<boolean>; nsfw: Option<boolean>;
@Transform(({ value }) => toOption(value), { toClassOnly: true })
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
@Expose()
language_id: Option<number>;
auth: string; auth: string;
constructor(init: EditPost) { constructor(init: EditPost) {

View file

@ -2,7 +2,8 @@ import { Option } from "@sniptt/monads";
import { Expose, Transform, Type } from "class-transformer"; import { Expose, Transform, Type } from "class-transformer";
import "reflect-metadata"; import "reflect-metadata";
import { toOption, toUndefined } from "../../utils"; import { toOption, toUndefined } from "../../utils";
import { ListingType, SearchType, SortType, ModlogActionType } from "../others"; import { ListingType, ModlogActionType, SearchType, SortType } from "../others";
import { Language } from "../source";
import { import {
AdminPurgeCommentView, AdminPurgeCommentView,
AdminPurgeCommunityView, AdminPurgeCommunityView,
@ -96,7 +97,6 @@ export class SearchResponse {
users: PersonViewSafe[]; users: PersonViewSafe[];
} }
export class GetModlog { export class GetModlog {
@Transform(({ value }) => toOption(value), { toClassOnly: true }) @Transform(({ value }) => toOption(value), { toClassOnly: true })
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true }) @Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
@ -345,6 +345,8 @@ export class GetSiteResponse {
@Expose() @Expose()
@Type(() => FederatedInstances) @Type(() => FederatedInstances)
federated_instances: Option<FederatedInstances>; federated_instances: Option<FederatedInstances>;
@Type(() => Language)
all_languages: Language[];
} }
/** /**
@ -361,6 +363,8 @@ export class MyUserInfo {
community_blocks: CommunityBlockView[]; community_blocks: CommunityBlockView[];
@Type(() => PersonBlockView) @Type(() => PersonBlockView)
person_blocks: PersonBlockView[]; person_blocks: PersonBlockView[];
@Type(() => Language)
discussion_languages: Language[];
} }
export class LeaveAdmin { export class LeaveAdmin {

View file

@ -13,7 +13,7 @@ export class LocalUserSettings {
theme: string; theme: string;
default_sort_type: number; default_sort_type: number;
default_listing_type: number; default_listing_type: number;
lang: string; interface_language: string;
show_avatars: boolean; show_avatars: boolean;
send_notifications_to_email: boolean; send_notifications_to_email: boolean;
show_bot_accounts: boolean; show_bot_accounts: boolean;
@ -200,6 +200,7 @@ export class Post {
thumbnail_url: Option<string>; thumbnail_url: Option<string>;
ap_id: string; ap_id: string;
local: boolean; local: boolean;
language_id: number;
} }
export class PasswordResetRequest { export class PasswordResetRequest {
@ -459,6 +460,7 @@ export class Comment {
local: boolean; local: boolean;
path: string; path: string;
distinguished: boolean; distinguished: boolean;
language_id: number;
} }
export class PersonMention { export class PersonMention {
@ -491,3 +493,9 @@ export class RegistrationApplication {
deny_reason: Option<string>; deny_reason: Option<string>;
published: string; published: string;
} }
export class Language {
id: number;
code: string;
name: string;
}