Compare commits

...

2 commits

Author SHA1 Message Date
Dessalines
03489de1c9 v0.17.2-rc.12 2023-05-10 11:02:37 -04:00
Dessalines
aabd039a54 Adding support for federated instances. Fixes #115 2023-05-10 11:00:58 -04:00
6 changed files with 33 additions and 8 deletions

View file

@ -1,6 +1,6 @@
{
"name": "lemmy-js-client",
"version": "0.17.2-rc.11",
"version": "0.17.2-rc.12",
"description": "A javascript / typescript client for Lemmy",
"repository": "https://github.com/LemmyNet/lemmy-js-client",
"license": "AGPL-3.0",

View file

@ -45,12 +45,14 @@ import { EditSite } from "./types/EditSite";
import { FeaturePost } from "./types/FeaturePost";
import { FollowCommunity } from "./types/FollowCommunity";
import { GetBannedPersons } from "./types/GetBannedPersons";
import { GetCaptcha } from "./types/GetCaptcha";
import { GetCaptchaResponse } from "./types/GetCaptchaResponse";
import { GetComment } from "./types/GetComment";
import { GetComments } from "./types/GetComments";
import { GetCommentsResponse } from "./types/GetCommentsResponse";
import { GetCommunity } from "./types/GetCommunity";
import { GetCommunityResponse } from "./types/GetCommunityResponse";
import { GetFederatedInstances } from "./types/GetFederatedInstances";
import { GetModlog } from "./types/GetModlog";
import { GetModlogResponse } from "./types/GetModlogResponse";
import { GetPersonDetails } from "./types/GetPersonDetails";
@ -936,11 +938,11 @@ export class LemmyHttp {
*
* `HTTP.GET /user/get_captcha`
*/
getCaptcha() {
return this.wrapper<any, GetCaptchaResponse>(
getCaptcha(form: GetCaptcha) {
return this.wrapper<GetCaptcha, GetCaptchaResponse>(
HttpType.Get,
"/user/get_captcha",
{}
form
);
}
@ -1191,6 +1193,15 @@ export class LemmyHttp {
return this.wrapper(HttpType.Post, "/custom_emoji/delete", form);
}
/**
* Fetch federated instances.
*
* `HTTP.Get /federated_instances`
*/
async getFederatedInstances(form: GetFederatedInstances) {
return this.wrapper(HttpType.Get, "/federated_instances", form);
}
/**
* Upload an image to the server.
*/

View file

@ -1,3 +1,5 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
export type GetCaptcha = null;
export interface GetCaptcha {
auth?: string;
}

View file

@ -1,3 +1,5 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
export type GetFederatedInstances = null;
export interface GetFederatedInstances {
auth?: string;
}

View file

@ -90,6 +90,7 @@ export enum UserOperation {
CreateCustomEmoji,
EditCustomEmoji,
DeleteCustomEmoji,
GetFederatedInstances,
}
export interface UploadImage {

View file

@ -33,9 +33,11 @@ import { EditSite } from "./types/EditSite";
import { FeaturePost } from "./types/FeaturePost";
import { FollowCommunity } from "./types/FollowCommunity";
import { GetBannedPersons } from "./types/GetBannedPersons";
import { GetCaptcha } from "./types/GetCaptcha";
import { GetComment } from "./types/GetComment";
import { GetComments } from "./types/GetComments";
import { GetCommunity } from "./types/GetCommunity";
import { GetFederatedInstances } from "./types/GetFederatedInstances";
import { GetModlog } from "./types/GetModlog";
import { GetPersonDetails } from "./types/GetPersonDetails";
import { GetPersonMentions } from "./types/GetPersonMentions";
@ -141,8 +143,8 @@ export class LemmyWebsocket {
/**
* Fetch a Captcha.
*/
getCaptcha() {
return wrapper(UserOperation.GetCaptcha, {});
getCaptcha(form: GetCaptcha) {
return wrapper(UserOperation.GetCaptcha, form);
}
/**
@ -706,6 +708,13 @@ export class LemmyWebsocket {
deleteCustomEmoji(form: DeleteCustomEmoji) {
return wrapper(UserOperation.DeleteCustomEmoji, form);
}
/**
* Fetch federated instances.
*/
getFederatedInstances(form: GetFederatedInstances) {
return wrapper(UserOperation.GetFederatedInstances, form);
}
}
function wrapper<MessageType>(op: UserOperation, data: MessageType) {