UNPKG

@artilleryio/platform-fargate

Version:
1 lines 897 B
"use strict";module.exports=createClient;const request=require("got"),debug=require("debug")("pro-api"),path=require("path"),CONFIG=require("../config.json");function createClient(apiBase){return new ArtilleryCloudClient(apiBase||CONFIG.apiBase)}function ArtilleryCloudClient(baseUrl){return this.ENDPOINTS={getStateToken:baseUrl+"/activate/stateToken",getActivationToken:baseUrl+"/activate/activationToken",requestLicenseKey:baseUrl+"/activate/requestLicenseKey",refreshLicenseToken:baseUrl+"/refresh-license-token"},this}ArtilleryCloudClient.prototype.requestLicenseKey=async function(params){debug("Requesting license key to "+params.email);try{var res=await request(this.ENDPOINTS.requestLicenseKey,{searchParams:{email:params.email}});return 202===res.statusCode||(debug("requestLicenseKey not accepted; status: "+res.statusCode),!1)}catch(err){if("HTTPError"===err.name)return!1;throw err}};