├── CHANGELOG.md ├── LICENSE ├── Pod ├── Assets │ └── .gitkeep └── Classes │ ├── .gitkeep │ ├── Action.swift │ ├── Conversation.swift │ ├── ConverseResponse.swift │ ├── DialogResponse.swift │ ├── Entities.swift │ ├── Intent.swift │ ├── Message.swift │ ├── Nlp.swift │ ├── Response.swift │ └── Sapcai.swift ├── README.md ├── sapcai.podspec └── sapcai └── 4.0.0 └── sapcai.podspec /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Change Log 2 | All notable changes to this project will be documented in this file. 3 | 4 | --- 5 | 6 | ## [4.0.0](https://github.com/SAPConversationalAI/SDK-ios/releases/tag/3.0.2) 7 | 8 | #### Features 9 | 10 | * Major update with strong typed object 11 | 12 | ## [3.0.2](https://github.com/SAPConversationalAI/SDK-ios/releases/tag/3.0.2) 13 | 14 | #### Features 15 | 16 | * Fix array null 17 | 18 | ## [3.0.1](https://github.com/SAPConversationalAI/SDK-ios/releases/tag/3.0.1) 19 | 20 | #### Features 21 | 22 | * JSON v2 23 | * Overall redo pod 24 | 25 | ## [2.1.1](https://github.com/SAPConversationalAI/SDK-ios/releases/tag/2.1.1) 26 | 27 | #### Features 28 | 29 | * Add job entity 30 | * Add multinlangual support 31 | 32 | ## [2.0.2](https://github.com/SAPConversationalAI/SDK-ios/releases/tag/2.0.2) 33 | 34 | #### Features 35 | 36 | ## [2.0.1](https://github.com/SAPConversationalAI/SDK-ios/releases/tag/2.0.1) 37 | 38 | #### Features 39 | 40 | * Add synopsis to README 41 | 42 | ## [2.0.0](https://github.com/SAPConversationalAI/SDK-ios/releases/tag/2.0.0) 43 | 44 | #### Features 45 | 46 | * Fix voice request 47 | * Add raw attribute to Response class 48 | * Rename methods 49 | * Remove unused pod 50 | * Update README 51 | 52 | ## [1.4.2](https://github.com/SAPConversationalAI/SDK-ios/releases/tag/1.4.2) 53 | 54 | #### Features 55 | 56 | * Minor changes 57 | 58 | ## [1.4.1](https://github.com/SAPConversationalAI/SDK-ios/releases/tag/1.4.1) 59 | 60 | #### Features 61 | 62 | * Minor changes 63 | 64 | ## [1.4.0](https://github.com/SAPConversationalAI/SDK-ios/releases/tag/1.4.0) 65 | 66 | #### Features 67 | 68 | * Update to API v1 69 | * Add custom entities 70 | 71 | ## [1.0.0](https://github.com/SAPConversationalAI/SDK-ios/releases/tag/1.0.0) 72 | 73 | #### Features 74 | 75 | * Add Voice 76 | * Change pod to Alamofire for HTTP Request 77 | * Add voice to example project 78 | 79 | ## [0.6.0](https://github.com/SAPConversationalAI/SDK-ios/releases/tag/0.6.0) 80 | 81 | #### Features 82 | 83 | * Add Example Project 84 | 85 | ## [0.5.3](https://github.com/SAPConversationalAI/SDK-ios/releases/tag/0.5.3) 86 | 87 | #### Features 88 | 89 | * Add Changelog 90 | 91 | ## [0.5.2](https://github.com/SAPConversationalAI/SDK-ios/releases/tag/0.5.2) 92 | 93 | #### Features 94 | 95 | * SDK Swift 96 | * Update README 97 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2019 SAP Conversational AI 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Pod/Assets/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/SDK-iOS/9fb1060ed14404caa7a7c0d85f1c7cfd689a8671/Pod/Assets/.gitkeep -------------------------------------------------------------------------------- /Pod/Classes/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/SDK-iOS/9fb1060ed14404caa7a7c0d85f1c7cfd689a8671/Pod/Classes/.gitkeep -------------------------------------------------------------------------------- /Pod/Classes/Action.swift: -------------------------------------------------------------------------------- 1 | // 2 | // File.swift 3 | // Pods 4 | // 5 | // Created by Pierre-Edouard Lieb on 3/30/17. 6 | // 7 | // 8 | 9 | import Foundation 10 | import ObjectMapper 11 | 12 | open class Action: Mappable { 13 | 14 | public var slug: String! 15 | public var done: Bool! 16 | public var reply: String! 17 | 18 | required convenience public init?(map: Map) { 19 | self.init() 20 | mapping(map: map) 21 | } 22 | 23 | open func mapping(map: Map) { 24 | slug <- map["slug"] 25 | done <- map["done"] 26 | reply <- map["reply"] 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Pod/Classes/Conversation.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Conversation.swift 3 | // 4 | // Created by Solberg, Eric on 4/16/18. 5 | // 6 | 7 | import Foundation 8 | import ObjectMapper 9 | 10 | /** 11 | The Conversation entity is a component of the Dialog response 12 | 13 | Return from the SAP Conversational AI Dialog API call 14 | */ 15 | public class Conversation : Mappable 16 | { 17 | public var id: String! 18 | public var language: String! 19 | public var memory: [String : [String : Any]]? 20 | public var skill: String! 21 | public var skill_occurrences: Int! 22 | 23 | /** 24 | Init class map 25 | */ 26 | required convenience public init?(map: Map) 27 | { 28 | self.init() 29 | mapping(map: map) 30 | } 31 | 32 | // Mappable 33 | public func mapping(map: Map) { 34 | id <- map["id"] 35 | language <- map["language"] 36 | memory <- map["memory"] 37 | skill <- map["skill"] 38 | skill_occurrences <- map["skill_occurrences"] 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /Pod/Classes/ConverseResponse.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ConverseResponse.swift 3 | // 4 | // Created by Marcus Ataide on 1/23/17. 5 | // Copyright © 2017 Math. All rights reserved. 6 | // 7 | 8 | import UIKit 9 | import ObjectMapper 10 | import Alamofire 11 | 12 | open class ConverseResponse: Mappable { 13 | 14 | static fileprivate let base_url : String = "https://api.cai.tools.sap/v2/" 15 | static fileprivate let textConverse : String = base_url + "converse" 16 | 17 | public var uuid: String! 18 | public var source: String! 19 | public var replies: [String]? 20 | public var action: Action? 21 | public var next_actions: [Action]? 22 | public var memory: [String : [String : Any]]? 23 | public var entities: Entities? 24 | public var intents: [Intent]? 25 | public var conversation_token: String! 26 | public var language: String! 27 | public var timestamp: String! 28 | public var version: String! 29 | public var status: Int! 30 | public var requestToken : String! = "" 31 | 32 | required convenience public init?(map: Map) { 33 | self.init() 34 | mapping(map: map) 35 | } 36 | 37 | open func mapping(map: Map) { 38 | uuid <- map["uuid"] 39 | source <- map["source"] 40 | replies <- map["replies"] 41 | action <- map["action"] 42 | next_actions <- map["next_actions"] 43 | memory <- map["memory"] 44 | entities <- map["entities"] 45 | intents <- map["intents"] 46 | conversation_token <- map["conversation_token"] 47 | language <- map["language"] 48 | timestamp <- map["timestamp"] 49 | version <- map["version"] 50 | status <- map["status"] 51 | } 52 | 53 | //************ Methods - Global ************ 54 | 55 | /** 56 | Get the first intent 57 | 58 | */ 59 | public func reply() -> String? { 60 | if ((replies?.count) != nil) { 61 | return replies?[0] 62 | } 63 | return (nil) 64 | } 65 | 66 | /** 67 | Get the first next action 68 | 69 | */ 70 | public func nextAction() -> Action? { 71 | if ((next_actions?.count) != nil) { 72 | return next_actions?[0] 73 | } 74 | return (nil) 75 | } 76 | 77 | /** 78 | Get memory entity 79 | 80 | */ 81 | public func getMemory(entity: String) -> [String : AnyObject]? { 82 | for (key, _) in memory! { 83 | if key == entity { 84 | let json = memory! as [String : AnyObject] 85 | return json[entity] as? [String : AnyObject] 86 | } 87 | } 88 | return (nil) 89 | } 90 | 91 | /** 92 | Set memory entity 93 | 94 | */ 95 | public func resetMemory(entity: [String : [String : Any]]) -> Void { 96 | let headers = ["Authorization": "Token " + self.requestToken] 97 | let parameters = ["conversation_token" : self.conversation_token, "memory" : entity] as! [String : Any] 98 | Alamofire.request(ConverseResponse.textConverse, method: .put, parameters: parameters, encoding: JSONEncoding.default, headers: headers).responseJSON { 99 | response in 100 | switch response.result { 101 | case .success(let value): 102 | print (value) 103 | break 104 | case .failure(let error): 105 | print (error) 106 | break 107 | } 108 | } 109 | } 110 | 111 | /** 112 | Reset memory entity 113 | 114 | */ 115 | public func resetMemory(entity: String) -> Void { 116 | //Reset all memory 117 | memory?[entity] = ["" : ""] 118 | let headers = ["Authorization": "Token " + self.requestToken] 119 | let parameters = ["conversation_token" : self.conversation_token, "memory" : memory as Any] 120 | Alamofire.request(ConverseResponse.textConverse, method: .put, parameters: parameters, encoding: JSONEncoding.default, headers: headers).responseJSON { 121 | response in 122 | switch response.result { 123 | case .success(let value): 124 | print (value) 125 | break 126 | case .failure(let error): 127 | print (error) 128 | break 129 | } 130 | } 131 | } 132 | 133 | /** 134 | Reset memory 135 | 136 | */ 137 | public func resetMemory() -> Void { 138 | //Reset all memory 139 | for _ in memory! { 140 | _ = "" 141 | } 142 | let headers = ["Authorization": "Token " + self.requestToken] 143 | let parameters = ["conversation_token" : self.conversation_token, "memory" : memory as Any] 144 | Alamofire.request(ConverseResponse.textConverse, method: .put, parameters: parameters, encoding: JSONEncoding.default, headers: headers).responseJSON { 145 | response in 146 | switch response.result { 147 | case .success(let value): 148 | print (value) 149 | break 150 | case .failure(let error): 151 | print (error) 152 | break 153 | } 154 | } 155 | } 156 | 157 | /** 158 | Reset conversation 159 | 160 | */ 161 | public func resetConversation() -> Void { 162 | let headers = ["Authorization": "Token " + self.requestToken] 163 | let parameters = ["conversation_token" : self.conversation_token] as [String : Any] 164 | Alamofire.request(ConverseResponse.textConverse, method: .delete, parameters: parameters, encoding: JSONEncoding.default, headers: headers).responseJSON { 165 | response in 166 | switch response.result { 167 | case .success(let value): 168 | print (value) 169 | break 170 | case .failure(let error): 171 | print (error) 172 | break 173 | } 174 | } 175 | } 176 | } 177 | 178 | -------------------------------------------------------------------------------- /Pod/Classes/DialogResponse.swift: -------------------------------------------------------------------------------- 1 | // 2 | // DialogResponse.swift 3 | // 4 | // Created by Solberg, Eric on 4/16/18. 5 | // 6 | 7 | import UIKit 8 | import ObjectMapper 9 | import Alamofire 10 | 11 | /** 12 | The DialogResponse entity is returned from calls to the Dialog endpoint 13 | */ 14 | open class DialogResponse: Mappable { 15 | 16 | public var nlp: Nlp! 17 | public var messages: [Message]! 18 | public var conversation: Conversation! 19 | 20 | required convenience public init?(map: Map) { 21 | self.init() 22 | mapping(map: map) 23 | } 24 | 25 | open func mapping(map: Map) { 26 | nlp <- map["nlp"] 27 | messages <- map["messages"] 28 | conversation <- map["nlp"] 29 | } 30 | } 31 | 32 | -------------------------------------------------------------------------------- /Pod/Classes/Entities.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Entities.swift 3 | // SAP Conversational AI Official iOS SDK 4 | // 5 | // Created by Pierre-Edouard LIEB on 24/03/2016. 6 | // 7 | 8 | import Foundation 9 | import ObjectMapper 10 | 11 | /** 12 | Entities class. This is the list of the current entities detected: 13 | - age 14 | - cardinal 15 | - color 16 | - datetime 17 | - distance 18 | - duration 19 | - email 20 | - ip 21 | - language 22 | - location 23 | - mass 24 | - misc 25 | - money 26 | - nationality 27 | - number 28 | - ordinal 29 | - organization 30 | - percent 31 | - person 32 | - pronoun 33 | - set 34 | - sort 35 | - speed 36 | - temperature 37 | - url 38 | - volume 39 | - custom 40 | */ 41 | 42 | public class Entities : Mappable 43 | { 44 | public var cardinals : [Cardinal]? 45 | public var colors : [Color]? 46 | public var datetimes : [Datetime]? 47 | public var distances : [Distance]? 48 | public var durations : [Duration]? 49 | public var emails : [Email]? 50 | public var emojis : [Emoji]? 51 | public var ips : [IP]? 52 | public var intervals : [Interval]? 53 | public var jobs : [Job]? 54 | public var languages : [Language]? 55 | public var locations : [Location]? 56 | public var masses : [Mass]? 57 | public var moneys : [Money]? 58 | public var nationalities : [Nationality]? 59 | public var numbers : [Number]? 60 | public var ordinals : [Ordinal]? 61 | public var organizations : [Organization]? 62 | public var percents : [Percent]? 63 | public var persons : [Person]? 64 | public var phone : [Phone]? 65 | public var pronouns : [Pronoun]? 66 | public var sets : [Set]? 67 | public var sorts : [Sort]? 68 | public var speeds : [Speed]? 69 | public var temperatures : [Temperature]? 70 | public var urls : [Url]? 71 | public var volumes : [Volume]? 72 | public var customs : [String:[Custom]]? 73 | 74 | /** 75 | Init class map 76 | */ 77 | 78 | required public init?(map: Map){ 79 | 80 | } 81 | 82 | // Mappable 83 | public func mapping(map: Map) { 84 | cardinals <- map["cardinal"] 85 | colors <- map["color"] 86 | datetimes <- map["datetime"] 87 | distances <- map["distance"] 88 | durations <- map["duration"] 89 | emails <- map["email"] 90 | emojis <- map["emoji"] 91 | ips <- map["ip"] 92 | intervals <- map["interval"] 93 | jobs <- map["job"] 94 | languages <- map["language"] 95 | locations <- map["location"] 96 | masses <- map["masse"] 97 | moneys <- map["money"] 98 | nationalities <- map["nationalitie"] 99 | numbers <- map["number"] 100 | ordinals <- map["ordinal"] 101 | organizations <- map["organization"] 102 | percents <- map["percent"] 103 | persons <- map["person"] 104 | phone <- map["phone"] 105 | pronouns <- map["pronoun"] 106 | sets <- map["set"] 107 | sorts <- map["sort"] 108 | speeds <- map["speed"] 109 | temperatures <- map["temperature"] 110 | urls <- map["url"] 111 | volumes <- map["volume"] 112 | customs <- map["custom"] 113 | } 114 | } 115 | 116 | /** 117 | Struct Cardinal 118 | 119 | Examples : north, southeast, north-west 120 | 121 | Key: 122 | - bearing: Float, the cardinal point bearing in degrees 123 | - raw: The raw value extracted for the sentence 124 | */ 125 | public class Cardinal : Mappable, CustomStringConvertible 126 | { 127 | public var bearing : Float = 0.0 128 | public var raw : String = "" 129 | public var confidence : Float = 0.0 130 | 131 | public var description: String 132 | { 133 | return "Bearing(deg : \(bearing), raw : \(raw))" 134 | } 135 | 136 | required convenience public init?(map: Map) { 137 | self.init() 138 | mapping(map: map) 139 | } 140 | 141 | // Mappable 142 | public func mapping(map: Map) { 143 | bearing <- map["bearing"] 144 | raw <- map["raw"] 145 | confidence <- map["confidence"] 146 | } 147 | } 148 | 149 | /** 150 | Struct Color 151 | 152 | Examples : blue, red, orange 153 | 154 | Key: 155 | - hex: String, the hexadecimal value of the color 156 | - raw: The raw value extracted for the sentence 157 | */ 158 | public class Color : Mappable, CustomStringConvertible 159 | { 160 | public var rgb : String = "" 161 | public var hex : String = "" 162 | public var raw : String = "" 163 | public var confidence : Float = 0.0 164 | 165 | public var description: String 166 | { 167 | return "Color(hex : \(hex), raw : \(raw))" 168 | } 169 | 170 | required convenience public init?(map: Map) { 171 | self.init() 172 | mapping(map: map) 173 | } 174 | 175 | // Mappable 176 | public func mapping(map: Map) { 177 | rgb <- map["rgb"] 178 | hex <- map["hex"] 179 | raw <- map["raw"] 180 | confidence <- map["confidence"] 181 | } 182 | } 183 | 184 | /** 185 | Struct Datetime 186 | 187 | Examples : the next friday, today, September 7 2016 188 | 189 | Key: 190 | - value: Integer, the unix timestamp of the datetime 191 | - raw: The raw value extracted for the sentence 192 | */ 193 | public class Datetime : Mappable, CustomStringConvertible 194 | { 195 | public var formatted : String = "" 196 | public var iso : String = "" 197 | public var accuracy : String = "" 198 | public var chronology : String = "" 199 | public var raw : String = "" 200 | public var confidence : Float = 0.0 201 | 202 | public var description: String 203 | { 204 | return "Datetime(formatted : \(formatted), raw : \(raw))" 205 | } 206 | 207 | required convenience public init?(map: Map) { 208 | self.init() 209 | mapping(map: map) 210 | } 211 | 212 | // Mappable 213 | public func mapping(map: Map) { 214 | formatted <- map["formatted"] 215 | iso <- map["iso"] 216 | accuracy <- map["accuracy"] 217 | chronology <- map["chronology"] 218 | raw <- map["raw"] 219 | confidence <- map["confidence"] 220 | } 221 | } 222 | 223 | /** 224 | Struct Distance 225 | 226 | Examples : 20 meters, seven miles 227 | 228 | Key: 229 | - value: Float, the countable 230 | - unit: String, the quantifier 231 | - raw: The raw value extracted for the sentence 232 | */ 233 | public class Distance : Mappable, CustomStringConvertible 234 | { 235 | public var scalar : Float = 0.0 236 | public var unit : String = "" 237 | public var meters : Float = 0.0 238 | public var raw : String = "" 239 | public var confidence : Float = 0.0 240 | 241 | public var description: String 242 | { 243 | return "Distance(scalar : \(scalar), unit : \(unit), raw : \(raw))" 244 | } 245 | 246 | required convenience public init?(map: Map) { 247 | self.init() 248 | mapping(map: map) 249 | } 250 | 251 | // Mappable 252 | public func mapping(map: Map) { 253 | scalar <- map["scalar"] 254 | unit <- map["unit"] 255 | meters <- map["meters"] 256 | raw <- map["raw"] 257 | confidence <- map["confidence"] 258 | } 259 | } 260 | 261 | /** 262 | Struct Duration 263 | 264 | Examples : five days, one year 265 | 266 | Key: 267 | - value: Integer, the number of seconds in this span 268 | - raw: The raw value extracted for the sentence 269 | */ 270 | public class Duration : Mappable, CustomStringConvertible 271 | { 272 | public var chrono : String = "" 273 | public var years : Float = 0.0 274 | public var months : Float = 0.0 275 | public var days : Float = 0.0 276 | public var hours : Float = 0.0 277 | public var minutes : Float = 0.0 278 | public var seconds : Float = 0.0 279 | public var raw : String = "" 280 | public var confidence : Float = 0.0 281 | 282 | public var description: String 283 | { 284 | return "Duration(chrono : \(chrono), raw : \(raw))" 285 | } 286 | 287 | required convenience public init?(map: Map) { 288 | self.init() 289 | mapping(map: map) 290 | } 291 | 292 | // Mappable 293 | public func mapping(map: Map) { 294 | chrono <- map["chrono"] 295 | years <- map["years"] 296 | months <- map["months"] 297 | days <- map["days"] 298 | hours <- map["hours"] 299 | minutes <- map["minutes"] 300 | seconds <- map["seconds"] 301 | raw <- map["raw"] 302 | confidence <- map["confidence"] 303 | } 304 | } 305 | 306 | /** 307 | Struct Email 308 | 309 | Examples : hello@example.com, hello+devs@example.com 310 | 311 | Key: 312 | - value: String, the downcased email 313 | - raw: The raw value extracted for the sentence 314 | */ 315 | public class Email : Mappable, CustomStringConvertible 316 | { 317 | public var local : String = "" 318 | public var tag : String = "" 319 | public var domain : String = "" 320 | public var raw : String = "" 321 | public var confidence : Float = 0.0 322 | 323 | public var description: String 324 | { 325 | return "Email(local : \(local), domain : \(domain), raw : \(raw))" 326 | } 327 | 328 | required convenience public init?(map: Map) { 329 | self.init() 330 | mapping(map: map) 331 | } 332 | 333 | // Mappable 334 | public func mapping(map: Map) { 335 | local <- map["local"] 336 | tag <- map["tag"] 337 | domain <- map["domain"] 338 | raw <- map["raw"] 339 | confidence <- map["confidence"] 340 | } 341 | } 342 | 343 | /** 344 | Struct Emoji 345 | 346 | Examples : emoji :), :heart:, 🙂 347 | 348 | Key: 349 | - formatted: the value 350 | - feeling: the value 351 | - tags: the value 352 | - unicode: the value 353 | - description: the value 354 | - raw: The raw value extracted for the sentence 355 | */ 356 | public class Emoji : Mappable, CustomStringConvertible 357 | { 358 | public var formatted : String = "" 359 | public var feeling : String = "" 360 | public var tags : [String] = [] 361 | public var unicode : String = "" 362 | public var descriptionEmoji : String = "" 363 | public var raw : String = "" 364 | public var confidence : Float = 0.0 365 | 366 | public var description: String 367 | { 368 | return "Emoji(formatted : \(formatted), raw : \(raw))" 369 | } 370 | 371 | required convenience public init?(map: Map) { 372 | self.init() 373 | mapping(map: map) 374 | } 375 | 376 | // Mappable 377 | public func mapping(map: Map) { 378 | formatted <- map["formatted"] 379 | feeling <- map["feeling"] 380 | tags <- map["tags"] 381 | unicode <- map["unicode"] 382 | descriptionEmoji <- map["description"] 383 | raw <- map["raw"] 384 | confidence <- map["confidence"] 385 | } 386 | } 387 | 388 | /** 389 | Struct IP 390 | 391 | Examples : 127.0.0.1 392 | 393 | Key: 394 | - formated: String, the full denomination of the ip’s location 395 | - lat: Float, the latitude of the ip’s location 396 | - lng: Float, the longitude of the ip’s location 397 | - raw: The raw value extracted for the sentence 398 | */ 399 | public class IP : Mappable, CustomStringConvertible 400 | { 401 | public var formated : String = "" 402 | public var lat : Float = 0.0 403 | public var lng : Float = 0.0 404 | public var raw : String = "" 405 | public var confidence : Float = 0.0 406 | 407 | public var description: String 408 | { 409 | return "IP(formated : \(formated), lat : \(lat), lng : \(lng), raw : \(raw))" 410 | } 411 | 412 | required convenience public init?(map: Map) { 413 | self.init() 414 | mapping(map: map) 415 | } 416 | 417 | // Mappable 418 | public func mapping(map: Map) { 419 | formated <- map["formated"] 420 | lat <- map["lat"] 421 | lng <- map["lng"] 422 | raw <- map["raw"] 423 | confidence <- map["confidence"] 424 | } 425 | } 426 | 427 | /** 428 | Struct Interval 429 | 430 | Examples : between today and tomorrow, from now to next week, wednesday the 3rd between 2pm and 3pm, starting sunday ending monday 431 | 432 | Key: 433 | - value: String, the downcased job 434 | - raw: The raw value extracted for the sentence 435 | */ 436 | public class Interval : Mappable, CustomStringConvertible 437 | { 438 | public var begin : String = "" 439 | public var end : String = "" 440 | public var begin_chronology : String = "" 441 | public var end_chronology : String = "" 442 | public var begin_accuracy : String = "" 443 | public var end_accuracy : String = "" 444 | public var timespan : Float = 0.0 445 | public var raw : String = "" 446 | public var confidence : Float = 0.0 447 | 448 | public var description: String 449 | { 450 | return "Interval(begin : \(begin), end : \(end), raw : \(raw))" 451 | } 452 | 453 | required convenience public init?(map: Map) { 454 | self.init() 455 | mapping(map: map) 456 | } 457 | 458 | // Mappable 459 | public func mapping(map: Map) { 460 | begin <- map["begin"] 461 | end <- map["end"] 462 | begin_chronology <- map["begin_chronology"] 463 | end_chronology <- map["end_chronology"] 464 | begin_accuracy <- map["begin_accuracy"] 465 | end_accuracy <- map["end_accuracy"] 466 | timespan <- map["timespan"] 467 | raw <- map["raw"] 468 | confidence <- map["confidence"] 469 | } 470 | } 471 | 472 | /** 473 | Struct Job 474 | 475 | Examples : CTO, farmer, financial accoutant 476 | 477 | Key: 478 | - value: String, the downcased job 479 | - raw: The raw value extracted for the sentence 480 | */ 481 | public class Job : Mappable, CustomStringConvertible 482 | { 483 | public var raw : String = "" 484 | public var confidence : Float = 0.0 485 | 486 | public var description: String 487 | { 488 | return "Job(raw : \(raw))" 489 | } 490 | 491 | required convenience public init?(map: Map) { 492 | self.init() 493 | mapping(map: map) 494 | } 495 | 496 | // Mappable 497 | public func mapping(map: Map) { 498 | raw <- map["raw"] 499 | confidence <- map["confidence"] 500 | } 501 | } 502 | 503 | /** 504 | Struct Language 505 | 506 | Examples : French, Hindi, Russian 507 | 508 | Key: 509 | - code: String, the language code. Follows the ISO 639-1 standard 510 | - raw: The raw value extracted for the sentence 511 | */ 512 | public class Language : Mappable, CustomStringConvertible 513 | { 514 | public var short : String = "" 515 | public var long : String = "" 516 | public var raw : String = "" 517 | public var confidence : Float = 0.0 518 | 519 | public var description: String 520 | { 521 | return "Language(short : \(short), raw : \(raw))" 522 | } 523 | 524 | required convenience public init?(map: Map) { 525 | self.init() 526 | mapping(map: map) 527 | } 528 | 529 | // Mappable 530 | public func mapping(map: Map) { 531 | short <- map["short"] 532 | long <- map["long"] 533 | raw <- map["raw"] 534 | confidence <- map["confidence"] 535 | } 536 | } 537 | 538 | /** 539 | Struct Location 540 | 541 | Examples : San Francisco, Paris, France 542 | 543 | Key: 544 | - formated: String, the full denomination of the location 545 | - lat: Float, the latitude of the location 546 | - lng: Float, the longitude of the location 547 | - raw: The raw value extracted for the sentence 548 | */ 549 | public class Location : Mappable, CustomStringConvertible 550 | { 551 | public var formated : String = "" 552 | public var lat : Float = 0.0 553 | public var lng : Float = 0.0 554 | public var place : String = "" 555 | public var type : String = "" 556 | public var raw : String = "" 557 | public var confidence : Float = 0.0 558 | 559 | public var description: String 560 | { 561 | return "Location(formated : \(formated), lat : \(lat), lng : \(lng), raw : \(raw))" 562 | } 563 | 564 | required convenience public init?(map: Map) { 565 | self.init() 566 | mapping(map: map) 567 | } 568 | 569 | // Mappable 570 | public func mapping(map: Map) { 571 | formated <- map["formated"] 572 | lat <- map["lat"] 573 | lng <- map["lng"] 574 | place <- map["place"] 575 | type <- map["type"] 576 | raw <- map["raw"] 577 | confidence <- map["confidence"] 578 | } 579 | } 580 | 581 | /** 582 | Struct Mass 583 | 584 | Examples : 45 pounds, twenty-one grams 585 | 586 | Key: 587 | - value: Float, the countable 588 | - unit: String, the quantifier. Can be lbs (pounds), kg (kilograms), g (grams), oz (ounces), etc. 589 | - raw: The raw value extracted for the sentence 590 | */ 591 | public class Mass : Mappable, CustomStringConvertible 592 | { 593 | public var scalar : Float = 0.0 594 | public var unit : String = "" 595 | public var grams : Float = 0.0 596 | public var raw : String = "" 597 | public var confidence : Float = 0.0 598 | 599 | public var description: String 600 | { 601 | return "Mass(scalar : \(scalar), unit : \(unit), raw : \(raw))" 602 | } 603 | 604 | required convenience public init?(map: Map) { 605 | self.init() 606 | mapping(map: map) 607 | } 608 | 609 | // Mappable 610 | public func mapping(map: Map) { 611 | scalar <- map["scalar"] 612 | unit <- map["unit"] 613 | grams <- map["grams"] 614 | raw <- map["raw"] 615 | confidence <- map["confidence"] 616 | } 617 | } 618 | 619 | /** 620 | Struct Money 621 | 622 | Examples : 3.14 euros, eight millions dollars, $6 623 | 624 | Key: 625 | - value: Float, the countable 626 | - unit: String, the currency. Follows the ISO 4217 standard 627 | - raw: The raw value extracted for the sentence 628 | */ 629 | public class Money : Mappable, CustomStringConvertible 630 | { 631 | public var amount : Float = 0.0 632 | public var currency : String = "" 633 | public var dollars : Float = 0.0 634 | public var raw : String = "" 635 | public var confidence : Float = 0.0 636 | 637 | public var description: String 638 | { 639 | return "Money(amount : \(amount), currency : \(currency), dollars : \(dollars), raw : \(raw))" 640 | } 641 | 642 | required convenience public init?(map: Map) { 643 | self.init() 644 | mapping(map: map) 645 | } 646 | 647 | // Mappable 648 | public func mapping(map: Map) { 649 | amount <- map["amount"] 650 | currency <- map["currency"] 651 | dollars <- map["dollars"] 652 | raw <- map["raw"] 653 | confidence <- map["confidence"] 654 | } 655 | } 656 | 657 | /** 658 | Struct Nationality 659 | 660 | Examples : French, Spanish, Australian 661 | 662 | Key: 663 | - code: String, the country code. Follows the ISO 3166-1 alpha2 standard 664 | - raw: The raw value extracted for the sentence 665 | */ 666 | public class Nationality : Mappable, CustomStringConvertible 667 | { 668 | public var short : String = "" 669 | public var long : String = "" 670 | public var country : String = "" 671 | public var raw : String = "" 672 | public var confidence : Float = 0.0 673 | 674 | public var description: String 675 | { 676 | return "Nationality(short : \(short), raw : \(raw))" 677 | } 678 | 679 | required convenience public init?(map: Map) { 680 | self.init() 681 | mapping(map: map) 682 | } 683 | 684 | // Mappable 685 | public func mapping(map: Map) { 686 | short <- map["short"] 687 | long <- map["long"] 688 | country <- map["country"] 689 | raw <- map["raw"] 690 | confidence <- map["confidence"] 691 | } 692 | } 693 | 694 | /** 695 | Struct Number 696 | 697 | Examples : one thousand, 3, 9,000 698 | 699 | Key: 700 | - value: Integer, the number 701 | - raw: The raw value extracted for the sentence 702 | */ 703 | public class Number : Mappable, CustomStringConvertible 704 | { 705 | public var scalar : Int = 0 706 | public var raw : String = "" 707 | public var confidence : Float = 0.0 708 | 709 | public var description: String 710 | { 711 | return "Number(scalar : \(scalar), raw : \(raw))" 712 | } 713 | 714 | required convenience public init?(map: Map) { 715 | self.init() 716 | mapping(map: map) 717 | } 718 | 719 | // Mappable 720 | public func mapping(map: Map) { 721 | scalar <- map["scalar"] 722 | raw <- map["raw"] 723 | confidence <- map["confidence"] 724 | } 725 | } 726 | 727 | /** 728 | Struct Ordinal 729 | 730 | Examples : 3rd, 158th, last 731 | 732 | Key: 733 | - value: Integer, the number behind the ordinal 734 | - raw: The raw value extracted for the sentence 735 | */ 736 | public class Ordinal : Mappable, CustomStringConvertible 737 | { 738 | public var rank : Int = 0 739 | public var raw : String = "" 740 | public var confidence : Float = 0.0 741 | 742 | public var description: String 743 | { 744 | return "Ordinal(rank : \(rank), raw : \(raw))" 745 | } 746 | 747 | required convenience public init?(map: Map) { 748 | self.init() 749 | mapping(map: map) 750 | } 751 | 752 | // Mappable 753 | public func mapping(map: Map) { 754 | rank <- map["rank"] 755 | raw <- map["raw"] 756 | confidence <- map["confidence"] 757 | } 758 | } 759 | 760 | /** 761 | Struct Organization 762 | 763 | Examples : Lehman Brothers, NASA 764 | 765 | Key: 766 | - value: String, the downcased entity extracted 767 | - raw: The raw value extracted for the sentence 768 | */ 769 | public class Organization : Mappable, CustomStringConvertible 770 | { 771 | public var raw : String = "" 772 | public var confidence : Float = 0.0 773 | 774 | public var description: String 775 | { 776 | return "Organization(raw : \(raw))" 777 | } 778 | 779 | required convenience public init?(map: Map) { 780 | self.init() 781 | mapping(map: map) 782 | } 783 | 784 | // Mappable 785 | public func mapping(map: Map) { 786 | raw <- map["raw"] 787 | confidence <- map["confidence"] 788 | } 789 | } 790 | 791 | /** 792 | Struct Percent 793 | 794 | Examples : 99%, two percent, one out of three 795 | 796 | Key: 797 | - value: Float, the countable 798 | - unit: String, the quantifier. Can be % (percent), etc. 799 | - raw: The raw value extracted for the sentence 800 | */ 801 | public class Percent : Mappable, CustomStringConvertible 802 | { 803 | public var scalar : Float = 0.0 804 | public var unit : String = "" 805 | public var raw : String = "" 806 | public var confidence : Float = 0.0 807 | 808 | public var description: String 809 | { 810 | return "Percent(scalar : \(scalar), unit : \(unit), raw : \(raw))" 811 | } 812 | 813 | required convenience public init?(map: Map) { 814 | self.init() 815 | mapping(map: map) 816 | } 817 | 818 | // Mappable 819 | public func mapping(map: Map) { 820 | scalar <- map["scalar"] 821 | unit <- map["unit"] 822 | raw <- map["raw"] 823 | confidence <- map["confidence"] 824 | } 825 | } 826 | 827 | /** 828 | Struct Person 829 | 830 | Examples : John Smith, David H. Doe 831 | 832 | Key: 833 | - value: String, the downcased entity extracted 834 | - raw: The raw value extracted for the sentence 835 | */ 836 | public class Person : Mappable, CustomStringConvertible 837 | { 838 | public var fullname : String = "" 839 | public var raw : String = "" 840 | public var confidence : Float = 0.0 841 | 842 | public var description: String 843 | { 844 | return "Person(fullname : \(fullname), raw : \(raw))" 845 | } 846 | 847 | required convenience public init?(map: Map) { 848 | self.init() 849 | mapping(map: map) 850 | } 851 | 852 | // Mappable 853 | public func mapping(map: Map) { 854 | fullname <- map["fullname"] 855 | raw <- map["raw"] 856 | confidence <- map["confidence"] 857 | } 858 | } 859 | 860 | /** 861 | Struct Phone 862 | 863 | Examples : +91-22-265 9000, 64 4 437-4746, 0682753582, (123) 123 1234 864 | 865 | Key: 866 | - value: String, the downcased entity extracted 867 | - raw: The raw value extracted for the sentence 868 | */ 869 | public class Phone : Mappable, CustomStringConvertible 870 | { 871 | public var number : String = "" 872 | public var raw : String = "" 873 | public var confidence : Float = 0.0 874 | 875 | public var description: String 876 | { 877 | return "Phone(number : \(number), raw : \(raw))" 878 | } 879 | 880 | required convenience public init?(map: Map) { 881 | self.init() 882 | mapping(map: map) 883 | } 884 | 885 | // Mappable 886 | public func mapping(map: Map) { 887 | number <- map["number"] 888 | raw <- map["raw"] 889 | confidence <- map["confidence"] 890 | } 891 | } 892 | 893 | /** 894 | Struct Pronoun 895 | 896 | Examples : I, we, it 897 | 898 | Key: 899 | - person: Integer, the person of the pronoun. Can be 1, 2 or 3 900 | - number: String, the number of the pronoun. Can be singular or plural 901 | - gender: String, the gender of the pronoun. Can be unknown, neutral, male of female 902 | - raw: The raw value extracted for the sentence 903 | */ 904 | public class Pronoun : Mappable, CustomStringConvertible 905 | { 906 | public var person : Int = 0 907 | public var number : String = "" 908 | public var gender : String = "" 909 | public var raw : String = "" 910 | public var confidence : Float = 0.0 911 | 912 | public var description: String 913 | { 914 | return "Pronoun(person : \(person), number : \(number), gender : \(gender), raw : \(raw))" 915 | } 916 | 917 | required convenience public init?(map: Map) { 918 | self.init() 919 | mapping(map: map) 920 | } 921 | 922 | // Mappable 923 | public func mapping(map: Map) { 924 | person <- map["person"] 925 | number <- map["number"] 926 | gender <- map["gender"] 927 | raw <- map["raw"] 928 | confidence <- map["confidence"] 929 | } 930 | } 931 | 932 | /** 933 | Struct Set 934 | 935 | Examples : every Sunday, each day 936 | 937 | Key: 938 | - next: Integer, the timestamp representing the next occurence 939 | - grain: String, the delay to repeat. Can be a combination of a number and a quantifier (day, week, month, year), just a quantifier, or even a day name. 940 | - raw: The raw value extracted for the sentence 941 | */ 942 | public class Set : Mappable, CustomStringConvertible 943 | { 944 | public var next : String = "" 945 | public var frequencey : String = "" 946 | public var interval : Int = 0 947 | public var rrule : String = "" 948 | public var raw : String = "" 949 | public var confidence : Float = 0.0 950 | 951 | public var description: String 952 | { 953 | return "Set(next : \(next), frequencey : \(frequencey), raw : \(raw))" 954 | } 955 | 956 | required convenience public init?(map: Map) { 957 | self.init() 958 | mapping(map: map) 959 | } 960 | 961 | // Mappable 962 | public func mapping(map: Map) { 963 | next <- map["next"] 964 | frequencey <- map["frequencey"] 965 | interval <- map["interval"] 966 | rrule <- map["rrule"] 967 | raw <- map["raw"] 968 | confidence <- map["confidence"] 969 | } 970 | } 971 | 972 | /** 973 | Struct Sort 974 | 975 | Examples : most valuable, best, least affordable 976 | 977 | Key: 978 | - value: String, the criterion to sort 979 | - order: String, the order to sort (MySQL inspired) 980 | - raw: The raw value extracted for the sentence 981 | */ 982 | public class Sort : Mappable, CustomStringConvertible 983 | { 984 | public var order : String = "" 985 | public var criterion : String = "" 986 | public var raw : String = "" 987 | public var confidence : Float = 0.0 988 | 989 | public var description: String 990 | { 991 | return "Sort(order : \(order), criterion : \(criterion), raw : \(raw))" 992 | } 993 | 994 | required convenience public init?(map: Map) { 995 | self.init() 996 | mapping(map: map) 997 | } 998 | 999 | // Mappable 1000 | public func mapping(map: Map) { 1001 | order <- map["order"] 1002 | criterion <- map["criterion"] 1003 | raw <- map["raw"] 1004 | confidence <- map["confidence"] 1005 | } 1006 | } 1007 | 1008 | /** 1009 | Struct Speed 1010 | 1011 | Examples : 7 mph, 10 km/h, seven meters per second 1012 | 1013 | Key: 1014 | - value: Float, the countable 1015 | - unit: String, the quantifier. Can be km/h (kilometer per hour), mi/s (miles per second), kt (knots), etc. 1016 | - raw: The raw value extracted for the sentence 1017 | */ 1018 | public class Speed : Mappable, CustomStringConvertible 1019 | { 1020 | public var scalar : Float = 0.0 1021 | public var unit : String = "" 1022 | public var mps : Float = 0.0 1023 | public var raw : String = "" 1024 | public var confidence : Float = 0.0 1025 | 1026 | public var description: String 1027 | { 1028 | return "Speed(scalar : \(scalar), unit : \(unit), raw : \(raw))" 1029 | } 1030 | 1031 | required convenience public init?(map: Map) { 1032 | self.init() 1033 | mapping(map: map) 1034 | } 1035 | 1036 | // Mappable 1037 | public func mapping(map: Map) { 1038 | scalar <- map["scalar"] 1039 | unit <- map["unit"] 1040 | mps <- map["mps"] 1041 | raw <- map["raw"] 1042 | confidence <- map["confidence"] 1043 | } 1044 | } 1045 | 1046 | /** 1047 | Struct Temperature 1048 | 1049 | Examples : 7 mph, 10 km/h, seven meters per second 1050 | 1051 | Key: 1052 | - value: Float, the countable 1053 | - unit: String, the quantifier. Can be C (Celsius), K (Kelvin), F (Fahrenheit), R (Rankine), etc. 1054 | - raw: The raw value extracted for the sentence 1055 | */ 1056 | public class Temperature : Mappable, CustomStringConvertible 1057 | { 1058 | public var scalar : Float = 0.0 1059 | public var unit : String = "" 1060 | public var celsius : Float = 0.0 1061 | public var raw : String = "" 1062 | public var confidence : Float = 0.0 1063 | 1064 | public var description: String 1065 | { 1066 | return "Temperature(scalar : \(scalar), unit : \(unit), raw : \(raw))" 1067 | } 1068 | 1069 | required convenience public init?(map: Map) { 1070 | self.init() 1071 | mapping(map: map) 1072 | } 1073 | 1074 | // Mappable 1075 | public func mapping(map: Map) { 1076 | scalar <- map["scalar"] 1077 | unit <- map["unit"] 1078 | celsius <- map["celsius"] 1079 | raw <- map["raw"] 1080 | confidence <- map["confidence"] 1081 | } 1082 | } 1083 | 1084 | /** 1085 | Struct Url 1086 | 1087 | Examples : https://cai.tools.sap, localhost:9000, api.cai.tools.sap/request 1088 | 1089 | Key: 1090 | - value: String, the downcased entity extracted 1091 | - raw: The raw value extracted for the sentence 1092 | */ 1093 | public class Url : Mappable, CustomStringConvertible 1094 | { 1095 | public var scheme : String = "" 1096 | public var host : String = "" 1097 | public var path : String = "" 1098 | public var params : String = "" 1099 | public var query : String = "" 1100 | public var fragment : String = "" 1101 | public var raw : String = "" 1102 | public var confidence : Float = 0.0 1103 | 1104 | public var description: String 1105 | { 1106 | return "Url(host : \(host), raw : \(raw))" 1107 | } 1108 | 1109 | required convenience public init?(map: Map) { 1110 | self.init() 1111 | mapping(map: map) 1112 | } 1113 | 1114 | // Mappable 1115 | public func mapping(map: Map) { 1116 | scheme <- map["scheme"] 1117 | host <- map["host"] 1118 | path <- map["path"] 1119 | params <- map["params"] 1120 | query <- map["query"] 1121 | fragment <- map["fragment"] 1122 | raw <- map["raw"] 1123 | confidence <- map["confidence"] 1124 | } 1125 | } 1126 | 1127 | /** 1128 | Struct Volume 1129 | 1130 | Examples : 30 liters, two barrels, ½ tbsp 1131 | 1132 | Key: 1133 | - value: Float, the countable 1134 | - unit: String, the quantifier. Can be l (liters), tsp (teaspoons), pt (pints), etc. 1135 | - raw: The raw value extracted for the sentence 1136 | */ 1137 | public class Volume : Mappable, CustomStringConvertible 1138 | { 1139 | public var scalar : Float = 0.0 1140 | public var unit : String = "" 1141 | public var liters : Float = 0.0 1142 | public var raw : String = "" 1143 | public var confidence : Float = 0.0 1144 | 1145 | public var description: String 1146 | { 1147 | return "Volume(scalar : \(scalar), unit : \(unit), raw : \(raw))" 1148 | } 1149 | 1150 | required convenience public init?(map: Map) { 1151 | self.init() 1152 | mapping(map: map) 1153 | } 1154 | 1155 | // Mappable 1156 | public func mapping(map: Map) { 1157 | scalar <- map["scalar"] 1158 | unit <- map["unit"] 1159 | liters <- map["liters"] 1160 | raw <- map["raw"] 1161 | confidence <- map["confidence"] 1162 | } 1163 | } 1164 | 1165 | /** 1166 | Struct Custom 1167 | 1168 | Key: 1169 | - value: the value 1170 | - raw: The raw value extracted for the sentence 1171 | */ 1172 | public class Custom : Mappable, CustomStringConvertible 1173 | { 1174 | public var value : String = "" 1175 | public var raw : String = "" 1176 | public var confidence : Float = 0.0 1177 | 1178 | public var description: String 1179 | { 1180 | return "Custom(value : \(value), raw : \(raw))" 1181 | } 1182 | 1183 | required convenience public init?(map: Map) { 1184 | self.init() 1185 | mapping(map: map) 1186 | } 1187 | 1188 | // Mappable 1189 | public func mapping(map: Map) { 1190 | value <- map["value"] 1191 | raw <- map["raw"] 1192 | confidence <- map["confidence"] 1193 | } 1194 | } 1195 | -------------------------------------------------------------------------------- /Pod/Classes/Intent.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Intent.swift 3 | // Pods 4 | // 5 | // Created by PE on 29/09/2016. 6 | // 7 | // 8 | 9 | import Foundation 10 | import ObjectMapper 11 | 12 | /** 13 | Class Response 14 | 15 | Return from the SAP Conversational AI API call 16 | */ 17 | public class Intent : Mappable, CustomStringConvertible 18 | { 19 | public var confidence : Float? 20 | public var slug : String? 21 | 22 | 23 | /** 24 | Init class map 25 | */ 26 | required public init?(map: Map) 27 | { 28 | 29 | } 30 | 31 | // Mappable 32 | public func mapping(map: Map) { 33 | confidence <- map["confidence"] 34 | slug <- map["slug"] 35 | } 36 | 37 | public var description: String { 38 | return slug! 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /Pod/Classes/Message.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Message.swift 3 | // 4 | // Created by Solberg, Eric on 4/16/18. 5 | // 6 | 7 | import Foundation 8 | import ObjectMapper 9 | 10 | /** 11 | Message entities contain bot responses from a Dialog request 12 | */ 13 | public class Message : Mappable 14 | { 15 | public var type: String! 16 | public var content: String! 17 | 18 | /** 19 | Init class map 20 | */ 21 | required convenience public init?(map: Map) 22 | { 23 | self.init() 24 | mapping(map: map) 25 | } 26 | 27 | // Mappable 28 | public func mapping(map: Map) { 29 | type <- map["type"] 30 | content <- map["content"] 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /Pod/Classes/Nlp.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Nlp.swift 3 | // 4 | // Created by Solberg, Eric on 4/16/18. 5 | // 6 | 7 | import Foundation 8 | import ObjectMapper 9 | 10 | /** 11 | The Nlp entity contains details about the NLP processing on a request to the Dialog endpoint 12 | */ 13 | public class Nlp : Mappable 14 | { 15 | public var uuid: String! 16 | public var source: String! 17 | public var intents: [Intent]? 18 | public var act: String! 19 | public var type: String! 20 | public var sentiment: String! 21 | public var entities: [String : Entities]? 22 | public var language: String! 23 | public var processing_language: String! 24 | public var version: String! 25 | public var timestamp: String! 26 | public var status: Int! 27 | 28 | /** 29 | Init class map 30 | */ 31 | required public convenience init?(map: Map) 32 | { 33 | self.init() 34 | mapping(map: map) 35 | } 36 | 37 | // Mappable 38 | public func mapping(map: Map) { 39 | uuid <- map["uuid"] 40 | source <- map["source"] 41 | intents <- map["intents"] 42 | act <- map["act"] 43 | type <- map["type"] 44 | uuid <- map["sentiment"] 45 | entities <- map["entities"] 46 | language <- map["language"] 47 | processing_language <- map["processing_language"] 48 | version <- map["version"] 49 | timestamp <- map["timestamp"] 50 | status <- map["status"] 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /Pod/Classes/Response.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Response.swift 3 | // SAP Conversational AI Official iOS SDK 4 | // 5 | // Created by Pierre-Edouard LIEB on 24/03/2016. 6 | // 7 | 8 | import Foundation 9 | import ObjectMapper 10 | 11 | /** 12 | Class Response 13 | 14 | Return from the SAP Conversational AI API call 15 | */ 16 | public class Response : Mappable, CustomStringConvertible 17 | { 18 | public var source : String! 19 | public var intents : [Intent]? 20 | public var act : String! 21 | public var type : String! 22 | public var sentiment : String! 23 | public var entities : Entities? 24 | public var language : String! 25 | public var version : String! 26 | public var timestamp : String! 27 | public var status : Int! 28 | public var raw : [String : AnyObject] = [:] 29 | 30 | private var ACT_ASSERT : String = "assert" 31 | private var ACT_COMMAND : String = "command" 32 | private var ACT_WH_QUERY : String = "wh-query" 33 | private var ACT_YN_QUERY : String = "yn-query" 34 | 35 | private var TYPE_ABBREVIATION : String = "abbr:" 36 | private var TYPE_ENTITY : String = "enty:" 37 | private var TYPE_DESCRIPTION : String = "desc:" 38 | private var TYPE_HUMAN : String = "hum:" 39 | private var TYPE_LOCATION : String = "loc:" 40 | private var TYPE_NUMBER : String = "num:" 41 | 42 | private var SENTIMENT_VERY_POSITIVE : String = "vpositive" 43 | private var SENTIMENT_POSITIVE : String = "positive" 44 | private var SENTIMENT_NEUTRAL : String = "neutral" 45 | private var SENTIMENT_NEGATIVE : String = "negative" 46 | private var SENTIMENT_VERY_NEGATIVE : String = "vnegative" 47 | 48 | /** 49 | Init class with JSON 50 | 51 | */ 52 | required convenience public init?(map: Map) { 53 | self.init() 54 | mapping(map: map) 55 | } 56 | 57 | // Mappable 58 | public func mapping(map: Map) { 59 | source <- map["source"] 60 | intents <- map["intents"] 61 | act <- map["act"] 62 | type <- map["type"] 63 | sentiment <- map["sentiment"] 64 | entities <- map["entities"] 65 | language <- map["language"] 66 | version <- map["version"] 67 | timestamp <- map["timestamp"] 68 | status <- map["status"] 69 | } 70 | 71 | /** 72 | Return raw JSON description 73 | */ 74 | public var description: String { 75 | return raw.description 76 | } 77 | 78 | //************ Methods - Global ************ 79 | 80 | /** 81 | Get the first intent 82 | 83 | */ 84 | public func intent() -> Intent? { 85 | if ((intents?.count) != nil) { 86 | return intents?[0] 87 | } 88 | return (nil) 89 | } 90 | 91 | //************ Methods - ACT ************ 92 | 93 | /** 94 | Return true is the ACT is an assert 95 | 96 | */ 97 | public func assert() -> Bool? { 98 | return (act! == ACT_ASSERT) 99 | } 100 | 101 | /** 102 | Return true is the ACT is an command 103 | 104 | */ 105 | public func command() -> Bool? { 106 | return (act! == ACT_COMMAND) 107 | } 108 | 109 | /** 110 | Return true is the ACT is an wh_query 111 | 112 | */ 113 | public func wh_query() -> Bool? { 114 | return (act! == ACT_WH_QUERY) 115 | } 116 | 117 | /** 118 | Return true is the ACT is an yn_query 119 | 120 | */ 121 | public func yn_query() -> Bool? { 122 | return (act! == ACT_YN_QUERY) 123 | } 124 | 125 | //************ Methods - TYPE ************ 126 | 127 | /** 128 | Return true is the TYPE is an Abbreviation 129 | 130 | */ 131 | public func isAbbreviation() -> Bool? { 132 | if (type!.range(of: TYPE_ABBREVIATION) != nil) { 133 | return true 134 | } 135 | return false 136 | } 137 | 138 | /** 139 | Return true is the TYPE is an Entity 140 | 141 | */ 142 | public func isEntity() -> Bool? { 143 | if (type!.range(of: TYPE_ENTITY) != nil) { 144 | return true 145 | } 146 | return false 147 | } 148 | 149 | /** 150 | Return true is the TYPE is a Description 151 | 152 | */ 153 | public func isDescription() -> Bool? { 154 | if (type!.range(of: TYPE_DESCRIPTION) != nil) { 155 | return true 156 | } 157 | return false 158 | } 159 | 160 | /** 161 | Return true is the TYPE is a Human 162 | 163 | */ 164 | public func isHuman() -> Bool? { 165 | if (type!.range(of: TYPE_HUMAN) != nil) { 166 | return true 167 | } 168 | return false 169 | } 170 | 171 | /** 172 | Return true is the TYPE is a Location 173 | 174 | */ 175 | public func isLocation() -> Bool? { 176 | if (type!.range(of: TYPE_LOCATION) != nil) { 177 | return true 178 | } 179 | return false 180 | } 181 | 182 | /** 183 | Return true is the TYPE is a Number 184 | 185 | */ 186 | public func isNumber() -> Bool? { 187 | if (type!.range(of: TYPE_NUMBER) != nil) { 188 | return true 189 | } 190 | return false 191 | } 192 | 193 | //************ Methods - SENTIMENT ************ 194 | 195 | /** 196 | Return true is the SENTIMENT is VPositive 197 | 198 | */ 199 | public func isVPositive() -> Bool? { 200 | return (sentiment == SENTIMENT_VERY_POSITIVE) 201 | } 202 | 203 | /** 204 | Return true is the SENTIMENT is Positive 205 | 206 | */ 207 | public func isPositive() -> Bool? { 208 | return (sentiment == SENTIMENT_POSITIVE) 209 | } 210 | 211 | /** 212 | Return true is the SENTIMENT is Neutral 213 | 214 | */ 215 | public func isNeutral() -> Bool? { 216 | return (sentiment == SENTIMENT_NEUTRAL) 217 | } 218 | 219 | /** 220 | Return true is the SENTIMENT is Negative 221 | 222 | */ 223 | public func isNegative() -> Bool? { 224 | return (sentiment == SENTIMENT_NEGATIVE) 225 | } 226 | 227 | /** 228 | Return true is the SENTIMENT is VNegative 229 | 230 | */ 231 | public func isVNegative() -> Bool? { 232 | return (sentiment == SENTIMENT_VERY_NEGATIVE) 233 | } 234 | } 235 | -------------------------------------------------------------------------------- /Pod/Classes/Sapcai.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Sapcai.swift 3 | // SAP Conversational AI Official iOS SDK 4 | // 5 | // Created by Pierre-Edouard LIEB on 24/03/2016. 6 | // 7 | 8 | import Foundation 9 | import Alamofire 10 | import ObjectMapper 11 | /** 12 | SapcaiClient class handling request to the API 13 | */ 14 | public class SapcaiClient 15 | { 16 | static fileprivate let base_url : String = "https://api.cai.tools.sap/v2/" 17 | static fileprivate let base_url_voice : String = "ws://api.cai.tools.sap/v2/" 18 | static fileprivate let textRequest : String = base_url + "request" 19 | static fileprivate let textConverse : String = base_url + "converse" 20 | static fileprivate let voiceRequest : String = base_url_voice + "request" 21 | static fileprivate let voiceConverse : String = base_url_voice + "converse" 22 | static fileprivate let base_url_dialog : String = "https://api.cai.tools.sap/build/v1/" 23 | static fileprivate let textDialog : String = base_url_dialog + "dialog" 24 | 25 | fileprivate var token : String 26 | fileprivate let language : String? 27 | 28 | /** 29 | Init SapcaiClient Class 30 | 31 | - parameter token: your bot token 32 | - parameter language: language of sentenses if needed 33 | 34 | - returns: SapcaiClient 35 | */ 36 | public init (token : String, language : String? = nil) 37 | { 38 | self.token = token 39 | self.language = language 40 | } 41 | 42 | /** 43 | Make a text converse to SAP Conversational AI API 44 | 45 | - parameter request: sentence to send to SAP Conversational AI API 46 | - parameter lang: lang of the sentence if needed 47 | - parameter successHandler: closure called when request succeed 48 | - parameter failureHandler: closure called when request failed 49 | 50 | - returns: void 51 | */ 52 | public func converseText(_ request : String, token : String? = nil, converseToken : String? = nil, lang: String? = nil, successHandler: @escaping (ConverseResponse) -> Void, failureHandle: @escaping (Error) -> Void) 53 | { 54 | if let tkn = token 55 | { 56 | self.token = tkn 57 | } 58 | let headers = ["Authorization" : "Token " + self.token] 59 | var param = ["text" : request] 60 | if let ln = lang 61 | { 62 | param["language"] = ln 63 | } 64 | else if let ln = self.language 65 | { 66 | param["language"] = ln 67 | } 68 | if let cnvrstnTkn = converseToken 69 | { 70 | param["conversation_token"] = cnvrstnTkn 71 | } 72 | Alamofire.request(SapcaiClient.textConverse, method: .post, parameters: param, headers: headers) 73 | .validate(statusCode: 200..<300) 74 | .responseJSON { 75 | response in 76 | switch response.result { 77 | case .success(let value): 78 | let sapcaiResponse = (value as! [String : AnyObject])["results"] as! [String : Any] 79 | let converseResponse = Mapper().map(JSON: sapcaiResponse)! 80 | converseResponse.requestToken = self.token 81 | successHandler(converseResponse) 82 | case .failure(let error): 83 | failureHandle(error) 84 | } 85 | } 86 | } 87 | 88 | /** 89 | Make a text converse to SAP Conversational AI API 90 | 91 | - parameter request: sentence to send to SAP Conversational AI API 92 | - parameter lang: lang of the sentence if needed 93 | - parameter successHandler: closure called when request succeed 94 | - parameter failureHandler: closure called when request failed 95 | 96 | - returns: void 97 | */ 98 | public func converseFile(_ audioFileURL: URL, token : String? = nil, converseToken : String? = nil, lang: String? = nil, successHandler: @escaping (ConverseResponse) -> Void, failureHandle: @escaping (Error) -> Void) 99 | { 100 | if let tkn = token 101 | { 102 | self.token = tkn 103 | } 104 | let headers = ["Authorization" : "Token " + self.token] 105 | var ln : String = lang! 106 | let conversationToken : String = converseToken! 107 | if (self.language != nil) 108 | { 109 | ln = self.language! 110 | } 111 | Alamofire.upload(multipartFormData: { multipartFormData in 112 | multipartFormData.append(audioFileURL, withName: "voice") 113 | multipartFormData.append(ln.data(using: String.Encoding.utf8)!, withName: "language") 114 | multipartFormData.append(conversationToken.data(using: String.Encoding.utf8)!, withName: "conversation_token") 115 | }, 116 | to: SapcaiClient.voiceConverse, 117 | method: .post, 118 | headers: headers, 119 | encodingCompletion: { encodingResult in 120 | switch encodingResult { 121 | case .success(let upload, _, _): 122 | upload.responseJSON { response in 123 | switch response.result { 124 | case .success(let value): 125 | let sapcaiResponse = (value as! [String : AnyObject])["results"] as! [String : Any] 126 | let converseResponse = Mapper().map(JSON: sapcaiResponse)! 127 | converseResponse.requestToken = self.token 128 | successHandler(converseResponse) 129 | case .failure(let error): 130 | failureHandle(error) 131 | } 132 | } 133 | case .failure(let encodingError): 134 | failureHandle(encodingError) 135 | } 136 | }) 137 | } 138 | 139 | /** 140 | Make a text request to SAP Conversational AI API 141 | 142 | - parameter request: sentence to send to SAP Conversational AI API 143 | - parameter lang: lang of the sentence if needed 144 | - parameter successHandler: closure called when request succeed 145 | - parameter failureHandler: closure called when request failed 146 | 147 | - returns: void 148 | */ 149 | public func analyseText(_ request : String, token : String? = nil, lang: String? = nil, successHandler: @escaping (Response) -> Void, failureHandle: @escaping (Error) -> Void) 150 | { 151 | if let tkn = token 152 | { 153 | self.token = tkn 154 | } 155 | let headers = ["Authorization" : "Token " + self.token] 156 | var param = ["text" : request] 157 | if let ln = lang 158 | { 159 | param["language"] = ln 160 | } 161 | else if let ln = self.language 162 | { 163 | param["language"] = ln 164 | } 165 | Alamofire.request(SapcaiClient.textRequest, method: .post, parameters: param, headers: headers) 166 | .validate(statusCode: 200..<300) 167 | .responseJSON { 168 | response in 169 | switch response.result { 170 | case .success(let value): 171 | let sapcaiResponse = (value as! [String : AnyObject])["results"] as! [String : Any] 172 | successHandler(Mapper().map(JSON: sapcaiResponse)!) 173 | case .failure(let error): 174 | failureHandle(error) 175 | } 176 | } 177 | } 178 | 179 | /** 180 | Make a voice request to SAP Conversational AI API 181 | 182 | - parameter audioFileURL: audio file URL to send to SAP Conversational AIAI 183 | - parameter lang: lang of the sentence if needed 184 | - parameter successHandler: closure called when request succeed 185 | - parameter failureHandler: closure called when request failed 186 | 187 | - returns: void 188 | */ 189 | public func analyseFile(_ audioFileURL: URL, token : String? = nil, lang: String? = nil, successHandler: @escaping (Response) -> Void, failureHandle: @escaping (Error) -> Void) { 190 | if let tkn = token 191 | { 192 | self.token = tkn 193 | } 194 | let headers = ["Authorization": "Token " + self.token] 195 | Alamofire.upload(multipartFormData: { multipartFormData in 196 | multipartFormData.append(audioFileURL, withName: "voice") 197 | }, 198 | to: SapcaiClient.voiceRequest, 199 | method: .post, 200 | headers: headers, 201 | encodingCompletion: { encodingResult in 202 | switch encodingResult { 203 | case .success(let upload, _, _): 204 | upload.responseJSON { response in 205 | switch response.result { 206 | case .success(let value): 207 | let sapcaiResponse = (value as! [String : AnyObject])["results"] as! [String : Any] 208 | successHandler(Mapper().map(JSON: sapcaiResponse)!) 209 | case .failure(let error): 210 | failureHandle(error) 211 | } 212 | } 213 | case .failure(let encodingError): 214 | failureHandle(encodingError) 215 | } 216 | }) 217 | } 218 | 219 | /** 220 | Engage in a conversation with a bot through the SAP Conversational AI Dialog endpoint 221 | 222 | - parameter message: sentence to send to SAP Conversational AI API (required) 223 | - parameter conversationId: Unique ID of this conversation (required) 224 | - parameter lang: lang of the sentence if needed 225 | - parameter successHandler: closure called when request succeed 226 | - parameter failureHandler: closure called when request failed 227 | 228 | - returns: void 229 | */ 230 | public func dialogText(_ message : String, token : String? = nil, conversationId : String, lang: String? = nil, successHandler: @escaping (DialogResponse) -> Void, failureHandle: @escaping (Error) -> Void) 231 | { 232 | if let tkn = token 233 | { 234 | self.token = tkn 235 | } 236 | let headers = ["Authorization" : "Token " + self.token] 237 | var param : Parameters = [:] 238 | param["message"] = ["type":"text", "content":message] 239 | if let ln = lang 240 | { 241 | param["language"] = ln 242 | } 243 | else if let ln = self.language 244 | { 245 | param["language"] = ln 246 | } 247 | param["conversation_id"] = conversationId 248 | 249 | Alamofire.request(SapcaiClient.textDialog, method: .post, parameters: param, headers: headers).responseJSON { 250 | response in 251 | switch response.result { 252 | case .success(let value): 253 | let sapcaiResponse = (value as! [String : AnyObject])["results"] as! [String : Any] 254 | let converseResponse = Mapper().map(JSON: sapcaiResponse)! 255 | successHandler(converseResponse) 256 | case .failure(let error): 257 | failureHandle(error) 258 | } 259 | } 260 | } 261 | 262 | } 263 | 264 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [logo]: https://cdn.cai.tools.sap/brand/sapcai/sap-cai-black.svg "SAP Conversational AI" 2 | ![alt text][logo] 3 | 4 | # SAP Conversational AI - SDK iOS 5 | 6 | # 🚨 Sunset of Open Source SDKs for SAP Conversational AI 7 | 8 | SAP Conversational AI provides several SDKs, which are all open-source and hosted on GitHub. 9 | Starting from January 2021, please note that we inform you that the SDKs will not be available anymore and the public repository of the project will be archived from GitHub. 10 | 11 | ## ✨ Why are we sunsetting our SDKs? 12 | 13 | Firstly, we noticed over the past year that these SDKs were not used much by our users. 14 | This is because our platform usage has become easier, including the APIs. 15 | 16 | Secondly, our APIs have undergone major changes. We would need to adapt the SDKs in order to keep them working, which will lead to a significant cost from our side. 17 | 18 | Hence, we decided to sunset this open source version starting from January 2021. 19 | 20 | ## ✨ What does it mean for me as a user? 21 | 22 | Any changes in our API’s will not be reflected in our SDKs. Hence, the code might not work unless you adjust the same. 23 | 24 | ## ✨ What are the next steps? 25 | 26 | If you are interested in taking the ownership of the project on GitHub, please get in touch with us and we can discuss the process. Otherwise, if there are no objections from anyone, we would archive the project following the open source sunset process. 27 | 28 | Please use the platform SAP Answers if you have any other questions related to this topic. 29 | 30 | Happy bot building! 31 | 32 | The SAP Conversational AI team 33 | 34 | --- 35 | 36 | ## Synospis 37 | 38 | This pod is a Swift wrapper around the [SAP Conversational AI](https://cai.tools.sap) API, and allows you to: 39 | * [Analyse your text](https://github.com/SAPConversationalAI/SDK-iOS/wiki/Analyse-text) 40 | * [Manage your conversation](https://github.com/SAPConversationalAI/SDK-iOS/wiki/Build-your-bot) 41 | 42 | ## Requirements 43 | 44 | - iOS 10.0+ 45 | - Xcode 8.0+ 46 | 47 | ## Installation 48 | 49 | SAP Conversational AI is available through [CocoaPods](http://cocoapods.org). To install 50 | it, simply add the following line to your Podfile: 51 | 52 | ```ruby 53 | pod "sapcai" 54 | ``` 55 | 56 | ```swift 57 | import sapcai 58 | ``` 59 | 60 | ## More 61 | 62 | You can view the whole API reference at [cai.tools.sap/docs/api-reference ](https://cai.tools.sap/docs/api-reference ) 63 | 64 | You can follow us on Twitter at [@sapcai](https://twitter.com/sapcai) for updates and releases. 65 | 66 | ## License 67 | 68 | SAP Conversational AI is available under the MIT license. 69 | 70 | Copyright (c) [2019] [SAP Conversational AI](https://cai.tools.sap) 71 | 72 | Permission is hereby granted, free of charge, to any person obtaining a copy 73 | of this software and associated documentation files (the "Software"), to deal 74 | in the Software without restriction, including without limitation the rights 75 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 76 | copies of the Software, and to permit persons to whom the Software is 77 | furnished to do so, subject to the following conditions: 78 | 79 | The above copyright notice and this permission notice shall be included in all 80 | copies or substantial portions of the Software. 81 | 82 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 83 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 84 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 85 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 86 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 87 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 88 | SOFTWARE. 89 | -------------------------------------------------------------------------------- /sapcai.podspec: -------------------------------------------------------------------------------- 1 | # 2 | # Be sure to run `pod lib lint sapcai.podspec' to ensure this is a 3 | # valid spec before submitting. 4 | # 5 | # Any lines starting with a # are optional, but their use is encouraged 6 | # To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html 7 | # 8 | 9 | Pod::Spec.new do |s| 10 | s.name = "sapcai" 11 | s.version = "4.0.0" 12 | s.summary = "SAP Conversational AI Official iOS SDK in Swift" 13 | 14 | # This description is used to generate tags and improve search results. 15 | # * Think: What does it do? Why did you write it? What is the focus? 16 | # * Try to keep it short, snappy and to the point. 17 | # * Write the description between the DESC delimiters below. 18 | # * Finally, don't worry about the indent, CocoaPods strips it! 19 | s.description = <<-DESC 20 | SAP Conversational AI Official iOS SDK in Swift. Allows you to make request to your bots. 21 | DESC 22 | 23 | s.homepage = "https://github.com/SAPConversationalAI" 24 | # s.screenshots = "www.example.com/screenshots_1", "www.example.com/screenshots_2" 25 | s.license = 'MIT' 26 | s.author = "PSAP CAI team" 27 | s.source = { :git => "https://github.com/SAPConversationalAI/SDK-ios.git", :tag => s.version.to_s } 28 | s.social_media_url = 'https://twitter.com/sapcai' 29 | 30 | s.platform = :ios, '10.0' 31 | s.requires_arc = true 32 | 33 | s.source_files = 'Pod/Classes/**/*' 34 | #s.resource_bundles = { 35 | #'SAPConversationalAI' => ['Pod/Assets/*.png'] 36 | #} 37 | 38 | # s.public_header_files = 'Pod/Classes/**/*.h' 39 | # s.frameworks = 'UIKit', 'MapKit' 40 | s.dependency 'Alamofire' 41 | s.dependency 'ObjectMapper' 42 | end 43 | -------------------------------------------------------------------------------- /sapcai/4.0.0/sapcai.podspec: -------------------------------------------------------------------------------- 1 | # 2 | # Be sure to run `pod lib lint sapcai.podspec' to ensure this is a 3 | # valid spec before submitting. 4 | # 5 | # Any lines starting with a # are optional, but their use is encouraged 6 | # To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html 7 | # 8 | 9 | Pod::Spec.new do |s| 10 | s.name = "sapcai" 11 | s.version = "4.0.0" 12 | s.summary = "SAP Conversational AI Official iOS SDK in Swift" 13 | 14 | # This description is used to generate tags and improve search results. 15 | # * Think: What does it do? Why did you write it? What is the focus? 16 | # * Try to keep it short, snappy and to the point. 17 | # * Write the description between the DESC delimiters below. 18 | # * Finally, don't worry about the indent, CocoaPods strips it! 19 | s.description = <<-DESC 20 | SAP Conversational AI Official iOS SDK in Swift. Allows you to make request to your bots. 21 | DESC 22 | 23 | s.homepage = "https://github.com/SAPConversationalAI" 24 | # s.screenshots = "www.example.com/screenshots_1", "www.example.com/screenshots_2" 25 | s.license = 'MIT' 26 | s.author = "PSAP CAI team" 27 | s.source = { :git => "https://github.com/SAPConversationalAI/SDK-ios.git", :tag => s.version.to_s } 28 | s.social_media_url = 'https://twitter.com/sapcai' 29 | 30 | s.platform = :ios, '10.0' 31 | s.requires_arc = true 32 | 33 | s.source_files = 'Pod/Classes/**/*' 34 | #s.resource_bundles = { 35 | #'SAPConversationalAI' => ['Pod/Assets/*.png'] 36 | #} 37 | 38 | # s.public_header_files = 'Pod/Classes/**/*.h' 39 | # s.frameworks = 'UIKit', 'MapKit' 40 | s.dependency 'Alamofire' 41 | s.dependency 'ObjectMapper' 42 | end 43 | --------------------------------------------------------------------------------