|
5 | 5 | using System;
|
6 | 6 | using System.Collections.Generic;
|
7 | 7 | using System.Linq;
|
| 8 | +using System.Net; |
8 | 9 | using System.Threading;
|
9 | 10 | using System.Threading.Tasks;
|
10 | 11 |
|
@@ -119,6 +120,36 @@ public Task<SearchItem> SearchItemsAsync(string q, SearchType type, int limit =
|
119 | 120 | {
|
120 | 121 | return DownloadDataAsync<SearchItem>(_builder.SearchItems(q, type, limit, offset, market));
|
121 | 122 | }
|
| 123 | + |
| 124 | + /// <summary> |
| 125 | + /// Get Spotify catalog information about artists, albums, tracks or playlists that match a keyword string. |
| 126 | + /// </summary> |
| 127 | + /// <param name="q">The search query's keywords (and optional field filters and operators), for example q=roadhouse+blues. (properly escaped)</param> |
| 128 | + /// <param name="type">A list of item types to search across.</param> |
| 129 | + /// <param name="limit">The maximum number of items to return. Default: 20. Minimum: 1. Maximum: 50.</param> |
| 130 | + /// <param name="offset">The index of the first result to return. Default: 0</param> |
| 131 | + /// <param name="market">An ISO 3166-1 alpha-2 country code or the string from_token.</param> |
| 132 | + /// <returns></returns> |
| 133 | + public SearchItem SearchItemsEscaped(string q, SearchType type, int limit = 20, int offset = 0, string market = "") |
| 134 | + { |
| 135 | + string escapedQuery = WebUtility.UrlEncode(q); |
| 136 | + return DownloadData<SearchItem>(_builder.SearchItems(escapedQuery, type, limit, offset, market)); |
| 137 | + } |
| 138 | + |
| 139 | + /// <summary> |
| 140 | + /// Get Spotify catalog information about artists, albums, tracks or playlists that match a keyword string asynchronously. |
| 141 | + /// </summary> |
| 142 | + /// <param name="q">The search query's keywords (and optional field filters and operators), for example q=roadhouse+blues. (properly escaped)</param> |
| 143 | + /// <param name="type">A list of item types to search across.</param> |
| 144 | + /// <param name="limit">The maximum number of items to return. Default: 20. Minimum: 1. Maximum: 50.</param> |
| 145 | + /// <param name="offset">The index of the first result to return. Default: 0</param> |
| 146 | + /// <param name="market">An ISO 3166-1 alpha-2 country code or the string from_token.</param> |
| 147 | + /// <returns></returns> |
| 148 | + public Task<SearchItem> SearchItemsEscapedAsync(string q, SearchType type, int limit = 20, int offset = 0, string market = "") |
| 149 | + { |
| 150 | + string escapedQuery = WebUtility.UrlEncode(q); |
| 151 | + return DownloadDataAsync<SearchItem>(_builder.SearchItems(escapedQuery, type, limit, offset, market)); |
| 152 | + } |
122 | 153 |
|
123 | 154 | #endregion Search
|
124 | 155 |
|
|
0 commit comments