本文整理汇总了C#中SearchType.GetStringAttribute方法的典型用法代码示例。如果您正苦于以下问题:C# SearchType.GetStringAttribute方法的具体用法?C# SearchType.GetStringAttribute怎么用?C# SearchType.GetStringAttribute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SearchType
的用法示例。
在下文中一共展示了SearchType.GetStringAttribute方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SearchItems
/// <summary>
/// Get Spotify catalog information about artists, albums, tracks or playlists that match a keyword string.
/// </summary>
/// <param name="q">The search query's keywords (and optional field filters and operators), for example q=roadhouse+blues.</param>
/// <param name="type">A list of item types to search across.</param>
/// <param name="limit">The maximum number of items to return. Default: 20. Minimum: 1. Maximum: 50.</param>
/// <param name="offset">The index of the first result to return. Default: 0</param>
/// <param name="market">An ISO 3166-1 alpha-2 country code or the string from_token.</param>
/// <returns></returns>
public string SearchItems(String q, SearchType type, int limit = 20, int offset = 0, String market = "")
{
limit = Math.Min(50, limit);
StringBuilder builder = new StringBuilder(APIBase + "/search");
builder.Append("?q=" + q);
builder.Append("&type=" + type.GetStringAttribute(","));
builder.Append("&limit=" + limit);
builder.Append("&offset=" + offset);
if (!String.IsNullOrEmpty(market))
builder.Append("&market=" + market);
return builder.ToString();
}