public IEnumerator SearchArticle(string query) { if (resultsAPI.Length > 0) { resultsAPI = new ArticleSerializable[0]; } url = GameObject.Find("GlobalManager").GetComponent <GlobalManager> ().url; string endPoint = "/forest/v1/articles/?search="; UnityWebRequest webRequest = UnityWebRequest.Get(url + endPoint + query); yield return(webRequest.Send()); if (!webRequest.isError) { ArticleListSerializable articleList = JsonUtility.FromJson <ArticleListSerializable> ( JSONHelpers.WrapToClass("articles", webRequest.downloadHandler.text) ); resultsAPI = articleList.articles; } else { Debug.Log(webRequest.error); } }
public IEnumerator GetThematics(string url) { UnityWebRequest webRequest = UnityWebRequest.Get(url); yield return(webRequest.Send()); if (!webRequest.isError) { ThematicListSerializable thematicList = JsonUtility.FromJson <ThematicListSerializable> ( JSONHelpers.WrapToClass("thematics", webRequest.downloadHandler.text) ); thematics = thematicList.thematics; } else { Debug.Log(webRequest.error); } }
public IEnumerator GetCategories(string url) { UnityWebRequest webRequest = UnityWebRequest.Get(url); yield return(webRequest.Send()); if (!webRequest.isError) { CategoryListSerializable categoryList = JsonUtility.FromJson <CategoryListSerializable> ( JSONHelpers.WrapToClass("categories", webRequest.downloadHandler.text) ); categories = categoryList.categories; } else { Debug.Log(webRequest.error); } }