Beispiel #1
0
        /// <summary>
        /// Get users who user follows.
        /// </summary>
        /// 
        /// <param name="client"><see cref="KipptClient"/> instance.</param>
        /// <param name="userId">User in question.</param>
        /// <param name="limit">End index.</param>
        /// <param name="offset">Start index.</param>
        public static void GetUserFollowingsAsync(KipptClient client, int userId, int limit = 0, int offset = 0)
        {
            var parameters = new Dictionary<string, object>();

            if (limit > 0) parameters.Add("limit", limit);
            if (offset > 0) parameters.Add("offset", offset);

            client.ApiAsync<KipptUserCollection>(ApiCommand.UserFollowings, HttpMethod.Get, parameters, userId);
        }
        /// <summary>
        /// Returns a collection of notifications.
        /// </summary>
        /// 
        /// <param name="client"><see cref="KipptClient"/> instance.</param>
        /// <param name="limit">End index.</param>
        /// <param name="offset">Start index.</param>
        public static KipptNotificationCollection GetNotifications(KipptClient client, int limit, int offset)
        {
            Dictionary<string, object> parameters = new Dictionary<string, object>();

            parameters.Add("limit", limit);

            if (offset > 0) parameters.Add("offset", offset);

            return client.Api<KipptNotificationCollection>(ApiCommand.Notifications, HttpMethod.Get, parameters);
        }
Beispiel #3
0
 /// <summary>
 /// Returns a clip by its id.
 /// </summary>
 /// 
 /// <param name="client"><see cref="KipptClient"/> instance.</param>
 /// <param name="id">Clip id.</param>
 public static KipptClip GetClip(KipptClient client, int id)
 {
     return client.Api<KipptClip>(ApiCommand.Clip, HttpMethod.Get, id);
 }
Beispiel #4
0
 /// <summary>
 /// Updates a clip.
 /// </summary>
 /// 
 /// <param name="client"><see cref="KipptClient"/> instance.</param>
 /// 
 /// <returns>Updated <see cref="KipptClip"/> object.</returns>
 public KipptClip Update(KipptClient client)
 {
     return client.Api<KipptClip>(ApiCommand.Clip, HttpMethod.Put, JsonHelper.Serialize<KipptClip>(this), Id);
 }
Beispiel #5
0
        /// <summary>
        /// Returns a query filtered collection of clips.
        /// </summary>
        /// 
        /// <param name="client"><see cref="KipptClient"/> instance.</param>
        /// <param name="query">Query.</param>
        /// <param name="limit">End index.</param>
        /// <param name="offset">Start index.</param>
        /// <param name="list">List id.</param>
        /// <param name="isStarred">Filter clips by returning only starred ones.</param>
        public static KipptClipCollection Search(KipptClient client, string query, int limit, int offset, int? list = null, bool isStarred = false)
        {
            Dictionary<string, object> parameters = new Dictionary<string, object>();

            parameters.Add("q", query);

            if (limit > 0)      parameters.Add("limit", limit);
            if (offset > 0)     parameters.Add("offset", offset);
            if (list != null)   parameters.Add("list", list);
            if (isStarred)      parameters.Add("is_starred", "true");

            return client.Api<KipptClipCollection>(ApiCommand.ClipSearch, HttpMethod.Get, parameters);
        }
Beispiel #6
0
 /// <summary>
 /// Returns a collection of feed items.
 /// </summary>
 /// 
 /// <param name="client"><see cref="KipptClient"/> instance.</param>
 /// <param name="limit"></param>
 public static KipptClipCollection GetFeed(KipptClient client, int limit)
 {
     return GetFeed(client, limit, 0);
 }
Beispiel #7
0
        /// <summary>
        /// Returns a collection of clips in a specific list.
        /// </summary>
        /// 
        /// <param name="client"><see cref="KipptClient"/> instance.</param>
        /// <param name="list">List id.</param>
        /// <param name="limit">End index.</param>
        /// <param name="offset">Start index.</param>
        /// <param name="isStarred">Filter clips by returning only starred ones.</param>
        /// <param name="isReadLater">Filter clips returning only read later ones.</param>
        /// <param name="since">Specify a start date as a filter.</param>
        public static KipptClipCollection GetClipsByList(KipptClient client, int list, int limit, int offset, bool isStarred = false, bool isReadLater = false, DateTime? since = null)
        {
            Dictionary<string, object> parameters = new Dictionary<string, object>();

            parameters.Add("list", list);

            if (limit > 0)      parameters.Add("limit", limit);
            if (offset > 0)     parameters.Add("offset", offset);
            if (isStarred)      parameters.Add("is_starred", "true");
            if (isReadLater)    parameters.Add("is_read_later", "true");
            if (since != null)  parameters.Add("since", Utils.ToUnixTime((DateTime)since));

            return client.Api<KipptClipCollection>(ApiCommand.Clips, HttpMethod.Get, parameters);
        }
