xsolla
Version:
A Node.js client for working with the Xsolla Merchant API
53 lines (52 loc) • 1.3 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const axios_1 = __importDefault(require("axios"));
class XsollaClient {
/**
* Xsolla Client constructor
*/
constructor(credentials) {
this.credentials = credentials;
this.client = axios_1.default.create({
baseURL: `https://api.xsolla.com/merchant/v2/`,
auth: {
username: credentials.merchantId.toString(),
password: credentials.apiKey,
}
});
}
/**
* Merchant ID for the current client.
*/
get merchantId() {
return this.credentials.merchantId;
}
/**
* Client get() method.
*/
get get() {
return this.client.get;
}
/**
* Client put() method.
*/
get put() {
return this.client.put;
}
/**
* Client post() method.
*/
get post() {
return this.client.post;
}
/**
* Client request() method.
*/
get request() {
return this.client.request;
}
}
exports.default = XsollaClient;