Evo Voice

<back to all web services

PatchAccount

Update the specified account details

Requires Authentication
Required role:SystemAdministrator
The following routes are available for this service:
PATCH/accounts/{accountId}
import Foundation
import ServiceStack

/**
* Update the specified account details
*/
// @Api(Description="Update the specified account details")
public class PatchAccount : IPatch, Codable
{
    /**
    * The ID of the account you want to update
    */
    // @ApiMember(Description="The ID of the account you want to update")
    public var accountId:String?

    /**
    * The new name for the account
    */
    // @ApiMember(Description="The new name for the account")
    public var name:String?

    /**
    * The max number of phone numbers this account can have
    */
    // @ApiMember(Description="The max number of phone numbers this account can have")
    public var maxPhoneNumbers:Int?

    /**
    * The ID of the file to use for a logo on the dashboard
    */
    // @ApiMember(Description="The ID of the file to use for a logo on the dashboard")
    public var logoId:String?

    /**
    * Updated billing settings for this account
    */
    // @ApiMember(Description="Updated billing settings for this account")
    public var billingSettings:BillingSettings?

    required public init(){}
}

public class BillingSettings : Codable
{
    public var base:BillingItem?
    public var localNumbers:BillingItem?
    public var tollFreeNumbers:BillingItem?
    public var inboundVoiceCalls:BillingItem?
    public var outboundVoiceCalls:BillingItem?
    public var inboundFaxes:BillingItem?
    public var outboundFaxes:BillingItem?
    public var inboundSmsMessages:BillingItem?
    public var outboundSmsMessages:BillingItem?

    required public init(){}
}

public class BillingItem : Codable
{
    public var baseCost:Double?
    public var rawUnitMultiplier:Double?
    public var unitCost:Double?
    public var allowance:Int?

    required public init(){}
}

public class AccountInfo : EntityInfo
{
    /**
    * The name of this account
    */
    // @ApiMember(Description="The name of this account")
    public var name:String?

    /**
    * The ID of this account's parent
    */
    // @ApiMember(Description="The ID of this account's parent")
    public var parentAccountId:String?

    /**
    * The twilio account SID
    */
    // @ApiMember(Description="The twilio account SID")
    public var twilioAccountSid:String?

    /**
    * The ancestors of this account. Useful for breadcrumbs
    */
    // @ApiMember(Description="The ancestors of this account. Useful for breadcrumbs")
    public var ancestorIds:[String] = []

    /**
    * The max number of phone numbers this account can have
    */
    // @ApiMember(Description="The max number of phone numbers this account can have")
    public var maxPhoneNumbers:Int?

    /**
    * This account is BYOA
    */
    // @ApiMember(Description="This account is BYOA")
    public var isBYOA:Bool?

    /**
    * TrustHub Profile Sid
    */
    // @ApiMember(Description="TrustHub Profile Sid")
    public var trustHubProfileSid:String?

    /**
    * The ID of the logo file
    */
    // @ApiMember(Description="The ID of the logo file")
    public var logoId:String?

    /**
    * The URI of the logo file
    */
    // @ApiMember(Description="The URI of the logo file")
    public var logoUri:String?

    /**
    * The billing settings for this account
    */
    // @ApiMember(Description="The billing settings for this account")
    public var billingSettings:BillingSettings?

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

    private enum CodingKeys : String, CodingKey {
        case name
        case parentAccountId
        case twilioAccountSid
        case ancestorIds
        case maxPhoneNumbers
        case isBYOA
        case trustHubProfileSid
        case logoId
        case logoUri
        case billingSettings
    }

    required public init(from decoder: Decoder) throws {
        try super.init(from: decoder)
        let container = try decoder.container(keyedBy: CodingKeys.self)
        name = try container.decodeIfPresent(String.self, forKey: .name)
        parentAccountId = try container.decodeIfPresent(String.self, forKey: .parentAccountId)
        twilioAccountSid = try container.decodeIfPresent(String.self, forKey: .twilioAccountSid)
        ancestorIds = try container.decodeIfPresent([String].self, forKey: .ancestorIds) ?? []
        maxPhoneNumbers = try container.decodeIfPresent(Int.self, forKey: .maxPhoneNumbers)
        isBYOA = try container.decodeIfPresent(Bool.self, forKey: .isBYOA)
        trustHubProfileSid = try container.decodeIfPresent(String.self, forKey: .trustHubProfileSid)
        logoId = try container.decodeIfPresent(String.self, forKey: .logoId)
        logoUri = try container.decodeIfPresent(String.self, forKey: .logoUri)
        billingSettings = try container.decodeIfPresent(BillingSettings.self, forKey: .billingSettings)
    }