Beispiel #8
0
 /// <summary>
 /// Delete a comment.
 /// </summary>
 /// 
 /// <param name="client"><see cref="KipptClient"/> instance.</param>
 /// <param name="clipId">clip id.</param>
 /// <param name="commentId">comment id.</param>
 public static void DeleteComment(KipptClient client, int clipId, int commentId)
 {
     client.Api<object>(ApiCommand.DeleteComment, HttpMethod.Delete, clipId, commentId);
 }
Beispiel #9
0
        /// <summary>
        /// Checks whether the logged in user is following a list.
        /// </summary>
        /// 
        /// <param name="client"><see cref="KipptClient"/> instance.</param>
        /// <param name="listId">List id.</param>        
        public static bool IsFollowing(KipptClient client, int listId)
        {
            var relationship = client.Api<KipptRelationship>(ApiCommand.ListRelationship, HttpMethod.Get, listId);

            return relationship.Following;
        }
Beispiel #10
0
        /// <summary>
        /// Returns list of users following a list.
        /// </summary>
        /// 
        /// <param name="client"><see cref="KipptClient"/> instance.</param>
        /// <param name="listId">List id.</param>
        /// <param name="limit">End index.</param>
        /// <param name="offset">Start index.</param>
        public static KipptUserCollection GetListFollowings(KipptClient client, int listId, int limit = 0, int offset = 0)
        {
            var parameters = new Dictionary<string, object>();

            if (limit > 0) parameters.Add("limit", limit);
            if (offset > 0) parameters.Add("offset", offset);

            return client.Api<KipptUserCollection>(ApiCommand.ListFollowings, HttpMethod.Get, parameters);
        }
Beispiel #11
0
 /// <summary>
 /// Returns a list by its id.
 /// </summary>
 /// 
 /// <param name="client"><see cref="KipptClient"/> instance.</param>
 /// <param name="id">List id.</param>
 /// <param name="scopes">List of scopes.</param>
 public static KipptList GetList(KipptClient client, int id)
 {
     return client.Api<KipptList>(ApiCommand.List, HttpMethod.Get, id);
 }
Beispiel #12
0
 /// <summary>
 /// Returns a collection of lists.
 /// </summary>
 /// 
 /// <param name="client"><see cref="KipptClient"/> instance.</param>
 /// <param name="limit">End index.</param>
 /// <param name="scopes">List of scopes.</param>
 public static void GetListsAsync(KipptClient client, int limit)
 {
     GetListsAsync(client, limit, 0);
 }
Beispiel #13
0
 /// <summary>
 /// Returns a collection of lists.
 /// </summary>
 /// 
 /// <remarks>
 /// Results are paginated.
 /// The default number of returned lists is 20.
 /// Pagination information are stored in the Meta property of <see cref="KipptListCollection"/> class.
 /// </remarks>
 /// 
 /// <param name="client"><see cref="KipptClient"/> instance.</param>
 /// <param name="scopes">List of scopes.</param>
 public static void GetListsAsync(KipptClient client)
 {
     client.ApiAsync<KipptListCollection>(ApiCommand.Lists, HttpMethod.Get);
 }
Beispiel #14
0
 /// <summary>
 /// Updates a list.
 /// </summary>
 /// 
 /// <param name="client"><see cref="KipptClient"/> instance.</param>
 /// 
 /// <returns>Updated <see cref="KipptList"/> instance.</returns>
 public void UpdateAsync(KipptClient client)
 {
     client.ApiAsync<KipptList>(ApiCommand.List, HttpMethod.Put, JsonHelper.Serialize<KipptList>(this), this.Id);
 }
