""" Options: Date: 2025-12-06 06:26:37 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: ValidateWaypoints.* #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 """ @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 ValidateWaypointsResponse(ApiServiceResponse): # @ApiMember(Description="List with validation information for each waypoint") waypoint_validations: Optional[List[WaypointValidationInformation]] = None """ List with validation information for each waypoint """ # @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="List of information for pricing etc between each waypoint") waypoints: Optional[List[WaypointQuoteInformation]] = None """ List of information for pricing etc between each waypoint """ # @ApiMember(Description="Is there an issue for the waypoints details specified?") waypoint_issue: bool = False """ Is there an issue for the waypoints details specified? """ # @Route("/quote/validatewaypoints", "POST") @dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE) @dataclass class ValidateWaypoints(ApiServiceRequest, IReturn[ValidateWaypointsResponse], ILogRequest): # @ApiMember(Description="Array of waypoints", IsRequired=true) waypoints: Optional[List[RequestQuoteWaypoint]] = None """ Array of waypoints """ # @ApiMember(Description="Set this to true to prevent while testing the API.", IsRequired=true) test: bool = False """ Set this to true to prevent while testing the API. """