Something went wrong. Try again.
A social knowledge tool for research trails, built on ATProto semble.so
research-tool social-network tools-for-thought atproto
Something went wrong. Try again.
2.1 kB · 78 lines
TypeScript
at development
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879import { BaseClient } from './BaseClient';import { AddUrlToLibraryRequest, AddUrlToLibraryResponse, AddCardToLibraryRequest, AddCardToLibraryResponse, AddCardToCollectionRequest, AddCardToCollectionResponse, UpdateNoteCardRequest, UpdateNoteCardResponse, RemoveCardFromLibraryRequest, RemoveCardFromLibraryResponse, RemoveCardFromCollectionRequest, RemoveCardFromCollectionResponse,} from '../types';
export class CardClient extends BaseClient { async addUrlToLibrary( request: AddUrlToLibraryRequest, ): Promise<AddUrlToLibraryResponse> { return this.request<AddUrlToLibraryResponse>( 'POST', '/api/cards/library/urls', request, ); }
async addCardToLibrary( request: AddCardToLibraryRequest, ): Promise<AddCardToLibraryResponse> { return this.request<AddCardToLibraryResponse>( 'POST', '/api/cards/library', request, ); }
async addCardToCollection( request: AddCardToCollectionRequest, ): Promise<AddCardToCollectionResponse> { return this.request<AddCardToCollectionResponse>( 'POST', '/api/cards/collections', request, ); }
async updateNoteCard( request: UpdateNoteCardRequest, ): Promise<UpdateNoteCardResponse> { return this.request<UpdateNoteCardResponse>( 'PUT', `/api/cards/${request.cardId}/note`, { note: request.note, }, ); }
async removeCardFromLibrary( request: RemoveCardFromLibraryRequest, ): Promise<RemoveCardFromLibraryResponse> { return this.request<RemoveCardFromLibraryResponse>( 'DELETE', `/api/cards/${request.cardId}/library`, ); }
async removeCardFromCollection( request: RemoveCardFromCollectionRequest, ): Promise<RemoveCardFromCollectionResponse> { const collectionIdsParam = request.collectionIds.join(','); return this.request<RemoveCardFromCollectionResponse>( 'DELETE', `/api/cards/${request.cardId}/collections?collectionIds=${encodeURIComponent(collectionIdsParam)}`, ); }}