コード例 #1
0
ファイル: SongkickClient.cs プロジェクト: dupuyjs/rimshot
        public async Task<ContentResponse> UpcomingEventSearch(string artistName, LocationType location = null, DateTime? minDate = null, DateTime? maxDate = null, int? page = 1, int? perPage = 20)
        {
            var parameters = new Dictionary<string, string>();
            parameters.Add("apikey", _apikey);

            if (artistName != null)
            {
                parameters.Add("artistname", Uri.EscapeDataString(artistName));
            }
            if (location != null)
            {
                parameters.Add("location", location.ToString());
            }
            if (minDate.HasValue)
            {
                parameters.Add("mindate", minDate.Value.ToString("yyyy-MM-dd"));
            }
            if (maxDate.HasValue)
            {
                parameters.Add("maxdate", maxDate.Value.ToString("yyyy-MM-dd"));
            }
            if (page.HasValue)
            {
                parameters.Add("page", page.Value.ToString());
            }
            if (perPage.HasValue)
            {
                parameters.Add("perpage", perPage.Value.ToString());
            }

            var template = new UriTemplate("events.json?apikey={apikey}&artist_name={artistname}&location={location}&min_date={mindate}&max_date={maxdate}&page={page}&per_page={perpage}");

            return await GetWithRetryAsync(baseUri, template, parameters);
        }
コード例 #2
0
ファイル: SongkickClient.cs プロジェクト: dupuyjs/rimshot
        public async Task<ContentResponse> LocationSearch(LocationType location, int? page = 1, int? perPage = 20)
        {
            var parameters = new Dictionary<string, string>();
            parameters.Add("apikey", _apikey);
            parameters.Add("location", location.ToString());

            if (page.HasValue)
            {
                parameters.Add("page", page.Value.ToString());
            }
            if (perPage.HasValue)
            {
                parameters.Add("perpage", perPage.Value.ToString());
            }

            var template = new UriTemplate("search/locations.json?apikey={apikey}&location={location}&page={page}&per_page={perpage}");

            return await GetWithRetryAsync(baseUri, template, parameters);
        }