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
|
@@ -205,5 +205,15 @@ declare class Communities {
|
|
|
205
205
|
* @returns promise
|
|
206
206
|
*/
|
|
207
207
|
static findByDomain<T>(domain: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
208
|
+
/**
|
|
209
|
+
* Has a user join a community. The join is executed using the current user's authentication token.
|
|
210
|
+
*
|
|
211
|
+
* @see https://api.glitch.fun/api/documentation#/Community%20Route/updateCommunityStorage
|
|
212
|
+
*
|
|
213
|
+
* @param community_id The id of the community to update.
|
|
214
|
+
*
|
|
215
|
+
* @returns promise
|
|
216
|
+
*/
|
|
217
|
+
static join<T>(community_id: string, data: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
208
218
|
}
|
|
209
219
|
export default Communities;
|
package/dist/esm/index.js
CHANGED
|
@@ -30848,6 +30848,7 @@ var CommunitiesRoute = /** @class */ (function () {
|
|
|
30848
30848
|
showUser: { url: '/communities/{community_id}/users/{user_id}', method: HTTP_METHODS.GET },
|
|
30849
30849
|
updateUser: { url: '/communities/{community_id}/users/{user_id}', method: HTTP_METHODS.PUT },
|
|
30850
30850
|
removeUser: { url: '/communities/{community_id}/users/{user_id}', method: HTTP_METHODS.DELETE },
|
|
30851
|
+
join: { url: '/communities/{community_id}/join', method: HTTP_METHODS.POST },
|
|
30851
30852
|
findByDomain: { url: '/communities/findByDomain/{domain}', method: HTTP_METHODS.GET }
|
|
30852
30853
|
};
|
|
30853
30854
|
return CommunitiesRoute;
|
|
@@ -31106,6 +31107,18 @@ var Communities = /** @class */ (function () {
|
|
|
31106
31107
|
Communities.findByDomain = function (domain, params) {
|
|
31107
31108
|
return Requests.processRoute(CommunitiesRoute.routes.findByDomain, {}, { domain: domain }, params);
|
|
31108
31109
|
};
|
|
31110
|
+
/**
|
|
31111
|
+
* Has a user join a community. The join is executed using the current user's authentication token.
|
|
31112
|
+
*
|
|
31113
|
+
* @see https://api.glitch.fun/api/documentation#/Community%20Route/updateCommunityStorage
|
|
31114
|
+
*
|
|
31115
|
+
* @param community_id The id of the community to update.
|
|
31116
|
+
*
|
|
31117
|
+
* @returns promise
|
|
31118
|
+
*/
|
|
31119
|
+
Communities.join = function (community_id, data, params) {
|
|
31120
|
+
return Requests.processRoute(CommunitiesRoute.routes.join, data, { community_id: community_id }, params);
|
|
31121
|
+
};
|
|
31109
31122
|
return Communities;
|
|
31110
31123
|
}());
|
|
31111
31124
|
|
|
@@ -32093,26 +32106,34 @@ var Storage = /** @class */ (function () {
|
|
|
32093
32106
|
}
|
|
32094
32107
|
Storage.set = function (key, value) {
|
|
32095
32108
|
try {
|
|
32096
|
-
|
|
32109
|
+
var serializedValue = JSON.stringify(value);
|
|
32110
|
+
window.localStorage.setItem(key, serializedValue);
|
|
32097
32111
|
}
|
|
32098
32112
|
catch (e) {
|
|
32099
32113
|
try {
|
|
32100
|
-
|
|
32114
|
+
var serializedValue = JSON.stringify(value);
|
|
32115
|
+
window.sessionStorage.setItem(key, serializedValue);
|
|
32101
32116
|
}
|
|
32102
32117
|
catch (e) {
|
|
32118
|
+
//fallback
|
|
32103
32119
|
this.setCookie(key, value, 31);
|
|
32104
|
-
//fallback if set cookie fails
|
|
32105
32120
|
Storage.data[key] = value;
|
|
32106
32121
|
}
|
|
32107
32122
|
}
|
|
32108
32123
|
};
|
|
32109
32124
|
Storage.get = function (key) {
|
|
32110
32125
|
try {
|
|
32111
|
-
|
|
32126
|
+
var serializedValue = window.localStorage.getItem(key);
|
|
32127
|
+
if (serializedValue !== null) {
|
|
32128
|
+
return JSON.parse(serializedValue);
|
|
32129
|
+
}
|
|
32112
32130
|
}
|
|
32113
32131
|
catch (e) {
|
|
32114
32132
|
try {
|
|
32115
|
-
|
|
32133
|
+
var serializedValue = window.sessionStorage.getItem(key);
|
|
32134
|
+
if (serializedValue !== null) {
|
|
32135
|
+
return JSON.parse(serializedValue);
|
|
32136
|
+
}
|
|
32116
32137
|
}
|
|
32117
32138
|
catch (e) {
|
|
32118
32139
|
var value = Storage.getCookie(key);
|