Skip to main content

Introduction to the SDK

Your Extension needs to interact with all the components on the platform, such as the side menu, the bottom image selector, notifications, modals, etc. To fulfil this function, we provide a Javascript SDK that will allow you to do so.

In a nutshell, the SDK provides a mechanism for you to perform operations on the main interface of the platform, either its web or mobile version. On the other hand, it also wraps commonly used functions of our APIs, making it much easier to call them.

Include the SDK in your code

To include the SDK in your code, simply add the public aura-package script in your HTML file, always make sure you use the latest version available!

  <script src="https://auraview.auravant.com/sdk/v1.0/aura-package_v1.0.js"></script>

Global variables

In the sdk, we have useful global variables to know the environment of our application.

platform

  • platform: tells us which device our application is running on, returns "web", "android" or "ios" as appropriate.
  if(platform=='web') {
console.log("Running extension from the web platform!")
}

token

  • token: provides us with a token in string format, necessary to use the APIs detailed here.
  fetch("https://api.auravant.com/api/getfields",{
headers:{
Authorization: "Bearer " + token
}
}).then(()=>{
console.log("Using the API with my token")
})

Organization of the functions

All SDK functions will be accessible through the avt namespace. Within that space there are different modules and within each module you will find the functions. For example if you want to execute the function 'hiAuravant()' of the module 'test' you must call avt.test.hiAuravant().

Synchronous and asynchronous functions

An important note before we start. Within the available functions you will see that all of them have an asynchronous version (you will notice since they have 'async' in their name) as well as in some cases synchronous versions will be available. It is important to mention that we recommend always using the asynchronous versions that return a promise.