mirror of
https://github.com/LemmyNet/lemmy-js-client.git
synced 2024-11-26 14:21:12 +00:00
Adding a few missing routes.
This commit is contained in:
parent
4f607e97c8
commit
a8ac7acf02
3 changed files with 66 additions and 1 deletions
56
src/http.ts
56
src/http.ts
|
@ -125,6 +125,7 @@ import { GenerateTotpSecretResponse } from "./types/GenerateTotpSecretResponse";
|
|||
import { UpdateTotp } from "./types/UpdateTotp";
|
||||
import { UpdateTotpResponse } from "./types/UpdateTotpResponse";
|
||||
import { SuccessResponse } from "./types/SuccessResponse";
|
||||
import { LoginToken } from "./types/LoginToken";
|
||||
|
||||
enum HttpType {
|
||||
Get = "GET",
|
||||
|
@ -223,6 +224,59 @@ export class LemmyHttp {
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Export a backup of your user settings, including your saved content,
|
||||
* followed communities, and blocks.
|
||||
*
|
||||
* `HTTP.GET /user/export_settings`
|
||||
*/
|
||||
exportSettings() {
|
||||
return this.#wrapper<object, any>(
|
||||
HttpType.Get,
|
||||
"/user/export_settings",
|
||||
{},
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Import a backup of your user settings.
|
||||
*
|
||||
* `HTTP.POST /user/import_settings`
|
||||
*/
|
||||
importSettings(form: any) {
|
||||
return this.#wrapper<object, SuccessResponse>(
|
||||
HttpType.Post,
|
||||
"/user/import_settings",
|
||||
form,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* List login tokens for your user
|
||||
*
|
||||
* `HTTP.GET /user/list_logins`
|
||||
*/
|
||||
listLogins() {
|
||||
return this.#wrapper<object, LoginToken[]>(
|
||||
HttpType.Get,
|
||||
"/user/list_logins",
|
||||
{},
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an error message if your auth token is invalid
|
||||
*
|
||||
* `HTTP.GET /user/validate_auth`
|
||||
*/
|
||||
validateAuth() {
|
||||
return this.#wrapper<object, SuccessResponse>(
|
||||
HttpType.Get,
|
||||
"/user/validate_auth",
|
||||
{},
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable / Disable TOTP / two-factor authentication.
|
||||
*
|
||||
|
@ -367,7 +421,7 @@ export class LemmyHttp {
|
|||
}
|
||||
|
||||
/**
|
||||
* Hide a community from public view.
|
||||
* Hide a community from public / "All" view. Admins only.
|
||||
*
|
||||
* `HTTP.PUT /community/hide`
|
||||
*/
|
||||
|
|
|
@ -129,6 +129,7 @@ export { LocalUserView } from "./types/LocalUserView";
|
|||
export { LockPost } from "./types/LockPost";
|
||||
export { Login } from "./types/Login";
|
||||
export { LoginResponse } from "./types/LoginResponse";
|
||||
export { LoginToken } from "./types/LoginToken";
|
||||
export { MarkCommentReplyAsRead } from "./types/MarkCommentReplyAsRead";
|
||||
export { MarkPersonMentionAsRead } from "./types/MarkPersonMentionAsRead";
|
||||
export { MarkPostAsRead } from "./types/MarkPostAsRead";
|
||||
|
|
10
src/types/LoginToken.ts
Normal file
10
src/types/LoginToken.ts
Normal file
|
@ -0,0 +1,10 @@
|
|||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||
import type { LocalUserId } from "./LocalUserId";
|
||||
|
||||
export interface LoginToken {
|
||||
id: number;
|
||||
user_id: LocalUserId;
|
||||
published: string;
|
||||
ip?: string;
|
||||
user_agent?: string;
|
||||
}
|
Loading…
Reference in a new issue