BrightmarketAdapter
Protocol methods and expected row shapes for client adapters.
Your client adapter must implement every method in BrightmarketAdapter.
Return raw source rows (list of dict or objects); map columns via *_FIELD_MAP in client constants. See Field maps. SDK sync builds Bright payloads and calls writers.
get_clients_created
Return raw rows for new clients (e.g. filtered by creation date).
Field names are mapped via CLIENT_FIELD_MAP in the client's constants module. SDK sync builds create_client payloads and optionally assigns client levels when CLIENT_LEVEL_MAPPING is configured.
get_clients_modified
Return raw rows for modified clients (same shape as get_clients_created).
SDK sync maps rows to update_client using CLIENT_FIELD_MAP and value maps.
get_payment_methods
Return distinct payment method rows from the source.
Field names are mapped via PAYMENT_METHOD_FIELD_MAP. SDK sync calls create_payment_method with Bright API externalId and name.
get_points_movements
Return raw client point movement rows.
Field names are mapped via POINTS_MOVEMENT_FIELD_MAP. Movement type codes are translated via POINTS_MOVEMENT_TYPE_MAPPING in constants. SDK sync calls create_points_movement. Optionally implement get_points_expiration_adjustments(from_date, to_date) for a post-sync adjustment pass (mapped via POINTS_EXPIRATION_FIELD_MAP).
get_promotions
Return promotions to sync. Each item may be either:
- A raw source row mapped via PROMOTION_FIELD_MAP, or
- A ready promotion_data dict for PromotionsWriter.create_promotion ("promotion", "regularPromotionType", "skuExternalIds", "discountValue", …).
SDK sync detects the shape and calls PromotionsWriter.create_promotion.
get_rewards
Return raw reward rows from the source.
Field names are mapped via REWARD_FIELD_MAP. SDK sync groups by segment, builds JSONL lines, and uploads via create_rewards. Requires ORGANIZATION_ID in the environment.
get_skus
Return raw article/SKU rows from the source system.
Each row is a dict or object whose field names are mapped to SDK logical keys via SKU_FIELD_MAP in the client's constants module. Alternatively, return writer-ready article dicts (externalId + skus list) for passthrough sync.
SDK sync groups rows by article id, maps fields, and calls create_brand, create_article, and create_sku.
get_stock_adjustments
Return raw stock rows to set absolute stock in Brightmarket.
Field names are mapped via STOCK_ADJUSTMENT_FIELD_MAP. When branch_office_id is None, return stock for all branches the client chooses to sync; when set, return only that branch. SDK sync calls send_stock_adjustment (POST stockMovements/set-stock).
get_tickets
Return raw ticket line rows (one row per line).
Field names are mapped via TICKET_FIELD_MAP. SDK sync groups by ticket id
and calls create_ticket. Optionally implement get_pagos_by_ticket(from_date,
to_date) returning a dict of ticket id → payment method external ids.
Optional TICKET_FIELD_MAP promo_id attaches line promotions to the
ticket via resolve_promotion_external_id_for_date (date-scoped IDs).