コード例 #1
0
ファイル: Utility.cs プロジェクト: NathanielBeen/GuitarTab
        public static Result <SongModel> attemptSearch(SearchTerms terms)
        {
            if (terms == null)
            {
                return(new Result <SongModel>());
            }
            if (terms.Name == null && terms.Artist == null && terms.Album == null && terms.Author == null && terms.Rating == 0 && terms.Tags.Length == 0)
            {
                return(APIRequest.getAllSongs().GetAwaiter().GetResult());
            }

            SongSearchRequest search = new SongSearchRequest(terms.Name, terms.Artist, terms.Album, terms.Author, terms.Rating, terms.Tags);

            return(APIRequest.searchSongs(search).GetAwaiter().GetResult());
        }
コード例 #2
0
        public static async Task <Result <SongModel> > searchSongs(SongSearchRequest model)
        {
            var response = await client.PostAsJsonAsync(SONGS + "search", model);

            return(await response.Content.ReadAsAsync <Result <SongModel> >());
        }