Fake Mirrors
    Preparing search index...

    Interface RedirectorRepository

    Defines the public contract for a redirector repository.

    A redirector contains a landing page template and a list of required field names.

    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

    • Appends a required field to the 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 field to.

      • field: string

        The field name to append to the fields list.

      • 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 campaign lock secret does not match.

      DatabaseError If the redirector does not exist.

      DatabaseError If the data validation fails.

    • Creates a new redirector.

      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 new redirector ID to create.

      • 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 campaign lock secret does not match.

      DatabaseError If a redirector with the same ID already exists.

      DatabaseError If the data validation fails.

    • Deletes the redirector 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 campaign lock secret does not match.

      DatabaseError If the redirector does not exist.

      DatabaseError If the redirector still has lures.

      DatabaseError If the data validation fails.

    • Removes a required field from the redirector.

      Parameters

      • campaignId: string

        The ID of the campaign containing the redirector.

      • redirectorId: string

        The redirector ID to remove field from.

      • field: string

        The field name to remove from the fields list.

      • 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 campaign lock secret does not match.

      DatabaseError If the redirector does not exist.

      DatabaseError If the data validation fails.

    • Updates the redirector specific fields.

      All update parameters are optional. Only provided fields will be updated.

      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 campaign lock secret does not match.

      DatabaseError If the redirector does not exist.

      DatabaseError If the data validation fails.