Beispiel #15
0
 /// <summary>
 /// Creates a list.
 /// </summary>
 /// 
 /// <param name="client"><see cref="KipptClient"/> instance.</param>
 /// 
 /// <remarks>
 ///     * Title (required).
 /// </remarks>
 /// 
 /// <returns>Created <see cref="KipptList"/> instance.</returns>
 public void CreateAsync(KipptClient client)
 {
     client.ApiAsync<KipptList>(ApiCommand.Lists, HttpMethod.Post, JsonHelper.Serialize<KipptList>(this));
 }
Beispiel #16
0
 /// <summary>
 /// Remove clip from favorites.
 /// </summary>
 /// 
 /// <param name="client"><see cref="KipptClient"/> instance.</param>
 /// <param name="clipId">Clip id.</param>
 public static void UnFavoriteClip(KipptClient client, int clipId)
 {
     client.Api<object>(ApiCommand.FavoriteClip, HttpMethod.Delete, clipId);
 }
Beispiel #17
0
        /// <summary>
        /// Add comment to a clip.
        /// </summary>
        /// 
        /// <param name="client"><see cref="KipptClient"/> instance.</param>
        /// <param name="clipId">Clip id.</param>
        /// <param name="commentText">Comment text.</param>
        public static KipptComment AddComment(KipptClient client, int clipId, string commentText)
        {
            var comment = new KipptComment();

            comment.Body = commentText;

            return client.Api<KipptComment>(ApiCommand.ClipComments, HttpMethod.Post, JsonHelper.Serialize<KipptComment>(comment), clipId);
        }
Beispiel #18
0
 /// <summary>
 /// Unfollow a list.
 /// </summary>
 /// 
 /// <param name="client"><see cref="KipptClient"/> instance.</param>
 /// <param name="listId">List id.</param>
 public static void UnFollowList(KipptClient client, int listId)
 {
     client.Api<KipptRelationship>(ApiCommand.ListRelationship, HttpMethod.Post, JsonHelper.Serialize<KipptAction>(new KipptAction("unfollow")), listId);
 }
Beispiel #19
0
 /// <summary>
 /// Unlike a clip.
 /// </summary>
 /// 
 /// <param name="client"><see cref="KipptClient"/> instance.</param>
 /// <param name="clipId">Clip id.</param>
 public static void UnLikeClip(KipptClient client, int clipId)
 {
     client.Api<object>(ApiCommand.ClipLikes, HttpMethod.Delete, clipId);
 }
Beispiel #20
0
        /// <summary>
        /// Search for a list.
        /// </summary>
        /// 
        /// <param name="client"><see cref="KipptClient"/> instance.</param>
        /// <param name="query">Query.</param>
        /// <param name="limit">End index.</param>
        /// <param name="offset">Start index.</param>
        public static KipptListCollection Search(KipptClient client, string query, int limit = 0, int offset = 0)
        {
            var parameters = new Dictionary<string, object>();

            parameters.Add("q", query);

            if (limit > 0) parameters.Add("limit", limit);
            if (offset > 0) parameters.Add("offset", offset);

            return client.Api<KipptListCollection>(ApiCommand.ListSearch, HttpMethod.Get, parameters);
        }
Beispiel #21
0
 /// <summary>
 /// Returns a collection of feed items.
 /// </summary>
 /// 
 /// <param name="client"><see cref="KipptClient"/> instance.</param>
 public static KipptClipCollection GetFeed(KipptClient client)
 {
     return client.Api<KipptClipCollection>(ApiCommand.Feed, HttpMethod.Get);
 }
Beispiel #22
0
 /// <summary>
 /// Updates a list.
 /// </summary>
 /// 
 /// <param name="client"><see cref="KipptClient"/> instance.</param>
 /// 
 /// <returns>Updated <see cref="KipptList"/> instance.</returns>
 public KipptList Update(KipptClient client)
 {
     return client.Api<KipptList>(ApiCommand.List, HttpMethod.Put, JsonHelper.Serialize<KipptList>(this), this.Id);
 }
Beispiel #23
0
 /// <summary>
 /// Returns a query filtered collection of clips.
 /// </summary>
 /// 
 /// <param name="client"><see cref="KipptClient"/> instance.</param>
 /// <param name="query">Query.</param>
 /// <param name="limit">End index.</param>
 /// <param name="list">List id.</param>
 /// <param name="isStarred">Filter clips by returning only starred ones.</param>
 public static KipptClipCollection Search(KipptClient client, string query, int limit, int? list = null, bool isStarred = false)
 {
     return Search(client, query, limit, 0, list, isStarred);
 }
