/
PlayFabDataModels.cs
372 lines (351 loc) · 12.4 KB
/
PlayFabDataModels.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
#if !DISABLE_PLAYFABENTITY_API
using System;
using System.Collections.Generic;
using PlayFab.SharedModels;
namespace PlayFab.DataModels
{
/// <summary>
/// Aborts the pending upload of the requested files.
/// </summary>
[Serializable]
public class AbortFileUploadsRequest : PlayFabRequestCommon
{
/// <summary>
/// The entity to perform this action on.
/// </summary>
public EntityKey Entity;
/// <summary>
/// Names of the files to have their pending uploads aborted.
/// </summary>
public List<string> FileNames;
/// <summary>
/// The expected version of the profile, if set and doesn't match the current version of the profile the operation will not
/// be performed.
/// </summary>
public int? ProfileVersion;
}
[Serializable]
public class AbortFileUploadsResponse : PlayFabResultCommon
{
/// <summary>
/// The entity id and type.
/// </summary>
public EntityKey Entity;
/// <summary>
/// The current version of the profile, can be used for concurrency control during updates.
/// </summary>
public int ProfileVersion;
}
/// <summary>
/// Deletes the requested files from the entity's profile.
/// </summary>
[Serializable]
public class DeleteFilesRequest : PlayFabRequestCommon
{
/// <summary>
/// The entity to perform this action on.
/// </summary>
public EntityKey Entity;
/// <summary>
/// Names of the files to be deleted.
/// </summary>
public List<string> FileNames;
/// <summary>
/// The expected version of the profile, if set and doesn't match the current version of the profile the operation will not
/// be performed.
/// </summary>
public int? ProfileVersion;
}
[Serializable]
public class DeleteFilesResponse : PlayFabResultCommon
{
/// <summary>
/// The entity id and type.
/// </summary>
public EntityKey Entity;
/// <summary>
/// The current version of the profile, can be used for concurrency control during updates.
/// </summary>
public int ProfileVersion;
}
/// <summary>
/// Combined entity type and ID structure which uniquely identifies a single entity.
/// </summary>
[Serializable]
public class EntityKey : PlayFabBaseModel
{
/// <summary>
/// Unique ID of the entity.
/// </summary>
public string Id;
/// <summary>
/// Entity type. See https://docs.microsoft.com/gaming/playfab/features/data/entities/available-built-in-entity-types
/// </summary>
public string Type;
}
/// <summary>
/// Finalizes the upload of the requested files. Verifies that the files have been successfully uploaded and moves the file
/// pointers from pending to live.
/// </summary>
[Serializable]
public class FinalizeFileUploadsRequest : PlayFabRequestCommon
{
/// <summary>
/// The entity to perform this action on.
/// </summary>
public EntityKey Entity;
/// <summary>
/// Names of the files to be finalized. Restricted to a-Z, 0-9, '(', ')', '_', '-' and '.'
/// </summary>
public List<string> FileNames;
}
[Serializable]
public class FinalizeFileUploadsResponse : PlayFabResultCommon
{
/// <summary>
/// The entity id and type.
/// </summary>
public EntityKey Entity;
/// <summary>
/// Collection of metadata for the entity's files
/// </summary>
public Dictionary<string,GetFileMetadata> Metadata;
/// <summary>
/// The current version of the profile, can be used for concurrency control during updates.
/// </summary>
public int ProfileVersion;
}
[Serializable]
public class GetFileMetadata : PlayFabBaseModel
{
/// <summary>
/// Checksum value for the file
/// </summary>
public string Checksum;
/// <summary>
/// Download URL where the file can be retrieved
/// </summary>
public string DownloadUrl;
/// <summary>
/// Name of the file
/// </summary>
public string FileName;
/// <summary>
/// Last UTC time the file was modified
/// </summary>
public DateTime LastModified;
/// <summary>
/// Storage service's reported byte count
/// </summary>
public int Size;
}
/// <summary>
/// Returns URLs that may be used to download the files for a profile for a limited length of time. Only returns files that
/// have been successfully uploaded, files that are still pending will either return the old value, if it exists, or
/// nothing.
/// </summary>
[Serializable]
public class GetFilesRequest : PlayFabRequestCommon
{
/// <summary>
/// The entity to perform this action on.
/// </summary>
public EntityKey Entity;
}
[Serializable]
public class GetFilesResponse : PlayFabResultCommon
{
/// <summary>
/// The entity id and type.
/// </summary>
public EntityKey Entity;
/// <summary>
/// Collection of metadata for the entity's files
/// </summary>
public Dictionary<string,GetFileMetadata> Metadata;
/// <summary>
/// The current version of the profile, can be used for concurrency control during updates.
/// </summary>
public int ProfileVersion;
}
/// <summary>
/// Gets JSON objects from an entity profile and returns it.
/// </summary>
[Serializable]
public class GetObjectsRequest : PlayFabRequestCommon
{
/// <summary>
/// The entity to perform this action on.
/// </summary>
public EntityKey Entity;
/// <summary>
/// Determines whether the object will be returned as an escaped JSON string or as a un-escaped JSON object. Default is JSON
/// object.
/// </summary>
public bool? EscapeObject;
}
[Serializable]
public class GetObjectsResponse : PlayFabResultCommon
{
/// <summary>
/// The entity id and type.
/// </summary>
public EntityKey Entity;
/// <summary>
/// Requested objects that the calling entity has access to
/// </summary>
public Dictionary<string,ObjectResult> Objects;
/// <summary>
/// The current version of the profile, can be used for concurrency control during updates.
/// </summary>
public int ProfileVersion;
}
[Serializable]
public class InitiateFileUploadMetadata : PlayFabBaseModel
{
/// <summary>
/// Name of the file.
/// </summary>
public string FileName;
/// <summary>
/// Location the data should be sent to via an HTTP PUT operation.
/// </summary>
public string UploadUrl;
}
/// <summary>
/// Returns URLs that may be used to upload the files for a profile 5 minutes. After using the upload calls
/// FinalizeFileUploads must be called to move the file status from pending to live.
/// </summary>
[Serializable]
public class InitiateFileUploadsRequest : PlayFabRequestCommon
{
/// <summary>
/// The entity to perform this action on.
/// </summary>
public EntityKey Entity;
/// <summary>
/// Names of the files to be set. Restricted to a-Z, 0-9, '(', ')', '_', '-' and '.'
/// </summary>
public List<string> FileNames;
/// <summary>
/// The expected version of the profile, if set and doesn't match the current version of the profile the operation will not
/// be performed.
/// </summary>
public int? ProfileVersion;
}
[Serializable]
public class InitiateFileUploadsResponse : PlayFabResultCommon
{
/// <summary>
/// The entity id and type.
/// </summary>
public EntityKey Entity;
/// <summary>
/// The current version of the profile, can be used for concurrency control during updates.
/// </summary>
public int ProfileVersion;
/// <summary>
/// Collection of file names and upload urls
/// </summary>
public List<InitiateFileUploadMetadata> UploadDetails;
}
[Serializable]
public class ObjectResult : PlayFabBaseModel
{
/// <summary>
/// Un-escaped JSON object, if EscapeObject false or default.
/// </summary>
public object DataObject;
/// <summary>
/// Escaped string JSON body of the object, if EscapeObject is true.
/// </summary>
public string EscapedDataObject;
/// <summary>
/// Name of the object. Restricted to a-Z, 0-9, '(', ')', '_', '-' and '.'
/// </summary>
public string ObjectName;
}
public enum OperationTypes
{
Created,
Updated,
Deleted,
None
}
[Serializable]
public class SetObject : PlayFabBaseModel
{
/// <summary>
/// Body of the object to be saved. If empty and DeleteObject is true object will be deleted if it exists, or no operation
/// will occur if it does not exist. Only one of Object or EscapedDataObject fields may be used.
/// </summary>
public object DataObject;
/// <summary>
/// Flag to indicate that this object should be deleted. Both DataObject and EscapedDataObject must not be set as well.
/// </summary>
public bool? DeleteObject;
/// <summary>
/// Body of the object to be saved as an escaped JSON string. If empty and DeleteObject is true object will be deleted if it
/// exists, or no operation will occur if it does not exist. Only one of DataObject or EscapedDataObject fields may be used.
/// </summary>
public string EscapedDataObject;
/// <summary>
/// Name of object. Restricted to a-Z, 0-9, '(', ')', '_', '-' and '.'.
/// </summary>
public string ObjectName;
}
[Serializable]
public class SetObjectInfo : PlayFabBaseModel
{
/// <summary>
/// Name of the object
/// </summary>
public string ObjectName;
/// <summary>
/// Optional reason to explain why the operation was the result that it was.
/// </summary>
public string OperationReason;
/// <summary>
/// Indicates which operation was completed, either Created, Updated, Deleted or None.
/// </summary>
public OperationTypes? SetResult;
}
/// <summary>
/// Sets JSON objects on the requested entity profile. May include a version number to be used to perform optimistic
/// concurrency operations during update. If the current version differs from the version in the request the request will be
/// ignored. If no version is set on the request then the value will always be updated if the values differ. Using the
/// version value does not guarantee a write though, ConcurrentEditError may still occur if multiple clients are attempting
/// to update the same profile.
/// </summary>
[Serializable]
public class SetObjectsRequest : PlayFabRequestCommon
{
/// <summary>
/// The entity to perform this action on.
/// </summary>
public EntityKey Entity;
/// <summary>
/// Optional field used for concurrency control. By specifying the previously returned value of ProfileVersion from
/// GetProfile API, you can ensure that the object set will only be performed if the profile has not been updated by any
/// other clients since the version you last loaded.
/// </summary>
public int? ExpectedProfileVersion;
/// <summary>
/// Collection of objects to set on the profile.
/// </summary>
public List<SetObject> Objects;
}
[Serializable]
public class SetObjectsResponse : PlayFabResultCommon
{
/// <summary>
/// New version of the entity profile.
/// </summary>
public int ProfileVersion;
/// <summary>
/// New version of the entity profile.
/// </summary>
public List<SetObjectInfo> SetResults;
}
}
#endif