""" Options: Date: 2025-12-06 06:29:51 Version: 8.0 Tip: To override a DTO option, remove "#" prefix before updating BaseUrl: https://api.1fetch.co.za #GlobalNamespace: #AddServiceStackTypes: True #AddResponseStatus: False #AddImplicitVersion: #AddDescriptionAsComments: True IncludeTypes: PlaceOrder.* #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 @dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE) @dataclass class RequestQuoteWaypoint(IRequestWaypoint): # @ApiMember(Description="Number of waypoint for ordering", IsRequired=true) waypoint_number: int = 0 """ Number of waypoint for ordering """ # @ApiMember(Description="Waypoint Latitude", IsRequired=true) latitude: float = 0.0 """ Waypoint Latitude """ # @ApiMember(Description="Waypoint Longitude", IsRequired=true) longitude: float = 0.0 """ Waypoint Longitude """ # @ApiMember(Description="Name of contact person at waypoint", IsRequired=true) contact_name: Optional[str] = None """ Name of contact person at waypoint """ # @ApiMember(Description="Telephone number of contact person at waypoint", IsRequired=true) contact_number: Optional[str] = None """ Telephone number of contact person at waypoint """ # @ApiMember(Description="Instructions for driver to follow at waypoint", IsRequired=true) delivery_instructions: Optional[str] = None """ Instructions for driver to follow at waypoint """ # @ApiMember(Description="Waypoint address", IsRequired=true) address: Optional[str] = None """ Waypoint address """ class ScheduleType(IntEnum): NEXT_AVAILABLE = 0 SPECIFIC_TIME = 1 @dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE) @dataclass class LinkedWaypoint: from_waypoint_number: int = 0 to_waypoint_number: int = 0 from_latitude: float = 0.0 from_longitude: float = 0.0 to_latitude: float = 0.0 to_longitude: float = 0.0 @dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE) @dataclass class WaypointQuoteInformation(LinkedWaypoint): # @ApiMember(Description="Distance between waypoints as a number") distance: float = 0.0 """ Distance between waypoints as a number """ # @ApiMember(Description="String formatted distance") distance_value: Optional[str] = None """ String formatted distance """ waypoint_valid: bool = False message: Optional[str] = None error_details: Optional[List[str]] = None # @ApiMember(Description="Caculated price between waypoints excluding vat") price: Decimal = decimal.Decimal(0) """ Caculated price between waypoints excluding vat """ # @ApiMember(Description="Price excluding vat formatted as a string rand value") price_value: Optional[str] = None """ Price excluding vat formatted as a string rand value """ # @ApiMember(Description="The price between waypoints including vat") price_with_v_a_t: Decimal = decimal.Decimal(0) """ The price between waypoints including vat """ # @ApiMember(Description="The price including vat formatted as a rand value string") price_value_with_v_a_t: Optional[str] = None """ The price including vat formatted as a rand value string """ @dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE) @dataclass class WaypointValidationInformation: waypoint_number: int = 0 is_valid: bool = False error_messages: Optional[List[str]] = None class IRequestWaypoint: latitude: float = 0.0 longitude: float = 0.0 waypoint_number: int = 0 contact_name: Optional[str] = None contact_number: Optional[str] = None delivery_instructions: Optional[str] = None address: Optional[str] = None @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 PlaceOrderResponse(ApiServiceResponse): # @ApiMember(Description="The ID of the order.") order_id: Optional[str] = None """ The ID of the order. """ # @ApiMember(Description="Were there any validation issues for any waypoints") waypoint_issue: bool = False """ Were there any validation issues for any waypoints """ # @ApiMember(Description="The total distance for the order") total_distance: float = 0.0 """ The total distance for the order """ # @ApiMember(Description="The total distance for the order, formatted as a string") total_distance_value: Optional[str] = None """ The total distance for the order, formatted as a string """ # @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="The subtotal of the order before VAT") sub_total: Optional[str] = None """ The subtotal of the order before VAT """ # @ApiMember(Description="The total of the order after VAT") final_price: Optional[str] = None """ The total of the order after VAT """ # @ApiMember(Description="The amount of VAT ") vat_value: Optional[str] = None """ The amount of VAT """ # @ApiMember(Description="Will contain a message if there a problem with a scheduled order") scheduling_notice: Optional[str] = None """ Will contain a message if there a problem with a scheduled order """ # @ApiMember(Description="Will contain a message if there is a problem with a scheduled quote, if the order is scheduled to soon to opening times") scheduling_error: Optional[str] = None """ Will contain a message if there is a problem with a scheduled quote, if the order is scheduled to soon to opening times """ # @ApiMember(Description="User friendly waybill number") way_bill: Optional[str] = None """ User friendly waybill number """ # @ApiMember(Description="List of order information for pricing etc between each waypoint") waypoints: Optional[List[WaypointQuoteInformation]] = None """ List of order information for pricing etc between each waypoint """ # @ApiMember(Description="List with validation information for each waypoint") waypoint_validations: Optional[List[WaypointValidationInformation]] = None """ List with validation information for each waypoint """ # @Route("/order", "POST") @dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE) @dataclass class PlaceOrder(ApiServiceRequest, IReturn[PlaceOrderResponse], ILogRequest): # @ApiMember(Description="Optionally provide your own reference identifier") client_reference: Optional[str] = None """ Optionally provide your own reference identifier """ # @ApiMember(Description="Optionally provide a reference for the customer/business") customer_reference: Optional[str] = None """ Optionally provide a reference for the customer/business """ # @ApiMember(Description="Array of waypoints", IsRequired=true) waypoints: Optional[List[RequestQuoteWaypoint]] = None """ Array of waypoints """ # @ApiMember(Description="Is this a scheduled order?", IsRequired=true) is_scheduled: bool = False """ Is this a scheduled order? """ # @ApiMember(Description="Specify the scheduling type, required if IsScheduled is true") schedule_type: Optional[ScheduleType] = None """ Specify the scheduling type, required if IsScheduled is true """ # @ApiMember(Description="Specify the scheduled date for this delivery in ISO 8601 string format, required if IsScheduled is true and ScheduleType is SpecificTime") scheduled_date: Optional[str] = None """ Specify the scheduled date for this delivery in ISO 8601 string format, required if IsScheduled is true and ScheduleType is SpecificTime """ # @ApiMember(Description="Set this to true to prevent creating an order and billing for it", IsRequired=true) test: bool = False """ Set this to true to prevent creating an order and billing for it """ # @ApiMember(Description="Is your account allows Urgent Orders, you can use this flag to indicate when an Order is urgent.") is_urgent: bool = False """ Is your account allows Urgent Orders, you can use this flag to indicate when an Order is urgent. """