public async Task<Cart> CreateCartAsync(long steamId)
{
List<WebRequestParameter> requestParameters = new List<WebRequestParameter>();
WebRequestParameter steamIdParameter = new WebRequestParameter("steamid", steamId.ToString());
requestParameters.Add(steamIdParameter);
// send the request and wait for the response
JObject data = await PerformSteamRequestAsync("ISteamMicroTxn", "CreateCart", 1, requestParameters);
bool success = TypeHelper.CreateBoolean(data["result"]["success"]);
if (!success)
throw new Exception(E_HTTP_RESPONSE_RESULT_FAILED);
try
{
Cart cart = new Cart()
{
ID = TypeHelper.CreateLong(data["result"]["cartgid"]),
IsValid = true,
OwnerSteamID = steamId
};
return cart;
}
catch
{
throw new Exception(E_JSON_DESERIALIZATION_FAILED);
}
}