Resolve endpoint (#28)

* Adding ResolveObject to the API. Fixes #27

* v0.11.4-rc.13

* v0.11.4-rc.14

* Forgot to add the websocket

* v0.11.4-rc.15
This commit is contained in:
Dessalines 2021-08-23 16:15:24 -04:00 committed by GitHub
parent 0fb3e3b7e4
commit f32772c2e1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 31 additions and 1 deletions

View file

@ -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.11.4-rc.12", "version": "0.11.4-rc.15",
"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",

View file

@ -56,6 +56,8 @@ import {
GetSiteConfig, GetSiteConfig,
GetSiteConfigResponse, GetSiteConfigResponse,
GetSiteResponse, GetSiteResponse,
ResolveObject,
ResolveObjectResponse,
SaveSiteConfig, SaveSiteConfig,
Search, Search,
SearchResponse, SearchResponse,
@ -181,6 +183,13 @@ export class LemmyHttp {
return this.wrapper(HttpType.Get, '/search', form); return this.wrapper(HttpType.Get, '/search', form);
} }
/**
* Fetch a non-local / federated object.
*/
async resolveObject(form: ResolveObject): Promise<ResolveObjectResponse> {
return this.wrapper(HttpType.Get, '/resolve_object', form);
}
/** /**
* Create a new community. * Create a new community.
*/ */

View file

@ -167,3 +167,15 @@ export interface FederatedInstances {
allowed?: string[]; allowed?: string[];
blocked?: string[]; blocked?: string[];
} }
export interface ResolveObject {
q: string;
auth?: string;
}
export interface ResolveObjectResponse {
comment?: CommentView;
post?: PostView;
community?: CommunityView;
person?: PersonViewSafe;
}

View file

@ -44,6 +44,7 @@ export enum UserOperation {
AddAdmin, AddAdmin,
BanPerson, BanPerson,
Search, Search,
ResolveObject,
MarkAllAsRead, MarkAllAsRead,
SaveUserSettings, SaveUserSettings,
TransferCommunity, TransferCommunity,

View file

@ -40,6 +40,7 @@ import {
GetModlog, GetModlog,
GetSite, GetSite,
GetSiteConfig, GetSiteConfig,
ResolveObject,
SaveSiteConfig, SaveSiteConfig,
Search, Search,
TransferSite, TransferSite,
@ -423,6 +424,13 @@ export class LemmyWebsocket {
return wrapper(UserOperation.Search, form); return wrapper(UserOperation.Search, form);
} }
/**
* Fetch a non-local / federated object.
*/
resolveObject(form: ResolveObject) {
return wrapper(UserOperation.ResolveObject, form);
}
/** /**
* Mark all replies as read. * Mark all replies as read.
*/ */