Evo Voice

<back to all web services

PatchIntegration

Update a specific integration

The following routes are available for this service:
PATCH/integrations/{integrationId}
<?php namespace dtos;

use DateTime;
use Exception;
use DateInterval;
use JsonSerializable;
use ServiceStack\{IReturn,IReturnVoid,IGet,IPost,IPut,IDelete,IPatch,IMeta,IHasSessionId,IHasBearerToken,IHasVersion};
use ServiceStack\{ICrud,ICreateDb,IUpdateDb,IPatchDb,IDeleteDb,ISaveDb,AuditBase,QueryDb,QueryDb2,QueryData,QueryData2,QueryResponse};
use ServiceStack\{ResponseStatus,ResponseError,EmptyResponse,IdResponse,ArrayList,KeyValuePair2,StringResponse,StringsResponse,Tuple2,Tuple3,ByteArray};
use ServiceStack\{JsonConverters,Returns,TypeContext};


class EntityInfo implements JsonSerializable
{
    public function __construct(
        /** @description The ID of the object */
        // @ApiMember(Description="The ID of the object")
        /** @var string|null */
        public ?string $id=null,

        /** @description The date the object was created */
        // @ApiMember(Description="The date the object was created")
        /** @var string|null */
        public ?string $dateCreated=null,

        /** @description The date the object was last modified */
        // @ApiMember(Description="The date the object was last modified")
        /** @var string|null */
        public ?string $dateLastModified=null,

        /** @description The user that created this object */
        // @ApiMember(Description="The user that created this object")
        /** @var string|null */
        public ?string $createdBy=null,

        /** @description The user that last modified this object */
        // @ApiMember(Description="The user that last modified this object")
        /** @var string|null */
        public ?string $lastModifiedBy=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['id'])) $this->id = $o['id'];
        if (isset($o['dateCreated'])) $this->dateCreated = $o['dateCreated'];
        if (isset($o['dateLastModified'])) $this->dateLastModified = $o['dateLastModified'];
        if (isset($o['createdBy'])) $this->createdBy = $o['createdBy'];
        if (isset($o['lastModifiedBy'])) $this->lastModifiedBy = $o['lastModifiedBy'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->id)) $o['id'] = $this->id;
        if (isset($this->dateCreated)) $o['dateCreated'] = $this->dateCreated;
        if (isset($this->dateLastModified)) $o['dateLastModified'] = $this->dateLastModified;
        if (isset($this->createdBy)) $o['createdBy'] = $this->createdBy;
        if (isset($this->lastModifiedBy)) $o['lastModifiedBy'] = $this->lastModifiedBy;
        return empty($o) ? new class(){} : $o;
    }
}

class CustomerBreadcrumb implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $id=null,
        /** @var string|null */
        public ?string $name=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['id'])) $this->id = $o['id'];
        if (isset($o['name'])) $this->name = $o['name'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->id)) $o['id'] = $this->id;
        if (isset($this->name)) $o['name'] = $this->name;
        return empty($o) ? new class(){} : $o;
    }
}

enum IntegrationTypes : string
{
    case HostedSuite = 'HostedSuite';
    case OfficeRnd = 'OfficeRnd';
    case Zoho = 'Zoho';
}

enum IntegrationStatuses : string
{
    case NotConfigured = 'NotConfigured';
    case Error = 'Error';
    case OK = 'OK';
}

enum ValueTypes : string
{
    case NotSpecified = 'NotSpecified';
    case String = 'String';
    case Boolean = 'Boolean';
    case Number = 'Number';
    case List = 'List';
    case Struct = 'Struct';
    case Transition = 'Transition';
    case Custom = 'Custom';
    case Date = 'Date';
    case AudioFile = 'AudioFile';
    case TimeZoneId = 'TimeZoneId';
    case PhoneNumber = 'PhoneNumber';
    case User = 'User';
    case Endpoint = 'Endpoint';
    case Time = 'Time';
    case File = 'File';
    case FaxNumber = 'FaxNumber';
    case EmailAccount = 'EmailAccount';
    case Customer = 'Customer';
    case Flow = 'Flow';
    case Team = 'Team';
    case FlowReference = 'FlowReference';
    case Integration = 'Integration';
    case Assistant = 'Assistant';
}

