Skip to content

Api reference

components.eyewear.public.blueprints

admin_blueprint

eyewear_admin_blueprint module-attribute

eyewear_admin_blueprint = Blueprint(
    name="eyewear_admin", import_name=__name__
)

user_blueprint

eyewear_user_blueprint module-attribute

eyewear_user_blueprint = Blueprint(
    name="eyewear", import_name=__name__
)

components.eyewear.public.business_logic

frame_order

get_last_eyewear_frame_order_for_user

get_last_eyewear_frame_order_for_user(feature_user)

Retrieve the last eyewear frame order for a given user.

Parameters:

Name Type Description Default
feature_user FeatureUser

The user for whom to retrieve the eyewear frame order.

required

Returns:

Type Description
Optional[EyewearFrameOrderData]

Optional[EyewearFrameOrderData]: The last eyewear frame order data if available, otherwise None.

Source code in components/eyewear/public/business_logic/frame_order.py
def get_last_eyewear_frame_order_for_user(
    feature_user: FeatureUser,
) -> Optional[EyewearFrameOrderData]:
    """
    Retrieve the last eyewear frame order for a given user.

    Args:
        feature_user (FeatureUser): The user for whom to retrieve the eyewear frame order.

    Returns:
        Optional[EyewearFrameOrderData]: The last eyewear frame order data if available, otherwise None.
    """
    eyewear_user = get_eyewear_user_from_user_id_and_app_id(
        user_id=int(feature_user.app_user_id), app_id=feature_user.app_id
    )

    return get_user_last_frame_order(eyewear_user) if eyewear_user else None

components.eyewear.public.commands

app_group

contact_lens_commands module-attribute

contact_lens_commands = AppGroup('contact_lens')

eyewear_commands module-attribute

eyewear_commands = AppGroup('eyewear')

register_all_commands

register_all_commands()
Source code in components/eyewear/public/commands/app_group.py
7
8
9
def register_all_commands() -> None:  # noqa: D103
    register_contact_lens_commands()
    register_eyewear_commands()

register_contact_lens_commands

register_contact_lens_commands()
Source code in components/eyewear/public/commands/app_group.py
def register_contact_lens_commands() -> None:  # noqa: D103
    from components.eyewear.public.commands.contact_lens_commands import (  # noqa: F401
        build_images_from_weiss_dir,
        cancel_old_unpaid_orders,
        import_catalog,
        notify_stale_orders,
        run_orders_reviewing,
        send_order_rating_notifications,
        send_unpaid_order_notifications,
        simulate_orders_reviewing,
        sync_packages_status_from_laposte,
    )

register_eyewear_commands

register_eyewear_commands()
Source code in components/eyewear/public/commands/app_group.py
def register_eyewear_commands() -> None:  # noqa: D103
    from components.eyewear.public.commands.eyewear_commands import (  # noqa: F401
        build_images_from_fittingbox_dir,
        build_images_from_photoshoot_dir,
        cancel_return_parcels,
        notify_stale_orders,
        send_order_rating_notifications,
        send_restock_alerts,
        sync_frames_stock_from_turing,
        sync_packages_status_from_sendcloud,
    )

contact_lens_commands

build_images_from_weiss_dir

build_images_from_weiss_dir(path)
Source code in components/eyewear/public/commands/contact_lens_commands.py
@contact_lens_commands.command(requires_authentication=False)
@click.option("--path", type=click.STRING, required=True)
def build_images_from_weiss_dir(path: str) -> None:  # noqa: D103
    from components.eyewear.internal.helpers.assets import (
        build_contact_lens_images_from_weiss_dir,
    )

    build_contact_lens_images_from_weiss_dir(path=path)

cancel_old_unpaid_orders

cancel_old_unpaid_orders(dry_run)
Source code in components/eyewear/public/commands/contact_lens_commands.py
@contact_lens_commands.command(requires_authentication=False)
@command_with_dry_run
def cancel_old_unpaid_orders(dry_run: bool) -> None:  # noqa: D103
    from components.eyewear.internal.business_logic.admin_business_logic.contact_lens_unpaid_cancelation import (
        cancel_old_unpaid_orders,
    )

    cancel_old_unpaid_orders(dry_run=dry_run)

import_catalog

