diff --git a/package.json b/package.json index ffef4822..4a42adf3 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "lemmy-js-client", "description": "A javascript / typescript client for Lemmy", - "version": "0.11.4-rc.12", + "version": "0.11.4-rc.15", "author": "Dessalines ", "license": "AGPL-3.0", "main": "./dist/index.js", diff --git a/src/http.ts b/src/http.ts index 509a1e9e..f3059447 100644 --- a/src/http.ts +++ b/src/http.ts @@ -56,6 +56,8 @@ import { GetSiteConfig, GetSiteConfigResponse, GetSiteResponse, + ResolveObject, + ResolveObjectResponse, SaveSiteConfig, Search, SearchResponse, @@ -181,6 +183,13 @@ export class LemmyHttp { return this.wrapper(HttpType.Get, '/search', form); } + /** + * Fetch a non-local / federated object. + */ + async resolveObject(form: ResolveObject): Promise { + return this.wrapper(HttpType.Get, '/resolve_object', form); + } + /** * Create a new community. */ diff --git a/src/interfaces/api/site.ts b/src/interfaces/api/site.ts index ec3e96c0..aaa3c725 100644 --- a/src/interfaces/api/site.ts +++ b/src/interfaces/api/site.ts @@ -167,3 +167,15 @@ export interface FederatedInstances { allowed?: string[]; blocked?: string[]; } + +export interface ResolveObject { + q: string; + auth?: string; +} + +export interface ResolveObjectResponse { + comment?: CommentView; + post?: PostView; + community?: CommunityView; + person?: PersonViewSafe; +} diff --git a/src/interfaces/others.ts b/src/interfaces/others.ts index c163d2f0..2d381a9c 100644 --- a/src/interfaces/others.ts +++ b/src/interfaces/others.ts @@ -44,6 +44,7 @@ export enum UserOperation { AddAdmin, BanPerson, Search, + ResolveObject, MarkAllAsRead, SaveUserSettings, TransferCommunity, diff --git a/src/websocket.ts b/src/websocket.ts index 07034de0..8e40545b 100644 --- a/src/websocket.ts +++ b/src/websocket.ts @@ -40,6 +40,7 @@ import { GetModlog, GetSite, GetSiteConfig, + ResolveObject, SaveSiteConfig, Search, TransferSite, @@ -423,6 +424,13 @@ export class LemmyWebsocket { return wrapper(UserOperation.Search, form); } + /** + * Fetch a non-local / federated object. + */ + resolveObject(form: ResolveObject) { + return wrapper(UserOperation.ResolveObject, form); + } + /** * Mark all replies as read. */