GalaxyMobile App API

<back to all web services

DeleteDependent

Requires Authentication
The following routes are available for this service:
DELETE/dependent
import Foundation
import ServiceStack

public class DeleteDependent : ApiServiceRequest
{
    public var dependentId:Int

    required public init(){ super.init() }

    private enum CodingKeys : String, CodingKey {
        case dependentId
    }

    required public init(from decoder: Decoder) throws {
        try super.init(from: decoder)
        let container = try decoder.container(keyedBy: CodingKeys.self)
        dependentId = try container.decodeIfPresent(Int.self, forKey: .dependentId)
    }

    public override func encode(to encoder: Encoder) throws {
        try super.encode(to: encoder)
        var container = encoder.container(keyedBy: CodingKeys.self)
        if dependentId != nil { try container.encode(dependentId, forKey: .dependentId) }
    }
}

public class ApiServiceRequest : IServiceRequest, IHasApiKey, IHasDeviceInfo, IHasClientId, Codable
{
    /**
    * The API Key required for authentication
    */
    // @ApiMember(DataType="string", Description="The API Key required for authentication", IsRequired=true)
    public var apiKey:String

    /**
    * Latitude of the user making this request
    */
    // @ApiMember(DataType="double", Description="Latitude of the user making this request")
    public var latitude:Double

    /**
    * Longitude of the user making this request
    */
    // @ApiMember(DataType="double", Description="Longitude of the user making this request")
    public var longitude:Double

    required public init(){}
}

public class DeleteDependentResponse : ApiServiceResponse
{
    public var dependents:[DependentData] = []

    required public init(){ super.init() }

    private enum CodingKeys : String, CodingKey {
        case dependents
    }

    required public init(from decoder: Decoder) throws {
        try super.init(from: decoder)
        let container = try decoder.container(keyedBy: CodingKeys.self)
        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 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 DependentData : Codable
{
    public var dependentId:Int
    public var firstName:String
    public var surname:String
    public var mobileNumber:String
    public var email:String
    public var idNumber:String

    required public init(){}
}


Swift DeleteDependent 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.

DELETE /dependent HTTP/1.1 
Host: galaxymobile.api.dev.86degrees.com 
Accept: text/jsv
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length

{
	Dependents: 
	[
		{
			DependentId: 0,
			FirstName: String,
			Surname: String,
			MobileNumber: String,
			Email: String,
			IdNumber: String
		}
	],
	Description: String,
	Heading: String,
	WasSuccessful: False,
	ModelState: {}
}