import_catalog(notify, dry_run)
Source code in components/eyewear/public/commands/contact_lens_commands.py
@contact_lens_commands.command(requires_authentication=False)
@click.option("--notify", is_flag=True, default=False)
@command_with_dry_run
def import_catalog(notify: bool, dry_run: bool) -> None:  # noqa: D103
    from components.eyewear.internal.business_logic.admin_business_logic.contact_lens_catalog import (
        import_contact_lens_catalog,
    )

    import_contact_lens_catalog(
        notify=notify,
        dry_run=dry_run,
    )

notify_stale_orders

notify_stale_orders(with_past_orders)
Source code in components/eyewear/public/commands/contact_lens_commands.py
@contact_lens_commands.command(requires_authentication=False)
@click.option("--with-past-orders", is_flag=True, default=False)
def notify_stale_orders(with_past_orders: bool) -> None:  # noqa: D103
    from components.eyewear.internal.business_logic.admin_business_logic.contact_lens_stale_orders import (
        notify_contact_lens_stale_orders,
    )

    notify_contact_lens_stale_orders(with_past_orders=with_past_orders)

review_order

review_order(order, dry_run)
Source code in components/eyewear/public/commands/contact_lens_commands.py
@contact_lens_commands.command(requires_authentication=False)
@click.option("--order", type=click.STRING, required=True)
@command_with_dry_run
def review_order(order: str, dry_run: bool) -> None:  # noqa: D103
    from components.eyewear.internal.business_logic.user_business_logic.contact_lens_order_reviewer import (
        review_contact_lens_order_by_id,
    )

    review_contact_lens_order_by_id(order_id=order, dry_run=dry_run)

run_orders_reviewing

run_orders_reviewing(dry_run)
Source code in components/eyewear/public/commands/contact_lens_commands.py
@contact_lens_commands.command(requires_authentication=False)
@command_with_dry_run
def run_orders_reviewing(dry_run: bool) -> None:  # noqa: D103
    from components.eyewear.internal.business_logic.user_business_logic.contact_lens_order_reviewer import (
        run_contact_lens_orders_reviewing,
    )

    run_contact_lens_orders_reviewing(dry_run=dry_run)

send_order_rating_notifications

send_order_rating_notifications(dry_run)
Source code in components/eyewear/public/commands/contact_lens_commands.py
@contact_lens_commands.command(requires_authentication=False)
@command_with_dry_run
def send_order_rating_notifications(dry_run: bool) -> None:  # noqa: D103
    from components.eyewear.internal.business_logic.admin_business_logic.contact_lens_order_rating import (
        send_contact_lens_order_rating_notifications,
    )

    send_contact_lens_order_rating_notifications(dry_run=dry_run)

send_unpaid_order_notifications

send_unpaid_order_notifications(dry_run)
Source code in components/eyewear/public/commands/contact_lens_commands.py
@contact_lens_commands.command(requires_authentication=False)
@command_with_dry_run
def send_unpaid_order_notifications(dry_run: bool) -> None:  # noqa: D103
    from components.eyewear.internal.business_logic.admin_business_logic.contact_lens_unpaid_notification import (
        send_contact_lens_unpaid_order_notifications,
    )

    send_contact_lens_unpaid_order_notifications(dry_run=dry_run)

simulate_orders_reviewing

simulate_orders_reviewing(limit)
Source code in components/eyewear/public/commands/contact_lens_commands.py
@contact_lens_commands.command(requires_authentication=False)
@click.option("--limit", type=click.INT, required=False)
def simulate_orders_reviewing(  # noqa: D103
    limit: Optional[int],
) -> None:
    from components.eyewear.internal.business_logic.user_business_logic.contact_lens_order_reviewer import (
        simulate_contact_lens_orders_reviewing,
    )

    simulate_contact_lens_orders_reviewing(limit=limit)

sync_packages_status_from_laposte

sync_packages_status_from_laposte(dry_run)
Source code in components/eyewear/public/commands/contact_lens_commands.py
@contact_lens_commands.command(requires_authentication=False)
@command_with_dry_run
def sync_packages_status_from_laposte(dry_run: bool) -> None:  # noqa: D103
    from components.eyewear.internal.business_logic.admin_business_logic.contact_lens_order_package import (
        sync_contact_lens_order_packages_status_from_laposte,
    )

    sync_contact_lens_order_packages_status_from_laposte(dry_run=dry_run)

eyewear_commands

build_images_from_fittingbox_dir

