From 5ef1a2d508a8a4e451b5ddafbf5850d97dc87387 Mon Sep 17 00:00:00 2001 From: Dessalines Date: Thu, 19 Aug 2021 20:34:14 -0400 Subject: [PATCH] Adding ResolveObject to the API. Fixes #27 --- src/http.ts | 6 ++++++ src/interfaces/api/site.ts | 12 ++++++++++++ src/interfaces/others.ts | 1 + 3 files changed, 19 insertions(+) diff --git a/src/http.ts b/src/http.ts index 4026e12..3f7b2cf 100644 --- a/src/http.ts +++ b/src/http.ts @@ -56,6 +56,8 @@ import { GetSiteConfig, GetSiteConfigResponse, GetSiteResponse, + ResolveObject, + ResolveObjectResponse, SaveSiteConfig, Search, SearchResponse, @@ -152,6 +154,10 @@ export class LemmyHttp { return this.wrapper(HttpType.Get, '/search', form); } + async resolveObject(form: ResolveObject): Promise { + return this.wrapper(HttpType.Get, '/resolve_object', form); + } + async createCommunity(form: CreateCommunity): Promise { return this.wrapper(HttpType.Post, '/community', form); } diff --git a/src/interfaces/api/site.ts b/src/interfaces/api/site.ts index 5afc6e5..9dd527e 100644 --- a/src/interfaces/api/site.ts +++ b/src/interfaces/api/site.ts @@ -128,3 +128,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 618df11..d6367f4 100644 --- a/src/interfaces/others.ts +++ b/src/interfaces/others.ts @@ -45,6 +45,7 @@ export enum UserOperation { AddAdmin, BanPerson, Search, + ResolveObject, MarkAllAsRead, SaveUserSettings, TransferCommunity,