generate-documentation_type-definitions.js

// Only the few most essential typedefs from https://docs.cc.sinch.com/cloud/api/CPExtInterface.html#message-schema
// Converted using https://francisn.com/json-schema-to-jsdoc/


/**
 * Contains properties for user related objects and properties
 * @typedef {object} user
 * @property {string} id Unique ID of the user
 * @property {object} name Name of the user
 * @property {string} name.first_name First Name of the user
 * @property {string} name.last_name Last Name of the user
 * @property {string} username Username of the user
 * @property {string} [alias] Alias of the user shown in conversations (ie: chat)
 * @property {"logged_in"|"logged_out"|"anonymous"} login_status Login status of the user
 * @property {string} [visible_a_number] The visible A-number (caller number) of the user. Default value is the current phone extension.
 * @property {"ready"|"not_ready"|"wrap_up"} work_status The work status of the user
 * @property {string} [daily_pause_time] Agent daily pause time (seconds)
 * @property {string} [daily_work_time] Agent daily work time (seconds)
 * @property {string} [default_email_from] Users default email from address
 * @property {string} [default_sms_from] Users default SMS from address
 * @property {string} [presence] Id for user's currently active presence profile
 * @property {array} [presence_profiles] All of the available profiles
 * @property {string} [chat_address] email address of the user
 * @property {string} extension Phone extension of the user
 * @property {string} language Language selected by agent server based on CCtr user configuration
 * @property {object} permissions User permissions
 * @property {boolean} [permissions.ecf_phone] ECF Phone Permission for user
 * @property {boolean} [permissions.phone] Phone Permission for user
 * @property {boolean} [permissions.mtd] MTD Permission for user
 * @property {string} [permissions.recording] Recording Permission (enabled | disabled | hidden) for user
 * @property {boolean} [permissions.update_visible_a_number] Visible A-number update Permission for user
 * @property {boolean} [permissions.video] Video Permission for user
 * @property {string} terminal_id terminalID of the client
 * @property {object} phone Language selected by agent server based on CCtr user configuration
 * @property {string} phone.sip_host sip host to which the sip client will connect to
 * @property {boolean} phone.sip_connected True = sip phone connected, False = sip phone not connected
 * @property {string} phone.extension Users sip number (when SIPML5 registers, it should use this number)
 * @property {array} phone.sip_proxies Array of ws_servers Address of SIP bridge to which we should route sip messages
 * @property {object} capabilities Capabilities of the user
 * @property {false|true} capabilities.video_chat Video chat capability of the user
 * @property {false|true} capabilities.phone Audio chat capability of the user
 */

/**
 * Information about a queue entity
 * @typedef {object} queue
 * @property {string} [id] Unique ID of the queue
 * @property {string} [name] CCtr Name of the queue
 * @property {boolean} [serve] Whether the agent is serving or not in a queue
 * @property {boolean} [forced_to_serve] Whether the queue needs to be served and cannot be changed by the user
 * @property {string} [type] Type of the queue
 * @property {number} [queue_autopwtime] Interaction wrapup time
 * @property {number} [queue_maxpicktimeout] Interaction offering time
 * @property {string} [queue_answerinfo] Interaction answer info
 * @property {string} [script_opening_type] Script opening type of the queue
 * @property {number} [threshold_max_wait_time_critical] Threshold value for queueing time
 * @property {number} [threshold_max_wait_time_warning] Threshold value for queueing time
 * @property {number} [threshold_interactions_critical] Threshold value for the amount of interactions
 * @property {number} [threshold_interactions_warning] Threshold value for the amount of interactions
 * @property {number} [threshold_agents_waiting_critical] Threshold value for the amount of free agents
 * @property {number} [threshold_agents_waiting_warning] Threshold value for the amount of free agents
 * @property {number} [threshold_agents_serving_critical] Threshold value for the amount of busy agents
 * @property {number} [threshold_agents_serving_warning] Threshold value for the amount of busy agents
 */