enum UIHints : string
{
    case None = 'None';
    case LargeText = 'LargeText';
    case InlineForm = 'InlineForm';
    case Password = 'Password';
    case InlineStruct = 'InlineStruct';
}

/**
 * @template array of String
 * @template array1 of Value
 */
class Struct extends array implements JsonSerializable
{
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = parent::jsonSerialize();
        return empty($o) ? new class(){} : $o;
    }
}

class Value implements JsonSerializable
{
    public function __construct(
        /** @var bool|null */
        public ?bool $boolValue=null,
        /** @var string|null */
        public ?string $stringValue=null,
        /** @var float|null */
        public ?float $numberValue=null,
        /** @var array<Struct>|null */
        public ?array $listValue=null,
        /** @var Struct|null */
        public ?Struct $structValue=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['boolValue'])) $this->boolValue = $o['boolValue'];
        if (isset($o['stringValue'])) $this->stringValue = $o['stringValue'];
        if (isset($o['numberValue'])) $this->numberValue = $o['numberValue'];
        if (isset($o['listValue'])) $this->listValue = JsonConverters::fromArray('Struct', $o['listValue']);
        if (isset($o['structValue'])) $this->structValue = JsonConverters::from('Struct', $o['structValue']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->boolValue)) $o['boolValue'] = $this->boolValue;
        if (isset($this->stringValue)) $o['stringValue'] = $this->stringValue;
        if (isset($this->numberValue)) $o['numberValue'] = $this->numberValue;
        if (isset($this->listValue)) $o['listValue'] = JsonConverters::toArray('Struct', $this->listValue);
        if (isset($this->structValue)) $o['structValue'] = JsonConverters::to('Struct', $this->structValue);
        return empty($o) ? new class(){} : $o;
    }
}

enum DataFieldUniqueness : string
{
    case NotUnique = 'NotUnique';
    case Unique = 'Unique';
    case UniqueToCustomer = 'UniqueToCustomer';
}

enum UserDataFieldModes : string
{
    case Hidden = 'Hidden';
    case ReadOnly = 'ReadOnly';
    case ReadWrite = 'ReadWrite';
}

