async-playfab-web-sdk 1.192.250526

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 (71) hide show
  1. package/dist/Addon.d.mts +591 -0
  2. package/dist/Addon.js.map +1 -0
  3. package/dist/Addon.mjs +452 -0
  4. package/dist/Addon.mjs.map +1 -0
  5. package/dist/Admin.d.mts +3484 -0
  6. package/dist/Admin.js.map +1 -0
  7. package/dist/Admin.mjs +1112 -0
  8. package/dist/Admin.mjs.map +1 -0
  9. package/dist/Authentication.d.mts +109 -0
  10. package/dist/Authentication.js.map +1 -0
  11. package/dist/Authentication.mjs +290 -0
  12. package/dist/Authentication.mjs.map +1 -0
  13. package/dist/Client.d.mts +4482 -0
  14. package/dist/Client.js.map +1 -0
  15. package/dist/Client.mjs +1893 -0
  16. package/dist/Client.mjs.map +1 -0
  17. package/dist/CloudScript.d.mts +511 -0
  18. package/dist/CloudScript.js.map +1 -0
  19. package/dist/CloudScript.mjs +349 -0
  20. package/dist/CloudScript.mjs.map +1 -0
  21. package/dist/Data.d.mts +228 -0
  22. package/dist/Data.js.map +1 -0
  23. package/dist/Data.mjs +291 -0
  24. package/dist/Data.mjs.map +1 -0
  25. package/dist/Economy.d.mts +1865 -0
  26. package/dist/Economy.js.map +1 -0
  27. package/dist/Economy.mjs +614 -0
  28. package/dist/Economy.mjs.map +1 -0
  29. package/dist/Events.d.mts +307 -0
  30. package/dist/Events.js.map +1 -0
  31. package/dist/Events.mjs +327 -0
  32. package/dist/Events.mjs.map +1 -0
  33. package/dist/Experimentation.d.mts +357 -0
  34. package/dist/Experimentation.js.map +1 -0
  35. package/dist/Experimentation.mjs +333 -0
  36. package/dist/Experimentation.mjs.map +1 -0
  37. package/dist/Groups.d.mts +546 -0
  38. package/dist/Groups.js.map +1 -0
  39. package/dist/Groups.mjs +417 -0
  40. package/dist/Groups.mjs.map +1 -0
  41. package/dist/Insights.d.mts +141 -0
  42. package/dist/Insights.js.map +1 -0
  43. package/dist/Insights.mjs +286 -0
  44. package/dist/Insights.mjs.map +1 -0
  45. package/dist/Localization.d.mts +20 -0
  46. package/dist/Localization.js.map +1 -0
  47. package/dist/Localization.mjs +249 -0
  48. package/dist/Localization.mjs.map +1 -0
  49. package/dist/Multiplayer.d.mts +3059 -0
  50. package/dist/Multiplayer.js.map +1 -0
  51. package/dist/Multiplayer.mjs +862 -0
  52. package/dist/Multiplayer.mjs.map +1 -0
  53. package/dist/PlayFabCommon-BUv4zqXf.d.mts +72 -0
  54. package/dist/Profiles.d.mts +278 -0
  55. package/dist/Profiles.js.map +1 -0
  56. package/dist/Profiles.mjs +306 -0
  57. package/dist/Profiles.mjs.map +1 -0
  58. package/dist/Progression.d.mts +598 -0
  59. package/dist/Progression.js.map +1 -0
  60. package/dist/Progression.mjs +404 -0
  61. package/dist/Progression.mjs.map +1 -0
  62. package/dist/Server.d.mts +3889 -0
  63. package/dist/Server.js.map +1 -0
  64. package/dist/Server.mjs +1377 -0
  65. package/dist/Server.mjs.map +1 -0
  66. package/dist/index.d.mts +17 -0
  67. package/dist/index.js.map +1 -0
  68. package/dist/index.mjs +6007 -0
  69. package/dist/index.mjs.map +1 -0
  70. package/package.json +22 -0
  71. package/readme.md +25 -0
