diff --git a/.travis.yml b/.travis.yml index cc4c8eb99..dd2a61c01 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,4 @@ osx_image: xcode10.1 -before_install: addons: homebrew: packages: @@ -18,132 +17,262 @@ jobs: language: objective-c osx_image: xcode11 before_install: - - brew install carthage || true - - openssl aes-256-cbc -K $encrypted_6b91f4629b52_key -iv $encrypted_6b91f4629b52_iv -in ./Source/SupportingFiles/WatsonCredentials.swift.enc -out ./Source/SupportingFiles/WatsonCredentials.swift -d - - openssl aes-256-cbc -K $encrypted_d84ac0b7eb5c_key -iv $encrypted_d84ac0b7eb5c_iv -in Tests/CompareComplyV1Tests/Resources/cloud-object-storage-credentials-input.json.enc -out Tests/CompareComplyV1Tests/Resources/cloud-object-storage-credentials-input.json -d - - openssl aes-256-cbc -K $encrypted_d84ac0b7eb5c_key -iv $encrypted_d84ac0b7eb5c_iv -in Tests/CompareComplyV1Tests/Resources/cloud-object-storage-credentials-output.json.enc -out Tests/CompareComplyV1Tests/Resources/cloud-object-storage-credentials-output.json -d + - brew install carthage || true + - openssl aes-256-cbc -K $encrypted_6b91f4629b52_key -iv $encrypted_6b91f4629b52_iv + -in ./Source/SupportingFiles/WatsonCredentials.swift.enc -out ./Source/SupportingFiles/WatsonCredentials.swift + -d + - openssl aes-256-cbc -K $encrypted_d84ac0b7eb5c_key -iv $encrypted_d84ac0b7eb5c_iv + -in Tests/CompareComplyV1Tests/Resources/cloud-object-storage-credentials-input.json.enc + -out Tests/CompareComplyV1Tests/Resources/cloud-object-storage-credentials-input.json + -d + - openssl aes-256-cbc -K $encrypted_d84ac0b7eb5c_key -iv $encrypted_d84ac0b7eb5c_iv + -in Tests/CompareComplyV1Tests/Resources/cloud-object-storage-credentials-output.json.enc + -out Tests/CompareComplyV1Tests/Resources/cloud-object-storage-credentials-output.json + -d install: carthage bootstrap --platform iOS --no-use-binaries --cache-builds - script: set -o pipefail && travis_retry xcodebuild -project WatsonDeveloperCloud.xcodeproj -scheme AssistantV1 -destination platform\=iOS\ Simulator,OS\=13.0,name\=iPhone\ 11 build test | xcpretty + script: set -o pipefail && travis_retry xcodebuild -project WatsonDeveloperCloud.xcodeproj + -scheme AssistantV1 -destination platform\=iOS\ Simulator,OS\=13.0,name\=iPhone\ + 11 build test | xcpretty - os: osx language: objective-c osx_image: xcode11 before_install: - - brew install carthage || true - - openssl aes-256-cbc -K $encrypted_6b91f4629b52_key -iv $encrypted_6b91f4629b52_iv -in ./Source/SupportingFiles/WatsonCredentials.swift.enc -out ./Source/SupportingFiles/WatsonCredentials.swift -d - - openssl aes-256-cbc -K $encrypted_d84ac0b7eb5c_key -iv $encrypted_d84ac0b7eb5c_iv -in Tests/CompareComplyV1Tests/Resources/cloud-object-storage-credentials-input.json.enc -out Tests/CompareComplyV1Tests/Resources/cloud-object-storage-credentials-input.json -d - - openssl aes-256-cbc -K $encrypted_d84ac0b7eb5c_key -iv $encrypted_d84ac0b7eb5c_iv -in Tests/CompareComplyV1Tests/Resources/cloud-object-storage-credentials-output.json.enc -out Tests/CompareComplyV1Tests/Resources/cloud-object-storage-credentials-output.json -d + - brew install carthage || true + - openssl aes-256-cbc -K $encrypted_6b91f4629b52_key -iv $encrypted_6b91f4629b52_iv + -in ./Source/SupportingFiles/WatsonCredentials.swift.enc -out ./Source/SupportingFiles/WatsonCredentials.swift + -d + - openssl aes-256-cbc -K $encrypted_d84ac0b7eb5c_key -iv $encrypted_d84ac0b7eb5c_iv + -in Tests/CompareComplyV1Tests/Resources/cloud-object-storage-credentials-input.json.enc + -out Tests/CompareComplyV1Tests/Resources/cloud-object-storage-credentials-input.json + -d + - openssl aes-256-cbc -K $encrypted_d84ac0b7eb5c_key -iv $encrypted_d84ac0b7eb5c_iv + -in Tests/CompareComplyV1Tests/Resources/cloud-object-storage-credentials-output.json.enc + -out Tests/CompareComplyV1Tests/Resources/cloud-object-storage-credentials-output.json + -d install: carthage bootstrap --platform iOS --no-use-binaries --cache-builds - script: set -o pipefail && travis_retry xcodebuild -project WatsonDeveloperCloud.xcodeproj -scheme AssistantV2 -destination platform\=iOS\ Simulator,OS\=13.0,name\=iPhone\ 11 build test | xcpretty + script: set -o pipefail && travis_retry xcodebuild -project WatsonDeveloperCloud.xcodeproj + -scheme AssistantV2 -destination platform\=iOS\ Simulator,OS\=13.0,name\=iPhone\ + 11 build test | xcpretty - os: osx language: objective-c osx_image: xcode11 before_install: - - brew install carthage || true - - openssl aes-256-cbc -K $encrypted_6b91f4629b52_key -iv $encrypted_6b91f4629b52_iv -in ./Source/SupportingFiles/WatsonCredentials.swift.enc -out ./Source/SupportingFiles/WatsonCredentials.swift -d - - openssl aes-256-cbc -K $encrypted_d84ac0b7eb5c_key -iv $encrypted_d84ac0b7eb5c_iv -in Tests/CompareComplyV1Tests/Resources/cloud-object-storage-credentials-input.json.enc -out Tests/CompareComplyV1Tests/Resources/cloud-object-storage-credentials-input.json -d - - openssl aes-256-cbc -K $encrypted_d84ac0b7eb5c_key -iv $encrypted_d84ac0b7eb5c_iv -in Tests/CompareComplyV1Tests/Resources/cloud-object-storage-credentials-output.json.enc -out Tests/CompareComplyV1Tests/Resources/cloud-object-storage-credentials-output.json -d + - brew install carthage || true + - openssl aes-256-cbc -K $encrypted_6b91f4629b52_key -iv $encrypted_6b91f4629b52_iv + -in ./Source/SupportingFiles/WatsonCredentials.swift.enc -out ./Source/SupportingFiles/WatsonCredentials.swift + -d + - openssl aes-256-cbc -K $encrypted_d84ac0b7eb5c_key -iv $encrypted_d84ac0b7eb5c_iv + -in Tests/CompareComplyV1Tests/Resources/cloud-object-storage-credentials-input.json.enc + -out Tests/CompareComplyV1Tests/Resources/cloud-object-storage-credentials-input.json + -d + - openssl aes-256-cbc -K $encrypted_d84ac0b7eb5c_key -iv $encrypted_d84ac0b7eb5c_iv + -in Tests/CompareComplyV1Tests/Resources/cloud-object-storage-credentials-output.json.enc + -out Tests/CompareComplyV1Tests/Resources/cloud-object-storage-credentials-output.json + -d install: carthage bootstrap --platform iOS --no-use-binaries --cache-builds - script: set -o pipefail && travis_retry xcodebuild -project WatsonDeveloperCloud.xcodeproj -scheme CompareComplyV1 -destination platform\=iOS\ Simulator,OS\=13.0,name\=iPhone\ 11 build test | xcpretty + script: set -o pipefail && travis_retry xcodebuild -project WatsonDeveloperCloud.xcodeproj + -scheme CompareComplyV1 -destination platform\=iOS\ Simulator,OS\=13.0,name\=iPhone\ + 11 build test | xcpretty - os: osx language: objective-c osx_image: xcode11 before_install: - - brew install carthage || true - - openssl aes-256-cbc -K $encrypted_6b91f4629b52_key -iv $encrypted_6b91f4629b52_iv -in ./Source/SupportingFiles/WatsonCredentials.swift.enc -out ./Source/SupportingFiles/WatsonCredentials.swift -d - - openssl aes-256-cbc -K $encrypted_d84ac0b7eb5c_key -iv $encrypted_d84ac0b7eb5c_iv -in Tests/CompareComplyV1Tests/Resources/cloud-object-storage-credentials-input.json.enc -out Tests/CompareComplyV1Tests/Resources/cloud-object-storage-credentials-input.json -d - - openssl aes-256-cbc -K $encrypted_d84ac0b7eb5c_key -iv $encrypted_d84ac0b7eb5c_iv -in Tests/CompareComplyV1Tests/Resources/cloud-object-storage-credentials-output.json.enc -out Tests/CompareComplyV1Tests/Resources/cloud-object-storage-credentials-output.json -d + - brew install carthage || true + - openssl aes-256-cbc -K $encrypted_6b91f4629b52_key -iv $encrypted_6b91f4629b52_iv + -in ./Source/SupportingFiles/WatsonCredentials.swift.enc -out ./Source/SupportingFiles/WatsonCredentials.swift + -d + - openssl aes-256-cbc -K $encrypted_d84ac0b7eb5c_key -iv $encrypted_d84ac0b7eb5c_iv + -in Tests/CompareComplyV1Tests/Resources/cloud-object-storage-credentials-input.json.enc + -out Tests/CompareComplyV1Tests/Resources/cloud-object-storage-credentials-input.json + -d + - openssl aes-256-cbc -K $encrypted_d84ac0b7eb5c_key -iv $encrypted_d84ac0b7eb5c_iv + -in Tests/CompareComplyV1Tests/Resources/cloud-object-storage-credentials-output.json.enc + -out Tests/CompareComplyV1Tests/Resources/cloud-object-storage-credentials-output.json + -d install: carthage bootstrap --platform iOS --no-use-binaries --cache-builds - script: set -o pipefail && travis_retry xcodebuild -project WatsonDeveloperCloud.xcodeproj -scheme DiscoveryV1 -destination platform\=iOS\ Simulator,OS\=13.0,name\=iPhone\ 11 build test | xcpretty + script: set -o pipefail && travis_retry xcodebuild -project WatsonDeveloperCloud.xcodeproj + -scheme DiscoveryV1 -destination platform\=iOS\ Simulator,OS\=13.0,name\=iPhone\ + 11 build test | xcpretty - os: osx language: objective-c osx_image: xcode11 before_install: - - brew install carthage || true - - openssl aes-256-cbc -K $encrypted_6b91f4629b52_key -iv $encrypted_6b91f4629b52_iv -in ./Source/SupportingFiles/WatsonCredentials.swift.enc -out ./Source/SupportingFiles/WatsonCredentials.swift -d - - openssl aes-256-cbc -K $encrypted_d84ac0b7eb5c_key -iv $encrypted_d84ac0b7eb5c_iv -in Tests/CompareComplyV1Tests/Resources/cloud-object-storage-credentials-input.json.enc -out Tests/CompareComplyV1Tests/Resources/cloud-object-storage-credentials-input.json -d - - openssl aes-256-cbc -K $encrypted_d84ac0b7eb5c_key -iv $encrypted_d84ac0b7eb5c_iv -in Tests/CompareComplyV1Tests/Resources/cloud-object-storage-credentials-output.json.enc -out Tests/CompareComplyV1Tests/Resources/cloud-object-storage-credentials-output.json -d + - brew install carthage || true + - openssl aes-256-cbc -K $encrypted_6b91f4629b52_key -iv $encrypted_6b91f4629b52_iv + -in ./Source/SupportingFiles/WatsonCredentials.swift.enc -out ./Source/SupportingFiles/WatsonCredentials.swift + -d + - openssl aes-256-cbc -K $encrypted_d84ac0b7eb5c_key -iv $encrypted_d84ac0b7eb5c_iv + -in Tests/CompareComplyV1Tests/Resources/cloud-object-storage-credentials-input.json.enc + -out Tests/CompareComplyV1Tests/Resources/cloud-object-storage-credentials-input.json + -d + - openssl aes-256-cbc -K $encrypted_d84ac0b7eb5c_key -iv $encrypted_d84ac0b7eb5c_iv + -in Tests/CompareComplyV1Tests/Resources/cloud-object-storage-credentials-output.json.enc + -out Tests/CompareComplyV1Tests/Resources/cloud-object-storage-credentials-output.json + -d install: carthage bootstrap --platform iOS --no-use-binaries --cache-builds - script: set -o pipefail && travis_retry xcodebuild -project WatsonDeveloperCloud.xcodeproj -scheme LanguageTranslatorV3 -destination platform\=iOS\ Simulator,OS\=13.0,name\=iPhone\ 11 build test | xcpretty + script: set -o pipefail && travis_retry xcodebuild -project WatsonDeveloperCloud.xcodeproj + -scheme LanguageTranslatorV3 -destination platform\=iOS\ Simulator,OS\=13.0,name\=iPhone\ + 11 build test | xcpretty - os: osx language: objective-c osx_image: xcode11 before_install: - - brew install carthage || true - - openssl aes-256-cbc -K $encrypted_6b91f4629b52_key -iv $encrypted_6b91f4629b52_iv -in ./Source/SupportingFiles/WatsonCredentials.swift.enc -out ./Source/SupportingFiles/WatsonCredentials.swift -d - - openssl aes-256-cbc -K $encrypted_d84ac0b7eb5c_key -iv $encrypted_d84ac0b7eb5c_iv -in Tests/CompareComplyV1Tests/Resources/cloud-object-storage-credentials-input.json.enc -out Tests/CompareComplyV1Tests/Resources/cloud-object-storage-credentials-input.json -d - - openssl aes-256-cbc -K $encrypted_d84ac0b7eb5c_key -iv $encrypted_d84ac0b7eb5c_iv -in Tests/CompareComplyV1Tests/Resources/cloud-object-storage-credentials-output.json.enc -out Tests/CompareComplyV1Tests/Resources/cloud-object-storage-credentials-output.json -d + - brew install carthage || true + - openssl aes-256-cbc -K $encrypted_6b91f4629b52_key -iv $encrypted_6b91f4629b52_iv + -in ./Source/SupportingFiles/WatsonCredentials.swift.enc -out ./Source/SupportingFiles/WatsonCredentials.swift + -d + - openssl aes-256-cbc -K $encrypted_d84ac0b7eb5c_key -iv $encrypted_d84ac0b7eb5c_iv + -in Tests/CompareComplyV1Tests/Resources/cloud-object-storage-credentials-input.json.enc + -out Tests/CompareComplyV1Tests/Resources/cloud-object-storage-credentials-input.json + -d + - openssl aes-256-cbc -K $encrypted_d84ac0b7eb5c_key -iv $encrypted_d84ac0b7eb5c_iv + -in Tests/CompareComplyV1Tests/Resources/cloud-object-storage-credentials-output.json.enc + -out Tests/CompareComplyV1Tests/Resources/cloud-object-storage-credentials-output.json + -d install: carthage bootstrap --platform iOS --no-use-binaries --cache-builds - script: set -o pipefail && travis_retry xcodebuild -project WatsonDeveloperCloud.xcodeproj -scheme NaturalLanguageClassifierV1 -destination platform\=iOS\ Simulator,OS\=13.0,name\=iPhone\ 11 build test | xcpretty + script: set -o pipefail && travis_retry xcodebuild -project WatsonDeveloperCloud.xcodeproj + -scheme NaturalLanguageClassifierV1 -destination platform\=iOS\ Simulator,OS\=13.0,name\=iPhone\ + 11 build test | xcpretty - os: osx language: objective-c osx_image: xcode11 before_install: - - brew install carthage || true - - openssl aes-256-cbc -K $encrypted_6b91f4629b52_key -iv $encrypted_6b91f4629b52_iv -in ./Source/SupportingFiles/WatsonCredentials.swift.enc -out ./Source/SupportingFiles/WatsonCredentials.swift -d - - openssl aes-256-cbc -K $encrypted_d84ac0b7eb5c_key -iv $encrypted_d84ac0b7eb5c_iv -in Tests/CompareComplyV1Tests/Resources/cloud-object-storage-credentials-input.json.enc -out Tests/CompareComplyV1Tests/Resources/cloud-object-storage-credentials-input.json -d - - openssl aes-256-cbc -K $encrypted_d84ac0b7eb5c_key -iv $encrypted_d84ac0b7eb5c_iv -in Tests/CompareComplyV1Tests/Resources/cloud-object-storage-credentials-output.json.enc -out Tests/CompareComplyV1Tests/Resources/cloud-object-storage-credentials-output.json -d + - brew install carthage || true + - openssl aes-256-cbc -K $encrypted_6b91f4629b52_key -iv $encrypted_6b91f4629b52_iv + -in ./Source/SupportingFiles/WatsonCredentials.swift.enc -out ./Source/SupportingFiles/WatsonCredentials.swift + -d + - openssl aes-256-cbc -K $encrypted_d84ac0b7eb5c_key -iv $encrypted_d84ac0b7eb5c_iv + -in Tests/CompareComplyV1Tests/Resources/cloud-object-storage-credentials-input.json.enc + -out Tests/CompareComplyV1Tests/Resources/cloud-object-storage-credentials-input.json + -d + - openssl aes-256-cbc -K $encrypted_d84ac0b7eb5c_key -iv $encrypted_d84ac0b7eb5c_iv + -in Tests/CompareComplyV1Tests/Resources/cloud-object-storage-credentials-output.json.enc + -out Tests/CompareComplyV1Tests/Resources/cloud-object-storage-credentials-output.json + -d install: carthage bootstrap --platform iOS --no-use-binaries --cache-builds - script: set -o pipefail && travis_retry xcodebuild -project WatsonDeveloperCloud.xcodeproj -scheme NaturalLanguageUnderstandingV1 -destination platform\=iOS\ Simulator,OS\=13.0,name\=iPhone\ 11 build test | xcpretty + script: set -o pipefail && travis_retry xcodebuild -project WatsonDeveloperCloud.xcodeproj + -scheme NaturalLanguageUnderstandingV1 -destination platform\=iOS\ Simulator,OS\=13.0,name\=iPhone\ + 11 build test | xcpretty - os: osx language: objective-c osx_image: xcode11 before_install: - - brew install carthage || true - - openssl aes-256-cbc -K $encrypted_6b91f4629b52_key -iv $encrypted_6b91f4629b52_iv -in ./Source/SupportingFiles/WatsonCredentials.swift.enc -out ./Source/SupportingFiles/WatsonCredentials.swift -d - - openssl aes-256-cbc -K $encrypted_d84ac0b7eb5c_key -iv $encrypted_d84ac0b7eb5c_iv -in Tests/CompareComplyV1Tests/Resources/cloud-object-storage-credentials-input.json.enc -out Tests/CompareComplyV1Tests/Resources/cloud-object-storage-credentials-input.json -d - - openssl aes-256-cbc -K $encrypted_d84ac0b7eb5c_key -iv $encrypted_d84ac0b7eb5c_iv -in Tests/CompareComplyV1Tests/Resources/cloud-object-storage-credentials-output.json.enc -out Tests/CompareComplyV1Tests/Resources/cloud-object-storage-credentials-output.json -d + - brew install carthage || true + - openssl aes-256-cbc -K $encrypted_6b91f4629b52_key -iv $encrypted_6b91f4629b52_iv + -in ./Source/SupportingFiles/WatsonCredentials.swift.enc -out ./Source/SupportingFiles/WatsonCredentials.swift + -d + - openssl aes-256-cbc -K $encrypted_d84ac0b7eb5c_key -iv $encrypted_d84ac0b7eb5c_iv + -in Tests/CompareComplyV1Tests/Resources/cloud-object-storage-credentials-input.json.enc + -out Tests/CompareComplyV1Tests/Resources/cloud-object-storage-credentials-input.json + -d + - openssl aes-256-cbc -K $encrypted_d84ac0b7eb5c_key -iv $encrypted_d84ac0b7eb5c_iv + -in Tests/CompareComplyV1Tests/Resources/cloud-object-storage-credentials-output.json.enc + -out Tests/CompareComplyV1Tests/Resources/cloud-object-storage-credentials-output.json + -d install: carthage bootstrap --platform iOS --no-use-binaries --cache-builds - script: set -o pipefail && travis_retry xcodebuild -project WatsonDeveloperCloud.xcodeproj -scheme PersonalityInsightsV3 -destination platform\=iOS\ Simulator,OS\=13.0,name\=iPhone\ 11 build test | xcpretty + script: set -o pipefail && travis_retry xcodebuild -project WatsonDeveloperCloud.xcodeproj + -scheme PersonalityInsightsV3 -destination platform\=iOS\ Simulator,OS\=13.0,name\=iPhone\ + 11 build test | xcpretty - os: osx language: objective-c osx_image: xcode11 before_install: - - brew install carthage || true - - openssl aes-256-cbc -K $encrypted_6b91f4629b52_key -iv $encrypted_6b91f4629b52_iv -in ./Source/SupportingFiles/WatsonCredentials.swift.enc -out ./Source/SupportingFiles/WatsonCredentials.swift -d - - openssl aes-256-cbc -K $encrypted_d84ac0b7eb5c_key -iv $encrypted_d84ac0b7eb5c_iv -in Tests/CompareComplyV1Tests/Resources/cloud-object-storage-credentials-input.json.enc -out Tests/CompareComplyV1Tests/Resources/cloud-object-storage-credentials-input.json -d - - openssl aes-256-cbc -K $encrypted_d84ac0b7eb5c_key -iv $encrypted_d84ac0b7eb5c_iv -in Tests/CompareComplyV1Tests/Resources/cloud-object-storage-credentials-output.json.enc -out Tests/CompareComplyV1Tests/Resources/cloud-object-storage-credentials-output.json -d + - brew install carthage || true + - openssl aes-256-cbc -K $encrypted_6b91f4629b52_key -iv $encrypted_6b91f4629b52_iv + -in ./Source/SupportingFiles/WatsonCredentials.swift.enc -out ./Source/SupportingFiles/WatsonCredentials.swift + -d + - openssl aes-256-cbc -K $encrypted_d84ac0b7eb5c_key -iv $encrypted_d84ac0b7eb5c_iv + -in Tests/CompareComplyV1Tests/Resources/cloud-object-storage-credentials-input.json.enc + -out Tests/CompareComplyV1Tests/Resources/cloud-object-storage-credentials-input.json + -d + - openssl aes-256-cbc -K $encrypted_d84ac0b7eb5c_key -iv $encrypted_d84ac0b7eb5c_iv + -in Tests/CompareComplyV1Tests/Resources/cloud-object-storage-credentials-output.json.enc + -out Tests/CompareComplyV1Tests/Resources/cloud-object-storage-credentials-output.json + -d install: carthage bootstrap --platform iOS --no-use-binaries --cache-builds - script: set -o pipefail && travis_retry xcodebuild -project WatsonDeveloperCloud.xcodeproj -scheme SpeechToTextV1 -destination platform\=iOS\ Simulator,OS\=13.0,name\=iPhone\ 11 build test | xcpretty + script: set -o pipefail && travis_retry xcodebuild -project WatsonDeveloperCloud.xcodeproj + -scheme SpeechToTextV1 -destination platform\=iOS\ Simulator,OS\=13.0,name\=iPhone\ + 11 build test | xcpretty - os: osx language: objective-c osx_image: xcode11 before_install: - - brew install carthage || true - - openssl aes-256-cbc -K $encrypted_6b91f4629b52_key -iv $encrypted_6b91f4629b52_iv -in ./Source/SupportingFiles/WatsonCredentials.swift.enc -out ./Source/SupportingFiles/WatsonCredentials.swift -d - - openssl aes-256-cbc -K $encrypted_d84ac0b7eb5c_key -iv $encrypted_d84ac0b7eb5c_iv -in Tests/CompareComplyV1Tests/Resources/cloud-object-storage-credentials-input.json.enc -out Tests/CompareComplyV1Tests/Resources/cloud-object-storage-credentials-input.json -d - - openssl aes-256-cbc -K $encrypted_d84ac0b7eb5c_key -iv $encrypted_d84ac0b7eb5c_iv -in Tests/CompareComplyV1Tests/Resources/cloud-object-storage-credentials-output.json.enc -out Tests/CompareComplyV1Tests/Resources/cloud-object-storage-credentials-output.json -d + - brew install carthage || true + - openssl aes-256-cbc -K $encrypted_6b91f4629b52_key -iv $encrypted_6b91f4629b52_iv + -in ./Source/SupportingFiles/WatsonCredentials.swift.enc -out ./Source/SupportingFiles/WatsonCredentials.swift + -d + - openssl aes-256-cbc -K $encrypted_d84ac0b7eb5c_key -iv $encrypted_d84ac0b7eb5c_iv + -in Tests/CompareComplyV1Tests/Resources/cloud-object-storage-credentials-input.json.enc + -out Tests/CompareComplyV1Tests/Resources/cloud-object-storage-credentials-input.json + -d + - openssl aes-256-cbc -K $encrypted_d84ac0b7eb5c_key -iv $encrypted_d84ac0b7eb5c_iv + -in Tests/CompareComplyV1Tests/Resources/cloud-object-storage-credentials-output.json.enc + -out Tests/CompareComplyV1Tests/Resources/cloud-object-storage-credentials-output.json + -d install: carthage bootstrap --platform iOS --no-use-binaries --cache-builds - script: set -o pipefail && travis_retry xcodebuild -project WatsonDeveloperCloud.xcodeproj -scheme TextToSpeechV1 -destination platform\=iOS\ Simulator,OS\=13.0,name\=iPhone\ 11 build test | xcpretty + script: set -o pipefail && travis_retry xcodebuild -project WatsonDeveloperCloud.xcodeproj + -scheme TextToSpeechV1 -destination platform\=iOS\ Simulator,OS\=13.0,name\=iPhone\ + 11 build test | xcpretty - os: osx language: objective-c osx_image: xcode11 before_install: - - brew install carthage || true - - openssl aes-256-cbc -K $encrypted_6b91f4629b52_key -iv $encrypted_6b91f4629b52_iv -in ./Source/SupportingFiles/WatsonCredentials.swift.enc -out ./Source/SupportingFiles/WatsonCredentials.swift -d - - openssl aes-256-cbc -K $encrypted_d84ac0b7eb5c_key -iv $encrypted_d84ac0b7eb5c_iv -in Tests/CompareComplyV1Tests/Resources/cloud-object-storage-credentials-input.json.enc -out Tests/CompareComplyV1Tests/Resources/cloud-object-storage-credentials-input.json -d - - openssl aes-256-cbc -K $encrypted_d84ac0b7eb5c_key -iv $encrypted_d84ac0b7eb5c_iv -in Tests/CompareComplyV1Tests/Resources/cloud-object-storage-credentials-output.json.enc -out Tests/CompareComplyV1Tests/Resources/cloud-object-storage-credentials-output.json -d + - brew install carthage || true + - openssl aes-256-cbc -K $encrypted_6b91f4629b52_key -iv $encrypted_6b91f4629b52_iv + -in ./Source/SupportingFiles/WatsonCredentials.swift.enc -out ./Source/SupportingFiles/WatsonCredentials.swift + -d + - openssl aes-256-cbc -K $encrypted_d84ac0b7eb5c_key -iv $encrypted_d84ac0b7eb5c_iv + -in Tests/CompareComplyV1Tests/Resources/cloud-object-storage-credentials-input.json.enc + -out Tests/CompareComplyV1Tests/Resources/cloud-object-storage-credentials-input.json + -d + - openssl aes-256-cbc -K $encrypted_d84ac0b7eb5c_key -iv $encrypted_d84ac0b7eb5c_iv + -in Tests/CompareComplyV1Tests/Resources/cloud-object-storage-credentials-output.json.enc + -out Tests/CompareComplyV1Tests/Resources/cloud-object-storage-credentials-output.json + -d install: carthage bootstrap --platform iOS --no-use-binaries --cache-builds - script: set -o pipefail && travis_retry xcodebuild -project WatsonDeveloperCloud.xcodeproj -scheme ToneAnalyzerV3 -destination platform\=iOS\ Simulator,OS\=13.0,name\=iPhone\ 11 build test | xcpretty + script: set -o pipefail && travis_retry xcodebuild -project WatsonDeveloperCloud.xcodeproj + -scheme ToneAnalyzerV3 -destination platform\=iOS\ Simulator,OS\=13.0,name\=iPhone\ + 11 build test | xcpretty - os: osx language: objective-c osx_image: xcode11 before_install: - - brew install carthage || true - - openssl aes-256-cbc -K $encrypted_6b91f4629b52_key -iv $encrypted_6b91f4629b52_iv -in ./Source/SupportingFiles/WatsonCredentials.swift.enc -out ./Source/SupportingFiles/WatsonCredentials.swift -d - - openssl aes-256-cbc -K $encrypted_d84ac0b7eb5c_key -iv $encrypted_d84ac0b7eb5c_iv -in Tests/CompareComplyV1Tests/Resources/cloud-object-storage-credentials-input.json.enc -out Tests/CompareComplyV1Tests/Resources/cloud-object-storage-credentials-input.json -d - - openssl aes-256-cbc -K $encrypted_d84ac0b7eb5c_key -iv $encrypted_d84ac0b7eb5c_iv -in Tests/CompareComplyV1Tests/Resources/cloud-object-storage-credentials-output.json.enc -out Tests/CompareComplyV1Tests/Resources/cloud-object-storage-credentials-output.json -d + - brew install carthage || true + - openssl aes-256-cbc -K $encrypted_6b91f4629b52_key -iv $encrypted_6b91f4629b52_iv + -in ./Source/SupportingFiles/WatsonCredentials.swift.enc -out ./Source/SupportingFiles/WatsonCredentials.swift + -d + - openssl aes-256-cbc -K $encrypted_d84ac0b7eb5c_key -iv $encrypted_d84ac0b7eb5c_iv + -in Tests/CompareComplyV1Tests/Resources/cloud-object-storage-credentials-input.json.enc + -out Tests/CompareComplyV1Tests/Resources/cloud-object-storage-credentials-input.json + -d + - openssl aes-256-cbc -K $encrypted_d84ac0b7eb5c_key -iv $encrypted_d84ac0b7eb5c_iv + -in Tests/CompareComplyV1Tests/Resources/cloud-object-storage-credentials-output.json.enc + -out Tests/CompareComplyV1Tests/Resources/cloud-object-storage-credentials-output.json + -d install: carthage bootstrap --platform iOS --no-use-binaries --cache-builds - script: set -o pipefail && travis_retry xcodebuild -project WatsonDeveloperCloud.xcodeproj -scheme VisualRecognitionV3 -destination platform\=iOS\ Simulator,OS\=13.0,name\=iPhone\ 11 build test | xcpretty + script: set -o pipefail && travis_retry xcodebuild -project WatsonDeveloperCloud.xcodeproj + -scheme VisualRecognitionV3 -destination platform\=iOS\ Simulator,OS\=13.0,name\=iPhone\ + 11 build test | xcpretty - os: osx language: objective-c osx_image: xcode11 before_install: - - brew install carthage || true - - openssl aes-256-cbc -K $encrypted_6b91f4629b52_key -iv $encrypted_6b91f4629b52_iv -in ./Source/SupportingFiles/WatsonCredentials.swift.enc -out ./Source/SupportingFiles/WatsonCredentials.swift -d - - openssl aes-256-cbc -K $encrypted_d84ac0b7eb5c_key -iv $encrypted_d84ac0b7eb5c_iv -in Tests/CompareComplyV1Tests/Resources/cloud-object-storage-credentials-input.json.enc -out Tests/CompareComplyV1Tests/Resources/cloud-object-storage-credentials-input.json -d - - openssl aes-256-cbc -K $encrypted_d84ac0b7eb5c_key -iv $encrypted_d84ac0b7eb5c_iv -in Tests/CompareComplyV1Tests/Resources/cloud-object-storage-credentials-output.json.enc -out Tests/CompareComplyV1Tests/Resources/cloud-object-storage-credentials-output.json -d + - brew install carthage || true + - openssl aes-256-cbc -K $encrypted_6b91f4629b52_key -iv $encrypted_6b91f4629b52_iv + -in ./Source/SupportingFiles/WatsonCredentials.swift.enc -out ./Source/SupportingFiles/WatsonCredentials.swift + -d + - openssl aes-256-cbc -K $encrypted_d84ac0b7eb5c_key -iv $encrypted_d84ac0b7eb5c_iv + -in Tests/CompareComplyV1Tests/Resources/cloud-object-storage-credentials-input.json.enc + -out Tests/CompareComplyV1Tests/Resources/cloud-object-storage-credentials-input.json + -d + - openssl aes-256-cbc -K $encrypted_d84ac0b7eb5c_key -iv $encrypted_d84ac0b7eb5c_iv + -in Tests/CompareComplyV1Tests/Resources/cloud-object-storage-credentials-output.json.enc + -out Tests/CompareComplyV1Tests/Resources/cloud-object-storage-credentials-output.json + -d install: carthage bootstrap --platform iOS --no-use-binaries --cache-builds - script: set -o pipefail && travis_retry xcodebuild -project WatsonDeveloperCloud.xcodeproj -scheme VisualRecognitionV4 -destination platform\=iOS\ Simulator,OS\=13.0,name\=iPhone\ 11 build test | xcpretty + script: set -o pipefail && travis_retry xcodebuild -project WatsonDeveloperCloud.xcodeproj + -scheme VisualRecognitionV4 -destination platform\=iOS\ Simulator,OS\=13.0,name\=iPhone\ + 11 build test | xcpretty - stage: release new version script: "./Scripts/travis/new-release.sh" os: osx @@ -153,4 +282,4 @@ jobs: script: "./Scripts/travis/deploy-to-cocoapods.sh" os: osx osx_image: xcode11 - if: branch = master AND type = push AND fork = false \ No newline at end of file + if: branch = master AND type = push AND fork = false diff --git a/Source/AssistantV1/Models/DialogNodeOutputGeneric.swift b/Source/AssistantV1/Models/DialogNodeOutputGeneric.swift index 2e8ee6554..42a47402c 100644 --- a/Source/AssistantV1/Models/DialogNodeOutputGeneric.swift +++ b/Source/AssistantV1/Models/DialogNodeOutputGeneric.swift @@ -131,8 +131,8 @@ public struct DialogNodeOutputGeneric: Codable, Equatable { /** The text of the search query. This can be either a natural-language query or a query that uses the Discovery query language syntax, depending on the value of the **query_type** property. For more information, see the [Discovery - service documentation](https://cloud.ibm.com/docs/discovery/query-operators.html#query-operators). Required when - **response_type**=`search_skill`. + service documentation](https://cloud.ibm.com/docs/discovery?topic=discovery-query-operators#query-operators). + Required when **response_type**=`search_skill`. */ public var query: String? @@ -144,7 +144,7 @@ public struct DialogNodeOutputGeneric: Codable, Equatable { /** An optional filter that narrows the set of documents to be searched. For more information, see the [Discovery service documentation]([Discovery service - documentation](https://cloud.ibm.com/docs/discovery/query-parameters.html#filter). + documentation](https://cloud.ibm.com/docs/discovery?topic=discovery-query-parameters#filter). */ public var filter: String? @@ -204,12 +204,12 @@ public struct DialogNodeOutputGeneric: Codable, Equatable { - parameter query: The text of the search query. This can be either a natural-language query or a query that uses the Discovery query language syntax, depending on the value of the **query_type** property. For more information, see the [Discovery service - documentation](https://cloud.ibm.com/docs/discovery/query-operators.html#query-operators). Required when - **response_type**=`search_skill`. + documentation](https://cloud.ibm.com/docs/discovery?topic=discovery-query-operators#query-operators). Required + when **response_type**=`search_skill`. - parameter queryType: The type of the search query. Required when **response_type**=`search_skill`. - parameter filter: An optional filter that narrows the set of documents to be searched. For more information, see the [Discovery service documentation]([Discovery service - documentation](https://cloud.ibm.com/docs/discovery/query-parameters.html#filter). + documentation](https://cloud.ibm.com/docs/discovery?topic=discovery-query-parameters#filter). - parameter discoveryVersion: The version of the Discovery service API to use for the query. - returns: An initialized `DialogNodeOutputGeneric`. diff --git a/Source/AssistantV1/Models/MessageInput.swift b/Source/AssistantV1/Models/MessageInput.swift index 1ec174745..8c5d15e45 100644 --- a/Source/AssistantV1/Models/MessageInput.swift +++ b/Source/AssistantV1/Models/MessageInput.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2017, 2019. + * (C) Copyright IBM Corp. 2017, 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,13 +27,44 @@ public struct MessageInput: Codable, Equatable { */ public var text: String? + /** + Whether to use spelling correction when processing the input. This property overrides the value of the + **spelling_suggestions** property in the workspace settings. + */ + public var spellingSuggestions: Bool? + + /** + Whether to use autocorrection when processing the input. If spelling correction is used and this property is + `false`, any suggested corrections are returned in the **suggested_text** property of the message response. If this + property is `true`, any corrections are automatically applied to the user input, and the original text is returned + in the **original_text** property of the message response. This property overrides the value of the + **spelling_auto_correct** property in the workspace settings. + */ + public var spellingAutoCorrect: Bool? + + /** + Any suggested corrections of the input text. This property is returned only if spelling correction is enabled and + autocorrection is disabled. + */ + public var suggestedText: String? + + /** + The original user input text. This property is returned only if autocorrection is enabled and the user input was + corrected. + */ + public var originalText: String? + /// Additional properties associated with this model. public var additionalProperties: [String: JSON] // Map each property name to the key that shall be used for encoding/decoding. private enum CodingKeys: String, CodingKey { case text = "text" - static let allValues = [text] + case spellingSuggestions = "spelling_suggestions" + case spellingAutoCorrect = "spelling_auto_correct" + case suggestedText = "suggested_text" + case originalText = "original_text" + static let allValues = [text, spellingSuggestions, spellingAutoCorrect, suggestedText, originalText] } /** @@ -41,21 +72,44 @@ public struct MessageInput: Codable, Equatable { - parameter text: The text of the user input. This string cannot contain carriage return, newline, or tab characters. + - parameter spellingSuggestions: Whether to use spelling correction when processing the input. This property + overrides the value of the **spelling_suggestions** property in the workspace settings. + - parameter spellingAutoCorrect: Whether to use autocorrection when processing the input. If spelling correction + is used and this property is `false`, any suggested corrections are returned in the **suggested_text** property + of the message response. If this property is `true`, any corrections are automatically applied to the user input, + and the original text is returned in the **original_text** property of the message response. This property + overrides the value of the **spelling_auto_correct** property in the workspace settings. + - parameter suggestedText: Any suggested corrections of the input text. This property is returned only if + spelling correction is enabled and autocorrection is disabled. + - parameter originalText: The original user input text. This property is returned only if autocorrection is + enabled and the user input was corrected. - returns: An initialized `MessageInput`. */ public init( text: String? = nil, + spellingSuggestions: Bool? = nil, + spellingAutoCorrect: Bool? = nil, + suggestedText: String? = nil, + originalText: String? = nil, additionalProperties: [String: JSON] = [:] ) { self.text = text + self.spellingSuggestions = spellingSuggestions + self.spellingAutoCorrect = spellingAutoCorrect + self.suggestedText = suggestedText + self.originalText = originalText self.additionalProperties = additionalProperties } public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) text = try container.decodeIfPresent(String.self, forKey: .text) + spellingSuggestions = try container.decodeIfPresent(Bool.self, forKey: .spellingSuggestions) + spellingAutoCorrect = try container.decodeIfPresent(Bool.self, forKey: .spellingAutoCorrect) + suggestedText = try container.decodeIfPresent(String.self, forKey: .suggestedText) + originalText = try container.decodeIfPresent(String.self, forKey: .originalText) let dynamicContainer = try decoder.container(keyedBy: DynamicKeys.self) additionalProperties = try dynamicContainer.decode([String: JSON].self, excluding: CodingKeys.allValues) } @@ -63,6 +117,10 @@ public struct MessageInput: Codable, Equatable { public func encode(to encoder: Encoder) throws { var container = encoder.container(keyedBy: CodingKeys.self) try container.encodeIfPresent(text, forKey: .text) + try container.encodeIfPresent(spellingSuggestions, forKey: .spellingSuggestions) + try container.encodeIfPresent(spellingAutoCorrect, forKey: .spellingAutoCorrect) + try container.encodeIfPresent(suggestedText, forKey: .suggestedText) + try container.encodeIfPresent(originalText, forKey: .originalText) var dynamicContainer = encoder.container(keyedBy: DynamicKeys.self) try dynamicContainer.encodeIfPresent(additionalProperties) } diff --git a/Source/AssistantV1/Models/WorkspaceSystemSettings.swift b/Source/AssistantV1/Models/WorkspaceSystemSettings.swift index 0ad624045..962b7287f 100644 --- a/Source/AssistantV1/Models/WorkspaceSystemSettings.swift +++ b/Source/AssistantV1/Models/WorkspaceSystemSettings.swift @@ -38,6 +38,19 @@ public struct WorkspaceSystemSettings: Codable, Equatable { */ public var humanAgentAssist: [String: JSON]? + /** + Whether spelling correction is enabled for the workspace. + */ + public var spellingSuggestions: Bool? + + /** + Whether autocorrection is enabled for the workspace. If spelling correction is enabled and this property is + `false`, any suggested corrections are returned in the **suggested_text** property of the message response. If this + property is `true`, any corrections are automatically applied to the user input, and the original text is returned + in the **original_text** property of the message response. + */ + public var spellingAutoCorrect: Bool? + /** Workspace settings related to the behavior of system entities. */ @@ -53,6 +66,8 @@ public struct WorkspaceSystemSettings: Codable, Equatable { case tooling = "tooling" case disambiguation = "disambiguation" case humanAgentAssist = "human_agent_assist" + case spellingSuggestions = "spelling_suggestions" + case spellingAutoCorrect = "spelling_auto_correct" case systemEntities = "system_entities" case offTopic = "off_topic" } @@ -64,6 +79,11 @@ public struct WorkspaceSystemSettings: Codable, Equatable { - parameter disambiguation: Workspace settings related to the disambiguation feature. **Note:** This feature is available only to Plus and Premium users. - parameter humanAgentAssist: For internal use only. + - parameter spellingSuggestions: Whether spelling correction is enabled for the workspace. + - parameter spellingAutoCorrect: Whether autocorrection is enabled for the workspace. If spelling correction is + enabled and this property is `false`, any suggested corrections are returned in the **suggested_text** property + of the message response. If this property is `true`, any corrections are automatically applied to the user input, + and the original text is returned in the **original_text** property of the message response. - parameter systemEntities: Workspace settings related to the behavior of system entities. - parameter offTopic: Workspace settings related to detection of irrelevant input. @@ -73,6 +93,8 @@ public struct WorkspaceSystemSettings: Codable, Equatable { tooling: WorkspaceSystemSettingsTooling? = nil, disambiguation: WorkspaceSystemSettingsDisambiguation? = nil, humanAgentAssist: [String: JSON]? = nil, + spellingSuggestions: Bool? = nil, + spellingAutoCorrect: Bool? = nil, systemEntities: WorkspaceSystemSettingsSystemEntities? = nil, offTopic: WorkspaceSystemSettingsOffTopic? = nil ) @@ -80,6 +102,8 @@ public struct WorkspaceSystemSettings: Codable, Equatable { self.tooling = tooling self.disambiguation = disambiguation self.humanAgentAssist = humanAgentAssist + self.spellingSuggestions = spellingSuggestions + self.spellingAutoCorrect = spellingAutoCorrect self.systemEntities = systemEntities self.offTopic = offTopic } diff --git a/Source/AssistantV2/Assistant.swift b/Source/AssistantV2/Assistant.swift index 332afd12b..120a1f778 100644 --- a/Source/AssistantV2/Assistant.swift +++ b/Source/AssistantV2/Assistant.swift @@ -249,9 +249,10 @@ public class Assistant { } /** - Send user input to assistant. + Send user input to assistant (stateful). - Send user input to an assistant and receive a response. + Send user input to an assistant and receive a response, with conversation state (including context data) stored by + Watson Assistant for the duration of the session. There is no rate limit for this operation. - parameter assistantID: Unique identifier of the assistant. To find the assistant ID in the Watson Assistant @@ -260,9 +261,10 @@ public class Assistant { **Note:** Currently, the v2 API does not support creating assistants. - parameter sessionID: Unique identifier of the session. - parameter input: An input object that includes the input text. - - parameter context: State information for the conversation. The context is stored by the assistant on a - per-session basis. You can use this property to set or modify context variables, which can also be accessed by - dialog nodes. + - parameter context: Context data for the conversation. You can use this property to set or modify context + variables, which can also be accessed by dialog nodes. The context is stored by the assistant on a per-session + basis. + **Note:** The total size of the context data stored for a stateful session cannot exceed 100KB. - parameter headers: A dictionary of request headers to be sent with this request. - parameter completionHandler: A function executed when the request completes with a successful result or error */ @@ -325,4 +327,81 @@ public class Assistant { request.responseObject(completionHandler: completionHandler) } + /** + Send user input to assistant (stateless). + + Send user input to an assistant and receive a response, with conversation state (including context data) managed by + your application. + There is no rate limit for this operation. + + - parameter assistantID: Unique identifier of the assistant. To find the assistant ID in the Watson Assistant + user interface, open the assistant settings and click **API Details**. For information about creating assistants, + see the [documentation](https://cloud.ibm.com/docs/assistant?topic=assistant-assistant-add#assistant-add-task). + **Note:** Currently, the v2 API does not support creating assistants. + - parameter input: An input object that includes the input text. + - parameter context: Context data for the conversation. You can use this property to set or modify context + variables, which can also be accessed by dialog nodes. The context is not stored by the assistant. To maintain + session state, include the context from the previous response. + **Note:** The total size of the context data for a stateless session cannot exceed 250KB. + - parameter headers: A dictionary of request headers to be sent with this request. + - parameter completionHandler: A function executed when the request completes with a successful result or error + */ + public func messageStateless( + assistantID: String, + input: MessageInputStateless? = nil, + context: MessageContextStateless? = nil, + headers: [String: String]? = nil, + completionHandler: @escaping (WatsonResponse?, WatsonError?) -> Void) + { + // construct body + let messageStatelessRequest = MessageRequestStateless( + input: input, + context: context) + guard let body = try? JSON.encoder.encodeIfPresent(messageStatelessRequest) else { + completionHandler(nil, WatsonError.serialization(values: "request body")) + return + } + + // construct header parameters + var headerParameters = defaultHeaders + if let headers = headers { + headerParameters.merge(headers) { (_, new) in new } + } + let sdkHeaders = Shared.getSDKHeaders(serviceName: serviceName, serviceVersion: serviceVersion, methodName: "messageStateless") + headerParameters.merge(sdkHeaders) { (_, new) in new } + headerParameters["Accept"] = "application/json" + headerParameters["Content-Type"] = "application/json" + + // construct query parameters + var queryParameters = [URLQueryItem]() + queryParameters.append(URLQueryItem(name: "version", value: version)) + + // construct REST request + let path = "/v2/assistants/\(assistantID)/message" + guard let encodedPath = path.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) else { + completionHandler(nil, WatsonError.urlEncoding(path: path)) + return + } + + // ensure that serviceURL is set + guard let serviceEndpoint = serviceURL else { + completionHandler(nil, WatsonError.noEndpoint) + return + } + + let request = RestRequest( + session: session, + authenticator: authenticator, + errorResponseDecoder: errorResponseDecoder, + method: "POST", + url: serviceEndpoint + encodedPath, + headerParameters: headerParameters, + queryItems: queryParameters, + messageBody: body + ) + + // execute REST request + request.responseObject(completionHandler: completionHandler) + } + } diff --git a/Source/AssistantV2/Models/MessageContext.swift b/Source/AssistantV2/Models/MessageContext.swift index e187735c6..f592c4fcc 100644 --- a/Source/AssistantV2/Models/MessageContext.swift +++ b/Source/AssistantV2/Models/MessageContext.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2018, 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,14 +20,14 @@ import Foundation public struct MessageContext: Codable, Equatable { /** - Information that is shared by all skills used by the Assistant. + Session context data that is shared by all skills used by the Assistant. */ public var global: MessageContextGlobal? /** - Information specific to particular skills used by the Assistant. - **Note:** Currently, only a single property named `main skill` is supported. This object contains variables that - apply to the dialog skill used by the assistant. + Information specific to particular skills used by the assistant. + **Note:** Currently, only a single child property is supported, containing variables that apply to the dialog skill + used by the assistant. */ public var skills: MessageContextSkills? @@ -40,10 +40,10 @@ public struct MessageContext: Codable, Equatable { /** Initialize a `MessageContext` with member variables. - - parameter global: Information that is shared by all skills used by the Assistant. - - parameter skills: Information specific to particular skills used by the Assistant. - **Note:** Currently, only a single property named `main skill` is supported. This object contains variables that - apply to the dialog skill used by the assistant. + - parameter global: Session context data that is shared by all skills used by the Assistant. + - parameter skills: Information specific to particular skills used by the assistant. + **Note:** Currently, only a single child property is supported, containing variables that apply to the dialog + skill used by the assistant. - returns: An initialized `MessageContext`. */ diff --git a/Source/AssistantV2/Models/MessageContextGlobal.swift b/Source/AssistantV2/Models/MessageContextGlobal.swift index 27f0a2782..d5fe41c40 100644 --- a/Source/AssistantV2/Models/MessageContextGlobal.swift +++ b/Source/AssistantV2/Models/MessageContextGlobal.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2018, 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,7 +17,7 @@ import Foundation /** - Information that is shared by all skills used by the Assistant. + Session context data that is shared by all skills used by the Assistant. */ public struct MessageContextGlobal: Codable, Equatable { @@ -26,23 +26,32 @@ public struct MessageContextGlobal: Codable, Equatable { */ public var system: MessageContextGlobalSystem? + /** + The session ID. + */ + public var sessionID: String? + // Map each property name to the key that shall be used for encoding/decoding. private enum CodingKeys: String, CodingKey { case system = "system" + case sessionID = "session_id" } /** Initialize a `MessageContextGlobal` with member variables. - parameter system: Built-in system properties that apply to all skills used by the assistant. + - parameter sessionID: The session ID. - returns: An initialized `MessageContextGlobal`. */ public init( - system: MessageContextGlobalSystem? = nil + system: MessageContextGlobalSystem? = nil, + sessionID: String? = nil ) { self.system = system + self.sessionID = sessionID } } diff --git a/Source/AssistantV2/Models/MessageContextGlobalStateless.swift b/Source/AssistantV2/Models/MessageContextGlobalStateless.swift new file mode 100644 index 000000000..82ca3084d --- /dev/null +++ b/Source/AssistantV2/Models/MessageContextGlobalStateless.swift @@ -0,0 +1,57 @@ +/** + * (C) Copyright IBM Corp. 2020. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + **/ + +import Foundation + +/** + Session context data that is shared by all skills used by the Assistant. + */ +public struct MessageContextGlobalStateless: Codable, Equatable { + + /** + Built-in system properties that apply to all skills used by the assistant. + */ + public var system: MessageContextGlobalSystem? + + /** + The unique identifier of the session. + */ + public var sessionID: String? + + // Map each property name to the key that shall be used for encoding/decoding. + private enum CodingKeys: String, CodingKey { + case system = "system" + case sessionID = "session_id" + } + + /** + Initialize a `MessageContextGlobalStateless` with member variables. + + - parameter system: Built-in system properties that apply to all skills used by the assistant. + - parameter sessionID: The unique identifier of the session. + + - returns: An initialized `MessageContextGlobalStateless`. + */ + public init( + system: MessageContextGlobalSystem? = nil, + sessionID: String? = nil + ) + { + self.system = system + self.sessionID = sessionID + } + +} diff --git a/Source/AssistantV2/Models/MessageContextSkill.swift b/Source/AssistantV2/Models/MessageContextSkill.swift index 023f8a7d0..d1fcb75c5 100644 --- a/Source/AssistantV2/Models/MessageContextSkill.swift +++ b/Source/AssistantV2/Models/MessageContextSkill.swift @@ -18,7 +18,8 @@ import Foundation import IBMSwiftSDKCore /** - Contains information specific to a particular skill used by the Assistant. + Contains information specific to a particular skill used by the Assistant. The property name must be the same as the + name of the skill (for example, `main skill`). */ public struct MessageContextSkill: Codable, Equatable { diff --git a/Source/AssistantV2/Models/MessageContextSkillSystem.swift b/Source/AssistantV2/Models/MessageContextSkillSystem.swift new file mode 100644 index 000000000..d6fd8201e --- /dev/null +++ b/Source/AssistantV2/Models/MessageContextSkillSystem.swift @@ -0,0 +1,75 @@ +/** + * (C) Copyright IBM Corp. 2020. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + **/ + +import Foundation +import IBMSwiftSDKCore + +/** + System context data used by the skill. + */ +public struct MessageContextSkillSystem: Codable, Equatable { + + /** + An encoded string representing the current conversation state. By saving this value and then sending it in the + context of a subsequent message request, you can restore the conversation to the same state. This can be useful if + you need to return to an earlier point in the conversation. If you are using stateful sessions, you can also use a + stored state value to restore a paused conversation whose session has expired. + */ + public var state: String? + + /// Additional properties associated with this model. + public var additionalProperties: [String: JSON] + + // Map each property name to the key that shall be used for encoding/decoding. + private enum CodingKeys: String, CodingKey { + case state = "state" + static let allValues = [state] + } + + /** + Initialize a `MessageContextSkillSystem` with member variables. + + - parameter state: An encoded string representing the current conversation state. By saving this value and then + sending it in the context of a subsequent message request, you can restore the conversation to the same state. + This can be useful if you need to return to an earlier point in the conversation. If you are using stateful + sessions, you can also use a stored state value to restore a paused conversation whose session has expired. + + - returns: An initialized `MessageContextSkillSystem`. + */ + public init( + state: String? = nil, + additionalProperties: [String: JSON] = [:] + ) + { + self.state = state + self.additionalProperties = additionalProperties + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + state = try container.decodeIfPresent(String.self, forKey: .state) + let dynamicContainer = try decoder.container(keyedBy: DynamicKeys.self) + additionalProperties = try dynamicContainer.decode([String: JSON].self, excluding: CodingKeys.allValues) + } + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encodeIfPresent(state, forKey: .state) + var dynamicContainer = encoder.container(keyedBy: DynamicKeys.self) + try dynamicContainer.encodeIfPresent(additionalProperties) + } + +} diff --git a/Source/AssistantV2/Models/MessageContextSkills.swift b/Source/AssistantV2/Models/MessageContextSkills.swift index 3edc04e7d..fb71fd309 100644 --- a/Source/AssistantV2/Models/MessageContextSkills.swift +++ b/Source/AssistantV2/Models/MessageContextSkills.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2018, 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,9 +18,9 @@ import Foundation import IBMSwiftSDKCore /** - Information specific to particular skills used by the Assistant. - **Note:** Currently, only a single property named `main skill` is supported. This object contains variables that apply - to the dialog skill used by the assistant. + Information specific to particular skills used by the assistant. + **Note:** Currently, only a single child property is supported, containing variables that apply to the dialog skill + used by the assistant. */ public struct MessageContextSkills: Codable, Equatable { diff --git a/Source/AssistantV2/Models/MessageContextStateless.swift b/Source/AssistantV2/Models/MessageContextStateless.swift new file mode 100644 index 000000000..bf7a458c0 --- /dev/null +++ b/Source/AssistantV2/Models/MessageContextStateless.swift @@ -0,0 +1,59 @@ +/** + * (C) Copyright IBM Corp. 2020. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + **/ + +import Foundation + +/** MessageContextStateless. */ +public struct MessageContextStateless: Codable, Equatable { + + /** + Session context data that is shared by all skills used by the Assistant. + */ + public var global: MessageContextGlobalStateless? + + /** + Information specific to particular skills used by the assistant. + **Note:** Currently, only a single child property is supported, containing variables that apply to the dialog skill + used by the assistant. + */ + public var skills: MessageContextSkills? + + // Map each property name to the key that shall be used for encoding/decoding. + private enum CodingKeys: String, CodingKey { + case global = "global" + case skills = "skills" + } + + /** + Initialize a `MessageContextStateless` with member variables. + + - parameter global: Session context data that is shared by all skills used by the Assistant. + - parameter skills: Information specific to particular skills used by the assistant. + **Note:** Currently, only a single child property is supported, containing variables that apply to the dialog + skill used by the assistant. + + - returns: An initialized `MessageContextStateless`. + */ + public init( + global: MessageContextGlobalStateless? = nil, + skills: MessageContextSkills? = nil + ) + { + self.global = global + self.skills = skills + } + +} diff --git a/Source/AssistantV2/Models/MessageInput.swift b/Source/AssistantV2/Models/MessageInput.swift index 7a5324f7c..c76ac506c 100644 --- a/Source/AssistantV2/Models/MessageInput.swift +++ b/Source/AssistantV2/Models/MessageInput.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2018, 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -38,11 +38,6 @@ public struct MessageInput: Codable, Equatable { */ public var text: String? - /** - Optional properties that control how the assistant responds. - */ - public var options: MessageInputOptions? - /** Intents to use when evaluating the user input. Include intents from the previous response to continue using those intents rather than trying to recognize intents in the new input. @@ -60,14 +55,19 @@ public struct MessageInput: Codable, Equatable { */ public var suggestionID: String? + /** + Optional properties that control how the assistant responds. + */ + public var options: MessageInputOptions? + // Map each property name to the key that shall be used for encoding/decoding. private enum CodingKeys: String, CodingKey { case messageType = "message_type" case text = "text" - case options = "options" case intents = "intents" case entities = "entities" case suggestionID = "suggestion_id" + case options = "options" } /** @@ -76,30 +76,30 @@ public struct MessageInput: Codable, Equatable { - parameter messageType: The type of user input. Currently, only text input is supported. - parameter text: The text of the user input. This string cannot contain carriage return, newline, or tab characters. - - parameter options: Optional properties that control how the assistant responds. - parameter intents: Intents to use when evaluating the user input. Include intents from the previous response to continue using those intents rather than trying to recognize intents in the new input. - parameter entities: Entities to use when evaluating the message. Include entities from the previous response to continue using those entities rather than detecting entities in the new input. - parameter suggestionID: For internal use only. + - parameter options: Optional properties that control how the assistant responds. - returns: An initialized `MessageInput`. */ public init( messageType: String? = nil, text: String? = nil, - options: MessageInputOptions? = nil, intents: [RuntimeIntent]? = nil, entities: [RuntimeEntity]? = nil, - suggestionID: String? = nil + suggestionID: String? = nil, + options: MessageInputOptions? = nil ) { self.messageType = messageType self.text = text - self.options = options self.intents = intents self.entities = entities self.suggestionID = suggestionID + self.options = options } } diff --git a/Source/AssistantV2/Models/MessageInputOptions.swift b/Source/AssistantV2/Models/MessageInputOptions.swift index a2e61d07d..5f5c85c15 100644 --- a/Source/AssistantV2/Models/MessageInputOptions.swift +++ b/Source/AssistantV2/Models/MessageInputOptions.swift @@ -21,13 +21,6 @@ import Foundation */ public struct MessageInputOptions: Codable, Equatable { - /** - Whether to return additional diagnostic information. Set to `true` to return additional information in the - `output.debug` property. If you also specify **return_context**=`true`, the returned skill context includes the - `system.state` property. - */ - public var debug: Bool? - /** Whether to restart dialog processing at the root of the dialog, regardless of any previously visited nodes. **Note:** This does not affect `turn_count` or any other context variables. @@ -39,6 +32,19 @@ public struct MessageInputOptions: Codable, Equatable { */ public var alternateIntents: Bool? + /** + Spelling correction options for the message. Any options specified on an individual message override the settings + configured for the skill. + */ + public var spelling: MessageInputOptionsSpelling? + + /** + Whether to return additional diagnostic information. Set to `true` to return additional information in the + `output.debug` property. If you also specify **return_context**=`true`, the returned skill context includes the + `system.state` property. + */ + public var debug: Bool? + /** Whether to return session context with the response. If you specify `true`, the response includes the `context` property. If you also specify **debug**=`true`, the returned skill context includes the `system.state` property. @@ -54,9 +60,10 @@ public struct MessageInputOptions: Codable, Equatable { // Map each property name to the key that shall be used for encoding/decoding. private enum CodingKeys: String, CodingKey { - case debug = "debug" case restart = "restart" case alternateIntents = "alternate_intents" + case spelling = "spelling" + case debug = "debug" case returnContext = "return_context" case export = "export" } @@ -64,13 +71,15 @@ public struct MessageInputOptions: Codable, Equatable { /** Initialize a `MessageInputOptions` with member variables. - - parameter debug: Whether to return additional diagnostic information. Set to `true` to return additional - information in the `output.debug` property. If you also specify **return_context**=`true`, the returned skill - context includes the `system.state` property. - parameter restart: Whether to restart dialog processing at the root of the dialog, regardless of any previously visited nodes. **Note:** This does not affect `turn_count` or any other context variables. - parameter alternateIntents: Whether to return more than one intent. Set to `true` to return all matching intents. + - parameter spelling: Spelling correction options for the message. Any options specified on an individual + message override the settings configured for the skill. + - parameter debug: Whether to return additional diagnostic information. Set to `true` to return additional + information in the `output.debug` property. If you also specify **return_context**=`true`, the returned skill + context includes the `system.state` property. - parameter returnContext: Whether to return session context with the response. If you specify `true`, the response includes the `context` property. If you also specify **debug**=`true`, the returned skill context includes the `system.state` property. @@ -85,12 +94,14 @@ public struct MessageInputOptions: Codable, Equatable { restart: Bool? = nil, alternateIntents: Bool? = nil, returnContext: Bool? = nil, - export: Bool? = nil + export: Bool? = nil, + spelling: MessageInputOptionsSpelling? = nil ) { - self.debug = debug self.restart = restart self.alternateIntents = alternateIntents + self.spelling = spelling + self.debug = debug self.returnContext = returnContext self.export = export } diff --git a/Source/AssistantV2/Models/MessageInputOptionsSpelling.swift b/Source/AssistantV2/Models/MessageInputOptionsSpelling.swift new file mode 100644 index 000000000..4a2d0f5ca --- /dev/null +++ b/Source/AssistantV2/Models/MessageInputOptionsSpelling.swift @@ -0,0 +1,71 @@ +/** + * (C) Copyright IBM Corp. 2020. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + **/ + +import Foundation + +/** + Spelling correction options for the message. Any options specified on an individual message override the settings + configured for the skill. + */ +public struct MessageInputOptionsSpelling: Codable, Equatable { + + /** + Whether to use spelling correction when processing the input. If spelling correction is used and **auto_correct** + is `true`, any spelling corrections are automatically applied to the user input. If **auto_correct** is `false`, + any suggested corrections are returned in the **output.spelling** property. + This property overrides the value of the **spelling_suggestions** property in the workspace settings for the skill. + */ + public var suggestions: Bool? + + /** + Whether to use autocorrection when processing the input. If this property is `true`, any corrections are + automatically applied to the user input, and the original text is returned in the **output.spelling** property of + the message response. This property overrides the value of the **spelling_auto_correct** property in the workspace + settings for the skill. + */ + public var autoCorrect: Bool? + + // Map each property name to the key that shall be used for encoding/decoding. + private enum CodingKeys: String, CodingKey { + case suggestions = "suggestions" + case autoCorrect = "auto_correct" + } + + /** + Initialize a `MessageInputOptionsSpelling` with member variables. + + - parameter suggestions: Whether to use spelling correction when processing the input. If spelling correction is + used and **auto_correct** is `true`, any spelling corrections are automatically applied to the user input. If + **auto_correct** is `false`, any suggested corrections are returned in the **output.spelling** property. + This property overrides the value of the **spelling_suggestions** property in the workspace settings for the + skill. + - parameter autoCorrect: Whether to use autocorrection when processing the input. If this property is `true`, + any corrections are automatically applied to the user input, and the original text is returned in the + **output.spelling** property of the message response. This property overrides the value of the + **spelling_auto_correct** property in the workspace settings for the skill. + + - returns: An initialized `MessageInputOptionsSpelling`. + */ + public init( + suggestions: Bool? = nil, + autoCorrect: Bool? = nil + ) + { + self.suggestions = suggestions + self.autoCorrect = autoCorrect + } + +} diff --git a/Source/AssistantV2/Models/MessageInputOptionsStateless.swift b/Source/AssistantV2/Models/MessageInputOptionsStateless.swift new file mode 100644 index 000000000..53b15200f --- /dev/null +++ b/Source/AssistantV2/Models/MessageInputOptionsStateless.swift @@ -0,0 +1,82 @@ +/** + * (C) Copyright IBM Corp. 2020. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + **/ + +import Foundation + +/** + Optional properties that control how the assistant responds. + */ +public struct MessageInputOptionsStateless: Codable, Equatable { + + /** + Whether to restart dialog processing at the root of the dialog, regardless of any previously visited nodes. + **Note:** This does not affect `turn_count` or any other context variables. + */ + public var restart: Bool? + + /** + Whether to return more than one intent. Set to `true` to return all matching intents. + */ + public var alternateIntents: Bool? + + /** + Spelling correction options for the message. Any options specified on an individual message override the settings + configured for the skill. + */ + public var spelling: MessageInputOptionsSpelling? + + /** + Whether to return additional diagnostic information. Set to `true` to return additional information in the + `output.debug` property. + */ + public var debug: Bool? + + // Map each property name to the key that shall be used for encoding/decoding. + private enum CodingKeys: String, CodingKey { + case restart = "restart" + case alternateIntents = "alternate_intents" + case spelling = "spelling" + case debug = "debug" + } + + /** + Initialize a `MessageInputOptionsStateless` with member variables. + + - parameter restart: Whether to restart dialog processing at the root of the dialog, regardless of any + previously visited nodes. **Note:** This does not affect `turn_count` or any other context variables. + - parameter alternateIntents: Whether to return more than one intent. Set to `true` to return all matching + intents. + - parameter spelling: Spelling correction options for the message. Any options specified on an individual + message override the settings configured for the skill. + - parameter debug: Whether to return additional diagnostic information. Set to `true` to return additional + information in the `output.debug` property. + + - returns: An initialized `MessageInputOptionsStateless`. + */ + public init( + restart: Bool? = nil, + alternateIntents: Bool? = nil, + spelling: MessageInputOptionsSpelling? = nil, + debug: Bool? = nil + ) + { + self.restart = restart + self.alternateIntents = alternateIntents + self.spelling = spelling + self.debug = debug + } + +} diff --git a/Source/AssistantV2/Models/MessageInputStateless.swift b/Source/AssistantV2/Models/MessageInputStateless.swift new file mode 100644 index 000000000..4fc0e8df4 --- /dev/null +++ b/Source/AssistantV2/Models/MessageInputStateless.swift @@ -0,0 +1,105 @@ +/** + * (C) Copyright IBM Corp. 2020. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + **/ + +import Foundation + +/** + An input object that includes the input text. + */ +public struct MessageInputStateless: Codable, Equatable { + + /** + The type of user input. Currently, only text input is supported. + */ + public enum MessageType: String { + case text = "text" + } + + /** + The type of user input. Currently, only text input is supported. + */ + public var messageType: String? + + /** + The text of the user input. This string cannot contain carriage return, newline, or tab characters. + */ + public var text: String? + + /** + Intents to use when evaluating the user input. Include intents from the previous response to continue using those + intents rather than trying to recognize intents in the new input. + */ + public var intents: [RuntimeIntent]? + + /** + Entities to use when evaluating the message. Include entities from the previous response to continue using those + entities rather than detecting entities in the new input. + */ + public var entities: [RuntimeEntity]? + + /** + For internal use only. + */ + public var suggestionID: String? + + /** + Optional properties that control how the assistant responds. + */ + public var options: MessageInputOptionsStateless? + + // Map each property name to the key that shall be used for encoding/decoding. + private enum CodingKeys: String, CodingKey { + case messageType = "message_type" + case text = "text" + case intents = "intents" + case entities = "entities" + case suggestionID = "suggestion_id" + case options = "options" + } + + /** + Initialize a `MessageInputStateless` with member variables. + + - parameter messageType: The type of user input. Currently, only text input is supported. + - parameter text: The text of the user input. This string cannot contain carriage return, newline, or tab + characters. + - parameter intents: Intents to use when evaluating the user input. Include intents from the previous response + to continue using those intents rather than trying to recognize intents in the new input. + - parameter entities: Entities to use when evaluating the message. Include entities from the previous response + to continue using those entities rather than detecting entities in the new input. + - parameter suggestionID: For internal use only. + - parameter options: Optional properties that control how the assistant responds. + + - returns: An initialized `MessageInputStateless`. + */ + public init( + messageType: String? = nil, + text: String? = nil, + intents: [RuntimeIntent]? = nil, + entities: [RuntimeEntity]? = nil, + suggestionID: String? = nil, + options: MessageInputOptionsStateless? = nil + ) + { + self.messageType = messageType + self.text = text + self.intents = intents + self.entities = entities + self.suggestionID = suggestionID + self.options = options + } + +} diff --git a/Source/AssistantV2/Models/MessageOutput.swift b/Source/AssistantV2/Models/MessageOutput.swift index 1b954ed9f..41a14bb75 100644 --- a/Source/AssistantV2/Models/MessageOutput.swift +++ b/Source/AssistantV2/Models/MessageOutput.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2018, 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -54,6 +54,11 @@ public struct MessageOutput: Codable, Equatable { */ public var userDefined: [String: JSON]? + /** + Properties describing any spelling corrections in the user input that was received. + */ + public var spelling: MessageOutputSpelling? + // Map each property name to the key that shall be used for encoding/decoding. private enum CodingKeys: String, CodingKey { case generic = "generic" @@ -62,6 +67,7 @@ public struct MessageOutput: Codable, Equatable { case actions = "actions" case debug = "debug" case userDefined = "user_defined" + case spelling = "spelling" } } diff --git a/Source/AssistantV2/Models/MessageOutputSpelling.swift b/Source/AssistantV2/Models/MessageOutputSpelling.swift new file mode 100644 index 000000000..c99f383b7 --- /dev/null +++ b/Source/AssistantV2/Models/MessageOutputSpelling.swift @@ -0,0 +1,49 @@ +/** + * (C) Copyright IBM Corp. 2020. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + **/ + +import Foundation + +/** + Properties describing any spelling corrections in the user input that was received. + */ +public struct MessageOutputSpelling: Codable, Equatable { + + /** + The user input text that was used to generate the response. If spelling autocorrection is enabled, this text + reflects any spelling corrections that were applied. + */ + public var text: String? + + /** + The original user input text. This property is returned only if autocorrection is enabled and the user input was + corrected. + */ + public var originalText: String? + + /** + Any suggested corrections of the input text. This property is returned only if spelling correction is enabled and + autocorrection is disabled. + */ + public var suggestedText: String? + + // Map each property name to the key that shall be used for encoding/decoding. + private enum CodingKeys: String, CodingKey { + case text = "text" + case originalText = "original_text" + case suggestedText = "suggested_text" + } + +} diff --git a/Source/AssistantV2/Models/MessageRequest.swift b/Source/AssistantV2/Models/MessageRequest.swift index 7f31e38d2..fd5bb0f44 100644 --- a/Source/AssistantV2/Models/MessageRequest.swift +++ b/Source/AssistantV2/Models/MessageRequest.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2018, 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,7 +17,7 @@ import Foundation /** - A request formatted for the Watson Assistant service. + A stateful message request formatted for the Watson Assistant service. */ internal struct MessageRequest: Codable, Equatable { @@ -27,8 +27,9 @@ internal struct MessageRequest: Codable, Equatable { public var input: MessageInput? /** - State information for the conversation. The context is stored by the assistant on a per-session basis. You can use - this property to set or modify context variables, which can also be accessed by dialog nodes. + Context data for the conversation. You can use this property to set or modify context variables, which can also be + accessed by dialog nodes. The context is stored by the assistant on a per-session basis. + **Note:** The total size of the context data stored for a stateful session cannot exceed 100KB. */ public var context: MessageContext? @@ -42,9 +43,10 @@ internal struct MessageRequest: Codable, Equatable { Initialize a `MessageRequest` with member variables. - parameter input: An input object that includes the input text. - - parameter context: State information for the conversation. The context is stored by the assistant on a - per-session basis. You can use this property to set or modify context variables, which can also be accessed by - dialog nodes. + - parameter context: Context data for the conversation. You can use this property to set or modify context + variables, which can also be accessed by dialog nodes. The context is stored by the assistant on a per-session + basis. + **Note:** The total size of the context data stored for a stateful session cannot exceed 100KB. - returns: An initialized `MessageRequest`. */ diff --git a/Source/AssistantV2/Models/MessageRequestStateless.swift b/Source/AssistantV2/Models/MessageRequestStateless.swift new file mode 100644 index 000000000..6dc075f9c --- /dev/null +++ b/Source/AssistantV2/Models/MessageRequestStateless.swift @@ -0,0 +1,63 @@ +/** + * (C) Copyright IBM Corp. 2020. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + **/ + +import Foundation + +/** + A stateless message request formatted for the Watson Assistant service. + */ +internal struct MessageRequestStateless: Codable, Equatable { + + /** + An input object that includes the input text. + */ + public var input: MessageInputStateless? + + /** + Context data for the conversation. You can use this property to set or modify context variables, which can also be + accessed by dialog nodes. The context is not stored by the assistant. To maintain session state, include the + context from the previous response. + **Note:** The total size of the context data for a stateless session cannot exceed 250KB. + */ + public var context: MessageContextStateless? + + // Map each property name to the key that shall be used for encoding/decoding. + private enum CodingKeys: String, CodingKey { + case input = "input" + case context = "context" + } + + /** + Initialize a `MessageRequestStateless` with member variables. + + - parameter input: An input object that includes the input text. + - parameter context: Context data for the conversation. You can use this property to set or modify context + variables, which can also be accessed by dialog nodes. The context is not stored by the assistant. To maintain + session state, include the context from the previous response. + **Note:** The total size of the context data for a stateless session cannot exceed 250KB. + + - returns: An initialized `MessageRequestStateless`. + */ + public init( + input: MessageInputStateless? = nil, + context: MessageContextStateless? = nil + ) + { + self.input = input + self.context = context + } + +} diff --git a/Source/AssistantV2/Models/MessageResponse.swift b/Source/AssistantV2/Models/MessageResponse.swift index 271c60e9b..1872d6d28 100644 --- a/Source/AssistantV2/Models/MessageResponse.swift +++ b/Source/AssistantV2/Models/MessageResponse.swift @@ -27,8 +27,8 @@ public struct MessageResponse: Codable, Equatable { public var output: MessageOutput /** - Context data for the conversation. The context is stored by the assistant on a per-session basis. You can use this - property to access context variables. + Context data for the conversation. You can use this property to access context variables. The context is stored by + the assistant on a per-session basis. **Note:** The context is included in message responses only if **return_context**=`true` in the message request. */ public var context: MessageContext? diff --git a/Source/AssistantV2/Models/MessageResponseStateless.swift b/Source/AssistantV2/Models/MessageResponseStateless.swift new file mode 100644 index 000000000..1efc115dc --- /dev/null +++ b/Source/AssistantV2/Models/MessageResponseStateless.swift @@ -0,0 +1,41 @@ +/** + * (C) Copyright IBM Corp. 2020. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + **/ + +import Foundation + +/** + A stateless response from the Watson Assistant service. + */ +public struct MessageResponseStateless: Codable, Equatable { + + /** + Assistant output to be rendered or processed by the client. + */ + public var output: MessageOutput + + /** + Context data for the conversation. You can use this property to access context variables. The context is not stored + by the assistant; to maintain session state, include the context from the response in the next message. + */ + public var context: MessageContextStateless + + // Map each property name to the key that shall be used for encoding/decoding. + private enum CodingKeys: String, CodingKey { + case output = "output" + case context = "context" + } + +} diff --git a/Source/AssistantV2/Models/SearchResult.swift b/Source/AssistantV2/Models/SearchResult.swift index ab6ad5be4..f48631678 100644 --- a/Source/AssistantV2/Models/SearchResult.swift +++ b/Source/AssistantV2/Models/SearchResult.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2019. + * (C) Copyright IBM Corp. 2019, 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -49,7 +49,7 @@ public struct SearchResult: Codable, Equatable { public var url: String? /** - An object containing segments of text from search results with query-matching text highlighted using HTML + An object containing segments of text from search results with query-matching text highlighted using HTML `` tags. */ public var highlight: SearchResultHighlight? diff --git a/Source/AssistantV2/Models/SearchResultHighlight.swift b/Source/AssistantV2/Models/SearchResultHighlight.swift index 82735e58c..6ee372be8 100644 --- a/Source/AssistantV2/Models/SearchResultHighlight.swift +++ b/Source/AssistantV2/Models/SearchResultHighlight.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2019. + * (C) Copyright IBM Corp. 2019, 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,7 +18,7 @@ import Foundation import IBMSwiftSDKCore /** - An object containing segments of text from search results with query-matching text highlighted using HTML tags. + An object containing segments of text from search results with query-matching text highlighted using HTML `` tags. */ public struct SearchResultHighlight: Codable, Equatable { diff --git a/Source/DiscoveryV2/Discovery.swift b/Source/DiscoveryV2/Discovery.swift index 5511ea972..8a79096b7 100644 --- a/Source/DiscoveryV2/Discovery.swift +++ b/Source/DiscoveryV2/Discovery.swift @@ -57,7 +57,7 @@ public class Discovery { */ public init(version: String) throws { self.version = version - + let authenticator = try ConfigBasedAuthenticatorFactory.getAuthenticator(credentialPrefix: serviceSdkName) self.authenticator = authenticator @@ -710,6 +710,8 @@ public class Discovery { same **document_id** if it exists. **Note:** This operation only works on collections created to accept direct file uploads. It cannot be used to modify a collection that connects to an external source such as Microsoft SharePoint. + **Note:** If an uploaded document is segmented, all segments will be overwritten, even if the updated version of + the document has fewer segments. - parameter projectID: The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling. @@ -809,6 +811,8 @@ public class Discovery { status code `200`) with the status set to 'deleted'. **Note:** This operation only works on collections created to accept direct file uploads. It cannot be used to modify a collection that connects to an external source such as Microsoft SharePoint. + **Note:** Segments of an uploaded document cannot be deleted individually. Delete all segments by deleting using + the `parent_document_id` of a segment result. - parameter projectID: The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling. diff --git a/Source/NaturalLanguageUnderstandingV1/Models/Model.swift b/Source/NaturalLanguageUnderstandingV1/Models/Model.swift index fb89e113b..45c6bfb2e 100644 --- a/Source/NaturalLanguageUnderstandingV1/Models/Model.swift +++ b/Source/NaturalLanguageUnderstandingV1/Models/Model.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2017, 2018. + * (C) Copyright IBM Corp. 2017, 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -47,6 +47,11 @@ public struct Model: Codable, Equatable { /** The model version, if it was manually provided in Watson Knowledge Studio. */ + public var modelVersion: String? + + /** + (Deprecated — use `model_version`) The model version, if it was manually provided in Watson Knowledge Studio. + */ public var version: String? /** @@ -66,6 +71,7 @@ public struct Model: Codable, Equatable { case language = "language" case description = "description" case workspaceID = "workspace_id" + case modelVersion = "model_version" case version = "version" case versionDescription = "version_description" case created = "created" diff --git a/Source/SupportingFiles/WatsonCredentials.swift.enc b/Source/SupportingFiles/WatsonCredentials.swift.enc index dcb7b4480..8575788e6 100644 Binary files a/Source/SupportingFiles/WatsonCredentials.swift.enc and b/Source/SupportingFiles/WatsonCredentials.swift.enc differ diff --git a/Source/TextToSpeechV1/TextToSpeech.swift b/Source/TextToSpeechV1/TextToSpeech.swift index 334efc87c..076070001 100644 --- a/Source/TextToSpeechV1/TextToSpeech.swift +++ b/Source/TextToSpeechV1/TextToSpeech.swift @@ -22,14 +22,15 @@ import IBMSwiftSDKCore The IBM® Text to Speech service provides APIs that use IBM's speech-synthesis capabilities to synthesize text into natural-sounding speech in a variety of languages, dialects, and voices. The service supports at least one male or female voice, sometimes both, for each language. The audio is streamed back to the client with minimal delay. - For speech synthesis, the service supports a synchronous HTTP Representational State Transfer (REST) interface. It also - supports a WebSocket interface that provides both plain text and SSML input, including the SSML <mark> element - and word timings. SSML is an XML-based markup language that provides text annotation for speech-synthesis applications. - The service also offers a customization interface. You can use the interface to define sounds-like or phonetic - translations for words. A sounds-like translation consists of one or more words that, when combined, sound like the - word. A phonetic translation is based on the SSML phoneme format for representing a word. You can specify a phonetic - translation in standard International Phonetic Alphabet (IPA) representation or in the proprietary IBM Symbolic - Phonetic Representation (SPR). The Arabic, Chinese, Dutch, and Korean languages support only IPA. + For speech synthesis, the service supports a synchronous HTTP Representational State Transfer (REST) interface and a + WebSocket interface. Both interfaces support plain text and SSML input. SSML is an XML-based markup language that + provides text annotation for speech-synthesis applications. The WebSocket interface also supports the SSML + <mark> element and word timings. + The service offers a customization interface that you can use to define sounds-like or phonetic translations for words. + A sounds-like translation consists of one or more words that, when combined, sound like the word. A phonetic + translation is based on the SSML phoneme format for representing a word. You can specify a phonetic translation in + standard International Phonetic Alphabet (IPA) representation or in the proprietary IBM Symbolic Phonetic + Representation (SPR). The Arabic, Chinese, Dutch, and Korean languages support only IPA. */ public class TextToSpeech { diff --git a/Source/VisualRecognitionV4/Models/ImageDetails.swift b/Source/VisualRecognitionV4/Models/ImageDetails.swift index 5ee2653f6..4bfbe353d 100644 --- a/Source/VisualRecognitionV4/Models/ImageDetails.swift +++ b/Source/VisualRecognitionV4/Models/ImageDetails.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2019. + * (C) Copyright IBM Corp. 2019, 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -46,6 +46,9 @@ public struct ImageDetails: Codable, Equatable { */ public var dimensions: ImageDimensions? + /** + Details about the errors. + */ public var errors: [Error]? /** diff --git a/Source/VisualRecognitionV4/Models/ObjectTrainingStatus.swift b/Source/VisualRecognitionV4/Models/ObjectTrainingStatus.swift index d7e179e11..e6bb1e77a 100644 --- a/Source/VisualRecognitionV4/Models/ObjectTrainingStatus.swift +++ b/Source/VisualRecognitionV4/Models/ObjectTrainingStatus.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2019. + * (C) Copyright IBM Corp. 2019, 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -41,6 +41,11 @@ public struct ObjectTrainingStatus: Codable, Equatable { */ public var latestFailed: Bool + /** + Whether the model can be downloaded after the training status is `ready`. + */ + public var rscnnReady: Bool + /** Details about the training. If training is in progress, includes information about the status. If training is not in progress, includes a success message or information about why training failed. @@ -53,6 +58,7 @@ public struct ObjectTrainingStatus: Codable, Equatable { case inProgress = "in_progress" case dataChanged = "data_changed" case latestFailed = "latest_failed" + case rscnnReady = "rscnn_ready" case description = "description" } @@ -63,6 +69,7 @@ public struct ObjectTrainingStatus: Codable, Equatable { - parameter inProgress: Whether training is in progress. - parameter dataChanged: Whether there are changes to the training data since the most recent training. - parameter latestFailed: Whether the most recent training failed. + - parameter rscnnReady: Whether the model can be downloaded after the training status is `ready`. - parameter description: Details about the training. If training is in progress, includes information about the status. If training is not in progress, includes a success message or information about why training failed. @@ -73,6 +80,7 @@ public struct ObjectTrainingStatus: Codable, Equatable { inProgress: Bool, dataChanged: Bool, latestFailed: Bool, + rscnnReady: Bool, description: String ) { @@ -80,6 +88,7 @@ public struct ObjectTrainingStatus: Codable, Equatable { self.inProgress = inProgress self.dataChanged = dataChanged self.latestFailed = latestFailed + self.rscnnReady = rscnnReady self.description = description } diff --git a/Source/VisualRecognitionV4/VisualRecognition.swift b/Source/VisualRecognitionV4/VisualRecognition.swift index dc7e92060..78d0cf955 100644 --- a/Source/VisualRecognitionV4/VisualRecognition.swift +++ b/Source/VisualRecognitionV4/VisualRecognition.swift @@ -524,6 +524,70 @@ public class VisualRecognition { request.response(completionHandler: completionHandler) } + /** + Get a model. + + Download a model that you can deploy to detect objects in images. The collection must include a generated model, + which is indicated in the response for the collection details as `"rscnn_ready": true`. If the value is `false`, + train or retrain the collection to generate the model. + Currently, the model format is specific to Android apps. For more information about how to deploy the model to your + app, see the [Watson Visual Recognition on Android](https://github.com/matt-ny/rscnn) project in GitHub. + + - parameter collectionID: The identifier of the collection. + - parameter feature: The feature for the model. + - parameter modelFormat: The format of the returned model. + - parameter headers: A dictionary of request headers to be sent with this request. + - parameter completionHandler: A function executed when the request completes with a successful result or error + */ + public func getModelFile( + collectionID: String, + feature: String, + modelFormat: String, + headers: [String: String]? = nil, + completionHandler: @escaping (WatsonResponse?, WatsonError?) -> Void) + { + // construct header parameters + var headerParameters = defaultHeaders + if let headers = headers { + headerParameters.merge(headers) { (_, new) in new } + } + let sdkHeaders = Shared.getSDKHeaders(serviceName: serviceName, serviceVersion: serviceVersion, methodName: "getModelFile") + headerParameters.merge(sdkHeaders) { (_, new) in new } + headerParameters["Accept"] = "application/octet-stream" + + // construct query parameters + var queryParameters = [URLQueryItem]() + queryParameters.append(URLQueryItem(name: "version", value: version)) + queryParameters.append(URLQueryItem(name: "feature", value: feature)) + queryParameters.append(URLQueryItem(name: "model_format", value: modelFormat)) + + // construct REST request + let path = "/v4/collections/\(collectionID)/model" + guard let encodedPath = path.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) else { + completionHandler(nil, WatsonError.urlEncoding(path: path)) + return + } + + // ensure that serviceURL is set + guard let serviceEndpoint = serviceURL else { + completionHandler(nil, WatsonError.noEndpoint) + return + } + + let request = RestRequest( + session: session, + authenticator: authenticator, + errorResponseDecoder: errorResponseDecoder, + method: "GET", + url: serviceEndpoint + encodedPath, + headerParameters: headerParameters, + queryItems: queryParameters + ) + + // execute REST request + request.response(completionHandler: completionHandler) + } + /** Add images. diff --git a/Tests/AssistantV2Tests/AssistantV2Tests.swift b/Tests/AssistantV2Tests/AssistantV2Tests.swift index 56c051da5..8b3480c3f 100644 --- a/Tests/AssistantV2Tests/AssistantV2Tests.swift +++ b/Tests/AssistantV2Tests/AssistantV2Tests.swift @@ -41,6 +41,7 @@ class AssistantV2Tests: XCTestCase { ("testDeleteSession", testDeleteSession), ("testDeleteSessionWithInvalidSessionID", testDeleteSessionWithInvalidSessionID), ("testMessage", testMessage), + ("testMessageStateless", testMessageStateless), ("testMessageWithInvalidSessionID", testMessageWithInvalidSessionID), ] } @@ -237,7 +238,8 @@ class AssistantV2Tests: XCTestCase { let description3 = "Continue a conversation." let expectation3 = self.expectation(description: description3) - let messageInput = MessageInput(messageType: MessageInput.MessageType.text.rawValue, text: "I'm good, how are you?") + let messageInputOptions = MessageInputOptions(debug: false, restart: false, alternateIntents: false, returnContext: true, export: false, spelling: nil) + let messageInput = MessageInput(messageType: MessageInput.MessageType.text.rawValue, text: "I'm good, how are you?", options: messageInputOptions) assistant.message(assistantID: assistantID, sessionID: sessionID, input: messageInput, context: nil) { response, error in @@ -272,13 +274,44 @@ class AssistantV2Tests: XCTestCase { XCTAssertEqual(intents[0].intent, "General_Greetings") // verify context - XCTAssertNil(context) + XCTAssertNotNil(context) expectation3.fulfill() } waitForExpectations() } + func testMessageStateless() { + let description = "Test message stateless" + let statelessMessageExpectation = self.expectation(description: description) + + let testInput: MessageInputStateless = MessageInputStateless(messageType: "text", text: "This is a test", intents: nil, entities: nil, suggestionID: nil, options: nil) + + let testGlobalContext: MessageContextGlobalStateless = MessageContextGlobalStateless(system: nil, sessionID: nil) + let testContext: MessageContextStateless = MessageContextStateless(global: testGlobalContext, skills: nil) + + assistant.messageStateless(assistantID: assistantID, input: testInput, context: testContext, headers: nil) { + response, error in + + if let error = error { + XCTFail(unexpectedErrorMessage(error)) + return + } + + guard let messageResponse = response?.result else { + XCTFail(missingResultMessage) + return + } + + XCTAssertNotNil(messageResponse.output) + XCTAssertNotNil(messageResponse.context) + + statelessMessageExpectation.fulfill() + } + + waitForExpectations() + } + func testMessageWithSystemEntity() { let description1 = "Create a session" let expectation1 = self.expectation(description: description1) diff --git a/Tests/VisualRecognitionV4Tests/VisualRecognitionV4Tests.swift b/Tests/VisualRecognitionV4Tests/VisualRecognitionV4Tests.swift index caab24d57..d2be10385 100644 --- a/Tests/VisualRecognitionV4Tests/VisualRecognitionV4Tests.swift +++ b/Tests/VisualRecognitionV4Tests/VisualRecognitionV4Tests.swift @@ -29,7 +29,7 @@ class VisualRecognitionV4Tests: XCTestCase { private let collectionID = WatsonCredentials.VisualRecognitionV4CollectionID private let giraffeCollectionID = WatsonCredentials.VisualRecognitionV4GiraffeCollectionID private let trainingDummyCollectionID = WatsonCredentials.VisualRecognitionV4TrainingDummyCollectionID - private let trainingDummyImageID = "1280px-Giraffe_Ithala_KZN_South_4b75885f184a39650eab62a086601068" + private let trainingDummyImageID = "MV5BZWJhZTdmMjQtNWQxOC00YzMwLTg_005ade9d99ec84c2dfe56f634998f7b8" private let giraffeImageURL = giraffeURL static var allTests: [(String, (VisualRecognitionV4Tests) -> () throws -> Void)] { @@ -457,6 +457,35 @@ class VisualRecognitionV4Tests: XCTestCase { waitForExpectations() } + + // MARK: - Downloading model files locally + + func testGetModelFile() { + let description = "Get Model File" + let modelFileExpectation = self.expectation(description: description) + + visualRecognition.getModelFile(collectionID: collectionID, feature: "objects", modelFormat: "rscnn", headers: nil) { + response, error in + + // make sure we didn't get an error + if let error = error { + XCTFail(unexpectedErrorMessage(error)) + return + } + + // make sure we got a response + guard let modelData = response?.result else { + XCTFail("No model data returned") + return + } + + // we expect the model to contain data + XCTAssertFalse(modelData.isEmpty) + + modelFileExpectation.fulfill() + } + waitForExpectations() + } // MARK: - Managing images in a collection diff --git a/WatsonDeveloperCloud.xcodeproj/project.pbxproj b/WatsonDeveloperCloud.xcodeproj/project.pbxproj index b0adacb31..80d46761b 100644 --- a/WatsonDeveloperCloud.xcodeproj/project.pbxproj +++ b/WatsonDeveloperCloud.xcodeproj/project.pbxproj @@ -375,6 +375,15 @@ 7E70D5C92388491E00CC8C80 /* Webhook.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7E70D5C62388491E00CC8C80 /* Webhook.swift */; }; 7E70D5CC238C1DF000CC8C80 /* TrainingEvents.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7E70D5CA238C1DF000CC8C80 /* TrainingEvents.swift */; }; 7E70D5CD238C1DF000CC8C80 /* TrainingEvent.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7E70D5CB238C1DF000CC8C80 /* TrainingEvent.swift */; }; + 7E8B21272475973700BE7EFA /* MessageContextSkillSystem.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7E8B211E2475973500BE7EFA /* MessageContextSkillSystem.swift */; }; + 7E8B21282475973700BE7EFA /* MessageInputStateless.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7E8B211F2475973600BE7EFA /* MessageInputStateless.swift */; }; + 7E8B21292475973700BE7EFA /* MessageInputOptionsSpelling.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7E8B21202475973600BE7EFA /* MessageInputOptionsSpelling.swift */; }; + 7E8B212A2475973700BE7EFA /* MessageOutputSpelling.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7E8B21212475973600BE7EFA /* MessageOutputSpelling.swift */; }; + 7E8B212B2475973700BE7EFA /* MessageRequestStateless.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7E8B21222475973600BE7EFA /* MessageRequestStateless.swift */; }; + 7E8B212C2475973700BE7EFA /* MessageContextStateless.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7E8B21232475973600BE7EFA /* MessageContextStateless.swift */; }; + 7E8B212D2475973700BE7EFA /* MessageResponseStateless.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7E8B21242475973700BE7EFA /* MessageResponseStateless.swift */; }; + 7E8B212E2475973700BE7EFA /* MessageContextGlobalStateless.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7E8B21252475973700BE7EFA /* MessageContextGlobalStateless.swift */; }; + 7E8B212F2475973700BE7EFA /* MessageInputOptionsStateless.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7E8B21262475973700BE7EFA /* MessageInputOptionsStateless.swift */; }; 7E96EC3C233907660039388E /* GenericQueryAggregation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7E96EC3B233907660039388E /* GenericQueryAggregation.swift */; }; 7E96EC3F23391C0A0039388E /* WordTimestamp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7E96EC3D23391C0A0039388E /* WordTimestamp.swift */; }; 7E96EC4023391C0A0039388E /* WordConfidence.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7E96EC3E23391C0A0039388E /* WordConfidence.swift */; }; @@ -1339,6 +1348,15 @@ 7E70D5C62388491E00CC8C80 /* Webhook.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Webhook.swift; sourceTree = ""; }; 7E70D5CA238C1DF000CC8C80 /* TrainingEvents.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TrainingEvents.swift; sourceTree = ""; }; 7E70D5CB238C1DF000CC8C80 /* TrainingEvent.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TrainingEvent.swift; sourceTree = ""; }; + 7E8B211E2475973500BE7EFA /* MessageContextSkillSystem.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MessageContextSkillSystem.swift; sourceTree = ""; }; + 7E8B211F2475973600BE7EFA /* MessageInputStateless.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MessageInputStateless.swift; sourceTree = ""; }; + 7E8B21202475973600BE7EFA /* MessageInputOptionsSpelling.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MessageInputOptionsSpelling.swift; sourceTree = ""; }; + 7E8B21212475973600BE7EFA /* MessageOutputSpelling.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MessageOutputSpelling.swift; sourceTree = ""; }; + 7E8B21222475973600BE7EFA /* MessageRequestStateless.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MessageRequestStateless.swift; sourceTree = ""; }; + 7E8B21232475973600BE7EFA /* MessageContextStateless.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MessageContextStateless.swift; sourceTree = ""; }; + 7E8B21242475973700BE7EFA /* MessageResponseStateless.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MessageResponseStateless.swift; sourceTree = ""; }; + 7E8B21252475973700BE7EFA /* MessageContextGlobalStateless.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MessageContextGlobalStateless.swift; sourceTree = ""; }; + 7E8B21262475973700BE7EFA /* MessageInputOptionsStateless.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MessageInputOptionsStateless.swift; sourceTree = ""; }; 7E96EC3B233907660039388E /* GenericQueryAggregation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GenericQueryAggregation.swift; sourceTree = ""; }; 7E96EC3D23391C0A0039388E /* WordTimestamp.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = WordTimestamp.swift; sourceTree = ""; }; 7E96EC3E23391C0A0039388E /* WordConfidence.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = WordConfidence.swift; sourceTree = ""; }; @@ -2960,15 +2978,24 @@ 9220778D2152FC5900C8C7E4 /* DialogSuggestionValue.swift */, 922077842152FC5900C8C7E4 /* MessageContext.swift */, 922077952152FC5900C8C7E4 /* MessageContextGlobal.swift */, + 7E8B21252475973700BE7EFA /* MessageContextGlobalStateless.swift */, 9220778C2152FC5900C8C7E4 /* MessageContextGlobalSystem.swift */, CA8E92882236C638001BFABF /* MessageContextSkill.swift */, 922077932152FC5900C8C7E4 /* MessageContextSkills.swift */, + 7E8B211E2475973500BE7EFA /* MessageContextSkillSystem.swift */, + 7E8B21232475973600BE7EFA /* MessageContextStateless.swift */, 922077912152FC5900C8C7E4 /* MessageInput.swift */, 922077962152FC5900C8C7E4 /* MessageInputOptions.swift */, + 7E8B21202475973600BE7EFA /* MessageInputOptionsSpelling.swift */, + 7E8B21262475973700BE7EFA /* MessageInputOptionsStateless.swift */, + 7E8B211F2475973600BE7EFA /* MessageInputStateless.swift */, 922077892152FC5900C8C7E4 /* MessageOutput.swift */, 9220778B2152FC5900C8C7E4 /* MessageOutputDebug.swift */, + 7E8B21212475973600BE7EFA /* MessageOutputSpelling.swift */, 922077872152FC5900C8C7E4 /* MessageRequest.swift */, + 7E8B21222475973600BE7EFA /* MessageRequestStateless.swift */, 922077982152FC5900C8C7E4 /* MessageResponse.swift */, + 7E8B21242475973700BE7EFA /* MessageResponseStateless.swift */, 922077922152FC5900C8C7E4 /* RuntimeEntity.swift */, 7EDC39C423F4445000B13747 /* RuntimeEntityAlternative.swift */, 7EDC39C323F4445000B13747 /* RuntimeEntityInterpretation.swift */, @@ -5365,6 +5392,8 @@ 922078532152FCE400C8C7E4 /* DialogLogMessage.swift in Sources */, 922078412152FCE000C8C7E4 /* Assistant.swift in Sources */, 922078572152FCE400C8C7E4 /* MessageResponse.swift in Sources */, + 7E8B212C2475973700BE7EFA /* MessageContextStateless.swift in Sources */, + 7E8B212A2475973700BE7EFA /* MessageOutputSpelling.swift in Sources */, 7EC735DC2319DDB400A73810 /* RuntimeResponseGeneric.swift in Sources */, 922078442152FCE400C8C7E4 /* DialogSuggestion.swift in Sources */, 922078512152FCE400C8C7E4 /* RuntimeEntity.swift in Sources */, @@ -5372,13 +5401,17 @@ 5F2C5BE722E9FA0900A7628D /* SearchResultHighlight.swift in Sources */, 922078522152FCE400C8C7E4 /* MessageContextSkills.swift in Sources */, 922078432152FCE400C8C7E4 /* MessageContext.swift in Sources */, + 7E8B212D2475973700BE7EFA /* MessageResponseStateless.swift in Sources */, 922078562152FCE400C8C7E4 /* DialogNodesVisited.swift in Sources */, 924EE7BA21505D7A0048C0E5 /* Shared.swift in Sources */, 922078422152FCE400C8C7E4 /* DialogNodeAction.swift in Sources */, 922078452152FCE400C8C7E4 /* SessionResponse.swift in Sources */, + 7E8B212B2475973700BE7EFA /* MessageRequestStateless.swift in Sources */, 922078502152FCE400C8C7E4 /* MessageInput.swift in Sources */, 922078472152FCE400C8C7E4 /* CaptureGroup.swift in Sources */, 5F2C5BE622E9FA0900A7628D /* SearchResult.swift in Sources */, + 7E8B21292475973700BE7EFA /* MessageInputOptionsSpelling.swift in Sources */, + 7E8B21272475973700BE7EFA /* MessageContextSkillSystem.swift in Sources */, 9220784A2152FCE400C8C7E4 /* MessageOutputDebug.swift in Sources */, 922078482152FCE400C8C7E4 /* MessageOutput.swift in Sources */, 9220784D2152FCE400C8C7E4 /* RuntimeIntent.swift in Sources */, @@ -5386,7 +5419,10 @@ CA8E92892236C638001BFABF /* MessageContextSkill.swift in Sources */, 7EDC39C723F4445000B13747 /* RuntimeEntityAlternative.swift in Sources */, 7EDC39C623F4445000B13747 /* RuntimeEntityInterpretation.swift in Sources */, + 7E8B212E2475973700BE7EFA /* MessageContextGlobalStateless.swift in Sources */, 9220784C2152FCE400C8C7E4 /* DialogSuggestionValue.swift in Sources */, + 7E8B212F2475973700BE7EFA /* MessageInputOptionsStateless.swift in Sources */, + 7E8B21282475973700BE7EFA /* MessageInputStateless.swift in Sources */, 9220784E2152FCE400C8C7E4 /* DialogNodeOutputOptionsElementValue.swift in Sources */, 5F2C5BE822E9FA0900A7628D /* SearchResultMetadata.swift in Sources */, 922078462152FCE400C8C7E4 /* MessageRequest.swift in Sources */,