| POST | /user/login | Check that the user exists on Galaxy and set up their account and services. |
|---|
import Foundation
import ServiceStack
public class UserLoginRequest : ApiServiceRequest
{
/**
* ID Number of the user to log in.
*/
// @ApiMember(Description="ID Number of the user to log in.", 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 UserLoginResponse : ApiServiceResponse
{
/**
* List of products the user has access to.
*/
// @ApiMember(Description="List of products the user has access to.")
public var userProductInformation:[UserProductData] = []
/**
* List of all dependents linked to this user.
*/
// @ApiMember(Description="List of all dependents linked to this user.")
public var dependents:[DependentData] = []
required public init(){ super.init() }
private enum CodingKeys : String, CodingKey {
case userProductInformation
case dependents
}
required public init(from decoder: Decoder) throws {
try super.init(from: decoder)
let container = try decoder.container(keyedBy: CodingKeys.self)
userProductInformation = try container.decodeIfPresent([UserProductData].self, forKey: .userProductInformation) ?? []
dependents = try container.decodeIfPresent([DependentData].self, forKey: .dependents) ?? []
}
public override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder)
var container = encoder.container(keyedBy: CodingKeys.self)
if userProductInformation.count > 0 { try container.encode(userProductInformation, forKey: .userProductInformation) }
if dependents.count > 0 { try container.encode(dependents, forKey: .dependents) }
}
}
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 UserProductData : Codable
{
public var integrationType:IntegrationProviderType
public var productId:Int
public var name:String
public var nameAfrikaans:String
public var dashImageUrl:String
public var actionUrl:String
public var attachments:[UserProductAttachmentData] = []
public var descriptionEng:String
public var summaryEng:String
public var descriptionAfr:String
public var summaryAfr:String
required public init(){}
}
public enum IntegrationProviderType : Int, Codable
{
case None = 0
case EA = 1
case IlluminaHubProtectMe = 2
case MyLegalHand = 3
case AccidentAngels = 4
case EmergencyServices = 5
case MightyMobile = 6
case Pulsit = 7
case Bolt = 8
}
public class UserProductAttachmentData : Codable
{
public var fileName:String
public var mainFileUrl:String
public var thumbnailUrl:String
public var isVideo:Bool
public var isImage:Bool
public var isPdf:Bool
required public init(){}
}
public class DependentData : Codable
{
/**
* Dependent's Galaxy Id used for referring to or deleting.
*/
// @ApiMember(Description="Dependent's Galaxy Id used for referring to or deleting.", IsRequired=true)
public var dependentId:Int
/**
* Dependent's first name.
*/
// @ApiMember(Description="Dependent's first name.", IsRequired=true)
public var firstName:String
/**
* Dependent's surname.
*/
// @ApiMember(Description="Dependent's surname.", IsRequired=true)
public var surname:String
/**
* Dependent's mobile contact number.
*/
// @ApiMember(Description="Dependent's mobile contact number.", IsRequired=true)
public var mobileNumber:String
/**
* Dependent's email address.
*/
// @ApiMember(Description="Dependent's email address.", IsRequired=true)
public var email:String
/**
* Depdendent's ID number.
*/
// @ApiMember(Description="Depdendent's ID number.", IsRequired=true)
public var idNumber:String
required public init(){}
}
To override the Content-type in your clients, use the HTTP Accept Header, append the .json suffix or ?format=json
To embed the response in a jsonp callback, append ?callback=myCallback
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /user/login HTTP/1.1
Host: galaxymobile.api.client.prod.86degrees.com
Accept: application/json
Content-Type: application/json
Content-Length: length
{"IdNumber":"String","ApiKey":"String"}
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: length
{"UserProductInformation":[{"IntegrationType":0,"ProductId":0,"Name":"String","NameAfrikaans":"String","DashImageUrl":"String","ActionUrl":"String","Attachments":[{"FileName":"String","MainFileUrl":"String","ThumbnailUrl":"String","IsVideo":false,"IsImage":false,"IsPdf":false}],"DescriptionEng":"String","SummaryEng":"String","DescriptionAfr":"String","SummaryAfr":"String"}],"Dependents":[{"DependentId":0,"FirstName":"String","Surname":"String","MobileNumber":"String","Email":"String","IdNumber":"String"}],"Description":"String","Heading":"String","WasSuccessful":false,"ModelState":{}}