Compare commits
14 commits
Author | SHA1 | Date | |
---|---|---|---|
|
916440e413 | ||
|
8fa91b55bb | ||
|
d497a1efea | ||
|
0a9c151b8e | ||
|
39d27b04d0 | ||
|
a6bcfbc049 | ||
|
f577df0a07 | ||
|
ad1d89ed20 | ||
|
ef5609dec9 | ||
|
657c851cf3 | ||
|
b5fdfa6513 | ||
|
9b73693910 | ||
|
ea8cab69f4 | ||
|
a336b2dccd |
12 changed files with 26 additions and 46 deletions
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "lemmy-js-client",
|
||||
"version": "0.18.0-rc.2",
|
||||
"version": "0.18.1-rc.3",
|
||||
"description": "A javascript / typescript client for Lemmy",
|
||||
"repository": "https://github.com/LemmyNet/lemmy-js-client",
|
||||
"license": "AGPL-3.0",
|
||||
|
|
26
src/http.ts
26
src/http.ts
|
@ -158,7 +158,7 @@ export class LemmyHttp {
|
|||
constructor(
|
||||
baseUrl: string,
|
||||
options?: {
|
||||
fetchFunction: typeof fetch;
|
||||
fetchFunction?: typeof fetch;
|
||||
headers?: { [key: string]: string };
|
||||
}
|
||||
) {
|
||||
|
@ -178,7 +178,7 @@ export class LemmyHttp {
|
|||
*
|
||||
* `HTTP.GET /site`
|
||||
*/
|
||||
getSite(form: GetSite) {
|
||||
getSite(form: GetSite = {}) {
|
||||
return this.#wrapper<GetSite, GetSiteResponse>(HttpType.Get, "/site", form);
|
||||
}
|
||||
|
||||
|
@ -222,7 +222,7 @@ export class LemmyHttp {
|
|||
*
|
||||
* `HTTP.GET /modlog`
|
||||
*/
|
||||
getModlog(form: GetModlog) {
|
||||
getModlog(form: GetModlog = {}) {
|
||||
return this.#wrapper<GetModlog, GetModlogResponse>(
|
||||
HttpType.Get,
|
||||
"/modlog",
|
||||
|
@ -270,7 +270,7 @@ export class LemmyHttp {
|
|||
*
|
||||
* `HTTP.GET /community`
|
||||
*/
|
||||
getCommunity(form: GetCommunity) {
|
||||
getCommunity(form: GetCommunity = {}) {
|
||||
return this.#wrapper<GetCommunity, GetCommunityResponse>(
|
||||
HttpType.Get,
|
||||
"/community",
|
||||
|
@ -296,7 +296,7 @@ export class LemmyHttp {
|
|||
*
|
||||
* `HTTP.GET /community/list`
|
||||
*/
|
||||
listCommunities(form: ListCommunities) {
|
||||
listCommunities(form: ListCommunities = {}) {
|
||||
return this.#wrapper<ListCommunities, ListCommunitiesResponse>(
|
||||
HttpType.Get,
|
||||
"/community/list",
|
||||
|
@ -413,7 +413,7 @@ export class LemmyHttp {
|
|||
*
|
||||
* `HTTP.GET /post`
|
||||
*/
|
||||
getPost(form: GetPost) {
|
||||
getPost(form: GetPost = {}) {
|
||||
return this.#wrapper<GetPost, GetPostResponse>(HttpType.Get, "/post", form);
|
||||
}
|
||||
|
||||
|
@ -496,7 +496,7 @@ export class LemmyHttp {
|
|||
*
|
||||
* `HTTP.GET /post/list`
|
||||
*/
|
||||
getPosts(form: GetPosts) {
|
||||
getPosts(form: GetPosts = {}) {
|
||||
return this.#wrapper<GetPosts, GetPostsResponse>(
|
||||
HttpType.Get,
|
||||
"/post/list",
|
||||
|
@ -691,7 +691,7 @@ export class LemmyHttp {
|
|||
*
|
||||
* `HTTP.GET /comment/list`
|
||||
*/
|
||||
getComments(form: GetComments) {
|
||||
getComments(form: GetComments = {}) {
|
||||
return this.#wrapper<GetComments, GetCommentsResponse>(
|
||||
HttpType.Get,
|
||||
"/comment/list",
|
||||
|
@ -883,7 +883,7 @@ export class LemmyHttp {
|
|||
*
|
||||
* `HTTP.GET /user`
|
||||
*/
|
||||
getPersonDetails(form: GetPersonDetails) {
|
||||
getPersonDetails(form: GetPersonDetails = {}) {
|
||||
return this.#wrapper<GetPersonDetails, GetPersonDetailsResponse>(
|
||||
HttpType.Get,
|
||||
"/user",
|
||||
|
@ -974,7 +974,7 @@ export class LemmyHttp {
|
|||
*
|
||||
* `HTTP.GET /user/get_captcha`
|
||||
*/
|
||||
getCaptcha(form: GetCaptcha) {
|
||||
getCaptcha(form: GetCaptcha = {}) {
|
||||
return this.#wrapper<GetCaptcha, GetCaptchaResponse>(
|
||||
HttpType.Get,
|
||||
"/user/get_captcha",
|
||||
|
@ -1246,7 +1246,7 @@ export class LemmyHttp {
|
|||
*
|
||||
* `HTTP.Get /federated_instances`
|
||||
*/
|
||||
async getFederatedInstances(form: GetFederatedInstances) {
|
||||
async getFederatedInstances(form: GetFederatedInstances = {}) {
|
||||
return this.#wrapper<GetFederatedInstances, GetFederatedInstancesResponse>(
|
||||
HttpType.Get,
|
||||
"/federated_instances",
|
||||
|
@ -1284,6 +1284,10 @@ export class LemmyHttp {
|
|||
},
|
||||
});
|
||||
|
||||
if (response.status === 413) {
|
||||
return { msg: "too_large" };
|
||||
}
|
||||
|
||||
const responseJson = await response.json();
|
||||
|
||||
if (responseJson.msg === "ok") {
|
||||
|
|
|
@ -16,6 +16,8 @@ export interface Community {
|
|||
local: boolean;
|
||||
icon?: string;
|
||||
banner?: string;
|
||||
followers_url: string;
|
||||
inbox_url: string;
|
||||
hidden: boolean;
|
||||
posting_restricted_to_mods: boolean;
|
||||
instance_id: InstanceId;
|
||||
|
|
|
@ -37,7 +37,6 @@ export interface CreateSite {
|
|||
rate_limit_search_per_second?: number;
|
||||
federation_enabled?: boolean;
|
||||
federation_debug?: boolean;
|
||||
federation_worker_count?: number;
|
||||
captcha_enabled?: boolean;
|
||||
captcha_difficulty?: string;
|
||||
allowed_instances?: Array<string>;
|
||||
|
|
|
@ -37,7 +37,6 @@ export interface EditSite {
|
|||
rate_limit_search_per_second?: number;
|
||||
federation_enabled?: boolean;
|
||||
federation_debug?: boolean;
|
||||
federation_worker_count?: number;
|
||||
captcha_enabled?: boolean;
|
||||
captcha_difficulty?: string;
|
||||
allowed_instances?: Array<string>;
|
||||
|
|
|
@ -5,6 +5,7 @@ import type { SortType } from "./SortType";
|
|||
export interface ListCommunities {
|
||||
type_?: ListingType;
|
||||
sort?: SortType;
|
||||
show_nsfw?: boolean;
|
||||
page?: number;
|
||||
limit?: number;
|
||||
auth?: string;
|
||||
|
|
|
@ -22,7 +22,6 @@ export interface LocalSite {
|
|||
slur_filter_regex?: string;
|
||||
actor_name_max_length: number;
|
||||
federation_enabled: boolean;
|
||||
federation_worker_count: number;
|
||||
captcha_enabled: boolean;
|
||||
captcha_difficulty: string;
|
||||
published: string;
|
||||
|
|
|
@ -23,4 +23,5 @@ export interface LocalUser {
|
|||
email_verified: boolean;
|
||||
accepted_application: boolean;
|
||||
totp_2fa_url?: string;
|
||||
open_links_in_new_tab: boolean;
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@ export interface Person {
|
|||
local: boolean;
|
||||
banner?: string;
|
||||
deleted: boolean;
|
||||
inbox_url: string;
|
||||
matrix_user_id?: string;
|
||||
admin: boolean;
|
||||
bot_account: boolean;
|
||||
|
|
|
@ -25,4 +25,5 @@ export interface SaveUserSettings {
|
|||
discussion_languages?: Array<LanguageId>;
|
||||
generate_totp_2fa?: boolean;
|
||||
auth: string;
|
||||
open_links_in_new_tab?: boolean;
|
||||
}
|
||||
|
|
|
@ -14,4 +14,7 @@ export type SortType =
|
|||
| "NewComments"
|
||||
| "TopHour"
|
||||
| "TopSixHour"
|
||||
| "TopTwelveHour";
|
||||
| "TopTwelveHour"
|
||||
| "TopThreeMonths"
|
||||
| "TopSixMonths"
|
||||
| "TopNineMonths";
|
||||
|
|
30
typedoc.json
30
typedoc.json
|
@ -1,30 +0,0 @@
|
|||
{
|
||||
"sort": ["kind", "alphabetical"],
|
||||
"kindSortOrder": [
|
||||
"Reference",
|
||||
"Project",
|
||||
"Module",
|
||||
"Namespace",
|
||||
"Class",
|
||||
"TypeAlias",
|
||||
"Constructor",
|
||||
"Method",
|
||||
"Function",
|
||||
"Interface",
|
||||
"Property",
|
||||
"Variable",
|
||||
"Enum",
|
||||
"EnumMember",
|
||||
"Accessor",
|
||||
"ObjectLiteral",
|
||||
"Parameter",
|
||||
"TypeParameter",
|
||||
"TypeLiteral",
|
||||
"CallSignature",
|
||||
"ConstructorSignature",
|
||||
"IndexSignature",
|
||||
"GetSignature",
|
||||
"SetSignature"
|
||||
],
|
||||
"groupOrder": ["Functions", "Variables", "*"]
|
||||
}
|
Loading…
Reference in a new issue