UNPKG

@capawesome/cli

Version:

The Capawesome Cloud Command Line Interface (CLI) to manage Live Updates and more.

33 lines (32 loc) 1.07 kB
import authorizationService from '../services/authorization-service.js'; import httpClient from '../utils/http-client.js'; class JobsServiceImpl { httpClient; constructor(httpClient) { this.httpClient = httpClient; } async findOne(dto) { const params = {}; if (dto.relations) { params.relations = dto.relations; } const response = await this.httpClient.get(`/v1/jobs/${dto.jobId}`, { headers: { Authorization: `Bearer ${authorizationService.getCurrentAuthorizationToken()}`, }, params, }); return response.data; } async update(options) { const { jobId, dto } = options; const response = await this.httpClient.patch(`/v1/jobs/${jobId}`, dto, { headers: { Authorization: `Bearer ${authorizationService.getCurrentAuthorizationToken()}`, }, }); return response.data; } } const jobsService = new JobsServiceImpl(httpClient); export default jobsService;