| 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 .xml suffix or ?format=xml
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/xml
Content-Type: application/xml
Content-Length: length
<UserLoginRequest xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/WebService.ClientServiceModel.User">
<ApiKey xmlns="http://schemas.datacontract.org/2004/07/WebService.ClientServiceModel.Base">String</ApiKey>
<IdNumber>String</IdNumber>
</UserLoginRequest>
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length
<UserLoginResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/WebService.ClientServiceModel.User">
<Description xmlns="http://schemas.datacontract.org/2004/07/CommonService.Api.Models.Base">String</Description>
<Heading xmlns="http://schemas.datacontract.org/2004/07/CommonService.Api.Models.Base">String</Heading>
<ModelState xmlns="http://schemas.datacontract.org/2004/07/CommonService.Api.Models.Base" />
<WasSuccessful xmlns="http://schemas.datacontract.org/2004/07/CommonService.Api.Models.Base">false</WasSuccessful>
<Dependents>
<DependentData>
<DependentId>0</DependentId>
<Email>String</Email>
<FirstName>String</FirstName>
<IdNumber>String</IdNumber>
<MobileNumber>String</MobileNumber>
<Surname>String</Surname>
</DependentData>
</Dependents>
<UserProductInformation>
<UserProductData>
<ActionUrl>String</ActionUrl>
<Attachments>
<UserProductAttachmentData>
<FileName>String</FileName>
<IsImage>false</IsImage>
<IsPdf>false</IsPdf>
<IsVideo>false</IsVideo>
<MainFileUrl>String</MainFileUrl>
<ThumbnailUrl>String</ThumbnailUrl>
</UserProductAttachmentData>
</Attachments>
<DashImageUrl>String</DashImageUrl>
<DescriptionAfr>String</DescriptionAfr>
<DescriptionEng>String</DescriptionEng>
<IntegrationType>None</IntegrationType>
<Name>String</Name>
<NameAfrikaans>String</NameAfrikaans>
<ProductId>0</ProductId>
<SummaryAfr>String</SummaryAfr>
<SummaryEng>String</SummaryEng>
</UserProductData>
</UserProductInformation>
</UserLoginResponse>