Exemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="FriendsIdsCommand"/> class.
        /// </summary>
        /// <param name="requestTokens">The request tokens.</param>
        /// <param name="options">The options.</param>
        public FriendsIdsCommand(OAuthTokens requestTokens, UsersIdsOptions options)
            : base(HTTPVerb.GET, string.Format(CultureInfo.CurrentCulture, "friends/ids.json"), requestTokens, options)
        {
            if (requestTokens == null)
            {
                throw new ArgumentNullException("requestTokens");
            }

            this.DeserializationHandler = UserIdCollection.DeserializeWrapper;
        }
Exemplo n.º 2
0
        /// <summary>
        /// Initializes the command.
        /// </summary>
        public override void Init()
        {
            UsersIdsOptions options = this.OptionalProperties as UsersIdsOptions;

            if (options == null)
            {
                this.RequestParameters.Add("cursor", "-1");
                return;
            }

            if (options.UserId > 0)
            {
                this.RequestParameters.Add("user_id", options.UserId.ToString(CultureInfo.InvariantCulture.NumberFormat));
            }

            if (!string.IsNullOrEmpty(options.ScreenName))
            {
                this.RequestParameters.Add("screen_name", options.ScreenName);
            }

            this.RequestParameters.Add("cursor", options.Cursor > 0 ? options.Cursor.ToString(CultureInfo.InvariantCulture) : "-1");
        }