Evo Voice

<back to all web services

NewFlowMessage

The following routes are available for this service:
All Verbs/flows/message
import Foundation
import ServiceStack

public class NewFlowMessage : Codable
{
    /**
    * The ID of the endpoint that received the message
    */
    // @ApiMember(Description="The ID of the endpoint that received the message")
    public var endpointId:String?

    /**
    * The session values
    */
    // @ApiMember(Description="The session values")
    public var sessionParameters:Struct?

    /**
    * The from address
    */
    // @ApiMember(Description="The from address")
    public var fromAddress:String?

    /**
    * The to address
    */
    // @ApiMember(Description="The to address")
    public var toAddress:String?

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

    /**
    * The display name of the sender (will default to identity if not specified
    */
    // @ApiMember(Description="The display name of the sender (will default to identity if not specified")
    public var displayName:String?

    /**
    * The URL to call when replies need to be sent back
    */
    // @ApiMember(Description="The URL to call when replies need to be sent back")
    public var messageUrl:String?

    required public init(){}
}

public class Struct : List<String:Value>
{
    required public init(){ super.init() }

    required public init(from decoder: Decoder) throws {
        try super.init(from: decoder)
    }

    public override func encode(to encoder: Encoder) throws {
        try super.encode(to: encoder)
    }
}

public class Value : Codable
{
    public var boolValue:Bool?
    public var stringValue:String?
    public var numberValue:Double?
    public var listValue:[Struct] = []
    public var structValue:Struct?

    required public init(){}
}

public class HttpResult : Codable
{
    public var responseText:String?
    public var responseStream:Data?
    public var fileInfo:FileInfo?
    //virtualFile:IVirtualFile ignored. Swift doesn't support interface properties
    public var contentType:String?
    public var headers:[String:String] = [:]
    public var cookies:[Cookie] = []
    public var eTag:String?
    @TimeSpan public var age:TimeInterval?
    @TimeSpan public var maxAge:TimeInterval?
    public var expires:Date?
    public var lastModified:Date?
    public var cacheControl:CacheControl?
    public var resultScope:Func<IDisposable>?
    public var allowsPartialResponse:Bool?
    public var options:[String:String] = [:]
    public var status:Int?
    public var statusCode:HttpStatusCode?
    public var statusDescription:String?
    //response:Object ignored. Type could not be extended in Swift
    //responseFilter:IContentTypeWriter ignored. Swift doesn't support interface properties
    //requestContext:IRequest ignored. Swift doesn't support interface properties
    public var view:String?
    public var template:String?
    public var paddingLength:Int?
    public var isPartialRequest:Bool?

    required public init(){}
}

public protocol IVirtualFile
{
    //virtualPathProvider:IVirtualPathProvider ignored. Swift doesn't support interface properties
    var `extension`:String? { get set }
    var length:Int? { get set }

}

public protocol IVirtualPathProvider
{
    //rootDirectory:IVirtualDirectory ignored. Swift doesn't support interface properties
    var virtualPathSeparator:String? { get set }
    var realPathSeparator:String? { get set }

}

public protocol IVirtualDirectory
{
}

// @Flags()
public enum CacheControl : Int, Codable
{
    case None = 0
    case Public = 1
    case Private = 2
    case MustRevalidate = 4
    case NoCache = 8
    case NoStore = 16
    case NoTransform = 32
    case ProxyRevalidate = 64
}

public protocol IContentTypeWriter
{
}

public protocol IRequest
{
    //originalRequest:Object ignored. Type could not be extended in Swift
    //response:IResponse ignored. Swift doesn't support interface properties
    var operationName:String? { get set }
    var verb:String? { get set }
    var requestAttributes:RequestAttributes? { get set }
    //requestPreferences:IRequestPreferences ignored. Swift doesn't support interface properties
    //dto:Object ignored. Type could not be extended in Swift
    var contentType:String? { get set }
    var isLocal:Bool? { get set }
    var userAgent:String? { get set }
    var cookies:[String:Cookie]? { get set }
    var responseContentType:String? { get set }
    var hasExplicitResponseContentType:Bool? { get set }
    var items:[String:Object]? { get set }
    var headers:NameValueCollection? { get set }
    var queryString:NameValueCollection? { get set }
    var formData:NameValueCollection? { get set }
    var useBufferedStream:Bool? { get set }
    var rawUrl:String? { get set }
    var absoluteUri:String? { get set }
    var userHostAddress:String? { get set }
    var remoteIp:String? { get set }
    var authorization:String? { get set }
    var isSecureConnection:Bool? { get set }
    var acceptTypes:[String] { get set }
    var pathInfo:String? { get set }
    var originalPathInfo:String? { get set }
    var inputStream:Data? { get set }
    var contentLength:Int? { get set }
    var files:[IHttpFile] { get set }
    var urlReferrer:Uri? { get set }

}

