Interface IAutomationProfileService
Represents a service for managing automation profiles.
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)
Clones an AutomationProfile by creating a new profile associated with the target email address.
Declaration
Task<AutomationProfile> CloneProfileAsync(AutomationProfile automationProfile, string targetEmail, AutomationProfileStatus status = AutomationProfileStatus.Inactive, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| AutomationProfile | automationProfile | The source profile to clone. |
| string | targetEmail | The email address to associate with the cloned profile. |
| AutomationProfileStatus | status | The status to assign to the cloned profile. Default is Inactive. |
| CancellationToken | cancellationToken | A token to monitor for cancellation requests. |
Returns
| Type | Description |
|---|---|
| Task<AutomationProfile> | The new cloned AutomationProfile. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | Thrown when |
| ArgumentException | Thrown when Id or |
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 encrypted 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 |
|---|---|
| ArgumentException | Thrown when |
SetModificationDateAsync(string, string, DateTimeOffset, CancellationToken)
Asynchronously sets the modification 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 modification 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 subscription 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 | If |
| CancellationToken | cancellationToken | A token to monitor for cancellation requests. |
Returns
| Type | Description |
|---|---|
| Task | A task that represents the asynchronous operation. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | Thrown when |
| ArgumentException |
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 | A token to monitor for cancellation requests. |
Returns
| Type | Description |
|---|---|
| Task<AutomationProfileService.ProfileEditResult> | An AutomationProfileService.ProfileEditResult object containing the result of the operation and the created profile, if any. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentException | Thrown when |
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 separated by a semicolon. |
Returns
| Type | Description |
|---|---|
| AutomationProfileService.ProfilePayload | A AutomationProfileService.ProfilePayload object containing the email and taskId. Returns |
Exceptions
| Type | Condition |
|---|---|
| ArgumentException | Thrown when |