Evo Voice

<back to all web services

ResendNotification

Requires Authentication
Requires any of the roles:SystemAdministrator, Manager, Customer
The following routes are available for this service:
POST/notifications/{notificationId}/resend
import Foundation
import ServiceStack

public class ResendNotification : Codable
{
    /**
    * The ID of the notification to resend
    */
    // @ApiMember(Description="The ID of the notification to resend")
    public var notificationId:String?

    required public init(){}
}

public class NotificationInfo : 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] = []

    /**
    * The type of notification
    */
    // @ApiMember(Description="The type of notification")
    public var type:NotificationTypes?

    /**
    * The subject of the notification
    */
    // @ApiMember(Description="The subject of the notification")
    public var subject:String?

    /**
    * The body of the notification
    */
    // @ApiMember(Description="The body of the notification")
    public var body:String?

    /**
    * The recipients of this notification
    */
    // @ApiMember(Description="The recipients of this notification")
    public var recipients:[NotificationRecipientInfo] = []

    /**
    * The list of attachments
    */
    // @ApiMember(Description="The list of attachments")
    public var attachments:[FileInfo] = []

    /**
    * The original from for the session
    */
    // @ApiMember(Description="The original from for the session")
    public var from:String?

    /**
    * The original To for the session
    */
    // @ApiMember(Description="The original To for the session")
    public var to:String?

    /**
    * Was there an error?
    */
    // @ApiMember(Description="Was there an error?")
    public var error:Bool?

    /**
    * The error message
    */
    // @ApiMember(Description="The error message")
    public var errorMessage:String?

    required public init(){ super.init() }

    private enum CodingKeys : String, CodingKey {
        case accountId
        case accountName
        case customerId
        case customerName
        case customerBreadcrumb
        case type
        case subject
        case body
        case recipients
        case attachments
        case from
        case to
        case error
        case errorMessage
    }

    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) ?? []
        type = try container.decodeIfPresent(NotificationTypes.self, forKey: .type)
        subject = try container.decodeIfPresent(String.self, forKey: .subject)
        body = try container.decodeIfPresent(String.self, forKey: .body)
        recipients = try container.decodeIfPresent([NotificationRecipientInfo].self, forKey: .recipients) ?? []
        attachments = try container.decodeIfPresent([FileInfo].self, forKey: .attachments) ?? []
        from = try container.decodeIfPresent(String.self, forKey: .from)
        to = try container.decodeIfPresent(String.self, forKey: .to)
        error = try container.decodeIfPresent(Bool.self, forKey: .error)
        errorMessage = try container.decodeIfPresent(String.self, forKey: .errorMessage)
    }

    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 type != nil { try container.encode(type, forKey: .type) }
        if subject != nil { try container.encode(subject, forKey: .subject) }
        if body != nil { try container.encode(body, forKey: .body) }
        if recipients.count > 0 { try container.encode(recipients, forKey: .recipients) }
        if attachments.count > 0 { try container.encode(attachments, forKey: .attachments) }
        if from != nil { try container.encode(from, forKey: .from) }
        if to != nil { try container.encode(to, forKey: .to) }
        if error != nil { try container.encode(error, forKey: .error) }
        if errorMessage != nil { try container.encode(errorMessage, forKey: .errorMessage) }
    }
}

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 enum NotificationTypes : String, Codable
{
    case Email
    case Sms
    case Push
    case IncomingCall
    case OutgoingCall
}

public class NotificationRecipientInfo : Codable
{
    /**
    * The address of the recipient
    */
    // @ApiMember(Description="The address of the recipient")
    public var address:String?

    /**
    * Extra info about the recipient e.g. CC, BCC
    */
    // @ApiMember(Description="Extra info about the recipient e.g. CC, BCC")
    public var extra:String?

    /**
    * The name of the recipient
    */
    // @ApiMember(Description="The name of the recipient")
    public var name:String?

    required public init(){}
}

public class FileInfo : EntityInfo
{
    /**
    * The type of file this is
    */
    // @ApiMember(Description="The type of file this is")
    public var type:FileTypes?

    /**
    * The account ID this file is associated with
    */
    // @ApiMember(Description="The account ID this file is associated with")
    public var accountId:String?

    /**
    * The name of the account this file is associated with
    */
    // @ApiMember(Description="The name of the account this file is associated with")
    public var accountName:String?

    /**
    * The ID of the customer this file is associated with
    */
    // @ApiMember(Description="The ID of the customer this file is associated with")
    public var customerId:String?

    /**
    * The name of the customer this file is associated with
    */
    // @ApiMember(Description="The name of the customer this file is associated with")
    public var customerName:String?

    /**
    * The breadcrumb to the customer for this file
    */
    // @ApiMember(Description="The breadcrumb to the customer for this file")
    public var customerBreadcrumb:[CustomerBreadcrumb] = []

    /**
    * The ID of the user this file is assocaited with
    */
    // @ApiMember(Description="The ID of the user this file is assocaited with")
    public var userId:String?

    /**
    * The name of the user this file is associated with
    */
    // @ApiMember(Description="The name of the user this file is associated with")
    public var userName:String?

    /**
    * The original file name for the file
    */
    // @ApiMember(Description="The original file name for the file")
    public var fileName:String?

    /**
    * The URI of the file
    */
    // @ApiMember(Description="The URI of the file")
    public var uri:String?

