private static IEnumerator _apiCallStringCollection(string uri, DelegateStringAnswer delegateSearch) { WWW www = new WWW(TenorAPIUri + uri); yield return(www); if (www.error == "" || www.error == null) { ResultStringCollection data = JsonUtility.FromJson <ResultStringCollection>(www.text); if (delegateSearch != null) { delegateSearch(data); } } else { throw new Exception(www.error); } }
// Method to call API End Point: Auto Complete https://tenor.com/gifapi#autocomplete public static IEnumerator AutoComplete(AutoCompleteRequest request, DelegateStringAnswer delegateAutoComplete) { return(_apiCallStringCollection(request.getQueryString(key), delegateAutoComplete)); }
// Method to call API End Point: Register Share https://tenor.com/gifapi#registershare public static IEnumerator RegisterShare(RegisterShareRequest request, DelegateStringAnswer delegateRegisterShare) { return(_apiCallStringCollection(request.getQueryString(key), delegateRegisterShare)); }
// Method to call API End Point: Search Suggestions https://tenor.com/gifapi#suggestions public static IEnumerator SearchSuggestions(SearchSuggestionsRequest request, DelegateStringAnswer delegateSearchSuggestions) { return(_apiCallStringCollection(request.getQueryString(key), delegateSearchSuggestions)); }
// Method to call API End Point: Hourly Trending https://tenor.com/gifapi#hourly-trending public static IEnumerator HourlyTrending(HourlyTrendingRequest request, DelegateStringAnswer delegateHourlyTrending) { return(_apiCallStringCollection(request.getQueryString(key), delegateHourlyTrending)); }