class DataField implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $id=null,
        /** @var string|null */
        public ?string $name=null,
        /** @var ValueTypes|null */
        public ?ValueTypes $type=null,
        /** @var UIHints|null */
        public ?UIHints $uiHint=null,
        /** @var string|null */
        public ?string $uiTab=null,
        /** @var bool|null */
        public ?bool $isAsync=null,
        /** @var bool|null */
        public ?bool $disableBinding=null,
        /** @var DataType|null */
        public ?DataType $structType=null,
        /** @var DataType|null */
        public ?DataType $listType=null,
        /** @var string|null */
        public ?string $description=null,
        /** @var array<string>|null */
        public ?array $possibleValues=null,
        /** @var bool|null */
        public ?bool $isOutput=null,
        /** @var string|null */
        public ?string $customFieldValuesUrl=null,
        /** @var Value|null */
        public ?Value $defaultValue=null,
        /** @var string|null */
        public ?string $transitionNameFormat=null,
        /** @var DataFieldUniqueness|null */
        public ?DataFieldUniqueness $uniqueness=null,
        /** @var bool|null */
        public ?bool $voiceOnly=null,
        /** @var string|null */
        public ?string $conditionalVisibilityField=null,
        /** @var string|null */
        public ?string $conditionalVisibilityValue=null,
        /** @var bool|null */
        public ?bool $noEvalTemplate=null,
        /** @var UserDataFieldModes|null */
        public ?UserDataFieldModes $userMode=null,
        /** @var bool|null */
        public ?bool $anyValueType=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['id'])) $this->id = $o['id'];
        if (isset($o['name'])) $this->name = $o['name'];
        if (isset($o['type'])) $this->type = JsonConverters::from('ValueTypes', $o['type']);
        if (isset($o['uiHint'])) $this->uiHint = JsonConverters::from('UIHints', $o['uiHint']);
        if (isset($o['uiTab'])) $this->uiTab = $o['uiTab'];
        if (isset($o['isAsync'])) $this->isAsync = $o['isAsync'];
        if (isset($o['disableBinding'])) $this->disableBinding = $o['disableBinding'];
        if (isset($o['structType'])) $this->structType = JsonConverters::from('DataType', $o['structType']);
        if (isset($o['listType'])) $this->listType = JsonConverters::from('DataType', $o['listType']);
        if (isset($o['description'])) $this->description = $o['description'];
        if (isset($o['possibleValues'])) $this->possibleValues = JsonConverters::fromArray('string', $o['possibleValues']);
        if (isset($o['isOutput'])) $this->isOutput = $o['isOutput'];
        if (isset($o['customFieldValuesUrl'])) $this->customFieldValuesUrl = $o['customFieldValuesUrl'];
        if (isset($o['defaultValue'])) $this->defaultValue = JsonConverters::from('Value', $o['defaultValue']);
        if (isset($o['transitionNameFormat'])) $this->transitionNameFormat = $o['transitionNameFormat'];
        if (isset($o['uniqueness'])) $this->uniqueness = JsonConverters::from('DataFieldUniqueness', $o['uniqueness']);
        if (isset($o['voiceOnly'])) $this->voiceOnly = $o['voiceOnly'];
        if (isset($o['conditionalVisibilityField'])) $this->conditionalVisibilityField = $o['conditionalVisibilityField'];
        if (isset($o['conditionalVisibilityValue'])) $this->conditionalVisibilityValue = $o['conditionalVisibilityValue'];
        if (isset($o['noEvalTemplate'])) $this->noEvalTemplate = $o['noEvalTemplate'];
        if (isset($o['userMode'])) $this->userMode = JsonConverters::from('UserDataFieldModes', $o['userMode']);
        if (isset($o['anyValueType'])) $this->anyValueType = $o['anyValueType'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->id)) $o['id'] = $this->id;
        if (isset($this->name)) $o['name'] = $this->name;
        if (isset($this->type)) $o['type'] = JsonConverters::to('ValueTypes', $this->type);
        if (isset($this->uiHint)) $o['uiHint'] = JsonConverters::to('UIHints', $this->uiHint);
        if (isset($this->uiTab)) $o['uiTab'] = $this->uiTab;
        if (isset($this->isAsync)) $o['isAsync'] = $this->isAsync;
        if (isset($this->disableBinding)) $o['disableBinding'] = $this->disableBinding;
        if (isset($this->structType)) $o['structType'] = JsonConverters::to('DataType', $this->structType);
        if (isset($this->listType)) $o['listType'] = JsonConverters::to('DataType', $this->listType);
        if (isset($this->description)) $o['description'] = $this->description;
        if (isset($this->possibleValues)) $o['possibleValues'] = JsonConverters::toArray('string', $this->possibleValues);
        if (isset($this->isOutput)) $o['isOutput'] = $this->isOutput;
        if (isset($this->customFieldValuesUrl)) $o['customFieldValuesUrl'] = $this->customFieldValuesUrl;
        if (isset($this->defaultValue)) $o['defaultValue'] = JsonConverters::to('Value', $this->defaultValue);
        if (isset($this->transitionNameFormat)) $o['transitionNameFormat'] = $this->transitionNameFormat;
        if (isset($this->uniqueness)) $o['uniqueness'] = JsonConverters::to('DataFieldUniqueness', $this->uniqueness);
        if (isset($this->voiceOnly)) $o['voiceOnly'] = $this->voiceOnly;
        if (isset($this->conditionalVisibilityField)) $o['conditionalVisibilityField'] = $this->conditionalVisibilityField;
        if (isset($this->conditionalVisibilityValue)) $o['conditionalVisibilityValue'] = $this->conditionalVisibilityValue;
        if (isset($this->noEvalTemplate)) $o['noEvalTemplate'] = $this->noEvalTemplate;
        if (isset($this->userMode)) $o['userMode'] = JsonConverters::to('UserDataFieldModes', $this->userMode);
        if (isset($this->anyValueType)) $o['anyValueType'] = $this->anyValueType;
        return empty($o) ? new class(){} : $o;
    }
}

class DataType implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $typeName=null,
        /** @var array<DataField>|null */
        public ?array $fields=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['typeName'])) $this->typeName = $o['typeName'];
        if (isset($o['fields'])) $this->fields = JsonConverters::fromArray('DataField', $o['fields']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->typeName)) $o['typeName'] = $this->typeName;
        if (isset($this->fields)) $o['fields'] = JsonConverters::toArray('DataField', $this->fields);
        return empty($o) ? new class(){} : $o;
    }
}

