diff --git a/src/OnePeek.Api/IOnePeekApi.cs b/src/OnePeek.Api/IOnePeekApi.cs new file mode 100644 index 0000000..1e5ba16 --- /dev/null +++ b/src/OnePeek.Api/IOnePeekApi.cs @@ -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 GetImageAsStream(string urn, StoreImageType imageType = StoreImageType.None); + Uri GetImageUri(string urn, StoreImageType imageType = StoreImageType.None); + Task GetMetadata(string appId, StoreType store, StoreCultureType storeCulture); + Task> GetMetadataForAllCultures(string appId, StoreType store, CancellationToken ct, IProgress progress); + Task GetRating(string appId, StoreType store, StoreCultureType storeCulture); + Task> GetRatingsForAllCultures(string appId, StoreType store, CancellationToken ct, IProgress progress); + Task GetReviews(string appId, StoreType store, StoreCultureType storeCulture, StoreReviewSorting sorting, string prevPageMarkerId = null, string nextPageMarkerId = null); + Task Search(string searchTerm, StoreType store, StoreCultureType storeCulture); + } +} diff --git a/src/OnePeek.Api/OnePeekApi.cs b/src/OnePeek.Api/OnePeekApi.cs index eb1379e..1b048e2 100644 --- a/src/OnePeek.Api/OnePeekApi.cs +++ b/src/OnePeek.Api/OnePeekApi.cs @@ -11,7 +11,7 @@ using System.Threading; namespace OnePeek.Api { - public class OnePeekApi : ApiBase + public class OnePeekApi : ApiBase, IOnePeekApi { /// /// Searches for apps based on a term (app name, keywords, ..) @@ -238,6 +238,15 @@ namespace OnePeek.Api + /// + /// Gets metadata for an app for all available cultures + /// Warning: This method makes a request per culture (100+) which can take a while. + /// + /// The ID of the app. Can be found in the dev portal or the store URI. + /// The store where the app is published. + /// The canellation token. + /// The progress event gets triggered as soon as new data arrives. + /// public async Task> GetMetadataForAllCultures(string appId, StoreType store, CancellationToken ct, IProgress progress) { IEnumerable cultures = Enum.GetValues(typeof(StoreCultureType)) @@ -253,6 +262,16 @@ namespace OnePeek.Api } + + /// + /// Gets ratings for an app for all available cultures + /// Warning: This method makes a request per culture (100+) which can take a while. + /// + /// The ID of the app. Can be found in the dev portal or the store URI. + /// The store where the app is published. + /// The canellation token. + /// The progress event gets triggered as soon as new data arrives. + /// public async Task> GetRatingsForAllCultures(string appId, StoreType store, CancellationToken ct, IProgress progress) { IEnumerable cultures = Enum.GetValues(typeof(StoreCultureType))