Show / Hide Table of Contents

Class WebhookTransmitter

Default implementation of IWebhookTransmitter

Inheritance
object
WebhookTransmitter
Implements
IWebhookTransmitter
Inherited Members
object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
Namespace: SuperOffice.CRM.Webhooks
Assembly: SoDataBase.BusinessLogic.dll
Syntax
public class WebhookTransmitter : IWebhookTransmitter

Constructors

WebhookTransmitter(IDelayedAsyncQueue<RetryWebhook>, ICustomProxyConfiguration, ILogger<WebhookTransmitter>)

Default implementation of IWebhookTransmitter

Declaration
public WebhookTransmitter(IDelayedAsyncQueue<RetryWebhook> retryList, ConfigFile.ICustomProxyConfiguration customProxyConfig, ILogger<WebhookTransmitter> logger)
Parameters
Type Name Description
IDelayedAsyncQueue<RetryWebhook> retryList
ConfigFile.ICustomProxyConfiguration customProxyConfig
ILogger<WebhookTransmitter> logger

Methods

AddHeadersToWebHookRequest(Webhook, WebhookPayload, HttpRequestMessage, JObject, int, bool)

Default implementation of IWebhookTransmitter

Declaration
protected void AddHeadersToWebHookRequest(Webhook webhook, WebhookPayload eventInfo, HttpRequestMessage request, JObject body, int retryCount, bool isTest)
Parameters
Type Name Description
Webhook webhook
WebhookPayload eventInfo
HttpRequestMessage request
JObject body
int retryCount
bool isTest

CallWebhookAsync(Webhook, WebhookPayload, CancellationToken, int, bool)

Broadcast the event to all subscribers, and mark failures/success status on the passed webhook objects.

Declaration
public Task<WebhookResponse> CallWebhookAsync(Webhook webhook, WebhookPayload eventInfo, CancellationToken cancellationToken, int maxRetries = 3, bool isTest = false)
Parameters
Type Name Description
Webhook webhook

Inform the given webhook that the event has occurred.

WebhookPayload eventInfo

Event name, unique id and details

CancellationToken cancellationToken
int maxRetries
bool isTest
Returns
Type Description
Task<WebhookResponse>

Success/Failure information. NULL is taken as SUCCESS

CreateWebHookRequestBody(Webhook, WebhookPayload)

Default implementation of IWebhookTransmitter

Declaration
protected JObject CreateWebHookRequestBody(Webhook webhook, WebhookPayload payload)
Parameters
Type Name Description
Webhook webhook
WebhookPayload payload
Returns
Type Description
JObject

ProcessRetryAttemptAsync(IAsyncQueueProcessItemContext<DelayedItem<RetryWebhook>>, CancellationToken)

Process retry attempts, that has been added to a queue.

Declaration
public Task<WebhookResponse> ProcessRetryAttemptAsync(IAsyncQueueProcessItemContext<DelayedItem<RetryWebhook>> context, CancellationToken cancellationToken)
Parameters
Type Name Description
IAsyncQueueProcessItemContext<DelayedItem<RetryWebhook>> context
CancellationToken cancellationToken
Returns
Type Description
Task<WebhookResponse>

RetryWebhookAsync(RetryWebhook, CancellationToken)

Default implementation of IWebhookTransmitter

Declaration
public Task<WebhookResponse> RetryWebhookAsync(RetryWebhook retry, CancellationToken cancellationToken)
Parameters
Type Name Description
RetryWebhook retry
CancellationToken cancellationToken
Returns
Type Description
Task<WebhookResponse>

SendHttpRequestAsync(WebhookPayload, HttpRequestMessage, WebhookResponse, CancellationToken)

Default implementation of IWebhookTransmitter

Declaration
protected virtual Task SendHttpRequestAsync(WebhookPayload eventInfo, HttpRequestMessage request, WebhookResponse result, CancellationToken cancellationToken)
Parameters
Type Name Description
WebhookPayload eventInfo
HttpRequestMessage request
WebhookResponse result
CancellationToken cancellationToken
Returns
Type Description
Task

SendWebhookAsync(RetryWebhook, WebhookResponse, CancellationToken)

Default implementation of IWebhookTransmitter

Declaration
protected Task SendWebhookAsync(RetryWebhook retry, WebhookResponse result, CancellationToken cancellationToken)
Parameters
Type Name Description
RetryWebhook retry
WebhookResponse result
CancellationToken cancellationToken
Returns
Type Description
Task

ServerCertificateCustomValidationCallback(object, X509Certificate, X509Chain, SslPolicyErrors)

Verify SSL certificate is ok, deny bogus SSL certs

Declaration
protected static bool ServerCertificateCustomValidationCallback(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors)
Parameters
Type Name Description
object sender
X509Certificate certificate
X509Chain chain
SslPolicyErrors sslPolicyErrors
Returns
Type Description
bool

True if SSL cert is ok

SignWebHookRequest(Webhook, WebhookPayload, HttpRequestMessage, JObject)

Default implementation of IWebhookTransmitter

Declaration
protected void SignWebHookRequest(Webhook webhook, WebhookPayload eventInfo, HttpRequestMessage request, JObject body)
Parameters
Type Name Description
Webhook webhook
WebhookPayload eventInfo
HttpRequestMessage request
JObject body

Implements

IWebhookTransmitter

Extension Methods

EnumUtil.MapEnums<From, To>(From)
Converters.MapEnums<From, To>(From)
© SuperOffice. All rights reserved.
SuperOffice |  Community |  Release Notes |  Privacy |  Site feedback |  Search Docs |  About Docs |  Contribute |  Back to top