""" Options: Date: 2025-12-06 06:22:05 Version: 8.0 Tip: To override a DTO option, remove "#" prefix before updating BaseUrl: https://1fetch.api.client.prod.86degrees.com #GlobalNamespace: #AddServiceStackTypes: True #AddResponseStatus: False #AddImplicitVersion: #AddDescriptionAsComments: True IncludeTypes: Order.* #ExcludeTypes: #DefaultImports: datetime,decimal,marshmallow.fields:*,servicestack:*,typing:*,dataclasses:dataclass/field,dataclasses_json:dataclass_json/LetterCase/Undefined/config,enum:Enum/IntEnum #DataClass: #DataClassJson: """ import datetime import decimal from marshmallow.fields import * from servicestack import * from typing import * from dataclasses import dataclass, field from dataclasses_json import dataclass_json, LetterCase, Undefined, config from enum import Enum, IntEnum @dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE) @dataclass class ApiServiceRequest(IServiceRequest, IHasApiKey): # @ApiMember(DataType="string", Description="The API Key required for authentication", IsRequired=true) api_key: Optional[str] = None """ The API Key required for authentication """ class IServiceRequest: pass class IHasApiKey: api_key: Optional[str] = None class ILogRequest: pass class OrderStatus(IntEnum): AWAITING_PAYMENT = 0 PROCESSING_PAYMENT = 1 AWAITING_DISPATCH = 2 DRIVER_DISPATCHED = 3 PACKAGE_EN_ROUTE = 4 COMPLETED = 5 CANCELLED = 6 DELIVERY_FAILED = 7 @dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE) @dataclass class ScanDetail: # @ApiMember(Description="List of URLs for images captured at the waypoint") photo_urls: Optional[List[str]] = None """ List of URLs for images captured at the waypoint """ # @ApiMember(Description="List of URLs for images of signatures captured at the waypoint") signature_urls: Optional[List[str]] = None """ List of URLs for images of signatures captured at the waypoint """ # @ApiMember(Description="Name of person the driver interacted with at the waypoint") received_by: Optional[str] = None """ Name of person the driver interacted with at the waypoint """ # @ApiMember(Description="The date the driver interacted with the person") received_date: Optional[str] = None """ The date the driver interacted with the person """ # @ApiMember(Description="Number of packages collected by the driver") packages_collected: int = 0 """ Number of packages collected by the driver """ @dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE) @dataclass class OrderItemWaypoint: # @ApiMember(Description="Has the driver completed this waypoint") completed: bool = False """ Has the driver completed this waypoint """ latitude: float = 0.0 longitude: float = 0.0 address: Optional[str] = None contact_name: Optional[str] = None contact_number: Optional[str] = None delivery_instructions: Optional[str] = None # @ApiMember(Description="Details captured at waypoint") scan_detail: Optional[ScanDetail] = None """ Details captured at waypoint """ @dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE) @dataclass class OrderTransitPoint: # @ApiMember(Description="Origin waypoint number") from_waypoint_number: int = 0 """ Origin waypoint number """ # @ApiMember(Description="Destination waypoint number") to_waypoint_number: int = 0 """ Destination waypoint number """ # @ApiMember(Description="Distance between waypoints") distance: float = 0.0 """ Distance between waypoints """ # @ApiMember(Description="Distance between waypoints rounded and converted to a string") distance_value: Optional[str] = None """ Distance between waypoints rounded and converted to a string """ # @ApiMember(Description="Price calculated between waypoints") price: Decimal = decimal.Decimal(0) """ Price calculated between waypoints """ # @ApiMember(Description="Price calculated between waypoints formatted as ZA currency") price_value: Optional[str] = None """ Price calculated between waypoints formatted as ZA currency """ @dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE) @dataclass class EventDetail: description: Optional[str] = None time: Optional[str] = None event_date_time: datetime.datetime = datetime.datetime(1, 1, 1) @dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE) @dataclass class OrderDetail: # @ApiMember(Description="ID of quote attached to the order") quote_id: Optional[str] = None """ ID of quote attached to the order """ # @ApiMember(Description="ID of order") order_id: Optional[str] = None """ ID of order """ # @ApiMember(Description="User friendly order identifier") waybill: Optional[str] = None """ User friendly order identifier """ # @ApiMember(Description="Invoice number for the order") invoice_number: Optional[str] = None """ Invoice number for the order """ # @ApiMember(Description="The date and time the order is scheduled for in ISO 8601 string format, will be set if IsScheduled is true") scheduled_date: Optional[str] = None """ The date and time the order is scheduled for in ISO 8601 string format, will be set if IsScheduled is true """ # @ApiMember(Description="Order status number") order_status: Optional[OrderStatus] = None """ Order status number """ # @ApiMember(Description="String value of order status") order_status_value: Optional[str] = None """ String value of order status """ # @ApiMember(Description="List of waypoints for this order") waypoints: Optional[List[OrderItemWaypoint]] = None """ List of waypoints for this order """ # @ApiMember(Description="List of sections between waypoints") transit_points: Optional[List[OrderTransitPoint]] = None """ List of sections between waypoints """ # @ApiMember(Description="Order Final price including VAT") final_price: Decimal = decimal.Decimal(0) """ Order Final price including VAT """ # @ApiMember(Description="Final price formatted as ZA currency") final_price_value: Optional[str] = None """ Final price formatted as ZA currency """ # @ApiMember(Description="Total distance for the order in km") total_distance: float = 0.0 """ Total distance for the order in km """ # @ApiMember(Description="Total distance for the order formatted as a string") total_distance_value: Optional[str] = None """ Total distance for the order formatted as a string """ # @ApiMember(Description="Date order was placed") date: Optional[str] = None """ Date order was placed """ # @ApiMember(Description="Google encoded maps polyline path for drawing route on a google map") encoded_poly_path: Optional[str] = None """ Google encoded maps polyline path for drawing route on a google map """ # @ApiMember(Description="List of events as they occurred while the order was in progress") events: Optional[List[EventDetail]] = None """ List of events as they occurred while the order was in progress """ @dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE) @dataclass class ApiServiceResponse(IServiceResponse): # @ApiMember(Description="Information about the response.", IsRequired=true) description: Optional[str] = None """ Information about the response. """ # @ApiMember(Description="Heading or summary of the response.", IsRequired=true) heading: Optional[str] = None """ Heading or summary of the response. """ # @ApiMember(DataType="boolean", Description="Did the intended operation for this response complete successfully?", IsRequired=true) was_successful: bool = False """ Did the intended operation for this response complete successfully? """ @dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE) @dataclass class OrderResponse(ApiServiceResponse): # @ApiMember(Description="List with order details, will only contain one item if requested with order id") order_items: Optional[List[OrderDetail]] = None """ List with order details, will only contain one item if requested with order id """ # @ApiMember(Description="Total number of items in order collection") total_count: int = 0 """ Total number of items in order collection """ # @ApiMember(Description="Used to indicate if there are more items available") last_page: bool = False """ Used to indicate if there are more items available """ # @Route("/order", "GET") @dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE) @dataclass class Order(ApiServiceRequest, IReturn[OrderResponse], ILogRequest): # @ApiMember(Description="The ID if getting specific order") order_id: Optional[str] = None """ The ID if getting specific order """ # @ApiMember(Description="The amount of elements to offset the index by") offset: int = 0 """ The amount of elements to offset the index by """ # @ApiMember(Description="The number of elements to be returned, defaults to 10") count: int = 0 """ The number of elements to be returned, defaults to 10 """