add interface to api

This commit is contained in:
2015-04-21 00:26:50 +02:00
parent 33ae03a4b0
commit c14e6103aa
2 changed files with 41 additions and 1 deletions
+21
View File
@@ -0,0 +1,21 @@
using OnePeek.Entities;
using System;
using System.Collections.Generic;
using System.IO;
using System.Threading;
using System.Threading.Tasks;
namespace OnePeek.Api
{
public interface IOnePeekApi
{
Task<Stream> GetImageAsStream(string urn, StoreImageType imageType = StoreImageType.None);
Uri GetImageUri(string urn, StoreImageType imageType = StoreImageType.None);
Task<AppMetadata> GetMetadata(string appId, StoreType store, StoreCultureType storeCulture);
Task<IEnumerable<AppMetadata>> GetMetadataForAllCultures(string appId, StoreType store, CancellationToken ct, IProgress<DownloadProgressChangedEventArgs> progress);
Task<AppRating> GetRating(string appId, StoreType store, StoreCultureType storeCulture);
Task<IEnumerable<AppRating>> GetRatingsForAllCultures(string appId, StoreType store, CancellationToken ct, IProgress<DownloadProgressChangedEventArgs> progress);
Task<AppReviews> GetReviews(string appId, StoreType store, StoreCultureType storeCulture, StoreReviewSorting sorting, string prevPageMarkerId = null, string nextPageMarkerId = null);
Task<StoreSearchResults> Search(string searchTerm, StoreType store, StoreCultureType storeCulture);
}
}
+20 -1
View File
@@ -11,7 +11,7 @@ using System.Threading;
namespace OnePeek.Api
{
public class OnePeekApi : ApiBase
public class OnePeekApi : ApiBase, IOnePeekApi
{
/// <summary>
/// Searches for apps based on a term (app name, keywords, ..)
@@ -238,6 +238,15 @@ namespace OnePeek.Api
/// <summary>
/// Gets metadata for an app for all available cultures
/// Warning: This method makes a request per culture (100+) which can take a while.
/// </summary>
/// <param name="appId">The ID of the app. Can be found in the dev portal or the store URI.</param>
/// <param name="store">The store where the app is published.</param>
/// <param name="ct">The canellation token.</param>
/// <param name="progress">The progress event gets triggered as soon as new data arrives.</param>
/// <returns></returns>
public async Task<IEnumerable<AppMetadata>> GetMetadataForAllCultures(string appId, StoreType store, CancellationToken ct, IProgress<DownloadProgressChangedEventArgs> progress)
{
IEnumerable<StoreCultureType> cultures = Enum.GetValues(typeof(StoreCultureType))
@@ -253,6 +262,16 @@ namespace OnePeek.Api
}
/// <summary>
/// Gets ratings for an app for all available cultures
/// Warning: This method makes a request per culture (100+) which can take a while.
/// </summary>
/// <param name="appId">The ID of the app. Can be found in the dev portal or the store URI.</param>
/// <param name="store">The store where the app is published.</param>
/// <param name="ct">The canellation token.</param>
/// <param name="progress">The progress event gets triggered as soon as new data arrives.</param>
/// <returns></returns>
public async Task<IEnumerable<AppRating>> GetRatingsForAllCultures(string appId, StoreType store, CancellationToken ct, IProgress<DownloadProgressChangedEventArgs> progress)
{
IEnumerable<StoreCultureType> cultures = Enum.GetValues(typeof(StoreCultureType))