diff --git a/src/webapp/api-client/ApiClient.ts b/src/webapp/api-client/ApiClient.ts index b530427e..a8b63d4c 100644 --- a/src/webapp/api-client/ApiClient.ts +++ b/src/webapp/api-client/ApiClient.ts @@ -57,6 +57,8 @@ import type { GetUrlCardsResponse, GetProfileResponse, GetProfileParams, + GetUrlStatusForMyLibraryParams, + GetUrlStatusForMyLibraryResponse, } from './types'; // Main API Client class using composition @@ -152,6 +154,13 @@ export class ApiClient { return this.queryClient.getUserCollections(params); } + async getUrlStatusForMyLibrary( + params: GetUrlStatusForMyLibraryParams, + ): Promise { + this.requireAuthentication('getUrlStatusForMyLibrary'); + return this.queryClient.getUrlStatusForMyLibrary(params); + } + // Card operations - delegate to CardClient (all require authentication) async addUrlToLibrary( request: AddUrlToLibraryRequest, diff --git a/src/webapp/api-client/clients/QueryClient.ts b/src/webapp/api-client/clients/QueryClient.ts index 5a21f258..26074da1 100644 --- a/src/webapp/api-client/clients/QueryClient.ts +++ b/src/webapp/api-client/clients/QueryClient.ts @@ -7,6 +7,7 @@ import { GetProfileResponse, GetCollectionPageResponse, GetCollectionsResponse, + GetUrlStatusForMyLibraryResponse, GetMyUrlCardsParams, GetUrlCardsParams, GetCollectionPageParams, @@ -14,6 +15,7 @@ import { GetCollectionsParams, GetCollectionPageByAtUriParams, GetProfileParams, + GetUrlStatusForMyLibraryParams, } from '../types'; export class QueryClient extends BaseClient { @@ -157,4 +159,14 @@ export class QueryClient extends BaseClient { return this.request('GET', endpoint); } + + async getUrlStatusForMyLibrary( + params: GetUrlStatusForMyLibraryParams, + ): Promise { + const searchParams = new URLSearchParams({ url: params.url }); + return this.request( + 'GET', + `/api/cards/library/status?${searchParams}`, + ); + } } diff --git a/src/webapp/api-client/types/requests.ts b/src/webapp/api-client/types/requests.ts index 17821ec9..2c6b9789 100644 --- a/src/webapp/api-client/types/requests.ts +++ b/src/webapp/api-client/types/requests.ts @@ -127,3 +127,7 @@ export interface GenerateExtensionTokensRequest { export interface GetProfileParams { identifier: string; // Can be DID or handle } + +export interface GetUrlStatusForMyLibraryParams { + url: string; +} diff --git a/src/webapp/api-client/types/responses.ts b/src/webapp/api-client/types/responses.ts index 1e76e84e..0b088d07 100644 --- a/src/webapp/api-client/types/responses.ts +++ b/src/webapp/api-client/types/responses.ts @@ -297,3 +297,13 @@ export interface GetGlobalFeedResponse { nextCursor?: string; }; } + +export interface GetUrlStatusForMyLibraryResponse { + cardId?: string; + collections?: { + id: string; + uri?: string; + name: string; + description?: string; + }[]; +}