1Fetch Client API

<back to all web services

Order

The following routes are available for this service:
GET/orderGet order information.If you do not specify an OrderId, the results will be paged.
import 'package:servicestack/servicestack.dart';

class ApiServiceRequest implements IServiceRequest, IHasApiKey, IConvertible
{
    /**
    * The API Key required for authentication
    */
    // @ApiMember(DataType="string", Description="The API Key required for authentication", IsRequired=true)
    String? ApiKey;

    ApiServiceRequest({this.ApiKey});
    ApiServiceRequest.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        ApiKey = json['ApiKey'];
        return this;
    }

    Map<String, dynamic> toJson() => {
        'ApiKey': ApiKey
    };

    getTypeName() => "ApiServiceRequest";
    TypeContext? context = _ctx;
}

class ApiServiceResponse implements IServiceResponse, IConvertible
{
    /**
    * Information about the response.
    */
    // @ApiMember(Description="Information about the response.", IsRequired=true)
    String? Description;

    /**
    * Heading or summary of the response.
    */
    // @ApiMember(Description="Heading or summary of the response.", IsRequired=true)
    String? Heading;

    /**
    * Did the intended operation for this response complete successfully?
    */
    // @ApiMember(DataType="boolean", Description="Did the intended operation for this response complete successfully?", IsRequired=true)
    bool? WasSuccessful;

    ApiServiceResponse({this.Description,this.Heading,this.WasSuccessful});
    ApiServiceResponse.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        Description = json['Description'];
        Heading = json['Heading'];
        WasSuccessful = json['WasSuccessful'];
        return this;
    }

    Map<String, dynamic> toJson() => {
        'Description': Description,
        'Heading': Heading,
        'WasSuccessful': WasSuccessful
    };

    getTypeName() => "ApiServiceResponse";
    TypeContext? context = _ctx;
}

class OrderStatus
{
    static const OrderStatus AwaitingPayment = const OrderStatus._(0);
    static const OrderStatus ProcessingPayment = const OrderStatus._(1);
    static const OrderStatus AwaitingDispatch = const OrderStatus._(2);
    static const OrderStatus DriverDispatched = const OrderStatus._(3);
    static const OrderStatus PackageEnRoute = const OrderStatus._(4);
    static const OrderStatus Completed = const OrderStatus._(5);
    static const OrderStatus Cancelled = const OrderStatus._(6);
    static const OrderStatus DeliveryFailed = const OrderStatus._(7);

    final int _value;
    const OrderStatus._(this._value);
    int get value => _value;
    static List<OrderStatus> get values => const [AwaitingPayment,ProcessingPayment,AwaitingDispatch,DriverDispatched,PackageEnRoute,Completed,Cancelled,DeliveryFailed];
}

class ScanDetail implements IConvertible
{
    /**
    * List of URLs for images captured at the waypoint
    */
    // @ApiMember(Description="List of URLs for images captured at the waypoint")
    List<String>? PhotoUrls;

    /**
    * List of URLs for images of signatures captured at the waypoint
    */
    // @ApiMember(Description="List of URLs for images of signatures captured at the waypoint")
    List<String>? SignatureUrls;

    /**
    * Name of person the driver interacted with at the waypoint
    */
    // @ApiMember(Description="Name of person the driver interacted with at the waypoint")
    String? ReceivedBy;

    /**
    * The date the driver interacted with the person
    */
    // @ApiMember(Description="The date the driver interacted with the person")
    String? ReceivedDate;

    /**
    * Number of packages collected by the driver
    */
    // @ApiMember(Description="Number of packages collected by the driver")
    int? PackagesCollected;

    ScanDetail({this.PhotoUrls,this.SignatureUrls,this.ReceivedBy,this.ReceivedDate,this.PackagesCollected});
    ScanDetail.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        PhotoUrls = JsonConverters.fromJson(json['PhotoUrls'],'List<String>',context!);
        SignatureUrls = JsonConverters.fromJson(json['SignatureUrls'],'List<String>',context!);
        ReceivedBy = json['ReceivedBy'];
        ReceivedDate = json['ReceivedDate'];
        PackagesCollected = json['PackagesCollected'];
        return this;
    }

    Map<String, dynamic> toJson() => {
        'PhotoUrls': JsonConverters.toJson(PhotoUrls,'List<String>',context!),
        'SignatureUrls': JsonConverters.toJson(SignatureUrls,'List<String>',context!),
        'ReceivedBy': ReceivedBy,
        'ReceivedDate': ReceivedDate,
        'PackagesCollected': PackagesCollected
    };

    getTypeName() => "ScanDetail";
    TypeContext? context = _ctx;
}

