93 lines
2.1 KiB
Python
93 lines
2.1 KiB
Python
"""Data models for pypretix-device API responses and operations."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from dataclasses import dataclass, field
|
|
from typing import Any, Dict, List, Optional
|
|
|
|
|
|
@dataclass
|
|
class CheckinResult:
|
|
"""Result of a check-in or check-out operation via checkinrpc/redeem."""
|
|
|
|
status: str # "ok", "incomplete", "exchange", "error"
|
|
reason: Optional[str] = None # "invalid", "already_redeemed", "unpaid", etc.
|
|
reason_explanation: Optional[str] = None
|
|
position: Optional[Dict[str, Any]] = None
|
|
require_attention: bool = False
|
|
checkin_texts: List[str] = field(default_factory=list)
|
|
list_info: Optional[Dict[str, Any]] = None
|
|
questions: Optional[List[Dict[str, Any]]] = None
|
|
|
|
|
|
@dataclass
|
|
class SearchResult:
|
|
"""Result of a ticket search via checkinrpc/search."""
|
|
|
|
position: Optional[Dict[str, Any]] = None
|
|
require_attention: bool = False
|
|
checkin_texts: List[str] = field(default_factory=list)
|
|
list_info: Optional[Dict[str, Any]] = None
|
|
|
|
|
|
@dataclass
|
|
class Event:
|
|
"""Pretix event."""
|
|
|
|
slug: str
|
|
name: str
|
|
testmode: bool = False
|
|
subevent_id: Optional[int] = None
|
|
currency: str = "EUR"
|
|
date_from: Optional[str] = None
|
|
date_to: Optional[str] = None
|
|
|
|
|
|
@dataclass
|
|
class Item:
|
|
"""A product/item within an event."""
|
|
|
|
id: int
|
|
name: str
|
|
internal_name: Optional[str] = None
|
|
|
|
|
|
@dataclass
|
|
class CheckinList:
|
|
"""A check-in list within an event."""
|
|
|
|
id: int
|
|
name: str
|
|
all_products: bool = True
|
|
checkin_count: int = 0
|
|
position_count: int = 0
|
|
allow_entry_after_exit: bool = False
|
|
subevent: Optional[int] = None
|
|
include_pending: bool = False
|
|
|
|
|
|
@dataclass
|
|
class AttendeeInfo:
|
|
"""Attendee/personalized ticket information."""
|
|
|
|
name: str
|
|
email: Optional[str] = None
|
|
position_id: Optional[int] = None
|
|
order_code: Optional[str] = None
|
|
|
|
|
|
@dataclass
|
|
class DeviceInfo:
|
|
"""Information about the registered device."""
|
|
|
|
organizer: str
|
|
device_id: int
|
|
name: str
|
|
api_token: str
|
|
unique_serial: str
|
|
gate: Optional[Dict[str, Any]] = None
|
|
server_version: Optional[str] = None
|
|
|
|
|
|
CONFIG_DIR = None # Set by Client before using
|