public protocol IResponse
{
    //originalResponse:Object ignored. Type could not be extended in Swift
    //request:IRequest ignored. Swift doesn't support interface properties
    var statusCode:Int? { get set }
    var statusDescription:String? { get set }
    var contentType:String? { get set }
    var outputStream:Data? { get set }
    //dto:Object ignored. Type could not be extended in Swift
    var useBufferedStream:Bool? { get set }
    var isClosed:Bool? { get set }
    var keepAlive:Bool? { get set }
    var hasStarted:Bool? { get set }
    var items:[String:Object]? { get set }

}

// @Flags()
public enum RequestAttributes : Int, Codable
{
    case None = 0
    case Localhost = 1
    case LocalSubnet = 2
    case External = 4
    case Secure = 8
    case InSecure = 16
    case AnySecurityMode = 24
    case HttpHead = 32
    case HttpGet = 64
    case HttpPost = 128
    case HttpPut = 256
    case HttpDelete = 512
    case HttpPatch = 1024
    case HttpOptions = 2048
    case HttpOther = 4096
    case AnyHttpMethod = 8160
    case OneWay = 8192
    case Reply = 16384
    case AnyCallStyle = 24576
    case Soap11 = 32768
    case Soap12 = 65536
    case Xml = 131072
    case Json = 262144
    case Jsv = 524288
    case ProtoBuf = 1048576
    case Csv = 2097152
    case Html = 4194304
    case Wire = 8388608
    case MsgPack = 16777216
    case FormatOther = 33554432
    case AnyFormat = 67076096
    case Http = 67108864
    case MessageQueue = 134217728
    case Tcp = 268435456
    case Grpc = 536870912
    case EndpointOther = 1073741824
    case AnyEndpoint = 2080374784
    case InProcess = -2147483648
    case InternalNetworkAccess = -2147483645
    case AnyNetworkAccessType = -2147483641
    case Any = -1
}

public protocol IRequestPreferences
{
    var acceptsBrotli:Bool? { get set }
    var acceptsDeflate:Bool? { get set }
    var acceptsGzip:Bool? { get set }

}

public protocol IHttpFile
{
    var name:String? { get set }
    var fileName:String? { get set }
    var contentLength:Int? { get set }
    var contentType:String? { get set }
    var inputStream:Data? { get set }

}


Swift NewFlowMessage DTOs

To override the Content-type in your clients, use the HTTP Accept Header, append the .xml suffix or ?format=xml

HTTP + XML

The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.

POST /flows/message HTTP/1.1 
Host: evovoice.io 
Accept: application/xml
Content-Type: application/xml
Content-Length: length