class OrderItemWaypoint implements IConvertible
{
    /**
    * Has the driver completed this waypoint
    */
    // @ApiMember(Description="Has the driver completed this waypoint")
    bool? Completed;

    double? Latitude;
    double? Longitude;
    String? Address;
    String? ContactName;
    String? ContactNumber;
    String? DeliveryInstructions;
    /**
    * Details captured at waypoint
    */
    // @ApiMember(Description="Details captured at waypoint")
    ScanDetail? ScanDetail;

    OrderItemWaypoint({this.Completed,this.Latitude,this.Longitude,this.Address,this.ContactName,this.ContactNumber,this.DeliveryInstructions,this.ScanDetail});
    OrderItemWaypoint.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        Completed = json['Completed'];
        Latitude = JsonConverters.toDouble(json['Latitude']);
        Longitude = JsonConverters.toDouble(json['Longitude']);
        Address = json['Address'];
        ContactName = json['ContactName'];
        ContactNumber = json['ContactNumber'];
        DeliveryInstructions = json['DeliveryInstructions'];
        ScanDetail = JsonConverters.fromJson(json['ScanDetail'],'ScanDetail',context!);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'Completed': Completed,
        'Latitude': Latitude,
        'Longitude': Longitude,
        'Address': Address,
        'ContactName': ContactName,
        'ContactNumber': ContactNumber,
        'DeliveryInstructions': DeliveryInstructions,
        'ScanDetail': JsonConverters.toJson(ScanDetail,'ScanDetail',context!)
    };

    getTypeName() => "OrderItemWaypoint";
    TypeContext? context = _ctx;
}

class OrderTransitPoint implements IConvertible
{
    /**
    * Origin waypoint number
    */
    // @ApiMember(Description="Origin waypoint number")
    int? FromWaypointNumber;

    /**
    * Destination waypoint number
    */
    // @ApiMember(Description="Destination waypoint number")
    int? ToWaypointNumber;

    /**
    * Distance between waypoints
    */
    // @ApiMember(Description="Distance between waypoints")
    double? Distance;

    /**
    * Distance between waypoints rounded and converted to a string
    */
    // @ApiMember(Description="Distance between waypoints rounded and converted to a string")
    String? DistanceValue;

    /**
    * Price calculated between waypoints
    */
    // @ApiMember(Description="Price calculated between waypoints")
    double? Price;

    /**
    * Price calculated between waypoints formatted as ZA currency
    */
    // @ApiMember(Description="Price calculated between waypoints formatted as ZA currency")
    String? PriceValue;

    OrderTransitPoint({this.FromWaypointNumber,this.ToWaypointNumber,this.Distance,this.DistanceValue,this.Price,this.PriceValue});
    OrderTransitPoint.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        FromWaypointNumber = json['FromWaypointNumber'];
        ToWaypointNumber = json['ToWaypointNumber'];
        Distance = JsonConverters.toDouble(json['Distance']);
        DistanceValue = json['DistanceValue'];
        Price = JsonConverters.toDouble(json['Price']);
        PriceValue = json['PriceValue'];
        return this;
    }

    Map<String, dynamic> toJson() => {
        'FromWaypointNumber': FromWaypointNumber,
        'ToWaypointNumber': ToWaypointNumber,
        'Distance': Distance,
        'DistanceValue': DistanceValue,
        'Price': Price,
        'PriceValue': PriceValue
    };

    getTypeName() => "OrderTransitPoint";
    TypeContext? context = _ctx;
}

class EventDetail implements IConvertible
{
    String? Description;
    String? Time;
    DateTime? EventDateTime;

    EventDetail({this.Description,this.Time,this.EventDateTime});
    EventDetail.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        Description = json['Description'];
        Time = json['Time'];
        EventDateTime = JsonConverters.fromJson(json['EventDateTime'],'DateTime',context!);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'Description': Description,
        'Time': Time,
        'EventDateTime': JsonConverters.toJson(EventDateTime,'DateTime',context!)
    };

    getTypeName() => "EventDetail";
    TypeContext? context = _ctx;
}

class OrderDetail implements IConvertible
{
    /**
    * ID of quote attached to the order
    */
    // @ApiMember(Description="ID of quote attached to the order")
    String? QuoteId;

    /**
    * ID of order
    */
    // @ApiMember(Description="ID of order")
    String? OrderId;

    /**
    * User friendly order identifier
    */
    // @ApiMember(Description="User friendly order identifier")
    String? Waybill;

    /**
    * Invoice number for the order
    */
    // @ApiMember(Description="Invoice number for the order")
    String? InvoiceNumber;

