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",
"description": "A javascript / typescript client for Lemmy",
"version": "0.17.0-rc.43",
"version": "0.17.0-rc.44",
"author": "Dessalines <tyhou13@gmx.com>",
"license": "AGPL-3.0",
"main": "./dist/index.js",

View file

@ -11,6 +11,10 @@ export class CreateComment {
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
@Expose()
parent_id: Option<number>;
@Transform(({ value }) => toOption(value), { toClassOnly: true })
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
@Expose()
language_id: Option<number>;
post_id: number;
/**
* 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 })
@Expose()
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.
*/

View file

@ -136,7 +136,7 @@ export class SaveUserSettings {
@Transform(({ value }) => toOption(value), { toClassOnly: true })
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
@Expose()
lang: Option<string>;
interface_language: Option<string>;
@Transform(({ value }) => toOption(value), { toClassOnly: true })
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
@Expose()
@ -189,6 +189,10 @@ export class SaveUserSettings {
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
@Expose()
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;
constructor(init: SaveUserSettings) {

View file

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

View file

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

View file

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