/// <summary> /// Initializes the command. /// </summary> public override void Init() { if (this.UserId > 0) { this.RequestParameters.Add("user_id", this.UserId.ToString("#")); } else if (!string.IsNullOrEmpty(this.UserName)) { this.RequestParameters.Add("screen_name", this.UserName); } UpdateFriendshipOptions options = this.OptionalProperties as UpdateFriendshipOptions; if (options != null) { if (options.DeviceNotifications != null) { this.RequestParameters.Add("device", (bool)options.DeviceNotifications ? "true" : "false"); } if (options.ShowRetweets != null) { this.RequestParameters.Add("retweets", (bool)options.ShowRetweets ? "true" : "false"); } } }
/// <summary> /// Initializes a new instance of the <see cref="UpdateFriendshipCommand"/> class. /// </summary> /// <param name="tokens">The request tokens.</param> /// <param name="userName">Name of the user.</param> /// <param name="optionalProperties">The optional properties.</param> public UpdateFriendshipCommand(OAuthTokens tokens, string userName, UpdateFriendshipOptions optionalProperties) : base(HTTPVerb.POST, Path, tokens, optionalProperties) { if (tokens == null) { throw new ArgumentNullException("tokens"); } if (string.IsNullOrEmpty(userName)) { throw new ArgumentNullException("userName"); } this.UserName = userName; }
/// <summary> /// Initializes a new instance of the <see cref="UpdateFriendshipCommand"/> class. /// </summary> /// <param name="tokens">The request tokens.</param> /// <param name="userId">The userid.</param> /// <param name="optionalProperties">The optional properties.</param> public UpdateFriendshipCommand(OAuthTokens tokens, decimal userId, UpdateFriendshipOptions optionalProperties) : base(HTTPVerb.POST, Path, tokens, optionalProperties) { if (tokens == null) { throw new ArgumentNullException("tokens"); } if (userId <= 0) { throw new ArgumentException("userId"); } this.UserId = userId; }