glitch-javascript-sdk 2.8.4 → 2.8.6

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/index.d.ts CHANGED
@@ -26,12 +26,20 @@ declare class Config {
26
26
  * @param lock If set to true, will lock the baseUrl so it cannot be changed
27
27
  */
28
28
  static setBaseUrl(baseUrl: string, lock?: boolean): void;
29
+ /**
30
+ * Gets the base URL
31
+ */
32
+ static getBaseUrl(): string;
29
33
  /**
30
34
  * Set the JSON Web Token (JWT) that will be passed to the API
31
35
  *
32
36
  * @param authToken The JWT
33
37
  */
34
38
  static setAuthToken(authToken: string): void;
39
+ /**
40
+ * Gets the auth token
41
+ */
42
+ static getAuthToken(): string;
35
43
  /**
36
44
  * Set the community to be associated with this config through
37
45
  *
@@ -45,6 +53,9 @@ declare class Config {
45
53
  * @param domain The domain ie: example.com
46
54
  */
47
55
  static setRootDomain(domain: string): void;
56
+ /**
57
+ * Gets the root domain
58
+ */
48
59
  static getRootDomain(): string;
49
60
  /**
50
61
  * Gets base url
@@ -58,6 +69,10 @@ declare class Config {
58
69
  * Gets the community currently associated
59
70
  */
60
71
  static get getCommunity(): object;
72
+ /**
73
+ * Checks if the base URL is locked
74
+ */
75
+ static isBaseUrlLocked(): boolean;
61
76
  }
62
77
 
63
78
  interface Response<T> {
@@ -4314,6 +4329,18 @@ declare class Titles {
4314
4329
  * @param title_id The UUID of the title.
4315
4330
  */
4316
4331
  static listBuilds<T>(title_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
4332
+ /**
4333
+ * List all cloud save slots for the player associated with this install.
4334
+ */
4335
+ static listSaves<T>(title_id: string, install_id: string): AxiosPromise<Response<T>>;
4336
+ /**
4337
+ * Upload game progress. The user is identified by the install_id.
4338
+ */
4339
+ static storeSave<T>(title_id: string, install_id: string, data: object): AxiosPromise<Response<T>>;
4340
+ /**
4341
+ * Resolve a conflict.
4342
+ */
4343
+ static resolveSaveConflict<T>(title_id: string, install_id: string, save_id: string, conflict_id: string, choice: 'keep_server' | 'use_client'): AxiosPromise<Response<T>>;
4317
4344
  }
4318
4345
 
4319
4346
  declare class Campaigns {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "glitch-javascript-sdk",
3
- "version": "2.8.4",
3
+ "version": "2.8.6",
4
4
  "description": "Javascript SDK for Glitch",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
package/src/api/Titles.ts CHANGED
@@ -1001,9 +1001,30 @@ class Titles {
1001
1001
  * List all builds/deployments for a specific title.
1002
1002
  * @param title_id The UUID of the title.
1003
1003
  */
1004
- public static listBuilds<T>(title_id: string, params?: Record<string, any>): AxiosPromise<Response<T>> {
1005
- return Requests.processRoute(TitlesRoute.routes.listBuilds, {}, { title_id }, params);
1006
- }
1004
+ public static listBuilds<T>(title_id: string, params?: Record<string, any>): AxiosPromise<Response<T>> {
1005
+ return Requests.processRoute(TitlesRoute.routes.listBuilds, {}, { title_id }, params);
1006
+ }
1007
+
1008
+ /**
1009
+ * List all cloud save slots for the player associated with this install.
1010
+ */
1011
+ public static listSaves<T>(title_id: string, install_id: string): AxiosPromise<Response<T>> {
1012
+ return Requests.processRoute(TitlesRoute.routes.listSaves, {}, { title_id, install_id });
1013
+ }
1014
+
1015
+ /**
1016
+ * Upload game progress. The user is identified by the install_id.
1017
+ */
1018
+ public static storeSave<T>(title_id: string, install_id: string, data: object): AxiosPromise<Response<T>> {
1019
+ return Requests.processRoute(TitlesRoute.routes.storeSave, data, { title_id, install_id });
1020
+ }
1021
+
1022
+ /**
1023
+ * Resolve a conflict.
1024
+ */
1025
+ public static resolveSaveConflict<T>(title_id: string, install_id: string, save_id: string, conflict_id: string, choice: 'keep_server' | 'use_client'): AxiosPromise<Response<T>> {
1026
+ return Requests.processRoute(TitlesRoute.routes.resolveSaveConflict, { conflict_id, choice }, { title_id, install_id, save_id });
1027
+ }
1007
1028
  }
1008
1029
 
1009
1030
  export default Titles;
@@ -53,6 +53,13 @@ class Config {
53
53
  }
54
54
  }
55
55
 
56
+ /**
57
+ * Gets the base URL
58
+ */
59
+ public static getBaseUrl(): string {
60
+ return Config._baseUrl;
61
+ }
62
+
56
63
  /**
57
64
  * Set the JSON Web Token (JWT) that will be passed to the API
58
65
  *
@@ -64,6 +71,16 @@ class Config {
64
71
  Requests.setAuthToken(authToken);
65
72
  }
66
73
 
74
+
75
+ /**
76
+ * Gets the auth token
77
+ */
78
+ public static getAuthToken(): string {
79
+ return Config._authToken;
80
+ }
81
+
82
+
83
+
67
84
  /**
68
85
  * Set the community to be associated with this config through
69
86
  *
@@ -77,6 +94,7 @@ class Config {
77
94
  LabelManager.initialize(community);
78
95
  }
79
96
 
97
+
80
98
  /**
81
99
  * Sets the root level domain so data can be accessed across
82
100
  * multiple subdomains
@@ -95,13 +113,16 @@ class Config {
95
113
 
96
114
  // REMOVE THIS LINE: formattedDomain = formattedDomain.replace(/^\./, '');
97
115
  // We WANT the dot.
98
-
116
+
99
117
  this._rootDomain = formattedDomain;
100
118
 
101
119
  Storage.setRootDomain(formattedDomain);
102
120
  }
103
121
 
104
- public static getRootDomain() {
122
+ /**
123
+ * Gets the root domain
124
+ */
125
+ public static getRootDomain(): string {
105
126
  return this._rootDomain;
106
127
  }
107
128
 
@@ -125,6 +146,13 @@ class Config {
125
146
  public static get getCommunity(): object {
126
147
  return Config._community;
127
148
  }
149
+
150
+ /**
151
+ * Checks if the base URL is locked
152
+ */
153
+ public static isBaseUrlLocked(): boolean {
154
+ return this._baseUrlLocked;
155
+ }
128
156
  }
129
157
 
130
158
  export default Config;
@@ -201,6 +201,10 @@ class TitlesRoute {
201
201
 
202
202
  listBuilds: { url: '/titles/{title_id}/deployments', method: HTTP_METHODS.GET },
203
203
 
204
+ listSaves: { url: '/titles/{title_id}/installs/{install_id}/saves', method: HTTP_METHODS.GET },
205
+ storeSave: { url: '/titles/{title_id}/installs/{install_id}/saves', method: HTTP_METHODS.POST },
206
+ resolveSaveConflict: { url: '/titles/{title_id}/installs/{install_id}/saves/{save_id}/resolve', method: HTTP_METHODS.POST },
207
+
204
208
 
205
209
  };
206
210