Classes
The following classes are available globally.
-
Undocumented
See moreDeclaration
Objective-C
@interface AWSLexInteractionKitConfig : NSObject<NSCopying> /* * The bot name. */ @property (nonatomic, strong) NSString *botName; /* * The bot alias. */ @property (nonatomic, strong) NSString *botAlias; /* * Optional user id, The service will use cognito identity id by default. */ @property (nonatomic, strong, nullable) NSString *userId; /* * Global session attributes are attributes that are applied for every call made to the lex service. */ @property (nonatomic, readonly) NSDictionary<NSString *, NSString *> *globalSessionAttributes; /* * The time interval before which the microphone timesout. */ @property (nonatomic, assign) NSTimeInterval noSpeechTimeoutInterval; /* * The max time interval for a speech input. */ @property (nonatomic, assign) NSTimeInterval maxSpeechTimeoutInterval; /* * The number of speech frames which defines what is a active speech. */ @property (nonatomic, assign) NSUInteger startpointingThreshold; /* * The number of non-speech frames which defines what a silence is. */ @property (nonatomic, assign) NSUInteger endpointingThreshold; /* * The Likelyhood-ratio test threshold value, which will be used to classify whether a frame of audio is a speech or not. */ @property (nonatomic, assign) float lrtThreshold; /* * Automatically start playing when a speech response is recieved. Defaults to true. */ @property (nonatomic, assign) BOOL autoPlayback; /* * Speech encoding format. Defaults to Opus. */ @property (nonatomic, assign) AWSLexSpeechEncoding encoding; /* * Set sessionAttribute globally. */ -(void)setGlobalSessionAttribute:(NSString *)value forKey:(NSString *)key; /* * remove a global session attribute */ -(void)removeGlobalSessionAttribute:(NSString *)key; /* * Clear all global session attributes. */ -(void)clearAllGlobalSessionAttributes; /* * returns interaction config with default values. */ +(instancetype)defaultInteractionKitConfigWithBotName:(NSString *)botName botAlias:(NSString *)botAlias; @end
Swift
class AWSLexInteractionKitConfig : NSObject, NSCopying
-
Undocumented
See moreDeclaration
Objective-C
@interface AWSLexInteractionKit : NSObject /* * The Tnteraction Kit config. */ @property (nonatomic, strong) AWSLexInteractionKitConfig *interactionKitConfig; @property (nonatomic, weak) id<AWSLexInteractionDelegate> interactionDelegate; @property (nonatomic, weak) id<AWSLexMicrophoneDelegate> microphoneDelegate; @property (nonatomic, weak) id<AWSLexAudioPlayerDelegate> audioPlayerDelegate; /** Returns the singleton interactionKit client. If the singleton object does not exist, the SDK instantiates the default service client with `defaultServiceConfiguration` from `[AWSServiceManager defaultServiceManager]`. The reference to this object is maintained by the SDK, and you do not need to retain it manually. For example, set the default service configuration in `- application:didFinishLaunchingWithOptions:` *Swift* func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { let credentialProvider = AWSCognitoCredentialsProvider(regionType: .USEast1, identityPoolId: "YourIdentityPoolId") let configuration = AWSServiceConfiguration(region: .USEast1, credentialsProvider: credentialProvider) AWSServiceManager.default().defaultServiceConfiguration = configuration return true } *Objective-C* -(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { AWSCognitoCredentialsProvider *credentialsProvider = [[AWSCognitoCredentialsProvider alloc] initWithRegionType:AWSRegionUSEast1 identityPoolId:@"YourIdentityPoolId"]; AWSServiceConfiguration *configuration = [[AWSServiceConfiguration alloc] initWithRegion:AWSRegionUSEast1 credentialsProvider:credentialsProvider]; [AWSServiceManager defaultServiceManager].defaultServiceConfiguration = configuration; return YES; } Then call the following to get the default service client: *Swift* let interactionKit = AWSLexInteractionKit.default() *Objective-C* AWSLexInteractionKit *interactionKit = [AWSLexInteractionKit defaultInteractionKit]; @return The default interactionKit client. */ + (instancetype)defaultInteractionKit; /** Creates a InteractionKit client with the given service configuration and registers it for the key. For example, set the default service configuration in `- application:didFinishLaunchingWithOptions:` *Swift* func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { let credentialProvider = AWSCognitoCredentialsProvider(regionType: .USEast1, identityPoolId: "YourIdentityPoolId") let configuration = AWSServiceConfiguration(region: .USWest2, credentialsProvider: credentialProvider) AWSLexInteractionKit.register(with: configuration!, forKey: "USWest2InteractionKit") return true } *Objective-C* - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { AWSCognitoCredentialsProvider *credentialsProvider = [[AWSCognitoCredentialsProvider alloc] initWithRegionType:AWSRegionUSEast1 identityPoolId:@"YourIdentityPoolId"]; AWSServiceConfiguration *configuration = [[AWSServiceConfiguration alloc] initWithRegion:AWSRegionUSWest2 credentialsProvider:credentialsProvider]; [AWSLexInteractionKit registerInteractionKitWithServiceConfiguration:configuration forKey:@"USWest2InteractionKit"]; return YES; } Then call the following to get the service client: *Swift* let interactionKit = AWSLexInteractionKit(forKey: "USWest2InteractionKit") *Objective-C* AWSLexInteractionKit *interactionKit = [AWSLexInteractionKit interactionKitForKey:@"USWest2InteractionKit"]; @warning After calling this method, do not modify the configuration object. It may cause unspecified behaviors. @param configuration A service configuration object. @param key A string to identify the service client. */ + (void)registerInteractionKitWithServiceConfiguration:(AWSServiceConfiguration *)configuration interactionKitConfiguration:(AWSLexInteractionKitConfig *)config forKey:(NSString *)key; /** Retrieves the service client associated with the key. You need to call `+ registerLexWithConfiguration:forKey:` before invoking this method. For example, set the default service configuration in `- application:didFinishLaunchingWithOptions:` *Swift* func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { let credentialProvider = AWSCognitoCredentialsProvider(regionType: .USEast1, identityPoolId: "YourIdentityPoolId") let configuration = AWSServiceConfiguration(region: .USWest2, credentialsProvider: credentialProvider) AWSLexInteractionKit.register(with: configuration!, forKey: "USWest2InteractionKit") return true } *Objective-C* - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { AWSCognitoCredentialsProvider *credentialsProvider = [[AWSCognitoCredentialsProvider alloc] initWithRegionType:AWSRegionUSEast1 identityPoolId:@"YourIdentityPoolId"]; AWSServiceConfiguration *configuration = [[AWSServiceConfiguration alloc] initWithRegion:AWSRegionUSWest2 credentialsProvider:credentialsProvider]; [AWSLexInteractionKit registerInteractionKitWithServiceConfiguration:configuration forKey:@"USWest2InteractionKit"]; return YES; } Then call the following to get the service client: *Swift* let interactionKit = AWSLexInteractionKit(forKey: "USWest2InteractionKit") *Objective-C* AWSLexInteractionKit *interactionKit = [AWSLexInteractionKit interactionKitForKey:@"USWest2InteractionKit"]; @param key A string to identify the service client. @return An instance of the service client. */ + (instancetype)interactionKitForKey:(NSString *)key; /** Removes the interaction kit associated with the key and release it. @warning Before calling this method, make sure no method is running on this client. @param key A string to identify the service client. */ + (void)removeInteractionKitForKey:(NSString *)key; /** Accepts a text input and responds back with a text output @param inputText The text input */ - (void)textInTextOut:(NSString *)inputText; /** Accets a text input and an optional sessionAttribute dictionary and responds back with a text output. @param inputText The text input @param sessionAttributes Optional Session attributes dictionary */ - (void)textInTextOut:(NSString *)inputText sessionAttributes:(NSDictionary<NSString *, NSString *> * _Nullable)sessionAttributes; /** Accepts a text input and responds back with an audio response. the playback will begin automatically unless you have set autoplayback to false in the InteractionKitConfig. @param inputText The text input */ - (void)textInAudioOut:(NSString *)inputText; /** Accepts a text input and an optional sessionAttribute dictionary and responds back with an audio response. The playback will begin automatically unless you have set autoplayback to false in the InteractionKitConfig. @param inputText The text input @param sessionAttributes Optional Session attributes dictionary */ - (void)textInAudioOut:(NSString *)inputText sessionAttributes:(NSDictionary<NSString *, NSString *> * _Nullable)sessionAttributes; /** Starts the microphone and listens to audio from the phone microphone and responds back with an audio response.The playback will begin automatically unless you have set autoplayback to false in the InteractionKitConfig. */ - (void)audioInAudioOut; /** Starts the microphone and listens to audio from the phone microphone and responds back with an audio response.The playback will begin automatically unless you have set autoplayback to false in the InteractionKitConfig. @param sessionAttributes Optional Session attributes dictionary */ - (void)audioInAudioOutWithSessionAttributes:(NSDictionary<NSString *, NSString *> * _Nullable)sessionAttributes; /** Starts the microphone and listens to audio from the phone microphone and responds back with a text response. */ - (void)audioInTextOut; /** Starts the microphone and listens to audio from the phone microphone and responds back with a text response. @param sessionAttributes Optional Session attributes dictionary */ - (void)audioInTextOutWithSessionAttributes:(NSDictionary<NSString *, NSString *> * _Nullable)sessionAttributes; /** Cancels ongoing http call and stops listening to Microphone if Audio input was requested. */ - (void)cancel; @end
Swift
class AWSLexInteractionKit : NSObject
-
Undocumented
See moreDeclaration
Objective-C
@interface AWSLexSwitchModeInput : NSObject /** Name of the intent being ellicited. */ @property (nonatomic, strong, readonly) NSString * _Nullable intent; /** Text response. */ @property (nonatomic, strong, readonly) NSString * _Nullable outputText; /** The slots which are currently filled in an ongoing dialog */ @property (nonatomic, strong, readonly) NSDictionary * _Nullable slots; /** The slot which is being ellicited for an intent. */ @property (nonatomic, strong, readonly) NSString * _Nullable elicitSlot; /** The current dialog state. */ @property (nonatomic, assign, readonly) AWSLexDialogState dialogState; /** The session attributes returned from the service. */ @property (nonatomic, strong, readonly) NSDictionary * _Nullable sessionAttributes; /** The audio stream . This may be null incase of a text response. */ @property (nonatomic, strong, readonly) NSData * _Nullable audioStream; /** The format for the audio stream. This may be null if the audion stream is null. */ @property (nonatomic, strong, readonly) NSString * _Nullable audioContentType; /** Transcript of the voice input to the operation. */ @property (nonatomic, strong, readonly) NSString * _Nullable inputTranscript; @end
Swift
class AWSLexSwitchModeInput : NSObject
-
A response class returned back to the InteractionKit, In the course that user decides to switch modes of input between 2 requests, or set additional session attributes in the subsequant request.
See moreDeclaration
Objective-C
@interface AWSLexSwitchModeResponse : NSObject
Swift
class AWSLexSwitchModeResponse : NSObject
-
Wrapper to AVAudioSession class. It auto-detects output source(Internal speaker or microphone) at runtime by listening to AVAudioSessionRouteChangeNotification.
See moreDeclaration
Objective-C
@interface AWSLexAudioSession : NSObject
Swift
class AWSLexAudioSession : NSObject
-
Wrapper to AVAudioPLayer class.
See moreDeclaration
Objective-C
@interface AWSLexAudioPlayer : NSObject
Swift
class AWSLexAudioPlayer : NSObject
-
A context is a variable that contains information about the current state of the conversation between a user and Amazon Lex. Context can be set automatically by Amazon Lex when an intent is fulfilled, or it can be set at runtime using the
PutContent
,PutText
, orPutSession
operation.Required parameters: [name, timeToLive, parameters]
See moreDeclaration
Objective-C
@interface AWSLexActiveContext
Swift
class AWSLexActiveContext
-
The length of time or number of turns that a context remains active.
See moreDeclaration
Objective-C
@interface AWSLexActiveContextTimeToLive
Swift
class AWSLexActiveContextTimeToLive
-
Represents an option to be shown on the client platform (Facebook, Slack, etc.)
Required parameters: [text, value]
See moreDeclaration
Objective-C
@interface AWSLexButton
Swift
class AWSLexButton
-
Declaration
Objective-C
@interface AWSLexDeleteSessionRequest
Swift
class AWSLexDeleteSessionRequest
-
Declaration
Objective-C
@interface AWSLexDeleteSessionResponse
Swift
class AWSLexDeleteSessionResponse
-
Describes the next action that the bot should take in its interaction with the user and provides information about the context in which the action takes place. Use the
DialogAction
data type to set the interaction to a specific state, or to return the interaction to a previous state.Required parameters: [type]
See moreDeclaration
Objective-C
@interface AWSLexDialogAction
Swift
class AWSLexDialogAction
-
Represents an option rendered to the user when a prompt is shown. It could be an image, a button, a link, or text.
See moreDeclaration
Objective-C
@interface AWSLexGenericAttachment
Swift
class AWSLexGenericAttachment
-
Declaration
Objective-C
@interface AWSLexGetSessionRequest
Swift
class AWSLexGetSessionRequest
-
Declaration
Objective-C
@interface AWSLexGetSessionResponse
Swift
class AWSLexGetSessionResponse
-
Provides a score that indicates the confidence that Amazon Lex has that an intent is the one that satisfies the user’s intent.
See moreDeclaration
Objective-C
@interface AWSLexIntentConfidence
Swift
class AWSLexIntentConfidence
-
Provides information about the state of an intent. You can use this information to get the current state of an intent so that you can process the intent, or so that you can return the intent to its previous state.
Required parameters: [dialogActionType]
See moreDeclaration
Objective-C
@interface AWSLexIntentSummary
Swift
class AWSLexIntentSummary
-
Declaration
Objective-C
@interface AWSLexPostContentRequest
Swift
class AWSLexPostContentRequest
-
Declaration
Objective-C
@interface AWSLexPostContentResponse
Swift
class AWSLexPostContentResponse
-
Declaration
Objective-C
@interface AWSLexPostTextRequest
Swift
class AWSLexPostTextRequest
-
Declaration
Objective-C
@interface AWSLexPostTextResponse
Swift
class AWSLexPostTextResponse
-
An intent that Amazon Lex suggests satisfies the user’s intent. Includes the name of the intent, the confidence that Amazon Lex has that the user’s intent is satisfied, and the slots defined for the intent.
See moreDeclaration
Objective-C
@interface AWSLexPredictedIntent
Swift
class AWSLexPredictedIntent
-
Declaration
Objective-C
@interface AWSLexPutSessionRequest
Swift
class AWSLexPutSessionRequest
-
Declaration
Objective-C
@interface AWSLexPutSessionResponse
Swift
class AWSLexPutSessionResponse
-
If you configure a response card when creating your bots, Amazon Lex substitutes the session attributes and slot values that are available, and then returns it. The response card can also come from a Lambda function (
See moredialogCodeHook
andfulfillmentActivity
on an intent).Declaration
Objective-C
@interface AWSLexResponseCard
Swift
class AWSLexResponseCard
-
The sentiment expressed in an utterance.
When the bot is configured to send utterances to Amazon Comprehend for sentiment analysis, this field structure contains the result of the analysis.
See moreDeclaration
Objective-C
@interface AWSLexSentimentResponse
Swift
class AWSLexSentimentResponse
-
Undocumented
See moreDeclaration
Objective-C
@interface AWSLexResources : NSObject + (instancetype)sharedInstance; - (NSDictionary *)JSONObject; @end
Swift
class AWSLexResources : NSObject
-
Amazon Lex provides both build and runtime endpoints. Each endpoint provides a set of operations (API). Your conversational bot uses the runtime API to understand user utterances (user input text or voice). For example, suppose a user says “I want pizza”, your bot sends this input to Amazon Lex using the runtime API. Amazon Lex recognizes that the user request is for the OrderPizza intent (one of the intents defined in the bot). Then Amazon Lex engages in user conversation on behalf of the bot to elicit required information (slot values, such as pizza size and crust type), and then performs fulfillment activity (that you configured when you created the bot). You use the build-time API to create and manage your Amazon Lex bot. For a list of build-time operations, see the build-time API, .
See moreDeclaration
Objective-C
@interface AWSLex
Swift
class AWSLex
-
Undocumented
See moreDeclaration
Objective-C
@interface AWSLexVoiceButtonResponse : NSObject /** Name of the intent being ellicited. */ @property (nonatomic, strong, readonly) NSString * _Nullable intent; /** Text response. */ @property (nonatomic, strong, readonly) NSString * _Nullable outputText; /** The slots which are currently filled in an ongoing dialog */ @property (nonatomic, strong, readonly) NSDictionary * _Nullable slots; /** The slot which is being ellicited for an intent. */ @property (nonatomic, strong, readonly) NSString * _Nullable elicitSlot; /** The current dialog state. */ @property (nonatomic, assign, readonly) AWSLexDialogState dialogState; /** The session attributes returned from the service. */ @property (nonatomic, strong, readonly) NSDictionary * _Nullable sessionAttributes; /** The audio stream . This may be null incase of a text response. */ @property (nonatomic, strong, readonly) NSData * _Nullable audioStream; /** The format for the audio stream. This may be null if the audion stream is null. */ @property (nonatomic, strong, readonly) NSString * _Nullable audioContentType; /** Transcript of the voice input to the operation. */ @property (nonatomic, strong, readonly) NSString * _Nullable inputTranscript; @end
Swift
class AWSLexVoiceButtonResponse : NSObject
-
Undocumented
See moreDeclaration
Objective-C
@interface AWSLexVoiceButton : UIView @property (nonatomic, weak) id<AWSLexVoiceButtonDelegate> delegate; /** Enable push transition animation when image switch between microphone and listen image. Default is NO. */ @property (nonatomic) BOOL animateOnImageSwitching; /** Set color for microphone image. Default is nil. */ @property (nonatomic, strong) UIColor *microphoneImageColor; /** Set color for inactive microphone image. Default is light grey. */ @property (nonatomic, strong) UIColor *lexImageColor; @property (nonatomic, strong) UIColor *errorColor; @end
Swift
class AWSLexVoiceButton : UIView