Evo Voice

<back to all web services

PatchIntegration

Update a specific integration

The following routes are available for this service:
PATCH/integrations/{integrationId}
import Foundation
import ServiceStack

/**
* Update a specific integration
*/
// @Api(Description="Update a specific integration")
public class PatchIntegration : IPatch, Codable
{
    /**
    * The ID of the integration you want to update
    */
    // @ApiMember(Description="The ID of the integration you want to update")
    public var integrationId:String

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

    /**
    * The parent customer for this integration
    */
    // @ApiMember(Description="The parent customer for this integration")
    public var customerId: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?

    /**
    * Settings values for this integration
    */
    // @ApiMember(Description="Settings values for this integration")
    public var settings: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 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 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 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
}


Swift PatchIntegration DTOs

To override the Content-type in your clients, use the HTTP Accept Header, append the .xml suffix or ?format=xml

HTTP + XML

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

PATCH /integrations/{integrationId} HTTP/1.1 
Host: team.evovoice.io 
Accept: application/xml
Content-Type: application/xml
Content-Length: length

<PatchIntegration xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Voice.Api.Integrations">
  <AutomaticallyCreateCustomers>false</AutomaticallyCreateCustomers>
  <CustomerId>String</CustomerId>
  <IntegrationId>String</IntegrationId>
  <Name>String</Name>
  <Settings xmlns:d2p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays" i:nil="true" />
</PatchIntegration>
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length

<IntegrationInfo xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Voice.Api.Integrations">
  <CreatedBy xmlns="http://schemas.datacontract.org/2004/07/Voice.Api">String</CreatedBy>
  <DateCreated xmlns="http://schemas.datacontract.org/2004/07/Voice.Api">String</DateCreated>
  <DateLastModified xmlns="http://schemas.datacontract.org/2004/07/Voice.Api">String</DateLastModified>
  <Id xmlns="http://schemas.datacontract.org/2004/07/Voice.Api">String</Id>
  <LastModifiedBy xmlns="http://schemas.datacontract.org/2004/07/Voice.Api">String</LastModifiedBy>
  <AccountId>String</AccountId>
  <AutomaticallyCreateCustomers>false</AutomaticallyCreateCustomers>
  <CustomerBreadcrumb xmlns:d2p1="http://schemas.datacontract.org/2004/07/Voice.Api.Customers">
    <d2p1:CustomerBreadcrumb>
      <d2p1:Id>String</d2p1:Id>
      <d2p1:Name>String</d2p1:Name>
    </d2p1:CustomerBreadcrumb>
  </CustomerBreadcrumb>
  <CustomerId>String</CustomerId>
  <CustomerName>String</CustomerName>
  <DateLastSync>String</DateLastSync>
  <Features>
    <IntegrationFeatures>CrmSync</IntegrationFeatures>
  </Features>
  <IsAuthorized>false</IsAuthorized>
  <Name>String</Name>
  <Settings xmlns:d2p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays" i:nil="true" />
  <SettingsDataType xmlns:d2p1="http://schemas.datacontract.org/2004/07/Voice.Api.Flows.Data" i:nil="true" />
  <Status>NotConfigured</Status>
  <StatusMessage>String</StatusMessage>
  <Type>HostedSuite</Type>
</IntegrationInfo>