Skip to content

Structure changes and bug fix

Compare
Choose a tag to compare
@xVir xVir released this 07 Feb 09:14
· 87 commits to master since this release

Several changes in the Cordova SDK to make the use of the SDK easier:

  1. Changed signature of the initialization method. Now you should pass keys and other parameters wrapped in a JSON object
  ApiAIPlugin.init(
     {
       subscriptionKey: 'subscriptionKey',
       clientAccessToken: 'clientAccessToken',
       lang: 'en'
     },
     function () {
      alert("Init success");
     },
     function (error) {
      alert("Init error\n" + error);
  });
  1. You don't need to pass language code in the request method. Language settings are picked up from the SDK configuration defined in the ApiAIPlugin.init() method.
  function sendVoice() {
      try {     
        ApiAIPlugin.requestVoice(
          {}, // empty for simple requests, some optional parameters can be here
          function (response) {
              // place your result processing here
              alert(JSON.stringify(response));
          },
          function (error) {
              // place your error processing here
              alert(error);
          });                
      } catch (e) {
          alert(e);
      }
  }
  1. Fixed bugs with wrong output format on Android platform and issues with initialization callbacks not being called.