@@ -0,0 +1,349 @@
1
+ // src/constants.ts
2
+ var AuthInfoMap = {
3
+ "X-EntityToken": {
4
+ authAttr: "entityToken",
5
+ authError: "errorEntityToken"
6
+ },
7
+ "X-Authorization": {
8
+ authAttr: "sessionTicket",
9
+ authError: "errorLoggedIn"
10
+ },
11
+ "X-SecretKey": {
12
+ authAttr: "developerSecretKey",
13
+ authError: "errorSecretKey"
14
+ }
15
+ };
16
+ var constants_default = {
17
+ sdkVersion: "1.192.250526",
18
+ sdkFingerprint: "JavaScriptSDK-1.192.250526",
19
+ buildIdentifier: "custom_async-javascriptsdk",
20
+ defaultSettings: {
21
+ titleId: "",
22
+ developerSecretKey: "",
23
+ GlobalHeaderInjection: {},
24
+ productionServerUrl: ".playfabapi.com",
25
+ verticalName: null
26
+ }
27
+ };
28
+
29
+ // src/PlayFabContext.ts
30
+ var PlayFabContext = class _PlayFabContext {
31
+ constructor() {
32
+ this.settings = constants_default.defaultSettings;
33
+ this.authenticationContext = {
34
+ PlayFabId: null,
35
+ EntityId: null,
36
+ EntityType: null,
37
+ SessionTicket: null,
38
+ EntityToken: null
39
+ };
40
+ this.sessionTicket = null;
41
+ this.entityToken = null;
42
+ }
43
+ static get instance() {
44
+ if (!_PlayFabContext._instance) {
45
+ _PlayFabContext._instance = new _PlayFabContext();
46
+ }
47
+ return _PlayFabContext._instance;
48
+ }
49
+ };
50
+
51
+ // src/PlayFabCommon.ts
52
+ var PlayFabCommon = class {
53
+ constructor(settings = void 0) {
54
+ this.buildIdentifier = constants_default.buildIdentifier;
55
+ this.requestGetParams = {
56
+ sdk: constants_default.sdkFingerprint
57
+ };
58
+ this.errorTitleId = "Must be have settings.titleId set to call this method";
59
+ this.errorLoggedIn = "Must be logged in to call this method";
60
+ this.errorEntityToken = "You must successfully call GetEntityToken before calling this";
61
+ this.errorSecretKey = "Must have settings.developerSecretKey set to call this method";
62
+ this._context = PlayFabContext.instance;
63
+ if (settings) {
64
+ Object.assign(this._context.settings, settings);
65
+ }
66
+ }
67
+ get settings() {
68
+ return this._context.settings;
69
+ }
70
+ get authenticationContext() {
71
+ return this._context.authenticationContext;
72
+ }
73
+ get sessionTicket() {
74
+ return this._context.sessionTicket;
75
+ }
76
+ set sessionTicket(value) {
77
+ this._context.sessionTicket = value;
78
+ }
79
+ get entityToken() {
80
+ return this._context.entityToken;
81
+ }
82
+ set entityToken(value) {
83
+ this._context.entityToken = value;
84
+ }
85
+ GetServerUrl() {
86
+ if (!(this.settings.productionServerUrl.substring(0, 4) === "http")) {
87
+ return `https://${this.settings.verticalName || this.settings.titleId}${this.settings.productionServerUrl}`;
88
+ } else {
89
+ return this.settings.productionServerUrl;
90
+ }
91
+ }
92
+ InjectHeaders(xhr, headersObj) {
93
+ if (!headersObj) return;
94
+ for (const headerKey in headersObj) {
95
+ try {
96
+ xhr.setRequestHeader(headerKey, headersObj[headerKey]);
97
+ } catch (e) {
98
+ console.log(
99
+ `Failed to append header: ${headerKey} = ${headersObj[headerKey]} Error: ${e}`
100
+ );
101
+ }
102
+ }
103
+ }
104
+ ExecuteRequest(url, body, authkey, authValue, customData, extraHeaders) {
105
+ return new Promise((resolve, reject) => {
106
+ if (body == null) body = {};
107
+ var startTime = (/* @__PURE__ */ new Date()).getTime();
108
+ var requestBody = JSON.stringify(body);
109
+ var urlArr = [url];
110
+ var getParams = this.requestGetParams;
111
+ if (getParams != null) {
112
+ var firstParam = true;
113
+ for (var key in getParams) {
114
+ if (firstParam) {
115
+ urlArr.push("?");
116
+ firstParam = false;
117
+ } else {
118
+ urlArr.push("&");
119
+ }
120
+ urlArr.push(key);
121
+ urlArr.push("=");
122
+ urlArr.push(getParams[key]);
123
+ }
124
+ }
125
+ var completeUrl = urlArr.join("");
126
+ var xhr = new XMLHttpRequest();
127
+ xhr.open("POST", completeUrl, true);
128
+ xhr.setRequestHeader("Content-Type", "application/json");
129
+ xhr.setRequestHeader(
130
+ "X-PlayFabSDK",
131
+ "JavaScriptSDK-" + constants_default.sdkVersion
132
+ );
133
+ if (authkey != null) {
134
+ xhr.setRequestHeader(authkey, authValue);
135
+ }
136
+ this.InjectHeaders(xhr, this.settings.GlobalHeaderInjection);
137
+ this.InjectHeaders(xhr, extraHeaders);
138
+ xhr.onloadend = () => {
139
+ var result = this.GetPlayFabResponse(body, xhr, startTime, customData);
140
+ if (result.code === 200) {
141
+ resolve(result.data || result);
142
+ } else {
143
+ reject(result);
144
+ }
145
+ };
146
+ xhr.onerror = () => {
147
+ var result = this.GetPlayFabResponse(body, xhr, startTime, customData);
148
+ reject(result);
149
+ };
150
+ xhr.send(requestBody);
151
+ });
152
+ }
153
+ GetPlayFabResponse(request, xhr, startTime, customData) {
154
+ var result = null;
155
+ try {
156
+ result = JSON.parse(xhr.responseText);
157
+ } catch (e) {
158
+ result = {
159
+ code: 503,
160
+ // Service Unavailable
161
+ status: "Service Unavailable",
162
+ error: "Connection error",
163
+ errorCode: 2,
164
+ // PlayFabErrorCode.ConnectionError
165
+ errorMessage: xhr.responseText
166
+ };
167
+ }
168
+ result.CallBackTimeMS = (/* @__PURE__ */ new Date()).getTime() - startTime;
169
+ result.Request = request;
170
+ result.CustomData = customData;
171
+ return result;
172
+ }
173
+ UpdateAuthenticationContext(currentAuthContext, result) {
174
+ var authenticationContextUpdates = {};
175
+ if (result == null ? void 0 : result.PlayFabId) {
176
+ authenticationContextUpdates.PlayFabId = result.PlayFabId;
177
+ }
178
+ if (result == null ? void 0 : result.SessionTicket) {
179
+ authenticationContextUpdates.SessionTicket = result.SessionTicket;
180
+ }
181
+ if (result == null ? void 0 : result.EntityToken) {
182
+ authenticationContextUpdates.EntityId = result.EntityToken.Entity.Id;
183
+ authenticationContextUpdates.EntityType = result.EntityToken.Entity.Type;
184
+ authenticationContextUpdates.EntityToken = result.EntityToken.EntityToken;
185
+ }
186
+ currentAuthContext = Object.assign(
187
+ currentAuthContext,
188
+ authenticationContextUpdates
189
+ );
190
+ this._context.authenticationContext = currentAuthContext;
191
+ return currentAuthContext;
192
+ }
193
+ GetAuthInfo(request, authKey) {
194
+ var authError = AuthInfoMap[authKey].authError;
195
+ var authAttr = AuthInfoMap[authKey].authAttr;
196
+ var defaultAuthValue = null;
197
+ if (authAttr === "entityToken") defaultAuthValue = this.entityToken;
198
+ else if (authAttr === "sessionTicket")
199
+ defaultAuthValue = this.sessionTicket;
200
+ else if (authAttr === "developerSecretKey")
201
+ defaultAuthValue = this.settings.developerSecretKey;
202
+ var authValue = request.AuthenticationContext ? request.AuthenticationContext[authAttr] : defaultAuthValue;
203
+ return { authKey, authValue, authError };
204
+ }
205
+ ExecuteRequestWrapper(apiURL, request, authKey, customData, extraHeaders) {
206
+ var authValue = null;
207
+ if (authKey !== null) {
208
+ const { authError, ...authInfo } = this.GetAuthInfo(request, authKey);
209
+ authKey = authInfo.authKey;
210
+ authValue = authInfo.authValue;
211
+ if (!authValue) throw authError;
212
+ }
213
+ return this.ExecuteRequest(
214
+ this.GetServerUrl() + apiURL,
215
+ request,
216
+ authKey,
217
+ authValue,
218
+ customData,
219
+ extraHeaders
220
+ );
221
+ }
222
+ GenerateErrorReport(error) {
223
+ if (error == null) return "";
224
+ var fullErrors = error.errorMessage;
225
+ for (var paramName in error.errorDetails)
226
+ for (var msgIdx in error.errorDetails[paramName])
227
+ fullErrors += "\n" + paramName + ": " + error.errorDetails[paramName][msgIdx];
228
+ return fullErrors;
229
+ }
230
+ ForgetAllCredentials() {
231
+ this._context.sessionTicket = null;
232
+ this._context.entityToken = null;
233
+ }
234
+ };
235
+
236
+ // src/apis/PlayFabCloudScriptApi.ts
237
+ var PlayFabCloudScriptApi = class extends PlayFabCommon {
238
+ /**
239
+ * Cloud Script is one of PlayFab's most versatile features. It allows client code to request execution of any kind of
240
+ * custom server-side functionality you can implement, and it can be used in conjunction with virtually anything.
241
+ * https://docs.microsoft.com/rest/api/playfab/cloudscript/server-side-cloud-script/executeentitycloudscript
242
+ */
243
+ ExecuteEntityCloudScript(request, customData, extraHeaders) {
244
+ return this.ExecuteRequestWrapper("/CloudScript/ExecuteEntityCloudScript", request, "X-EntityToken", customData, extraHeaders);
245
+ }
246
+ /**
247
+ * Cloud Script is one of PlayFab's most versatile features. It allows client code to request execution of any kind of
248
+ * custom server-side functionality you can implement, and it can be used in conjunction with virtually anything.
249
+ * https://docs.microsoft.com/rest/api/playfab/cloudscript/server-side-cloud-script/executefunction
250
+ */
251
+ ExecuteFunction(request, customData, extraHeaders) {
252
+ return this.ExecuteRequestWrapper("/CloudScript/ExecuteFunction", request, "X-EntityToken", customData, extraHeaders);
253
+ }
254
+ /**
255
+ * Gets registered Azure Functions for a given title id and function name.
256
+ * https://docs.microsoft.com/rest/api/playfab/cloudscript/server-side-cloud-script/getfunction
257
+ */
258
+ GetFunction(request, customData, extraHeaders) {
259
+ return this.ExecuteRequestWrapper("/CloudScript/GetFunction", request, "X-EntityToken", customData, extraHeaders);
260
+ }
261
+ /**
262
+ * Lists all currently registered Event Hub triggered Azure Functions for a given title.
263
+ * https://docs.microsoft.com/rest/api/playfab/cloudscript/server-side-cloud-script/listeventhubfunctions
264
+ */
265
+ ListEventHubFunctions(request, customData, extraHeaders) {
266
+ return this.ExecuteRequestWrapper("/CloudScript/ListEventHubFunctions", request, "X-EntityToken", customData, extraHeaders);
267
+ }
268
+ /**
269
+ * Lists all currently registered Azure Functions for a given title.
270
+ * https://docs.microsoft.com/rest/api/playfab/cloudscript/server-side-cloud-script/listfunctions
271
+ */
272
+ ListFunctions(request, customData, extraHeaders) {
273
+ return this.ExecuteRequestWrapper("/CloudScript/ListFunctions", request, "X-EntityToken", customData, extraHeaders);
274
+ }
275
+ /**
276
+ * Lists all currently registered HTTP triggered Azure Functions for a given title.
277
+ * https://docs.microsoft.com/rest/api/playfab/cloudscript/server-side-cloud-script/listhttpfunctions
278
+ */
279
+ ListHttpFunctions(request, customData, extraHeaders) {
280
+ return this.ExecuteRequestWrapper("/CloudScript/ListHttpFunctions", request, "X-EntityToken", customData, extraHeaders);
281
+ }
282
+ /**
283
+ * Lists all currently registered Queue triggered Azure Functions for a given title.
284
+ * https://docs.microsoft.com/rest/api/playfab/cloudscript/server-side-cloud-script/listqueuedfunctions
285
+ */
286
+ ListQueuedFunctions(request, customData, extraHeaders) {
287
+ return this.ExecuteRequestWrapper("/CloudScript/ListQueuedFunctions", request, "X-EntityToken", customData, extraHeaders);
288
+ }
289
+ /**
290
+ * Generate an entity PlayStream event for the provided function result.
291
+ * https://docs.microsoft.com/rest/api/playfab/cloudscript/server-side-cloud-script/postfunctionresultforentitytriggeredaction
292
+ */
293
+ PostFunctionResultForEntityTriggeredAction(request, customData, extraHeaders) {
294
+ return this.ExecuteRequestWrapper("/CloudScript/PostFunctionResultForEntityTriggeredAction", request, "X-EntityToken", customData, extraHeaders);
295
+ }
296
+ /**
297
+ * Generate an entity PlayStream event for the provided function result.
298
+ * https://docs.microsoft.com/rest/api/playfab/cloudscript/server-side-cloud-script/postfunctionresultforfunctionexecution
299
+ */
300
+ PostFunctionResultForFunctionExecution(request, customData, extraHeaders) {
301
+ return this.ExecuteRequestWrapper("/CloudScript/PostFunctionResultForFunctionExecution", request, "X-EntityToken", customData, extraHeaders);
302
+ }
303
+ /**
304
+ * Generate a player PlayStream event for the provided function result.
305
+ * https://docs.microsoft.com/rest/api/playfab/cloudscript/server-side-cloud-script/postfunctionresultforplayertriggeredaction
306
+ */
307
+ PostFunctionResultForPlayerTriggeredAction(request, customData, extraHeaders) {
308
+ return this.ExecuteRequestWrapper("/CloudScript/PostFunctionResultForPlayerTriggeredAction", request, "X-EntityToken", customData, extraHeaders);
309
+ }
310
+ /**
311
+ * Generate a PlayStream event for the provided function result.
312
+ * https://docs.microsoft.com/rest/api/playfab/cloudscript/server-side-cloud-script/postfunctionresultforscheduledtask
313
+ */
314
+ PostFunctionResultForScheduledTask(request, customData, extraHeaders) {
315
+ return this.ExecuteRequestWrapper("/CloudScript/PostFunctionResultForScheduledTask", request, "X-EntityToken", customData, extraHeaders);
316
+ }
317
+ /**
318
+ * Registers an event hub triggered Azure Function with a title.
319
+ * https://docs.microsoft.com/rest/api/playfab/cloudscript/server-side-cloud-script/registereventhubfunction
320
+ */
321
+ RegisterEventHubFunction(request, customData, extraHeaders) {
322
+ return this.ExecuteRequestWrapper("/CloudScript/RegisterEventHubFunction", request, "X-EntityToken", customData, extraHeaders);
323
+ }
324
+ /**
325
+ * Registers an HTTP triggered Azure function with a title.
326
+ * https://docs.microsoft.com/rest/api/playfab/cloudscript/server-side-cloud-script/registerhttpfunction
327
+ */
328
+ RegisterHttpFunction(request, customData, extraHeaders) {
329
+ return this.ExecuteRequestWrapper("/CloudScript/RegisterHttpFunction", request, "X-EntityToken", customData, extraHeaders);
330
+ }
331
+ /**
332
+ * Registers a queue triggered Azure Function with a title.
333
+ * https://docs.microsoft.com/rest/api/playfab/cloudscript/server-side-cloud-script/registerqueuedfunction
334
+ */
335
+ RegisterQueuedFunction(request, customData, extraHeaders) {
336
+ return this.ExecuteRequestWrapper("/CloudScript/RegisterQueuedFunction", request, "X-EntityToken", customData, extraHeaders);
337
+ }
338
+ /**
339
+ * Unregisters an Azure Function with a title.
340
+ * https://docs.microsoft.com/rest/api/playfab/cloudscript/server-side-cloud-script/unregisterfunction
341
+ */
342
+ UnregisterFunction(request, customData, extraHeaders) {
343
+ return this.ExecuteRequestWrapper("/CloudScript/UnregisterFunction", request, "X-EntityToken", customData, extraHeaders);
344
+ }
345
+ };
346
+ export {
347
+ PlayFabCloudScriptApi as default
348
+ };
349
+ //# sourceMappingURL=CloudScript.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/constants.ts","../src/PlayFabContext.ts","../src/PlayFabCommon.ts","../src/apis/PlayFabCloudScriptApi.ts"],"sourcesContent":["export interface ISettings {\n /** You must set this value for PlayFabSdk to work properly (Found in the Game Manager for your title, at the PlayFab Website) */\n titleId: string;\n /** For security reasons you must never expose this value to the client or players - You must set this value for Server-APIs to work properly (Found in the Game Manager for your title, at the PlayFab Website) */\n developerSecretKey: string;\n productionServerUrl: string;\n GlobalHeaderInjection?: { [key: string]: string };\n /** The name of a customer vertical. This is only for customers running a private cluster. Generally you shouldn't touch this */\n verticalName?: string | null;\n}\n\nexport const AuthInfoMap = {\n \"X-EntityToken\": {\n authAttr: \"entityToken\",\n authError: \"errorEntityToken\",\n },\n \"X-Authorization\": {\n authAttr: \"sessionTicket\",\n authError: \"errorLoggedIn\",\n },\n \"X-SecretKey\": {\n authAttr: \"developerSecretKey\",\n authError: \"errorSecretKey\",\n },\n};\n\nexport default {\n sdkVersion: \"1.192.250526\",\n sdkFingerprint: \"JavaScriptSDK-1.192.250526\",\n buildIdentifier: \"custom_async-javascriptsdk\",\n defaultSettings: {\n titleId: \"\",\n developerSecretKey: \"\",\n GlobalHeaderInjection: {},\n productionServerUrl: \".playfabapi.com\",\n verticalName: null\n } as ISettings\n};\n","import constants, { type ISettings } from \"./constants\";\n\nexport type AuthContext = {\n PlayFabId: string | null;\n EntityId: string | null;\n EntityType: string | null;\n SessionTicket: string | null;\n EntityToken: string | null;\n};\n\nexport class PlayFabContext {\n private static _instance: PlayFabContext;\n\n settings: ISettings = constants.defaultSettings;\n\n authenticationContext: AuthContext = {\n PlayFabId: null,\n EntityId: null,\n EntityType: null,\n SessionTicket: null,\n EntityToken: null,\n };\n\n sessionTicket: string | null = null;\n\n entityToken: string | null = null;\n\n private constructor() {}\n\n public static get instance(): PlayFabContext {\n if (!PlayFabContext._instance) {\n PlayFabContext._instance = new PlayFabContext();\n }\n\n return PlayFabContext._instance;\n }\n}\n","import constants, { ISettings, AuthInfoMap } from \"./constants\";\nimport { AuthContext, PlayFabContext } from \"./PlayFabContext\";\nimport { IPlayFabError, IPlayFabResultCommon } from \"./types/PlayFab\";\n\nexport class PlayFabCommon {\n buildIdentifier: string = constants.buildIdentifier;\n requestGetParams = {\n sdk: constants.sdkFingerprint,\n } as const;\n errorTitleId = \"Must be have settings.titleId set to call this method\";\n errorLoggedIn = \"Must be logged in to call this method\";\n errorEntityToken =\n \"You must successfully call GetEntityToken before calling this\";\n errorSecretKey =\n \"Must have settings.developerSecretKey set to call this method\";\n private _context = PlayFabContext.instance;\n\n constructor(settings: Partial<ISettings> | undefined = undefined) {\n if (settings) {\n Object.assign(this._context.settings, settings);\n }\n }\n\n get settings() {\n return this._context.settings;\n }\n\n get authenticationContext() {\n return this._context.authenticationContext;\n }\n\n get sessionTicket() {\n return this._context.sessionTicket;\n }\n\n set sessionTicket(value: string | null) {\n this._context.sessionTicket = value;\n }\n\n get entityToken() {\n return this._context.entityToken;\n }\n\n set entityToken(value: string | null) {\n this._context.entityToken = value;\n }\n\n GetServerUrl() {\n if (!(this.settings.productionServerUrl.substring(0, 4) === \"http\")) {\n return `https://${this.settings.verticalName || this.settings.titleId}${\n this.settings.productionServerUrl\n }`;\n } else {\n return this.settings.productionServerUrl;\n }\n }\n\n InjectHeaders(\n xhr: XMLHttpRequest,\n headersObj: Record<string, string> | undefined\n ) {\n if (!headersObj) return;\n\n for (const headerKey in headersObj) {\n try {\n xhr.setRequestHeader(headerKey, headersObj[headerKey]);\n } catch (e) {\n console.log(\n `Failed to append header: ${headerKey} = ${headersObj[headerKey]} Error: ${e}`\n );\n }\n }\n }\n\n ExecuteRequest<T extends IPlayFabResultCommon>(\n url: string,\n body: any,\n authkey: string | null,\n authValue: string | null,\n customData: any,\n extraHeaders?: Record<string, string>\n ): Promise<T> {\n return new Promise((resolve, reject) => {\n if (body == null) body = {};\n\n var startTime = new Date().getTime();\n var requestBody = JSON.stringify(body);\n\n var urlArr = [url];\n var getParams = this.requestGetParams;\n if (getParams != null) {\n var firstParam = true;\n for (var key in getParams) {\n if (firstParam) {\n urlArr.push(\"?\");\n firstParam = false;\n } else {\n urlArr.push(\"&\");\n }\n urlArr.push(key);\n urlArr.push(\"=\");\n urlArr.push(getParams[key as keyof typeof getParams]);\n }\n }\n\n var completeUrl = urlArr.join(\"\");\n\n var xhr = new XMLHttpRequest();\n xhr.open(\"POST\", completeUrl, true);\n\n xhr.setRequestHeader(\"Content-Type\", \"application/json\");\n xhr.setRequestHeader(\n \"X-PlayFabSDK\",\n \"JavaScriptSDK-\" + constants.sdkVersion\n );\n if (authkey != null) {\n xhr.setRequestHeader(authkey, authValue!);\n }\n this.InjectHeaders(xhr, this.settings.GlobalHeaderInjection);\n this.InjectHeaders(xhr, extraHeaders);\n\n xhr.onloadend = () => {\n var result = this.GetPlayFabResponse(body, xhr, startTime, customData);\n if (result.code === 200) {\n resolve(result.data || result);\n } else {\n reject(result);\n }\n };\n\n xhr.onerror = () => {\n var result = this.GetPlayFabResponse(body, xhr, startTime, customData);\n reject(result);\n };\n\n xhr.send(requestBody);\n });\n }\n\n GetPlayFabResponse(\n request: any,\n xhr: XMLHttpRequest,\n startTime: number,\n customData: any\n ) {\n var result = null as any;\n try {\n // window.console.log(\"parsing json result: \" + xhr.responseText);\n result = JSON.parse(xhr.responseText);\n } catch (e) {\n result = {\n code: 503, // Service Unavailable\n status: \"Service Unavailable\",\n error: \"Connection error\",\n errorCode: 2, // PlayFabErrorCode.ConnectionError\n errorMessage: xhr.responseText,\n };\n }\n\n result.CallBackTimeMS = new Date().getTime() - startTime;\n result.Request = request;\n result.CustomData = customData;\n return result;\n }\n\n UpdateAuthenticationContext(currentAuthContext: AuthContext, result: any) {\n var authenticationContextUpdates = {} as AuthContext;\n if (result?.PlayFabId) {\n authenticationContextUpdates.PlayFabId = result.PlayFabId;\n }\n if (result?.SessionTicket) {\n authenticationContextUpdates.SessionTicket = result.SessionTicket;\n }\n if (result?.EntityToken) {\n authenticationContextUpdates.EntityId = result.EntityToken.Entity.Id;\n authenticationContextUpdates.EntityType = result.EntityToken.Entity.Type;\n authenticationContextUpdates.EntityToken = result.EntityToken.EntityToken;\n }\n // Update the authenticationContext with values from the result\n currentAuthContext = Object.assign(\n currentAuthContext,\n authenticationContextUpdates\n );\n\n this._context.authenticationContext = currentAuthContext;\n\n return currentAuthContext;\n }\n\n GetAuthInfo(request: any, authKey: string) {\n // Use the most-recently saved authKey, unless one was provided in the request via the AuthenticationContext\n var authError = AuthInfoMap[authKey as keyof typeof AuthInfoMap].authError;\n var authAttr = AuthInfoMap[authKey as keyof typeof AuthInfoMap].authAttr;\n var defaultAuthValue: string | null = null;\n if (authAttr === \"entityToken\") defaultAuthValue = this.entityToken;\n else if (authAttr === \"sessionTicket\")\n defaultAuthValue = this.sessionTicket;\n else if (authAttr === \"developerSecretKey\")\n defaultAuthValue = this.settings.developerSecretKey;\n var authValue = request.AuthenticationContext\n ? request.AuthenticationContext[authAttr]\n : defaultAuthValue;\n return { authKey, authValue, authError };\n }\n\n ExecuteRequestWrapper<T extends IPlayFabResultCommon>(\n apiURL: string,\n request: any,\n authKey: string | null,\n customData: any,\n extraHeaders?: Record<string, string>\n ) {\n var authValue = null;\n if (authKey !== null) {\n const { authError, ...authInfo } = this.GetAuthInfo(request, authKey);\n authKey = authInfo.authKey;\n authValue = authInfo.authValue;\n if (!authValue) throw authError;\n }\n return this.ExecuteRequest<T>(\n this.GetServerUrl() + apiURL,\n request,\n authKey,\n authValue,\n customData,\n extraHeaders\n );\n }\n\n GenerateErrorReport(error: IPlayFabError | null): string {\n if (error == null) return \"\";\n var fullErrors = error.errorMessage;\n for (var paramName in error.errorDetails)\n for (var msgIdx in error.errorDetails[paramName])\n fullErrors +=\n \"\\n\" + paramName + \": \" + error.errorDetails[paramName][msgIdx];\n return fullErrors;\n }\n\n ForgetAllCredentials() {\n this._context.sessionTicket = null;\n this._context.entityToken = null;\n }\n}\n","import type {\n\n ExecuteEntityCloudScriptRequest,\n ExecuteFunctionRequest,\n GetFunctionRequest,\n ListFunctionsRequest,\n PostFunctionResultForEntityTriggeredActionRequest,\n PostFunctionResultForFunctionExecutionRequest,\n PostFunctionResultForPlayerTriggeredActionRequest,\n PostFunctionResultForScheduledTaskRequest,\n RegisterEventHubFunctionRequest,\n RegisterHttpFunctionRequest,\n RegisterQueuedFunctionRequest,\n UnregisterFunctionRequest,\n ExecuteCloudScriptResult,\n ExecuteFunctionResult,\n GetFunctionResult,\n ListEventHubFunctionsResult,\n ListFunctionsResult,\n ListHttpFunctionsResult,\n ListQueuedFunctionsResult,\n EmptyResult,\n} from \"../types/PlayFabCloudScriptApi\";\nimport { PlayFabCommon } from \"../PlayFabCommon\";\n\nexport default class PlayFabCloudScriptApi extends PlayFabCommon {\n\n /**\n * Cloud Script is one of PlayFab's most versatile features. It allows client code to request execution of any kind of\n * custom server-side functionality you can implement, and it can be used in conjunction with virtually anything.\n * https://docs.microsoft.com/rest/api/playfab/cloudscript/server-side-cloud-script/executeentitycloudscript\n */\n ExecuteEntityCloudScript (request: ExecuteEntityCloudScriptRequest, customData?: any, extraHeaders?: Record<string, string>) {\n return this.ExecuteRequestWrapper<ExecuteCloudScriptResult>(\"/CloudScript/ExecuteEntityCloudScript\", request, \"X-EntityToken\", customData, extraHeaders);\n }\n\n /**\n * Cloud Script is one of PlayFab's most versatile features. It allows client code to request execution of any kind of\n * custom server-side functionality you can implement, and it can be used in conjunction with virtually anything.\n * https://docs.microsoft.com/rest/api/playfab/cloudscript/server-side-cloud-script/executefunction\n */\n ExecuteFunction (request: ExecuteFunctionRequest, customData?: any, extraHeaders?: Record<string, string>) {\n return this.ExecuteRequestWrapper<ExecuteFunctionResult>(\"/CloudScript/ExecuteFunction\", request, \"X-EntityToken\", customData, extraHeaders);\n }\n\n /**\n * Gets registered Azure Functions for a given title id and function name.\n * https://docs.microsoft.com/rest/api/playfab/cloudscript/server-side-cloud-script/getfunction\n */\n GetFunction (request: GetFunctionRequest, customData?: any, extraHeaders?: Record<string, string>) {\n return this.ExecuteRequestWrapper<GetFunctionResult>(\"/CloudScript/GetFunction\", request, \"X-EntityToken\", customData, extraHeaders);\n }\n\n /**\n * Lists all currently registered Event Hub triggered Azure Functions for a given title.\n * https://docs.microsoft.com/rest/api/playfab/cloudscript/server-side-cloud-script/listeventhubfunctions\n */\n ListEventHubFunctions (request: ListFunctionsRequest, customData?: any, extraHeaders?: Record<string, string>) {\n return this.ExecuteRequestWrapper<ListEventHubFunctionsResult>(\"/CloudScript/ListEventHubFunctions\", request, \"X-EntityToken\", customData, extraHeaders);\n }\n\n /**\n * Lists all currently registered Azure Functions for a given title.\n * https://docs.microsoft.com/rest/api/playfab/cloudscript/server-side-cloud-script/listfunctions\n */\n ListFunctions (request: ListFunctionsRequest, customData?: any, extraHeaders?: Record<string, string>) {\n return this.ExecuteRequestWrapper<ListFunctionsResult>(\"/CloudScript/ListFunctions\", request, \"X-EntityToken\", customData, extraHeaders);\n }\n\n /**\n * Lists all currently registered HTTP triggered Azure Functions for a given title.\n * https://docs.microsoft.com/rest/api/playfab/cloudscript/server-side-cloud-script/listhttpfunctions\n */\n ListHttpFunctions (request: ListFunctionsRequest, customData?: any, extraHeaders?: Record<string, string>) {\n return this.ExecuteRequestWrapper<ListHttpFunctionsResult>(\"/CloudScript/ListHttpFunctions\", request, \"X-EntityToken\", customData, extraHeaders);\n }\n\n /**\n * Lists all currently registered Queue triggered Azure Functions for a given title.\n * https://docs.microsoft.com/rest/api/playfab/cloudscript/server-side-cloud-script/listqueuedfunctions\n */\n ListQueuedFunctions (request: ListFunctionsRequest, customData?: any, extraHeaders?: Record<string, string>) {\n return this.ExecuteRequestWrapper<ListQueuedFunctionsResult>(\"/CloudScript/ListQueuedFunctions\", request, \"X-EntityToken\", customData, extraHeaders);\n }\n\n /**\n * Generate an entity PlayStream event for the provided function result.\n * https://docs.microsoft.com/rest/api/playfab/cloudscript/server-side-cloud-script/postfunctionresultforentitytriggeredaction\n */\n PostFunctionResultForEntityTriggeredAction (request: PostFunctionResultForEntityTriggeredActionRequest, customData?: any, extraHeaders?: Record<string, string>) {\n return this.ExecuteRequestWrapper<EmptyResult>(\"/CloudScript/PostFunctionResultForEntityTriggeredAction\", request, \"X-EntityToken\", customData, extraHeaders);\n }\n\n /**\n * Generate an entity PlayStream event for the provided function result.\n * https://docs.microsoft.com/rest/api/playfab/cloudscript/server-side-cloud-script/postfunctionresultforfunctionexecution\n */\n PostFunctionResultForFunctionExecution (request: PostFunctionResultForFunctionExecutionRequest, customData?: any, extraHeaders?: Record<string, string>) {\n return this.ExecuteRequestWrapper<EmptyResult>(\"/CloudScript/PostFunctionResultForFunctionExecution\", request, \"X-EntityToken\", customData, extraHeaders);\n }\n\n /**\n * Generate a player PlayStream event for the provided function result.\n * https://docs.microsoft.com/rest/api/playfab/cloudscript/server-side-cloud-script/postfunctionresultforplayertriggeredaction\n */\n PostFunctionResultForPlayerTriggeredAction (request: PostFunctionResultForPlayerTriggeredActionRequest, customData?: any, extraHeaders?: Record<string, string>) {\n return this.ExecuteRequestWrapper<EmptyResult>(\"/CloudScript/PostFunctionResultForPlayerTriggeredAction\", request, \"X-EntityToken\", customData, extraHeaders);\n }\n\n /**\n * Generate a PlayStream event for the provided function result.\n * https://docs.microsoft.com/rest/api/playfab/cloudscript/server-side-cloud-script/postfunctionresultforscheduledtask\n */\n PostFunctionResultForScheduledTask (request: PostFunctionResultForScheduledTaskRequest, customData?: any, extraHeaders?: Record<string, string>) {\n return this.ExecuteRequestWrapper<EmptyResult>(\"/CloudScript/PostFunctionResultForScheduledTask\", request, \"X-EntityToken\", customData, extraHeaders);\n }\n\n /**\n * Registers an event hub triggered Azure Function with a title.\n * https://docs.microsoft.com/rest/api/playfab/cloudscript/server-side-cloud-script/registereventhubfunction\n */\n RegisterEventHubFunction (request: RegisterEventHubFunctionRequest, customData?: any, extraHeaders?: Record<string, string>) {\n return this.ExecuteRequestWrapper<EmptyResult>(\"/CloudScript/RegisterEventHubFunction\", request, \"X-EntityToken\", customData, extraHeaders);\n }\n\n /**\n * Registers an HTTP triggered Azure function with a title.\n * https://docs.microsoft.com/rest/api/playfab/cloudscript/server-side-cloud-script/registerhttpfunction\n */\n RegisterHttpFunction (request: RegisterHttpFunctionRequest, customData?: any, extraHeaders?: Record<string, string>) {\n return this.ExecuteRequestWrapper<EmptyResult>(\"/CloudScript/RegisterHttpFunction\", request, \"X-EntityToken\", customData, extraHeaders);\n }\n\n /**\n * Registers a queue triggered Azure Function with a title.\n * https://docs.microsoft.com/rest/api/playfab/cloudscript/server-side-cloud-script/registerqueuedfunction\n */\n RegisterQueuedFunction (request: RegisterQueuedFunctionRequest, customData?: any, extraHeaders?: Record<string, string>) {\n return this.ExecuteRequestWrapper<EmptyResult>(\"/CloudScript/RegisterQueuedFunction\", request, \"X-EntityToken\", customData, extraHeaders);\n }\n\n /**\n * Unregisters an Azure Function with a title.\n * https://docs.microsoft.com/rest/api/playfab/cloudscript/server-side-cloud-script/unregisterfunction\n */\n UnregisterFunction (request: UnregisterFunctionRequest, customData?: any, extraHeaders?: Record<string, string>) {\n return this.ExecuteRequestWrapper<EmptyResult>(\"/CloudScript/UnregisterFunction\", request, \"X-EntityToken\", customData, extraHeaders);\n }\n\n};\n"],"mappings":";AAWO,IAAM,cAAc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ends IPlayFabRequestCommon {
4
+ /** The optional custom tags associated with the request (e.g. build number, external trace identifiers, etc.). */
5
+ CustomTags?: Record<string, string | null>;
6
+ /** The entity to perform this action on. */
7
+ Entity: EntityKey;
8
+ /** Names of the files to have their pending uploads aborted. */
9
+ FileNames: string[];
10
+ /**
11
+ * The expected version of the profile, if set and doesn't match the current version of the profile the operation will not
12
+ * be performed.
13
+ */
14
+ ProfileVersion?: number;
15
+ }
16
+ interface AbortFileUploadsResponse extends IPlayFabResultCommon {
17
+ /** The entity id and type. */
18
+ Entity?: EntityKey;
19
+ /** The current version of the profile, can be used for concurrency control during updates. */
20
+ ProfileVersion: number;
21
+ }
22
+ interface DeleteFilesRequest extends IPlayFabRequestCommon {
23
+ /** The optional custom tags associated with the request (e.g. build number, external trace identifiers, etc.). */
24
+ CustomTags?: Record<string, string | null>;
25
+ /** The entity to perform this action on. */
26
+ Entity: EntityKey;
27
+ /** Names of the files to be deleted. */
28
+ FileNames: string[];
29
+ /**
30
+ * The expected version of the profile, if set and doesn't match the current version of the profile the operation will not
31
+ * be performed.
32
+ */
33
+ ProfileVersion?: number;
34
+ }
35
+ interface DeleteFilesResponse extends IPlayFabResultCommon {
36
+ /** The entity id and type. */
37
+ Entity?: EntityKey;
38
+ /** The current version of the profile, can be used for concurrency control during updates. */
39
+ ProfileVersion: number;
40
+ }
41
+ interface EntityKey {
42
+ /** Unique ID of the entity. */
43
+ Id: string;
44
+ /** Entity type. See https://docs.microsoft.com/gaming/playfab/features/data/entities/available-built-in-entity-types */
45
+ Type?: string;
46
+ }
47
+ interface FinalizeFileUploadsRequest extends IPlayFabRequestCommon {
48
+ /** The optional custom tags associated with the request (e.g. build number, external trace identifiers, etc.). */
49
+ CustomTags?: Record<string, string | null>;
50
+ /** The entity to perform this action on. */
51
+ Entity: EntityKey;
52
+ /** Names of the files to be finalized. Restricted to a-Z, 0-9, '(', ')', '_', '-' and '.' */
53
+ FileNames: string[];
54
+ /** The current version of the profile, can be used for concurrency control during updates. */
55
+ ProfileVersion: number;
56
+ }
57
+ interface FinalizeFileUploadsResponse extends IPlayFabResultCommon {
58
+ /** The entity id and type. */
59
+ Entity?: EntityKey;
60
+ /** Collection of metadata for the entity's files */
61
+ Metadata?: Record<string, GetFileMetadata>;
62
+ /** The current version of the profile, can be used for concurrency control during updates. */
63
+ ProfileVersion: number;
64
+ }
65
+ interface GetFileMetadata {
66
+ /** Checksum value for the file, can be used to check if the file on the server has changed. */
67
+ Checksum?: string;
68
+ /** Download URL where the file can be retrieved */
69
+ DownloadUrl?: string;
70
+ /** Name of the file */
71
+ FileName?: string;
72
+ /** Last UTC time the file was modified */
73
+ LastModified: string;
74
+ /** Storage service's reported byte count */
75
+ Size: number;
76
+ }
77
+ interface GetFilesRequest extends IPlayFabRequestCommon {
78
+ /** The optional custom tags associated with the request (e.g. build number, external trace identifiers, etc.). */
79
+ CustomTags?: Record<string, string | null>;
80
+ /** The entity to perform this action on. */
81
+ Entity: EntityKey;
82
+ }
83
+ interface GetFilesResponse extends IPlayFabResultCommon {
84
+ /** The entity id and type. */
85
+ Entity?: EntityKey;
86
+ /** Collection of metadata for the entity's files */
87
+ Metadata?: Record<string, GetFileMetadata>;
88
+ /** The current version of the profile, can be used for concurrency control during updates. */
89
+ ProfileVersion: number;
90
+ }
91
+ interface GetObjectsRequest extends IPlayFabRequestCommon {
92
+ /** The optional custom tags associated with the request (e.g. build number, external trace identifiers, etc.). */
93
+ CustomTags?: Record<string, string | null>;
94
+ /** The entity to perform this action on. */
95
+ Entity: EntityKey;
96
+ /**
97
+ * Determines whether the object will be returned as an escaped JSON string or as a un-escaped JSON object. Default is JSON
98
+ * object.
99
+ */
100
+ EscapeObject?: boolean;
101
+ }
102
+ interface GetObjectsResponse extends IPlayFabResultCommon {
103
+ /** The entity id and type. */
104
+ Entity?: EntityKey;
105
+ /** Requested objects that the calling entity has access to */
106
+ Objects?: Record<string, ObjectResult>;
107
+ /** The current version of the profile, can be used for concurrency control during updates. */
108
+ ProfileVersion: number;
109
+ }
110
+ interface InitiateFileUploadMetadata {
111
+ /** Name of the file. */
112
+ FileName?: string;
113
+ /** Location the data should be sent to via an HTTP PUT operation. */
114
+ UploadUrl?: string;
115
+ }
116
+ interface InitiateFileUploadsRequest extends IPlayFabRequestCommon {
117
+ /** The optional custom tags associated with the request (e.g. build number, external trace identifiers, etc.). */
118
+ CustomTags?: Record<string, string | null>;
119
+ /** The entity to perform this action on. */
120
+ Entity: EntityKey;
121
+ /** Names of the files to be set. Restricted to a-Z, 0-9, '(', ')', '_', '-' and '.' */
122
+ FileNames: string[];
123
+ /**
124
+ * The expected version of the profile, if set and doesn't match the current version of the profile the operation will not
125
+ * be performed.
126
+ */
127
+ ProfileVersion?: number;
128
+ }
129
+ interface InitiateFileUploadsResponse extends IPlayFabResultCommon {
130
+ /** The entity id and type. */
131
+ Entity?: EntityKey;
132
+ /** The current version of the profile, can be used for concurrency control during updates. */
133
+ ProfileVersion: number;
134
+ /** Collection of file names and upload urls */
135
+ UploadDetails?: InitiateFileUploadMetadata[];
136
+ }
137
+ interface ObjectResult {
138
+ /** Un-escaped JSON object, if EscapeObject false or default. */
139
+ DataObject?: any;
140
+ /** Escaped string JSON body of the object, if EscapeObject is true. */
141
+ EscapedDataObject?: string;
142
+ /** Name of the object. Restricted to a-Z, 0-9, '(', ')', '_', '-' and '.' */
143
+ ObjectName?: string;
144
+ }
145
+ interface SetObject {
146
+ /**
147
+ * Body of the object to be saved. If empty and DeleteObject is true object will be deleted if it exists, or no operation
148
+ * will occur if it does not exist. Only one of Object or EscapedDataObject fields may be used.
149
+ */
150
+ DataObject?: any;
151
+ /** Flag to indicate that this object should be deleted. Both DataObject and EscapedDataObject must not be set as well. */
152
+ DeleteObject?: boolean;
153
+ /**
154
+ * Body of the object to be saved as an escaped JSON string. If empty and DeleteObject is true object will be deleted if it
155
+ * exists, or no operation will occur if it does not exist. Only one of DataObject or EscapedDataObject fields may be used.
156
+ */
157
+ EscapedDataObject?: string;
158
+ /** Name of object. Restricted to a-Z, 0-9, '(', ')', '_', '-' and '.'. */
159
+ ObjectName: string;
160
+ }
161
+ interface SetObjectInfo {
162
+ /** Name of the object */
163
+ ObjectName?: string;
164
+ /** Optional reason to explain why the operation was the result that it was. */
165
+ OperationReason?: string;
166
+ /** Indicates which operation was completed, either Created, Updated, Deleted or None. */
167
+ SetResult?: string;
168
+ }
169
+ interface SetObjectsRequest extends IPlayFabRequestCommon {
170
+ /** The optional custom tags associated with the request (e.g. build number, external trace identifiers, etc.). */
171
+ CustomTags?: Record<string, string | null>;
172
+ /** The entity to perform this action on. */
173
+ Entity: EntityKey;
174
+ /**
175
+ * Optional field used for concurrency control. By specifying the previously returned value of ProfileVersion from
176
+ * GetProfile API, you can ensure that the object set will only be performed if the profile has not been updated by any
177
+ * other clients since the version you last loaded.
178
+ */
179
+ ExpectedProfileVersion?: number;
180
+ /** Collection of objects to set on the profile. */
181
+ Objects: SetObject[];
182
+ }
183
+ interface SetObjectsResponse extends IPlayFabResultCommon {
184
+ /** New version of the entity profile. */
185
+ ProfileVersion: number;
186
+ /** New version of the entity profile. */
187
+ SetResults?: SetObjectInfo[];
188
+ }
189
+
190
+ declare class PlayFabDataApi extends PlayFabCommon {
191
+ /**
192
+ * Abort pending file uploads to an entity's profile.
193
+ * https://docs.microsoft.com/rest/api/playfab/data/file/abortfileuploads
194
+ */
195
+ AbortFileUploads(request: AbortFileUploadsRequest, customData?: any, extraHeaders?: Record<string, string>): Promise<AbortFileUploadsResponse>;
196
+ /**
197
+ * Delete files on an entity's profile.
198
+ * https://docs.microsoft.com/rest/api/playfab/data/file/deletefiles
199
+ */
200
+ DeleteFiles(request: DeleteFilesRequest, customData?: any, extraHeaders?: Record<string, string>): Promise<DeleteFilesResponse>;
201
+ /**
202
+ * Finalize file uploads to an entity's profile.
203
+ * https://docs.microsoft.com/rest/api/playfab/data/file/finalizefileuploads
204
+ */
205
+ FinalizeFileUploads(request: FinalizeFileUploadsRequest, customData?: any, extraHeaders?: Record<string, string>): Promise<FinalizeFileUploadsResponse>;
206
+ /**
207
+ * Retrieves file metadata from an entity's profile.
208
+ * https://docs.microsoft.com/rest/api/playfab/data/file/getfiles
209
+ */
210
+ GetFiles(request: GetFilesRequest, customData?: any, extraHeaders?: Record<string, string>): Promise<GetFilesResponse>;
211
+ /**
212
+ * Retrieves objects from an entity's profile.
213
+ * https://docs.microsoft.com/rest/api/playfab/data/object/getobjects
214
+ */
215
+ GetObjects(request: GetObjectsRequest, customData?: any, extraHeaders?: Record<string, string>): Promise<GetObjectsResponse>;
216
+ /**
217
+ * Initiates file uploads to an entity's profile.
218
+ * https://docs.microsoft.com/rest/api/playfab/data/file/initiatefileuploads
219
+ */
220
+ InitiateFileUploads(request: InitiateFileUploadsRequest, customData?: any, extraHeaders?: Record<string, string>): Promise<InitiateFileUploadsResponse>;
221
+ /**
222
+ * Sets objects on an entity's profile.
223
+ * https://docs.microsoft.com/rest/api/playfab/data/object/setobjects
224
+ */
225
+ SetObjects(request: SetObjectsRequest, customData?: any, extraHeaders?: Record<string, string>): Promise<SetObjectsResponse>;
226
+ }
227
+
228
+ export { PlayFabDataApi as default };