Requires any of the roles: | SystemAdministrator, Manager, Customer |
POST | /packages |
---|
import datetime
import decimal
from marshmallow.fields import *
from servicestack import *
from typing import *
from dataclasses import dataclass, field
from dataclasses_json import dataclass_json, LetterCase, Undefined, config
from enum import Enum, IntEnum
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class EntityInfo:
# @ApiMember(Description="The ID of the object")
id: Optional[str] = None
"""
The ID of the object
"""
# @ApiMember(Description="The date the object was created")
date_created: Optional[str] = None
"""
The date the object was created
"""
# @ApiMember(Description="The date the object was last modified")
date_last_modified: Optional[str] = None
"""
The date the object was last modified
"""
# @ApiMember(Description="The user that created this object")
created_by: Optional[str] = None
"""
The user that created this object
"""
# @ApiMember(Description="The user that last modified this object")
last_modified_by: Optional[str] = None
"""
The user that last modified this object
"""
class FlowRoles(str, Enum):
UI = 'UI'
REFERENCE = 'Reference'
PHONE_NUMBER_ROUTING = 'PhoneNumberRouting'
USER_DIAL_OUT = 'UserDialOut'
FAX_NUMBER_ROUTING = 'FaxNumberRouting'
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class CustomerBreadcrumb:
id: Optional[str] = None
name: Optional[str] = None
class FlowNodeCategories(str, Enum):
GENERAL = 'General'
VOICE = 'Voice'
LOGIC = 'Logic'
DATE_AND_TIME = 'DateAndTime'
AUDIO = 'Audio'
MESSAGING = 'Messaging'
ASSISTANT = 'Assistant'
FLOWS = 'Flows'
FAX = 'Fax'
NETWORK = 'Network'
COOKIES = 'Cookies'
CALL_CENTER = 'CallCenter'
INTELLIGENCE = 'Intelligence'
class ValueTypes(str, Enum):
NOT_SPECIFIED = 'NotSpecified'
STRING = 'String'
BOOLEAN = 'Boolean'
NUMBER = 'Number'
LIST = 'List'
STRUCT = 'Struct'
TRANSITION = 'Transition'
CUSTOM = 'Custom'
DATE = 'Date'
AUDIO_FILE = 'AudioFile'
TIME_ZONE_ID = 'TimeZoneId'
PHONE_NUMBER = 'PhoneNumber'
USER = 'User'
ENDPOINT = 'Endpoint'
TIME = 'Time'
FILE = 'File'
FAX_NUMBER = 'FaxNumber'
EMAIL_ACCOUNT = 'EmailAccount'
CUSTOMER = 'Customer'
FLOW = 'Flow'
TEAM = 'Team'
FLOW_REFERENCE = 'FlowReference'
INTEGRATION = 'Integration'
ASSISTANT = 'Assistant'
class UIHints(str, Enum):
NONE = 'None'
LARGE_TEXT = 'LargeText'
INLINE_FORM = 'InlineForm'
PASSWORD = 'Password'
INLINE_STRUCT = 'InlineStruct'
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class Struct(Dict[str,Value]):
pass
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class Value:
bool_value: Optional[bool] = None
string_value: Optional[str] = None
number_value: Optional[float] = None
list_value: Optional[List[Struct]] = None
struct_value: Optional[Struct] = None
class DataFieldUniqueness(str, Enum):
NOT_UNIQUE = 'NotUnique'
UNIQUE = 'Unique'
UNIQUE_TO_CUSTOMER = 'UniqueToCustomer'
class UserDataFieldModes(str, Enum):
HIDDEN = 'Hidden'
READ_ONLY = 'ReadOnly'
READ_WRITE = 'ReadWrite'
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class DataField:
id: Optional[str] = None
name: Optional[str] = None
type: Optional[ValueTypes] = None
ui_hint: Optional[UIHints] = None
ui_tab: Optional[str] = None
is_async: bool = False
disable_binding: bool = False
struct_type: Optional[DataType] = None
list_type: Optional[DataType] = None
description: Optional[str] = None
possible_values: Optional[List[str]] = None
is_output: bool = False
custom_field_values_url: Optional[str] = None
default_value: Optional[Value] = None
transition_name_format: Optional[str] = None
uniqueness: Optional[DataFieldUniqueness] = None
voice_only: bool = False
conditional_visibility_field: Optional[str] = None
conditional_visibility_value: Optional[str] = None
no_eval_template: bool = False
user_mode: Optional[UserDataFieldModes] = None
any_value_type: bool = False
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class DataType:
type_name: Optional[str] = None
fields: Optional[List[DataField]] = None
class FlowChannels(str, Enum):
VOICE = 'Voice'
CHAT = 'Chat'
FAX = 'Fax'
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class FlowNodeSpec:
# @ApiMember(Description="The name of this node")
name: Optional[str] = None
"""
The name of this node
"""
# @ApiMember(Description="A description of this node")
description: Optional[str] = None
"""
A description of this node
"""
# @ApiMember(Description="Icon class for this node (FontAwesome)")
icon_class: Optional[str] = None
"""
Icon class for this node (FontAwesome)
"""
# @ApiMember(Description="The type name for this node")
type_name: Optional[str] = None
"""
The type name for this node
"""
# @ApiMember(Description="The category this node should be grouped under")
category: Optional[FlowNodeCategories] = None
"""
The category this node should be grouped under
"""
# @ApiMember(Description="The URL where this node is located")
url: Optional[str] = None
"""
The URL where this node is located
"""
# @ApiMember(Description="The data type for this node")
data_type: Optional[DataType] = None
"""
The data type for this node
"""
# @ApiMember(Description="URL for documentation for this node")
documentation_url: Optional[str] = None
"""
URL for documentation for this node
"""
# @ApiMember(Description="The channels that this node is restricted to")
restrict_to_channels: Optional[List[FlowChannels]] = None
"""
The channels that this node is restricted to
"""
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class FlowNodeUI:
# @ApiMember(Description="The X position of the node")
x: float = 0.0
"""
The X position of the node
"""
# @ApiMember(Description="The Y position of the node")
y: float = 0.0
"""
The Y position of the node
"""
# @ApiMember(Description="Notes for this node")
notes: Optional[str] = None
"""
Notes for this node
"""
class ValueSources(str, Enum):
VALUE = 'Value'
FLOW = 'Flow'
SYSTEM = 'System'
CUSTOMER = 'Customer'
SESSION = 'Session'
ENDPOINT = 'Endpoint'
EXPRESSION = 'Expression'
USER = 'User'
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class NodeParameter:
id: Optional[str] = None
type: Optional[ValueTypes] = None
source: Optional[ValueSources] = None
is_async: bool = False
reference_id: Optional[str] = None
value: Optional[Value] = None
no_eval_template: bool = False
list_parameters: Optional[List[NodeParameterMap]] = None
struct_parameters: Optional[NodeParameterMap] = None
is_output: bool = False
expression: Optional[str] = None
list_type: Optional[DataType] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class NodeParameterMap(Dict[str,NodeParameter]):
pass
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class FlowNode:
# @ApiMember(Description="The ID of this node. Must be unique within the flow but can be anything")
id: Optional[str] = None
"""
The ID of this node. Must be unique within the flow but can be anything
"""
# @ApiMember(Description="Is this the starting node for the flow. Only one node can have this set")
is_start_node: bool = False
"""
Is this the starting node for the flow. Only one node can have this set
"""
# @ApiMember(Description="The name of the node, descriptive to be used as a reminder in the GUI")
name: Optional[str] = None
"""
The name of the node, descriptive to be used as a reminder in the GUI
"""
# @ApiMember(Description="The specification for the node")
spec: Optional[FlowNodeSpec] = None
"""
The specification for the node
"""
# @ApiMember(Description="The UI data for the node")
ui: Optional[FlowNodeUI] = None
"""
The UI data for the node
"""
# @ApiMember(Description="The data for this node. These will be POST'd to the endpoint when it is called.")
parameters: Optional[NodeParameterMap] = None
"""
The data for this node. These will be POST'd to the endpoint when it is called.
"""
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class FlowParameter(DataField):
is_public: bool = False
is_knob: bool = False
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class FlowExit:
# @ApiMember(Description="The unique ID for this exit")
id: Optional[str] = None
"""
The unique ID for this exit
"""
# @ApiMember(Description="The name of this exit")
name: Optional[str] = None
"""
The name of this exit
"""
# @ApiMember(Description="The UI for the exit")
ui: Optional[FlowNodeUI] = None
"""
The UI for the exit
"""
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class FlowUI:
selected_node: Optional[str] = None
canvas_x: float = 0.0
canvas_y: float = 0.0
canvas_zoom: float = 0.0
class TagColors(str, Enum):
MAGENTA = 'Magenta'
RED = 'Red'
VOLCANO = 'Volcano'
ORANGE = 'Orange'
GOLD = 'Gold'
LIME = 'Lime'
GREEN = 'Green'
CYAN = 'Cyan'
BLUE = 'Blue'
GEEK_BLUE = 'GeekBlue'
PURPLE = 'Purple'
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class Tag:
id: Optional[str] = None
name: Optional[str] = None
color: Optional[TagColors] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class FlowInfo(EntityInfo):
# @ApiMember(Description="The name of this flow")
name: Optional[str] = None
"""
The name of this flow
"""
# @ApiMember(Description="The roles that this flow has")
roles: Optional[List[FlowRoles]] = None
"""
The roles that this flow has
"""
# @ApiMember(Description="What this flow does")
description: Optional[str] = None
"""
What this flow does
"""
# @ApiMember(Description="Any notes for this flow")
notes: Optional[str] = None
"""
Any notes for this flow
"""
# @ApiMember(Description="The ID of the account associated with the flow")
account_id: Optional[str] = None
"""
The ID of the account associated with the flow
"""
# @ApiMember(Description="The name of the account associated with the flow")
account_name: Optional[str] = None
"""
The name of the account associated with the flow
"""
# @ApiMember(Description="The ID of the customer this flow is associated with")
customer_id: Optional[str] = None
"""
The ID of the customer this flow is associated with
"""
# @ApiMember(Description="The name of the customer this flow is associated with")
customer_name: Optional[str] = None
"""
The name of the customer this flow is associated with
"""
# @ApiMember(Description="The breadcrumb to the flow for this endpoint")
customer_breadcrumb: Optional[List[CustomerBreadcrumb]] = None
"""
The breadcrumb to the flow for this endpoint
"""
# @ApiMember(Description="The nodes in this flow")
nodes: Optional[List[FlowNode]] = None
"""
The nodes in this flow
"""
# @ApiMember(Description="The flow's parameters")
parameters: Optional[List[FlowParameter]] = None
"""
The flow's parameters
"""
# @ApiMember(Description="The flow's exits")
exits: Optional[List[FlowExit]] = None
"""
The flow's exits
"""
# @ApiMember(Description="The UI data for the flow")
ui: Optional[FlowUI] = None
"""
The UI data for the flow
"""
# @ApiMember(Description="The list of tags for this flow")
tags: Optional[List[Tag]] = None
"""
The list of tags for this flow
"""
# @ApiMember(Description="The number of nodes in this flow")
node_count: int = 0
"""
The number of nodes in this flow
"""
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class CustomerDataField(DataField):
show_in_search: bool = False
class EndpointTypes(str, Enum):
PHONE_NUMBER = 'PhoneNumber'
USER = 'User'
FAX_NUMBER = 'FaxNumber'
EMAIL_ADDRESS = 'EmailAddress'
UNUSED_1 = 'Unused_1'
UNUSED_2 = 'Unused_2'
UNUSED_3 = 'Unused_3'
UNUSED_4 = 'Unused_4'
UNUSED_5 = 'Unused_5'
TEAM = 'Team'
ASSISTANT = 'Assistant'
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class EndpointDataField(DataField):
show_in_search: bool = False
show_in_lists: bool = False
endpoint_type: Optional[EndpointTypes] = None
is_caller_id: bool = False
is_knob: bool = False
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class SystemSettingsField(DataField):
value: Optional[Value] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class PackageInfo:
flows: Optional[List[FlowInfo]] = None
customer_fields: Optional[List[CustomerDataField]] = None
endpoint_fields: Optional[List[EndpointDataField]] = None
system_fields: Optional[List[SystemSettingsField]] = None
# @Api(Description="Import the specified package")
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class ImportPackage:
"""
Import the specified package
"""
# @ApiMember(Description="The account you want to import the package into")
account_id: Optional[str] = None
"""
The account you want to import the package into
"""
# @ApiMember(Description="The package you want to import (should be from a previous export)")
package: Optional[PackageInfo] = None
"""
The package you want to import (should be from a previous export)
"""
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.
POST /packages HTTP/1.1
Host: team.evovoice.io
Accept: text/jsonl
Content-Type: text/jsonl
Content-Length: length
{"accountId":"String","package":{"flows":[{"name":"String","roles":["UI"],"description":"String","notes":"String","accountId":"String","accountName":"String","customerId":"String","customerName":"String","customerBreadcrumb":[{"id":"String","name":"String"}],"nodes":[{"id":"String","isStartNode":false,"name":"String","spec":{"name":"String","description":"String","iconClass":"String","typeName":"String","category":"General","url":"String","documentationUrl":"String","restrictToChannels":["Voice"]},"ui":{"x":0,"y":0,"notes":"String"},"parameters":{}}],"parameters":[{"isPublic":false,"isKnob":false,"id":"String","name":"String","type":"NotSpecified","uiHint":"None","uiTab":"String","isAsync":false,"disableBinding":false,"description":"String","possibleValues":["String"],"isOutput":false,"customFieldValuesUrl":"String","defaultValue":{"boolValue":false,"stringValue":"String","numberValue":0,"listValue":[null]},"transitionNameFormat":"String","uniqueness":"NotUnique","voiceOnly":false,"conditionalVisibilityField":"String","conditionalVisibilityValue":"String","noEvalTemplate":false,"userMode":"Hidden","anyValueType":false}],"exits":[{"id":"String","name":"String","ui":{"x":0,"y":0,"notes":"String"}}],"ui":{"selectedNode":"String","canvasX":0,"canvasY":0,"canvasZoom":0},"tags":[{"id":"String","name":"String","color":"Magenta"}],"nodeCount":0,"id":"String","dateCreated":"String","dateLastModified":"String","createdBy":"String","lastModifiedBy":"String"}],"customerFields":[{"showInSearch":false,"id":"String","name":"String","type":"NotSpecified","uiHint":"None","uiTab":"String","isAsync":false,"disableBinding":false,"description":"String","possibleValues":["String"],"isOutput":false,"customFieldValuesUrl":"String","defaultValue":{"boolValue":false,"stringValue":"String","numberValue":0,"listValue":[null]},"transitionNameFormat":"String","uniqueness":"NotUnique","voiceOnly":false,"conditionalVisibilityField":"String","conditionalVisibilityValue":"String","noEvalTemplate":false,"userMode":"Hidden","anyValueType":false}],"endpointFields":[{"showInSearch":false,"showInLists":false,"endpointType":"PhoneNumber","isCallerId":false,"isKnob":false,"id":"String","name":"String","type":"NotSpecified","uiHint":"None","uiTab":"String","isAsync":false,"disableBinding":false,"description":"String","possibleValues":["String"],"isOutput":false,"customFieldValuesUrl":"String","defaultValue":{"boolValue":false,"stringValue":"String","numberValue":0,"listValue":[null]},"transitionNameFormat":"String","uniqueness":"NotUnique","voiceOnly":false,"conditionalVisibilityField":"String","conditionalVisibilityValue":"String","noEvalTemplate":false,"userMode":"Hidden","anyValueType":false}],"systemFields":[{"value":{"boolValue":false,"stringValue":"String","numberValue":0,"listValue":[null]},"id":"String","name":"String","type":"NotSpecified","uiHint":"None","uiTab":"String","isAsync":false,"disableBinding":false,"description":"String","possibleValues":["String"],"isOutput":false,"customFieldValuesUrl":"String","defaultValue":{"boolValue":false,"stringValue":"String","numberValue":0,"listValue":[null]},"transitionNameFormat":"String","uniqueness":"NotUnique","voiceOnly":false,"conditionalVisibilityField":"String","conditionalVisibilityValue":"String","noEvalTemplate":false,"userMode":"Hidden","anyValueType":false}]}}