-
Notifications
You must be signed in to change notification settings - Fork 0
/
profiles.ts
349 lines (317 loc) · 13.2 KB
/
profiles.ts
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
// deno-lint-ignore-file
import { dispatchRequest, RequestOptions } from "./support/runtime.ts";
export enum EffectType {
Allow = "Allow",
Deny = "Deny",
}
/** An entity object and its associated meta data. */
export interface EntityDataObject {
/** Un-escaped JSON object, if DataAsObject is true. */
DataObject?: Record<string, unknown>;
/** Escaped string JSON body of the object, if DataAsObject is default or false. */
EscapedDataObject?: string;
/** Name of this object. */
ObjectName?: string;
}
/** Combined entity type and ID structure which uniquely identifies a single entity. */
export interface EntityKey {
/** Unique ID of the entity. */
Id: string;
/** Entity type. See https://docs.microsoft.com/gaming/playfab/features/data/entities/available-built-in-entity-types */
Type?: string;
}
export interface EntityLineage {
/** The Character Id of the associated entity. */
CharacterId?: string;
/** The Group Id of the associated entity. */
GroupId?: string;
/** The Master Player Account Id of the associated entity. */
MasterPlayerAccountId?: string;
/** The Namespace Id of the associated entity. */
NamespaceId?: string;
/** The Title Id of the associated entity. */
TitleId?: string;
/** The Title Player Account Id of the associated entity. */
TitlePlayerAccountId?: string;
}
export interface EntityPermissionStatement {
/** The action this statement effects. May be 'Read', 'Write' or '*' for both read and write. */
Action: string;
/** A comment about the statement. Intended solely for bookkeeping and debugging. */
Comment?: string;
/** Additional conditions to be applied for entity resources. */
Condition?: Record<string, unknown>;
/** The effect this statement will have. It may be either Allow or Deny */
Effect: EffectType;
/** The principal this statement will effect. */
Principal: Record<string, unknown>;
/** The resource this statements effects. Similar to 'pfrn:data--title![Title ID]/Profile/*' */
Resource: string;
}
export interface EntityProfileBody {
/** Avatar URL for the entity. */
AvatarUrl?: string;
/** The creation time of this profile in UTC. */
Created: string;
/** The display name of the entity. This field may serve different purposes for different entity types. i.e.: for a title player account it could represent the display name of the player, whereas on a character it could be character's name. */
DisplayName?: string;
/** The entity id and type. */
Entity?: EntityKey;
/** The chain of responsibility for this entity. Use Lineage. */
EntityChain?: string;
/** The experiment variants of this profile. */
ExperimentVariants?: string[];
/** The files on this profile. */
Files?: EntityProfileFileMetadata;
/** The language on this profile. */
Language?: string;
/** Leaderboard metadata for the entity. */
LeaderboardMetadata?: string;
/** The lineage of this profile. */
Lineage?: EntityLineage;
/** The objects on this profile. */
Objects?: EntityDataObject;
/** The permissions that govern access to this entity profile and its properties. Only includes permissions set on this profile, not global statements from titles and namespaces. */
Permissions?: EntityPermissionStatement[];
/** The statistics on this profile. */
Statistics?: EntityStatisticValue;
/** The version number of the profile in persistent storage at the time of the read. Used for optional optimistic concurrency during update. */
VersionNumber: number;
}
/** An entity file's meta data. To get a download URL call File/GetFiles API. */
export interface EntityProfileFileMetadata {
/** Checksum value for the file, can be used to check if the file on the server has changed. */
Checksum?: string;
/** Name of the file */
FileName?: string;
/** Last UTC time the file was modified */
LastModified: string;
/** Storage service's reported byte count */
Size: number;
}
export interface EntityStatisticChildValue {
/** Child name value, if child statistic */
ChildName?: string;
/** Child statistic metadata */
Metadata?: string;
/** Child statistic value */
Value: number;
}
export interface EntityStatisticValue {
/** Child statistic values */
ChildStatistics?: EntityStatisticChildValue;
/** Statistic metadata */
Metadata?: string;
/** Statistic name */
Name?: string;
/** Statistic value */
Value?: number;
/** Statistic version */
Version: number;
}
/** Given an entity type and entity identifier will retrieve the profile from the entity store. If the profile being retrieved is the caller's, then the read operation is consistent, if not it is an inconsistent read. An inconsistent read means that we do not guarantee all committed writes have occurred before reading the profile, allowing for a stale read. If consistency is important the Version Number on the result can be used to compare which version of the profile any reader has. */
export interface GetEntityProfileRequest {
/** The optional custom tags associated with the request (e.g. build number, external trace identifiers, etc.). */
CustomTags?: Record<string, unknown>;
/** Determines whether the objects will be returned as an escaped JSON string or as a un-escaped JSON object. Default is JSON string. */
DataAsObject?: boolean;
/** The entity to perform this action on. */
Entity?: EntityKey;
}
export interface GetEntityProfileResponse {
/** Entity profile */
Profile?: EntityProfileBody;
}
/** Given a set of entity types and entity identifiers will retrieve all readable profiles properties for the caller. Profiles that the caller is not allowed to read will silently not be included in the results. */
export interface GetEntityProfilesRequest {
/** The optional custom tags associated with the request (e.g. build number, external trace identifiers, etc.). */
CustomTags?: Record<string, unknown>;
/** Determines whether the objects will be returned as an escaped JSON string or as a un-escaped JSON object. Default is JSON string. */
DataAsObject?: boolean;
/** Entity keys of the profiles to load. Must be between 1 and 25 */
Entities: EntityKey[];
}
export interface GetEntityProfilesResponse {
/** Entity profiles */
Profiles?: EntityProfileBody[];
}
/** Retrieves the title access policy that is used before the profile's policy is inspected during a request. If never customized this will return the default starter policy built by PlayFab. */
export interface GetGlobalPolicyRequest {
/** The optional custom tags associated with the request (e.g. build number, external trace identifiers, etc.). */
CustomTags?: Record<string, unknown>;
}
export interface GetGlobalPolicyResponse {
/** The permissions that govern access to all entities under this title or namespace. */
Permissions?: EntityPermissionStatement[];
}
/** Given a master player account id (PlayFab ID), returns all title player accounts associated with it. */
export interface GetTitlePlayersFromMasterPlayerAccountIdsRequest {
/** The optional custom tags associated with the request (e.g. build number, external trace identifiers, etc.). */
CustomTags?: Record<string, unknown>;
/** Master player account ids. */
MasterPlayerAccountIds: string[];
/** Id of title to get players from. */
TitleId?: string;
}
export interface GetTitlePlayersFromMasterPlayerAccountIdsResponse {
/** Optional id of title to get players from, required if calling using a master_player_account. */
TitleId?: string;
/** Dictionary of master player ids mapped to title player entity keys and id pairs */
TitlePlayerAccounts?: EntityKey;
}
export enum OperationTypes {
Created = "Created",
Updated = "Updated",
Deleted = "Deleted",
None = "None",
}
/** This will set the access policy statements on the given entity profile. This is not additive, any existing statements will be replaced with the statements in this request. */
export interface SetEntityProfilePolicyRequest {
/** The optional custom tags associated with the request (e.g. build number, external trace identifiers, etc.). */
CustomTags?: Record<string, unknown>;
/** The entity to perform this action on. */
Entity: EntityKey;
/** The statements to include in the access policy. */
Statements?: EntityPermissionStatement[];
}
export interface SetEntityProfilePolicyResponse {
/** The permissions that govern access to this entity profile and its properties. Only includes permissions set on this profile, not global statements from titles and namespaces. */
Permissions?: EntityPermissionStatement[];
}
/** Updates the title access policy that is used before the profile's policy is inspected during a request. Policies are compiled and cached for several minutes so an update here may not be reflected in behavior for a short time. */
export interface SetGlobalPolicyRequest {
/** The optional custom tags associated with the request (e.g. build number, external trace identifiers, etc.). */
CustomTags?: Record<string, unknown>;
/** The permissions that govern access to all entities under this title or namespace. */
Permissions?: EntityPermissionStatement[];
}
export interface SetGlobalPolicyResponse {}
/** Given an entity profile, will update its language to the one passed in if the profile's version is equal to the one passed in. */
export interface SetProfileLanguageRequest {
/** The optional custom tags associated with the request (e.g. build number, external trace identifiers, etc.). */
CustomTags?: Record<string, unknown>;
/** The entity to perform this action on. */
Entity?: EntityKey;
/** The expected version of a profile to perform this update on */
ExpectedVersion?: number;
/** The language to set on the given entity. Deletes the profile's language if passed in a null string. */
Language?: string;
}
export interface SetProfileLanguageResponse {
/** The type of operation that occured on the profile's language */
OperationResult?: OperationTypes;
/** The updated version of the profile after the language update */
VersionNumber?: number;
}
/**
* Gets the global title access policy
* @param {GetGlobalPolicyRequest} request
* @param {RequestOptions} options
* @returns {Promise<GetGlobalPolicyResponse>}
*/
export function GetGlobalPolicy(
request: GetGlobalPolicyRequest,
options: RequestOptions
): Promise<GetGlobalPolicyResponse> {
return dispatchRequest<GetGlobalPolicyResponse>(
"/Profile/GetGlobalPolicy",
request,
options
);
}
/**
* Retrieves the entity's profile.
* @param {GetEntityProfileRequest} request
* @param {RequestOptions} options
* @returns {Promise<GetEntityProfileResponse>}
*/
export function GetProfile(
request: GetEntityProfileRequest,
options: RequestOptions
): Promise<GetEntityProfileResponse> {
return dispatchRequest<GetEntityProfileResponse>(
"/Profile/GetProfile",
request,
options
);
}
/**
* Retrieves the entity's profile.
* @param {GetEntityProfilesRequest} request
* @param {RequestOptions} options
* @returns {Promise<GetEntityProfilesResponse>}
*/
export function GetProfiles(
request: GetEntityProfilesRequest,
options: RequestOptions
): Promise<GetEntityProfilesResponse> {
return dispatchRequest<GetEntityProfilesResponse>(
"/Profile/GetProfiles",
request,
options
);
}
/**
* Retrieves the title player accounts associated with the given master player account.
* @param {GetTitlePlayersFromMasterPlayerAccountIdsRequest} request
* @param {RequestOptions} options
* @returns {Promise<GetTitlePlayersFromMasterPlayerAccountIdsResponse>}
*/
export function GetTitlePlayersFromMasterPlayerAccountIds(
request: GetTitlePlayersFromMasterPlayerAccountIdsRequest,
options: RequestOptions
): Promise<GetTitlePlayersFromMasterPlayerAccountIdsResponse> {
return dispatchRequest<GetTitlePlayersFromMasterPlayerAccountIdsResponse>(
"/Profile/GetTitlePlayersFromMasterPlayerAccountIds",
request,
options
);
}
/**
* Sets the global title access policy
* @param {SetGlobalPolicyRequest} request
* @param {RequestOptions} options
* @returns {Promise<SetGlobalPolicyResponse>}
*/
export function SetGlobalPolicy(
request: SetGlobalPolicyRequest,
options: RequestOptions
): Promise<SetGlobalPolicyResponse> {
return dispatchRequest<SetGlobalPolicyResponse>(
"/Profile/SetGlobalPolicy",
request,
options
);
}
/**
* Updates the entity's language. The precedence hierarchy for communication to the player is Title Player Account language, Master Player Account language, and then title default language if the first two aren't set or supported.
* @param {SetProfileLanguageRequest} request
* @param {RequestOptions} options
* @returns {Promise<SetProfileLanguageResponse>}
*/
export function SetProfileLanguage(
request: SetProfileLanguageRequest,
options: RequestOptions
): Promise<SetProfileLanguageResponse> {
return dispatchRequest<SetProfileLanguageResponse>(
"/Profile/SetProfileLanguage",
request,
options
);
}
/**
* Sets the profiles access policy
* @param {SetEntityProfilePolicyRequest} request
* @param {RequestOptions} options
* @returns {Promise<SetEntityProfilePolicyResponse>}
*/
export function SetProfilePolicy(
request: SetEntityProfilePolicyRequest,
options: RequestOptions
): Promise<SetEntityProfilePolicyResponse> {
return dispatchRequest<SetEntityProfilePolicyResponse>(
"/Profile/SetProfilePolicy",
request,
options
);
}