@capawesome/cli
Version:
The Capawesome Cloud Command Line Interface (CLI) to manage Live Updates and more.
34 lines (33 loc) • 1.23 kB
JavaScript
import httpClient from '../utils/http-client.js';
import authorizationService from '../services/authorization-service.js';
class AppBundlesServiceImpl {
httpClient;
constructor(httpClient) {
this.httpClient = httpClient;
}
async create(dto) {
const response = await this.httpClient.post(`/v1/apps/${dto.appId}/bundles`, dto, {
headers: {
Authorization: `Bearer ${authorizationService.getCurrentAuthorizationToken()}`,
},
});
return response.data;
}
async update(dto) {
const response = await this.httpClient.patch(`/v1/apps/${dto.appId}/bundles/${dto.appBundleId}`, dto, {
headers: {
Authorization: `Bearer ${authorizationService.getCurrentAuthorizationToken()}`,
},
});
return response.data;
}
async delete(dto) {
await this.httpClient.delete(`/v1/apps/${dto.appId}/bundles/${dto.appBundleId}`, {
headers: {
Authorization: `Bearer ${authorizationService.getCurrentAuthorizationToken()}`,
},
});
}
}
const appBundlesService = new AppBundlesServiceImpl(httpClient);
export default appBundlesService;