ggez-banking-sdk
Version:
A Node.js package to handle GGEZ Banking API endpoints, Simplify the process of managing CRUD operations with this efficient and easy-to-use package.
62 lines (61 loc) • 1.45 kB
JavaScript
import { GeoHelper } from "../../helper/geoHelper";
class DefaultClientContextProvider {
baseUrl;
nodeUrl;
programId;
lang;
installationId;
token;
userId;
geoHelper;
constructor(init) {
this.baseUrl = init.baseUrl;
this.nodeUrl = init.nodeUrl;
this.programId = init.programId;
this.lang = init.lang ?? "en";
this.installationId = init.installationId ?? "";
this.token = init.token ?? "";
this.userId = init.userId ?? 0;
this.geoHelper = new GeoHelper(init.baseUrl);
}
getGeoHelper() {
return this.geoHelper;
}
getBaseUrl() {
return this.baseUrl;
}
getNodeUrl() {
return this.nodeUrl;
}
getProgramId() {
return Number(this.programId);
}
getLang() {
return ((typeof window !== "undefined" &&
window.localStorage.getItem("i18next")) ||
this.lang ||
"en");
}
setLang(lang) {
this.lang = lang;
}
getInstallationId() {
return this.installationId;
}
setInstallationId(installationId) {
this.installationId = installationId;
}
getToken() {
return this.token;
}
setToken(token) {
this.token = token;
}
getUserId() {
return this.userId;
}
setUserId(userId) {
this.userId = userId;
}
}
export { DefaultClientContextProvider };