diff --git a/PocketSharp/Components/Retrieve.cs b/PocketSharp/Components/Retrieve.cs deleted file mode 100644 index 87d2232..0000000 --- a/PocketSharp/Components/Retrieve.cs +++ /dev/null @@ -1,171 +0,0 @@ -using PocketSharp.Models; -using System; -using System.Collections.Generic; -using System.Threading.Tasks; -using System.Linq; - -namespace PocketSharp -{ - /// - /// PocketClient - /// - public partial class PocketClient - { - /// - /// Retrieves items from pocket - /// with the given filters - /// - /// parameters, which are mapped to the officials from http://getpocket.com/developer/docs/v3/retrieve - /// - /// - public async Task> Get( - State? state = null, - bool? favorite = null, - string tag = null, - ContentType? contentType = null, - Sort? sort = null, - string search = null, - string domain = null, - DateTime? since = null, - int? count = null, - int? offset = null - ) - { - RetrieveParameters parameters = new RetrieveParameters() - { - State = state, - Favorite = favorite, - Tag = tag, - ContentType = contentType, - Sort = sort, - DetailType = DetailType.complete, - Search = search, - Domain = domain, - Since = since, - Count = count, - Offset = offset - }; - - Retrieve response = await Request("get", parameters.Convert()); - - return response.Items; - } - - - /// - /// Retrieves an item by a given ID - /// Note: The Pocket API contains no method, which allows to retrieve a single item, so all items are retrieved and filtered locally by the ID. - /// - /// The item ID. - /// - /// - public async Task Get(int itemID) - { - List items = await Get( - state: State.all - ); - - return items.SingleOrDefault(item => item.ID == itemID); - } - - - /// - /// Retrieves all items by a given filter - /// - /// The filter. - /// - /// - public async Task> Get(RetrieveFilter filter) - { - RetrieveParameters parameters = new RetrieveParameters(); - - switch(filter) - { - case RetrieveFilter.Article: - parameters.ContentType = ContentType.article; - break; - case RetrieveFilter.Image: - parameters.ContentType = ContentType.image; - break; - case RetrieveFilter.Video: - parameters.ContentType = ContentType.video; - break; - case RetrieveFilter.Favorite: - parameters.Favorite = true; - break; - case RetrieveFilter.Unread: - parameters.State = State.unread; - break; - case RetrieveFilter.Archive: - parameters.State = State.archive; - break; - } - - parameters.DetailType = DetailType.complete; - - Retrieve response = await Request("get", parameters.Convert()); - - return response.Items; - } - - - /// - /// Retrieves items by tag - /// - /// The tag. - /// - /// - public async Task> SearchByTag(string tag) - { - return await Get(tag: tag); - } - - - /// - /// Retrieves items which match the specified search string in title or content - /// - /// The search string. - /// - /// - public async Task> Search(string searchString) - { - return await Get(search: searchString); - } - } - - - /// - /// Filter for simple retrieve requests - /// - public enum RetrieveFilter - { - /// - /// All types - /// - All, - /// - /// Only unread items - /// - Unread, - /// - /// Archived items - /// - Archive, - /// - /// Favorited items - /// - Favorite, - /// - /// Only articles - /// - Article, - /// - /// Only videos - /// - Video, - /// - /// Only images - /// - Image - } -}