enum IntegrationFeatures : string
{
    case CrmSync = 'CrmSync';
    case OAuth2 = 'OAuth2';
}

class IntegrationInfo extends EntityInfo implements JsonSerializable
{
    /**
     * @param string|null $id
     * @param string|null $dateCreated
     * @param string|null $dateLastModified
     * @param string|null $createdBy
     * @param string|null $lastModifiedBy
     */
    public function __construct(
        ?string $id=null,
        ?string $dateCreated=null,
        ?string $dateLastModified=null,
        ?string $createdBy=null,
        ?string $lastModifiedBy=null,
        /** @description The ID of the account associated with this integration */
        // @ApiMember(Description="The ID of the account associated with this integration")
        /** @var string|null */
        public ?string $accountId=null,

        /** @description The ID of the customer this integration is associated with */
        // @ApiMember(Description="The ID of the customer this integration is associated with")
        /** @var string|null */
        public ?string $customerId=null,

        /** @description The name of the customer this integration is associated with */
        // @ApiMember(Description="The name of the customer this integration is associated with")
        /** @var string|null */
        public ?string $customerName=null,

        /** @description The date the integration was sync'd last */
        // @ApiMember(Description="The date the integration was sync'd last")
        /** @var string|null */
        public ?string $dateLastSync=null,

        /** @description The breadcrumb to the customer for this integration */
        // @ApiMember(Description="The breadcrumb to the customer for this integration")
        /** @var array<CustomerBreadcrumb>|null */
        public ?array $customerBreadcrumb=null,

        /** @description The name of the integration (e.g. HostedSuite Dallas) */
        // @ApiMember(Description="The name of the integration (e.g. HostedSuite Dallas)")
        /** @var string|null */
        public ?string $name=null,

        /** @description Automatically create new customers / users when sync'ing with CRM? */
        // @ApiMember(Description="Automatically create new customers / users when sync'ing with CRM?")
        /** @var bool|null */
        public ?bool $automaticallyCreateCustomers=null,

        /** @description The type of integration */
        // @ApiMember(Description="The type of integration")
        /** @var IntegrationTypes|null */
        public ?IntegrationTypes $type=null,

        /** @description The status of the integration */
        // @ApiMember(Description="The status of the integration")
        /** @var IntegrationStatuses|null */
        public ?IntegrationStatuses $status=null,

        /** @description The status of the integration */
        // @ApiMember(Description="The status of the integration")
        /** @var string|null */
        public ?string $statusMessage=null,

        /** @description The settings type for this integration */
        // @ApiMember(Description="The settings type for this integration")
        /** @var DataType|null */
        public ?DataType $settingsDataType=null,

        /** @description The settings for this integration */
        // @ApiMember(Description="The settings for this integration")
        /** @var Struct|null */
        public ?Struct $settings=null,

        /** @description The features supported by this integration */
        // @ApiMember(Description="The features supported by this integration")
        /** @var array<IntegrationFeatures>|null */
        public ?array $features=null,

        /** @description Is this integration authorized (OAuth)? */
        // @ApiMember(Description="Is this integration authorized (OAuth)?")
        /** @var bool|null */
        public ?bool $isAuthorized=null
    ) {
        parent::__construct($id,$dateCreated,$dateLastModified,$createdBy,$lastModifiedBy);
    }