    /**
    * The Content type of the file
    */
    // @ApiMember(Description="The Content type of the file")
    public var contentType:String?

    /**
    * The size of the file
    */
    // @ApiMember(Description="The size of the file")
    public var contentLength:Int?

    /**
    * The Twilio ID of the recording
    */
    // @ApiMember(Description="The Twilio ID of the recording")
    public var recordingSid:String?

    /**
    * The duration of the recording in seconds
    */
    // @ApiMember(Description="The duration of the recording in seconds")
    public var recordingDuration:Int?

    /**
    * Who is the recording from?
    */
    // @ApiMember(Description="Who is the recording from?")
    public var recordingFrom:String?

    /**
    * Transcription (if available)
    */
    // @ApiMember(Description="Transcription (if available)")
    public var transcription:String?

    /**
    * From Address (e.g. caller ID) for incoming calls
    */
    // @ApiMember(Description="From Address (e.g. caller ID) for incoming calls")
    public var fromAddress:String?

    /**
    * To Address (e.g. dialed number) for outgoing calls
    */
    // @ApiMember(Description="To Address (e.g. dialed number) for outgoing calls")
    public var toAddress:String?

    required public init(){ super.init() }

    private enum CodingKeys : String, CodingKey {
        case type
        case accountId
        case accountName
        case customerId
        case customerName
        case customerBreadcrumb
        case userId
        case userName
        case fileName
        case uri
        case contentType
        case contentLength
        case recordingSid
        case recordingDuration
        case recordingFrom
        case transcription
        case fromAddress
        case toAddress
    }

    required public init(from decoder: Decoder) throws {
        try super.init(from: decoder)
        let container = try decoder.container(keyedBy: CodingKeys.self)
        type = try container.decodeIfPresent(FileTypes.self, forKey: .type)
        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) ?? []
        userId = try container.decodeIfPresent(String.self, forKey: .userId)
        userName = try container.decodeIfPresent(String.self, forKey: .userName)
        fileName = try container.decodeIfPresent(String.self, forKey: .fileName)
        uri = try container.decodeIfPresent(String.self, forKey: .uri)
        contentType = try container.decodeIfPresent(String.self, forKey: .contentType)
        contentLength = try container.decodeIfPresent(Int.self, forKey: .contentLength)
        recordingSid = try container.decodeIfPresent(String.self, forKey: .recordingSid)
        recordingDuration = try container.decodeIfPresent(Int.self, forKey: .recordingDuration)
        recordingFrom = try container.decodeIfPresent(String.self, forKey: .recordingFrom)
        transcription = try container.decodeIfPresent(String.self, forKey: .transcription)
        fromAddress = try container.decodeIfPresent(String.self, forKey: .fromAddress)
        toAddress = try container.decodeIfPresent(String.self, forKey: .toAddress)
    }

    public override func encode(to encoder: Encoder) throws {
        try super.encode(to: encoder)
        var container = encoder.container(keyedBy: CodingKeys.self)
        if type != nil { try container.encode(type, forKey: .type) }
        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 userId != nil { try container.encode(userId, forKey: .userId) }
        if userName != nil { try container.encode(userName, forKey: .userName) }
        if fileName != nil { try container.encode(fileName, forKey: .fileName) }
        if uri != nil { try container.encode(uri, forKey: .uri) }
        if contentType != nil { try container.encode(contentType, forKey: .contentType) }
        if contentLength != nil { try container.encode(contentLength, forKey: .contentLength) }
        if recordingSid != nil { try container.encode(recordingSid, forKey: .recordingSid) }
        if recordingDuration != nil { try container.encode(recordingDuration, forKey: .recordingDuration) }
        if recordingFrom != nil { try container.encode(recordingFrom, forKey: .recordingFrom) }
        if transcription != nil { try container.encode(transcription, forKey: .transcription) }
        if fromAddress != nil { try container.encode(fromAddress, forKey: .fromAddress) }
        if toAddress != nil { try container.encode(toAddress, forKey: .toAddress) }
    }
}

public enum FileTypes : String, Codable
{
    case Upload
    case VoiceMessage
    case CallRecording
    case Fax
    case Attachment
    case FaxOutgoing
}


Swift ResendNotification 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.

POST /notifications/{notificationId}/resend HTTP/1.1 
Host: evovoice.io 
Accept: application/json
Content-Type: application/json
Content-Length: length

{"notificationId":"String"}
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: length

{"accountId":"String","accountName":"String","customerId":"String","customerName":"String","customerBreadcrumb":[{"id":"String","name":"String"}],"type":"Email","subject":"String","body":"String","recipients":[{"address":"String","extra":"String","name":"String"}],"attachments":[{"type":"Upload","accountId":"String","accountName":"String","customerId":"String","customerName":"String","customerBreadcrumb":[{"id":"String","name":"String"}],"userId":"String","userName":"String","fileName":"String","uri":"String","contentType":"String","contentLength":0,"recordingSid":"String","recordingDuration":0,"recordingFrom":"String","transcription":"String","fromAddress":"String","toAddress":"String","id":"String","dateCreated":"String","dateLastModified":"String","createdBy":"String","lastModifiedBy":"String"}],"from":"String","to":"String","error":false,"errorMessage":"String","id":"String","dateCreated":"String","dateLastModified":"String","createdBy":"String","lastModifiedBy":"String"}