import { BaseService, BaseServiceOptions } from '../api/services/base-service'; import { UpdateLocationPrivacyRequest } from '../asset'; import { PagedRequest, PagedResponse, UpdateAttachmentResponse, ViewAttachmentResponse, createQueryParams, } from '../common'; import { CreateCheckInEventRequest, GetCheckInEventsRequest, UpdateCheckInAttachmentRequest, } from './check-in-service.interfaces'; import { CheckInEvent } from './interfaces'; export class CheckInService extends BaseService { checkinApiUrl: string; constructor(opts: BaseServiceOptions) { super(opts); this.checkinApiUrl = `${this.coreApiUrl}/v1/checkin`; } createCheckIn(req: CreateCheckInEventRequest) { return this.post(this.checkinApiUrl, req); } getEvent(eventId: string) { return this.get(`${this.checkinApiUrl}/${eventId}`); } getCheckInEvents(req?: PagedRequest) { return this.get, PagedRequest>( this.checkinApiUrl + `?${createQueryParams(req)}` ); } updateAttachment(req: UpdateCheckInAttachmentRequest) { return this.put( `${this.checkinApiUrl}/${req.eventId}/attachments`, req ); } getAttachmentImage(attId: string, thumb?: boolean) { const query = createQueryParams({ id: attId, thumb: thumb ? 'true' : undefined }); return this.get(`${this.checkinApiUrl}/attachments/view?${query}`); } updateLocationPrivacy(eventId: string, req: UpdateLocationPrivacyRequest) { return this.patch(`${this.checkinApiUrl}/${eventId}/privacy`, req); } }