DataWeb
Search Results for

    Show / Hide Table of Contents

    Class AutomationProfileService

    Provides methods for managing automation profiles.

    Inheritance
    object
    AutomationProfileService
    Implements
    IAutomationProfileService
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: DataWeb.Automation
    Assembly: DataWeb.Core.dll
    Syntax
    public class AutomationProfileService : IAutomationProfileService

    Constructors

    AutomationProfileService(IAutomationProfileStore, IConfiguration, IDataProtectionProvider, TimeProvider)

    Provides methods for managing automation profiles.

    Declaration
    public AutomationProfileService(IAutomationProfileStore automationProfileStore, IConfiguration Configuration, IDataProtectionProvider dataProtectionProvider, TimeProvider timeProvider)
    Parameters
    Type Name Description
    IAutomationProfileStore automationProfileStore

    An instance of the IAutomationProfileStore interface.

    IConfiguration Configuration

    The application configuration.

    IDataProtectionProvider dataProtectionProvider

    The data protection provider used to encrypt and decrypt payload data.

    TimeProvider timeProvider

    The time provider used to obtain the current date and time.

    Properties

    AutomationAppSettings

    Gets the automation application settings loaded from configuration.

    Declaration
    public 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
    public 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 automationProfile is null.

    ArgumentException

    Thrown when Id or targetEmail is null or empty.

    DeleteAsync(string, string, CancellationToken)

    Asynchronously deletes the status of an automation profile.

    Declaration
    public 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
    public 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
    public 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
    public 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
    public 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
    public 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
    public 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
    public string ProtectProfilePayload(string email, string taskId)
    Parameters
    Type Name Description
    string email

    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 email or taskId is null or empty.

    SetModificationDateAsync(string, string, DateTimeOffset, CancellationToken)

    Asynchronously sets the modification date of an automation profile.

    Declaration
    public 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
    public 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
    public 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
    public 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
    public 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
    public 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
    public 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 true, preserves the existing modification date if already set; otherwise, updates it to the current local time.

    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 automationProfile is null.

    ArgumentException

    Thrown when Id or Email is null or empty.

    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
    public 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 email

    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
    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 email is null or empty.

    SetStatusAsync(string, string, AutomationProfileStatus, CancellationToken)

    Asynchronously sets the status of an automation profile.

    Declaration
    public 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
    public 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 null if the payload is null, empty, invalid, or cannot be decrypted.

    Exceptions
    Type Condition
    ArgumentException

    Thrown when payload is null or empty.

    Implements

    IAutomationProfileService
    In this article
    Back to top Generated by DocFX