/// <summary>
        /// Initializes the command.
        /// </summary>
        public override void Init()
        {
            ListStatusesOptions options = this.OptionalProperties as ListStatusesOptions;

            if (options == null)
            {
                this.RequestParameters.Add("page", "1");

                return;
            }

            if (options.SinceId > 0)
            {
                this.RequestParameters.Add("since_id", options.SinceId.ToString(CultureInfo.InvariantCulture));
            }

            if (options.MaxId > 0)
            {
                this.RequestParameters.Add("max_id", options.MaxId.ToString(CultureInfo.InvariantCulture));
            }

            if (options.ItemsPerPage > 0)
            {
                this.RequestParameters.Add("per_page", options.ItemsPerPage.ToString(CultureInfo.InvariantCulture));
            }

            if (options.IncludeEntites)
            {
                this.RequestParameters.Add("include_entities", "true");
            }

            this.RequestParameters.Add("page", options.Page > 0 ? options.Page.ToString(CultureInfo.InvariantCulture) : "1");
        }
        public void GetStatuses()
        {
            ListStatusesOptions options = new ListStatusesOptions();
            TwitterResponse <TwitterStatusCollection> statuses = TwitterList.GetStatuses(Configuration.GetTokens(), userName, listName, options);

            Assert.IsNotNull(statuses);
            Assert.That(statuses.Result == RequestResult.Success);
        }
示例#3
0
        public void GetStatuses()
        {
            ListStatusesOptions options = new ListStatusesOptions();
            TwitterResponse <TwitterStatusCollection> statuses = TwitterList.GetStatuses(Configuration.GetTokens(), userName, listName, options);

            Assert.IsNotNull(statuses, "statuses is null");
            Assert.IsTrue(statuses.Result == RequestResult.Success, statuses.ErrorMessage ?? statuses.Result.ToString());
        }
示例#4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ListStatusesCommand"/> class.
        /// </summary>
        /// <param name="requestTokens">The request tokens.</param>
        /// <param name="username">The username.</param>
        /// <param name="listIdOrSlug">The list id or slug.</param>
        /// <param name="options">The options.</param>
        /// <remarks></remarks>
        public ListStatusesCommand(OAuthTokens requestTokens, string username, string listIdOrSlug, ListStatusesOptions options)
            : base(HTTPVerb.GET, string.Format("{0}/lists/{1}/statuses.json", username, listIdOrSlug), requestTokens, options)
        {
            if (string.IsNullOrEmpty(username))
            {
                throw new ArgumentNullException("username");
            }

            if (string.IsNullOrEmpty(listIdOrSlug))
            {
                throw new ArgumentNullException("listIdOrSlug");
            }
        }