humanapi cordova plugin for android & ios
v1.0.5
via npm
npm i cordova-plugin-humanapi
via cordova
cordova plugin add cordova-plugin-humanapi
via ionic
ionic cordova plugin add cordova-plugin-humanapi
For a detailed documentation 📔, please have a look at the Wiki.
-
The human API code for IOS is written in swift 4 language. In order to use this plugin, your project deployment target should be set to a minimum of 11.
-
In case your project doesn't have swift support, please add this plugin
-
The Xcode Version should be 10.0+
-
The swift version (found under Build Settings) in Xcode should be set to 4
Authentication
window.plugin.humanapi.auth("CLIENT_ID", "CLIENT_SECRET", "USER_ID", "PUBLIC_TOKEN", "ACCESS_TOKEN", function(result) {
alert("Result = " + result)
}, function(error) {
alert("Error = " + error)
})
Wellness Data
window.plugin.humanapi.execute("WELLNESS_NAME", "ACCESS_TOKEN", function(result) {
alert("Result = " + result)
}, function(error) {
alert("Error = " + error)
})
window.plugin.humanapi.executeByFilter("WELLNESS_NAME", "ACCESS_TOKEN", "FILTER_NAME", function(result) {
alert("Result = " + result)
}, function(error) {
alert("Error = " + error)
})
Sources Data
window.plugin.humanapi.execute("sources", "ACCESS_TOKEN", function(result) {
alert("Result = " + result)
}, function(error) {
alert("Error = " + error)
})
Authentication
var human: any = window
human.plugin.humanapi.auth("CLIENT_ID", "CLIENT_SECRET", "USER_ID", "PUBLIC_TOKEN", "ACCESS_TOKEN", (result) => {
alert("Result = " + result)
}, (error) => {
alert("Error = " + error)
})
Wellness Data
var human: any = window
human.plugin.humanapi.execute("WELLNESS_NAME", "ACCESS_TOKEN", (result) => {
alert("Result = " + result)
}, (error) => {
alert("Error = " + error)
})
human.plugin.humanapi.executeByFilter("WELLNESS_NAME", "ACCESS_TOKEN", "FILTER_NAME", (result) => {
alert("Result = " + result)
}, (error) => {
alert("Error = " + error)
})
Sources Data
var human: any = window
human.plugin.humanapi.execute("sources", "ACCESS_TOKEN", (result) => {
alert("Result = " + result)
}, (error) => {
alert("Error = " + error)
})
{
clientID: "CLIENT_ID",
clientSecret: "CLIENT_SECRET",
userID: "USER_ID",
humanID: "HUMAN_ID",
sessionToken: "SESSION_TOKEN",
publicToken: "PUBLIC_TOKEN",
accessToken: "ACCESS_TOKEN",
pluginMsg: "The plugin message if any"
}
{
humanAPIData: "WELLNESS_API_DATA",
key: "PASSED_KEY",
pluginMsg: "The plugin message if any"
}
Currently the plugin supports 17 wellness API's (excluding Genetic Traits & Genotypes). Please refer for the list of wellness API's and data formats here
{
humanAPIData: "SOURCES_API_DATA",
key: "PASSED_KEY",
pluginMsg: "The plugin message if any"
}
Please refer to sources data format here
For general plugin examples, please refer here
For a full fledged ionic example, please refer here