Esempio n. 1
0
        public async Task<List<EventExt>> GetArtistPastEvents(ArtistExt artist)
        {
            int perPage = 50;

            ArtistType artistType = new ArtistType();
            artistType.Type = ArtistTypeEnum.Songkick;
            artistType.ArtistId = artist.Id.Value;

            var pastEvents = new List<EventExt>();
            var response = await _songkickClient.ArtistPastEvents(artistType, 1, perPage);

            if (int.Parse(response.ResultsPage.TotalEntries) != 0)
            {
                pastEvents.AddRange(response.ResultsPage.Results.Events);

                var max = Math.Ceiling(double.Parse(response.ResultsPage.TotalEntries) / perPage);

                for (int page = 2; page <= max; page++)
                {
                    response = await _songkickClient.ArtistPastEvents(artistType, 1, perPage);
                    pastEvents.AddRange(response.ResultsPage.Results.Events);
                }
            }

            return pastEvents;
        }
Esempio n. 2
0
        public async Task<List<EventExt>> GetArtistUpcomingEvents(ArtistExt artist)
        {
            ArtistType artistType = new ArtistType();
            artistType.Type = ArtistTypeEnum.Songkick;
            artistType.ArtistId = artist.Id.Value;

            ContentResponse response = await _songkickClient.ArtistUpcomingEvents(artistType);
            return response.ResultsPage.Results.Events;
        }
Esempio n. 3
0
        public async Task<ContentResponse> ArtistPastEvents(ArtistType artist, int? page = 1, int? perPage = 20, OrderTypeEnum order = OrderTypeEnum.Ascending)
        {
            var parameters = new Dictionary<string, string>();
            parameters.Add("apikey", _apikey);
            parameters.Add("artistid", artist.ToString());

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

            switch (order)
            {
                case OrderTypeEnum.Ascending:
                    parameters.Add("order", "asc");
                    break;
                case OrderTypeEnum.Descending:
                    parameters.Add("order", "desc");
                    break;
            }

            var template = new UriTemplate("artists/{artistid}/gigography.json?apikey={apikey}&page={page}&per_page={perpage}&order={order}");

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