@sudoplatform/sudo-email

    Interface SudoEmailClient

    interface SudoEmailClient {
        blockEmailAddresses(
            input: BlockEmailAddressesInput,
        ): Promise<BatchOperationResult<string, string>>;
        checkEmailAddressAvailability(
            input: CheckEmailAddressAvailabilityInput,
        ): Promise<string[]>;
        createCustomEmailFolder(
            input: CreateCustomEmailFolderInput,
        ): Promise<EmailFolder>;
        createDraftEmailMessage(
            input: CreateDraftEmailMessageInput,
        ): Promise<DraftEmailMessageMetadata>;
        deleteCustomEmailFolder(
            input: DeleteCustomEmailFolderInput,
        ): Promise<undefined | EmailFolder>;
        deleteDraftEmailMessages(
            input: DeleteDraftEmailMessagesInput,
        ): Promise<
            BatchOperationResult<
                DeleteEmailMessageSuccessResult,
                EmailMessageOperationFailureResult,
            >,
        >;
        deleteEmailMessage(
            id: string,
        ): Promise<undefined | DeleteEmailMessageSuccessResult>;
        deleteEmailMessages(
            ids: string[],
        ): Promise<
            BatchOperationResult<
                DeleteEmailMessageSuccessResult,
                EmailMessageOperationFailureResult,
            >,
        >;
        deleteMessagesForFolderId(
            input: DeleteMessagesForFolderIdInput,
        ): Promise<string>;
        deprovisionEmailAddress(id: string): Promise<EmailAddress>;
        exportKeys(): Promise<ArrayBuffer>;
        getConfigurationData(): Promise<ConfigurationData>;
        getConfiguredEmailDomains(cachePolicy?: CachePolicy): Promise<string[]>;
        getDraftEmailMessage(
            input: GetDraftEmailMessageInput,
        ): Promise<undefined | DraftEmailMessage>;
        getEmailAddress(
            input: GetEmailAddressInput,
        ): Promise<undefined | EmailAddress>;
        getEmailAddressBlocklist(): Promise<UnsealedBlockedAddress[]>;
        getEmailMessage(
            input: GetEmailMessageInput,
        ): Promise<undefined | EmailMessage>;
        getEmailMessageRfc822Data(
            input: GetEmailMessageRfc822DataInput,
        ): Promise<undefined | EmailMessageRfc822Data>;
        getEmailMessageWithBody(
            input: GetEmailMessageWithBodyInput,
        ): Promise<undefined | EmailMessageWithBody>;
        getSupportedEmailDomains(cachePolicy?: CachePolicy): Promise<string[]>;
        importKeys(archiveData: ArrayBuffer): Promise<void>;
        listDraftEmailMessageMetadata(): Promise<DraftEmailMessageMetadata[]>;
        listDraftEmailMessageMetadataForEmailAddressId(
            emailAddressId: string,
        ): Promise<DraftEmailMessageMetadata[]>;
        listDraftEmailMessages(): Promise<DraftEmailMessage[]>;
        listDraftEmailMessagesForEmailAddressId(
            emailAddressId: string,
        ): Promise<DraftEmailMessage[]>;
        listEmailAddresses(
            input?: ListEmailAddressesInput,
        ): Promise<ListEmailAddressesResult>;
        listEmailAddressesForSudoId(
            input: ListEmailAddressesForSudoIdInput,
        ): Promise<ListEmailAddressesResult>;
        listEmailFoldersForEmailAddressId(
            input: ListEmailFoldersForEmailAddressIdInput,
        ): Promise<ListOutput<EmailFolder>>;
        listEmailMessages(
            input: ListEmailMessagesInput,
        ): Promise<ListEmailMessagesResult>;
        listEmailMessagesForEmailAddressId(
            input: ListEmailMessagesForEmailAddressIdInput,
        ): Promise<ListEmailMessagesResult>;
        listEmailMessagesForEmailFolderId(
            input: ListEmailMessagesForEmailFolderIdInput,
        ): Promise<ListEmailMessagesResult>;
        lookupEmailAddressesPublicInfo(
            input: LookupEmailAddressesPublicInfoInput,
        ): Promise<EmailAddressPublicInfo[]>;
        provisionEmailAddress(
            input: ProvisionEmailAddressInput,
        ): Promise<EmailAddress>;
        reset(): Promise<void>;
        sendEmailMessage(
            input: SendEmailMessageInput,
        ): Promise<SendEmailMessageResult>;
        subscribeToEmailMessages(
            subscriptionId: string,
            subscriber: EmailMessageSubscriber,
        ): Promise<void>;
        unblockEmailAddresses(
            input: UnblockEmailAddressesInput,
        ): Promise<BatchOperationResult<string, string>>;
        unblockEmailAddressesByHashedValue(
            input: UnblockEmailAddressesByHashedValueInput,
        ): Promise<BatchOperationResult<string, string>>;
        unsubscribeFromEmailMessages(subscriptionId: string): void;
        updateCustomEmailFolder(
            input: UpdateCustomEmailFolderInput,
        ): Promise<EmailFolder>;
        updateDraftEmailMessage(
            input: UpdateDraftEmailMessageInput,
        ): Promise<DraftEmailMessageMetadata>;
        updateEmailAddressMetadata(
            input: UpdateEmailAddressMetadataInput,
        ): Promise<string>;
        updateEmailMessages(
            input: UpdateEmailMessagesInput,
        ): Promise<
            BatchOperationResult<
                UpdatedEmailMessageSuccess,
                EmailMessageOperationFailureResult,
            >,
        >;
    }

    Implemented by

    Index

    Methods

    • Delete a custom email folder for the email address identified by emailAddressId. When a custom folder is deleted, any messages in the folder will be moved to TRASH.

      Parameters

      Returns Promise<undefined | EmailFolder>

      The deleted folder, or undefined if folder was not found.

    • Delete a single email message identified by id.

      Parameters

      • id: string

        The identifier of the email message to be deleted.

      Returns Promise<undefined | DeleteEmailMessageSuccessResult>

      Result object containing the identifier of the email message that was deleted, or undefined if the email message could not be deleted.

      NotRegisteredError

      LimitExceededError

      ServiceError

    • Delete the email messages identified by the list of ids.

      Email messages can only be deleted in batches of 100. Anything greater will throw a LimitExceededError.

      Parameters

      • ids: string[]

        A list of one or more identifiers of the email messages to be deleted. There is a limit of 100 email message ids per API request. Exceeding this will cause an error to be thrown.

      Returns Promise<
          BatchOperationResult<
              DeleteEmailMessageSuccessResult,
              EmailMessageOperationFailureResult,
          >,
      >

      The status of the delete: Success - All email messages succeeded to delete. Partial - Only a partial amount of messages succeeded to delete. Includes a list of the identifiers of the email messages that failed and succeeded to delete. Failure - All email messages failed to delete.

      NotRegisteredError

      InvalidArgumentError

      LimitExceededError

      ServiceError

    • Delete all messages for in an email folder. Deletion will be processed asynchronously since it may take a substantial amount of time. This method does not wait for deletion to complete. To check for completion, listen for subscriptions or check list endpoints.

      Parameters

      Returns Promise<string>

      The id of the folder

    • Deprovision an email address.

      Parameters

      • id: string

        The identifier of the email address to deprovision.

      Returns Promise<EmailAddress>

      The deprovisioned email address.

      NotRegisteredError

    • Export the cryptographic keys to a key archive.

      Returns Promise<ArrayBuffer>

      Key archive data.

    • Get the configuration data for the email service.

      Returns Promise<ConfigurationData>

      The configuration data for the email service.

    • Get a list of all of the email domains for which end-to-end encryption is supported.

      Parameters

      • OptionalcachePolicy: CachePolicy

        Determines how the configured email domains will be fetched. Default usage is remoteOnly.

      Returns Promise<string[]>

      A list of all configured domains.

      NotRegisteredError

      ServiceError

    • Get an email address identified by id.

      Parameters

      Returns Promise<undefined | EmailAddress>

      The email address identified by id or undefined if the email address cannot be found.

    • Get email address blocklist for logged in user

      Returns Promise<UnsealedBlockedAddress[]>

      The list of unsealed blocked addresses

    • Get an email message identified by id.

      Parameters

      Returns Promise<undefined | EmailMessage>

      The email message identified by id or undefined if the email message cannot be found.

    • Parameters

      Returns Promise<undefined | EmailMessageRfc822Data>

      The data associated with the email message or undefined if the email message cannot be found.

      Use getEmailMessageWithBody instead to retrieve the body and attachment data.

      Get the RFC 6854 (supersedes RFC 822) data of the email message.

    • Get a list of all of the email domains on which emails may be provisioned.

      Parameters

      • OptionalcachePolicy: CachePolicy

        Determines how the supported email domains will be fetched. Default usage is remoteOnly.

      Returns Promise<string[]>

      A list of supported domains.

      NotRegisteredError

      ServiceError

    • Imports cryptographic keys from a key archive.

      Parameters

      • archiveData: ArrayBuffer

        Key archive data to import the keys from.

      Returns Promise<void>

    • Lists the metadata of all draft email messages for the user.

      Returns Promise<DraftEmailMessageMetadata[]>

      An array of draft email message metadata or an empty array if no matching draft email messages can be found.

    • Lists the metadata of all draft email messages for the specified email address identifier.

      Parameters

      • emailAddressId: string

        The identifier of the email address associated with the draft email messages.

      Returns Promise<DraftEmailMessageMetadata[]>

      An array of draft email message metadata or an empty array if no matching draft email messages can be found.

    • Lists the metadata and content of all draft email messages for the user.

      Returns Promise<DraftEmailMessage[]>

      An array of draft email messages or an empty array if no matching draft email messages can be found.

    • Lists the metadata and content of all draft messages for the specified email address identifier.

      Parameters

      • emailAddressId: string

        The identifier of the email address associated with the draft email messages.

      Returns Promise<DraftEmailMessage[]>

      An array of draft email messages or an empty array if no matching draft email messages can be found.

    • Get a list of email folders associated with the email address identified by emailAddressId.

      Parameters

      Returns Promise<ListOutput<EmailFolder>>

      An array of email folders or an empty array if no matching email folders can be found.

    • Get a list of public information objects associated with the provided email addresses.

      Results can only be retrieved in batches of 50. Anything greater will throw a LimitExceededError.

      Parameters

      Returns Promise<EmailAddressPublicInfo[]>

      An array of public info objects, or an empty array if email addresses or their public keys cannot be found.

      LimitExceededError

    • Provision an email address.

      Parameters

      • input: ProvisionEmailAddressInput

        Parameters used to provision an email address. Email addresses must meet the following criteria:

        • Total length (including both local part and domain) must not exceed 256 characters.
        • Local part must not exceed more than 64 characters.
        • Input domain parts (domain separated by .) must not exceed 63 characters.
        • Address must match standard email address pattern: ^[a-zA-Z0-9](\.?[-_a-zA-Z0-9])*@[a-zA-Z0-9](-*\.?[a-zA-Z0-9])*\.[a-zA-Z](-?[a-zA-Z0-9])+$.
        • Domain must be a registered domain retrieved from SudoEmailClient.getSupportedEmailDomains.

      Returns Promise<EmailAddress>

      The provisioned email address.

      NotRegisteredError

      InvalidTokenError

      InsufficientEntitlementsError

      ServiceError

    • Removes any cached data maintained by this client.

      Returns Promise<void>

    • Subscribe to email message events.

      Parameters

      • subscriptionId: string

        unique identifier to differentiate subscriptions; note that specifying a duplicate subscription id will replace the previous subscription.

      • subscriber: EmailMessageSubscriber

        implementation of callback to be invoked when email message event occurs

      Returns Promise<void>

    • Unsubscribe from email message events.

      Parameters

      • subscriptionId: string

        unique identifier to differentiate subscription

      Returns void

    • Update the metadata of an email address.

      Parameters

      Returns Promise<string>

      The id of the updated email address.

      NotRegisteredError

      ServiceError

    MMNEPVFCICPMFPCPTTAAATR