/* Options: Date: 2024-05-17 02:11:53 SwiftVersion: 5.0 Version: 6.40 Tip: To override a DTO option, remove "//" prefix before updating BaseUrl: https://evovoice.io //BaseClass: //AddModelExtensions: True //AddServiceStackTypes: True IncludeTypes: ListSessions.* //ExcludeTypes: //ExcludeGenericBaseTypes: False //AddResponseStatus: False //AddImplicitVersion: //AddDescriptionAsComments: True //InitializeCollections: True //TreatTypesAsStrings: //DefaultImports: Foundation,ServiceStack */ import Foundation import ServiceStack /** * Retrieve a list of sessions */ // @Route("/sessions", "GET") // @Api(Description="Retrieve a list of sessions") public class ListSessions : ListRequest, IReturn { public typealias Return = ListResponse /** * The account IDs for the sessions to retrieve */ // @ApiMember(Description="The account IDs for the sessions to retrieve") public var accountIds:[String] = [] /** * Whether to search live or archived sessions */ // @ApiMember(Description="Whether to search live or archived sessions") public var searchArchive:Bool? /** * The start date to retrieve usage records for (YYYY-MM-DD) */ // @ApiMember(Description="The start date to retrieve usage records for (YYYY-MM-DD)") public var startDate:String? /** * The end date to retrieve usage records for (YYYY-MM-DD) */ // @ApiMember(Description="The end date to retrieve usage records for (YYYY-MM-DD)") public var endDate:String? /** * The IDs of the customers whose sessions you want to retrieve */ // @ApiMember(Description="The IDs of the customers whose sessions you want to retrieve") public var customerIds:[String] = [] /** * The IDs of the endpoints whose sessions you want to retrieve */ // @ApiMember(Description="The IDs of the endpoints whose sessions you want to retrieve") public var endpointIds:[String] = [] /** * Filter by the from (this is a contains search) */ // @ApiMember(Description="Filter by the from (this is a contains search)") public var from:String? /** * Filter by the to (this is a contains search) */ // @ApiMember(Description="Filter by the to (this is a contains search)") public var to:String? /** * Filter by text in the log */ // @ApiMember(Description="Filter by text in the log") public var log:String? /** * Filter by parent session ID */ // @ApiMember(Description="Filter by parent session ID") public var parentSessionId:String? required public init(){ super.init() } private enum CodingKeys : String, CodingKey { case accountIds case searchArchive case startDate case endDate case customerIds case endpointIds case from case to case log case parentSessionId } required public init(from decoder: Decoder) throws { try super.init(from: decoder) let container = try decoder.container(keyedBy: CodingKeys.self) accountIds = try container.decodeIfPresent([String].self, forKey: .accountIds) ?? [] searchArchive = try container.decodeIfPresent(Bool.self, forKey: .searchArchive) startDate = try container.decodeIfPresent(String.self, forKey: .startDate) endDate = try container.decodeIfPresent(String.self, forKey: .endDate) customerIds = try container.decodeIfPresent([String].self, forKey: .customerIds) ?? [] endpointIds = try container.decodeIfPresent([String].self, forKey: .endpointIds) ?? [] from = try container.decodeIfPresent(String.self, forKey: .from) to = try container.decodeIfPresent(String.self, forKey: .to) log = try container.decodeIfPresent(String.self, forKey: .log) parentSessionId = try container.decodeIfPresent(String.self, forKey: .parentSessionId) } public override func encode(to encoder: Encoder) throws { try super.encode(to: encoder) var container = encoder.container(keyedBy: CodingKeys.self) if accountIds.count > 0 { try container.encode(accountIds, forKey: .accountIds) } if searchArchive != nil { try container.encode(searchArchive, forKey: .searchArchive) } if startDate != nil { try container.encode(startDate, forKey: .startDate) } if endDate != nil { try container.encode(endDate, forKey: .endDate) } if customerIds.count > 0 { try container.encode(customerIds, forKey: .customerIds) } if endpointIds.count > 0 { try container.encode(endpointIds, forKey: .endpointIds) } if from != nil { try container.encode(from, forKey: .from) } if to != nil { try container.encode(to, forKey: .to) } if log != nil { try container.encode(log, forKey: .log) } if parentSessionId != nil { try container.encode(parentSessionId, forKey: .parentSessionId) } } } public class ListResponse : Codable { /** * The items */ // @ApiMember(Description="The items") public var items:[SessionInfo] = [] /** * The total number of items */ // @ApiMember(Description="The total number of items") public var totalCount:Int? /** * The total number of pages */ // @ApiMember(Description="The total number of pages") public var totalPages:Int? /** * Are there more pages of items? Used with simplified paging */ // @ApiMember(Description="Are there more pages of items? Used with simplified paging") public var hasMorePages:Bool? required public init(){} } public enum SortOrders : String, Codable { case Ascend case Descend } public class ListRequest : IGet, Codable { /** * The page of data to retrieve */ // @ApiMember(Description="The page of data to retrieve") public var page:Int? /** * If you want all objects to be returned. This should be used with care */ // @ApiMember(Description="If you want all objects to be returned. This should be used with care") public var all:Bool? /** * The number per page to retrieve */ // @ApiMember(Description="The number per page to retrieve") public var countPerPage:Int? /** * Specific IDs */ // @ApiMember(Description="Specific IDs") public var specificIds:[String] = [] /** * Specify a sort field */ // @ApiMember(Description="Specify a sort field") public var sortField:String? /** * Specify a sort order */ // @ApiMember(Description="Specify a sort order") public var sortOrder:SortOrders? /** * Disables total / page counts - improves performance. Returns only data. If there is no more data, Items will be empty array */ // @ApiMember(Description="Disables total / page counts - improves performance. Returns only data. If there is no more data, Items will be empty array") public var simplifiedPaging:Bool? required public init(){} } public class HostedSuiteCompletedForm : Codable { public var id:String? public var name:String? public var dateCreated:String? public var dateCompleted:String? public var formId:String? public var formName:String? public var clientId:String? public var clientName:String? public var contactId:String? public var contactName:String? public var contactsIds:[String] = [] public var contactsNames:[String] = [] public var emailSubject:String? public var callerNumber:String? public var fields:[HostedSuiteCompletedFormField] = [] required public init(){} } public class LogEntryInfo : EntityInfo { /** * The account ID this endpoint is associated with */ // @ApiMember(Description="The account ID this endpoint is associated with") public var accountId:String? /** * The name of the account this endpoint is associated with */ // @ApiMember(Description="The name of the account this endpoint is associated with") public var accountName:String? /** * The ID of the customer this endpoint is associated with */ // @ApiMember(Description="The ID of the customer this endpoint is associated with") public var customerId:String? /** * The name of the customer this endpoint is associated with */ // @ApiMember(Description="The name of the customer this endpoint is associated with") public var customerName:String? /** * The breadcrumb to the customer for this endpoint */ // @ApiMember(Description="The breadcrumb to the customer for this endpoint") public var customerBreadcrumb:[CustomerBreadcrumb] = [] public var userName:String? public var Description:String? required public init(){ super.init() } private enum CodingKeys : String, CodingKey { case accountId case accountName case customerId case customerName case customerBreadcrumb case userName case Description } 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) accountName = try container.decodeIfPresent(String.self, forKey: .accountName) customerId = try container.decodeIfPresent(String.self, forKey: .customerId) customerName = try container.decodeIfPresent(String.self, forKey: .customerName) customerBreadcrumb = try container.decodeIfPresent([CustomerBreadcrumb].self, forKey: .customerBreadcrumb) ?? [] userName = try container.decodeIfPresent(String.self, forKey: .userName) Description = try container.decodeIfPresent(String.self, forKey: .Description) } 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 accountName != nil { try container.encode(accountName, forKey: .accountName) } if customerId != nil { try container.encode(customerId, forKey: .customerId) } if customerName != nil { try container.encode(customerName, forKey: .customerName) } if customerBreadcrumb.count > 0 { try container.encode(customerBreadcrumb, forKey: .customerBreadcrumb) } if userName != nil { try container.encode(userName, forKey: .userName) } if Description != nil { try container.encode(Description, forKey: .Description) } } } 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 class HostedSuiteCompletedFormField : Codable { public var name:String? public var values:[String] = [] required public init(){} } public class AccountInfo : EntityInfo { /** * The name of this account */ // @ApiMember(Description="The name of this account") public var name:String? /** * The ID of this account's parent */ // @ApiMember(Description="The ID of this account's parent") public var parentAccountId:String? /** * The twilio account SID */ // @ApiMember(Description="The twilio account SID") public var twilioAccountSid:String? /** * The ancestors of this account. Useful for breadcrumbs */ // @ApiMember(Description="The ancestors of this account. Useful for breadcrumbs") public var ancestorIds:[String] = [] /** * The max number of phone numbers this account can have */ // @ApiMember(Description="The max number of phone numbers this account can have") public var maxPhoneNumbers:Int? /** * This account is BYOA */ // @ApiMember(Description="This account is BYOA") public var isBYOA:Bool? /** * TrustHub Profile Sid */ // @ApiMember(Description="TrustHub Profile Sid") public var trustHubProfileSid:String? /** * The ID of the logo file */ // @ApiMember(Description="The ID of the logo file") public var logoId:String? /** * The URI of the logo file */ // @ApiMember(Description="The URI of the logo file") public var logoUri:String? /** * The billing settings for this account */ // @ApiMember(Description="The billing settings for this account") public var billingSettings:BillingSettings? required public init(){ super.init() } private enum CodingKeys : String, CodingKey { case name case parentAccountId case twilioAccountSid case ancestorIds case maxPhoneNumbers case isBYOA case trustHubProfileSid case logoId case logoUri case billingSettings } required public init(from decoder: Decoder) throws { try super.init(from: decoder) let container = try decoder.container(keyedBy: CodingKeys.self) name = try container.decodeIfPresent(String.self, forKey: .name) parentAccountId = try container.decodeIfPresent(String.self, forKey: .parentAccountId) twilioAccountSid = try container.decodeIfPresent(String.self, forKey: .twilioAccountSid) ancestorIds = try container.decodeIfPresent([String].self, forKey: .ancestorIds) ?? [] maxPhoneNumbers = try container.decodeIfPresent(Int.self, forKey: .maxPhoneNumbers) isBYOA = try container.decodeIfPresent(Bool.self, forKey: .isBYOA) trustHubProfileSid = try container.decodeIfPresent(String.self, forKey: .trustHubProfileSid) logoId = try container.decodeIfPresent(String.self, forKey: .logoId) logoUri = try container.decodeIfPresent(String.self, forKey: .logoUri) billingSettings = try container.decodeIfPresent(BillingSettings.self, forKey: .billingSettings) } public override func encode(to encoder: Encoder) throws { try super.encode(to: encoder) var container = encoder.container(keyedBy: CodingKeys.self) if name != nil { try container.encode(name, forKey: .name) } if parentAccountId != nil { try container.encode(parentAccountId, forKey: .parentAccountId) } if twilioAccountSid != nil { try container.encode(twilioAccountSid, forKey: .twilioAccountSid) } if ancestorIds.count > 0 { try container.encode(ancestorIds, forKey: .ancestorIds) } if maxPhoneNumbers != nil { try container.encode(maxPhoneNumbers, forKey: .maxPhoneNumbers) } if isBYOA != nil { try container.encode(isBYOA, forKey: .isBYOA) } if trustHubProfileSid != nil { try container.encode(trustHubProfileSid, forKey: .trustHubProfileSid) } if logoId != nil { try container.encode(logoId, forKey: .logoId) } if logoUri != nil { try container.encode(logoUri, forKey: .logoUri) } if billingSettings != nil { try container.encode(billingSettings, forKey: .billingSettings) } } } public class SessionInfo : EntityInfo { /** * The state of the session */ // @ApiMember(Description="The state of the session") public var dialState:SessionDialState? /** * The call state of the session */ // @ApiMember(Description="The call state of the session") public var callState:SessionCallState? /** * The queue state of the session */ // @ApiMember(Description="The queue state of the session") public var queueState:SessionQueueStates? /** * The ID of the account associated with the flow */ // @ApiMember(Description="The ID of the account associated with the flow") public var accountId:String? /** * The name of the account associated with the session */ // @ApiMember(Description="The name of the account associated with the session") public var accountName:String? /** * The ID of the customer this session is associated with */ // @ApiMember(Description="The ID of the customer this session is associated with") public var customerId:String? /** * The customer breadcrumb this session is associated with */ // @ApiMember(Description="The customer breadcrumb this session is associated with") public var customerBreadcrumb:[CustomerBreadcrumb] = [] /** * The name of the customer this session is associated with */ // @ApiMember(Description="The name of the customer this session is associated with") public var customerName:String? /** * The ID of the endpoint associated with this session */ // @ApiMember(Description="The ID of the endpoint associated with this session") public var endpointId:String? /** * The name of the endpoint associated with this session */ // @ApiMember(Description="The name of the endpoint associated with this session") public var endpointName:String? /** * The date the call completed */ // @ApiMember(Description="The date the call completed") public var dateCompleted:String? /** * The destination of the session (e.g. what was entered into the Dial box) */ // @ApiMember(Description="The destination of the session (e.g. what was entered into the Dial box)") public var destination:String? /** * The to address if any */ // @ApiMember(Description="The to address if any") public var toAddress:String? /** * The from address if any */ // @ApiMember(Description="The from address if any") public var fromAddress:String? /** * The from name if any */ // @ApiMember(Description="The from name if any") public var fromName:String? /** * Answered by name (if any) */ // @ApiMember(Description="Answered by name (if any)") public var answeredByName:String? /** * The ID of the queue member assigned to this call */ // @ApiMember(Description="The ID of the queue member assigned to this call") public var queueMemberId:String? /** * The flow channel */ // @ApiMember(Description="The flow channel") public var channel:FlowChannels? /** * Has the session ended */ // @ApiMember(Description="Has the session ended") public var ended:Bool? /** * The outcome of the call */ // @ApiMember(Description="The outcome of the call") public var outcome:String? /** * The twilio Call SID of this session */ // @ApiMember(Description="The twilio Call SID of this session") public var callSid:String? /** * Any console data for this session */ // @ApiMember(Description="Any console data for this session") public var consoleData:String? /** * The name of the hold queue for this call */ // @ApiMember(Description="The name of the hold queue for this call") public var holdQueueName:String? /** * The user ID who put this call on hold */ // @ApiMember(Description="The user ID who put this call on hold") public var heldByUserId:String? /** * The reason for the hold */ // @ApiMember(Description="The reason for the hold") public var holdReason:SessionHoldReasons? /** * The SID of the conference if in a conference call */ // @ApiMember(Description="The SID of the conference if in a conference call") public var conferenceSid:String? /** * The display name for this session */ // @ApiMember(Description="The display name for this session") public var displayName:String? /** * The log entries for this session */ // @ApiMember(Description="The log entries for this session") public var log:[SessionLogInfo] = [] /** * The members of this session */ // @ApiMember(Description="The members of this session") public var members:[SessionMemberInfo] = [] /** * The callback number (typically used for SIP to User calls) */ // @ApiMember(Description="The callback number (typically used for SIP to User calls)") public var callbackNumber:String? /** * The ID of the endpoint that answered */ // @ApiMember(Description="The ID of the endpoint that answered") public var answeredById:String? /** * Is this session incoming or outgoing? */ // @ApiMember(Description="Is this session incoming or outgoing?") public var direction:SessionDirections? /** * The phone number that this session is coming from (used with SMS chats) */ // @ApiMember(Description="The phone number that this session is coming from (used with SMS chats)") public var fromPhoneNumber:String? /** * The Call SID of the most recently added conference participant */ // @ApiMember(Description="The Call SID of the most recently added conference participant") public var mostRecentParticipantCallSid:String? /** * Was this session missed? */ // @ApiMember(Description="Was this session missed?") public var wasMissed:Bool? /** * The ring queue that the call is currently in */ // @ApiMember(Description="The ring queue that the call is currently in") public var ringQueueId:String? required public init(){ super.init() } private enum CodingKeys : String, CodingKey { case dialState case callState case queueState case accountId case accountName case customerId case customerBreadcrumb case customerName case endpointId case endpointName case dateCompleted case destination case toAddress case fromAddress case fromName case answeredByName case queueMemberId case channel case ended case outcome case callSid case consoleData case holdQueueName case heldByUserId case holdReason case conferenceSid case displayName case log case members case callbackNumber case answeredById case direction case fromPhoneNumber case mostRecentParticipantCallSid case wasMissed case ringQueueId } required public init(from decoder: Decoder) throws { try super.init(from: decoder) let container = try decoder.container(keyedBy: CodingKeys.self) dialState = try container.decodeIfPresent(SessionDialState.self, forKey: .dialState) callState = try container.decodeIfPresent(SessionCallState.self, forKey: .callState) queueState = try container.decodeIfPresent(SessionQueueStates.self, forKey: .queueState) accountId = try container.decodeIfPresent(String.self, forKey: .accountId) accountName = try container.decodeIfPresent(String.self, forKey: .accountName) customerId = try container.decodeIfPresent(String.self, forKey: .customerId) customerBreadcrumb = try container.decodeIfPresent([CustomerBreadcrumb].self, forKey: .customerBreadcrumb) ?? [] customerName = try container.decodeIfPresent(String.self, forKey: .customerName) endpointId = try container.decodeIfPresent(String.self, forKey: .endpointId) endpointName = try container.decodeIfPresent(String.self, forKey: .endpointName) dateCompleted = try container.decodeIfPresent(String.self, forKey: .dateCompleted) destination = try container.decodeIfPresent(String.self, forKey: .destination) toAddress = try container.decodeIfPresent(String.self, forKey: .toAddress) fromAddress = try container.decodeIfPresent(String.self, forKey: .fromAddress) fromName = try container.decodeIfPresent(String.self, forKey: .fromName) answeredByName = try container.decodeIfPresent(String.self, forKey: .answeredByName) queueMemberId = try container.decodeIfPresent(String.self, forKey: .queueMemberId) channel = try container.decodeIfPresent(FlowChannels.self, forKey: .channel) ended = try container.decodeIfPresent(Bool.self, forKey: .ended) outcome = try container.decodeIfPresent(String.self, forKey: .outcome) callSid = try container.decodeIfPresent(String.self, forKey: .callSid) consoleData = try container.decodeIfPresent(String.self, forKey: .consoleData) holdQueueName = try container.decodeIfPresent(String.self, forKey: .holdQueueName) heldByUserId = try container.decodeIfPresent(String.self, forKey: .heldByUserId) holdReason = try container.decodeIfPresent(SessionHoldReasons.self, forKey: .holdReason) conferenceSid = try container.decodeIfPresent(String.self, forKey: .conferenceSid) displayName = try container.decodeIfPresent(String.self, forKey: .displayName) log = try container.decodeIfPresent([SessionLogInfo].self, forKey: .log) ?? [] members = try container.decodeIfPresent([SessionMemberInfo].self, forKey: .members) ?? [] callbackNumber = try container.decodeIfPresent(String.self, forKey: .callbackNumber) answeredById = try container.decodeIfPresent(String.self, forKey: .answeredById) direction = try container.decodeIfPresent(SessionDirections.self, forKey: .direction) fromPhoneNumber = try container.decodeIfPresent(String.self, forKey: .fromPhoneNumber) mostRecentParticipantCallSid = try container.decodeIfPresent(String.self, forKey: .mostRecentParticipantCallSid) wasMissed = try container.decodeIfPresent(Bool.self, forKey: .wasMissed) ringQueueId = try container.decodeIfPresent(String.self, forKey: .ringQueueId) } public override func encode(to encoder: Encoder) throws { try super.encode(to: encoder) var container = encoder.container(keyedBy: CodingKeys.self) if dialState != nil { try container.encode(dialState, forKey: .dialState) } if callState != nil { try container.encode(callState, forKey: .callState) } if queueState != nil { try container.encode(queueState, forKey: .queueState) } if accountId != nil { try container.encode(accountId, forKey: .accountId) } if accountName != nil { try container.encode(accountName, forKey: .accountName) } if customerId != nil { try container.encode(customerId, forKey: .customerId) } if customerBreadcrumb.count > 0 { try container.encode(customerBreadcrumb, forKey: .customerBreadcrumb) } if customerName != nil { try container.encode(customerName, forKey: .customerName) } if endpointId != nil { try container.encode(endpointId, forKey: .endpointId) } if endpointName != nil { try container.encode(endpointName, forKey: .endpointName) } if dateCompleted != nil { try container.encode(dateCompleted, forKey: .dateCompleted) } if destination != nil { try container.encode(destination, forKey: .destination) } if toAddress != nil { try container.encode(toAddress, forKey: .toAddress) } if fromAddress != nil { try container.encode(fromAddress, forKey: .fromAddress) } if fromName != nil { try container.encode(fromName, forKey: .fromName) } if answeredByName != nil { try container.encode(answeredByName, forKey: .answeredByName) } if queueMemberId != nil { try container.encode(queueMemberId, forKey: .queueMemberId) } if channel != nil { try container.encode(channel, forKey: .channel) } if ended != nil { try container.encode(ended, forKey: .ended) } if outcome != nil { try container.encode(outcome, forKey: .outcome) } if callSid != nil { try container.encode(callSid, forKey: .callSid) } if consoleData != nil { try container.encode(consoleData, forKey: .consoleData) } if holdQueueName != nil { try container.encode(holdQueueName, forKey: .holdQueueName) } if heldByUserId != nil { try container.encode(heldByUserId, forKey: .heldByUserId) } if holdReason != nil { try container.encode(holdReason, forKey: .holdReason) } if conferenceSid != nil { try container.encode(conferenceSid, forKey: .conferenceSid) } if displayName != nil { try container.encode(displayName, forKey: .displayName) } if log.count > 0 { try container.encode(log, forKey: .log) } if members.count > 0 { try container.encode(members, forKey: .members) } if callbackNumber != nil { try container.encode(callbackNumber, forKey: .callbackNumber) } if answeredById != nil { try container.encode(answeredById, forKey: .answeredById) } if direction != nil { try container.encode(direction, forKey: .direction) } if fromPhoneNumber != nil { try container.encode(fromPhoneNumber, forKey: .fromPhoneNumber) } if mostRecentParticipantCallSid != nil { try container.encode(mostRecentParticipantCallSid, forKey: .mostRecentParticipantCallSid) } if wasMissed != nil { try container.encode(wasMissed, forKey: .wasMissed) } if ringQueueId != nil { try container.encode(ringQueueId, forKey: .ringQueueId) } } }