    /** @throws Exception */
    public function fromMap($o): void {
        parent::fromMap($o);
        if (isset($o['accountId'])) $this->accountId = $o['accountId'];
        if (isset($o['customerId'])) $this->customerId = $o['customerId'];
        if (isset($o['customerName'])) $this->customerName = $o['customerName'];
        if (isset($o['dateLastSync'])) $this->dateLastSync = $o['dateLastSync'];
        if (isset($o['customerBreadcrumb'])) $this->customerBreadcrumb = JsonConverters::fromArray('CustomerBreadcrumb', $o['customerBreadcrumb']);
        if (isset($o['name'])) $this->name = $o['name'];
        if (isset($o['automaticallyCreateCustomers'])) $this->automaticallyCreateCustomers = $o['automaticallyCreateCustomers'];
        if (isset($o['type'])) $this->type = JsonConverters::from('IntegrationTypes', $o['type']);
        if (isset($o['status'])) $this->status = JsonConverters::from('IntegrationStatuses', $o['status']);
        if (isset($o['statusMessage'])) $this->statusMessage = $o['statusMessage'];
        if (isset($o['settingsDataType'])) $this->settingsDataType = JsonConverters::from('DataType', $o['settingsDataType']);
        if (isset($o['settings'])) $this->settings = JsonConverters::from('Struct', $o['settings']);
        if (isset($o['features'])) $this->features = JsonConverters::fromArray('IntegrationFeatures', $o['features']);
        if (isset($o['isAuthorized'])) $this->isAuthorized = $o['isAuthorized'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = parent::jsonSerialize();
        if (isset($this->accountId)) $o['accountId'] = $this->accountId;
        if (isset($this->customerId)) $o['customerId'] = $this->customerId;
        if (isset($this->customerName)) $o['customerName'] = $this->customerName;
        if (isset($this->dateLastSync)) $o['dateLastSync'] = $this->dateLastSync;
        if (isset($this->customerBreadcrumb)) $o['customerBreadcrumb'] = JsonConverters::toArray('CustomerBreadcrumb', $this->customerBreadcrumb);
        if (isset($this->name)) $o['name'] = $this->name;
        if (isset($this->automaticallyCreateCustomers)) $o['automaticallyCreateCustomers'] = $this->automaticallyCreateCustomers;
        if (isset($this->type)) $o['type'] = JsonConverters::to('IntegrationTypes', $this->type);
        if (isset($this->status)) $o['status'] = JsonConverters::to('IntegrationStatuses', $this->status);
        if (isset($this->statusMessage)) $o['statusMessage'] = $this->statusMessage;
        if (isset($this->settingsDataType)) $o['settingsDataType'] = JsonConverters::to('DataType', $this->settingsDataType);
        if (isset($this->settings)) $o['settings'] = JsonConverters::to('Struct', $this->settings);
        if (isset($this->features)) $o['features'] = JsonConverters::toArray('IntegrationFeatures', $this->features);
        if (isset($this->isAuthorized)) $o['isAuthorized'] = $this->isAuthorized;
        return empty($o) ? new class(){} : $o;
    }
}

/** @description Update a specific integration */
// @Api(Description="Update a specific integration")
class PatchIntegration implements IPatch, JsonSerializable
{
    public function __construct(
        /** @description The ID of the integration you want to update */
        // @ApiMember(Description="The ID of the integration you want to update")
        /** @var string|null */
        public ?string $integrationId=null,

        /** @description The name for the integration */
        // @ApiMember(Description="The name for the integration")
        /** @var string|null */
        public ?string $name=null,

        /** @description The parent customer for this integration */
        // @ApiMember(Description="The parent customer for this integration")
        /** @var string|null */
        public ?string $customerId=null,

        /** @description Automatically create new customers / users when sync'ing with CRM? */
        // @ApiMember(Description="Automatically create new customers / users when sync'ing with CRM?")
        /** @var bool|null */
        public ?bool $automaticallyCreateCustomers=null,

        /** @description Settings values for this integration */
        // @ApiMember(Description="Settings values for this integration")
        /** @var Struct|null */
        public ?Struct $settings=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['integrationId'])) $this->integrationId = $o['integrationId'];
        if (isset($o['name'])) $this->name = $o['name'];
        if (isset($o['customerId'])) $this->customerId = $o['customerId'];
        if (isset($o['automaticallyCreateCustomers'])) $this->automaticallyCreateCustomers = $o['automaticallyCreateCustomers'];
        if (isset($o['settings'])) $this->settings = JsonConverters::from('Struct', $o['settings']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->integrationId)) $o['integrationId'] = $this->integrationId;
        if (isset($this->name)) $o['name'] = $this->name;
        if (isset($this->customerId)) $o['customerId'] = $this->customerId;
        if (isset($this->automaticallyCreateCustomers)) $o['automaticallyCreateCustomers'] = $this->automaticallyCreateCustomers;
        if (isset($this->settings)) $o['settings'] = JsonConverters::to('Struct', $this->settings);
        return empty($o) ? new class(){} : $o;
    }
}

PHP PatchIntegration 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.

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

{"integrationId":"String","name":"String","customerId":"String","automaticallyCreateCustomers":false}
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: length

{"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"}