Testing some option types over the API.

This commit is contained in:
Dessalines 2022-05-14 11:00:45 -04:00
parent 7203e3dce6
commit 591c86f8e5
4 changed files with 17 additions and 5 deletions

View file

@ -15,6 +15,9 @@
"prepare": "yarn run build && husky install"
},
"repository": "https://github.com/LemmyNet/lemmy-js-client",
"dependencies": {
"@sniptt/monads": "^0.5.10"
},
"devDependencies": {
"@types/node": "^17.0.10",
"@types/node-fetch": "^3.0.3",
@ -32,6 +35,7 @@
"sortpack": "^2.2.0",
"typedoc": "^0.21.6",
"typedoc-plugin-sourcefile-url": "^1.0.6",
"@sniptt/monads": "^0.5.10",
"typescript": "^4.5.4"
},
"types": "./dist/index.d.ts",

View file

@ -1,3 +1,4 @@
import { Option } from "@sniptt/monads";
import {
CommentView,
CommunityBlockView,
@ -103,7 +104,7 @@ export interface CreateSite {
export interface EditSite {
name?: string;
sidebar?: string;
sidebar: Option<string>;
description?: string;
icon?: string;
banner?: string;
@ -131,14 +132,14 @@ export interface GetSiteResponse {
/**
* Optional, because the site might not be set up yet.
*/
site_view?: SiteView;
site_view: Option<SiteView>;
admins: PersonViewSafe[];
online: number;
version: string;
/**
* If you're logged in, you'll get back extra user info.
*/
my_user?: MyUserInfo;
my_user: Option<MyUserInfo>;
federated_instances?: FederatedInstances;
}

View file

@ -1,3 +1,5 @@
import { Option } from "@sniptt/monads";
export interface LocalUserSettings {
id: number;
person_id: number;
@ -41,14 +43,14 @@ export interface PersonSafe {
export interface Site {
id: number;
name: string;
sidebar?: string;
sidebar: Option<string>;
published: string;
updated?: string;
enable_downvotes: boolean;
open_registration: boolean;
enable_nsfw: boolean;
icon?: string;
banner?: string;
banner: Option<string>;
description?: string;
community_creation_admin_only: boolean;
require_email_verification: boolean;

View file

@ -251,6 +251,11 @@
"@nodelib/fs.scandir" "2.1.4"
fastq "^1.6.0"
"@sniptt/monads@^0.5.10":
version "0.5.10"
resolved "https://registry.yarnpkg.com/@sniptt/monads/-/monads-0.5.10.tgz#a80cd00738bbd682d36d36dd36bdc0bddc96eb76"
integrity sha512-+agDOv9DpDV+9e2zN/Vmdk+XaqGx5Sykl0fqhqgiJ90r18nsBkxe44DmZ2sA1HYK+MSsBeZBiAr6pq4w+5uhfw==
"@types/glob@^7.1.1":
version "7.2.0"
resolved "https://registry.yarnpkg.com/@types/glob/-/glob-7.2.0.tgz#bc1b5bf3aa92f25bd5dd39f35c57361bdce5b2eb"