Interface for a mailing list service.

interface MailingListServiceInterface {
    attachTo: (app: ZibriApplication) => void;
    confirmSubscribeToList: (confirmationTokenValue: string) => Promise<void>;
    mailingListBaseRoute: `/${string}`;
    queueEmailForList: <T extends BaseMailingListEmailTemplateData>(
        listId: string,
        data: MailingListQueueEmailData<T>,
    ) => Promise<void>;
    requestSubscribeToList: <T extends BaseMailingListEmailTemplateData>(
        listId: string,
        subscriber: MailingListSubscriberCreateData,
        emailData: MailingListQueueEmailData<T>,
    ) => Promise<void>;
    unsubscribeFromList: (
        listId: string,
        subscriberId: string,
    ) => Promise<void>;
}

Implemented by

Properties

attachTo: (app: ZibriApplication) => void

Attaches the service to the Zibri application.

confirmSubscribeToList: (confirmationTokenValue: string) => Promise<void>

Confirms that a new subscriber is added to the mailing list.

mailingListBaseRoute: `/${string}`

The base route for everything regarding mailing lists.

queueEmailForList: <T extends BaseMailingListEmailTemplateData>(
    listId: string,
    data: MailingListQueueEmailData<T>,
) => Promise<void>

Queues a new email for the mailing list with the provided id.

requestSubscribeToList: <T extends BaseMailingListEmailTemplateData>(
    listId: string,
    subscriber: MailingListSubscriberCreateData,
    emailData: MailingListQueueEmailData<T>,
) => Promise<void>

Requests for a new subscriber to the be added to the mailing list with the provided id. This should initialize a two step process required by the GDPR.

unsubscribeFromList: (listId: string, subscriberId: string) => Promise<void>

Removes a subscriber with the given id from the mailing list with the provided id.