diff --git a/package.json b/package.json index edb2232..b4ad899 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "lemmy-js-client", "description": "A javascript / typescript client for Lemmy", - "version": "0.20.0-alpha.18", + "version": "0.20.0-pkce.1", "author": "Dessalines ", "license": "AGPL-3.0", "main": "./dist/index.js", diff --git a/src/http.ts b/src/http.ts index 05df92b..67c67ab 100644 --- a/src/http.ts +++ b/src/http.ts @@ -154,6 +154,9 @@ import { ListCommunityPendingFollows } from "./types/ListCommunityPendingFollows import { CommunityId } from "./types/CommunityId"; import { ListReports } from "./types/ListReports"; import { ListReportsResponse } from "./types/ListReportsResponse"; +import { UserBlockInstanceParams } from "./types/UserBlockInstanceParams"; +import { AdminAllowInstanceParams } from "./types/AdminAllowInstanceParams"; +import { AdminBlockInstanceParams } from "./types/AdminBlockInstanceParams"; enum HttpType { Get = "GET", @@ -1739,7 +1742,7 @@ export class LemmyHttp { /** * List post reports. * - * `HTTP.GET //report/list` + * `HTTP.GET /report/list` */ listReports(form: ListReports, options?: RequestOptions) { return this.#wrapper( @@ -1750,6 +1753,48 @@ export class LemmyHttp { ); } + /** + * Block an instance as user. + * + * `HTTP.Post /site/block` + */ + userBlockInstance(form: UserBlockInstanceParams, options?: RequestOptions) { + return this.#wrapper( + HttpType.Post, + "/site/block", + form, + options, + ); + } + + /** + * Globally block an instance as admin. + * + * `HTTP.Post /admin/block_instance` + */ + adminBlockInstance(form: AdminBlockInstanceParams, options?: RequestOptions) { + return this.#wrapper( + HttpType.Post, + "/admin/block_instance", + form, + options, + ); + } + + /** + * Globally allow an instance as admin. + * + * `HTTP.Post /admin/allow_instance` + */ + adminAllowInstance(form: AdminAllowInstanceParams, options?: RequestOptions) { + return this.#wrapper( + HttpType.Post, + "/admin/allow_instance", + form, + options, + ); + } + /** * Upload an image to the server. */