MigrantLeap.Auth

<back to all web services

GenerateOtpForUser

The following routes are available for this service:
POST/api/v1/generateotp
import Foundation
import ServiceStack

public class GenerateOtpForUser : Codable
{
    public var email:String
    public var phoneNumber:String

    required public init(){}
}

public class GenerateOtpForUserResponse : BaseResponse
{
    public var phoneNumber:String

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

    private enum CodingKeys : String, CodingKey {
        case phoneNumber
    }

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

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

public class BaseResponse : Codable
{
    public var responseStatus:ResponseStatus

    required public init(){}
}


Swift GenerateOtpForUser DTOs

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

HTTP + JSON

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

POST /api/v1/generateotp HTTP/1.1 
Host: auth.migrantleap.com 
Accept: application/json
Content-Type: application/json
Content-Length: length

{"email":"String","phoneNumber":"String"}
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: length

{"phoneNumber":"String","responseStatus":{"statusCode":0,"message":"String","stackTrace":"String","errors":[{"errorCode":"String","fieldName":"String","message":"String","meta":{"String":"String"}}],"meta":{"String":"String"}}}