public AzureTentQueues(IGeneralConfiguration configuration, IJsonHelpers jsonHelpers, ITaskHelpers taskHelpers, ILoggingService loggingService) { Ensure.Argument.IsNotNull(configuration, nameof(configuration)); Ensure.Argument.IsNotNull(jsonHelpers, nameof(jsonHelpers)); Ensure.Argument.IsNotNull(taskHelpers, nameof(taskHelpers)); Ensure.Argument.IsNotNull(loggingService, nameof(loggingService)); this.taskHelpers = taskHelpers; this.loggingService = loggingService; // Create the storage account from the connection string, and the corresponding client. var queuesStorageAccount = CloudStorageAccount.Parse(configuration.AzureQueuesConnectionString); var queuesClient = queuesStorageAccount.CreateCloudQueueClient(); // Create the queues references. this.mentionsQueue = queuesClient.GetQueueReference("mentions"); this.subscriptionsQueue = queuesClient.GetQueueReference("subscriptions"); this.appNotificationQueue = queuesClient.GetQueueReference("appnotifications"); this.metaSubscriptionQueue = queuesClient.GetQueueReference("metasubscriptions"); this.retryQueue = queuesClient.GetQueueReference("retries"); // Create the IQueue objects. this.Mentions = new AzureQueue<QueueMentionMessage>(this.mentionsQueue, jsonHelpers); this.Subscriptions = new AzureQueue<QueueSubscriptionMessage>(this.subscriptionsQueue, jsonHelpers); this.AppNotifications = new AzureQueue<QueueAppNotificationMessage>(this.appNotificationQueue, jsonHelpers); this.MetaSubscriptions = new AzureQueue<QueueMetaSubscriptionMessage>(this.metaSubscriptionQueue, jsonHelpers); this.Retries = new AzureQueue<QueueRetryMessage>(this.retryQueue, jsonHelpers); // Create the initializer for this component. this.initializer = new TaskRunner(this.InitializeOnceAsync); }
public HttpRequestFactory(IJsonHelpers jsonHelpers, ITentConstants tentConstants) { Ensure.Argument.IsNotNull(jsonHelpers, nameof(jsonHelpers)); Ensure.Argument.IsNotNull(tentConstants, nameof(tentConstants)); this.jsonHelpers = jsonHelpers; this.tentConstants = tentConstants; }
public HttpClientFactory( IJsonHelpers jsonHelpers, IHttpHelpers httpHelpers) { Ensure.Argument.IsNotNull(jsonHelpers, nameof(jsonHelpers)); Ensure.Argument.IsNotNull(httpHelpers, nameof(httpHelpers)); this.jsonHelpers = jsonHelpers; this.httpHelpers = httpHelpers; }
public Http( IJsonHelpers jsonHelpers, IHttpHelpers httpHelpers) { Ensure.Argument.IsNotNull(jsonHelpers, nameof(jsonHelpers)); Ensure.Argument.IsNotNull(httpHelpers, nameof(httpHelpers)); this.jsonHelpers = jsonHelpers; this.httpHelpers = httpHelpers; }
public AzureQueue( CloudQueue baseQueue, IJsonHelpers jsonHelpers) { Ensure.Argument.IsNotNull(baseQueue, nameof(baseQueue)); Ensure.Argument.IsNotNull(jsonHelpers, nameof(jsonHelpers)); this.baseQueue = baseQueue; this.jsonHelpers = jsonHelpers; }
public override JObject GetCanonicalJson(IJsonHelpers jsonHelpers) { return new JObject { { "category", this.Category }, { "content_type", this.ContentType }, { "name", this.Name }, { "digest", this.Digest }, { "size", this.Size } }; }
public RedisCaches( IJsonHelpers jsonHelpers, IConfiguration configuration) { Ensure.Argument.IsNotNull(jsonHelpers, nameof(jsonHelpers)); Ensure.Argument.IsNotNull(configuration, nameof(configuration)); this.jsonHelpers = jsonHelpers; this.configuration = configuration; // Create the initializer for this component. this.initializer = new TaskRunner(this.InitializeOnceAsync); }
public HttpClient( IJsonHelpers jsonHelpers, IHttpHelpers httpHelpers) { Ensure.Argument.IsNotNull(jsonHelpers, nameof(jsonHelpers)); Ensure.Argument.IsNotNull(httpHelpers, nameof(httpHelpers)); this.jsonHelpers = jsonHelpers; this.httpHelpers = httpHelpers; // Create the underlying HttpClient. this.client = new Native.HttpClient(); }
public override JObject GetCanonicalJson(IJsonHelpers jsonHelpers) { var result = new JObject { { "published_at", this.PublishedAt.GetValueOrDefault().ToUnixTime() }, }; if (this.Parents != null && this.Parents.Any()) { result.Add("parents", jsonHelpers.FromObject(this.Parents.Select(p => p.GetCanonicalJson(jsonHelpers)))); } return result; }
public AwsQueue(IJsonHelpers jsonHelpers, ITextHelpers textHelpers, AmazonSQSClient client, string queueUrl) { Ensure.Argument.IsNotNull(jsonHelpers, nameof(jsonHelpers)); Ensure.Argument.IsNotNull(textHelpers, nameof(textHelpers)); Ensure.Argument.IsNotNull(client, nameof(client)); Ensure.Argument.IsNotNullOrWhiteSpace(queueUrl, nameof(queueUrl)); this.jsonHelpers = jsonHelpers; this.textHelpers = textHelpers; this.client = client; this.queueUrl = queueUrl; }
public override JObject GetCanonicalJson(IJsonHelpers jsonHelpers) { var result = new JObject(); if (!string.IsNullOrWhiteSpace(this.Name)) { result.Add("name", this.Name); } if (!string.IsNullOrWhiteSpace(this.Url)) { result.Add("url", this.Url); } return result; }
public HttpRequest( IJsonHelpers jsonHelpers, IHttpHelpers httpHelpers, Native.HttpClient client, Native.HttpMethod method, Uri target) { Ensure.Argument.IsNotNull(jsonHelpers, nameof(jsonHelpers)); Ensure.Argument.IsNotNull(httpHelpers, nameof(httpHelpers)); Ensure.Argument.IsNotNull(client, nameof(client)); Ensure.Argument.IsNotNull(target, nameof(target)); this.jsonHelpers = jsonHelpers; this.httpHelpers = httpHelpers; this.client = client; this.request = new Native.HttpRequestMessage(method, target); }
public RedisCacheStore( IJsonHelpers jsonHelpers, IConfiguration configuration, IDatabase db) { Ensure.Argument.IsNotNull(jsonHelpers, nameof(jsonHelpers)); Ensure.Argument.IsNotNull(configuration, nameof(configuration)); Ensure.Argument.IsNotNull(db, nameof(db)); this.jsonHelpers = jsonHelpers; this.db = db; // Find the cache key for this resource type. var resourceType = typeof(TCacheResource); this.cacheKeyRoot = configuration.CachePrefixes[resourceType]; }
public override JObject GetCanonicalJson(IJsonHelpers jsonHelpers) { var result = new JObject { {"id", this.Id}, {"created_at", this.CreatedAt.GetValueOrDefault()}, {"updated_at", this.UpdatedAt.GetValueOrDefault()}, {"handle", this.Handle}, {"entity", this.Entity}, {"email", this.Email}, {"password", this.Password}, {"password_salt", this.PasswordSalt}, {"is_bot_followed", this.IsBotFollowed}, {"last_discovery_attempt", this.LastDiscoveryAttempt.GetValueOrDefault()}, {"deleted_at", this.DeletedAt.GetValueOrDefault()} }; return result.Sort(); }
public override JObject GetCanonicalJson(IJsonHelpers jsonHelpers) { var result = new JObject { { "post", this.PostId } }; if (!string.IsNullOrWhiteSpace(this.OriginalEntity)) result.Add("entity", this.OriginalEntity); else if (!string.IsNullOrWhiteSpace(this.Entity)) result.Add("entity", this.Entity); if (!string.IsNullOrWhiteSpace(this.VersionId)) result.Add("version", this.VersionId); if (this.Type != null) result.Add("type", this.Type.ToString()); return result; }
public override JObject GetCanonicalJson(IJsonHelpers jsonHelpers) { // Create the canonical Json object. var result = new JObject { { "version", this.VersionId } }; if (!string.IsNullOrEmpty(this.OriginalEntity)) { result.Add("entity", this.OriginalEntity); } else if (!string.IsNullOrEmpty(this.Entity)) { result.Add("entity", this.Entity); } if (!string.IsNullOrEmpty(this.PostId)) { result.Add("post", this.PostId); } return result; }
public virtual JObject GetCanonicalJson(IJsonHelpers jsonHelpers) { throw new NotImplementedException("This method shouldn't be called on this object."); }