/// <summary>
 /// Initializes a new instance of the <see cref="HomeTimelineCommand"/> class.
 /// </summary>
 /// <param name="tokens">The request tokens.</param>
 /// <param name="optionalProperties">The optional properties.</param>
 public HomeTimelineCommand(OAuthTokens tokens, TimelineOptions optionalProperties)
     : base(HttpMethod.Get, "statuses/home_timeline.json", tokens, optionalProperties)
 {
     if (tokens == null)
     {
         throw new ArgumentNullException("tokens");
     }
 }
Пример #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MentionsCommand"/> class.
 /// </summary>
 /// <param name="tokens">The request tokens.</param>
 /// <param name="options">The options.</param>
 public MentionsCommand(OAuthTokens tokens, TimelineOptions options)
     : base(HttpMethod.Get, "statuses/mentions.json", tokens, options)
 {
     if (tokens == null)
     {
         throw new ArgumentNullException("tokens");
     }
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="UserTimelineCommand"/> class.
        /// </summary>
        /// <param name="tokens">The request tokens.</param>
        /// <param name="options">The options.</param>
        public UserTimelineCommand(OAuthTokens tokens, UserTimelineOptions options)
            : base(HttpMethod.Get, "statuses/user_timeline.json", tokens, options)
        {
            if (tokens == null && options == null)
            {
                throw new ArgumentException("You must supply either OAuth tokens or identify a user in the TimelineOptions class.");
            }

            if (options != null && tokens == null && string.IsNullOrEmpty(options.ScreenName) && options.UserId <= 0)
            {
                throw new ArgumentException("You must specify a user's screen name or id for unauthorized requests.");
            }
        }
Пример #4
0
        /// <summary>
        ///   Initializes a new instance of the <see cref = "Stream" /> class.
        /// </summary>
        /// <param name = "tokens">The tokens.</param>
        /// <param name = "userAgent">The user agent string which shall include the version of your client.</param>
        /// <param name = "streamoptions">The stream or user stream options to intially use when starting the stream.</param>
        public Stream(OAuthTokens tokens, string userAgent, StreamOptions streamoptions)
        {
            // No non-silverlight user-agent as Assembly.GetName() isn't supported and setting the request.UserAgent is also not supported.
            if (string.IsNullOrEmpty(userAgent))
            {
                this.userAgent = string.Format(
                    CultureInfo.InvariantCulture,
                    "Twitterizer/{0}",
                    String.Empty); //Assembly.GetExecutingAssembly().GetName().Version);
            }
            else
            {
                this.userAgent = string.Format(
                    CultureInfo.InvariantCulture,
                    "{0} (via Twitterizer/{1})",
                    userAgent,
                    String.Empty); //Assembly.GetExecutingAssembly().GetName().Version);
            }
            Tokens = tokens;

            if (streamoptions != null)
                StreamOptions = streamoptions;
        }