Exemplo n.º 1
0
        /// <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;
            }
        }
Exemplo n.º 2
0
        /// <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);
        }
Exemplo n.º 3
0
        /// <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;
        }
Exemplo n.º 4
0
        /// <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;
            }
        }