Interface IAutomationProfileService
Represents a service for managing event automation.
Namespace: DataWeb.Automation
Assembly: DataWeb.Core.dll
Syntax
public interface IAutomationProfileService
Properties
AutomationAppSettings
Gets the automation application settings loaded from configuration.
Declaration
AutomationAppSettings AutomationAppSettings { get; }
Property Value
| Type | Description |
|---|---|
| AutomationAppSettings |
Methods
CloneProfileAsync(AutomationProfile, string, AutomationProfileStatus, CancellationToken)
Clona un AutomationProfile esistente creando un nuovo profilo associato all'email di destinazione.
Declaration
Task<AutomationProfile> CloneProfileAsync(AutomationProfile automationProfile, string targetEmail, AutomationProfileStatus status = AutomationProfileStatus.Inactive, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| AutomationProfile | automationProfile | Il profilo di origine da clonare. |
| string | targetEmail | L'indirizzo email del nuovo profilo clonato. |
| AutomationProfileStatus | status | (Opzionale) Lo stato da assegnare al profilo clonato. Il valore predefinito è Inactive. |
| CancellationToken | cancellationToken | Token di cancellazione per interrompere l'operazione asincrona se necessario. |
Returns
| Type | Description |
|---|---|
| Task<AutomationProfile> | Il nuovo AutomationProfile clonato e salvato. |
Exceptions
| Type | Condition |
|---|---|
| Exception | Viene generata se l' |
DeleteAsync(string, string, CancellationToken)
Asynchronously deletes the status of an automation profile.
Declaration
Task DeleteAsync(string automationProfileId, string automationProfileEmail, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| string | automationProfileId | The unique identifier of the automation profile. |
| string | automationProfileEmail | The email associated with the automation profile, used for partitioning or tracking. |
| CancellationToken | cancellationToken | A token to observe while waiting for the task to complete (optional). |
Returns
| Type | Description |
|---|---|
| Task | A task that represents the asynchronous operation. |
DeleteFromStorageAsync(string, string, CancellationToken)
Asynchronously deletes from storage the status of an automation profile.
Declaration
Task DeleteFromStorageAsync(string automationProfileId, string automationProfileEmail, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| string | automationProfileId | The unique identifier of the automation profile. |
| string | automationProfileEmail | The email associated with the automation profile, used for partitioning or tracking. |
| CancellationToken | cancellationToken | A token to observe while waiting for the task to complete (optional). |
Returns
| Type | Description |
|---|---|
| Task | A task that represents the asynchronous operation. |
GetProfileAsync(AutomationProfileFilter, CancellationToken)
Retrieves an automation profile based on the specified filter.
Declaration
Task<AutomationProfile> GetProfileAsync(AutomationProfileFilter filter, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| AutomationProfileFilter | filter | The filter to apply when searching for profile. |
| CancellationToken | cancellationToken | A token to cancel the operation. |
Returns
| Type | Description |
|---|---|
| Task<AutomationProfile> | A list of matching automation profile. |
GetProfileCountAsync(AutomationProfileFilter, CancellationToken)
Asynchronously retrieves the count of automation profiles that match the specified filter.
Declaration
Task<long> GetProfileCountAsync(AutomationProfileFilter filter, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| AutomationProfileFilter | filter | The filter used to query automation profiles. |
| CancellationToken | cancellationToken | A token to cancel the asynchronous operation (optional). |
Returns
| Type | Description |
|---|---|
| Task<long> | The number of matching automation profiles as a long. |
GetProfilesAsync(AutomationProfileFilter, CancellationToken)
Retrieves a list of automation profiles based on the specified filter.
Declaration
Task<IEnumerable<AutomationProfile>> GetProfilesAsync(AutomationProfileFilter filter, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| AutomationProfileFilter | filter | The filter to apply when searching for profiles. |
| CancellationToken | cancellationToken | A token to cancel the operation. |
Returns
| Type | Description |
|---|---|
| Task<IEnumerable<AutomationProfile>> | A list of matching automation profiles. |
NewsletterSubscribeAsync(AutomationProfile, CancellationToken)
Subscribes the given automationProfile to the newsletter if not already active or blocked.
Declaration
Task NewsletterSubscribeAsync(AutomationProfile automationProfile, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| AutomationProfile | automationProfile | The automation profile to update with newsletter subscription status. |
| CancellationToken | cancellationToken | Optional token to cancel the asynchronous operation. |
Returns
| Type | Description |
|---|---|
| Task |
Remarks
If the profile's newsletter status is neither Active nor Blocked, it will be set to Active, the subscription date will be updated to the current local time, and the changes will be persisted.
ProfileExistsAsync(AutomationProfileFilter, CancellationToken)
Determines whether an automation profile exists based on the specified filter.
Declaration
Task<bool> ProfileExistsAsync(AutomationProfileFilter filter, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| AutomationProfileFilter | filter | The filter to apply when checking for the profile. |
| CancellationToken | cancellationToken | A token to cancel the operation. |
Returns
| Type | Description |
|---|---|
| Task<bool> | True if the profile exists; otherwise, false. |
ProtectProfilePayload(string, string)
Protects profile data (email and taskId) by creating a secure payload.
Declaration
string ProtectProfilePayload(string email, string taskId)
Parameters
| Type | Name | Description |
|---|---|---|
| string | The email address associated with the profile. |
|
| string | taskId | The identifier of the task associated with the profile. |
Returns
| Type | Description |
|---|---|
| string | A protected string that contains the email and taskId separated by a semicolon. |
Exceptions
| Type | Condition |
|---|---|
| Exception | Thrown when |
SetModificationDateAsync(string, string, DateTimeOffset, CancellationToken)
Asynchronously sets the newsletter subscription date of an automation profile.
Declaration
Task SetModificationDateAsync(string automationProfileId, string automationProfileEmail, DateTimeOffset modificationDate, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| string | automationProfileId | The unique identifier of the automation profile. |
| string | automationProfileEmail | The email associated with the automation profile, used for partitioning or tracking. |
| DateTimeOffset | modificationDate | The new date to be set for the automation profile. |
| CancellationToken | cancellationToken | A token to observe while waiting for the task to complete (optional). |
Returns
| Type | Description |
|---|---|
| Task | A task that represents the asynchronous operation. |
SetNewsletterStatusAsync(string, string, AutomationProfileNotificationStatus, CancellationToken)
Asynchronously sets the newsletter status of an automation profile.
Declaration
Task SetNewsletterStatusAsync(string automationProfileId, string automationProfileEmail, AutomationProfileNotificationStatus status, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| string | automationProfileId | The unique identifier of the automation profile. |
| string | automationProfileEmail | The email associated with the automation profile, used for partitioning or tracking. |
| AutomationProfileNotificationStatus | status | The new newsletter status to be set for the automation profile. |
| CancellationToken | cancellationToken | A token to observe while waiting for the task to complete (optional). |
Returns
| Type | Description |
|---|---|
| Task | A task that represents the asynchronous operation. |
SetNewsletterSubscriptionDateAsync(string, string, DateTimeOffset, CancellationToken)
Asynchronously sets the newsletter subscription date of an automation profile.
Declaration
Task SetNewsletterSubscriptionDateAsync(string automationProfileId, string automationProfileEmail, DateTimeOffset newsletterSubscriptionDate, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| string | automationProfileId | The unique identifier of the automation profile. |
| string | automationProfileEmail | The email associated with the automation profile, used for partitioning or tracking. |
| DateTimeOffset | newsletterSubscriptionDate | The new date to be set for the automation profile. |
| CancellationToken | cancellationToken | A token to observe while waiting for the task to complete (optional). |
Returns
| Type | Description |
|---|---|
| Task | A task that represents the asynchronous operation. |
SetNotificationAppStatusAsync(string, string, AutomationProfileNotificationStatus, CancellationToken)
Asynchronously sets the app notification status of an automation profile.
Declaration
Task SetNotificationAppStatusAsync(string automationProfileId, string automationProfileEmail, AutomationProfileNotificationStatus status, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| string | automationProfileId | The unique identifier of the automation profile. |
| string | automationProfileEmail | The email associated with the automation profile, used for partitioning or tracking. |
| AutomationProfileNotificationStatus | status | The new notification status to be set for the automation profile. |
| CancellationToken | cancellationToken | A token to observe while waiting for the task to complete (optional). |
Returns
| Type | Description |
|---|---|
| Task | A task that represents the asynchronous operation. |
SetNotificationEmailStatusAsync(string, string, AutomationProfileNotificationStatus, CancellationToken)
Asynchronously sets the email notification status of an automation profile.
Declaration
Task SetNotificationEmailStatusAsync(string automationProfileId, string automationProfileEmail, AutomationProfileNotificationStatus status, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| string | automationProfileId | The unique identifier of the automation profile. |
| string | automationProfileEmail | The email associated with the automation profile, used for partitioning or tracking. |
| AutomationProfileNotificationStatus | status | The new notification status to be set for the automation profile. |
| CancellationToken | cancellationToken | A token to observe while waiting for the task to complete (optional). |
Returns
| Type | Description |
|---|---|
| Task | A task that represents the asynchronous operation. |
SetNotificationPhoneStatusAsync(string, string, AutomationProfileNotificationStatus, CancellationToken)
Asynchronously sets the phone notification status of an automation profile.
Declaration
Task SetNotificationPhoneStatusAsync(string automationProfileId, string automationProfileEmail, AutomationProfileNotificationStatus status, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| string | automationProfileId | The unique identifier of the automation profile. |
| string | automationProfileEmail | The email associated with the automation profile, used for partitioning or tracking. |
| AutomationProfileNotificationStatus | status | The new notification status to be set for the automation profile. |
| CancellationToken | cancellationToken | A token to observe while waiting for the task to complete (optional). |
Returns
| Type | Description |
|---|---|
| Task | A task that represents the asynchronous operation. |
SetProfileAsync(AutomationProfile, bool, CancellationToken)
Asynchronously adds an automation profile to the store.
Declaration
Task SetProfileAsync(AutomationProfile automationProfile, bool keepExistingModificationDate = false, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| AutomationProfile | automationProfile | The AutomationProfile to add to the store. |
| bool | keepExistingModificationDate | |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task | A task that represents the asynchronous operation. |
SetProfileAsync(string, string, string, string, string, List<string>, List<string>, string, AutomationProfileNotificationStatus, AutomationProfileNotificationStatus, AutomationProfileNotificationStatus, AutomationProfileNotificationStatus, Dictionary<string, object>, CancellationToken)
Creates or updates an automation profile associated with the specified email address.
Declaration
Task<AutomationProfileService.ProfileEditResult> SetProfileAsync(string email, string phoneNumber = null, string culture = null, string country = null, string zone = null, List<string> interests = null, List<string> groups = null, string source = "Automation", AutomationProfileNotificationStatus notificationEmailStatus = AutomationProfileNotificationStatus.Active, AutomationProfileNotificationStatus notificationAppStatus = AutomationProfileNotificationStatus.Active, AutomationProfileNotificationStatus notificationPhoneStatus = AutomationProfileNotificationStatus.Inactive, AutomationProfileNotificationStatus newsletterStatus = AutomationProfileNotificationStatus.Inactive, Dictionary<string, object> properties = null, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| string | The email address identifying the profile. This parameter is required. |
|
| string | phoneNumber | The phone number to associate with the profile. Optional. |
| string | culture | The culture code (e.g., "en-US") for localization. Optional. |
| string | country | The country associated with the profile. Optional. |
| string | zone | The time zone or geographical zone. Optional. |
| List<string> | interests | A list of interest tags to associate with the profile. Optional. |
| List<string> | groups | A list of group identifiers to associate with the profile. Optional. |
| string | source | The source of the profile creation or update (e.g., "Automation"). |
| AutomationProfileNotificationStatus | notificationEmailStatus | The email notification status for the profile. |
| AutomationProfileNotificationStatus | notificationAppStatus | The in-app notification status for the profile. |
| AutomationProfileNotificationStatus | notificationPhoneStatus | The phone notification status for the profile. |
| AutomationProfileNotificationStatus | newsletterStatus | The newsletter subscription status for the profile. |
| Dictionary<string, object> | properties | A dictionary of additional properties to associate with the profile. Optional. |
| CancellationToken | cancellationToken | Token for canceling the asynchronous operation. |
Returns
| Type | Description |
|---|---|
| Task<AutomationProfileService.ProfileEditResult> | A ProfileEditResult indicating the result of the operation, including whether a new profile was created. |
Exceptions
| Type | Condition |
|---|---|
| Exception | Thrown when the |
SetStatusAsync(string, string, AutomationProfileStatus, CancellationToken)
Asynchronously sets the status of an automation profile.
Declaration
Task SetStatusAsync(string automationProfileId, string automationProfileEmail, AutomationProfileStatus status, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| string | automationProfileId | The unique identifier of the automation profile. |
| string | automationProfileEmail | The email associated with the automation profile, used for partitioning or tracking. |
| AutomationProfileStatus | status | The new status to be set for the automation profile. |
| CancellationToken | cancellationToken | A token to observe while waiting for the task to complete (optional). |
Returns
| Type | Description |
|---|---|
| Task | A task that represents the asynchronous operation. |
UnprotectProfilePayload(string)
Decrypts and returns the profile payload data.
Declaration
AutomationProfileService.ProfilePayload UnprotectProfilePayload(string payload)
Parameters
| Type | Name | Description |
|---|---|---|
| string | payload | The protected string containing the email and taskId. |
Returns
| Type | Description |
|---|---|
| AutomationProfileService.ProfilePayload | A ProfilePayload object containing the email and taskId. |