UNPKG

selva-riskeval

Version:

Testing One MGA sdk creation

60 lines (59 loc) 1.52 kB
import axios from "axios"; export default class InsuranceProduct { apiKey; baseURL = 'https://lf99je7gbk.execute-api.us-west-2.amazonaws.com/'; constructor(apiKey) { this.apiKey = apiKey; } async createProduct(data) { try { let response = await axios.post(this.baseURL + 'product', data); return response.data['_id']; } catch (err) { throw Error(err.message); } } async getProducts() { try { return await axios.get(this.baseURL + 'product'); } catch (err) { throw Error(err.message); } } async getProductById(id) { try { return await axios.get(this.baseURL + 'product' + '/' + id); } catch (err) { throw Error(err.message); } } async createService(data) { try { let response = await axios.post(this.baseURL + 'product', data); return response.data['_id']; } catch (err) { throw Error(err.message); } } async getServiceById(id) { try { return await axios.get(this.baseURL + 'service' + '/' + id); } catch (err) { throw Error(err.message); } } async getServices() { try { return await axios.get(this.baseURL + 'service'); } catch (err) { throw Error(err.message); } } } // export {RiskEval}