    public override func encode(to encoder: Encoder) throws {
        try super.encode(to: encoder)
        var container = encoder.container(keyedBy: CodingKeys.self)
        if name != nil { try container.encode(name, forKey: .name) }
        if parentAccountId != nil { try container.encode(parentAccountId, forKey: .parentAccountId) }
        if twilioAccountSid != nil { try container.encode(twilioAccountSid, forKey: .twilioAccountSid) }
        if ancestorIds.count > 0 { try container.encode(ancestorIds, forKey: .ancestorIds) }
        if maxPhoneNumbers != nil { try container.encode(maxPhoneNumbers, forKey: .maxPhoneNumbers) }
        if isBYOA != nil { try container.encode(isBYOA, forKey: .isBYOA) }
        if trustHubProfileSid != nil { try container.encode(trustHubProfileSid, forKey: .trustHubProfileSid) }
        if logoId != nil { try container.encode(logoId, forKey: .logoId) }
        if logoUri != nil { try container.encode(logoUri, forKey: .logoUri) }
        if billingSettings != nil { try container.encode(billingSettings, forKey: .billingSettings) }
    }
}

public class EntityInfo : Codable
{
    /**
    * The ID of the object
    */
    // @ApiMember(Description="The ID of the object")
    public var id:String?

    /**
    * The date the object was created
    */
    // @ApiMember(Description="The date the object was created")
    public var dateCreated:String?

    /**
    * The date the object was last modified
    */
    // @ApiMember(Description="The date the object was last modified")
    public var dateLastModified:String?

    /**
    * The user that created this object
    */
    // @ApiMember(Description="The user that created this object")
    public var createdBy:String?

    /**
    * The user that last modified this object
    */
    // @ApiMember(Description="The user that last modified this object")
    public var lastModifiedBy:String?

    required public init(){}
}


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

PATCH /accounts/{accountId} HTTP/1.1 
Host: evovoice.io 
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length

{
	accountId: String,
	name: String,
	maxPhoneNumbers: 0,
	logoId: String,
	billingSettings: 
	{
		base: 
		{
			baseCost: 0,
			rawUnitMultiplier: 0,
			unitCost: 0,
			allowance: 0
		},
		localNumbers: 
		{
			baseCost: 0,
			rawUnitMultiplier: 0,
			unitCost: 0,
			allowance: 0
		},
		tollFreeNumbers: 
		{
			baseCost: 0,
			rawUnitMultiplier: 0,
			unitCost: 0,
			allowance: 0
		},
		inboundVoiceCalls: 
		{
			baseCost: 0,
			rawUnitMultiplier: 0,
			unitCost: 0,
			allowance: 0
		},
		outboundVoiceCalls: 
		{
			baseCost: 0,
			rawUnitMultiplier: 0,
			unitCost: 0,
			allowance: 0
		},
		inboundFaxes: 
		{
			baseCost: 0,
			rawUnitMultiplier: 0,
			unitCost: 0,
			allowance: 0
		},
		outboundFaxes: 
		{
			baseCost: 0,
			rawUnitMultiplier: 0,
			unitCost: 0,
			allowance: 0
		},
		inboundSmsMessages: 
		{
			baseCost: 0,
			rawUnitMultiplier: 0,
			unitCost: 0,
			allowance: 0
		},
		outboundSmsMessages: 
		{
			baseCost: 0,
			rawUnitMultiplier: 0,
			unitCost: 0,
			allowance: 0
		}
	}
}
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length

{
	name: String,
	parentAccountId: String,
	twilioAccountSid: String,
	ancestorIds: 
	[
		String
	],
	maxPhoneNumbers: 0,
	isBYOA: False,
	trustHubProfileSid: String,
	logoId: String,
	logoUri: String,
	billingSettings: 
	{
		base: 
		{
			baseCost: 0,
			rawUnitMultiplier: 0,
			unitCost: 0,
			allowance: 0
		},
		localNumbers: 
		{
			baseCost: 0,
			rawUnitMultiplier: 0,
			unitCost: 0,
			allowance: 0
		},
		tollFreeNumbers: 
		{
			baseCost: 0,
			rawUnitMultiplier: 0,
			unitCost: 0,
			allowance: 0
		},
		inboundVoiceCalls: 
		{
			baseCost: 0,
			rawUnitMultiplier: 0,
			unitCost: 0,
			allowance: 0
		},
		outboundVoiceCalls: 
		{
			baseCost: 0,
			rawUnitMultiplier: 0,
			unitCost: 0,
			allowance: 0
		},
		inboundFaxes: 
		{
			baseCost: 0,
			rawUnitMultiplier: 0,
			unitCost: 0,
			allowance: 0
		},
		outboundFaxes: 
		{
			baseCost: 0,
			rawUnitMultiplier: 0,
			unitCost: 0,
			allowance: 0
		},
		inboundSmsMessages: 
		{
			baseCost: 0,
			rawUnitMultiplier: 0,
			unitCost: 0,
			allowance: 0
		},
		outboundSmsMessages: 
		{
			baseCost: 0,
			rawUnitMultiplier: 0,
			unitCost: 0,
			allowance: 0
		}
	},
	id: String,
	dateCreated: String,
	dateLastModified: String,
	createdBy: String,
	lastModifiedBy: String
}