import { BaseService, BaseServiceOptions } from '../../api/services/base-service'; import { BitDocument } from '../interfaces'; import { AddDocumentRequest, EditDocumentRequest, ListDocumentsRequest } from './documents.service.interfaces'; export type DocumentsServiceOptions = BaseServiceOptions & { profileApiUrl: string }; export class DocumentsService extends BaseService { private profileApiUrl: string; constructor(opts: DocumentsServiceOptions) { super(opts); this.profileApiUrl = opts.profileApiUrl; } listDocuments(profileId: string, req: ListDocumentsRequest) { return this.get(`${this.profileApiUrl}/${profileId}/documents`, req); } addDocument(profileId: string, req: AddDocumentRequest) { return this.post(`${this.profileApiUrl}/${profileId}/documents`, req); } getDocumentById(profileId: string, docId: string) { return this.get(`${this.profileApiUrl}/${profileId}/documents/${docId}`); } editDocument(profileId: string, docId: string, req: EditDocumentRequest) { return this.put(`${this.profileApiUrl}/${profileId}/documents/${docId}`, req); } removeDocument(profileId: string, docId: string) { return this.delete(`${this.profileApiUrl}/${profileId}/documents/${docId}`); } }