/// <summary> /// Handles Twitter Tweet /// </summary> /// <param name="twitterItemMapper">Transforms Twitter data to Item Schema</param> /// <param name="tweet">Twitter tweet</param> private async Task <ItemMetadata> UploadTweet(TwitterSchemaToItemMapper twitterItemMapper, Tweet tweet, ConnectorTask taskInfo) { Item item = twitterItemMapper.MapTweetToItem(tweet); string fileName = await uploader.UploadItem(taskInfo.JobId, taskInfo.TaskId, item); Trace.TraceInformation("Tweet Uploaded to Azure Blobs"); return(new ItemMetadata(item.Id, item.SentTimeUtc, fileName)); }
/// <summary> /// Constructor /// </summary> public JobProcessorTwitter(IDownloader downloader, IUploader uploader, TwitterSchemaToItemMapper twitterItemMapper) { url = SettingsTwitter.TwitterEndPoint + "/1.1/statuses/user_timeline.json"; AppID = SettingsTwitter.TwitterApiKey; AppSecret = SettingsTwitter.TwitterApiSecretKey; this.twitterItemMapper = twitterItemMapper; this.downloader = downloader; this.uploader = uploader; }
/// <summary> /// Handles Twitter Tweet /// </summary> /// <param name="twitterItemMapper">Transforms Twitter data to Item Schema</param> /// <param name="tweet">Twitter tweet</param> private async Task <List <ItemMetadata> > UploadTweet(TwitterSchemaToItemMapper twitterItemMapper, Tweet tweet, ConnectorTask taskInfo) { List <Item> postItem = await twitterItemMapper.MapTweetToItemList(tweet); List <ItemMetadata> itemMetaDataList = new List <ItemMetadata>(); foreach (var item in postItem) { string fileName = await uploader.UploadItem(taskInfo.JobId, taskInfo.TaskId, item); Trace.TraceInformation("Tweet Uploaded to Azure Blobs"); itemMetaDataList.Add(new ItemMetadata(item.Id, item.SentTimeUtc, fileName)); } return(itemMetaDataList); }