Requires any of the roles: | SystemAdministrator, Manager, Customer |
GET | /flows |
---|
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
class SortOrders(str, Enum):
ASCEND = 'Ascend'
DESCEND = 'Descend'
T = TypeVar('T')
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class ListRequest(Generic[T], IReturn[ListResponse[T]], IGet):
# @ApiMember(Description="The page of data to retrieve")
page: int = 0
"""
The page of data to retrieve
"""
# @ApiMember(Description="If you want all objects to be returned. This should be used with care")
all: bool = False
"""
If you want all objects to be returned. This should be used with care
"""
# @ApiMember(Description="The number per page to retrieve")
count_per_page: int = 0
"""
The number per page to retrieve
"""
# @ApiMember(Description="Specific IDs")
specific_ids: Optional[List[str]] = None
"""
Specific IDs
"""
# @ApiMember(Description="Specify a sort field")
sort_field: Optional[str] = None
"""
Specify a sort field
"""
# @ApiMember(Description="Specify a sort order")
sort_order: Optional[SortOrders] = None
"""
Specify a sort order
"""
# @ApiMember(Description="Disables total / page counts - improves performance. Returns only data. If there is no more data, Items will be empty array")
simplified_paging: bool = False
"""
Disables total / page counts - improves performance. Returns only data. If there is no more data, Items will be empty array
"""
@staticmethod
def response_type(): return ListResponse[T]
@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
"""
# @Api(Description="Lists all the flows")
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class ListFlows(ListRequest[FlowInfo]):
"""
Lists all the flows
"""
# @ApiMember(Description="Filter by accounts")
account_ids: Optional[List[str]] = None
"""
Filter by accounts
"""
# @ApiMember(Description="The IDs of the customers whose flows you want to retrieve")
customer_ids: Optional[List[str]] = None
"""
The IDs of the customers whose flows you want to retrieve
"""
# @ApiMember(Description="Filter by name")
name_filter: Optional[str] = None
"""
Filter by name
"""
# @ApiMember(Description="The list of tag IDs to filter by (must contain all)")
tag_ids: Optional[List[str]] = None
"""
The list of tag IDs to filter by (must contain all)
"""
# @ApiMember(Description="List flows by specific role")
role: Optional[FlowRoles] = None
"""
List flows by specific role
"""
# @ApiMember(Description="Exclude nodes")
include_nodes: bool = False
"""
Exclude nodes
"""
# @ApiMember(Description="Node Type Filter")
node_type_filter: Optional[str] = None
"""
Node Type Filter
"""
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class BillingItem:
base_cost: float = 0.0
raw_unit_multiplier: float = 0.0
unit_cost: float = 0.0
allowance: int = 0
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class BillingSettings:
base: Optional[BillingItem] = None
local_numbers: Optional[BillingItem] = None
toll_free_numbers: Optional[BillingItem] = None
inbound_voice_calls: Optional[BillingItem] = None
outbound_voice_calls: Optional[BillingItem] = None
inbound_faxes: Optional[BillingItem] = None
outbound_faxes: Optional[BillingItem] = None
inbound_sms_messages: Optional[BillingItem] = None
outbound_sms_messages: Optional[BillingItem] = None
ai_insights: Optional[BillingItem] = None
ai_live_minutes: Optional[BillingItem] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class AccountInfo(EntityInfo):
# @ApiMember(Description="The name of this account")
name: Optional[str] = None
"""
The name of this account
"""
# @ApiMember(Description="The ID of this account's parent")
parent_account_id: Optional[str] = None
"""
The ID of this account's parent
"""
# @ApiMember(Description="The twilio account SID")
twilio_account_sid: Optional[str] = None
"""
The twilio account SID
"""
# @ApiMember(Description="The ancestors of this account. Useful for breadcrumbs")
ancestor_ids: Optional[List[str]] = None
"""
The ancestors of this account. Useful for breadcrumbs
"""
# @ApiMember(Description="The max number of phone numbers this account can have")
max_phone_numbers: int = 0
"""
The max number of phone numbers this account can have
"""
# @ApiMember(Description="This account is BYOA")
is_b_y_o_a: bool = False
"""
This account is BYOA
"""
# @ApiMember(Description="TrustHub Profile Sid")
trust_hub_profile_sid: Optional[str] = None
"""
TrustHub Profile Sid
"""
# @ApiMember(Description="The ID of the logo file")
logo_id: Optional[str] = None
"""
The ID of the logo file
"""
# @ApiMember(Description="The URI of the logo file")
logo_uri: Optional[str] = None
"""
The URI of the logo file
"""
# @ApiMember(Description="The billing settings for this account")
billing_settings: Optional[BillingSettings] = None
"""
The billing settings for this account
"""
T = TypeVar('T')
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class ListResponse(Generic[T]):
# @ApiMember(Description="The items")
items: Optional[List[AccountInfo]] = None
"""
The items
"""
# @ApiMember(Description="The total number of items")
total_count: int = 0
"""
The total number of items
"""
# @ApiMember(Description="The total number of pages")
total_pages: int = 0
"""
The total number of pages
"""
# @ApiMember(Description="Are there more pages of items? Used with simplified paging")
has_more_pages: bool = False
"""
Are there more pages of items? Used with simplified paging
"""
To override the Content-type in your clients, use the HTTP Accept Header, append the .csv suffix or ?format=csv
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
GET /flows HTTP/1.1 Host: team.evovoice.io Accept: text/csv
HTTP/1.1 200 OK Content-Type: text/csv Content-Length: length {"items":[{"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"}],"totalCount":0,"totalPages":0,"hasMorePages":false}