@cobaltio/cobalt-js 5.0.0 → 5.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/cobalt.js +22 -2
  2. package/package.json +1 -1
package/cobalt.js CHANGED
@@ -74,6 +74,26 @@ class Cobalt {
74
74
  return this.sessionToken = typeof token === "string" ? token : "";
75
75
  };
76
76
 
77
+ /**
78
+ * Returns the org & customer details for the associated token.
79
+ * @private
80
+ * @returns {Promise<unknown>}
81
+ */
82
+ async getAccountDetails() {
83
+ const res = await fetch(`${this.baseUrl}/api/v3/org/basics`, {
84
+ headers: {
85
+ authorization: `Bearer ${this.token}`,
86
+ },
87
+ });
88
+
89
+ if (res.status >= 400 && res.status < 600) {
90
+ throw new Error(res.statusText);
91
+ }
92
+
93
+ const data = await res.json();
94
+ return data;
95
+ }
96
+
77
97
  /**
78
98
  * Returns the application details for the specified application, provided
79
99
  * the application is enabled in Cobalt. If no application is specified,
@@ -218,8 +238,8 @@ class Cobalt {
218
238
  * @param {ConfigPayload} [payload] The payload object for config.
219
239
  * @returns {Promise<Config>} The specified config.
220
240
  */
221
- async config(slug, configId, payload) {
222
- const res = await fetch(`${this.baseUrl}/api/v2/application/${slug}/installation/${configId ? configId : ""}`, {
241
+ async config(slug, payload) {
242
+ const res = await fetch(`${this.baseUrl}/api/v2/application/${slug}/installation`, {
223
243
  method: "POST",
224
244
  headers: {
225
245
  authorization: `Bearer ${this.token}`,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cobaltio/cobalt-js",
3
- "version": "5.0.0",
3
+ "version": "5.1.0",
4
4
  "description": "Cobalt frontend SDK",
5
5
  "main": "./cobalt.js",
6
6
  "scripts": {