Skip to content

PackageManager API

Version: 1.0.0

Status: ⚫⚪⚪

PackageManager interface for Thunder framework.

(Defined with IPackageManager in IPackageManager.h)

Table of Contents

Introduction

Scope

This document describes purpose and functionality of the PackageManager interface (version 1.0.0). It includes detailed specification about its methods provided and notifications sent.

Case Sensitivity

All identifiers of the interfaces described in this document are case-sensitive. Thus, unless stated otherwise, all keywords, entities, properties, relations and actions should be treated as such.

Acronyms, Abbreviations and Terms

The table below provides and overview of acronyms used in this document and their definitions.

Acronym Description
API Application Programming Interface
HTTP Hypertext Transfer Protocol
JSON JavaScript Object Notation; a data interchange format
JSON-RPC A remote procedure call protocol encoded in JSON

The table below provides and overview of terms and abbreviations used in this document and their definitions.

Term Description
callsign The name given to an instance of a plugin. One plugin can be instantiated multiple times, but each instance the instance name, callsign, must be unique.

References

Ref ID Description
HTTP HTTP specification
JSON-RPC JSON-RPC 2.0 specification
JSON JSON specification
Thunder Thunder API Reference

Description

PackageManager JSON-RPC interface.

Methods

The following methods are provided by the PackageManager interface:

PackageManager interface methods:

Method Description
install Download the application bundle
uninstall Uninstall the application
download Download arbitrary application's resource file
reset Delete persistent data stored locally
getStorageDetails Information on the storage usage
setAuxMetadata Set an arbitrary metadata
clearAuxMetadata Clears an arbitrary metadata
getMetadata Get application metadata
cancel Cancel asynchronous request
getProgress Estimated progress of a request
getList List installed applications
lock Lock the application
unlock Unlock application
getLockInfo Get lock info

install method

Download the application bundle.

Parameters

Name Type M/O Description
params object mandatory ...
params.type string mandatory Type of the package
params.id string mandatory Id of the package
params.version string mandatory Version of the package
params.url string mandatory URL used to install package
params.appName string mandatory Application Name
params.category string mandatory Category of the package

Result

Name Type M/O Description
result string mandatory Handle to the active installtion that can be used to refer to it later. e.g. for canceling or progress information

Example

Request

{
  "jsonrpc": "2.0",
  "id": 42,
  "method": "<callsign>.1.install",
  "params": {
    "type": "...",
    "id": "...",
    "version": "...",
    "url": "...",
    "appName": "...",
    "category": "..."
  }
}

Response

{
  "jsonrpc": "2.0",
  "id": 42,
  "result": "..."
}

uninstall method

Uninstall the application.

Parameters

Name Type M/O Description
params object mandatory ...
params.type string mandatory Type of the package
params.id string mandatory Id of the package
params.version string mandatory Version of the package
params.uninstallType string mandatory Type of uninstall

Result

Name Type M/O Description
result string mandatory Handle to the active uninstallation that can be used to refer to it later. e.g. for canceling or progress information

Example

Request

{
  "jsonrpc": "2.0",
  "id": 42,
  "method": "<callsign>.1.uninstall",
  "params": {
    "type": "...",
    "id": "...",
    "version": "...",
    "uninstallType": "..."
  }
}

Response

{
  "jsonrpc": "2.0",
  "id": 42,
  "result": "..."
}

download method

Download arbitrary application's resource file.

Parameters

Name Type M/O Description
params object mandatory ...
params.type string mandatory Type of the package
params.id string mandatory Id of the package
params.version string mandatory Version of the package
params.resKey string mandatory Resorce Key
params.url string mandatory URL used to download package

Result

Name Type M/O Description
result string mandatory Handle to the active download that can be used to refer to it later. e.g. for canceling or progress information

Example

Request

{
  "jsonrpc": "2.0",
  "id": 42,
  "method": "<callsign>.1.download",
  "params": {
    "type": "...",
    "id": "...",
    "version": "...",
    "resKey": "...",
    "url": "..."
  }
}

Response

{
  "jsonrpc": "2.0",
  "id": 42,
  "result": "..."
}

reset method

Delete persistent data stored locally.

Parameters

Name Type M/O Description
params object mandatory ...
params.type string mandatory Type of the package
params.id string mandatory Id of the package
params.version string mandatory Version of the package
params.resetType string mandatory Type of Reset

Result

Name Type M/O Description
result null mandatory Always null

Example

Request

{
  "jsonrpc": "2.0",
  "id": 42,
  "method": "<callsign>.1.reset",
  "params": {
    "type": "...",
    "id": "...",
    "version": "...",
    "resetType": "..."
  }
}

Response

