Add PlayFab Client endpoints
This commit is contained in:
@@ -0,0 +1,200 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Prospect.Server.Api.Models.Client;
|
||||
using Prospect.Server.Api.Models.Client.Data;
|
||||
|
||||
namespace Prospect.Server.Api.Controllers
|
||||
{
|
||||
[Route("Client")]
|
||||
[ApiController]
|
||||
public class ClientController : Controller
|
||||
{
|
||||
[HttpPost("LoginWithSteam")]
|
||||
[Produces("application/json")]
|
||||
public IActionResult LoginWithSteam(ClientLoginWithSteamRequest request)
|
||||
{
|
||||
var playerIdOne = "AAAABBBBCCCCDDDD"; // PlayFabId
|
||||
var playerIdTwo = "0000111122223333"; // EntityId
|
||||
var playerName = "AeonLucid";
|
||||
|
||||
var titleId = "A22AB";
|
||||
var publisherId = "850902E5B40508ED";
|
||||
|
||||
if (!string.IsNullOrEmpty(request.SteamTicket))
|
||||
{
|
||||
return Ok(new ClientResponse<FServerLoginResult>
|
||||
{
|
||||
Code = 200,
|
||||
Status = "OK",
|
||||
Data = new FServerLoginResult
|
||||
{
|
||||
EntityToken = new FEntityTokenResponse
|
||||
{
|
||||
Entity = new FEntityKey
|
||||
{
|
||||
Id = playerIdTwo,
|
||||
Type = "title_player_account",
|
||||
TypeString = "title_player_account"
|
||||
},
|
||||
EntityToken = "RW50aXR5VG9rZW4=",
|
||||
TokenExpiration = DateTime.UtcNow.AddDays(1),
|
||||
},
|
||||
InfoResultPayload = new FGetPlayerCombinedInfoResultPayload
|
||||
{
|
||||
CharacterInventories = new List<object>(),
|
||||
PlayerProfile = new FPlayerProfileModel
|
||||
{
|
||||
DisplayName = playerName,
|
||||
PlayerId = playerIdOne,
|
||||
PublisherId = publisherId,
|
||||
TitleId = titleId
|
||||
},
|
||||
UserDataVersion = 0,
|
||||
UserInventory = new List<object>(),
|
||||
UserReadOnlyDataVersion = 0
|
||||
},
|
||||
LastLoginTime = DateTime.UtcNow,
|
||||
NewlyCreated = false,
|
||||
PlayFabId = playerIdOne,
|
||||
SessionTicket = "SOME",
|
||||
SettingsForUser = new FUserSettings
|
||||
{
|
||||
GatherDeviceInfo = true,
|
||||
GatherFocusInfo = true,
|
||||
NeedsAttribution = false,
|
||||
},
|
||||
TreatmentAssignment = new FTreatmentAssignment
|
||||
{
|
||||
Variables = new List<FVariable>(),
|
||||
Variants = new List<string>()
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return BadRequest(new ClientResponse
|
||||
{
|
||||
Code = 400,
|
||||
Status = "BadRequest",
|
||||
Error = "InvalidSteamTicket",
|
||||
ErrorCode = 1010,
|
||||
ErrorMessage = "Steam API AuthenticateUserTicket error response .."
|
||||
});
|
||||
}
|
||||
|
||||
[HttpPost("AddGenericID")]
|
||||
[Produces("application/json")]
|
||||
public IActionResult AddGenericId(FAddGenericIDRequest request)
|
||||
{
|
||||
return Ok(new ClientResponse
|
||||
{
|
||||
Code = 200,
|
||||
Status = "OK"
|
||||
});
|
||||
}
|
||||
|
||||
[HttpPost("UpdateUserTitleDisplayName")]
|
||||
[Produces("application/json")]
|
||||
public IActionResult AddGenericId(FUpdateUserTitleDisplayNameRequest request)
|
||||
{
|
||||
return Ok(new ClientResponse<FUpdateUserTitleDisplayNameResult>
|
||||
{
|
||||
Code = 200,
|
||||
Status = "OK",
|
||||
Data = new FUpdateUserTitleDisplayNameResult
|
||||
{
|
||||
DisplayName = request.DisplayName
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
[HttpPost("GetUserData")]
|
||||
[Produces("application/json")]
|
||||
public IActionResult GetUserData(FGetUserDataRequest request)
|
||||
{
|
||||
return Ok(new ClientResponse<FGetUserDataResult>
|
||||
{
|
||||
Code = 200,
|
||||
Status = "OK",
|
||||
Data = new FGetUserDataResult
|
||||
{
|
||||
Data = new Dictionary<string, FUserDataRecord>(),
|
||||
DataVersion = 0
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
[HttpPost("GetUserReadOnlyData")]
|
||||
[Produces("application/json")]
|
||||
public IActionResult GetUserReadOnlyData(FGetUserDataRequest request)
|
||||
{
|
||||
return Ok(new ClientResponse<FGetUserDataResult>
|
||||
{
|
||||
Code = 200,
|
||||
Status = "OK",
|
||||
Data = new FGetUserDataResult
|
||||
{
|
||||
Data = new Dictionary<string, FUserDataRecord>(),
|
||||
DataVersion = 0
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
[HttpPost("GetUserInventory")]
|
||||
[Produces("application/json")]
|
||||
public IActionResult GetUserReadOnlyData(FGetUserInventoryRequest request)
|
||||
{
|
||||
return Ok(new ClientResponse<FGetUserInventoryResult>
|
||||
{
|
||||
Code = 200,
|
||||
Status = "OK",
|
||||
Data = new FGetUserInventoryResult
|
||||
{
|
||||
Inventory = new List<FItemInstance>
|
||||
{
|
||||
new FItemInstance
|
||||
{
|
||||
ItemId = "Helmet_03",
|
||||
ItemInstanceId = "0102030405060708",
|
||||
ItemClass = "Helmet",
|
||||
PurchaseDate = DateTime.Now.AddDays(-1),
|
||||
CatalogVersion = "StaticItems",
|
||||
DisplayName = "Helmet",
|
||||
UnitPrice = 0,
|
||||
CustomData = new Dictionary<string, string>
|
||||
{
|
||||
["insurance"] = "None",
|
||||
["mods"] = "{\"m\":[]}",
|
||||
["vanity_misc_data"] = "{\"v\":\"\",\"s\":\"\",\"l\":3,\"a\":1,\"d\":300}"
|
||||
}
|
||||
}
|
||||
},
|
||||
VirtualCurrency = new Dictionary<string, int>
|
||||
{
|
||||
["AE"] = 0,
|
||||
["AS"] = 0,
|
||||
["AU"] = 0,
|
||||
["SC"] = 12345
|
||||
},
|
||||
VirtualCurrencyRechargeTimes = new Dictionary<string, FVirtualCurrencyRechargeTime>()
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
[HttpPost("GetTitleData")]
|
||||
[Produces("application/json")]
|
||||
public IActionResult GetTitleData(FGetTitleDataRequest request)
|
||||
{
|
||||
return Ok(new ClientResponse<FGetTitleDataResult>
|
||||
{
|
||||
Code = 200,
|
||||
Status = "OK",
|
||||
Data = new FGetTitleDataResult()
|
||||
{
|
||||
Data = new Dictionary<string, string>()
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Http.Extensions;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Prospect.Server.Api.Middleware
|
||||
{
|
||||
public class RequestLoggerMiddleware
|
||||
{
|
||||
private readonly ILogger<RequestLoggerMiddleware> _logger;
|
||||
private readonly RequestDelegate _next;
|
||||
|
||||
public RequestLoggerMiddleware(ILogger<RequestLoggerMiddleware> logger, RequestDelegate next)
|
||||
{
|
||||
_logger = logger;
|
||||
_next = next;
|
||||
}
|
||||
|
||||
public async Task Invoke(HttpContext context)
|
||||
{
|
||||
var body = await RequestAsync(context.Request);
|
||||
|
||||
if (context.Request.Method == "POST")
|
||||
{
|
||||
_logger.LogDebug("URL {Url} Body {Body}", context.Request.GetDisplayUrl(), body);
|
||||
}
|
||||
|
||||
await _next(context);
|
||||
}
|
||||
|
||||
private static async Task<string> RequestAsync(HttpRequest request)
|
||||
{
|
||||
request.EnableBuffering();
|
||||
|
||||
try
|
||||
{
|
||||
using (var reader = new StreamReader(request.Body, Encoding.UTF8, false, 4096, true))
|
||||
{
|
||||
var body = await reader.ReadToEndAsync();
|
||||
if (body.StartsWith("{"))
|
||||
{
|
||||
return JsonConvert.SerializeObject(JsonConvert.DeserializeObject(body), Formatting.Indented);
|
||||
}
|
||||
|
||||
return body;
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
request.Body.Position = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Prospect.Server.Api.Models.Client
|
||||
{
|
||||
public class ClientLoginWithSteamRequest
|
||||
{
|
||||
[JsonPropertyName("CreateAccount")]
|
||||
public bool CreateAccount { get; set; }
|
||||
|
||||
[JsonPropertyName("CustomTags")]
|
||||
public JsonDocument CustomTags { get; set; }
|
||||
|
||||
[JsonPropertyName("EncryptedRequest")]
|
||||
public string EncryptedRequest { get; set; }
|
||||
|
||||
[JsonPropertyName("InfoRequestParameters")]
|
||||
public InfoParameters InfoRequestParameters { get; set; }
|
||||
|
||||
[JsonPropertyName("PlayerSecret")]
|
||||
public string PlayerSecret { get; set; }
|
||||
|
||||
[JsonPropertyName("SteamTicket")]
|
||||
public string SteamTicket { get; set; }
|
||||
}
|
||||
|
||||
public class InfoParameters
|
||||
{
|
||||
[JsonPropertyName("GetCharacterInventories")]
|
||||
public bool GetCharacterInventories { get; set; }
|
||||
|
||||
[JsonPropertyName("GetCharacterList")]
|
||||
public bool GetCharacterList { get; set; }
|
||||
|
||||
[JsonPropertyName("GetPlayerProfile")]
|
||||
public bool GetPlayerProfile { get; set; }
|
||||
|
||||
[JsonPropertyName("GetPlayerStatistics")]
|
||||
public bool GetPlayerStatistics { get; set; }
|
||||
|
||||
[JsonPropertyName("GetTitleData")]
|
||||
public bool GetTitleData { get; set; }
|
||||
|
||||
[JsonPropertyName("GetUserAccountInfo")]
|
||||
public bool GetUserAccountInfo { get; set; }
|
||||
|
||||
[JsonPropertyName("GetUserData")]
|
||||
public bool GetUserData { get; set; }
|
||||
|
||||
[JsonPropertyName("GetUserInventory")]
|
||||
public bool GetUserInventory { get; set; }
|
||||
|
||||
[JsonPropertyName("GetUserReadOnlyData")]
|
||||
public bool GetUserReadOnlyData { get; set; }
|
||||
|
||||
[JsonPropertyName("GetUserVirtualCurrency")]
|
||||
public bool GetUserVirtualCurrency { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Prospect.Server.Api.Models.Client
|
||||
{
|
||||
public class ClientResponse
|
||||
{
|
||||
[JsonPropertyName("code")]
|
||||
public int Code { get; set; }
|
||||
|
||||
[JsonPropertyName("status")]
|
||||
public string Status { get; set; }
|
||||
|
||||
[JsonPropertyName("error")]
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
|
||||
public string Error { get; set; }
|
||||
|
||||
[JsonPropertyName("errorCode")]
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
|
||||
public int ErrorCode { get; set; }
|
||||
|
||||
[JsonPropertyName("errorMessage")]
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
|
||||
public string ErrorMessage { get; set; }
|
||||
}
|
||||
|
||||
public class ClientResponse<T> : ClientResponse
|
||||
{
|
||||
[JsonPropertyName("data")]
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
|
||||
public T Data { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Prospect.Server.Api.Models.Client.Data
|
||||
{
|
||||
public class FEntityKey
|
||||
{
|
||||
/// <summary>
|
||||
/// Unique ID of the entity.
|
||||
/// </summary>
|
||||
[JsonPropertyName("Id")]
|
||||
public string Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// [optional] Entity type. See https://docs.microsoft.com/gaming/playfab/features/data/entities/available-built-in-entity-types
|
||||
/// </summary>
|
||||
[JsonPropertyName("Type")]
|
||||
public string Type { get; set; }
|
||||
|
||||
// Not in PlayFab SDK
|
||||
[JsonPropertyName("TypeString")]
|
||||
public string TypeString { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
using System;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Prospect.Server.Api.Models.Client.Data
|
||||
{
|
||||
public class FEntityTokenResponse
|
||||
{
|
||||
/// <summary>
|
||||
/// [optional] The entity id and type.
|
||||
/// </summary>
|
||||
[JsonPropertyName("Entity")]
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
|
||||
public FEntityKey Entity { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// [optional] The token used to set X-EntityToken for all entity based API calls.
|
||||
/// </summary>
|
||||
[JsonPropertyName("EntityToken")]
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
|
||||
public string EntityToken { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// [optional] The time the token will expire, if it is an expiring token, in UTC.
|
||||
/// </summary>
|
||||
[JsonPropertyName("TokenExpiration")]
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
|
||||
public DateTime? TokenExpiration { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Prospect.Server.Api.Models.Client.Data
|
||||
{
|
||||
public class FGenericServiceId
|
||||
{
|
||||
/// <summary>
|
||||
/// Name of the service for which the player has a unique identifier.
|
||||
/// </summary>
|
||||
[JsonPropertyName("ServiceName")]
|
||||
public string ServiceName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Unique identifier of the player in that service.
|
||||
/// </summary>
|
||||
[JsonPropertyName("UserId")]
|
||||
public string UserId { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Prospect.Server.Api.Models.Client.Data
|
||||
{
|
||||
public class FGetPlayerCombinedInfoResultPayload
|
||||
{
|
||||
// TSharedPtr<FUserAccountInfo> AccountInfo;
|
||||
|
||||
/// <summary>
|
||||
/// [optional] Inventories for each character for the user.
|
||||
/// </summary>
|
||||
[JsonPropertyName("CharacterInventories")]
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
|
||||
public List<object> CharacterInventories { get; set; }
|
||||
|
||||
// TArray<FCharacterResult> CharacterList;
|
||||
|
||||
/// <summary>
|
||||
/// [optional] The profile of the players. This profile is not guaranteed to be up-to-date. For a new player, this profile will not
|
||||
/// exist.
|
||||
/// </summary>
|
||||
[JsonPropertyName("PlayerProfile")]
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
|
||||
public FPlayerProfileModel PlayerProfile { get; set; }
|
||||
|
||||
// TArray<FStatisticValue> PlayerStatistics;
|
||||
|
||||
// TMap<FString, FString> TitleData;
|
||||
|
||||
// TMap<FString, FUserDataRecord> UserData;
|
||||
|
||||
/// <summary>
|
||||
/// The version of the UserData that was returned.
|
||||
/// </summary>
|
||||
[JsonPropertyName("UserDataVersion")]
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
|
||||
public uint? UserDataVersion { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// [optional] Array of inventory items in the user's current inventory.
|
||||
/// </summary>
|
||||
[JsonPropertyName("UserInventory")]
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
|
||||
public List<object> UserInventory { get; set; }
|
||||
|
||||
// TMap<FString, FUserDataRecord> UserReadOnlyData;
|
||||
|
||||
/// <summary>
|
||||
/// The version of the Read-Only UserData that was returned.
|
||||
/// </summary>
|
||||
[JsonPropertyName("UserReadOnlyDataVersion")]
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
|
||||
public uint? UserReadOnlyDataVersion { get; set; }
|
||||
|
||||
// TMap<FString, int32> UserVirtualCurrency;
|
||||
|
||||
// TMap<FString, FVirtualCurrencyRechargeTime> UserVirtualCurrencyRechargeTimes;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,116 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Prospect.Server.Api.Models.Client.Data
|
||||
{
|
||||
public class FItemInstance
|
||||
{
|
||||
/// <summary>
|
||||
/// [optional] Game specific comment associated with this instance when it was added to the user inventory.
|
||||
/// </summary>
|
||||
[JsonPropertyName("Annotation")]
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
|
||||
public string Annotation { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// [optional] Array of unique items that were awarded when this catalog item was purchased.
|
||||
/// </summary>
|
||||
[JsonPropertyName("BundleContents")]
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
|
||||
public List<string> BundleContents { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// [optional] Unique identifier for the parent inventory item, as defined in the catalog, for object which were added from a bundle or
|
||||
/// container.
|
||||
/// </summary>
|
||||
[JsonPropertyName("BundleParent")]
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
|
||||
public string BundleParent { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// [optional] Catalog version for the inventory item, when this instance was created.
|
||||
/// </summary>
|
||||
[JsonPropertyName("CatalogVersion")]
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
|
||||
public string CatalogVersion { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// [optional] A set of custom key-value pairs on the instance of the inventory item, which is not to be confused with the catalog
|
||||
/// item's custom data.
|
||||
/// </summary>
|
||||
[JsonPropertyName("CustomData")]
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
|
||||
public Dictionary<string, string> CustomData { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// [optional] CatalogItem.DisplayName at the time this item was purchased.
|
||||
/// </summary>
|
||||
[JsonPropertyName("DisplayName")]
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
|
||||
public string DisplayName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// [optional] Timestamp for when this instance will expire.
|
||||
/// </summary>
|
||||
[JsonPropertyName("Expiration")]
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
|
||||
public DateTime? Expiration { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// [optional] Class name for the inventory item, as defined in the catalog.
|
||||
/// </summary>
|
||||
[JsonPropertyName("ItemClass")]
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
|
||||
public string ItemClass { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// [optional] Unique identifier for the inventory item, as defined in the catalog.
|
||||
/// </summary>
|
||||
[JsonPropertyName("ItemId")]
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
|
||||
public string ItemId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// [optional] Unique item identifier for this specific instance of the item.
|
||||
/// </summary>
|
||||
[JsonPropertyName("ItemInstanceId")]
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
|
||||
public string ItemInstanceId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// [optional] Timestamp for when this instance was purchased.
|
||||
/// </summary>
|
||||
[JsonPropertyName("PurchaseDate")]
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
|
||||
public DateTime? PurchaseDate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// [optional] Total number of remaining uses, if this is a consumable item.
|
||||
/// </summary>
|
||||
[JsonPropertyName("RemainingUses")]
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
|
||||
public int? RemainingUses { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// [optional] Currency type for the cost of the catalog item. Not available when granting items.
|
||||
/// </summary>
|
||||
[JsonPropertyName("UnitCurrency")]
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
|
||||
public string UnitCurrency { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Cost of the catalog item in the given currency. Not available when granting items.
|
||||
/// </summary>
|
||||
[JsonPropertyName("UnitPrice")]
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
|
||||
public uint? UnitPrice { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// [optional] The number of uses that were added or removed to this item in this call.
|
||||
/// </summary>
|
||||
[JsonPropertyName("UsesIncrementedBy")]
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
|
||||
public int? UsesIncrementedBy { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Prospect.Server.Api.Models.Client.Data
|
||||
{
|
||||
public class FPlayerProfileModel
|
||||
{
|
||||
/// <summary>
|
||||
/// [optional] Player display name
|
||||
/// </summary>
|
||||
[JsonPropertyName("DisplayName")]
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
|
||||
public string DisplayName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// [optional] PlayFab player account unique identifier
|
||||
/// </summary>
|
||||
[JsonPropertyName("PlayerId")]
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
|
||||
public string PlayerId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// [optional] Publisher this player belongs to
|
||||
/// </summary>
|
||||
[JsonPropertyName("PublisherId")]
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
|
||||
public string PublisherId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// [optional] Title ID this player profile applies to
|
||||
/// </summary>
|
||||
[JsonPropertyName("TitleId")]
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
|
||||
public string TitleId { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Prospect.Server.Api.Models.Client.Data
|
||||
{
|
||||
public class FTreatmentAssignment
|
||||
{
|
||||
/// <summary>
|
||||
/// [optional] List of the experiment variables.
|
||||
/// </summary>
|
||||
[JsonPropertyName("Variables")]
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
|
||||
public List<FVariable> Variables { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// [optional] List of the experiment variants.
|
||||
/// </summary>
|
||||
[JsonPropertyName("Variants")]
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
|
||||
public List<string> Variants { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
using System;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Prospect.Server.Api.Models.Client.Data
|
||||
{
|
||||
public class FUserDataRecord
|
||||
{
|
||||
/// <summary>
|
||||
/// Timestamp for when this data was last updated.
|
||||
/// </summary>
|
||||
[JsonPropertyName("LastUpdated")]
|
||||
public DateTime LastUpdated { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// [optional] Indicates whether this data can be read by all users (public) or only the user (private). This is used for GetUserData
|
||||
/// requests being made by one player about another player.
|
||||
/// </summary>
|
||||
[JsonPropertyName("Permission")]
|
||||
[JsonConverter(typeof(JsonStringEnumConverter))]
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
|
||||
public UserDataPermission Permission { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// [optional] Data stored for the specified user data key.
|
||||
/// </summary>
|
||||
[JsonPropertyName("Value")]
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
|
||||
public string Value { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Prospect.Server.Api.Models.Client.Data
|
||||
{
|
||||
public class FUserSettings
|
||||
{
|
||||
/// <summary>
|
||||
/// Boolean for whether this player is eligible for gathering device info.
|
||||
/// </summary>
|
||||
[JsonPropertyName("GatherDeviceInfo")]
|
||||
public bool GatherDeviceInfo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Boolean for whether this player should report OnFocus play-time tracking.
|
||||
/// </summary>
|
||||
[JsonPropertyName("GatherFocusInfo")]
|
||||
public bool GatherFocusInfo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Boolean for whether this player is eligible for ad tracking.
|
||||
/// </summary>
|
||||
[JsonPropertyName("NeedsAttribution")]
|
||||
public bool NeedsAttribution { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Prospect.Server.Api.Models.Client.Data
|
||||
{
|
||||
public class FVariable
|
||||
{
|
||||
/// <summary>
|
||||
/// Name of the variable.
|
||||
/// </summary>
|
||||
[JsonPropertyName("Name")]
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// [optional] Value of the variable.
|
||||
/// </summary>
|
||||
[JsonPropertyName("Value")]
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
|
||||
public string Value { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
using System;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Prospect.Server.Api.Models.Client.Data
|
||||
{
|
||||
public class FVirtualCurrencyRechargeTime
|
||||
{
|
||||
/// <summary>
|
||||
/// Maximum value to which the regenerating currency will automatically increment. Note that it can exceed this value
|
||||
/// through use of the AddUserVirtualCurrency API call. However, it will not regenerate automatically until it has fallen
|
||||
/// below this value.
|
||||
/// </summary>
|
||||
[JsonPropertyName("RechargeMax")]
|
||||
public int RechargeMax { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Server timestamp in UTC indicating the next time the virtual currency will be incremented.
|
||||
/// </summary>
|
||||
[JsonPropertyName("RechargeTime")]
|
||||
public DateTime RechargeTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Time remaining (in seconds) before the next recharge increment of the virtual currency.
|
||||
/// </summary>
|
||||
[JsonPropertyName("SecondsToRecharge")]
|
||||
public int SecondsToRecharge { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
namespace Prospect.Server.Api.Models.Client.Data
|
||||
{
|
||||
public enum UserDataPermission
|
||||
{
|
||||
Public,
|
||||
Private
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
using System.Text.Json.Serialization;
|
||||
using Prospect.Server.Api.Models.Client.Data;
|
||||
|
||||
namespace Prospect.Server.Api.Models.Client
|
||||
{
|
||||
public class FAddGenericIDRequest
|
||||
{
|
||||
[JsonPropertyName("GenericId")]
|
||||
public FGenericServiceId GenericId { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Prospect.Server.Api.Models.Client
|
||||
{
|
||||
public class FGetTitleDataRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// [optional] Specific keys to search for in the title data (leave null to get all keys)
|
||||
/// </summary>
|
||||
[JsonPropertyName("Keys")]
|
||||
public List<string> Keys { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// [optional] Name of the override. This value is ignored when used by the game client; otherwise, the overrides are applied
|
||||
/// automatically to the title data.
|
||||
/// </summary>
|
||||
[JsonPropertyName("OverrideLabel")]
|
||||
public string OverrideLabel { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Prospect.Server.Api.Models.Client
|
||||
{
|
||||
public class FGetTitleDataResult
|
||||
{
|
||||
/// <summary>
|
||||
/// [optional] a dictionary object of key / value pairs
|
||||
/// </summary>
|
||||
[JsonPropertyName("Data")]
|
||||
public Dictionary<string, string> Data { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Prospect.Server.Api.Models.Client
|
||||
{
|
||||
public class FGetUserDataRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// [optional] The version that currently exists according to the caller. The call will return the data for all of the keys if the
|
||||
/// version in the system is greater than this.
|
||||
/// </summary>
|
||||
[JsonPropertyName("IfChangedFromDataVersion")]
|
||||
public List<uint> IfChangedFromDataVersion { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// [optional] List of unique keys to load from.
|
||||
/// </summary>
|
||||
[JsonPropertyName("Keys")]
|
||||
public List<string> Keys { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// [optional] Unique PlayFab identifier of the user to load data for. Optional, defaults to yourself if not set. When specified to a
|
||||
/// PlayFab id of another player, then this will only return public keys for that account.
|
||||
/// </summary>
|
||||
[JsonPropertyName("PlayFabId")]
|
||||
public string PlayFabId { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Text.Json.Serialization;
|
||||
using Prospect.Server.Api.Models.Client.Data;
|
||||
|
||||
namespace Prospect.Server.Api.Models.Client
|
||||
{
|
||||
public class FGetUserDataResult
|
||||
{
|
||||
/// <summary>
|
||||
/// [optional] User specific data for this title.
|
||||
/// </summary>
|
||||
[JsonPropertyName("Data")]
|
||||
public Dictionary<string, FUserDataRecord> Data { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// [optional] Indicates the current version of the data that has been set. This is incremented with every set call for that type of
|
||||
/// data (read-only, internal, etc). This version can be provided in Get calls to find updated data.
|
||||
/// </summary>
|
||||
[JsonPropertyName("DataVersion")]
|
||||
public uint DataVersion { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Prospect.Server.Api.Models.Client
|
||||
{
|
||||
public class FGetUserInventoryRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// [optional] The optional custom tags associated with the request (e.g. build number, external trace identifiers, etc.).
|
||||
/// </summary>
|
||||
[JsonPropertyName("CustomTags")]
|
||||
public Dictionary<string, string> CustomTags { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Text.Json.Serialization;
|
||||
using Prospect.Server.Api.Models.Client.Data;
|
||||
|
||||
namespace Prospect.Server.Api.Models.Client
|
||||
{
|
||||
public class FGetUserInventoryResult
|
||||
{
|
||||
/// <summary>
|
||||
/// [optional] Array of inventory items belonging to the user.
|
||||
/// </summary>
|
||||
[JsonPropertyName("Inventory")]
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
|
||||
public List<FItemInstance> Inventory { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// [optional] Array of virtual currency balance(s) belonging to the user.
|
||||
/// </summary>
|
||||
[JsonPropertyName("VirtualCurrency")]
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
|
||||
public Dictionary<string, int> VirtualCurrency { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// [optional] Array of virtual currency balance(s) belonging to the user.
|
||||
/// </summary>
|
||||
[JsonPropertyName("VirtualCurrencyRechargeTimes")]
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
|
||||
public Dictionary<string, FVirtualCurrencyRechargeTime> VirtualCurrencyRechargeTimes { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
using System;
|
||||
using System.Text.Json.Serialization;
|
||||
using Prospect.Server.Api.Models.Client.Data;
|
||||
|
||||
namespace Prospect.Server.Api.Models.Client
|
||||
{
|
||||
public class FServerLoginResult
|
||||
{
|
||||
/// <summary>
|
||||
/// [optional] If LoginTitlePlayerAccountEntity flag is set on the login request the title_player_account will also be logged in and
|
||||
/// returned.
|
||||
/// </summary>
|
||||
[JsonPropertyName("EntityToken")]
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
|
||||
public FEntityTokenResponse EntityToken { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// [optional] Results for requested info.
|
||||
/// </summary>
|
||||
[JsonPropertyName("InfoResultPayload")]
|
||||
public FGetPlayerCombinedInfoResultPayload InfoResultPayload { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// [optional] The time of this user's previous login. If there was no previous login, then it's DateTime.MinValue
|
||||
/// </summary>
|
||||
[JsonPropertyName("LastLoginTime")]
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
|
||||
public DateTime? LastLoginTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// True if the account was newly created on this login.
|
||||
/// </summary>
|
||||
[JsonPropertyName("NewlyCreated")]
|
||||
public bool NewlyCreated { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// [optional] Player's unique PlayFabId.
|
||||
/// </summary>
|
||||
[JsonPropertyName("PlayFabId")]
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
|
||||
public string PlayFabId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// [optional] Unique token authorizing the user and game at the server level, for the current session.
|
||||
/// </summary>
|
||||
[JsonPropertyName("SessionTicket")]
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
|
||||
public string SessionTicket { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// [optional] Settings specific to this user.
|
||||
/// </summary>
|
||||
[JsonPropertyName("SettingsForUser")]
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
|
||||
public FUserSettings SettingsForUser { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// [optional] The experimentation treatments for this user at the time of login.
|
||||
/// </summary>
|
||||
[JsonPropertyName("TreatmentAssignment")]
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
|
||||
public FTreatmentAssignment TreatmentAssignment { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Prospect.Server.Api.Models.Client
|
||||
{
|
||||
public class FUpdateUserTitleDisplayNameRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// [optional] The optional custom tags associated with the request (e.g. build number, external trace identifiers, etc.).
|
||||
/// </summary>
|
||||
[JsonPropertyName("CustomTags")]
|
||||
public Dictionary<string, string> CustomTags { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// New title display name for the user - must be between 3 and 25 characters.
|
||||
/// </summary>
|
||||
[JsonPropertyName("DisplayName")]
|
||||
public string DisplayName { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
namespace Prospect.Server.Api.Models.Client
|
||||
{
|
||||
public class FUpdateUserTitleDisplayNameResult
|
||||
{
|
||||
/// <summary>
|
||||
/// [optional] Current title display name for the user (this will be the original display name if the rename attempt failed).
|
||||
/// </summary>
|
||||
public string DisplayName { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -11,6 +11,7 @@ namespace Prospect.Server.Api
|
||||
public static int Main(string[] args)
|
||||
{
|
||||
Log.Logger = new LoggerConfiguration()
|
||||
.MinimumLevel.Debug()
|
||||
.MinimumLevel.Override("Microsoft", LogEventLevel.Information)
|
||||
.MinimumLevel.Override("Microsoft.AspNetCore", LogEventLevel.Warning)
|
||||
.Enrich.FromLogContext()
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
"commandName": "Project",
|
||||
"dotnetRunMessages": "true",
|
||||
"launchBrowser": false,
|
||||
"applicationUrl": "http://localhost:8888",
|
||||
"applicationUrl": "http://localhost:5000",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Prospect.Server.Api.Middleware;
|
||||
using Serilog;
|
||||
|
||||
namespace Prospect.Server.Api
|
||||
@@ -21,9 +22,8 @@ namespace Prospect.Server.Api
|
||||
}
|
||||
|
||||
app.UseSerilogRequestLogging();
|
||||
|
||||
app.UseMiddleware<RequestLoggerMiddleware>();
|
||||
app.UseRouting();
|
||||
|
||||
app.UseEndpoints(endpoints =>
|
||||
{
|
||||
endpoints.MapControllers();
|
||||
|
||||
Reference in New Issue
Block a user