build_images_from_fittingbox_dir(path)
Source code in components/eyewear/public/commands/eyewear_commands.py
@eyewear_commands.command(requires_authentication=False)
@click.option("--path", type=click.STRING, required=True)
def build_images_from_fittingbox_dir(path: str) -> None:  # noqa: D103
    from components.eyewear.internal.helpers.assets import (
        build_frame_images_from_fittingbox_dir,
    )

    build_frame_images_from_fittingbox_dir(path=path)

build_images_from_photoshoot_dir

build_images_from_photoshoot_dir(path)
Source code in components/eyewear/public/commands/eyewear_commands.py
@eyewear_commands.command(requires_authentication=False)
@click.option("--path", type=click.STRING, required=True)
def build_images_from_photoshoot_dir(path: str) -> None:  # noqa: D103
    from components.eyewear.internal.helpers.assets import (
        build_frame_images_from_photoshoot_dir,
    )

    build_frame_images_from_photoshoot_dir(path=path)

cancel_return_parcels

cancel_return_parcels(dry_run)
Source code in components/eyewear/public/commands/eyewear_commands.py
@eyewear_commands.command(requires_authentication=False)
@command_with_dry_run
def cancel_return_parcels(dry_run: bool) -> None:  # noqa: D103
    from components.eyewear.internal.helpers.sendcloud import (
        cancel_return_parcels,
    )

    cancel_return_parcels(dry_run=dry_run)

notify_stale_orders

notify_stale_orders(with_past_orders)
Source code in components/eyewear/public/commands/eyewear_commands.py
@eyewear_commands.command(requires_authentication=False)
@click.option("--with-past-orders", is_flag=True, default=False)
def notify_stale_orders(with_past_orders: bool) -> None:  # noqa: D103
    from components.eyewear.internal.business_logic.admin_business_logic.frame_stale_orders import (
        notify_eyewear_stale_orders,
    )

    notify_eyewear_stale_orders(with_past_orders=with_past_orders)

send_order_rating_notifications

send_order_rating_notifications(dry_run)
Source code in components/eyewear/public/commands/eyewear_commands.py
@eyewear_commands.command(requires_authentication=False)
@command_with_dry_run
def send_order_rating_notifications(dry_run: bool) -> None:  # noqa: D103
    from components.eyewear.internal.business_logic.admin_business_logic.frame_order_rating import (
        send_eyewear_order_rating_notifications,
    )

    send_eyewear_order_rating_notifications(dry_run=dry_run)

send_restock_alerts

send_restock_alerts(dry_run)
Source code in components/eyewear/public/commands/eyewear_commands.py
@eyewear_commands.command(requires_authentication=False)
@command_with_dry_run
def send_restock_alerts(dry_run: bool) -> None:  # noqa: D103
    from components.eyewear.internal.business_logic.user_business_logic.frame_stock import (
        send_eyewear_restock_alerts,
    )

    send_eyewear_restock_alerts(dry_run=dry_run)

sync_frames_stock_from_turing

sync_frames_stock_from_turing(dry_run)
Source code in components/eyewear/public/commands/eyewear_commands.py
@eyewear_commands.command(requires_authentication=False)
@command_with_dry_run
def sync_frames_stock_from_turing(dry_run: bool) -> None:  # noqa: D103
    from components.eyewear.internal.business_logic.user_business_logic.frame_stock import (
        sync_eyewear_frames_stock_from_turing,
    )

    sync_eyewear_frames_stock_from_turing(dry_run=dry_run)

sync_packages_status_from_sendcloud

sync_packages_status_from_sendcloud(dry_run)
Source code in components/eyewear/public/commands/eyewear_commands.py
@eyewear_commands.command(requires_authentication=False)
@command_with_dry_run
def sync_packages_status_from_sendcloud(dry_run: bool) -> None:  # noqa: D103
    from components.eyewear.internal.business_logic.admin_business_logic.frame_order_package import (
        sync_frame_order_packages_status_from_sendcloud,
    )

    sync_frame_order_packages_status_from_sendcloud(dry_run=dry_run)

components.eyewear.public.events

EyewearTestimonialPublished dataclass

EyewearTestimonialPublished(
    frame_id, user_name, feedback, rating
)

Bases: WebhookMessage

Event triggered when a ShopTestimonial has been published.

feedback instance-attribute

feedback

frame_id instance-attribute

frame_id

rating instance-attribute

rating

user_name instance-attribute

user_name