{
  "jsonrpc": "2.0",
  "id": 42,
  "result": null
}

getStorageDetails method

Information on the storage usage.

Parameters

Name Type M/O Description
params object mandatory ...
params.type string mandatory Type of the package
params.id string mandatory Id of the package
params.version string mandatory Version of the package

Result

Name Type M/O Description
result object mandatory Info about Storage
result.apps object mandatory Storage details of application
result.apps.path string mandatory Path of Storage
result.apps.quotaKb string mandatory Total Space allowed in KB
result.apps.usedKb string mandatory Used Space in KB
result.persistent object mandatory Storage details of persistent
result.persistent.path string mandatory Path of Storage
result.persistent.quotaKb string mandatory Total Space allowed in KB
result.persistent.usedKb string mandatory Used Space in KB

Example

Request

{
  "jsonrpc": "2.0",
  "id": 42,
  "method": "<callsign>.1.getStorageDetails",
  "params": {
    "type": "...",
    "id": "...",
    "version": "..."
  }
}

Response

{
  "jsonrpc": "2.0",
  "id": 42,
  "result": {
    "apps": {
      "path": "...",
      "quotaKb": "...",
      "usedKb": "..."
    },
    "persistent": {
      "path": "...",
      "quotaKb": "...",
      "usedKb": "..."
    }
  }
}

setAuxMetadata method

Set an arbitrary metadata.

Parameters

Name Type M/O Description
params object mandatory ...
params.type string mandatory Type of the package
params.id string mandatory Id of the package
params.version string mandatory Version of the package
params.key string mandatory Key used to set arbitrary meta data
params.value string mandatory Value of given key

Result

Name Type M/O Description
result null mandatory Always null

Example

Request

{
  "jsonrpc": "2.0",
  "id": 42,
  "method": "<callsign>.1.setAuxMetadata",
  "params": {
    "type": "...",
    "id": "...",
    "version": "...",
    "key": "...",
    "value": "..."
  }
}

Response

{
  "jsonrpc": "2.0",
  "id": 42,
  "result": null
}

clearAuxMetadata method

Clears an arbitrary metadata.

Parameters

Name Type M/O Description
params object mandatory ...
params.type string mandatory Type of the package
params.id string mandatory Id of the package
params.version string mandatory Version of the package
params.key string mandatory Key used to clear arbitrary meta data

Result

Name Type M/O Description
result null mandatory Always null

Example

Request

{
  "jsonrpc": "2.0",
  "id": 42,
  "method": "<callsign>.1.clearAuxMetadata",
  "params": {
    "type": "...",
    "id": "...",
    "version": "...",
    "key": "..."
  }
}

Response

{
  "jsonrpc": "2.0",
  "id": 42,
  "result": null
}

getMetadata method

Get application metadata.

Parameters

Name Type M/O Description
params object mandatory ...
params.type string mandatory Type of the package
params.id string mandatory Id of the package
params.version string mandatory Version of the package

Result