    /**
    * The date and time the order is scheduled for in ISO 8601 string format, will be set if IsScheduled is true
    */
    // @ApiMember(Description="The date and time the order is scheduled for in ISO 8601 string format, will be set if IsScheduled is true")
    String? ScheduledDate;

    /**
    * Order status number
    */
    // @ApiMember(Description="Order status number")
    OrderStatus? OrderStatus;

    /**
    * String value of order status
    */
    // @ApiMember(Description="String value of order status")
    String? OrderStatusValue;

    /**
    * List of waypoints for this order
    */
    // @ApiMember(Description="List of waypoints for this order")
    List<OrderItemWaypoint>? Waypoints;

    /**
    * List of sections between waypoints
    */
    // @ApiMember(Description="List of sections between waypoints")
    List<OrderTransitPoint>? TransitPoints;

    /**
    * Order Final price including VAT
    */
    // @ApiMember(Description="Order Final price including VAT")
    double? FinalPrice;

    /**
    * Final price formatted as ZA currency
    */
    // @ApiMember(Description="Final price formatted as ZA currency")
    String? FinalPriceValue;

    /**
    * Total distance for the order in km
    */
    // @ApiMember(Description="Total distance for the order in km")
    double? TotalDistance;

    /**
    * Total distance for the order formatted as a string
    */
    // @ApiMember(Description="Total distance for the order formatted as a string")
    String? TotalDistanceValue;

    /**
    * Date order was placed
    */
    // @ApiMember(Description="Date order was placed")
    String? Date;

    /**
    * Google encoded maps polyline path for drawing route on a google map
    */
    // @ApiMember(Description="Google encoded maps polyline path for drawing route on a google map")
    String? EncodedPolyPath;

    /**
    * List of events as they occurred while the order was in progress
    */
    // @ApiMember(Description="List of events as they occurred while the order was in progress")
    List<EventDetail>? Events;

    OrderDetail({this.QuoteId,this.OrderId,this.Waybill,this.InvoiceNumber,this.ScheduledDate,this.OrderStatus,this.OrderStatusValue,this.Waypoints,this.TransitPoints,this.FinalPrice,this.FinalPriceValue,this.TotalDistance,this.TotalDistanceValue,this.Date,this.EncodedPolyPath,this.Events});
    OrderDetail.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        QuoteId = json['QuoteId'];
        OrderId = json['OrderId'];
        Waybill = json['Waybill'];
        InvoiceNumber = json['InvoiceNumber'];
        ScheduledDate = json['ScheduledDate'];
        OrderStatus = JsonConverters.fromJson(json['OrderStatus'],'OrderStatus',context!);
        OrderStatusValue = json['OrderStatusValue'];
        Waypoints = JsonConverters.fromJson(json['Waypoints'],'List<OrderItemWaypoint>',context!);
        TransitPoints = JsonConverters.fromJson(json['TransitPoints'],'List<OrderTransitPoint>',context!);
        FinalPrice = JsonConverters.toDouble(json['FinalPrice']);
        FinalPriceValue = json['FinalPriceValue'];
        TotalDistance = JsonConverters.toDouble(json['TotalDistance']);
        TotalDistanceValue = json['TotalDistanceValue'];
        Date = json['Date'];
        EncodedPolyPath = json['EncodedPolyPath'];
        Events = JsonConverters.fromJson(json['Events'],'List<EventDetail>',context!);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'QuoteId': QuoteId,
        'OrderId': OrderId,
        'Waybill': Waybill,
        'InvoiceNumber': InvoiceNumber,
        'ScheduledDate': ScheduledDate,
        'OrderStatus': JsonConverters.toJson(OrderStatus,'OrderStatus',context!),
        'OrderStatusValue': OrderStatusValue,
        'Waypoints': JsonConverters.toJson(Waypoints,'List<OrderItemWaypoint>',context!),
        'TransitPoints': JsonConverters.toJson(TransitPoints,'List<OrderTransitPoint>',context!),
        'FinalPrice': FinalPrice,
        'FinalPriceValue': FinalPriceValue,
        'TotalDistance': TotalDistance,
        'TotalDistanceValue': TotalDistanceValue,
        'Date': Date,
        'EncodedPolyPath': EncodedPolyPath,
        'Events': JsonConverters.toJson(Events,'List<EventDetail>',context!)
    };

    getTypeName() => "OrderDetail";
    TypeContext? context = _ctx;
}

class OrderResponse extends ApiServiceResponse implements IConvertible
{
    /**
    * List with order details, will only contain one item if requested with order id
    */
    // @ApiMember(Description="List with order details, will only contain one item if requested with order id")
    List<OrderDetail>? OrderItems;

