mirror of
https://github.com/LemmyNet/lemmy-js-client.git
synced 2024-11-23 04:41:13 +00:00
Merge branch 'main' into admin_purge
This commit is contained in:
commit
9c59fc2a31
18 changed files with 1512 additions and 1663 deletions
26
.drone.yml
26
.drone.yml
|
@ -9,23 +9,25 @@ platform:
|
||||||
steps:
|
steps:
|
||||||
|
|
||||||
- name: yarn
|
- name: yarn
|
||||||
image: node:14-alpine
|
image: node:17-alpine
|
||||||
commands:
|
commands:
|
||||||
- yarn
|
- yarn
|
||||||
|
|
||||||
- name: yarn lint
|
- name: yarn lint
|
||||||
image: node:14-alpine
|
image: node:17-alpine
|
||||||
commands:
|
commands:
|
||||||
- yarn lint
|
- yarn lint
|
||||||
|
|
||||||
- name: npm
|
- name: npm publish
|
||||||
image: plugins/npm
|
image: node:17-alpine
|
||||||
settings:
|
commands:
|
||||||
username:
|
- echo "//registry.npmjs.org/:_authToken=$NPM_AUTH_TOKEN" >> .npmrc
|
||||||
from_secret: npm_username
|
- echo "email = $NPM_EMAIL" >> ~/.npmrc
|
||||||
password:
|
- npm publish
|
||||||
from_secret: npm_password
|
environment:
|
||||||
email: tyhou13@gmx.com
|
NPM_AUTH_TOKEN:
|
||||||
|
from_secret: npm_token
|
||||||
|
NPM_EMAIL: tyhou13@gmx.com
|
||||||
when:
|
when:
|
||||||
ref:
|
ref:
|
||||||
- refs/tags/*
|
- refs/tags/*
|
||||||
|
@ -41,11 +43,11 @@ platform:
|
||||||
steps:
|
steps:
|
||||||
|
|
||||||
- name: yarn
|
- name: yarn
|
||||||
image: node:14-alpine
|
image: node:17-alpine
|
||||||
commands:
|
commands:
|
||||||
- yarn
|
- yarn
|
||||||
|
|
||||||
- name: yarn lint
|
- name: yarn lint
|
||||||
image: node:14-alpine
|
image: node:17-alpine
|
||||||
commands:
|
commands:
|
||||||
- yarn lint
|
- yarn lint
|
||||||
|
|
|
@ -4,11 +4,11 @@
|
||||||
"browser": true
|
"browser": true
|
||||||
},
|
},
|
||||||
"plugins": [
|
"plugins": [
|
||||||
"jane"
|
"@typescript-eslint"
|
||||||
],
|
],
|
||||||
"extends": [
|
"extends": [
|
||||||
"plugin:jane/recommended",
|
"eslint:recommended",
|
||||||
"plugin:jane/typescript"
|
"plugin:@typescript-eslint/recommended"
|
||||||
],
|
],
|
||||||
"parser": "@typescript-eslint/parser",
|
"parser": "@typescript-eslint/parser",
|
||||||
"parserOptions": {
|
"parserOptions": {
|
||||||
|
@ -16,14 +16,11 @@
|
||||||
"warnOnUnsupportedTypeScriptVersion": false
|
"warnOnUnsupportedTypeScriptVersion": false
|
||||||
},
|
},
|
||||||
"rules": {
|
"rules": {
|
||||||
"@typescript-eslint/camelcase": 0,
|
|
||||||
"@typescript-eslint/member-delimiter-style": 0,
|
|
||||||
"@typescript-eslint/no-empty-interface": 0,
|
"@typescript-eslint/no-empty-interface": 0,
|
||||||
|
"@typescript-eslint/no-empty-function": 0,
|
||||||
|
"@typescript-eslint/ban-ts-comment": 0,
|
||||||
"@typescript-eslint/no-explicit-any": 0,
|
"@typescript-eslint/no-explicit-any": 0,
|
||||||
"@typescript-eslint/no-this-alias": 0,
|
"@typescript-eslint/explicit-module-boundary-types": 0,
|
||||||
"@typescript-eslint/no-unused-vars": 0,
|
|
||||||
"@typescript-eslint/no-use-before-define": 0,
|
|
||||||
"@typescript-eslint/no-useless-constructor": 0,
|
|
||||||
"arrow-body-style": 0,
|
"arrow-body-style": 0,
|
||||||
"curly": 0,
|
"curly": 0,
|
||||||
"eol-last": 0,
|
"eol-last": 0,
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
module.exports = Object.assign(require('eslint-plugin-jane/prettier-ts'), {
|
module.exports = Object.assign(require("eslint-plugin-prettier"), {
|
||||||
arrowParens: 'avoid',
|
arrowParens: "avoid",
|
||||||
semi: true,
|
semi: true,
|
||||||
});
|
});
|
||||||
|
|
29
package.json
29
package.json
|
@ -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.13.4-rc.2",
|
"version": "0.16.4-rc.3",
|
||||||
"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",
|
||||||
|
@ -16,18 +16,23 @@
|
||||||
},
|
},
|
||||||
"repository": "https://github.com/LemmyNet/lemmy-js-client",
|
"repository": "https://github.com/LemmyNet/lemmy-js-client",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/node": "^16.10.2",
|
"@types/node": "^17.0.33",
|
||||||
"@types/node-fetch": "^3.0.3",
|
"@types/node-fetch": "^3.0.3",
|
||||||
"eslint": "^7.32.0",
|
"@typescript-eslint/eslint-plugin": "^5.23.0",
|
||||||
"eslint-plugin-jane": "^9.0.6",
|
"@typescript-eslint/parser": "^5.23.0",
|
||||||
"husky": "^7.0.2",
|
"eslint": "^8.15.0",
|
||||||
"lint-staged": "^11.1.2",
|
"eslint-plugin-prettier": "^4.0.0",
|
||||||
"node-fetch": "^3.0.0",
|
"husky": "^8.0.1",
|
||||||
"prettier": "^2.4.1",
|
"lint-staged": "^12.4.1",
|
||||||
|
"node-fetch": "^3.2.4",
|
||||||
|
"prettier": "^2.6.2",
|
||||||
|
"prettier-plugin-import-sort": "^0.0.7",
|
||||||
|
"prettier-plugin-organize-imports": "^2.3.4",
|
||||||
|
"prettier-plugin-packagejson": "^2.2.18",
|
||||||
"sortpack": "^2.2.0",
|
"sortpack": "^2.2.0",
|
||||||
"typedoc": "^0.21.6",
|
"typedoc": "^0.21.6",
|
||||||
"typedoc-plugin-sourcefile-url": "^1.0.6",
|
"typedoc-plugin-sourcefile-url": "^1.0.6",
|
||||||
"typescript": "^4.4.3"
|
"typescript": "^4.6.4"
|
||||||
},
|
},
|
||||||
"types": "./dist/index.d.ts",
|
"types": "./dist/index.d.ts",
|
||||||
"lint-staged": {
|
"lint-staged": {
|
||||||
|
@ -38,5 +43,11 @@
|
||||||
"package.json": [
|
"package.json": [
|
||||||
"sortpack"
|
"sortpack"
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
"importSort": {
|
||||||
|
".js, .jsx, .ts, .tsx": {
|
||||||
|
"style": "module",
|
||||||
|
"parser": "typescript"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
418
src/http.ts
418
src/http.ts
|
@ -1,4 +1,4 @@
|
||||||
import fetch from 'node-fetch';
|
import fetch from "node-fetch";
|
||||||
import {
|
import {
|
||||||
CommentReportResponse,
|
CommentReportResponse,
|
||||||
CommentResponse,
|
CommentResponse,
|
||||||
|
@ -15,7 +15,7 @@ import {
|
||||||
RemoveComment,
|
RemoveComment,
|
||||||
ResolveCommentReport,
|
ResolveCommentReport,
|
||||||
SaveComment,
|
SaveComment,
|
||||||
} from './interfaces/api/comment';
|
} from "./interfaces/api/comment";
|
||||||
import {
|
import {
|
||||||
AddModToCommunity,
|
AddModToCommunity,
|
||||||
AddModToCommunityResponse,
|
AddModToCommunityResponse,
|
||||||
|
@ -34,10 +34,54 @@ import {
|
||||||
ListCommunitiesResponse,
|
ListCommunitiesResponse,
|
||||||
RemoveCommunity,
|
RemoveCommunity,
|
||||||
TransferCommunity,
|
TransferCommunity,
|
||||||
} from './interfaces/api/community';
|
} from "./interfaces/api/community";
|
||||||
|
import {
|
||||||
|
AddAdmin,
|
||||||
|
AddAdminResponse,
|
||||||
|
BannedPersonsResponse,
|
||||||
|
BanPerson,
|
||||||
|
BanPersonResponse,
|
||||||
|
BlockPerson,
|
||||||
|
BlockPersonResponse,
|
||||||
|
ChangePassword,
|
||||||
|
CreatePrivateMessage,
|
||||||
|
DeleteAccount,
|
||||||
|
DeleteAccountResponse,
|
||||||
|
DeletePrivateMessage,
|
||||||
|
EditPrivateMessage,
|
||||||
|
GetBannedPersons,
|
||||||
|
GetCaptchaResponse,
|
||||||
|
GetPersonDetails,
|
||||||
|
GetPersonDetailsResponse,
|
||||||
|
GetPersonMentions,
|
||||||
|
GetPersonMentionsResponse,
|
||||||
|
GetPrivateMessages,
|
||||||
|
GetReplies,
|
||||||
|
GetRepliesResponse,
|
||||||
|
GetReportCount,
|
||||||
|
GetReportCountResponse,
|
||||||
|
GetUnreadCount,
|
||||||
|
GetUnreadCountResponse,
|
||||||
|
Login,
|
||||||
|
LoginResponse,
|
||||||
|
MarkAllAsRead,
|
||||||
|
MarkPersonMentionAsRead,
|
||||||
|
MarkPrivateMessageAsRead,
|
||||||
|
PasswordChange,
|
||||||
|
PasswordReset,
|
||||||
|
PasswordResetResponse,
|
||||||
|
PersonMentionResponse,
|
||||||
|
PrivateMessageResponse,
|
||||||
|
PrivateMessagesResponse,
|
||||||
|
Register,
|
||||||
|
SaveUserSettings,
|
||||||
|
VerifyEmail,
|
||||||
|
VerifyEmailResponse,
|
||||||
|
} from "./interfaces/api/person";
|
||||||
import {
|
import {
|
||||||
CreatePost,
|
CreatePost,
|
||||||
CreatePostLike,
|
CreatePostLike,
|
||||||
|
CreatePostReport,
|
||||||
DeletePost,
|
DeletePost,
|
||||||
EditPost,
|
EditPost,
|
||||||
GetPost,
|
GetPost,
|
||||||
|
@ -46,18 +90,19 @@ import {
|
||||||
GetPostsResponse,
|
GetPostsResponse,
|
||||||
GetSiteMetadata,
|
GetSiteMetadata,
|
||||||
GetSiteMetadataResponse,
|
GetSiteMetadataResponse,
|
||||||
|
ListPostReports,
|
||||||
|
ListPostReportsResponse,
|
||||||
LockPost,
|
LockPost,
|
||||||
CreatePostReport,
|
MarkPostAsRead,
|
||||||
PostReportResponse,
|
PostReportResponse,
|
||||||
PostResponse,
|
PostResponse,
|
||||||
RemovePost,
|
RemovePost,
|
||||||
|
ResolvePostReport,
|
||||||
SavePost,
|
SavePost,
|
||||||
StickyPost,
|
StickyPost,
|
||||||
ResolvePostReport,
|
} from "./interfaces/api/post";
|
||||||
ListPostReports,
|
|
||||||
ListPostReportsResponse,
|
|
||||||
} from './interfaces/api/post';
|
|
||||||
import {
|
import {
|
||||||
|
ApproveRegistrationApplication,
|
||||||
CreateSite,
|
CreateSite,
|
||||||
EditSite,
|
EditSite,
|
||||||
GetModlog,
|
GetModlog,
|
||||||
|
@ -66,62 +111,30 @@ import {
|
||||||
GetSiteConfig,
|
GetSiteConfig,
|
||||||
GetSiteConfigResponse,
|
GetSiteConfigResponse,
|
||||||
GetSiteResponse,
|
GetSiteResponse,
|
||||||
|
GetUnreadRegistrationApplicationCount,
|
||||||
|
GetUnreadRegistrationApplicationCountResponse,
|
||||||
|
LeaveAdmin,
|
||||||
|
ListRegistrationApplications,
|
||||||
|
ListRegistrationApplicationsResponse,
|
||||||
PurgeComment,
|
PurgeComment,
|
||||||
PurgeCommunity,
|
PurgeCommunity,
|
||||||
PurgeItemResponse,
|
PurgeItemResponse,
|
||||||
PurgePerson,
|
PurgePerson,
|
||||||
PurgePost,
|
PurgePost,
|
||||||
|
RegistrationApplicationResponse,
|
||||||
ResolveObject,
|
ResolveObject,
|
||||||
ResolveObjectResponse,
|
ResolveObjectResponse,
|
||||||
SaveSiteConfig,
|
SaveSiteConfig,
|
||||||
Search,
|
Search,
|
||||||
SearchResponse,
|
SearchResponse,
|
||||||
SiteResponse,
|
SiteResponse,
|
||||||
TransferSite,
|
} from "./interfaces/api/site";
|
||||||
} from './interfaces/api/site';
|
import { VERSION } from "./interfaces/others";
|
||||||
import {
|
|
||||||
AddAdmin,
|
|
||||||
AddAdminResponse,
|
|
||||||
BanPerson,
|
|
||||||
BanPersonResponse,
|
|
||||||
CreatePrivateMessage,
|
|
||||||
DeleteAccount,
|
|
||||||
DeletePrivateMessage,
|
|
||||||
EditPrivateMessage,
|
|
||||||
GetCaptchaResponse,
|
|
||||||
GetPrivateMessages,
|
|
||||||
GetReplies,
|
|
||||||
GetRepliesResponse,
|
|
||||||
GetPersonDetails,
|
|
||||||
GetPersonDetailsResponse,
|
|
||||||
GetPersonMentions,
|
|
||||||
GetPersonMentionsResponse,
|
|
||||||
Login,
|
|
||||||
LoginResponse,
|
|
||||||
MarkAllAsRead,
|
|
||||||
MarkPrivateMessageAsRead,
|
|
||||||
MarkPersonMentionAsRead,
|
|
||||||
PasswordChange,
|
|
||||||
PasswordReset,
|
|
||||||
PasswordResetResponse,
|
|
||||||
PrivateMessageResponse,
|
|
||||||
PrivateMessagesResponse,
|
|
||||||
Register,
|
|
||||||
SaveUserSettings,
|
|
||||||
ChangePassword,
|
|
||||||
PersonMentionResponse,
|
|
||||||
BlockPerson,
|
|
||||||
BlockPersonResponse,
|
|
||||||
GetReportCount,
|
|
||||||
GetReportCountResponse,
|
|
||||||
} from './interfaces/api/person';
|
|
||||||
|
|
||||||
import { VERSION } from './interfaces/others';
|
|
||||||
|
|
||||||
enum HttpType {
|
enum HttpType {
|
||||||
Get = 'GET',
|
Get = "GET",
|
||||||
Post = 'POST',
|
Post = "POST",
|
||||||
Put = 'PUT',
|
Put = "PUT",
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -146,535 +159,682 @@ export class LemmyHttp {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the site, and your user data.
|
* Gets the site, and your user data.
|
||||||
|
* `HTTP.GET /site`
|
||||||
*/
|
*/
|
||||||
async getSite(form: GetSite): Promise<GetSiteResponse> {
|
async getSite(form: GetSite): Promise<GetSiteResponse> {
|
||||||
return this.wrapper(HttpType.Get, '/site', form);
|
return this.wrapper(HttpType.Get, "/site", form);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create your site.
|
* Create your site.
|
||||||
|
* `HTTP.POST /site`
|
||||||
*/
|
*/
|
||||||
async createSite(form: CreateSite): Promise<SiteResponse> {
|
async createSite(form: CreateSite): Promise<SiteResponse> {
|
||||||
return this.wrapper(HttpType.Post, '/site', form);
|
return this.wrapper(HttpType.Post, "/site", form);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Edit your site.
|
* Edit your site.
|
||||||
|
* `HTTP.PUT /site`
|
||||||
*/
|
*/
|
||||||
async editSite(form: EditSite): Promise<SiteResponse> {
|
async editSite(form: EditSite): Promise<SiteResponse> {
|
||||||
return this.wrapper(HttpType.Put, '/site', form);
|
return this.wrapper(HttpType.Put, "/site", form);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Transfer your site to another user.
|
* Leave the Site admins.
|
||||||
|
* `HTTP.POST /user/leave_admin`
|
||||||
*/
|
*/
|
||||||
async transferSite(form: TransferSite): Promise<GetSiteResponse> {
|
async leaveAdmin(form: LeaveAdmin): Promise<GetSiteResponse> {
|
||||||
return this.wrapper(HttpType.Post, '/site/transfer', form);
|
return this.wrapper(HttpType.Post, "/user/leave_admin", form);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get your site configuration.
|
* Get your site configuration.
|
||||||
|
* `HTTP.GET /site/config`
|
||||||
*/
|
*/
|
||||||
async getSiteConfig(form: GetSiteConfig): Promise<GetSiteConfigResponse> {
|
async getSiteConfig(form: GetSiteConfig): Promise<GetSiteConfigResponse> {
|
||||||
return this.wrapper(HttpType.Get, '/site/config', form);
|
return this.wrapper(HttpType.Get, "/site/config", form);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Save your site config.
|
* Save your site config.
|
||||||
|
* `HTTP.PUT /site/config`
|
||||||
*/
|
*/
|
||||||
async saveSiteConfig(form: SaveSiteConfig): Promise<GetSiteConfigResponse> {
|
async saveSiteConfig(form: SaveSiteConfig): Promise<GetSiteConfigResponse> {
|
||||||
return this.wrapper(HttpType.Put, '/site/config', form);
|
return this.wrapper(HttpType.Put, "/site/config", form);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the modlog.
|
* Get the modlog.
|
||||||
|
* `HTTP.GET /modlog`
|
||||||
*/
|
*/
|
||||||
async getModlog(form: GetModlog): Promise<GetModlogResponse> {
|
async getModlog(form: GetModlog): Promise<GetModlogResponse> {
|
||||||
return this.wrapper(HttpType.Get, '/modlog', form);
|
return this.wrapper(HttpType.Get, "/modlog", form);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Search lemmy.
|
* Search lemmy.
|
||||||
|
* `HTTP.GET /search`
|
||||||
*/
|
*/
|
||||||
async search(form: Search): Promise<SearchResponse> {
|
async search(form: Search): Promise<SearchResponse> {
|
||||||
return this.wrapper(HttpType.Get, '/search', form);
|
return this.wrapper(HttpType.Get, "/search", form);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fetch a non-local / federated object.
|
* Fetch a non-local / federated object.
|
||||||
|
* `HTTP.GET /resolve_object`
|
||||||
*/
|
*/
|
||||||
async resolveObject(form: ResolveObject): Promise<ResolveObjectResponse> {
|
async resolveObject(form: ResolveObject): Promise<ResolveObjectResponse> {
|
||||||
return this.wrapper(HttpType.Get, '/resolve_object', form);
|
return this.wrapper(HttpType.Get, "/resolve_object", form);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new community.
|
* Create a new community.
|
||||||
|
* `HTTP.POST /community`
|
||||||
*/
|
*/
|
||||||
async createCommunity(form: CreateCommunity): Promise<CommunityResponse> {
|
async createCommunity(form: CreateCommunity): Promise<CommunityResponse> {
|
||||||
return this.wrapper(HttpType.Post, '/community', form);
|
return this.wrapper(HttpType.Post, "/community", form);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get / fetch a community.
|
* Get / fetch a community.
|
||||||
|
* `HTTP.GET /community`
|
||||||
*/
|
*/
|
||||||
async getCommunity(form: GetCommunity): Promise<GetCommunityResponse> {
|
async getCommunity(form: GetCommunity): Promise<GetCommunityResponse> {
|
||||||
return this.wrapper(HttpType.Get, '/community', form);
|
return this.wrapper(HttpType.Get, "/community", form);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Edit a community.
|
* Edit a community.
|
||||||
|
* `HTTP.PUT /community`
|
||||||
*/
|
*/
|
||||||
async editCommunity(form: EditCommunity): Promise<CommunityResponse> {
|
async editCommunity(form: EditCommunity): Promise<CommunityResponse> {
|
||||||
return this.wrapper(HttpType.Put, '/community', form);
|
return this.wrapper(HttpType.Put, "/community", form);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* List communities, with various filters.
|
* List communities, with various filters.
|
||||||
|
* `HTTP.GET /community/list`
|
||||||
*/
|
*/
|
||||||
async listCommunities(
|
async listCommunities(
|
||||||
form: ListCommunities
|
form: ListCommunities
|
||||||
): Promise<ListCommunitiesResponse> {
|
): Promise<ListCommunitiesResponse> {
|
||||||
return this.wrapper(HttpType.Get, '/community/list', form);
|
return this.wrapper(HttpType.Get, "/community/list", form);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Follow / subscribe to a community.
|
* Follow / subscribe to a community.
|
||||||
|
* `HTTP.POST /community/follow`
|
||||||
*/
|
*/
|
||||||
async followCommunity(form: FollowCommunity): Promise<CommunityResponse> {
|
async followCommunity(form: FollowCommunity): Promise<CommunityResponse> {
|
||||||
return this.wrapper(HttpType.Post, '/community/follow', form);
|
return this.wrapper(HttpType.Post, "/community/follow", form);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Block a community.
|
* Block a community.
|
||||||
|
* `HTTP.POST /community/block`
|
||||||
*/
|
*/
|
||||||
async blockCommunity(form: BlockCommunity): Promise<BlockCommunityResponse> {
|
async blockCommunity(form: BlockCommunity): Promise<BlockCommunityResponse> {
|
||||||
return this.wrapper(HttpType.Post, '/community/block', form);
|
return this.wrapper(HttpType.Post, "/community/block", form);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete a community.
|
* Delete a community.
|
||||||
|
* `HTTP.POST /community/delete`
|
||||||
*/
|
*/
|
||||||
async deleteCommunity(form: DeleteCommunity): Promise<CommunityResponse> {
|
async deleteCommunity(form: DeleteCommunity): Promise<CommunityResponse> {
|
||||||
return this.wrapper(HttpType.Post, '/community/delete', form);
|
return this.wrapper(HttpType.Post, "/community/delete", form);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A moderator remove for a community.
|
* A moderator remove for a community.
|
||||||
|
* `HTTP.POST /community/remove`
|
||||||
*/
|
*/
|
||||||
async removeCommunity(form: RemoveCommunity): Promise<CommunityResponse> {
|
async removeCommunity(form: RemoveCommunity): Promise<CommunityResponse> {
|
||||||
return this.wrapper(HttpType.Post, '/community/remove', form);
|
return this.wrapper(HttpType.Post, "/community/remove", form);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Transfer your community to an existing moderator.
|
* Transfer your community to an existing moderator.
|
||||||
|
* `HTTP.POST /community/transfer`
|
||||||
*/
|
*/
|
||||||
async transferCommunity(
|
async transferCommunity(
|
||||||
form: TransferCommunity
|
form: TransferCommunity
|
||||||
): Promise<GetCommunityResponse> {
|
): Promise<GetCommunityResponse> {
|
||||||
return this.wrapper(HttpType.Post, '/community/transfer', form);
|
return this.wrapper(HttpType.Post, "/community/transfer", form);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Ban a user from a community.
|
* Ban a user from a community.
|
||||||
|
* `HTTP.POST /community/ban_user`
|
||||||
*/
|
*/
|
||||||
async banFromCommunity(
|
async banFromCommunity(
|
||||||
form: BanFromCommunity
|
form: BanFromCommunity
|
||||||
): Promise<BanFromCommunityResponse> {
|
): Promise<BanFromCommunityResponse> {
|
||||||
return this.wrapper(HttpType.Post, '/community/ban_user', form);
|
return this.wrapper(HttpType.Post, "/community/ban_user", form);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a moderator to your community.
|
* Add a moderator to your community.
|
||||||
|
* `HTTP.POST /community/mod`
|
||||||
*/
|
*/
|
||||||
async addModToCommunity(
|
async addModToCommunity(
|
||||||
form: AddModToCommunity
|
form: AddModToCommunity
|
||||||
): Promise<AddModToCommunityResponse> {
|
): Promise<AddModToCommunityResponse> {
|
||||||
return this.wrapper(HttpType.Post, '/community/mod', form);
|
return this.wrapper(HttpType.Post, "/community/mod", form);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a post.
|
* Create a post.
|
||||||
|
* `HTTP.POST /post`
|
||||||
*/
|
*/
|
||||||
async createPost(form: CreatePost): Promise<PostResponse> {
|
async createPost(form: CreatePost): Promise<PostResponse> {
|
||||||
return this.wrapper(HttpType.Post, '/post', form);
|
return this.wrapper(HttpType.Post, "/post", form);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get / fetch a post.
|
* Get / fetch a post.
|
||||||
|
* `HTTP.GET /post`
|
||||||
*/
|
*/
|
||||||
async getPost(form: GetPost): Promise<GetPostResponse> {
|
async getPost(form: GetPost): Promise<GetPostResponse> {
|
||||||
return this.wrapper(HttpType.Get, '/post', form);
|
return this.wrapper(HttpType.Get, "/post", form);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Edit a post.
|
* Edit a post.
|
||||||
|
* `HTTP.PUT /post`
|
||||||
*/
|
*/
|
||||||
async editPost(form: EditPost): Promise<PostResponse> {
|
async editPost(form: EditPost): Promise<PostResponse> {
|
||||||
return this.wrapper(HttpType.Put, '/post', form);
|
return this.wrapper(HttpType.Put, "/post", form);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete a post.
|
* Delete a post.
|
||||||
|
* `HTTP.POST /post/delete`
|
||||||
*/
|
*/
|
||||||
async deletePost(form: DeletePost): Promise<PostResponse> {
|
async deletePost(form: DeletePost): Promise<PostResponse> {
|
||||||
return this.wrapper(HttpType.Post, '/post/delete', form);
|
return this.wrapper(HttpType.Post, "/post/delete", form);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A moderator remove for a post.
|
* A moderator remove for a post.
|
||||||
|
* `HTTP.POST /post/remove`
|
||||||
*/
|
*/
|
||||||
async removePost(form: RemovePost): Promise<PostResponse> {
|
async removePost(form: RemovePost): Promise<PostResponse> {
|
||||||
return this.wrapper(HttpType.Post, '/post/remove', form);
|
return this.wrapper(HttpType.Post, "/post/remove", form);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Mark a post as read.
|
||||||
|
* `HTTP.POST /post/mark_as_read`
|
||||||
|
*/
|
||||||
|
async markPostAsRead(form: MarkPostAsRead): Promise<PostResponse> {
|
||||||
|
return this.wrapper(HttpType.Post, "/post/mark_as_read", form);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A moderator can lock a post ( IE disable new comments ).
|
* A moderator can lock a post ( IE disable new comments ).
|
||||||
|
* `HTTP.POST /post/lock`
|
||||||
*/
|
*/
|
||||||
async lockPost(form: LockPost): Promise<PostResponse> {
|
async lockPost(form: LockPost): Promise<PostResponse> {
|
||||||
return this.wrapper(HttpType.Post, '/post/lock', form);
|
return this.wrapper(HttpType.Post, "/post/lock", form);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A moderator can sticky a post ( IE stick it to the top of a community ).
|
* A moderator can sticky a post ( IE stick it to the top of a community ).
|
||||||
|
* `HTTP.POST /post/sticky`
|
||||||
*/
|
*/
|
||||||
async stickyPost(form: StickyPost): Promise<PostResponse> {
|
async stickyPost(form: StickyPost): Promise<PostResponse> {
|
||||||
return this.wrapper(HttpType.Post, '/post/sticky', form);
|
return this.wrapper(HttpType.Post, "/post/sticky", form);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get / fetch posts, with various filters.
|
* Get / fetch posts, with various filters.
|
||||||
|
* `HTTP.GET /post/list`
|
||||||
*/
|
*/
|
||||||
async getPosts(form: GetPosts): Promise<GetPostsResponse> {
|
async getPosts(form: GetPosts): Promise<GetPostsResponse> {
|
||||||
return this.wrapper(HttpType.Get, '/post/list', form);
|
return this.wrapper(HttpType.Get, "/post/list", form);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Like / vote on a post.
|
* Like / vote on a post.
|
||||||
|
* `HTTP.POST /post/like`
|
||||||
*/
|
*/
|
||||||
async likePost(form: CreatePostLike): Promise<PostResponse> {
|
async likePost(form: CreatePostLike): Promise<PostResponse> {
|
||||||
return this.wrapper(HttpType.Post, '/post/like', form);
|
return this.wrapper(HttpType.Post, "/post/like", form);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Save a post.
|
* Save a post.
|
||||||
|
* `HTTP.PUT /post/save`
|
||||||
*/
|
*/
|
||||||
async savePost(form: SavePost): Promise<PostResponse> {
|
async savePost(form: SavePost): Promise<PostResponse> {
|
||||||
return this.wrapper(HttpType.Put, '/post/save', form);
|
return this.wrapper(HttpType.Put, "/post/save", form);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Report a post.
|
* Report a post.
|
||||||
|
* `HTTP.POST /post/report`
|
||||||
*/
|
*/
|
||||||
async createPostReport(form: CreatePostReport): Promise<PostReportResponse> {
|
async createPostReport(form: CreatePostReport): Promise<PostReportResponse> {
|
||||||
return this.wrapper(HttpType.Post, '/post/report', form);
|
return this.wrapper(HttpType.Post, "/post/report", form);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Resolve a post report. Only a mod can do this.
|
* Resolve a post report. Only a mod can do this.
|
||||||
|
* `HTTP.PUT /post/report/resolve`
|
||||||
*/
|
*/
|
||||||
async resolvePostReport(
|
async resolvePostReport(
|
||||||
form: ResolvePostReport
|
form: ResolvePostReport
|
||||||
): Promise<PostReportResponse> {
|
): Promise<PostReportResponse> {
|
||||||
return this.wrapper(HttpType.Put, '/post/report/resolve', form);
|
return this.wrapper(HttpType.Put, "/post/report/resolve", form);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* List post reports.
|
* List post reports.
|
||||||
|
* `HTTP.GET /post/report/list`
|
||||||
*/
|
*/
|
||||||
async listPostReports(
|
async listPostReports(
|
||||||
form: ListPostReports
|
form: ListPostReports
|
||||||
): Promise<ListPostReportsResponse> {
|
): Promise<ListPostReportsResponse> {
|
||||||
return this.wrapper(HttpType.Get, '/post/report/list', form);
|
return this.wrapper(HttpType.Get, "/post/report/list", form);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fetch metadata for any given site.
|
* Fetch metadata for any given site.
|
||||||
|
* `HTTP.GET /post/site_metadata`
|
||||||
*/
|
*/
|
||||||
async getSiteMetadata(
|
async getSiteMetadata(
|
||||||
form: GetSiteMetadata
|
form: GetSiteMetadata
|
||||||
): Promise<GetSiteMetadataResponse> {
|
): Promise<GetSiteMetadataResponse> {
|
||||||
return this.wrapper(HttpType.Get, '/post/site_metadata', form);
|
return this.wrapper(HttpType.Get, "/post/site_metadata", form);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a comment.
|
* Create a comment.
|
||||||
|
* `HTTP.POST /comment`
|
||||||
*/
|
*/
|
||||||
async createComment(form: CreateComment): Promise<CommentResponse> {
|
async createComment(form: CreateComment): Promise<CommentResponse> {
|
||||||
return this.wrapper(HttpType.Post, '/comment', form);
|
return this.wrapper(HttpType.Post, "/comment", form);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Edit a comment.
|
* Edit a comment.
|
||||||
|
* `HTTP.PUT /comment`
|
||||||
*/
|
*/
|
||||||
async editComment(form: EditComment): Promise<CommentResponse> {
|
async editComment(form: EditComment): Promise<CommentResponse> {
|
||||||
return this.wrapper(HttpType.Put, '/comment', form);
|
return this.wrapper(HttpType.Put, "/comment", form);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete a comment.
|
* Delete a comment.
|
||||||
|
* `HTTP.POST /comment/delete`
|
||||||
*/
|
*/
|
||||||
async deleteComment(form: DeleteComment): Promise<CommentResponse> {
|
async deleteComment(form: DeleteComment): Promise<CommentResponse> {
|
||||||
return this.wrapper(HttpType.Post, '/comment/delete', form);
|
return this.wrapper(HttpType.Post, "/comment/delete", form);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A moderator remove for a comment.
|
* A moderator remove for a comment.
|
||||||
|
* `HTTP.POST /comment/remove`
|
||||||
*/
|
*/
|
||||||
async removeComment(form: RemoveComment): Promise<CommentResponse> {
|
async removeComment(form: RemoveComment): Promise<CommentResponse> {
|
||||||
return this.wrapper(HttpType.Post, '/comment/remove', form);
|
return this.wrapper(HttpType.Post, "/comment/remove", form);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Mark a comment as read.
|
* Mark a comment as read.
|
||||||
|
* `HTTP.POST /comment/mark_as_read`
|
||||||
*/
|
*/
|
||||||
async markCommentAsRead(form: MarkCommentAsRead): Promise<CommentResponse> {
|
async markCommentAsRead(form: MarkCommentAsRead): Promise<CommentResponse> {
|
||||||
return this.wrapper(HttpType.Post, '/comment/mark_as_read', form);
|
return this.wrapper(HttpType.Post, "/comment/mark_as_read", form);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Like / vote on a comment.
|
* Like / vote on a comment.
|
||||||
|
* `HTTP.POST /comment/like`
|
||||||
*/
|
*/
|
||||||
async likeComment(form: CreateCommentLike): Promise<CommentResponse> {
|
async likeComment(form: CreateCommentLike): Promise<CommentResponse> {
|
||||||
return this.wrapper(HttpType.Post, '/comment/like', form);
|
return this.wrapper(HttpType.Post, "/comment/like", form);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Save a comment.
|
* Save a comment.
|
||||||
|
* `HTTP.PUT /comment/save`
|
||||||
*/
|
*/
|
||||||
async saveComment(form: SaveComment): Promise<CommentResponse> {
|
async saveComment(form: SaveComment): Promise<CommentResponse> {
|
||||||
return this.wrapper(HttpType.Put, '/comment/save', form);
|
return this.wrapper(HttpType.Put, "/comment/save", form);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get / fetch comments.
|
* Get / fetch comments.
|
||||||
|
* `HTTP.GET /comment/list`
|
||||||
*/
|
*/
|
||||||
async getComments(form: GetComments): Promise<GetCommentsResponse> {
|
async getComments(form: GetComments): Promise<GetCommentsResponse> {
|
||||||
return this.wrapper(HttpType.Get, '/comment/list', form);
|
return this.wrapper(HttpType.Get, "/comment/list", form);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Report a comment.
|
* Report a comment.
|
||||||
|
* `HTTP.POST /comment/report`
|
||||||
*/
|
*/
|
||||||
async createCommentReport(
|
async createCommentReport(
|
||||||
form: CreateCommentReport
|
form: CreateCommentReport
|
||||||
): Promise<CommentReportResponse> {
|
): Promise<CommentReportResponse> {
|
||||||
return this.wrapper(HttpType.Post, '/comment/report', form);
|
return this.wrapper(HttpType.Post, "/comment/report", form);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Resolve a comment report. Only a mod can do this.
|
* Resolve a comment report. Only a mod can do this.
|
||||||
|
* `HTTP.PUT /comment/report/resolve`
|
||||||
*/
|
*/
|
||||||
async resolveCommentReport(
|
async resolveCommentReport(
|
||||||
form: ResolveCommentReport
|
form: ResolveCommentReport
|
||||||
): Promise<CommentReportResponse> {
|
): Promise<CommentReportResponse> {
|
||||||
return this.wrapper(HttpType.Put, '/comment/report/resolve', form);
|
return this.wrapper(HttpType.Put, "/comment/report/resolve", form);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* List comment reports.
|
* List comment reports.
|
||||||
|
* `HTTP.GET /comment/report/list`
|
||||||
*/
|
*/
|
||||||
async listCommentReports(
|
async listCommentReports(
|
||||||
form: ListCommentReports
|
form: ListCommentReports
|
||||||
): Promise<ListCommentReportsResponse> {
|
): Promise<ListCommentReportsResponse> {
|
||||||
return this.wrapper(HttpType.Get, '/comment/report/list', form);
|
return this.wrapper(HttpType.Get, "/comment/report/list", form);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get / fetch private messages.
|
* Get / fetch private messages.
|
||||||
|
* `HTTP.GET /private_message/list`
|
||||||
*/
|
*/
|
||||||
async getPrivateMessages(
|
async getPrivateMessages(
|
||||||
form: GetPrivateMessages
|
form: GetPrivateMessages
|
||||||
): Promise<PrivateMessagesResponse> {
|
): Promise<PrivateMessagesResponse> {
|
||||||
return this.wrapper(HttpType.Get, '/private_message/list', form);
|
return this.wrapper(HttpType.Get, "/private_message/list", form);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a private message.
|
* Create a private message.
|
||||||
|
* `HTTP.POST /private_message`
|
||||||
*/
|
*/
|
||||||
async createPrivateMessage(
|
async createPrivateMessage(
|
||||||
form: CreatePrivateMessage
|
form: CreatePrivateMessage
|
||||||
): Promise<PrivateMessageResponse> {
|
): Promise<PrivateMessageResponse> {
|
||||||
return this.wrapper(HttpType.Post, '/private_message', form);
|
return this.wrapper(HttpType.Post, "/private_message", form);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Edit a private message.
|
* Edit a private message.
|
||||||
|
* `HTTP.PUT /private_message`
|
||||||
*/
|
*/
|
||||||
async editPrivateMessage(
|
async editPrivateMessage(
|
||||||
form: EditPrivateMessage
|
form: EditPrivateMessage
|
||||||
): Promise<PrivateMessageResponse> {
|
): Promise<PrivateMessageResponse> {
|
||||||
return this.wrapper(HttpType.Put, '/private_message', form);
|
return this.wrapper(HttpType.Put, "/private_message", form);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete a private message.
|
* Delete a private message.
|
||||||
|
* `HTTP.POST /private_message/delete`
|
||||||
*/
|
*/
|
||||||
async deletePrivateMessage(
|
async deletePrivateMessage(
|
||||||
form: DeletePrivateMessage
|
form: DeletePrivateMessage
|
||||||
): Promise<PrivateMessageResponse> {
|
): Promise<PrivateMessageResponse> {
|
||||||
return this.wrapper(HttpType.Post, '/private_message/delete', form);
|
return this.wrapper(HttpType.Post, "/private_message/delete", form);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Mark a private message as read.
|
* Mark a private message as read.
|
||||||
|
* `HTTP.POST /private_message/mark_as_read`
|
||||||
*/
|
*/
|
||||||
async markPrivateMessageAsRead(
|
async markPrivateMessageAsRead(
|
||||||
form: MarkPrivateMessageAsRead
|
form: MarkPrivateMessageAsRead
|
||||||
): Promise<PrivateMessageResponse> {
|
): Promise<PrivateMessageResponse> {
|
||||||
return this.wrapper(HttpType.Post, '/private_message/mark_as_read', form);
|
return this.wrapper(HttpType.Post, "/private_message/mark_as_read", form);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Register a new user.
|
* Register a new user.
|
||||||
|
* `HTTP.POST /user/register`
|
||||||
*/
|
*/
|
||||||
async register(form: Register): Promise<LoginResponse> {
|
async register(form: Register): Promise<LoginResponse> {
|
||||||
return this.wrapper(HttpType.Post, '/user/register', form);
|
return this.wrapper(HttpType.Post, "/user/register", form);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Log into lemmy.
|
* Log into lemmy.
|
||||||
|
* `HTTP.POST /user/login`
|
||||||
*/
|
*/
|
||||||
async login(form: Login): Promise<LoginResponse> {
|
async login(form: Login): Promise<LoginResponse> {
|
||||||
return this.wrapper(HttpType.Post, '/user/login', form);
|
return this.wrapper(HttpType.Post, "/user/login", form);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the details for a person.
|
* Get the details for a person.
|
||||||
|
* `HTTP.GET /user`
|
||||||
*/
|
*/
|
||||||
async getPersonDetails(
|
async getPersonDetails(
|
||||||
form: GetPersonDetails
|
form: GetPersonDetails
|
||||||
): Promise<GetPersonDetailsResponse> {
|
): Promise<GetPersonDetailsResponse> {
|
||||||
return this.wrapper(HttpType.Get, '/user', form);
|
return this.wrapper(HttpType.Get, "/user", form);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get mentions for your user.
|
* Get mentions for your user.
|
||||||
|
* `HTTP.GET /user/mention`
|
||||||
*/
|
*/
|
||||||
async getPersonMentions(
|
async getPersonMentions(
|
||||||
form: GetPersonMentions
|
form: GetPersonMentions
|
||||||
): Promise<GetPersonMentionsResponse> {
|
): Promise<GetPersonMentionsResponse> {
|
||||||
return this.wrapper(HttpType.Get, '/user/mention', form);
|
return this.wrapper(HttpType.Get, "/user/mention", form);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Mark a person mention as read.
|
* Mark a person mention as read.
|
||||||
|
* `HTTP.POST /user/mention/mark_as_read`
|
||||||
*/
|
*/
|
||||||
async markPersonMentionAsRead(
|
async markPersonMentionAsRead(
|
||||||
form: MarkPersonMentionAsRead
|
form: MarkPersonMentionAsRead
|
||||||
): Promise<PersonMentionResponse> {
|
): Promise<PersonMentionResponse> {
|
||||||
return this.wrapper(HttpType.Post, '/user/mention/mark_as_read', form);
|
return this.wrapper(HttpType.Post, "/user/mention/mark_as_read", form);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get comment replies.
|
* Get comment replies.
|
||||||
|
* `HTTP.GET /user/replies`
|
||||||
*/
|
*/
|
||||||
async getReplies(form: GetReplies): Promise<GetRepliesResponse> {
|
async getReplies(form: GetReplies): Promise<GetRepliesResponse> {
|
||||||
return this.wrapper(HttpType.Get, '/user/replies', form);
|
return this.wrapper(HttpType.Get, "/user/replies", form);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Ban a person from your site.
|
* Ban a person from your site.
|
||||||
|
* `HTTP.POST /user/ban`
|
||||||
*/
|
*/
|
||||||
async banPerson(form: BanPerson): Promise<BanPersonResponse> {
|
async banPerson(form: BanPerson): Promise<BanPersonResponse> {
|
||||||
return this.wrapper(HttpType.Post, '/user/ban', form);
|
return this.wrapper(HttpType.Post, "/user/ban", form);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a list of banned users
|
||||||
|
* `HTTP.GET /user/banned`
|
||||||
|
*/
|
||||||
|
async getBannedPersons(
|
||||||
|
form: GetBannedPersons
|
||||||
|
): Promise<BannedPersonsResponse> {
|
||||||
|
return this.wrapper(HttpType.Get, "/user/banned", form);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Block a person.
|
* Block a person.
|
||||||
|
* `HTTP.POST /user/block`
|
||||||
*/
|
*/
|
||||||
async blockPerson(form: BlockPerson): Promise<BlockPersonResponse> {
|
async blockPerson(form: BlockPerson): Promise<BlockPersonResponse> {
|
||||||
return this.wrapper(HttpType.Post, '/user/block', form);
|
return this.wrapper(HttpType.Post, "/user/block", form);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fetch a Captcha.
|
* Fetch a Captcha.
|
||||||
|
* `HTTP.GET /user/get_captcha`
|
||||||
*/
|
*/
|
||||||
async getCaptcha(): Promise<GetCaptchaResponse> {
|
async getCaptcha(): Promise<GetCaptchaResponse> {
|
||||||
return this.wrapper(HttpType.Get, '/user/get_captcha', {});
|
return this.wrapper(HttpType.Get, "/user/get_captcha", {});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete your account.
|
* Delete your account.
|
||||||
|
* `HTTP.POST /user/delete_account`
|
||||||
*/
|
*/
|
||||||
async deleteAccount(form: DeleteAccount): Promise<LoginResponse> {
|
async deleteAccount(form: DeleteAccount): Promise<DeleteAccountResponse> {
|
||||||
return this.wrapper(HttpType.Post, '/user/delete_account', form);
|
return this.wrapper(HttpType.Post, "/user/delete_account", form);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reset your password.
|
* Reset your password.
|
||||||
|
* `HTTP.POST /user/password_reset`
|
||||||
*/
|
*/
|
||||||
async passwordReset(form: PasswordReset): Promise<PasswordResetResponse> {
|
async passwordReset(form: PasswordReset): Promise<PasswordResetResponse> {
|
||||||
return this.wrapper(HttpType.Post, '/user/password_reset', form);
|
return this.wrapper(HttpType.Post, "/user/password_reset", form);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change your password from an email / token based reset.
|
* Change your password from an email / token based reset.
|
||||||
|
* `HTTP.POST /user/password_change`
|
||||||
*/
|
*/
|
||||||
async passwordChange(form: PasswordChange): Promise<LoginResponse> {
|
async passwordChange(form: PasswordChange): Promise<LoginResponse> {
|
||||||
return this.wrapper(HttpType.Post, '/user/password_change', form);
|
return this.wrapper(HttpType.Post, "/user/password_change", form);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Mark all replies as read.
|
* Mark all replies as read.
|
||||||
|
* `HTTP.POST /user/mark_all_as_read`
|
||||||
*/
|
*/
|
||||||
async markAllAsRead(form: MarkAllAsRead): Promise<GetRepliesResponse> {
|
async markAllAsRead(form: MarkAllAsRead): Promise<GetRepliesResponse> {
|
||||||
return this.wrapper(HttpType.Post, '/user/mark_all_as_read', form);
|
return this.wrapper(HttpType.Post, "/user/mark_all_as_read", form);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Save your user settings.
|
* Save your user settings.
|
||||||
|
* `HTTP.PUT /user/save_user_settings`
|
||||||
*/
|
*/
|
||||||
async saveUserSettings(form: SaveUserSettings): Promise<LoginResponse> {
|
async saveUserSettings(form: SaveUserSettings): Promise<LoginResponse> {
|
||||||
return this.wrapper(HttpType.Put, '/user/save_user_settings', form);
|
return this.wrapper(HttpType.Put, "/user/save_user_settings", form);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change your user password.
|
* Change your user password.
|
||||||
|
* `HTTP.PUT /user/change_password`
|
||||||
*/
|
*/
|
||||||
async changePassword(form: ChangePassword): Promise<LoginResponse> {
|
async changePassword(form: ChangePassword): Promise<LoginResponse> {
|
||||||
return this.wrapper(HttpType.Put, '/user/change_password', form);
|
return this.wrapper(HttpType.Put, "/user/change_password", form);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get counts for your reports
|
* Get counts for your reports
|
||||||
|
* `HTTP.GET /user/report_count`
|
||||||
*/
|
*/
|
||||||
async getReportCount(form: GetReportCount): Promise<GetReportCountResponse> {
|
async getReportCount(form: GetReportCount): Promise<GetReportCountResponse> {
|
||||||
return this.wrapper(HttpType.Get, '/user/report_count', form);
|
return this.wrapper(HttpType.Get, "/user/report_count", form);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get your unread counts
|
||||||
|
* `HTTP.GET /user/unread_count`
|
||||||
|
*/
|
||||||
|
async getUnreadCount(form: GetUnreadCount): Promise<GetUnreadCountResponse> {
|
||||||
|
return this.wrapper(HttpType.Get, "/user/unread_count", form);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Verify your email
|
||||||
|
* `HTTP.POST /user/verify_email`
|
||||||
|
*/
|
||||||
|
async verifyEmail(form: VerifyEmail): Promise<VerifyEmailResponse> {
|
||||||
|
return this.wrapper(HttpType.Post, "/user/verify_email", form);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add an admin to your site.
|
* Add an admin to your site.
|
||||||
|
* `HTTP.POST /admin/add`
|
||||||
*/
|
*/
|
||||||
async addAdmin(form: AddAdmin): Promise<AddAdminResponse> {
|
async addAdmin(form: AddAdmin): Promise<AddAdminResponse> {
|
||||||
return this.wrapper(HttpType.Post, '/admin/add', form);
|
return this.wrapper(HttpType.Post, "/admin/add", form);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the unread registration applications count.
|
||||||
|
* `HTTP.GET /admin/registration_application/count`
|
||||||
|
*/
|
||||||
|
async getUnreadRegistrationApplicationCount(
|
||||||
|
form: GetUnreadRegistrationApplicationCount
|
||||||
|
): Promise<GetUnreadRegistrationApplicationCountResponse> {
|
||||||
|
return this.wrapper(
|
||||||
|
HttpType.Get,
|
||||||
|
"/admin/registration_application/count",
|
||||||
|
form
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* List the registration applications.
|
||||||
|
* `HTTP.GET /admin/registration_application/list`
|
||||||
|
*/
|
||||||
|
async listRegistrationApplications(
|
||||||
|
form: ListRegistrationApplications
|
||||||
|
): Promise<ListRegistrationApplicationsResponse> {
|
||||||
|
return this.wrapper(
|
||||||
|
HttpType.Get,
|
||||||
|
"/admin/registration_application/list",
|
||||||
|
form
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Approve a registration application
|
||||||
|
* `HTTP.PUT /admin/registration_application/approve`
|
||||||
|
*/
|
||||||
|
async approveRegistrationApplication(
|
||||||
|
form: ApproveRegistrationApplication
|
||||||
|
): Promise<RegistrationApplicationResponse> {
|
||||||
|
return this.wrapper(
|
||||||
|
HttpType.Put,
|
||||||
|
"/admin/registration_application/approve",
|
||||||
|
form
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Purge / Delete a person from the database.
|
* Purge / Delete a person from the database.
|
||||||
|
* `HTTP.POST /admin/purge/person`
|
||||||
*/
|
*/
|
||||||
async purgePerson(form: PurgePerson): Promise<PurgeItemResponse> {
|
async purgePerson(form: PurgePerson): Promise<PurgeItemResponse> {
|
||||||
return this.wrapper(HttpType.Post, '/admin/purge/person', form);
|
return this.wrapper(HttpType.Post, "/admin/purge/person", form);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Purge / Delete a community from the database.
|
* Purge / Delete a community from the database.
|
||||||
|
* `HTTP.POST /admin/purge/community`
|
||||||
*/
|
*/
|
||||||
async purgeCommunity(form: PurgeCommunity): Promise<PurgeItemResponse> {
|
async purgeCommunity(form: PurgeCommunity): Promise<PurgeItemResponse> {
|
||||||
return this.wrapper(HttpType.Post, '/admin/purge/community', form);
|
return this.wrapper(HttpType.Post, "/admin/purge/community", form);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Purge / Delete a post from the database.
|
* Purge / Delete a post from the database.
|
||||||
|
* `HTTP.POST /admin/purge/post`
|
||||||
*/
|
*/
|
||||||
async purgePost(form: PurgePost): Promise<PurgeItemResponse> {
|
async purgePost(form: PurgePost): Promise<PurgeItemResponse> {
|
||||||
return this.wrapper(HttpType.Post, '/admin/purge/post', form);
|
return this.wrapper(HttpType.Post, "/admin/purge/post", form);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Purge / Delete a comment from the database.
|
* Purge / Delete a comment from the database.
|
||||||
|
* `HTTP.POST /admin/purge/comment`
|
||||||
*/
|
*/
|
||||||
async purgeComment(form: PurgeComment): Promise<PurgeItemResponse> {
|
async purgeComment(form: PurgeComment): Promise<PurgeItemResponse> {
|
||||||
return this.wrapper(HttpType.Post, '/admin/purge/comment', form);
|
return this.wrapper(HttpType.Post, "/admin/purge/comment", form);
|
||||||
}
|
}
|
||||||
|
|
||||||
private buildFullUrl(endpoint: string): string {
|
private buildFullUrl(endpoint: string): string {
|
||||||
|
@ -689,14 +849,14 @@ export class LemmyHttp {
|
||||||
if (type_ == HttpType.Get) {
|
if (type_ == HttpType.Get) {
|
||||||
let getUrl = `${this.buildFullUrl(endpoint)}?${encodeGetParams(form)}`;
|
let getUrl = `${this.buildFullUrl(endpoint)}?${encodeGetParams(form)}`;
|
||||||
return fetch(getUrl, {
|
return fetch(getUrl, {
|
||||||
method: 'GET',
|
method: "GET",
|
||||||
headers: this.headers,
|
headers: this.headers,
|
||||||
}).then(d => d.json() as Promise<ResponseType>);
|
}).then(d => d.json() as Promise<ResponseType>);
|
||||||
} else {
|
} else {
|
||||||
return fetch(this.buildFullUrl(endpoint), {
|
return fetch(this.buildFullUrl(endpoint), {
|
||||||
method: type_,
|
method: type_,
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
"Content-Type": "application/json",
|
||||||
...this.headers,
|
...this.headers,
|
||||||
},
|
},
|
||||||
body: JSON.stringify(form),
|
body: JSON.stringify(form),
|
||||||
|
@ -707,6 +867,6 @@ export class LemmyHttp {
|
||||||
|
|
||||||
function encodeGetParams(p: any): string {
|
function encodeGetParams(p: any): string {
|
||||||
return Object.entries(p)
|
return Object.entries(p)
|
||||||
.map(kv => kv.map(encodeURIComponent).join('='))
|
.map(kv => kv.map(encodeURIComponent).join("="))
|
||||||
.join('&');
|
.join("&");
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
export * from './interfaces';
|
export * from "./http";
|
||||||
export * from './http';
|
export * from "./interfaces";
|
||||||
export * from './websocket';
|
export * from "./websocket";
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import { CommentReportView, CommentView } from '../views';
|
import { ListingType, SortType } from "../others";
|
||||||
|
import { CommentReportView, CommentView } from "../views";
|
||||||
|
|
||||||
export interface CreateComment {
|
export interface CreateComment {
|
||||||
content: string;
|
content: string;
|
||||||
|
@ -77,14 +78,8 @@ export interface CreateCommentLike {
|
||||||
* To get posts for a federated community by name, use `name@instance.tld` .
|
* To get posts for a federated community by name, use `name@instance.tld` .
|
||||||
*/
|
*/
|
||||||
export interface GetComments {
|
export interface GetComments {
|
||||||
/**
|
type_?: ListingType;
|
||||||
* The [[ListingType]].
|
sort?: SortType;
|
||||||
*/
|
|
||||||
type_?: string;
|
|
||||||
/**
|
|
||||||
* The [[SortType]].
|
|
||||||
*/
|
|
||||||
sort?: string;
|
|
||||||
page?: number;
|
page?: number;
|
||||||
limit?: number;
|
limit?: number;
|
||||||
community_id?: number;
|
community_id?: number;
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
|
import { ListingType, SortType } from "../others";
|
||||||
|
import { Site } from "../source";
|
||||||
import {
|
import {
|
||||||
CommunityModeratorView,
|
CommunityModeratorView,
|
||||||
CommunityView,
|
CommunityView,
|
||||||
PersonViewSafe,
|
PersonViewSafe,
|
||||||
} from '../views';
|
} from "../views";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* You can use either `id` or `name` as an id.
|
* You can use either `id` or `name` as an id.
|
||||||
|
@ -17,6 +19,7 @@ export interface GetCommunity {
|
||||||
|
|
||||||
export interface GetCommunityResponse {
|
export interface GetCommunityResponse {
|
||||||
community_view: CommunityView;
|
community_view: CommunityView;
|
||||||
|
site?: Site;
|
||||||
moderators: CommunityModeratorView[];
|
moderators: CommunityModeratorView[];
|
||||||
online: number;
|
online: number;
|
||||||
}
|
}
|
||||||
|
@ -28,6 +31,7 @@ export interface CreateCommunity {
|
||||||
icon?: string;
|
icon?: string;
|
||||||
banner?: string;
|
banner?: string;
|
||||||
nsfw?: boolean;
|
nsfw?: boolean;
|
||||||
|
posting_restricted_to_mods?: boolean;
|
||||||
auth: string;
|
auth: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,15 +40,8 @@ export interface CommunityResponse {
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ListCommunities {
|
export interface ListCommunities {
|
||||||
/**
|
type_?: ListingType;
|
||||||
* The [[ListingType]].
|
sort?: SortType;
|
||||||
*/
|
|
||||||
type_?: string;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The [[SortType]].
|
|
||||||
*/
|
|
||||||
sort?: string;
|
|
||||||
page?: number;
|
page?: number;
|
||||||
limit?: number;
|
limit?: number;
|
||||||
auth?: string;
|
auth?: string;
|
||||||
|
@ -64,6 +61,9 @@ export interface BanFromCommunity {
|
||||||
*/
|
*/
|
||||||
remove_data?: boolean;
|
remove_data?: boolean;
|
||||||
reason?: string;
|
reason?: string;
|
||||||
|
/**
|
||||||
|
* The expire time in Unix seconds
|
||||||
|
*/
|
||||||
expires?: number;
|
expires?: number;
|
||||||
auth: string;
|
auth: string;
|
||||||
}
|
}
|
||||||
|
@ -94,6 +94,7 @@ export interface EditCommunity {
|
||||||
icon?: string;
|
icon?: string;
|
||||||
banner?: string;
|
banner?: string;
|
||||||
nsfw?: boolean;
|
nsfw?: boolean;
|
||||||
|
posting_restricted_to_mods?: boolean;
|
||||||
auth: string;
|
auth: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -110,6 +111,9 @@ export interface RemoveCommunity {
|
||||||
community_id: number;
|
community_id: number;
|
||||||
removed: boolean;
|
removed: boolean;
|
||||||
reason?: string;
|
reason?: string;
|
||||||
|
/**
|
||||||
|
* The expire time in Unix seconds
|
||||||
|
*/
|
||||||
expires?: number;
|
expires?: number;
|
||||||
auth: string;
|
auth: string;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
export * from './comment';
|
export * from "./comment";
|
||||||
export * from './community';
|
export * from "./community";
|
||||||
export * from './post';
|
export * from "./person";
|
||||||
export * from './site';
|
export * from "./post";
|
||||||
export * from './person';
|
export * from "./site";
|
||||||
export * from './websocket';
|
export * from "./websocket";
|
||||||
|
|
|
@ -1,11 +1,12 @@
|
||||||
|
import { SortType } from "../others";
|
||||||
import {
|
import {
|
||||||
CommentView,
|
CommentView,
|
||||||
CommunityModeratorView,
|
CommunityModeratorView,
|
||||||
PostView,
|
|
||||||
PrivateMessageView,
|
|
||||||
PersonMentionView,
|
PersonMentionView,
|
||||||
PersonViewSafe,
|
PersonViewSafe,
|
||||||
} from '../views';
|
PostView,
|
||||||
|
PrivateMessageView,
|
||||||
|
} from "../views";
|
||||||
|
|
||||||
export interface Login {
|
export interface Login {
|
||||||
username_or_email: string;
|
username_or_email: string;
|
||||||
|
@ -19,6 +20,9 @@ export interface Login {
|
||||||
*/
|
*/
|
||||||
export interface Register {
|
export interface Register {
|
||||||
username: string;
|
username: string;
|
||||||
|
/**
|
||||||
|
* Email is mandatory if email verification is enabled on the server
|
||||||
|
*/
|
||||||
email?: string;
|
email?: string;
|
||||||
password: string;
|
password: string;
|
||||||
password_verify: string;
|
password_verify: string;
|
||||||
|
@ -29,6 +33,10 @@ export interface Register {
|
||||||
captcha_uuid?: string;
|
captcha_uuid?: string;
|
||||||
captcha_answer?: string;
|
captcha_answer?: string;
|
||||||
honeypot?: string;
|
honeypot?: string;
|
||||||
|
/**
|
||||||
|
* An answer is mandatory if require application is enabled on the server
|
||||||
|
*/
|
||||||
|
answer?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface GetCaptcha {}
|
export interface GetCaptcha {}
|
||||||
|
@ -106,7 +114,12 @@ export interface ChangePassword {
|
||||||
* The `jwt` string should be stored and used anywhere `auth` is called for.
|
* The `jwt` string should be stored and used anywhere `auth` is called for.
|
||||||
*/
|
*/
|
||||||
export interface LoginResponse {
|
export interface LoginResponse {
|
||||||
jwt: string;
|
/**
|
||||||
|
* This is None in response to `Register` if email verification is enabled, or the server requires registration applications.
|
||||||
|
*/
|
||||||
|
jwt?: string;
|
||||||
|
verify_email_sent: boolean;
|
||||||
|
registration_created: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface GetPersonDetails {
|
export interface GetPersonDetails {
|
||||||
|
@ -115,7 +128,7 @@ export interface GetPersonDetails {
|
||||||
* To get details for a federated user, use `person@instance.tld`.
|
* To get details for a federated user, use `person@instance.tld`.
|
||||||
*/
|
*/
|
||||||
username?: string;
|
username?: string;
|
||||||
sort?: string;
|
sort?: SortType;
|
||||||
page?: number;
|
page?: number;
|
||||||
limit?: number;
|
limit?: number;
|
||||||
community_id?: number;
|
community_id?: number;
|
||||||
|
@ -161,6 +174,9 @@ export interface BanPerson {
|
||||||
*/
|
*/
|
||||||
remove_data?: boolean;
|
remove_data?: boolean;
|
||||||
reason?: string;
|
reason?: string;
|
||||||
|
/**
|
||||||
|
* The expire time in Unix seconds
|
||||||
|
*/
|
||||||
expires?: number;
|
expires?: number;
|
||||||
auth: string;
|
auth: string;
|
||||||
}
|
}
|
||||||
|
@ -171,10 +187,7 @@ export interface BanPersonResponse {
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface GetReplies {
|
export interface GetReplies {
|
||||||
/**
|
sort?: SortType;
|
||||||
* The [[SortType]].
|
|
||||||
*/
|
|
||||||
sort?: string;
|
|
||||||
page?: number;
|
page?: number;
|
||||||
limit?: number;
|
limit?: number;
|
||||||
unread_only?: boolean;
|
unread_only?: boolean;
|
||||||
|
@ -182,10 +195,7 @@ export interface GetReplies {
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface GetPersonMentions {
|
export interface GetPersonMentions {
|
||||||
/**
|
sort?: SortType;
|
||||||
* The [[SortType]].
|
|
||||||
*/
|
|
||||||
sort?: string;
|
|
||||||
page?: number;
|
page?: number;
|
||||||
limit?: number;
|
limit?: number;
|
||||||
unread_only?: boolean;
|
unread_only?: boolean;
|
||||||
|
@ -210,6 +220,8 @@ export interface DeleteAccount {
|
||||||
auth: string;
|
auth: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface DeleteAccountResponse {}
|
||||||
|
|
||||||
export interface PasswordReset {
|
export interface PasswordReset {
|
||||||
email: string;
|
email: string;
|
||||||
}
|
}
|
||||||
|
@ -275,6 +287,22 @@ export interface GetReportCountResponse {
|
||||||
post_reports: number;
|
post_reports: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface GetUnreadCount {
|
||||||
|
auth: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface GetUnreadCountResponse {
|
||||||
|
replies: number;
|
||||||
|
mentions: number;
|
||||||
|
private_messages: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface VerifyEmail {
|
||||||
|
token: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface VerifyEmailResponse {}
|
||||||
|
|
||||||
export interface BlockPerson {
|
export interface BlockPerson {
|
||||||
person_id: number;
|
person_id: number;
|
||||||
block: boolean;
|
block: boolean;
|
||||||
|
@ -285,3 +313,11 @@ export interface BlockPersonResponse {
|
||||||
person_view: PersonViewSafe;
|
person_view: PersonViewSafe;
|
||||||
blocked: boolean;
|
blocked: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface GetBannedPersons {
|
||||||
|
auth: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface BannedPersonsResponse {
|
||||||
|
banned: PersonViewSafe[];
|
||||||
|
}
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
import { SiteMetadata } from '..';
|
import { ListingType, SiteMetadata, SortType } from "../others";
|
||||||
import {
|
import {
|
||||||
CommunityView,
|
|
||||||
CommentView,
|
CommentView,
|
||||||
CommunityModeratorView,
|
CommunityModeratorView,
|
||||||
|
CommunityView,
|
||||||
PostReportView,
|
PostReportView,
|
||||||
PostView,
|
PostView,
|
||||||
} from '../views';
|
} from "../views";
|
||||||
|
|
||||||
export interface CreatePost {
|
export interface CreatePost {
|
||||||
name: string;
|
name: string;
|
||||||
|
@ -35,16 +35,8 @@ export interface GetPostResponse {
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface GetPosts {
|
export interface GetPosts {
|
||||||
/**
|
type_?: ListingType;
|
||||||
* The [[ListingType]].
|
sort?: SortType;
|
||||||
*
|
|
||||||
* Post listing types are `All, Subscribed, Community`
|
|
||||||
*/
|
|
||||||
type_?: string;
|
|
||||||
/**
|
|
||||||
* The [[SortType]].
|
|
||||||
*/
|
|
||||||
sort?: string;
|
|
||||||
page?: number;
|
page?: number;
|
||||||
limit?: number;
|
limit?: number;
|
||||||
community_id?: number;
|
community_id?: number;
|
||||||
|
@ -95,6 +87,15 @@ export interface RemovePost {
|
||||||
auth: string;
|
auth: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Marks a post as read.
|
||||||
|
*/
|
||||||
|
export interface MarkPostAsRead {
|
||||||
|
post_id: number;
|
||||||
|
read: boolean;
|
||||||
|
auth: string;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Only admins and mods can lock a post.
|
* Only admins and mods can lock a post.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,19 +1,16 @@
|
||||||
|
import { ListingType, SearchType, SortType } from "../others";
|
||||||
import {
|
import {
|
||||||
AdminPurgeCommentView,
|
AdminPurgeCommentView,
|
||||||
AdminPurgeCommunityView,
|
AdminPurgeCommunityView,
|
||||||
AdminPurgePersonView,
|
AdminPurgePersonView,
|
||||||
AdminPurgePostView,
|
AdminPurgePostView,
|
||||||
|
CommentView,
|
||||||
CommunityBlockView,
|
CommunityBlockView,
|
||||||
CommunityFollowerView,
|
CommunityFollowerView,
|
||||||
CommunityModeratorView,
|
CommunityModeratorView,
|
||||||
LocalUserSettingsView,
|
|
||||||
PersonBlockView,
|
|
||||||
} from '../views';
|
|
||||||
import {
|
|
||||||
CommentView,
|
|
||||||
CommunityView,
|
CommunityView,
|
||||||
|
LocalUserSettingsView,
|
||||||
ModAddCommunityView,
|
ModAddCommunityView,
|
||||||
ModTransferCommunityView,
|
|
||||||
ModAddView,
|
ModAddView,
|
||||||
ModBanFromCommunityView,
|
ModBanFromCommunityView,
|
||||||
ModBanView,
|
ModBanView,
|
||||||
|
@ -22,10 +19,13 @@ import {
|
||||||
ModRemoveCommunityView,
|
ModRemoveCommunityView,
|
||||||
ModRemovePostView,
|
ModRemovePostView,
|
||||||
ModStickyPostView,
|
ModStickyPostView,
|
||||||
PostView,
|
ModTransferCommunityView,
|
||||||
SiteView,
|
PersonBlockView,
|
||||||
PersonViewSafe,
|
PersonViewSafe,
|
||||||
} from '../views';
|
PostView,
|
||||||
|
RegistrationApplicationView,
|
||||||
|
SiteView,
|
||||||
|
} from "../views";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Search lemmy for different types of data.
|
* Search lemmy for different types of data.
|
||||||
|
@ -35,22 +35,12 @@ export interface Search {
|
||||||
* The search query string.
|
* The search query string.
|
||||||
*/
|
*/
|
||||||
q: string;
|
q: string;
|
||||||
|
type_?: SearchType;
|
||||||
/**
|
|
||||||
* The [[SearchType]].
|
|
||||||
*/
|
|
||||||
type_?: string;
|
|
||||||
community_id?: number;
|
community_id?: number;
|
||||||
community_name?: string;
|
community_name?: string;
|
||||||
creator_id?: number;
|
creator_id?: number;
|
||||||
/**
|
sort?: SortType;
|
||||||
* The [[SortType]].
|
listing_type?: ListingType;
|
||||||
*/
|
|
||||||
sort?: string;
|
|
||||||
/**
|
|
||||||
* The [[ListingType]].
|
|
||||||
*/
|
|
||||||
listing_type?: string;
|
|
||||||
page?: number;
|
page?: number;
|
||||||
limit?: number;
|
limit?: number;
|
||||||
auth?: string;
|
auth?: string;
|
||||||
|
@ -72,6 +62,7 @@ export interface GetModlog {
|
||||||
community_id?: number;
|
community_id?: number;
|
||||||
page?: number;
|
page?: number;
|
||||||
limit?: number;
|
limit?: number;
|
||||||
|
auth?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface GetModlogResponse {
|
export interface GetModlogResponse {
|
||||||
|
@ -101,6 +92,12 @@ export interface CreateSite {
|
||||||
open_registration?: boolean;
|
open_registration?: boolean;
|
||||||
enable_nsfw?: boolean;
|
enable_nsfw?: boolean;
|
||||||
community_creation_admin_only?: boolean;
|
community_creation_admin_only?: boolean;
|
||||||
|
require_email_verification?: boolean;
|
||||||
|
require_application?: boolean;
|
||||||
|
application_question?: string;
|
||||||
|
private_instance?: boolean;
|
||||||
|
default_theme?: string;
|
||||||
|
default_post_listing_type?: string;
|
||||||
auth: string;
|
auth: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -114,6 +111,13 @@ export interface EditSite {
|
||||||
open_registration?: boolean;
|
open_registration?: boolean;
|
||||||
enable_nsfw?: boolean;
|
enable_nsfw?: boolean;
|
||||||
community_creation_admin_only?: boolean;
|
community_creation_admin_only?: boolean;
|
||||||
|
require_email_verification?: boolean;
|
||||||
|
require_application?: boolean;
|
||||||
|
application_question?: string;
|
||||||
|
private_instance?: boolean;
|
||||||
|
default_theme?: string;
|
||||||
|
legal_information?: string;
|
||||||
|
default_post_listing_type?: string;
|
||||||
auth: string;
|
auth: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -131,7 +135,6 @@ export interface GetSiteResponse {
|
||||||
*/
|
*/
|
||||||
site_view?: SiteView;
|
site_view?: SiteView;
|
||||||
admins: PersonViewSafe[];
|
admins: PersonViewSafe[];
|
||||||
banned: PersonViewSafe[];
|
|
||||||
online: number;
|
online: number;
|
||||||
version: string;
|
version: string;
|
||||||
/**
|
/**
|
||||||
|
@ -152,8 +155,7 @@ export interface MyUserInfo {
|
||||||
person_blocks: PersonBlockView[];
|
person_blocks: PersonBlockView[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface TransferSite {
|
export interface LeaveAdmin {
|
||||||
person_id: number;
|
|
||||||
auth: string;
|
auth: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -190,14 +192,12 @@ export interface ResolveObjectResponse {
|
||||||
|
|
||||||
export interface PurgePerson {
|
export interface PurgePerson {
|
||||||
person_id: number;
|
person_id: number;
|
||||||
remove_images: boolean;
|
|
||||||
reason?: string;
|
reason?: string;
|
||||||
auth: string;
|
auth: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface PurgeCommunity {
|
export interface PurgeCommunity {
|
||||||
community_id: number;
|
community_id: number;
|
||||||
remove_images: boolean;
|
|
||||||
reason?: string;
|
reason?: string;
|
||||||
auth: string;
|
auth: string;
|
||||||
}
|
}
|
||||||
|
@ -217,3 +217,36 @@ export interface PurgeComment {
|
||||||
export interface PurgeItemResponse {
|
export interface PurgeItemResponse {
|
||||||
success: boolean;
|
success: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface ListRegistrationApplications {
|
||||||
|
/**
|
||||||
|
* Only shows the unread applications (IE those without an admin actor)
|
||||||
|
*/
|
||||||
|
unread_only?: boolean;
|
||||||
|
page?: number;
|
||||||
|
limit?: number;
|
||||||
|
auth: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ListRegistrationApplicationsResponse {
|
||||||
|
registration_applications: RegistrationApplicationView[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ApproveRegistrationApplication {
|
||||||
|
id: number;
|
||||||
|
approve: boolean;
|
||||||
|
deny_reason?: string;
|
||||||
|
auth: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface RegistrationApplicationResponse {
|
||||||
|
registration_application: RegistrationApplicationView;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface GetUnreadRegistrationApplicationCount {
|
||||||
|
auth: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface GetUnreadRegistrationApplicationCountResponse {
|
||||||
|
registration_applications: number;
|
||||||
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
export * from './api';
|
export * from "./aggregates";
|
||||||
export * from './aggregates';
|
export * from "./api";
|
||||||
export * from './others';
|
export * from "./others";
|
||||||
export * from './source';
|
export * from "./source";
|
||||||
export * from './views';
|
export * from "./views";
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
export const VERSION = 'v3';
|
export const VERSION = "v3";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* All of the websocket operations available.
|
* All of the websocket operations available.
|
||||||
|
@ -26,6 +26,7 @@ export enum UserOperation {
|
||||||
RemovePost,
|
RemovePost,
|
||||||
LockPost,
|
LockPost,
|
||||||
StickyPost,
|
StickyPost,
|
||||||
|
MarkPostAsRead,
|
||||||
SavePost,
|
SavePost,
|
||||||
EditCommunity,
|
EditCommunity,
|
||||||
DeleteCommunity,
|
DeleteCommunity,
|
||||||
|
@ -42,13 +43,17 @@ export enum UserOperation {
|
||||||
EditSite,
|
EditSite,
|
||||||
GetSite,
|
GetSite,
|
||||||
AddAdmin,
|
AddAdmin,
|
||||||
|
GetUnreadRegistrationApplicationCount,
|
||||||
|
ListRegistrationApplications,
|
||||||
|
ApproveRegistrationApplication,
|
||||||
BanPerson,
|
BanPerson,
|
||||||
|
GetBannedPersons,
|
||||||
Search,
|
Search,
|
||||||
ResolveObject,
|
ResolveObject,
|
||||||
MarkAllAsRead,
|
MarkAllAsRead,
|
||||||
SaveUserSettings,
|
SaveUserSettings,
|
||||||
TransferCommunity,
|
TransferCommunity,
|
||||||
TransferSite,
|
LeaveAdmin,
|
||||||
DeleteAccount,
|
DeleteAccount,
|
||||||
PasswordReset,
|
PasswordReset,
|
||||||
PasswordChange,
|
PasswordChange,
|
||||||
|
@ -78,6 +83,8 @@ export enum UserOperation {
|
||||||
ResolvePostReport,
|
ResolvePostReport,
|
||||||
ListPostReports,
|
ListPostReports,
|
||||||
GetReportCount,
|
GetReportCount,
|
||||||
|
GetUnreadCount,
|
||||||
|
VerifyEmail,
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -87,62 +94,62 @@ export enum SortType {
|
||||||
/**
|
/**
|
||||||
* Posts sorted by the most recent comment.
|
* Posts sorted by the most recent comment.
|
||||||
*/
|
*/
|
||||||
Active = 'Active',
|
Active = "Active",
|
||||||
/**
|
/**
|
||||||
* Posts sorted by the published time.
|
* Posts sorted by the published time.
|
||||||
*/
|
*/
|
||||||
Hot = 'Hot',
|
Hot = "Hot",
|
||||||
New = 'New',
|
New = "New",
|
||||||
/**
|
/**
|
||||||
* The top posts for this last day.
|
* The top posts for this last day.
|
||||||
*/
|
*/
|
||||||
TopDay = 'TopDay',
|
TopDay = "TopDay",
|
||||||
/**
|
/**
|
||||||
* The top posts for this last week.
|
* The top posts for this last week.
|
||||||
*/
|
*/
|
||||||
TopWeek = 'TopWeek',
|
TopWeek = "TopWeek",
|
||||||
/**
|
/**
|
||||||
* The top posts for this last month.
|
* The top posts for this last month.
|
||||||
*/
|
*/
|
||||||
TopMonth = 'TopMonth',
|
TopMonth = "TopMonth",
|
||||||
/**
|
/**
|
||||||
* The top posts for this last year.
|
* The top posts for this last year.
|
||||||
*/
|
*/
|
||||||
TopYear = 'TopYear',
|
TopYear = "TopYear",
|
||||||
/**
|
/**
|
||||||
* The top posts of all time.
|
* The top posts of all time.
|
||||||
*/
|
*/
|
||||||
TopAll = 'TopAll',
|
TopAll = "TopAll",
|
||||||
/**
|
/**
|
||||||
* Posts sorted by the most comments.
|
* Posts sorted by the most comments.
|
||||||
*/
|
*/
|
||||||
MostComments = 'MostComments',
|
MostComments = "MostComments",
|
||||||
/**
|
/**
|
||||||
* Posts sorted by the newest comments, with no necrobumping. IE a forum sort.
|
* Posts sorted by the newest comments, with no necrobumping. IE a forum sort.
|
||||||
*/
|
*/
|
||||||
NewComments = 'NewComments',
|
NewComments = "NewComments",
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The different listing types for post and comment fetches.
|
* The different listing types for post and comment fetches.
|
||||||
*/
|
*/
|
||||||
export enum ListingType {
|
export enum ListingType {
|
||||||
All = 'All',
|
All = "All",
|
||||||
Local = 'Local',
|
Local = "Local",
|
||||||
Subscribed = 'Subscribed',
|
Subscribed = "Subscribed",
|
||||||
Community = 'Community',
|
Community = "Community",
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Search types for lemmy's search.
|
* Search types for lemmy's search.
|
||||||
*/
|
*/
|
||||||
export enum SearchType {
|
export enum SearchType {
|
||||||
All = 'All',
|
All = "All",
|
||||||
Comments = 'Comments',
|
Comments = "Comments",
|
||||||
Posts = 'Posts',
|
Posts = "Posts",
|
||||||
Communities = 'Communities',
|
Communities = "Communities",
|
||||||
Users = 'Users',
|
Users = "Users",
|
||||||
Url = 'Url',
|
Url = "Url",
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -13,6 +13,8 @@ export interface LocalUserSettings {
|
||||||
show_scores: boolean;
|
show_scores: boolean;
|
||||||
show_read_posts: boolean;
|
show_read_posts: boolean;
|
||||||
show_new_post_notifs: boolean;
|
show_new_post_notifs: boolean;
|
||||||
|
email_verified: boolean;
|
||||||
|
accepted_application: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface PersonSafe {
|
export interface PersonSafe {
|
||||||
|
@ -33,22 +35,33 @@ export interface PersonSafe {
|
||||||
matrix_user_id?: string;
|
matrix_user_id?: string;
|
||||||
admin: boolean;
|
admin: boolean;
|
||||||
bot_account: boolean;
|
bot_account: boolean;
|
||||||
|
ban_expires?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Site {
|
export interface Site {
|
||||||
id: number;
|
id: number;
|
||||||
name: string;
|
name: string;
|
||||||
sidebar?: string;
|
sidebar?: string;
|
||||||
description?: string;
|
|
||||||
creator_id: number;
|
|
||||||
published: string;
|
published: string;
|
||||||
updated?: string;
|
updated?: string;
|
||||||
enable_downvotes: boolean;
|
enable_downvotes: boolean;
|
||||||
open_registration: boolean;
|
open_registration: boolean;
|
||||||
enable_nsfw: boolean;
|
enable_nsfw: boolean;
|
||||||
community_creation_admin_only: boolean;
|
|
||||||
icon?: string;
|
icon?: string;
|
||||||
banner?: string;
|
banner?: string;
|
||||||
|
description?: string;
|
||||||
|
community_creation_admin_only: boolean;
|
||||||
|
require_email_verification: boolean;
|
||||||
|
require_application: boolean;
|
||||||
|
application_question?: string;
|
||||||
|
private_instance: boolean;
|
||||||
|
default_theme: string;
|
||||||
|
default_post_listing_type: string;
|
||||||
|
actor_id: string;
|
||||||
|
last_refreshed_at: string;
|
||||||
|
inbox_url: string;
|
||||||
|
public_key: string;
|
||||||
|
legal_information?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface PrivateMessage {
|
export interface PrivateMessage {
|
||||||
|
@ -242,6 +255,7 @@ export interface CommunitySafe {
|
||||||
local: boolean;
|
local: boolean;
|
||||||
icon?: string;
|
icon?: string;
|
||||||
banner?: string;
|
banner?: string;
|
||||||
|
posting_restricted_to_mods: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface CommentReport {
|
export interface CommentReport {
|
||||||
|
@ -278,3 +292,12 @@ export interface PersonMention {
|
||||||
read: boolean;
|
read: boolean;
|
||||||
published: string;
|
published: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface RegistrationApplication {
|
||||||
|
id: number;
|
||||||
|
local_user_id: number;
|
||||||
|
answer: string;
|
||||||
|
admin_id?: number;
|
||||||
|
deny_reason?: string;
|
||||||
|
published: string;
|
||||||
|
}
|
||||||
|
|
|
@ -1,17 +1,21 @@
|
||||||
import {
|
import {
|
||||||
CommentAggregates,
|
CommentAggregates,
|
||||||
CommunityAggregates,
|
CommunityAggregates,
|
||||||
|
PersonAggregates,
|
||||||
PostAggregates,
|
PostAggregates,
|
||||||
SiteAggregates,
|
SiteAggregates,
|
||||||
PersonAggregates,
|
} from "./aggregates";
|
||||||
} from './aggregates';
|
|
||||||
import {
|
import {
|
||||||
|
AdminPurgeComment,
|
||||||
|
AdminPurgeCommunity,
|
||||||
|
AdminPurgePerson,
|
||||||
|
AdminPurgePost,
|
||||||
Comment,
|
Comment,
|
||||||
CommentReport,
|
CommentReport,
|
||||||
CommunitySafe,
|
CommunitySafe,
|
||||||
|
LocalUserSettings,
|
||||||
ModAdd,
|
ModAdd,
|
||||||
ModAddCommunity,
|
ModAddCommunity,
|
||||||
ModTransferCommunity,
|
|
||||||
ModBan,
|
ModBan,
|
||||||
ModBanFromCommunity,
|
ModBanFromCommunity,
|
||||||
ModLockPost,
|
ModLockPost,
|
||||||
|
@ -19,18 +23,15 @@ import {
|
||||||
ModRemoveCommunity,
|
ModRemoveCommunity,
|
||||||
ModRemovePost,
|
ModRemovePost,
|
||||||
ModStickyPost,
|
ModStickyPost,
|
||||||
|
ModTransferCommunity,
|
||||||
|
PersonMention,
|
||||||
|
PersonSafe,
|
||||||
Post,
|
Post,
|
||||||
PostReport,
|
PostReport,
|
||||||
PrivateMessage,
|
PrivateMessage,
|
||||||
|
RegistrationApplication,
|
||||||
Site,
|
Site,
|
||||||
PersonMention,
|
} from "./source";
|
||||||
PersonSafe,
|
|
||||||
LocalUserSettings,
|
|
||||||
AdminPurgeCommunity,
|
|
||||||
AdminPurgePerson,
|
|
||||||
AdminPurgePost,
|
|
||||||
AdminPurgeComment,
|
|
||||||
} from './source';
|
|
||||||
|
|
||||||
export interface PersonViewSafe {
|
export interface PersonViewSafe {
|
||||||
person: PersonSafe;
|
person: PersonSafe;
|
||||||
|
@ -60,7 +61,6 @@ export interface LocalUserSettingsView {
|
||||||
|
|
||||||
export interface SiteView {
|
export interface SiteView {
|
||||||
site: Site;
|
site: Site;
|
||||||
creator: PersonSafe;
|
|
||||||
counts: SiteAggregates;
|
counts: SiteAggregates;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -244,3 +244,10 @@ export interface CommunityView {
|
||||||
blocked: boolean;
|
blocked: boolean;
|
||||||
counts: CommunityAggregates;
|
counts: CommunityAggregates;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface RegistrationApplicationView {
|
||||||
|
registration_application: RegistrationApplication;
|
||||||
|
creator_local_user: LocalUserSettings;
|
||||||
|
creator: PersonSafe;
|
||||||
|
admin?: PersonSafe;
|
||||||
|
}
|
||||||
|
|
124
src/websocket.ts
124
src/websocket.ts
|
@ -10,7 +10,7 @@ import {
|
||||||
RemoveComment,
|
RemoveComment,
|
||||||
ResolveCommentReport,
|
ResolveCommentReport,
|
||||||
SaveComment,
|
SaveComment,
|
||||||
} from './interfaces/api/comment';
|
} from "./interfaces/api/comment";
|
||||||
import {
|
import {
|
||||||
AddModToCommunity,
|
AddModToCommunity,
|
||||||
BanFromCommunity,
|
BanFromCommunity,
|
||||||
|
@ -23,7 +23,33 @@ import {
|
||||||
ListCommunities,
|
ListCommunities,
|
||||||
RemoveCommunity,
|
RemoveCommunity,
|
||||||
TransferCommunity,
|
TransferCommunity,
|
||||||
} from './interfaces/api/community';
|
} from "./interfaces/api/community";
|
||||||
|
import {
|
||||||
|
AddAdmin,
|
||||||
|
BanPerson,
|
||||||
|
BlockPerson,
|
||||||
|
ChangePassword,
|
||||||
|
CreatePrivateMessage,
|
||||||
|
DeleteAccount,
|
||||||
|
DeletePrivateMessage,
|
||||||
|
EditPrivateMessage,
|
||||||
|
GetBannedPersons,
|
||||||
|
GetPersonDetails,
|
||||||
|
GetPersonMentions,
|
||||||
|
GetPrivateMessages,
|
||||||
|
GetReplies,
|
||||||
|
GetReportCount,
|
||||||
|
GetUnreadCount,
|
||||||
|
Login,
|
||||||
|
MarkAllAsRead,
|
||||||
|
MarkPersonMentionAsRead,
|
||||||
|
MarkPrivateMessageAsRead,
|
||||||
|
PasswordChange,
|
||||||
|
PasswordReset,
|
||||||
|
Register,
|
||||||
|
SaveUserSettings,
|
||||||
|
VerifyEmail,
|
||||||
|
} from "./interfaces/api/person";
|
||||||
import {
|
import {
|
||||||
CreatePost,
|
CreatePost,
|
||||||
CreatePostLike,
|
CreatePostLike,
|
||||||
|
@ -35,17 +61,22 @@ import {
|
||||||
GetSiteMetadata,
|
GetSiteMetadata,
|
||||||
ListPostReports,
|
ListPostReports,
|
||||||
LockPost,
|
LockPost,
|
||||||
|
MarkPostAsRead,
|
||||||
RemovePost,
|
RemovePost,
|
||||||
ResolvePostReport,
|
ResolvePostReport,
|
||||||
SavePost,
|
SavePost,
|
||||||
StickyPost,
|
StickyPost,
|
||||||
} from './interfaces/api/post';
|
} from "./interfaces/api/post";
|
||||||
import {
|
import {
|
||||||
|
ApproveRegistrationApplication,
|
||||||
CreateSite,
|
CreateSite,
|
||||||
EditSite,
|
EditSite,
|
||||||
GetModlog,
|
GetModlog,
|
||||||
GetSite,
|
GetSite,
|
||||||
GetSiteConfig,
|
GetSiteConfig,
|
||||||
|
GetUnreadRegistrationApplicationCount,
|
||||||
|
LeaveAdmin,
|
||||||
|
ListRegistrationApplications,
|
||||||
PurgeComment,
|
PurgeComment,
|
||||||
PurgeCommunity,
|
PurgeCommunity,
|
||||||
PurgePerson,
|
PurgePerson,
|
||||||
|
@ -53,33 +84,9 @@ import {
|
||||||
ResolveObject,
|
ResolveObject,
|
||||||
SaveSiteConfig,
|
SaveSiteConfig,
|
||||||
Search,
|
Search,
|
||||||
TransferSite,
|
} from "./interfaces/api/site";
|
||||||
} from './interfaces/api/site';
|
import { CommunityJoin, PostJoin, UserJoin } from "./interfaces/api/websocket";
|
||||||
import {
|
import { UserOperation } from "./interfaces/others";
|
||||||
AddAdmin,
|
|
||||||
BanPerson,
|
|
||||||
CreatePrivateMessage,
|
|
||||||
DeleteAccount,
|
|
||||||
DeletePrivateMessage,
|
|
||||||
EditPrivateMessage,
|
|
||||||
GetPrivateMessages,
|
|
||||||
GetReplies,
|
|
||||||
GetPersonDetails,
|
|
||||||
GetPersonMentions,
|
|
||||||
Login,
|
|
||||||
MarkAllAsRead,
|
|
||||||
MarkPrivateMessageAsRead,
|
|
||||||
MarkPersonMentionAsRead,
|
|
||||||
PasswordChange,
|
|
||||||
PasswordReset,
|
|
||||||
Register,
|
|
||||||
SaveUserSettings,
|
|
||||||
ChangePassword,
|
|
||||||
BlockPerson,
|
|
||||||
GetReportCount,
|
|
||||||
} from './interfaces/api/person';
|
|
||||||
import { UserJoin, PostJoin, CommunityJoin } from './interfaces/api/websocket';
|
|
||||||
import { UserOperation } from './interfaces/others';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helps build lemmy websocket message requests, that you can use in your Websocket sends.
|
* Helps build lemmy websocket message requests, that you can use in your Websocket sends.
|
||||||
|
@ -330,6 +337,13 @@ export class LemmyWebsocket {
|
||||||
return wrapper(UserOperation.StickyPost, form);
|
return wrapper(UserOperation.StickyPost, form);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Mark a post as read.
|
||||||
|
*/
|
||||||
|
markPostAsRead(form: MarkPostAsRead) {
|
||||||
|
return wrapper(UserOperation.MarkPostAsRead, form);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Save a post.
|
* Save a post.
|
||||||
*/
|
*/
|
||||||
|
@ -387,10 +401,10 @@ export class LemmyWebsocket {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Transfer your site to another user.
|
* Leave the Site admins.
|
||||||
*/
|
*/
|
||||||
transferSite(form: TransferSite) {
|
leaveAdmin(form: LeaveAdmin) {
|
||||||
return wrapper(UserOperation.TransferSite, form);
|
return wrapper(UserOperation.LeaveAdmin, form);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -400,6 +414,13 @@ export class LemmyWebsocket {
|
||||||
return wrapper(UserOperation.BanPerson, form);
|
return wrapper(UserOperation.BanPerson, form);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a list of banned users
|
||||||
|
*/
|
||||||
|
getBannedPersons(form: GetBannedPersons) {
|
||||||
|
return wrapper(UserOperation.GetBannedPersons, form);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add an admin to your site.
|
* Add an admin to your site.
|
||||||
*/
|
*/
|
||||||
|
@ -407,6 +428,29 @@ export class LemmyWebsocket {
|
||||||
return wrapper(UserOperation.AddAdmin, form);
|
return wrapper(UserOperation.AddAdmin, form);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the unread registration applications count.
|
||||||
|
*/
|
||||||
|
getUnreadRegistrationApplicationCount(
|
||||||
|
form: GetUnreadRegistrationApplicationCount
|
||||||
|
) {
|
||||||
|
return wrapper(UserOperation.GetUnreadRegistrationApplicationCount, form);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* List the unread registration applications.
|
||||||
|
*/
|
||||||
|
listRegistrationApplications(form: ListRegistrationApplications) {
|
||||||
|
return wrapper(UserOperation.ListRegistrationApplications, form);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Approve a registration application
|
||||||
|
*/
|
||||||
|
approveRegistrationApplication(form: ApproveRegistrationApplication) {
|
||||||
|
return wrapper(UserOperation.ApproveRegistrationApplication, form);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the details for a person.
|
* Get the details for a person.
|
||||||
*/
|
*/
|
||||||
|
@ -512,6 +556,20 @@ export class LemmyWebsocket {
|
||||||
return wrapper(UserOperation.GetReportCount, form);
|
return wrapper(UserOperation.GetReportCount, form);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get your unread counts
|
||||||
|
*/
|
||||||
|
getUnreadCount(form: GetUnreadCount) {
|
||||||
|
return wrapper(UserOperation.GetUnreadCount, form);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Verify your email
|
||||||
|
*/
|
||||||
|
verifyEmail(form: VerifyEmail) {
|
||||||
|
return wrapper(UserOperation.VerifyEmail, form);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete your account.
|
* Delete your account.
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in a new issue