Name Type M/O Description
result object mandatory ...
result.metadata object mandatory Payload of meta data
result.metadata.appName string mandatory Name of the application
result.metadata.type string mandatory Type of the package
result.metadata.category string mandatory Category of the package
result.metadata.url string mandatory URL used for operation
result.resources array mandatory Resources
result.resources[#] object mandatory ...
result.resources[#].key string mandatory Key
result.resources[#].value string mandatory Value
result.auxMetadata array mandatory Arbitrary metadata
result.auxMetadata[#] object mandatory ...
result.auxMetadata[#].key string mandatory Key
result.auxMetadata[#].value string mandatory Value

Example

Request

{
  "jsonrpc": "2.0",
  "id": 42,
  "method": "<callsign>.1.getMetadata",
  "params": {
    "type": "...",
    "id": "...",
    "version": "..."
  }
}

Response

{
  "jsonrpc": "2.0",
  "id": 42,
  "result": {
    "metadata": {
      "appName": "...",
      "type": "...",
      "category": "...",
      "url": "..."
    },
    "resources": [
      {
        "key": "...",
        "value": "..."
      }
    ],
    "auxMetadata": [
      {
        "key": "...",
        "value": "..."
      }
    ]
  }
}

cancel method

Cancel asynchronous request.

Parameters

Name Type M/O Description
params object mandatory ...
params.handle string mandatory Handle of the currently progressing operation (i.e, install/uninstal/download)

Result

Name Type M/O Description
result null mandatory Always null

Example

Request

{
  "jsonrpc": "2.0",
  "id": 42,
  "method": "<callsign>.1.cancel",
  "params": {
    "handle": "..."
  }
}

Response

{
  "jsonrpc": "2.0",
  "id": 42,
  "result": null
}

getProgress method

Estimated progress of a request.

Parameters

Name Type M/O Description
params object mandatory ...
params.handle string mandatory Handle of the currently progressing operation (i.e, install/uninstal/download)

Result

Name Type M/O Description
result integer mandatory Indication of installation progress

Example

Request

{
  "jsonrpc": "2.0",
  "id": 42,
  "method": "<callsign>.1.getProgress",
  "params": {
    "handle": "..."
  }
}

Response

{
  "jsonrpc": "2.0",
  "id": 42,
  "result": 0
}

getList method

List installed applications.

Parameters

Name Type M/O Description
params object mandatory ...
params.type string mandatory Type of the package
params.id string mandatory Id of the package
params.version string mandatory Version of the package
params.appName string mandatory Application Name
params.category string mandatory Category of the package

Result

Name Type M/O Description
result array mandatory Ids of Installed Package
result[#] object mandatory ...
result[#].id string mandatory Unique identifier of the package
result[#].version string mandatory Version of the package

Example

Request

{
  "jsonrpc": "2.0",
  "id": 42,
  "method": "<callsign>.1.getList",
  "params": {
    "type": "...",
    "id": "...",
    "version": "...",
    "appName": "...",
    "category": "..."
  }
}

Response

{
  "jsonrpc": "2.0",
  "id": 42,
  "result": [
    {
      "id": "...",
      "version": "..."
    }
  ]
}

lock method

Lock the application. Preventing uninstallation.

Parameters

Name Type M/O Description
params object mandatory ...
params.type string mandatory Type of the package
params.id string mandatory Id of the package
params.version string mandatory Version of the package
params.reason string mandatory Reason to lock the application
params.owner string mandatory Owner used to lock

Result

Name Type M/O Description
result string mandatory Handle to the lock that can be used to refer to it later. e.g. for unlock later

Example

Request

{
  "jsonrpc": "2.0",
  "id": 42,
  "method": "<callsign>.1.lock",
  "params": {
    "type": "...",
    "id": "...",
    "version": "...",
    "reason": "...",
    "owner": "..."
  }
}

Response

{
  "jsonrpc": "2.0",
  "id": 42,
  "result": "..."
}

unlock method

Unlock application.

Parameters

Name Type M/O Description
params object mandatory ...
params.handle string mandatory Handle got during the Lock, it is to be used to Unlock operation

Result

Name Type M/O Description
result null mandatory Always null

Example

Request

{
  "jsonrpc": "2.0",
  "id": 42,
  "method": "<callsign>.1.unlock",
  "params": {
    "handle": "..."
  }
}

Response

{
  "jsonrpc": "2.0",
  "id": 42,
  "result": null
}

getLockInfo method

Get lock info.

Parameters

Name Type M/O Description
params object mandatory ...
params.type string mandatory Type of the package
params.id string mandatory Id of the package
params.version string mandatory Version of the package

Result

Name Type M/O Description
result object mandatory Info about Lock
result.reason string mandatory Reason of Locking
result.owner string mandatory Owner of Locking

Example

Request

{
  "jsonrpc": "2.0",
  "id": 42,
  "method": "<callsign>.1.getLockInfo",
  "params": {
    "type": "...",
    "id": "...",
    "version": "..."
  }
}

Response

{
  "jsonrpc": "2.0",
  "id": 42,
  "result": {
    "reason": "...",
    "owner": "..."
  }
}

Notifications

Notifications are autonomous events triggered by the internals of the implementation and broadcasted via JSON-RPC to all registered observers. Refer to [Thunder] for information on how to register for a notification.

The following events are provided by the PackageManager interface:

PackageManager interface events:

Notification Description
operationStatus Completion of asynchronous operation

operationStatus notification

Completion of asynchronous operation.

Notification Parameters

Name Type M/O Description
params object mandatory ...
params.handle string mandatory Handle of the currently progressing operation (i.e, install/uninstal/download)
params.operation string mandatory Type of the operation
params.type string mandatory Type of the package
params.id string mandatory Id of the package
params.version string mandatory Version of the package
params.status string mandatory Current status of the operation
params.details string mandatory Details about the operation

Example

Registration

{
  "jsonrpc": "2.0",
  "id": 42,
  "method": "<callsign>.1.register",
  "params": {
    "event": "operationStatus",
    "id": "myid"
  }
}

Notification

{
  "jsonrpc": "2.0",
  "method": "myid.operationStatus",
  "params": {
    "handle": "...",
    "operation": "...",
    "type": "...",
    "id": "...",
    "version": "...",
    "status": "...",
    "details": "..."
  }
}

The client ID parameter is passed within the notification designator, i.e. <client-id>.operationStatus.