<NewFlowMessage xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Voice.Api.Flows">
  <DisplayName>String</DisplayName>
  <EndpointId>String</EndpointId>
  <FromAddress>String</FromAddress>
  <Identity>String</Identity>
  <MessageUrl>String</MessageUrl>
  <SessionParameters xmlns:d2p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
    <d2p1:KeyValueOfstringValue8Ahp2kgT>
      <d2p1:Key>String</d2p1:Key>
      <d2p1:Value xmlns:d4p1="http://schemas.datacontract.org/2004/07/Voice.Api.Flows.Data">
        <d4p1:BoolValue>false</d4p1:BoolValue>
        <d4p1:ListValue>
          <d2p1:ArrayOfKeyValueOfstringValue8Ahp2kgT>
            <d2p1:KeyValueOfstringValue8Ahp2kgT>
              <d2p1:Key>String</d2p1:Key>
              <d2p1:Value>
                <d4p1:BoolValue>false</d4p1:BoolValue>
                <d4p1:ListValue>
                  <d2p1:ArrayOfKeyValueOfstringValue8Ahp2kgT>
                    <d2p1:KeyValueOfstringValue8Ahp2kgT>
                      <d2p1:Key>String</d2p1:Key>
                      <d2p1:Value>
                        <d4p1:BoolValue>false</d4p1:BoolValue>
                        <d4p1:ListValue>
                          <d2p1:ArrayOfKeyValueOfstringValue8Ahp2kgT i:nil="true" />
                        </d4p1:ListValue>
                        <d4p1:NumberValue>0</d4p1:NumberValue>
                        <d4p1:StringValue>String</d4p1:StringValue>
                        <d4p1:StructValue i:nil="true" />
                      </d2p1:Value>
                    </d2p1:KeyValueOfstringValue8Ahp2kgT>
                  </d2p1:ArrayOfKeyValueOfstringValue8Ahp2kgT>
                </d4p1:ListValue>
                <d4p1:NumberValue>0</d4p1:NumberValue>
                <d4p1:StringValue>String</d4p1:StringValue>
                <d4p1:StructValue>
                  <d2p1:KeyValueOfstringValue8Ahp2kgT>
                    <d2p1:Key>String</d2p1:Key>
                    <d2p1:Value>
                      <d4p1:BoolValue>false</d4p1:BoolValue>
                      <d4p1:ListValue>
                        <d2p1:ArrayOfKeyValueOfstringValue8Ahp2kgT i:nil="true" />
                      </d4p1:ListValue>
                      <d4p1:NumberValue>0</d4p1:NumberValue>
                      <d4p1:StringValue>String</d4p1:StringValue>
                      <d4p1:StructValue i:nil="true" />
                    </d2p1:Value>
                  </d2p1:KeyValueOfstringValue8Ahp2kgT>
                </d4p1:StructValue>
              </d2p1:Value>
            </d2p1:KeyValueOfstringValue8Ahp2kgT>
          </d2p1:ArrayOfKeyValueOfstringValue8Ahp2kgT>
        </d4p1:ListValue>
        <d4p1:NumberValue>0</d4p1:NumberValue>
        <d4p1:StringValue>String</d4p1:StringValue>
        <d4p1:StructValue>
          <d2p1:KeyValueOfstringValue8Ahp2kgT>
            <d2p1:Key>String</d2p1:Key>
            <d2p1:Value>
              <d4p1:BoolValue>false</d4p1:BoolValue>
              <d4p1:ListValue>
                <d2p1:ArrayOfKeyValueOfstringValue8Ahp2kgT>
                  <d2p1:KeyValueOfstringValue8Ahp2kgT>
                    <d2p1:Key>String</d2p1:Key>
                    <d2p1:Value>
                      <d4p1:BoolValue>false</d4p1:BoolValue>
                      <d4p1:ListValue>
                        <d2p1:ArrayOfKeyValueOfstringValue8Ahp2kgT i:nil="true" />
                      </d4p1:ListValue>
                      <d4p1:NumberValue>0</d4p1:NumberValue>
                      <d4p1:StringValue>String</d4p1:StringValue>
                      <d4p1:StructValue i:nil="true" />
                    </d2p1:Value>
                  </d2p1:KeyValueOfstringValue8Ahp2kgT>
                </d2p1:ArrayOfKeyValueOfstringValue8Ahp2kgT>
              </d4p1:ListValue>
              <d4p1:NumberValue>0</d4p1:NumberValue>
              <d4p1:StringValue>String</d4p1:StringValue>
              <d4p1:StructValue>
                <d2p1:KeyValueOfstringValue8Ahp2kgT>
                  <d2p1:Key>String</d2p1:Key>
                  <d2p1:Value>
                    <d4p1:BoolValue>false</d4p1:BoolValue>
                    <d4p1:ListValue>
                      <d2p1:ArrayOfKeyValueOfstringValue8Ahp2kgT i:nil="true" />
                    </d4p1:ListValue>
                    <d4p1:NumberValue>0</d4p1:NumberValue>
                    <d4p1:StringValue>String</d4p1:StringValue>
                    <d4p1:StructValue i:nil="true" />
                  </d2p1:Value>
                </d2p1:KeyValueOfstringValue8Ahp2kgT>
              </d4p1:StructValue>
            </d2p1:Value>
          </d2p1:KeyValueOfstringValue8Ahp2kgT>
        </d4p1:StructValue>
      </d2p1:Value>
    </d2p1:KeyValueOfstringValue8Ahp2kgT>
  </SessionParameters>
  <ToAddress>String</ToAddress>
</NewFlowMessage>
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length

<CustomHttpResult xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.servicestack.net/types" />