/**
 * Interaction is a presentation of the action that is happening for the user
 * @typedef {object} interaction
 * @property {string} id Unique ID of the interaction
 * @property {"user_defined"|"chat"|"email"|"phone"} channel_type Channel type of the interaction
 * @property {"bad_address"|"barred"|"busy"|"calling"|"congestion"|"connected"|"disconnected"|"knocking"|"muted"|"no_answer"|"onhold"|"onvideo"|"outbound_accepted"|"outbound_incoming"|"outbound_preview"|"outbound_rejected"|"outbound_skipped"|"outgoing"|"picking"|"queue_closed"|"queue_full"|"rejected"|"ringing"|"system_error"|"temporary_failure"|"transferring"|"unknown"|"unreachable"} [channel_status] Channel status of the interaction
 * @property {string} [channel_sub_type] Custom channel type specified by host app
 * @property {string} date_created Date and time the interaction was created (by Contact Pro backend)
 * @property {string} date_incoming Added by CPC: Date and time of incoming interaction allocated to agent
 * @property {string} date_outgoing Added by CPC: Date and time of outgoing interaction created by agent
 * @property {string} date_accepted Added by CPC: Date and time the interaction was accepted by agent
 * @property {string} date_ended Added by CPC: Date and time the interaction ended (disconnected)
 * @property {string} date_handled Added by CPC: Date and time the interaction was handled and removed from view
 * @property {"queued"|"incoming"|"outgoing"|"accepted"|"rejected"|"handled"|"ended"} status Current status of the interaction
 * @property {string} originator Originating address of the interaction. For a phone call would be the A-Number. For email, the email address sent from
 * @property {string} destination Destination of the original call. For a phone call would be the B-Number. For email, the email address sent to
 * @property {object} [dir_entry] Directory information of other party
 * @property {string} [dir_entry.id] Unique ID of the directory entry
 * @property {string} [dir_entry.name] Name of the directory entry
 * @property {boolean} [recording] Recording state of the (call) interaction
 * @property {boolean} [consent] Recording consent of the (call) interaction
 * @property {string} [consult_for] Id of the interaction for which this is consultation
 * @property {string} [callback_id] Callback id in case of callback call
 * @property {string} [conference_id] Conference id in case of conference call
 * @property {object} from_queue Queue that interaction was last routed from
 * @property {string} from_queue.id CCtr unique ID of the queue
 * @property {string} from_queue.name Name of the queue
 * @property {object} [orig_queue] Queue that interaction was originally routed from
 * @property {string} orig_queue.id CCtr unique ID of the queue
 * @property {string} orig_queue.name Name of the queue
 * @property {object} [outbound] Outbound campaign call data
 * @property {object} [outbound.campaign] Outbound campaign data
 * @property {string} [outbound.campaign.id] CCtr unique ID of the campaign
 * @property {string} [outbound.campaign.name] Campaign name
 * @property {string} [outbound.campaign.description] Campaign description
 * @property {string} [outbound.campaign.start_date] Campaign start date
 * @property {string} [outbound.campaign.end_date] Campaign end date
 * @property {number} [outbound.campaign.max_calls] Campaign customer call limit
 * @property {array} [outbound.campaign.classifiers] Campaign classifiers
 * @property {object} [outbound.customer] Outbound customer data
 * @property {string} [outbound.customer.id] Unique ID of the customer
 * @property {string} [outbound.customer.remarks] Customer remarks
 * @property {boolean} [outbound.customer.modify_access] Customer modify access
 * @property {array} [outbound.customer.attributes] Customer attributes
 * @property {array} [outbound.customer.previous_calls] Customer previous calls
 * @property {string} [outbound.initial_info] Customer call initial information text
 * @property {number} [outbound.preview_time] Customer call preview time (seconds)
 * @property {object} attached_data Interaction attached data
 * @property {string} title Title that is displayed for this interaction
 * @property {string} [incoming_destination] Identifier for incoming destination
 * @property {number} [iswtf] Interaction waiting time
 * @property {array} [participants] Chat conversation participants
 * @property {object} [transcript] Chat conversation transcript
 * @property {array} transcript.messages Collection of messages that make up a Chat conversation
 * @property {string} [terminal_id] terminalID of the interaction
 * @property {string} [content] Content of the (email) interaction
 * @property {array} [attachments] Collection of attachments'
 * @property {string} [case_id] Case id of the (email) interaction
 * @property {string} [cid] CIDt of the (email) interaction
 * @property {string} [contact_id] Contact id of interaction
 * @property {string} [original_contact_id] Original contact id of interaction
 * @property {object} [from_address] Address from which the (email) interaction was sent from
 * @property {string} from_address.address E-mail address of the sender
 * @property {string} [from_address.name] Name of the sender
 * @property {object} [reply_to_address] Reply to address in e-mail
 * @property {string} reply_to_address.address E-mail address of the reply-to address
 * @property {string} [reply_to_address.name] Name of the reply-to account
 * @property {array} [to_address] Collection of target addresses'
 * @property {array} [cc_address] Collection of cc addresses'
 * @property {array} [bcc_address] Collection of bcc addresses'
 * @property {object} [draft] Draft email information
 * @property {string} [draft.id] unique ID of the draft
 * @property {string} [draft.owner_terminal_id] Id the of the handling terminal
 * @property {string} [draft.draft_type] Type of the draft
 * @property {string} [draft.status] Status of the draft
 * @property {string} [draft.subject] Subject of the draft
 * @property {string} [draft.content] Content of the draft
 * @property {array} [draft.attachments] Collection of attachments'
 * @property {string} [draft.from_address] Selected from address
 * @property {array} [draft.from_addresses] Collection of possible from addresses'
 * @property {array} [draft.to_address] Collection of target addresses'
 * @property {array} [draft.cc_address] Collection of possible cc addresses'
 * @property {array} [draft.bcc_address] Collection of possible bcc addresses'
 * @property {array} [scripts] Script results for this interaction
 * @property {object} [webrtc] WebRTC signalling 'conversation' for Video Chat
 * @property {"on"|"signalling"|"off"|"error"} webrtc.status Status of the WebRTC 'conversation'
 * @property {array} webrtc.messages Collection of messages that make up a WebRTC 'conversation'
 */