| GET, POST | /pickmeup/history | Get the user's recent history of bookings. |
|---|
import Foundation
import ServiceStack
public class PickMeUpHistoryRequest : ApiServiceRequest
{
/**
* ID Number of the user's history to retrieve.
*/
// @ApiMember(Description="ID Number of the user's history to retrieve.", IsRequired=true)
public var idNumber:String
required public init(){ super.init() }
private enum CodingKeys : String, CodingKey {
case idNumber
}
required public init(from decoder: Decoder) throws {
try super.init(from: decoder)
let container = try decoder.container(keyedBy: CodingKeys.self)
idNumber = try container.decodeIfPresent(String.self, forKey: .idNumber)
}
public override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder)
var container = encoder.container(keyedBy: CodingKeys.self)
if idNumber != nil { try container.encode(idNumber, forKey: .idNumber) }
}
}
public class ApiServiceRequest : IServiceRequest, IHasApiKey, Codable
{
/**
* The API Key required for authentication
*/
// @ApiMember(DataType="string", Description="The API Key required for authentication", IsRequired=true)
public var apiKey:String
required public init(){}
}
public class PickMeUpHistoryResponse : ApiServiceResponse
{
/**
* Is the requested product set up and enabled on Galaxy.
*/
// @ApiMember(Description="Is the requested product set up and enabled on Galaxy.")
public var productAvailable:Bool
/**
* Does the user have access to this product, based on their Galaxy profile.
*/
// @ApiMember(Description="Does the user have access to this product, based on their Galaxy profile.")
public var userHasAccess:Bool
/**
* List of booking history items for the Pick Me Up service.
*/
// @ApiMember(Description="List of booking history items for the Pick Me Up service.")
public var pickMeUpHistory:[PickMeUpBookingItem] = []
/**
* List of booking history items for the Take Me Home service.
*/
// @ApiMember(Description="List of booking history items for the Take Me Home service.")
public var takeMeHomeHistory:[PickMeUpBookingItem] = []
required public init(){ super.init() }
private enum CodingKeys : String, CodingKey {
case productAvailable
case userHasAccess
case pickMeUpHistory
case takeMeHomeHistory
}
required public init(from decoder: Decoder) throws {
try super.init(from: decoder)
let container = try decoder.container(keyedBy: CodingKeys.self)
productAvailable = try container.decodeIfPresent(Bool.self, forKey: .productAvailable)
userHasAccess = try container.decodeIfPresent(Bool.self, forKey: .userHasAccess)
pickMeUpHistory = try container.decodeIfPresent([PickMeUpBookingItem].self, forKey: .pickMeUpHistory) ?? []
takeMeHomeHistory = try container.decodeIfPresent([PickMeUpBookingItem].self, forKey: .takeMeHomeHistory) ?? []
}
public override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder)
var container = encoder.container(keyedBy: CodingKeys.self)
if productAvailable != nil { try container.encode(productAvailable, forKey: .productAvailable) }
if userHasAccess != nil { try container.encode(userHasAccess, forKey: .userHasAccess) }
if pickMeUpHistory.count > 0 { try container.encode(pickMeUpHistory, forKey: .pickMeUpHistory) }
if takeMeHomeHistory.count > 0 { try container.encode(takeMeHomeHistory, forKey: .takeMeHomeHistory) }
}
}
public class ApiServiceResponse : IServiceResponse, Codable
{
public var Description:String
public var heading:String
public var wasSuccessful:Bool
//modelState:Object ignored. Type could not be extended in Swift
required public init(){}
}
public class PickMeUpBookingItem : Codable
{
/**
* Date and Time of the pickup in ISO 8601 format.
*/
// @ApiMember(Description="Date and Time of the pickup in ISO 8601 format.")
public var bookingTime:String
/**
* The booking reference number returned by the service provider. To be shown to the client.
*/
// @ApiMember(Description="The booking reference number returned by the service provider. To be shown to the client.")
public var referenceNumber:String
/**
* Date and Time the booking request was made in ISO 8601 format.
*/
// @ApiMember(Description="Date and Time the booking request was made in ISO 8601 format.")
public var dateCreated:String
/**
* Status of the booking as returned by the service provider.
*/
// @ApiMember(Description="Status of the booking as returned by the service provider.")
public var status:String
/**
* Name of contact person at pickup.
*/
// @ApiMember(Description="Name of contact person at pickup.", IsRequired=true)
public var contactName:String
/**
* Contact number of contact person at pickup.
*/
// @ApiMember(Description="Contact number of contact person at pickup.", IsRequired=true)
public var contactNumber:String
/**
* The number of people to be picked up.
*/
// @ApiMember(Description="The number of people to be picked up.", IsRequired=true)
public var passengerCount:String
/**
* The location details of where the clients are to be picked up.
*/
// @ApiMember(Description="The location details of where the clients are to be picked up.", IsRequired=true)
public var pickupLocation:BookingLocation
/**
* The location details of where the clients are to be dropped off.
*/
// @ApiMember(Description="The location details of where the clients are to be dropped off.", IsRequired=true)
public var dropoffLocation:BookingLocation
required public init(){}
}
public class BookingLocation : Codable
{
/**
* Latitude of the pickup/drop-off location.
*/
// @ApiMember(Description="Latitude of the pickup/drop-off location.", IsRequired=true)
public var latitude:Double
/**
* Longitude of the pickup/drop-off location.
*/
// @ApiMember(Description="Longitude of the pickup/drop-off location.", IsRequired=true)
public var longitude:Double
/**
* Address of the pickup/drop-off location.
*/
// @ApiMember(Description="Address of the pickup/drop-off location.", IsRequired=true)
public var address:String
required public init(){}
}
Swift PickMeUpHistoryRequest DTOs
To override the Content-type in your clients, use the HTTP Accept Header, append the .csv suffix or ?format=csv
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /pickmeup/history HTTP/1.1
Host: galaxymobile.api.client.prod.86degrees.com
Accept: text/csv
Content-Type: text/csv
Content-Length: length
{"IdNumber":"String","ApiKey":"String"}
HTTP/1.1 200 OK
Content-Type: text/csv
Content-Length: length
{"ProductAvailable":false,"UserHasAccess":false,"PickMeUpHistory":[{}],"TakeMeHomeHistory":[{}],"Description":"String","Heading":"String","WasSuccessful":false,"ModelState":{}}