/// <summary> /// Initializes a new instance of the <see cref="MessageQuery"/> class. /// </summary> /// <param name="limit">The returned message limit.</param> /// <param name="trim">The returned message trim / limit options.</param> /// <param name="threaded">The message thread option.</param> public MessageQuery( int limit, MessageQueryTrim trim, MessageQueryThread threaded) { if (limit > 0 && limit != Config.Message.DefaultQueryResponseLimit) { this.Limit = limit; } if (trim != null) { switch (trim.TrimOption) { case MessageQueryTrimOption.OlderThan: this.Older_Than = trim.MessageId; break; case MessageQueryTrimOption.NewerThan: this.Newer_Than = trim.MessageId; break; } } switch (threaded) { case MessageQueryThread.Threaded: this.Threaded = "true"; break; case MessageQueryThread.Extended: this.Threaded = "extended"; break; } }
/// <summary> /// Get all messages liked by the user. /// </summary> /// <remarks> /// UNDOCUMENTED. Use at your own risk. /// </remarks> /// <param name="client">The message client.</param> /// <param name="thread">The message thread option.</param> /// <returns>The <see cref="MessageEnvelope"/>.</returns> public static async Task<MessageEnvelope> GetAllLiked( this MessageClient client, MessageQueryThread thread = MessageQueryThread.NoThread) { var query = new MessageQuery(0, null, thread); var url = client.GetFinalUrl(string.Format("{0}/liked_by.json", Endpoints.Messages), query.SerializeQueryString()); var result = await client.Client.GetAsync<MessageEnvelope>(url); return result.Content; }
/// <summary> /// Get all messages liked by the user. /// </summary> /// <remarks> /// UNDOCUMENTED. Use at your own risk. /// </remarks> /// <param name="client">The message client.</param> /// <param name="thread">The message thread option.</param> /// <returns>The <see cref="MessageEnvelope"/>.</returns> public static async Task <MessageEnvelope> GetAllLiked( this MessageClient client, MessageQueryThread thread = MessageQueryThread.NoThread) { var query = new MessageQuery(0, null, thread); var url = client.GetFinalUrl(string.Format("{0}/liked_by.json", Endpoints.Messages), query.SerializeQueryString()); var result = await client.Client.GetAsync <MessageEnvelope>(url); return(result.Content); }
/// <summary> /// Get the "Following" feed which is conversations involving people, groups and topics that the user is following. /// </summary> /// <param name="limit">The returned message limit.</param> /// <param name="trim">The returned message trim / limit options.</param> /// <param name="thread">The thread options.</param> /// <returns>The <see cref="MessageEnvelope"/>.</returns> public async Task <MessageEnvelope> GetFollowing( int limit = Config.Message.DefaultQueryResponseLimit, MessageQueryTrim trim = null, MessageQueryThread thread = MessageQueryThread.NoThread) { var query = new MessageQuery(limit, trim, thread); var url = this.GetFinalUrl(string.Format("{0}/following.json", Endpoints.Messages), query.SerializeQueryString()); var result = await this.Client.GetAsync <MessageEnvelope>(url); return(result.Content); }
/// <summary> /// Get the algorithmic feed that corresponds to "Top" conversation. /// </summary> /// <param name="limit">The returned message limit.</param> /// <param name="trim">The returned message trim / limit options.</param> /// <param name="thread">The thread options.</param> /// <returns>The <see cref="MessageEnvelope"/>.</returns> public async Task<MessageEnvelope> GetTop( int limit = Config.Message.DefaultQueryResponseLimit, MessageQueryTrim trim = null, MessageQueryThread thread = MessageQueryThread.NoThread) { var query = new MessageQuery(limit, trim, thread); var url = this.GetFinalUrl(string.Format("{0}/algo.json", Endpoints.Messages), query.SerializeQueryString()); var result = await this.Client.GetAsync<MessageEnvelope>(url); return result.Content; }