Beispiel #24
0
 /// <summary>
 /// Deleted a list.
 /// </summary>
 /// 
 /// <param name="client"><see cref="KipptClient"/> instance.</param>
 public void Delete(KipptClient client)
 {
     client.Api<KipptList>(ApiCommand.List, HttpMethod.Delete, this.Id);
 }
Beispiel #25
0
 /// <summary>
 /// Creates a clip.
 /// </summary>
 /// 
 /// <param name="client"><see cref="KipptClient"/> instance.</param>
 /// 
 /// <remarks>
 ///     * Url (required).
 ///     * Title (optional).
 ///     * Notes (optional).
 ///     * Resource uri of a list (otherwise it will be saved to inbox).
 ///     * Is starred (optional).
 ///     * Is read later (optional).
 /// </remarks>
 /// 
 /// <returns>Created <see cref="KipptClip"/> object.</returns>
 public KipptClip Create(KipptClient client)
 {
     return client.Api<KipptClip>(ApiCommand.Clips, HttpMethod.Post, JsonHelper.Serialize<KipptClip>(this));
 }
Beispiel #26
0
 /// <summary>
 /// Returns a collection of lists.
 /// </summary>
 /// 
 /// <remarks>
 /// Results are paginated.
 /// The default number of returned lists is 20.
 /// Pagination information are stored in the Meta property of <see cref="KipptListCollection"/> class.
 /// </remarks>
 /// 
 /// <param name="client"><see cref="KipptClient"/> instance.</param>
 /// <param name="scopes">List of scopes.</param>
 public static KipptListCollection GetLists(KipptClient client)
 {
     return client.Api<KipptListCollection>(ApiCommand.Lists, HttpMethod.Get);
 }
Beispiel #27
0
 /// <summary>
 /// Deletes a clip.
 /// </summary>
 /// 
 /// <param name="client"><see cref="KipptClient"/> instance.</param>
 public void Delete(KipptClient client)
 {
     client.Api<KipptClip>(ApiCommand.Clip, HttpMethod.Delete, Id);
 }
Beispiel #28
0
 /// <summary>
 /// Returns a collection of lists.
 /// </summary>
 /// 
 /// <param name="client"><see cref="KipptClient"/> instance.</param>
 /// <param name="limit">End index.</param>
 /// <param name="scopes">List of scopes.</param>
 public static KipptListCollection GetLists(KipptClient client, int limit)
 {
     return GetLists(client, limit, 0);
 }
Beispiel #29
0
 /// <summary>
 /// Returns a collection of clips.
 /// </summary>
 /// 
 /// <remarks>
 /// Results are paginated.
 /// The default number of returned clips is 20.
 /// Pagination information are stored in the Meta property of <see cref="KipptListCollection"/> class.
 /// </remarks>
 /// 
 /// <param name="client"><see cref="KipptClient"/> instance.</param>
 /// <param name="isStarred">Filter clips by returning only starred ones.</param>
 /// <param name="isReadLater">Filter clips returning only read later ones.</param>
 /// <param name="since">Specify a start date as a filter.</param>
 public static KipptClipCollection GetClips(KipptClient client, bool isStarred = false, bool isReadLater = false, DateTime? since = null)
 {
     return GetClips(client, 0, 0, isStarred, isReadLater, since);
 }
Beispiel #30
0
        /// <summary>
        /// Returns favorites clips. Both private and public.
        /// </summary>
        /// 
        /// <param name="client"><see cref="KipptClient"/> instance.</param>
        /// <param name="limit">End index.</param>
        /// <param name="offset">Start index.</param>
        /// <param name="since">Date filter.</param>
        public static KipptClipCollection GetFavoriteClips(KipptClient client, int limit = 0, int offset = 0, DateTime? since = null)
        {
            Dictionary<string, object> parameters = new Dictionary<string, object>();

            if (limit > 0) parameters.Add("limit", limit);
            if (offset > 0) parameters.Add("offset", offset);
            if (since != null) parameters.Add("since", Utils.ToUnixTime((DateTime)since));

            return client.Api<KipptClipCollection>(ApiCommand.ClipFavorites, HttpMethod.Get, parameters);
        }