public Task <ContentResponse> GetRecentlyPlayedRadiosAsync( MediaNamespace mediaNamespace, int?maxItems = null, int?page = null) { Dictionary <string, string> requestParameters = new Dictionary <string, string>(); if (page.HasValue) { requestParameters.Add("page", page.ToString()); } if (maxItems.HasValue) { requestParameters.Add("maxitems", maxItems.ToString()); } return(ApiCallWithUserAuthorizationHeaderRefreshAsync( headers => GetAsync <ContentResponse>( Hostname, $"/1/content/{mediaNamespace}/radio/recentlyplayed", new CancellationToken(false), requestParameters, headers))); }
public Task <ContentResponse> BrowseGenresAsync( MediaNamespace mediaNamespace, string country = null, string language = null) { return(BrowseAsync(mediaNamespace, "genres", country, language)); }
public Task <ContentResponse> SpotlightApiAsync( MediaNamespace mediaNamespace, string language = null, string country = null) { return(DiscoverAsync(mediaNamespace, "spotlight", country, language)); }
public Task <RadioResponse> CreateRadioAsync( MediaNamespace mediaNamespace, CreateRadioRequest createRadioRequest, int?maxItems = null) { if (createRadioRequest == null) { throw new ArgumentNullException(nameof(createRadioRequest)); } Dictionary <string, string> requestParameters = new Dictionary <string, string>(); if (maxItems.HasValue) { requestParameters.Add("maxitems", maxItems.ToString()); } return(ApiCallWithUserAuthorizationHeaderRefreshAsync( headers => PostAsync <RadioResponse, CreateRadioRequest>( Hostname, $"/1/content/{mediaNamespace}/radio/create", createRadioRequest, new CancellationToken(false), requestParameters, headers))); }
public Task <ContentResponse> NewReleasesApiAsync( MediaNamespace mediaNamespace, string genre = null, string language = null, string country = null) { return(DiscoverAsync(mediaNamespace, "newreleases", country, language, genre)); }
public Task <ContentResponse> BrowseContinuationAsync( MediaNamespace mediaNamespace, ContentSource source, ItemType type, string continuationToken) { return(BrowseApiAsync(mediaNamespace, source, type, continuationToken: continuationToken)); }
public Task <ContentResponse> SearchAsync( MediaNamespace mediaNamespace, string query, ContentSource?source = null, SearchFilter filter = SearchFilter.Default, string language = null, string country = null, int?maxItems = null) { return(SearchApiAsync(mediaNamespace, query, source, filter, language, country, maxItems)); }
public Task <RadioResponse> ContinueRadioAsync( MediaNamespace mediaNamespace, Radio radio, int?maxItems = null) { if (radio == null) { throw new ArgumentNullException(nameof(radio)); } return(ContinueRadioAsync(mediaNamespace, radio.Id, maxItems)); }
public Task <RadioResponse> ContinueRadioAsync( MediaNamespace mediaNamespace, RadioResponse previousResponse, int?maxItems = null) { if (previousResponse == null) { throw new ArgumentNullException(nameof(previousResponse)); } return(ContinueRadioAsync(mediaNamespace, previousResponse.SessionId, maxItems)); }
private async Task <ContentResponse> BrowseAsync(MediaNamespace mediaNamespace, string browseCategory, string country, string language) { Dictionary <string, string> requestHeaders = await FormatRequestHeadersAsync(null); Dictionary <string, string> requestParameters = FormatRequestParameters(language: language, country: country); return(await GetAsync <ContentResponse>( Hostname, $"/1/content/{mediaNamespace}/catalog/{browseCategory}", new CancellationToken(false), requestParameters, requestHeaders)); }
private async Task <ContentResponse> SearchApiAsync( MediaNamespace mediaNamespace, string query = null, ContentSource?source = null, SearchFilter filter = SearchFilter.Default, string language = null, string country = null, int?maxItems = null, string continuationToken = null) { Dictionary <string, string> requestParameters = FormatRequestParameters(continuationToken, language, country, source); if (!string.IsNullOrEmpty(query)) { requestParameters.Add("q", Uri.EscapeDataString(query)); } if (filter != SearchFilter.Default) { requestParameters.Add("filters", filter.ToString().Replace(", ", "+")); } if (maxItems.HasValue) { requestParameters.Add("maxItems", maxItems.ToString()); } if (_userTokenManager?.UserIsSignedIn == true) { return(await ApiCallWithUserAuthorizationHeaderRefreshAsync( headers => GetAsync <ContentResponse>( Hostname, $"/1/content/{mediaNamespace}/search", new CancellationToken(false), requestParameters, headers))); } else { Dictionary <string, string> requestHeaders = await FormatRequestHeadersAsync(null); return(await GetAsync <ContentResponse>( Hostname, $"/1/content/{mediaNamespace}/search", new CancellationToken(false), requestParameters, requestHeaders)); } }
public Task <ContentResponse> BrowseAsync( MediaNamespace mediaNamespace, ContentSource source, ItemType type, string genre = null, string mood = null, string activity = null, OrderBy?orderBy = null, int?maxItems = null, int?page = null, string country = null, string language = null) { return(BrowseApiAsync(mediaNamespace, source, type, genre, mood, activity, orderBy, maxItems, page, country, language)); }
public async Task <UserProfileResponse> GetUserProfileAsync( MediaNamespace mediaNamespace, string language = null, string country = null) { Dictionary <string, string> requestParameters = FormatRequestParameters(language: language, country: country); return(await ApiCallWithUserAuthorizationHeaderRefreshAsync( headers => GetAsync <UserProfileResponse>( Hostname, $"/1/user/{mediaNamespace}/profile", new CancellationToken(false), requestParameters, headers))); }
public async Task <TrackActionResponse> CollectionOperationAsync( MediaNamespace mediaNamespace, TrackActionType operation, TrackActionRequest trackActionRequest) { Dictionary <string, string> requestParameters = await FormatRequestParametersAsync(); return(await ApiCallWithUserAuthorizationHeaderRefreshAsync( headers => PostAsync <TrackActionResponse, TrackActionRequest>( Hostname, $"/1/content/{mediaNamespace}/collection/{operation}", trackActionRequest, new CancellationToken(false), requestParameters, headers))); }
public async Task <PlaylistActionResponse> PlaylistOperationAsync( MediaNamespace mediaNamespace, PlaylistActionType operation, PlaylistAction playlistAction) { Dictionary <string, string> requestParameters = FormatRequestParameters(); return(await ApiCallWithUserAuthorizationHeaderRefreshAsync( headers => PostAsync <PlaylistActionResponse, PlaylistAction>( Hostname, $"/1/content/{mediaNamespace}/collection/playlists/{operation}", playlistAction, new CancellationToken(false), requestParameters, headers))); }
public Task <RadioResponse> ContinueRadioAsync( MediaNamespace mediaNamespace, string id, int?maxItems = null) { Dictionary <string, string> requestParameters = new Dictionary <string, string>(); if (maxItems.HasValue) { requestParameters.Add("maxitems", maxItems.ToString()); } return(ApiCallWithUserAuthorizationHeaderRefreshAsync( headers => GetAsync <RadioResponse>( Hostname, $"/1/content/{mediaNamespace}/radio/{id}/next", new CancellationToken(false), requestParameters, headers))); }
private async Task <ContentResponse> DiscoverAsync( MediaNamespace mediaNamespace, string type, string country = null, string language = null, string genre = null) { Dictionary <string, string> requestHeaders = await FormatRequestHeadersAsync(null); Dictionary <string, string> requestParameters = FormatRequestParameters(language: language, country: country); if (!string.IsNullOrEmpty(genre)) { requestParameters.Add("genre", genre); } return(await GetAsync <ContentResponse>( Hostname, $"/1/content/{mediaNamespace}/{type}", new CancellationToken(false), requestParameters, requestHeaders)); }
private async Task <ContentResponse> BrowseApiAsync( MediaNamespace mediaNamespace, ContentSource source, ItemType type, string genre = null, string mood = null, string activity = null, OrderBy?orderBy = null, int?maxItems = null, int?page = null, string country = null, string language = null, string continuationToken = null) { Dictionary <string, string> requestParameters = FormatRequestParameters(continuationToken, language, country); if (genre != null) { requestParameters.Add("genre", genre); } if (mood != null) { requestParameters.Add("mood", genre); } if (activity != null) { requestParameters.Add("activity", genre); } if (orderBy.HasValue) { requestParameters.Add("orderby", orderBy.ToString()); } if (maxItems.HasValue) { requestParameters.Add("maxitems", maxItems.ToString()); } if (page.HasValue) { requestParameters.Add("page", page.ToString()); } if (_userTokenManager?.UserIsSignedIn == true) { return(await ApiCallWithUserAuthorizationHeaderRefreshAsync( headers => GetAsync <ContentResponse>( Hostname, $"/1/content/{mediaNamespace}/{source}/{type}/browse", new CancellationToken(false), requestParameters, headers))); } else { Dictionary <string, string> requestHeaders = await FormatRequestHeadersAsync(null); return(await GetAsync <ContentResponse>( Hostname, $"/1/content/{mediaNamespace}/{source}/{type}/browse", new CancellationToken(false), requestParameters, requestHeaders)); } }
public Task <ContentResponse> BrowseActivitiesAsync(MediaNamespace mediaNamespace, string country, string language) { return(BrowseAsync(mediaNamespace, "activities", country, language)); }
public Task <ContentResponse> SearchContinuationAsync( MediaNamespace mediaNamespace, string continuationToken) { return(SearchApiAsync(mediaNamespace, continuationToken: continuationToken)); }