    /**
    * Total number of items in order collection
    */
    // @ApiMember(Description="Total number of items in order collection")
    int? TotalCount;

    /**
    * Used to indicate if there are more items available
    */
    // @ApiMember(Description="Used to indicate if there are more items available")
    bool? LastPage;

    OrderResponse({this.OrderItems,this.TotalCount,this.LastPage});
    OrderResponse.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        super.fromMap(json);
        OrderItems = JsonConverters.fromJson(json['OrderItems'],'List<OrderDetail>',context!);
        TotalCount = json['TotalCount'];
        LastPage = json['LastPage'];
        return this;
    }

    Map<String, dynamic> toJson() => super.toJson()..addAll({
        'OrderItems': JsonConverters.toJson(OrderItems,'List<OrderDetail>',context!),
        'TotalCount': TotalCount,
        'LastPage': LastPage
    });

    getTypeName() => "OrderResponse";
    TypeContext? context = _ctx;
}

class Order extends ApiServiceRequest implements ILogRequest, IConvertible
{
    /**
    * The ID if getting specific order
    */
    // @ApiMember(Description="The ID if getting specific order")
    String? OrderId;

    /**
    * The amount of elements to offset the index by
    */
    // @ApiMember(Description="The amount of elements to offset the index by")
    int? Offset;

    /**
    * The number of elements to be returned, defaults to 10
    */
    // @ApiMember(Description="The number of elements to be returned, defaults to 10")
    int? Count;

    Order({this.OrderId,this.Offset,this.Count});
    Order.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        super.fromMap(json);
        OrderId = json['OrderId'];
        Offset = json['Offset'];
        Count = json['Count'];
        return this;
    }

    Map<String, dynamic> toJson() => super.toJson()..addAll({
        'OrderId': OrderId,
        'Offset': Offset,
        'Count': Count
    });

    getTypeName() => "Order";
    TypeContext? context = _ctx;
}

TypeContext _ctx = TypeContext(library: 'api.1fetch.co.za', types: <String, TypeInfo> {
    'ApiServiceRequest': TypeInfo(TypeOf.Class, create:() => ApiServiceRequest()),
    'ApiServiceResponse': TypeInfo(TypeOf.Class, create:() => ApiServiceResponse()),
    'OrderStatus': TypeInfo(TypeOf.Enum, enumValues:OrderStatus.values),
    'ScanDetail': TypeInfo(TypeOf.Class, create:() => ScanDetail()),
    'OrderItemWaypoint': TypeInfo(TypeOf.Class, create:() => OrderItemWaypoint()),
    'OrderTransitPoint': TypeInfo(TypeOf.Class, create:() => OrderTransitPoint()),
    'EventDetail': TypeInfo(TypeOf.Class, create:() => EventDetail()),
    'OrderDetail': TypeInfo(TypeOf.Class, create:() => OrderDetail()),
    'List<OrderItemWaypoint>': TypeInfo(TypeOf.Class, create:() => <OrderItemWaypoint>[]),
    'List<OrderTransitPoint>': TypeInfo(TypeOf.Class, create:() => <OrderTransitPoint>[]),
    'List<EventDetail>': TypeInfo(TypeOf.Class, create:() => <EventDetail>[]),
    'OrderResponse': TypeInfo(TypeOf.Class, create:() => OrderResponse()),
    'List<OrderDetail>': TypeInfo(TypeOf.Class, create:() => <OrderDetail>[]),
    'Order': TypeInfo(TypeOf.Class, create:() => Order()),
});

Dart Order DTOs

To override the Content-type in your clients, use the HTTP Accept Header, append the .jsv suffix or ?format=jsv

HTTP + JSV

The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.

GET /order HTTP/1.1 
Host: api.1fetch.co.za 
Accept: text/jsv
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length

{
	OrderItems: 
	[
		{
			QuoteId: 00000000-0000-0000-0000-000000000000,
			OrderId: 00000000-0000-0000-0000-000000000000,
			Waybill: String,
			InvoiceNumber: String,
			ScheduledDate: String,
			OrderStatus: 0,
			OrderStatusValue: String,
			Waypoints: 
			[
				{
					
				}
			],
			TransitPoints: 
			[
				{
					
				}
			],
			FinalPrice: 0,
			FinalPriceValue: String,
			TotalDistance: 0,
			TotalDistanceValue: String,
			Date: String,
			EncodedPolyPath: String,
			Events: 
			[
				{
					
				}
			]
		}
	],
	TotalCount: 0,
	LastPage: False,
	Description: String,
	Heading: String,
	WasSuccessful: False
}