using System; namespace SpotifyAPI.Web { public class SearchRequest : RequestParams { /// /// /// /// /// A comma-separated list of item types to search across. /// Valid types are: album , artist, playlist, track, show and episode. /// Search results include hits from all the specified item types. /// /// /// Search query keywords and optional field filters and operators. /// /// /// https://developer.spotify.com/documentation/web-api/reference/search/search/ /// public SearchRequest(Types type, string query) { Ensure.ArgumentNotNull(type, nameof(type)); Ensure.ArgumentNotNullOrEmptyString(query, nameof(query)); Type = type; Query = query; } /// /// A comma-separated list of item types to search across. /// Valid types are: album , artist, playlist, track, show and episode. /// Search results include hits from all the specified item types. /// /// [QueryParam("type")] public Types Type { get; set; } /// /// Search query keywords and optional field filters and operators. /// /// [QueryParam("q")] public string Query { get; set; } /// /// An ISO 3166-1 alpha-2 country code or the string from_token. /// If a country code is specified, only content that is playable in that market is returned. /// Note: /// - Playlist results are not affected by the market parameter. /// - If market is set to from_token, and a valid access token is /// specified in the request header, only content playable in the country /// associated with the user account, is returned. /// - Users can view the country that is associated with their account in the /// account settings. A user must grant access to the user-read-private scope /// prior to when the access token is issued. /// /// [QueryParam("market")] public string? Market { get; set; } /// /// Maximum number of results to return. /// Default: 20 /// Minimum: 1 /// Maximum: 50 /// Note: The limit is applied within each type, not on the total response. /// For example, if the limit value is 3 and the type is artist,album, /// the response contains 3 artists and 3 albums. /// /// [QueryParam("limit")] public int? Limit { get; set; } /// /// The index of the first result to return. /// Default: 0 (the first result). Maximum offset (including limit): 2,000. /// Use with limit to get the next page of search results. /// /// [QueryParam("offset")] public int? Offset { get; set; } /// /// Possible values: audio /// If include_external = audio is specified the response /// will include any relevant audio content that is hosted externally. /// By default external content is filtered out from responses. /// /// [QueryParam("include_external")] public IncludeExternals? IncludeExternal { get; set; } [Flags] public enum IncludeExternals { [String("audio")] Audio = 1, } [Flags] public enum Types { [String("album")] Album = 1, [String("artist")] Artist = 2, [String("playlist")] Playlist = 4, [String("track")] Track = 8, [String("show")] Show = 16, [String("episode")] Episode = 32, All = Album | Artist | Playlist | Track | Show | Episode } } }