glitch-javascript-sdk 0.2.8 → 0.3.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.
- package/dist/cjs/index.js +26 -5
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/api/Communities.d.ts +10 -0
- package/dist/esm/index.js +26 -5
- package/dist/esm/index.js.map +1 -1
- package/dist/index.d.ts +10 -0
- package/package.json +1 -1
- package/src/api/Communities.ts +18 -3
- package/src/routes/CommunitiesRoute.ts +1 -0
- package/src/util/Storage.ts +26 -5
package/dist/cjs/index.js
CHANGED
|
@@ -16626,6 +16626,7 @@ var CommunitiesRoute = /** @class */ (function () {
|
|
|
16626
16626
|
showUser: { url: '/communities/{community_id}/users/{user_id}', method: HTTP_METHODS.GET },
|
|
16627
16627
|
updateUser: { url: '/communities/{community_id}/users/{user_id}', method: HTTP_METHODS.PUT },
|
|
16628
16628
|
removeUser: { url: '/communities/{community_id}/users/{user_id}', method: HTTP_METHODS.DELETE },
|
|
16629
|
+
join: { url: '/communities/{community_id}/join', method: HTTP_METHODS.POST },
|
|
16629
16630
|
findByDomain: { url: '/communities/findByDomain/{domain}', method: HTTP_METHODS.GET }
|
|
16630
16631
|
};
|
|
16631
16632
|
return CommunitiesRoute;
|
|
@@ -16884,6 +16885,18 @@ var Communities = /** @class */ (function () {
|
|
|
16884
16885
|
Communities.findByDomain = function (domain, params) {
|
|
16885
16886
|
return Requests.processRoute(CommunitiesRoute.routes.findByDomain, {}, { domain: domain }, params);
|
|
16886
16887
|
};
|
|
16888
|
+
/**
|
|
16889
|
+
* Has a user join a community. The join is executed using the current user's authentication token.
|
|
16890
|
+
*
|
|
16891
|
+
* @see https://api.glitch.fun/api/documentation#/Community%20Route/updateCommunityStorage
|
|
16892
|
+
*
|
|
16893
|
+
* @param community_id The id of the community to update.
|
|
16894
|
+
*
|
|
16895
|
+
* @returns promise
|
|
16896
|
+
*/
|
|
16897
|
+
Communities.join = function (community_id, data, params) {
|
|
16898
|
+
return Requests.processRoute(CommunitiesRoute.routes.join, data, { community_id: community_id }, params);
|
|
16899
|
+
};
|
|
16887
16900
|
return Communities;
|
|
16888
16901
|
}());
|
|
16889
16902
|
|
|
@@ -17871,26 +17884,34 @@ var Storage = /** @class */ (function () {
|
|
|
17871
17884
|
}
|
|
17872
17885
|
Storage.set = function (key, value) {
|
|
17873
17886
|
try {
|
|
17874
|
-
|
|
17887
|
+
var serializedValue = JSON.stringify(value);
|
|
17888
|
+
window.localStorage.setItem(key, serializedValue);
|
|
17875
17889
|
}
|
|
17876
17890
|
catch (e) {
|
|
17877
17891
|
try {
|
|
17878
|
-
|
|
17892
|
+
var serializedValue = JSON.stringify(value);
|
|
17893
|
+
window.sessionStorage.setItem(key, serializedValue);
|
|
17879
17894
|
}
|
|
17880
17895
|
catch (e) {
|
|
17896
|
+
//fallback
|
|
17881
17897
|
this.setCookie(key, value, 31);
|
|
17882
|
-
//fallback if set cookie fails
|
|
17883
17898
|
Storage.data[key] = value;
|
|
17884
17899
|
}
|
|
17885
17900
|
}
|
|
17886
17901
|
};
|
|
17887
17902
|
Storage.get = function (key) {
|
|
17888
17903
|
try {
|
|
17889
|
-
|
|
17904
|
+
var serializedValue = window.localStorage.getItem(key);
|
|
17905
|
+
if (serializedValue !== null) {
|
|
17906
|
+
return JSON.parse(serializedValue);
|
|
17907
|
+
}
|
|
17890
17908
|
}
|
|
17891
17909
|
catch (e) {
|
|
17892
17910
|
try {
|
|
17893
|
-
|
|
17911
|
+
var serializedValue = window.sessionStorage.getItem(key);
|
|
17912
|
+
if (serializedValue !== null) {
|
|
17913
|
+
return JSON.parse(serializedValue);
|
|
17914
|
+
}
|
|
17894
17915
|
}
|
|
17895
17916
|
catch (e) {
|
|
17896
17917
|
var value = Storage.getCookie(key);
|