{ "media_ids", "10,20" },
{ "auto_populate_reply_metadata", "true" },
{ "exclude_reply_user_ids", "100,200" },
+ { "attachment_url", "https://twitter.com/twitterapi/status/22634515958" },
})
)
.ReturnsAsync(LazyJson.Create(new TwitterStatus()));
twitterApi.apiConnection = mock.Object;
await twitterApi.StatusesUpdate("hogehoge", replyToId: 100L, mediaIds: new[] { 10L, 20L },
- autoPopulateReplyMetadata: true, excludeReplyUserIds: new[] { 100L, 200L })
+ autoPopulateReplyMetadata: true, excludeReplyUserIds: new[] { 100L, 200L },
+ attachmentUrl: "https://twitter.com/twitterapi/status/22634515958")
.IgnoreResponse()
.ConfigureAwait(false);
}
public Task<LazyJson<TwitterStatus>> StatusesUpdate(string status, long? replyToId, IReadOnlyList<long> mediaIds,
- bool? autoPopulateReplyMetadata = null, IReadOnlyList<long> excludeReplyUserIds = null)
+ bool? autoPopulateReplyMetadata = null, IReadOnlyList<long> excludeReplyUserIds = null, string attachmentUrl = null)
{
var endpoint = new Uri("statuses/update.json", UriKind.Relative);
var param = new Dictionary<string, string>
param["auto_populate_reply_metadata"] = autoPopulateReplyMetadata.Value ? "true" : "false";
if (excludeReplyUserIds != null && excludeReplyUserIds.Count > 0)
param["exclude_reply_user_ids"] = string.Join(",", excludeReplyUserIds);
+ if (attachmentUrl != null)
+ param["attachment_url"] = attachmentUrl;
return this.apiConnection.PostLazyAsync<TwitterStatus>(endpoint, param);
}
/// メディアのアップロードとツイートの投稿を行います
/// </summary>
/// <exception cref="WebApiException"/>
- Task PostStatusAsync(string text, long? inReplyToStatusId, IMediaItem[] mediaItems, long[] excludeReplyUserIds);
+ Task PostStatusAsync(string text, long? inReplyToStatusId, IMediaItem[] mediaItems, long[] excludeReplyUserIds, string attachmentUrl);
/// <summary>
/// 画像URLのために確保する必要のある文字数を返します
return MaxFileSize;
}
- public async Task PostStatusAsync(string text, long? inReplyToStatusId, IMediaItem[] mediaItems, long[] excludeReplyUserIds)
+ public async Task PostStatusAsync(string text, long? inReplyToStatusId, IMediaItem[] mediaItems,
+ long[] excludeReplyUserIds, string attachmentUrl)
{
if (mediaItems == null)
throw new ArgumentNullException(nameof(mediaItems));
var textWithImageUrl = text + " " + imageUrl.Trim();
- await this.twitter.PostStatus(textWithImageUrl, inReplyToStatusId, excludeReplyUserIds: excludeReplyUserIds)
+ await this.twitter.PostStatus(textWithImageUrl, inReplyToStatusId, excludeReplyUserIds: excludeReplyUserIds, attachmentUrl: attachmentUrl)
.ConfigureAwait(false);
}
return MaxFileSize;
}
- public async Task PostStatusAsync(string text, long? inReplyToStatusId, IMediaItem[] mediaItems, long[] excludeReplyUserIds)
+ public async Task PostStatusAsync(string text, long? inReplyToStatusId, IMediaItem[] mediaItems,
+ long[] excludeReplyUserIds, string attachmentUrl)
{
if (mediaItems == null)
throw new ArgumentNullException(nameof(mediaItems));
var textWithImageUrl = text + " " + imageUrlElm.Value.Trim();
- await this.twitter.PostStatus(textWithImageUrl, inReplyToStatusId, excludeReplyUserIds: excludeReplyUserIds)
+ await this.twitter.PostStatus(textWithImageUrl, inReplyToStatusId, excludeReplyUserIds: excludeReplyUserIds, attachmentUrl: attachmentUrl)
.ConfigureAwait(false);
}
return this.twitterConfig.PhotoSizeLimit;
}
- public async Task PostStatusAsync(string text, long? inReplyToStatusId, IMediaItem[] mediaItems, long[] excludeReplyUserIds)
+ public async Task PostStatusAsync(string text, long? inReplyToStatusId, IMediaItem[] mediaItems,
+ long[] excludeReplyUserIds, string attachmentUrl)
{
if (mediaItems == null)
throw new ArgumentNullException(nameof(mediaItems));
var mediaIds = await Task.WhenAll(uploadTasks)
.ConfigureAwait(false);
- await this.tw.PostStatus(text, inReplyToStatusId, mediaIds, excludeReplyUserIds)
+ await this.tw.PostStatus(text, inReplyToStatusId, mediaIds, excludeReplyUserIds, attachmentUrl)
.ConfigureAwait(false);
}
public long? inReplyToId = null;
public string inReplyToName = null;
public long[] excludeReplyUserIds = null;
+ public string attachmentUrl = null;
public string imageService = ""; //画像投稿サービス名
public IMediaItem[] mediaItems = null;
public PostingStatus()
{
if (status.mediaItems == null || status.mediaItems.Length == 0)
{
- await this.tw.PostStatus(status.status, status.inReplyToId, excludeReplyUserIds: status.excludeReplyUserIds)
+ await this.tw.PostStatus(status.status, status.inReplyToId, excludeReplyUserIds: status.excludeReplyUserIds, attachmentUrl: status.attachmentUrl)
.ConfigureAwait(false);
}
else
{
var service = ImageSelector.GetService(status.imageService);
- await service.PostStatusAsync(status.status, status.inReplyToId, status.mediaItems, status.excludeReplyUserIds)
+ await service.PostStatusAsync(status.status, status.inReplyToId, status.mediaItems, status.excludeReplyUserIds, status.attachmentUrl)
.ConfigureAwait(false);
}
});
}
public async Task PostStatus(string postStr, long? reply_to, IReadOnlyList<long> mediaIds = null,
- IReadOnlyList<long> excludeReplyUserIds = null)
+ IReadOnlyList<long> excludeReplyUserIds = null, string attachmentUrl = null)
{
this.CheckAccountState();
autoPopulateReplyMetadata = true;
var response = await this.Api.StatusesUpdate(postStr, reply_to, mediaIds,
- autoPopulateReplyMetadata, excludeReplyUserIds)
+ autoPopulateReplyMetadata, excludeReplyUserIds, attachmentUrl)
.ConfigureAwait(false);
var status = await response.LoadJsonAsync()