public static Types.BattleFieldItemIdentifier ParseBattleFieldId(Types.Item singleItem) { var split = singleItem.Id.Split("::"); return(new Types.BattleFieldItemIdentifier { Round = split[0], Guid = split[1], Team = split[2], Type = split[3] }); }
public static async Task <string> PostBattlefield(Types.Item input) { // instantiate http client var httpClient = new HttpClient(); // deserialize current battlefield var serializedObj = JsonConvert.SerializeObject(input); // post message var obj = new StringContent(serializedObj, Encoding.UTF8, "application/json"); var response = await httpClient.PostAsync($"{Constants.APIGATEWAY_URL}/items", obj); // read response var responseString = await response.Content.ReadAsStringAsync(); return(responseString); }
public static Types.Item GetLastItemFromBattlefield(List <Types.Item> battlefield, string action) { var lastItem = new Types.Item { Id = "_::_::_::_", Value = "" }; foreach (var item in battlefield) { if (item.Id.Contains(action)) { lastItem = item; } } return(lastItem); }