TIE API 客户端
这个库提供了一种与 Teneo 引擎服务器实例通信的方法
要求
- iOS 12.0+
- Xcode 11.0+
- Swift 5.0+
基本使用
设置
必须在调用 sendInput 或 closeSession 之前调用
do {
try TieApiService.sharedInstance.setup("BASE_URL", endpoint: "ENDPOINT")
} catch {
// Handle errors here
}
发送输入
TieApiService.sharedInstance.sendInput({MESSAGE},
parameters: {PARAMETERS},
success: { response in
// Handle response. Remember to dispatch to main thread if updating UI
}, failure: { error in
// Handle error
})
关闭会话
TieApiService.sharedInstance.closeSession({ response in
// Handle response. Remember to dispatch to main thread if updating UI
}, failure: { error in
// Handle error
})
安装
CocoaPods
CocoaPods 是 Cocoa 项目的依赖管理器。您可以使用以下命令安装它:
$ gem install cocoapods
CocoaPods 1.5+ 是构建 TieApiClient 1.0.0+ 所必需的。
要使用 CocoaPods 将 TieApiClient 集成到您的 Xcode 项目中,请在您的 Podfile
中指定它:
pod "TieApiClient"
然后,运行以下命令:
$ pod install
许可协议
TieApiClient 采用 Apache 许可协议,版本 2.0。有关详细信息,请参阅 LICENSE。