Foundry API

<back to all web services

ChangeEmailAddressRequest

Requires Authentication
The following routes are available for this service:
PUT,PATCH/profile/{Id}/email
import Foundation
import ServiceStack

public class ChangeEmailAddressRequest : PutPatchOperationUnTenanted<UpdateProfileResponse>
{
    public var id:String?
    public var emailAddress:String?

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

    private enum CodingKeys : String, CodingKey {
        case id
        case emailAddress
    }

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

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

public class PutPatchOperationUnTenanted<TResponse : Codable> : IPatch, IPut, Codable
{
    required public init(){}
}

public class UpdateProfileResponse : Codable
{
    public var responseStatus:ResponseStatus?
    public var profile:Profile?

    required public init(){}
}

public class Profile : ProfileBasic
{
    public var defaultOrganisationId:String?

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

    private enum CodingKeys : String, CodingKey {
        case defaultOrganisationId
    }

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

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

public class ProfileBasic : IIdentifiableResource, Codable
{
    public var name:PersonName?
    public var displayName:String?
    public var emailAddress:String?
    public var phoneNumber:String?
    public var timezone:String?
    public var id:String?

    required public init(){}
}

public class PersonName : Codable
{
    public var firstName:String?
    public var lastName:String?

    required public init(){}
}


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

PUT /profile/{Id}/email HTTP/1.1 
Host: foundrystage-api-app.azurewebsites.net 
Accept: application/json
Content-Type: application/json
Content-Length: length

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

{"responseStatus":{"errorCode":"String","message":"String","stackTrace":"String","errors":[{"errorCode":"String","fieldName":"String","message":"String","meta":{"String":"String"}}],"meta":{"String":"String"}},"profile":{"defaultOrganisationId":"String","name":{"firstName":"String","lastName":"String"},"displayName":"String","emailAddress":"String","phoneNumber":"String","timezone":"String","id":"String"}}