Fake Mirrors
    Preparing search index...

    Interface RedirectorRepository

    Represents a redirector repository.

    interface RedirectorRepository {
        appendField(
            campaignId: string,
            redirectorId: string,
            field: string,
            lockSecret: string,
        ): Promise<void>;
        create(
            campaignId: string,
            redirectorId: string,
            page: string,
            lockSecret: string,
        ): Promise<void>;
        delete(
            campaignId: string,
            redirectorId: string,
            lockSecret: string,
        ): Promise<void>;
        list(campaignId: string): Promise<RedirectorModel[] | null>;
        listFull(campaignId: string): Promise<FullRedirectorModel[] | null>;
        read(
            campaignId: string,
            redirectorId: string,
        ): Promise<RedirectorModel | null>;
        readFull(
            campaignId: string,
            redirectorId: string,
        ): Promise<FullRedirectorModel | null>;
        removeField(
            campaignId: string,
            redirectorId: string,
            field: string,
            lockSecret: string,
        ): Promise<void>;
        update(
            campaignId: string,
            redirectorId: string,
            page: string | null | undefined,
            lockSecret: string,
        ): Promise<void>;
    }

    Implemented by

    Methods

    • Appends a required field to a redirector.

      When rendering a redirector with required fields, all specified fields must be provided in the parameters. If the fields array is empty, the redirector is "loose" and accepts any parameters.

      Parameters

      • campaignId: string

        The ID of the campaign containing the redirector

      • redirectorId: string

        The redirector ID to append fields

      • field: string

        The field name to require

      • lockSecret: string

        The campaign lock secret obtained from CampaignRepository.lock()

      Returns Promise<void>

      DatabaseError If the campaign does not exist

      DatabaseError If the campaign is not locked

      DatabaseError If the lock secret does not match

      DatabaseError If the redirector does not exist

    • Creates a new redirector in the specified campaign.

      The redirector is created with an empty fields array, meaning it is initially "loose" (accepts any parameters). Use appendField() or removeField() to manage required fields.

      Parameters

      • campaignId: string

        The ID of the campaign to create the redirector in

      • redirectorId: string

        The unique identifier for the new redirector

      • page: string

        The page template

      • lockSecret: string

        The campaign lock secret obtained from CampaignRepository.lock()

      Returns Promise<void>

      DatabaseError If the campaign does not exist

      DatabaseError If the campaign is not locked

      DatabaseError If the lock secret does not match

      DatabaseError If a redirector with the same ID already exists

    • Delete a redirector model by its ID.

      A redirector cannot be deleted if it has any lures pointing to it.

      Parameters

      • campaignId: string

        The ID of the campaign containing the redirector

      • redirectorId: string

        The redirector ID to delete

      • lockSecret: string

        The campaign lock secret obtained from CampaignRepository.lock()

      Returns Promise<void>

      DatabaseError If the campaign does not exist

      DatabaseError If the campaign is not locked

      DatabaseError If the lock secret does not match

      DatabaseError If the redirector does not exist

      DatabaseError If the redirector still has lures

    • Removes a required field from a redirector.

      Parameters

      • campaignId: string

        The ID of the campaign containing the redirector

      • redirectorId: string

        The redirector ID to remove fields

      • field: string

        The field name to remove

      • lockSecret: string

        The campaign lock secret obtained from CampaignRepository.lock()

      Returns Promise<void>

      DatabaseError If the campaign does not exist

      DatabaseError If the campaign is not locked

      DatabaseError If the lock secret does not match

      DatabaseError If the redirector does not exist

    • Updates specific fields of a redirector model.

      Parameters

      • campaignId: string

        The ID of the campaign containing the redirector

      • redirectorId: string

        The redirector ID to update

      • page: string | null | undefined

        The page template

      • lockSecret: string

        The campaign lock secret obtained from CampaignRepository.lock()

      Returns Promise<void>

      DatabaseError If the campaign does not exist

      DatabaseError If the campaign is not locked

      DatabaseError If the lock secret does not match

      DatabaseError If the redirector does not exist