private async Task <CharacterAPIModel> ApiGetCharactersAsync(MemberModel member, APIAccessor accessor) { string path = "Destiny2/" + member.MemberType.ToString() + "/Profile/"; string query = member.MemberID + "/?components=100"; accessor.CreateUri(path, query); string response = await APIAccessor.RequestAsync(APIAccessor.ApiClient); var characterAPI = JsonConvert.DeserializeObject <CharacterAPIModel>(response); return(characterAPI); }
public async Task <MemberAPIModel> GetPlayerAsync(APIAccessor accessor) { var path = "/User/GetMembershipsForCurrentUser"; var query = "/"; accessor.CreateUri(path, query); var res = await APIAccessor.RequestAsync(APIAccessor.ApiClient); var memberAPI = JsonConvert.DeserializeObject <MemberAPIModel>(res); return(memberAPI); }
public async Task <PrimaryStat> GetInstanceAsync(Item item, MemberModel member, APIAccessor accessor) { string path = "Destiny2/" + member.MemberType.ToString() + "/Profile/" + member.MemberID; string query = "/Item/" + item.ItemInstanceId + "/?components=300"; accessor.CreateUri(path, query); string res = await APIAccessor.RequestAsync(APIAccessor.ApiClient); var items = JsonConvert.DeserializeObject <ItemAPIInstance>(res); var instancePath = items.Response.Instance.Data.PrimaryStat; return(instancePath); }
public async Task <Item[]> GetInventoryItemHashesAsync(MemberModel member, string charId, APIAccessor accessor) { string path = "Destiny2/" + member.MemberType.ToString() + "/Profile/" + member.MemberID; string query = "/Character/" + charId + "/?components=201"; accessor.CreateUri(path, query); string res = await APIAccessor.RequestAsync(APIAccessor.ApiClient); var items = JsonConvert.DeserializeObject <ItemAPIModel>(res); var inventoryPath = items.Response.Inventory.Data.Items; return(inventoryPath); }
public async Task <MemberModel> SearchPlayerAsync(string input, MemberModel member) { string path = "/Destiny2/SearchDestinyPlayer/-1/"; string query = input + "/"; accessor.CreateUri(path, query); var res = await APIAccessor.RequestAsync(APIAccessor.ApiClient); var result = JsonConvert.DeserializeObject <SearchedPlayerAPI>(res); member.MemberID = result.Response[0].MembershipId; member.MemberType = Convert.ToInt32(result.Response[0].MembershipType); return(member); }
public async Task <List <ItemModel> > GetCharacterEquippedAsync(MemberModel member, CharacterModel character) { string path = "Destiny2/" + member.MemberType.ToString() + "/Profile/" + member.MemberID; string query = "/Character/" + character.Id + "/?components=205"; accessor.CreateUri(path, query); string response = await APIAccessor.RequestAsync(APIAccessor.ApiClient); var result = JsonConvert.DeserializeObject <ItemAPIModel>(response); List <ItemModel> itemList = new List <ItemModel>(); var itemPath = result.Response.Equipment.Data.Items; itemList = await GetItemInfoAsync(itemPath, member, itemList); return(itemList); }
public async Task <List <CharacterModel> > GetCharacterAsync(MemberModel member, APIAccessor accessor) { var characterList = new List <CharacterModel>(); CharacterAPIModel characterAPI = await ApiGetCharactersAsync(member, accessor); foreach (var characterId in characterAPI.Response.Profile.Data.CharacterIds) { string path = "Destiny2/" + member.MemberType.ToString() + "/Profile/" + member.MemberID; string query = "/Character/" + characterId + "/?components=200"; accessor.CreateUri(path, query); string response = await APIAccessor.RequestAsync(APIAccessor.ApiClient); var characterInfoData = JsonConvert.DeserializeObject <CharacterInfoModel>(response); if (characterInfoData != null) { characterList.Add(Character(characterId, characterInfoData)); } } return(characterList); }