public async Task <BacklogResponse <Star[]> > GetStarsAsync(StarQuery query = null) { query = query ?? new StarQuery(); var response = await _client.GetAsync($"/api/v2/users/{Id}/stars", query.Build()).ConfigureAwait(false); return(await _client.CreateResponseAsync <Star[], List <_Star> >( response, HttpStatusCode.OK, data => data.Select(x => new Star(x, _client)).ToArray()).ConfigureAwait(false)); }
string GetRequestQuery(StarQuery query) { string queryString = "?"; if (query.systemName != string.Empty) { queryString = queryString + "systemName=" + query.systemName + "&"; } if (query.showId == 1) { queryString = queryString + "showId=" + query.showId + "&"; } if (query.showCoordinates == 1) { queryString = queryString + "showCoordinates=" + query.showCoordinates + "&"; } if (query.showPermit == 1) { queryString = queryString + "showPermit=" + query.showPermit + "&"; } if (query.showInformation == 1) { queryString = queryString + "showInformation=" + query.showInformation + "&"; } if (query.showPrimaryStar == 1) { queryString = queryString + "sysshowPrimaryStartemName=" + query.showPrimaryStar + "&"; } if (query.startDateTime != string.Empty) { queryString = queryString + "startDateTime=" + query.startDateTime + "&"; } if (query.endDateTime != string.Empty) { queryString = queryString + "endDateTime=" + query.endDateTime + "&"; } if (query.onlyFeatured == 1) { queryString = queryString + "onlyFeatured=" + query.onlyFeatured + "&"; } if (query.onlyKnownCoordinates == 1) { queryString = queryString + "onlyKnownCoordinates=" + query.onlyKnownCoordinates + "&"; } if (query.onlyUnknownCoordinates == 1) { queryString = queryString + "onlyUnknownCoordinates=" + query.onlyUnknownCoordinates + "&"; } if (query.includeHidden == 1) { queryString = queryString + "includeHidden=" + query.includeHidden + "&"; } return(queryString.Substring(0, queryString.Length - 1)); }
IEnumerator UpdateStarData(StarQuery query) { //query.systemName = "Thailoae FN-L b40-1"; //query.showCoordinates = 1; UnityWebRequest unityWebRequest = UnityWebRequest.Get(urls.getSystems + GetRequestQuery(query)); unityWebRequest.SetRequestHeader("Content-Type", "application/json; charset=utf-8"); yield return(unityWebRequest.SendWebRequest()); if (unityWebRequest.error != null) { Debug.LogWarning("Error updating star data! " + unityWebRequest.error); // Popup warning dialogue } else { ProcessStarData(unityWebRequest.downloadHandler.text); mapController.CreateMap(); } }