GET | /integrations |
---|
import Foundation
import ServiceStack
/**
* Retrieve integrations
*/
// @Api(Description="Retrieve integrations")
public class ListIntegrations : ListRequest<IntegrationInfo>
{
/**
* Filter by accounts
*/
// @ApiMember(Description="Filter by accounts")
public var accountIds:[String]
/**
* Filter by name
*/
// @ApiMember(Description="Filter by name")
public var nameFilter:String
/**
* The IDs of the parent customers you want to filter by
*/
// @ApiMember(Description="The IDs of the parent customers you want to filter by")
public var customerIds:[String]
/**
* If you want a shall customer integration filter (e.g. no deep children)
*/
// @ApiMember(Description="If you want a shall customer integration filter (e.g. no deep children)")
public var shallowParent:Bool
required public init(){ super.init() }
private enum CodingKeys : String, CodingKey {
case accountIds
case nameFilter
case customerIds
case shallowParent
}
required public init(from decoder: Decoder) throws {
try super.init(from: decoder)
let container = try decoder.container(keyedBy: CodingKeys.self)
accountIds = try container.decodeIfPresent([String].self, forKey: .accountIds) ?? []
nameFilter = try container.decodeIfPresent(String.self, forKey: .nameFilter)
customerIds = try container.decodeIfPresent([String].self, forKey: .customerIds) ?? []
shallowParent = try container.decodeIfPresent(Bool.self, forKey: .shallowParent)
}
public override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder)
var container = encoder.container(keyedBy: CodingKeys.self)
if accountIds != nil { try container.encode(accountIds, forKey: .accountIds) }
if nameFilter != nil { try container.encode(nameFilter, forKey: .nameFilter) }
if customerIds != nil { try container.encode(customerIds, forKey: .customerIds) }
if shallowParent != nil { try container.encode(shallowParent, forKey: .shallowParent) }
}
}
public class ListRequest<T : Codable> : IGet, Codable
{
/**
* The page of data to retrieve
*/
// @ApiMember(Description="The page of data to retrieve")
public var page:Int
/**
* If you want all objects to be returned. This should be used with care
*/
// @ApiMember(Description="If you want all objects to be returned. This should be used with care")
public var all:Bool
/**
* The number per page to retrieve
*/
// @ApiMember(Description="The number per page to retrieve")
public var countPerPage:Int
/**
* Specific IDs
*/
// @ApiMember(Description="Specific IDs")
public var specificIds:[String]
/**
* Specify a sort field
*/
// @ApiMember(Description="Specify a sort field")
public var sortField:String
/**
* Specify a sort order
*/
// @ApiMember(Description="Specify a sort order")
public var sortOrder:SortOrders
/**
* Disables total / page counts - improves performance. Returns only data. If there is no more data, Items will be empty array
*/
// @ApiMember(Description="Disables total / page counts - improves performance. Returns only data. If there is no more data, Items will be empty array")
public var simplifiedPaging:Bool
required public init(){}
}
public enum SortOrders : String, Codable
{
case Ascend
case Descend
}
public class IntegrationInfo : EntityInfo
{
/**
* The ID of the account associated with this integration
*/
// @ApiMember(Description="The ID of the account associated with this integration")
public var accountId:String
/**
* The ID of the customer this integration is associated with
*/
// @ApiMember(Description="The ID of the customer this integration is associated with")
public var customerId:String
/**
* The name of the customer this integration is associated with
*/
// @ApiMember(Description="The name of the customer this integration is associated with")
public var customerName:String
/**
* The date the integration was sync'd last
*/
// @ApiMember(Description="The date the integration was sync'd last")
public var dateLastSync:String
/**
* The breadcrumb to the customer for this integration
*/
// @ApiMember(Description="The breadcrumb to the customer for this integration")
public var customerBreadcrumb:[CustomerBreadcrumb]
/**
* The name of the integration (e.g. HostedSuite Dallas)
*/
// @ApiMember(Description="The name of the integration (e.g. HostedSuite Dallas)")
public var name:String
/**
* Automatically create new customers / users when sync'ing with CRM?
*/
// @ApiMember(Description="Automatically create new customers / users when sync'ing with CRM?")
public var automaticallyCreateCustomers:Bool
/**
* The type of integration
*/
// @ApiMember(Description="The type of integration")
public var type:IntegrationTypes
/**
* The status of the integration
*/
// @ApiMember(Description="The status of the integration")
public var status:IntegrationStatuses
/**
* The status of the integration
*/
// @ApiMember(Description="The status of the integration")
public var statusMessage:String
/**
* The settings type for this integration
*/
// @ApiMember(Description="The settings type for this integration")
public var settingsDataType:DataType
/**
* The settings for this integration
*/
// @ApiMember(Description="The settings for this integration")
public var settings:Struct
/**
* The features supported by this integration
*/
// @ApiMember(Description="The features supported by this integration")
public var features:[IntegrationFeatures]
/**
* Is this integration authorized (OAuth)?
*/
// @ApiMember(Description="Is this integration authorized (OAuth)?")
public var isAuthorized:Bool
required public init(){ super.init() }
private enum CodingKeys : String, CodingKey {
case accountId
case customerId
case customerName
case dateLastSync
case customerBreadcrumb
case name
case automaticallyCreateCustomers
case type
case status
case statusMessage
case settingsDataType
case settings
case features
case isAuthorized
}
required public init(from decoder: Decoder) throws {
try super.init(from: decoder)
let container = try decoder.container(keyedBy: CodingKeys.self)
accountId = try container.decodeIfPresent(String.self, forKey: .accountId)
customerId = try container.decodeIfPresent(String.self, forKey: .customerId)
customerName = try container.decodeIfPresent(String.self, forKey: .customerName)
dateLastSync = try container.decodeIfPresent(String.self, forKey: .dateLastSync)
customerBreadcrumb = try container.decodeIfPresent([CustomerBreadcrumb].self, forKey: .customerBreadcrumb) ?? []
name = try container.decodeIfPresent(String.self, forKey: .name)
automaticallyCreateCustomers = try container.decodeIfPresent(Bool.self, forKey: .automaticallyCreateCustomers)
type = try container.decodeIfPresent(IntegrationTypes.self, forKey: .type)
status = try container.decodeIfPresent(IntegrationStatuses.self, forKey: .status)
statusMessage = try container.decodeIfPresent(String.self, forKey: .statusMessage)
settingsDataType = try container.decodeIfPresent(DataType.self, forKey: .settingsDataType)
settings = try container.decodeIfPresent(Struct.self, forKey: .settings)
features = try container.decodeIfPresent([IntegrationFeatures].self, forKey: .features) ?? []
isAuthorized = try container.decodeIfPresent(Bool.self, forKey: .isAuthorized)
}
public override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder)
var container = encoder.container(keyedBy: CodingKeys.self)
if accountId != nil { try container.encode(accountId, forKey: .accountId) }
if customerId != nil { try container.encode(customerId, forKey: .customerId) }
if customerName != nil { try container.encode(customerName, forKey: .customerName) }
if dateLastSync != nil { try container.encode(dateLastSync, forKey: .dateLastSync) }
if customerBreadcrumb != nil { try container.encode(customerBreadcrumb, forKey: .customerBreadcrumb) }
if name != nil { try container.encode(name, forKey: .name) }
if automaticallyCreateCustomers != nil { try container.encode(automaticallyCreateCustomers, forKey: .automaticallyCreateCustomers) }
if type != nil { try container.encode(type, forKey: .type) }
if status != nil { try container.encode(status, forKey: .status) }
if statusMessage != nil { try container.encode(statusMessage, forKey: .statusMessage) }
if settingsDataType != nil { try container.encode(settingsDataType, forKey: .settingsDataType) }
if settings != nil { try container.encode(settings, forKey: .settings) }
if features != nil { try container.encode(features, forKey: .features) }
if isAuthorized != nil { try container.encode(isAuthorized, forKey: .isAuthorized) }
}
}
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(){}
}
public class CustomerBreadcrumb : Codable
{
public var id:String
public var name:String
required public init(){}
}
public enum IntegrationTypes : String, Codable
{
case HostedSuite
case OfficeRnd
case Zoho
}
public enum IntegrationStatuses : String, Codable
{
case NotConfigured
case Error
case OK
}
public class DataType : Codable
{
public var typeName:String
public var fields:[DataField]
required public init(){}
}
public class DataField : Codable
{
public var id:String
public var name:String
public var type:ValueTypes
public var uiHint:UIHints
public var uiTab:String
public var isAsync:Bool
public var disableBinding:Bool
public var structType:DataType
public var listType:DataType
public var Description:String
public var possibleValues:[String]
public var isOutput:Bool
public var customFieldValuesUrl:String
public var defaultValue:Value
public var transitionNameFormat:String
public var uniqueness:DataFieldUniqueness
public var voiceOnly:Bool
public var conditionalVisibilityField:String
public var conditionalVisibilityValue:String
public var noEvalTemplate:Bool
public var userMode:UserDataFieldModes
public var anyValueType:Bool
required public init(){}
}
public enum ValueTypes : String, Codable
{
case NotSpecified
case String
case Boolean
case Number
case List
case Struct
case Transition
case Custom
case Date
case AudioFile
case TimeZoneId
case PhoneNumber
case User
case Endpoint
case Time
case File
case FaxNumber
case EmailAccount
case Customer
case Flow
case Team
case FlowReference
case Integration
case Assistant
}
public enum UIHints : String, Codable
{
case None
case LargeText
case InlineForm
case Password
case InlineStruct
}
public class Value : Codable
{
public var boolValue:Bool?
public var stringValue:String
public var numberValue:Double?
public var listValue:[Struct]
public var structValue:Struct
required public init(){}
}
public class Struct : List<String:Value>
{
required public init(){ super.init() }
required public init(from decoder: Decoder) throws {
try super.init(from: decoder)
}
public override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder)
}
}
public enum DataFieldUniqueness : String, Codable
{
case NotUnique
case Unique
case UniqueToCustomer
}
public enum UserDataFieldModes : String, Codable
{
case Hidden
case ReadOnly
case ReadWrite
}
public enum IntegrationFeatures : String, Codable
{
case CrmSync
case OAuth2
}
public class ListResponse<T : Codable> : Codable
{
/**
* The items
*/
// @ApiMember(Description="The items")
public var items:[AccountInfo]
/**
* The total number of items
*/
// @ApiMember(Description="The total number of items")
public var totalCount:Int
/**
* The total number of pages
*/
// @ApiMember(Description="The total number of pages")
public var totalPages:Int
/**
* Are there more pages of items? Used with simplified paging
*/
// @ApiMember(Description="Are there more pages of items? Used with simplified paging")
public var hasMorePages:Bool
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 != nil { 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 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
public var aiInsights:BillingItem
public var aiLiveMinutes: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(){}
}
To override the Content-type in your clients, use the HTTP Accept Header, append the .other suffix or ?format=other
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
GET /integrations HTTP/1.1 Host: team.evovoice.io Accept: text/jsonl
HTTP/1.1 200 OK Content-Type: text/jsonl Content-Length: length {"items":[{"accountId":"String","customerId":"String","customerName":"String","dateLastSync":"String","customerBreadcrumb":[{"id":"String","name":"String"}],"name":"String","automaticallyCreateCustomers":false,"type":"HostedSuite","status":"NotConfigured","statusMessage":"String","features":["CrmSync"],"isAuthorized":false,"id":"String","dateCreated":"String","dateLastModified":"String","createdBy":"String","lastModifiedBy":"String"}],"totalCount":0,"totalPages":0,"hasMorePages":false}