public async Task <IEnumerable <ConnectorEntity> > Get([FromUri] string jobType, [FromUri] string jobId) { CloudTable jobMappingTable = azureTableProviderInstance.GetAzureTableReference(Settings.PageJobMappingTableName); Trace.TraceInformation("Getting connector Entities for JobType {0}", jobType.ToString()); IEnumerable <ConnectorEntity> entities = await sourceProvider.GetEntities(jobId); Trace.TraceInformation("Entities retrieved: {0}", entities?.Count()); if (entities != null) { foreach (ConnectorEntity entity in entities) { Expression <Func <PageJobEntity, bool> > filter = (e => e.PartitionKey == entity.Id); List <PageJobEntity> pageJobEntityList = await azureTableProviderInstance.QueryEntitiesAsync <PageJobEntity>(jobMappingTable, filter); entity.AlreadyUsed = pageJobEntityList.Any(); } } IEnumerable <ConnectorEntity> response = new List <ConnectorEntity>(); response = entities; return(response); }
public async Task UpdateSourceInfo(ConnectorTask taskInfo, SourceInfoTwitter twitterSourceInfo) { PageJobMappingTable = azureTableProviderInstance.GetAzureTableReference(Settings.PageJobMappingTableName); Expression <Func <PageJobEntity, bool> > filter = (entity => entity.RowKey == taskInfo.JobId); CloudTable pageJobMappingTable = azureTableProviderInstance.GetAzureTableReference(Settings.PageJobMappingTableName); List <PageJobEntity> pageJobEntityList = await azureTableProviderInstance.QueryEntitiesAsync <PageJobEntity>(pageJobMappingTable, filter); PageJobEntity pageJobEntity = pageJobEntityList[0]; pageJobEntity.SourceInfo = JsonConvert.SerializeObject(twitterSourceInfo); await azureTableProviderInstance.InsertOrReplaceEntityAsync(PageJobMappingTable, pageJobEntity); }
public async Task <bool> ConnectorOAuth([FromUri] string jobId) { CloudTable jobMappingTable = azureTableProvider.GetAzureTableReference(Settings.PageJobMappingTableName); Expression <Func <PageJobEntity, bool> > filter = (entity => entity.RowKey == jobId); List <PageJobEntity> pageJobEntityList = await azureTableProvider.QueryEntitiesAsync <PageJobEntity>(jobMappingTable, filter); if (!pageJobEntityList.Any()) { return(false); } Trace.TraceInformation("Job with JobId: {0} successfully set up", jobId); PageJobEntity pageJobEntity = pageJobEntityList?[0]; return(true); }
private async Task <PageJobEntity> GetJobIdFromTable(string jobId) { Expression <Func <PageJobEntity, bool> > filter = (entity => entity.RowKey == jobId); pageJobMappingTable = azureTableProviderInstance.GetAzureTableReference(Settings.PageJobMappingTableName); List <PageJobEntity> pageJobEntityList = await azureTableProviderInstance.QueryEntitiesAsync <PageJobEntity>(pageJobMappingTable, filter); return(pageJobEntityList?[0]); }
public async Task <HttpResponseMessage> ConnectorOAuth([FromUri] string jobId) { HttpRequestMessage request = new HttpRequestMessage(); var configuration = new HttpConfiguration(); request.SetConfiguration(configuration); CloudTable jobMappingTable = azureTableProvider.GetAzureTableReference(Settings.PageJobMappingTableName); Expression <Func <PageJobEntity, bool> > filter = (entity => entity.RowKey == jobId); List <PageJobEntity> pageJobEntityList = await azureTableProvider.QueryEntitiesAsync <PageJobEntity>(jobMappingTable, filter); if (!pageJobEntityList.Any()) { return(request.CreateResponse <JobCreationResponse>(HttpStatusCode.OK, new JobCreationResponse(false, null))); } Trace.TraceInformation("Job with JobId: {0} successfully set up", jobId); return(request.CreateResponse <JobCreationResponse>(HttpStatusCode.OK, new JobCreationResponse(true, null))); }
public async Task <bool> Configure([FromBody] Dictionary <string, string> configSettings) { SettingsTable = azureTableProvider.GetAzureTableReference(Settings.ConfigurationSettingsTableName); if (!string.IsNullOrEmpty(configSettings["TwitterAppIdValue"])) { SettingsTwitter.TwitterAppId = configSettings["TwitterAppIdValue"]; await azureTableProvider.InsertOrReplaceEntityAsync(SettingsTable, new ConfigurationSettingsEntity("TwitterAppId", configSettings["TwitterAppIdValue"])); } if (!string.IsNullOrEmpty(configSettings["TwitterAppSecretValue"])) { SettingsTwitter.TwitterAppSecret = configSettings["TwitterAppSecretValue"]; await azureTableProvider.InsertOrReplaceEntityAsync(SettingsTable, new ConfigurationSettingsEntity("TwitterAppSecret", configSettings["TwitterAppSecretValue"])); } if (!string.IsNullOrEmpty(configSettings["TwitterClientTokenValue"])) { SettingsTwitter.TwitterClientToken = configSettings["TwitterClientTokenValue"]; await azureTableProvider.InsertOrReplaceEntityAsync(SettingsTable, new ConfigurationSettingsEntity("TwitterClientToken", configSettings["TwitterClientTokenValue"])); } if (!string.IsNullOrEmpty(configSettings["TwitterClientTokenSecretValue"])) { SettingsTwitter.TwitterClientSecret = configSettings["TwitterClientTokenSecretValue"]; await azureTableProvider.InsertOrReplaceEntityAsync(SettingsTable, new ConfigurationSettingsEntity("TwitterClientSecret", configSettings["TwitterClientTokenSecretValue"])); } if (!string.IsNullOrEmpty(configSettings["AADAppIdValue"])) { Settings.AAdAppId = configSettings["AADAppIdValue"]; await azureTableProvider.InsertOrReplaceEntityAsync(SettingsTable, new ConfigurationSettingsEntity("AAdAppId", configSettings["AADAppIdValue"])); } if (!string.IsNullOrEmpty(configSettings["AADAppSecretValue"])) { Settings.AAdAppSecret = configSettings["AADAppSecretValue"]; await azureTableProvider.InsertOrReplaceEntityAsync(SettingsTable, new ConfigurationSettingsEntity("AAdAppSecret", configSettings["AADAppSecretValue"])); } if (!string.IsNullOrEmpty(configSettings["AADAppUriValue"])) { Settings.AADAppUri = configSettings["AADAppUriValue"]; await azureTableProvider.InsertOrReplaceEntityAsync(SettingsTable, new ConfigurationSettingsEntity("AADAppUri", configSettings["AADAppUriValue"])); } if (!string.IsNullOrEmpty(configSettings["InstrumentationKeyValue"])) { Settings.APPINSIGHTS_INSTRUMENTATIONKEY = configSettings["InstrumentationKeyValue"]; await azureTableProvider.InsertOrReplaceEntityAsync(SettingsTable, new ConfigurationSettingsEntity("APPINSIGHTS_INSTRUMENTATIONKEY", configSettings["InstrumentationKeyValue"])); TelemetryConfiguration.Active.InstrumentationKey = configSettings["InstrumentationKeyValue"]; } return(true); }
public async Task <bool> Configure([FromBody] Dictionary <string, string> configSettings) { SettingsTable = azureTableProvider.GetAzureTableReference(Settings.ConfigurationSettingsTableName); if (!string.IsNullOrEmpty(configSettings["TwitterApiKeyValue"])) { SettingsTwitter.TwitterApiKey = configSettings["TwitterApiKeyValue"]; await azureTableProvider.InsertOrReplaceEntityAsync(SettingsTable, new ConfigurationSettingsEntity("TwitterApiKey", configSettings["TwitterApiKeyValue"])); } if (!string.IsNullOrEmpty(configSettings["TwitterApiSecretKeyValue"])) { SettingsTwitter.TwitterApiSecretKey = configSettings["TwitterApiSecretKeyValue"]; await azureTableProvider.InsertOrReplaceEntityAsync(SettingsTable, new ConfigurationSettingsEntity("TwitterApiSecretKey", configSettings["TwitterApiSecretKeyValue"])); } if (!string.IsNullOrEmpty(configSettings["TwitterAccessTokenValue"])) { SettingsTwitter.TwitterAccessToken = configSettings["TwitterAccessTokenValue"]; await azureTableProvider.InsertOrReplaceEntityAsync(SettingsTable, new ConfigurationSettingsEntity("TwitterAccessToken", configSettings["TwitterAccessTokenValue"])); } if (!string.IsNullOrEmpty(configSettings["TwitterAccessTokenSecretValue"])) { SettingsTwitter.TwitterAccessTokenSecret = configSettings["TwitterAccessTokenSecretValue"]; await azureTableProvider.InsertOrReplaceEntityAsync(SettingsTable, new ConfigurationSettingsEntity("TwitterAccessTokenSecret", configSettings["TwitterAccessTokenSecretValue"])); } if (!string.IsNullOrEmpty(configSettings["AADAppIdValue"])) { Settings.AAdAppId = configSettings["AADAppIdValue"]; await azureTableProvider.InsertOrReplaceEntityAsync(SettingsTable, new ConfigurationSettingsEntity("AAdAppId", configSettings["AADAppIdValue"])); } if (!string.IsNullOrEmpty(configSettings["AADAppSecretValue"])) { Settings.AAdAppSecret = configSettings["AADAppSecretValue"]; await azureTableProvider.InsertOrReplaceEntityAsync(SettingsTable, new ConfigurationSettingsEntity("AAdAppSecret", configSettings["AADAppSecretValue"])); } return(true); }
public FacebookProvider(AzureTableProvider azureTableProvider) : base(azureTableProvider, azureTableProvider.GetAzureTableReference(Settings.TokenTableName)) { Client = new RestApiRepository(SettingsFB.FacebookBaseUrl); }
public TwitterProvider(AzureTableProvider azureTableProviderInstance, IRestApiRepository Client, TwitterAuthProvider twitterAuthProvider) : base(azureTableProviderInstance, azureTableProviderInstance.GetAzureTableReference(Settings.TokenTableName)) { this.Client = Client; this.twitterAuthProvider = twitterAuthProvider; }
public TwitterAuthProvider(IRestApiRepository httpClient, AzureTableProvider azureTableProvider) { this.Client = httpClient; this.azureTableProvider = azureTableProvider; PageJobMappingTable = azureTableProvider.GetAzureTableReference(Settings.PageJobMappingTableName); }