public async Task DoAsync() { var bucketName = "example-datasets"; var objectName = "tweets_tiny_no_headers.csv"; objectName = "tweets_tiny.csv"; objectName = "tweets.csv"; var mappingName = "tweets.csv.mapping"; objectName = "tweets.apple.json"; mappingName = "tweets.json.mapping"; var attributesDict = new Dictionary <string, string> { { "bucketName", bucketName }, { "objectName", objectName }, { "mappingName", mappingName } }; var attributes = new DataAcquirerAttributes(attributesDict); var guid = Guid.NewGuid(); var daInput = new DataAcquirerInputModel( guid, null, null, attributes, 0 ); var posts = _dataAcquirer.GetPostsAsync(daInput, CancellationToken.None); await foreach (var item in posts) { Console.WriteLine(item.Text); } }
static async Task MainAsync(string[] args) { var services = Configure(); var credentialsOptions = services .GetRequiredService <IOptions <RedditCredentialsOptions> >(); var credentials = credentialsOptions.Value; var redditAcquirer = services.GetRequiredService <IDataAcquirer>(); var attributesDict = new Dictionary <string, string>() { { "appId", credentials.AppId }, { "appSecret", credentials.AppSecret }, { "refreshToken", credentials.RefreshToken } }; var attributes = new DataAcquirerAttributes(attributesDict); var query = "snake bites NOT piercing NOT darts NOT music"; var jobId = Guid.NewGuid(); var inputModel = new DataAcquirerInputModel( jobId, query, null, attributes, 3); var batch = redditAcquirer.GetPostsAsync(inputModel); await foreach (var item in batch) { Console.WriteLine(JsonConvert.SerializeObject(item, Formatting.Indented)); } Console.WriteLine("Search ended"); Console.ReadLine(); }