npm i @plentra/sphereclient
Import
import { SphereClient } from '@plentra/sphereclient';
Initialization
...
let sphereClient = new SphereClient("YOUR-APP-KEY")
Home launcher is the main launcher of your app containing launcher items that link to either items belonging to a particular category or a sub launcher.It also acts as a source for special features such as popup and message (It is intended to launch during the initial launch of your application).
Home launcher is the main launcher of your app containing launcher items that link to either items belonging to a particular category or a sub launcher.It also acts as a source for special features such as popup and message (It is intended to launch during the initial launch of your application).
sphereClient.getHome({
onResult( appName , appIcon , totalItemCount , itemsInThisPage , itemsPerPage , items ){
//do on result
},
onLoading(){
//do when loading
},
onLoadfinished(){
//do when loading finished
},
onPopup( popupTitle , popupMessage ){
//do when popup
},
onAnnouncement( announcementBody ){
//do when announcement
},
onMessage( messageTitle , messageBody ){
//do when message
},
onAppLocation( appLocation , latitude , longitude ){
//do when app location
},
onNextPage(){
//do when next page exists
},
onHomeCover( cover ){
//do when there is a home cover
},
onEmpty(appName , appIcon){
//do when home launcher items are empty
},
onError(error){
//do when error
},
onUnderConstruction(){
//do when under construction
},
onNotActive(){
//do when app is not active
},
onNotExist(){
//do when app does not exist
},
onNotFound(){
//do when page not found
},
onNotAcceptable(){
//do when there is illegal client request
},
onBadRequest(){
//do when there is bad request from client
},
onNoNextPage(){
//do when there is no next page
},
}
)
Methods | description |
---|---|
onResult(String appName , String appIcon , int totalItemCount , int itemsInThisPage , int itemsPerPage , HomeItems[] items) | This method provides App's name,icon,total number of items available in home launcher, number of items available in current page , max number of items that can be available in current page and array of items as HomeItems instance (This method is called only when home launcher items are available). |
onLoading() | This method is called when the library is fetching the data from the servers (You can display a loading screen on this method call). |
onLoadfinished() | This method is called when the library has successfully fetched the data from the servers (You can stop displaying the loading screen on this method call). |
onPopup(String popupTitle , String popupBody) | This method is called when there is a popup enabled in your app.It provides the popup title and popup body. |
onAnnouncement(String announcementBody) | This method is called when there is announcement enabled in your app.It provides the announcemment body. |
onMessage(String messageTitle , String messageBody) | This method is called when there is a message enabled in your app.It provides the message title and message body. |
onAppLocation(String appLocation, double latitude, double longitude) | This method is called when business location is available in your app.It provides app's location , latitude and longitude. |
onNextPage() | This method is called when next page is available so that the home launcher items available in the next page can be loaded. |
onHomeCover(String cover) | This method is called when cover is available for the home launcher. |
onEmpty(String appName, String appIcon) | This method is called when there are no home launcher items.This provides app's name and icon. |
onError(VolleyError error) | This method is called when an error has occured in the internal volley library used for fetching the data such as a network error. |
onUnderConstruction() | This method is called when the under construction mode is enabled in the app. |
onNotActive() | This method is called when your app is not active due to subscription expiration. |
onNotExist() | This method is called when your app is removed or is temporarily banned. |
onNotFound() | This method is called when home launcher or current page is not available. |
onNotAcceptable() | This method is called when there is illegal client request. |
onBadRequest() | This method is called when there is a bad request from client. |
onNoNextPage() | This method is called when next page is not available. |
You can access home launcher properties by calling getLauncherLoadMore method on the sphereClient object.The getHomeLoadMore method has single argument that accepts GetHomeLoadMore interface.
sphereClient.getHomeLoadMore({
onResult( totalItemCount , itemsInThisPage , itemsPerPage , items ){
//do on result
},
onLoading(){
//do when loading
},
onLoadfinished(){
//do when loading finished
},
onNextPage(){
//do when next page exists
},
onEmpty(){
//do when home launcher items are empty
},
onError(error){
//do when error
},
onUnderConstruction(){
//do when under construction
},
onNotActive(){
//do when app is not active
},
onNotExist(){
//do when app does not exist
},
onNotFound(){
//do when page not found
},
onNotAcceptable(){
//do when there is illegal client request
},
onBadRequest(){
//do when there is bad request from client
},
onNoNextPage(){
//do when there is no next page
},
});
Methods | description |
---|---|
onResult(int totalItemCount , int itemsInThisPage , int itemsPerPage , HomeItems[] items) | This method provides total number of items available in this page, number of items available in current page , max number of items that can be available in current page and array of items as HomeItems instance (This method is called only when home launcher items are available). |
onLoading() | This method is called when the library is fetching the data from the servers (You can display load more progress bar on this method call). |
onLoadfinished() | This method is called when the library has successfully fetched the data from the servers (You can stop displaying the progress bar on this method call). |
onNextPage() | This method is called when next page is available so that the home launcher items available in the next page can be loaded. |
onEmpty() | This method is called when there are no home launcher items in this page. |
onError(VolleyError error) | This method is called when an error has occured in the internal volley library used for fetching the data such as a network error. |
onUnderConstruction() | This method is called when the under construction mode is enabled in the app. |
onNotActive() | This method is called when your app is not active due to subscription expiration. |
onNotExist() | This method is called when your app is removed or is temporarily banned. |
onNotFound() | This method is called when home launcher or current page is not available. |
onNotAcceptable() | This method is called when there is illegal client request. |
onBadRequest() | This method is called when there is a bad request from client. |
onNoNextPage() | This method is called when next page is not available. |
Every item you add is linked to a category.
You can access all the items belonging to a category by calling getItems method on the sphereClient object.The getItems method has two arguments that accepts getItems interface and item category id .
sphereClient.getItems(categoryId , {
onResult( appName , appIcon , categoryName, categoryIcon , totalItemCount , itemsInThisPage , itemsPerPage , items){
//do on result
},
onLoading(){
//do when loading
},
onLoadfinished(){
//do when loading finished
},
onAnnouncement( announcementBody ){
//do when announcement
},
onAppLocation( appLocation , latitude , longitude ){
//do when app location
},
onNextPage(){
//do when page exists
},
onHomeCover( cover ){
//do when there is a home cover
},
onEmpty(appName , appIcon , categoryName, categoryIcon){
//do when items are empty
},
onError(error){
//do when error
},
onUnderConstruction(){
//do when construction
},
onNotActive(){
//do when app is not active
},
onNotExist(){
//do when app does not exist
},
onNotFound(){
//do when page not found
},
onNotAcceptable(){
//do when there is illegal client request
},
onBadRequest(){
//do when there is bad request from client
},
onNoNextPage(){
//do when there is no next page
},
})
Methods | description |
---|---|
onResult(String appName, String appIcon, String categoryName, String categoryIcon, int totalItemCount, int itemsInThisPage, int itemsPerPage, Items[] items) | This method provides App's name,icon ,category name,category icon,total number of items available in the current page, number of items available , max number of items that can be available in current page and array of items as Items instance (This method is called only when items belonging to this category are available in this page ). |
onLoading() | This method is called when the library is fetching the data from the servers (You can display a loading screen on this method call). |
onLoadfinished() | This method is called when the library has successfully fetched the data from the servers (You can stop displaying the loading screen on this method call). |
onAnnouncement(String announcementBody) | This method is called when there is announcement enabled in your app.It provides the announcemment body. |
onAppLocation(String appLocation, double latitude, double longitude) | This method is called when business location is available in your app.It provides app's location , latitude and longitude. |
onNextPage() | This method is called when next page is available so that the items available in the next page can be loaded. |
onHomeCover(String cover) | This method is called when cover is available. |
onEmpty(String appName, String appIcon) | This method is called when there are no home launcher items.This provides app's name and icon. |
onError(VolleyError error) | This method is called when an error has occured in the internal volley library used for fetching the data such as a network error. |
onUnderConstruction() | This method is called when the under construction mode is enabled in the app. |
onNotActive() | This method is called when your app is not active due to subscription expiration. |
onNotExist() | This method is called when your app is removed or is temporarily banned. |
onNotFound() | This method is called when home launcher or current page is not available. |
onNotAcceptable() | This method is called when there is illegal client request. |
onBadRequest() | This method is called when there is a bad request from client. |
onNoNextPage() | This method is called when next page is not available. |
You can access more items belonging to a category by calling getItemsLoadMore method on the sphereClient object.This iterates the next page available and loads the properties of that page everytime this method is called.The getItemsLoadMore method has two arguments that accepts GetItemsLoadMore interface and category id.
sphereClient.getItemsLoadMore(categoryId , {
onResult(totalItemCount , itemsInThisPage , itemsPerPage , items){
//do on result
},
onLoading(){
//do when loading
},
onLoadfinished(){
//do when loading finished
},
onNextPage(){
//do when next page exists
},
onEmpty(){
//do when items are empty
},
onError(error){
//do when error
},
onUnderConstruction(){
//do when construction
},
onNotActive(){
//do when app is not active
},
onNotExist(){
//do when app does not exist
},
onNotFound(){
//do when page not found
},
onNotAcceptable(){
//do when there is illegal from client
},
onBadRequest(){
//do when there is bad request from client
},
onNoNextPage(){
//do when there is no next page
},
});
Methods | description |
---|---|
onResult(int totalItemCount, int itemsInThisPage, int itemsPerPage, Items[] items) | This method provides total number of items available in the current page, number of items available , max number of items that can be available in current page and array of items as Items instance (This method is called only when items are available in the page). |
onLoading() | This method is called when the library is fetching the data from the servers (You can display a progress bar on this method call). |
onLoadFinished() | This method is called when the library has successfully fetched data from the servers (You can stop displaying the progress bar on this method call). |
onNextPage() | This method is called when next page is available so that the items available in the next page can be loaded. |
onEmpty() | This method is called when there are no home launcher items. |
onError(VolleyError error) | This method is called when an error has occured in the internal volley library used for fetching the data such as a network error. |
onUnderConstruction() | This method is called when the under construction mode is enabled in the app. |
onNotActive() | This method is called when your app is not active due to subscription expiration. |
onNotExist() | This method is called when your app is removed or is temporarily banned. |
onNotFound() | This method is called when home launcher or current page is not available. |
onNotAcceptable() | This method is called when there is illegal client request. |
onBadRequest() | This method is called when there is a bad request from client. |
onNoNextPage() | This method is called when next page is not available. |
Just like the home launcher the sub launcher contains launcher items that are linked either to a category or other sub launcher.
You can access all the properties of sub launcher by calling getLauncher method on the sphereClient object.The getLauncher method has two arguments that accepts getLauncher interface and launcher id
sphereClient.getLauncher(launcherId , {
onResult( appName , appIcon , launcherName, launcherIcon , totalItemCount , itemsInThisPage , itemsPerPage , items ){
//do on result
},
onLoading(){
//do when loading
},
onLoadfinished(){
//do when loading finished
},
onAnnouncement( announcementBody ){
//do when announcement
},
onAppLocation( appLocation , latitude , longitude ){
//do when app location
},
onNextPage(){
//do when next page exists
},
onLauncherCover( cover ){
//do when there is launcher cover
},
onEmpty(appName , appIcon , launcherName, launcherIcon){
//do when launcher items are empty
},
onError(error){
//do when error
},
onUnderConstruction(){
//do when under construction
},
onNotActive(){
//do when app is not active
},
onNotExist(){
//do when app does not exist
},
onNotFound(){
//do when page not found
},
onNotAcceptable(){
//do when there is illegal client request
},
onBadRequest(){
//do when there is bad request from client
},
onNoNextPage(){
//do when there is no next page
},
});
Methods | description |
---|---|
onResult(String appName, String appIcon, String launcherName, String launcherIcon, int totalItemCount, int itemsInThisPage, int itemsPerPage, LauncherItems[] items) | This method provides App's name,icon ,launcher name,launcher icon,total number of launcher items available in the current page, number of launcher items available , max number of launcher items that can be available in current page and array of launcher items as LauncherItems instance (This method is called only when launcher items are available in this page). |
onLoading() | This method is called when the library is fetching the data from the servers (You can display a loading screen on this method call). |
onLoadfinished() | This method is called when the library has successfully fetched the data from the servers (You can stop displaying the loading screen on this method call). |
onAnnouncement(String announcementBody) | This method is called when there is announcement enabled in your app.It provides the announcemment body. |
onAppLocation(String appLocation, double latitude, double longitude) | This method is called when business location is available in your app.It provides app's location , latitude and longitude. |
onNextPage() | This method is called when next page is available so that the items available in the next page can be loaded. |
onLauncherCover(String cover) | This method is called when launcher cover is available. |
onEmpty(String appName, String appIcon, String launcherName, String launcherIcon) | This method is called when there are no launcher items.This provides app's name,icon,launcher name and launcher icon. |
onError(VolleyError error) | This method is called when an error has occured in the internal volley library used for fetching the data such as a network error. |
onUnderConstruction() | This method is called when the under construction mode is enabled in the app. |
onNotActive() | This method is called when your app is not active due to subscription expiration. |
onNotExist() | This method is called when your app is removed or is temporarily banned. |
onNotFound() | This method is called when home launcher or current page is not available. |
onNotAcceptable() | This method is called when there is illegal client request. |
onBadRequest() | This method is called when there is a bad request from client. |
onNoNextPage() | This method is called when next page is not available. |
You can access more sub launcher items by calling getLauncherLoadMore method on the sphereClient object.This iterates the next page available and loads the properties of that page everytime this method is called.The getLauncherLoadMore method has two arguments that accepts GetLauncherLoadMore interface and launcher id.
sphereClient.getLauncherLoadMore(launcherId , {
onResult(totalItemCount , itemsInThisPage , itemsPerPage , items ){
//do on result
},
onLoading(){
//do when loading
},
onLoadfinished(){
//do when loading finished
},
onNextPage(){
//do when next page exists
},
onEmpty(){
//do when launcher items are empty
},
onError(error){
//do when error
},
onUnderConstruction(){
//do when under construction
},
onNotActive(){
//do when app is not active
},
onNotExist(){
//do when app does not exist
},
onNotFound(){
//do when page not found
},
onNotAcceptable(){
//do when there is illegal client request
},
onBadRequest(){
//do when there is bad request from client
},
onNoNextPage(){
//do when there is no next page
},
});
Methods | description |
---|---|
onResult(int totalItemCount, int itemsInThisPage, int itemsPerPage, LauncherItems[] items) | This method provides total number of launcher items available in the current page, number of launcher items available , max number of launcher items that can be available in current page and array of launcher items as LauncherItems instance (This method is called only when launcher items are available in this page). |
onLoading() | This method is called when the library is fetching the data from the servers (You can display a progress bar on this method call). |
onLoadfinished() | This method is called when the library has successfully fetched the data from the servers (You can stop displaying the progress bar on this method call). |
onNextPage() | This method is called when next page is available so that the items available in the next page can be loaded. |
onEmpty() | This method is called when there are no launcher items. |
onError(VolleyError error) | This method is called when an error has occured in the internal volley library used for fetching the data such as a network error. |
onUnderConstruction() | This method is called when the under construction mode is enabled in the app. |
onNotActive() | This method is called when your app is not active due to subscription expiration. |
onNotExist() | This method is called when your app is removed or is temporarily banned. |
onNotFound() | This method is called when home launcher or current page is not available. |
onNotAcceptable() | This method is called when there is illegal client request. |
onBadRequest() | This method is called when there is a bad request from client. |
onNoNextPage() | This method is called when next page is not available. |
You can access all the item properties by calling GetItem method on the sphereClient object.The GetItem method has two arguments that accepts getItem interface and item id.
sphereClient.getItem(id , {
onResult(appName , appIcon , itemName ,extras , body ,itemCategoryName ,itemImages , itemImage){
//do on result
},
onLoading(){
//do when loading
},
onLoadfinished(){
//do when loading finished
},
onAnnouncement(announcementBody){
//do when announcement
},
onAppLocation(appLocation ,latitude ,longitude ){
//do when app location
},
onHomeCover(cover){
//do when there is home cover
},
onError(error){
//do when error
},
onUnderConstruction(){
//do when under construction
},
onNotActive(){
//do when app is not active
},
onNotExist(){
//do when app does not exist
},
onNotFound(){
//do when page not found
},
onNotAcceptable(){
//do when there is illegal client request
},
onBadRequest(){
//do when there is bad request from client
},
})
});
Methods | description |
---|---|
onResult(String appName, String appIcon, String itemName, JSONObject extras_, String body, String itemCategoryName, JSONObject itemImages_, String itemImage) | This method provides App's name,icon ,item name,item extras,item body,item's category name,item gallery images and item image. |
onLoading() | This method is called when the library is fetching the data from the servers (You can display a loading screen on this method call). |
onLoadfinished() | This method is called when the library has successfully fetched the data from the servers (You can stop displaying the loading screen on this method call). |
onAnnouncement(String announcementBody) | This method is called when there is announcement enabled in your app.It provides the announcemment body. |
onAppLocation(String appLocation, double latitude, double longitude) | This method is called when business location is available in your app.It provides app's location , latitude and longitude. |
onHomeCover(String cover) | This method is called when home cover is available. |
onError(VolleyError error) | This method is called when an error has occured in the internal volley library used for fetching the data such as a network error. |
onUnderConstruction() | This method is called when the under construction mode is enabled in the app. |
onNotActive() | This method is called when your app is not active due to subscription expiration. |
onNotExist() | This method is called when your app is removed or is temporarily banned. |
onNotFound() | This method is called when home launcher or current page is not available. |
onNotAcceptable() | This method is called when there is illegal client request. |
onBadRequest() | This method is called when there is a bad request from client. |
You can reach us any time
Mon - Fri 09:00 - 18:00
+91 9429693099
Copyright Ⓒ 2023 Plentra Technologies Pvt Ltd