API reference
API reference
Select your platform
No SDKs available
No versions available

WitRequest Class

Manages a single request lifecycle when sending/receiving data from Wit.ai.
Note: This is not intended to be instantiated directly. Requests should be created with the WitRequestFactory

Properties

The wit Configuration to be used with this request
The request timeout in ms
Encoding settings for audio based requests
AudioEncoding audioEncoding[Get]
Endpoint to be used for this request
Final portion of the endpoint Path
Whether a post command should be called
Key value pair that is sent as a query param in the Wit.ai uri
Returns true if the response had begun
Returns true if the response had begun
Callback called when the server is ready to receive audio data from WitRequest's input stream.

Fields

byte [] postData[Get]
string postContentType[Get]
string forcedHttpMethodType[Get]
Returns true if the request is being performed
AudioDurationTracker audioDurationTracker[Get]
Returns the raw string response that was received before converting it to a JSON object.
NOTE: This response comes back on a different thread. Do not attempt ot set UI control values or other interactions from this callback. This is intended to be used for demo and test UI, not for regular use.
Provides an opportunity to customize the url just before a request executed

Protected Fields

override bool DecodeRawResponses[Get]

Events

Provides an opportunity to provide custom headers for the request just before it is executed.
Callback called when the server is ready to receive data from the WitRequest's input stream. See WitRequest.Write()
Returns a partial utterance from an in process request
NOTE: This response comes back on a different thread.
Returns a full utterance from a completed request
NOTE: This response comes back on a different thread.
Callback called when a response is received from the server off a partial transcription
Callback called when a response is received from the server

Public Statics

Allows customization of the request before it is sent out.
Note: This is for devs who are routing requests to their servers before sending data to Wit.ai. This allows adding any additional headers, url modifications, or customization of the request.

Member Functions

Simply return the Path to be called
delegate Dictionary< string, string > OnProvideCustomHeadersEvent ( )
delegate Uri OnCustomizeUriEvent
( UriBuilder uriBuilder )
delegate void PreSendRequestDelegate
( ref Uri src_uri,
out Dictionary< string, string > headers )
Initialize wit request with configuration & path to endpoint
Parameters
newConfiguration
newOptions
newEvents
Write request data to the Wit.ai post's body input stream
Note: If the stream is not open (IsActive) this will throw an IOException. Data will be written synchronously. This should not be called from the main thread.
Parameters
data
offset
length

Protected Functions

override void SetState
( VoiceRequestState newState )
Finalize initialization
override void HandleAudioActivation ( )
override void HandleAudioDeactivation ( )
override string GetSendError ( )
Start the async request for data from the Wit.ai servers
Called when raw response data has been received
override void OnPartialTranscription ( )
override void OnFullTranscription ( )
override void OnPartialResponse
( WitResponseNode responseNode )
override bool HasSentAudio ( )
override void HandleCancel ( )
override void OnComplete ( )
Did you find this page helpful?
Thumbs up icon
Thumbs down icon