From 86df6c9a94ea40ae137fb5e16307fdd8a3baefa6 Mon Sep 17 00:00:00 2001 From: Mateusz Daniluk <121170681+VeithMetro@users.noreply.github.com> Date: Tue, 11 Feb 2025 09:34:53 +0100 Subject: [PATCH] [IPackager] Update with JSON-RPC interface (#412) * Adjust IPackager to use JSON-RPC, remove .json file * Add IPackager to definition on Windows * Remove Packager from defitions * Added DEPRECATED to the Configure() method * Update params to be present in the md --- definitions/Definitions.vcxproj | 4 -- definitions/Definitions.vcxproj.filters | 6 --- interfaces/IPackager.h | 22 +++++++-- jsonrpc/Packager.json | 62 ------------------------- 4 files changed, 19 insertions(+), 75 deletions(-) delete mode 100644 jsonrpc/Packager.json diff --git a/definitions/Definitions.vcxproj b/definitions/Definitions.vcxproj index 9620fd5e..dd2bbc6f 100644 --- a/definitions/Definitions.vcxproj +++ b/definitions/Definitions.vcxproj @@ -43,7 +43,6 @@ - @@ -324,9 +323,6 @@ Document - - Document - Document diff --git a/definitions/Definitions.vcxproj.filters b/definitions/Definitions.vcxproj.filters index 73e65dfd..e5058393 100644 --- a/definitions/Definitions.vcxproj.filters +++ b/definitions/Definitions.vcxproj.filters @@ -90,9 +90,6 @@ Generated Files - - Generated Files - Generated Files @@ -213,9 +210,6 @@ Contracts - - Contracts - Contracts diff --git a/interfaces/IPackager.h b/interfaces/IPackager.h index 532fe54d..2b3473c6 100644 --- a/interfaces/IPackager.h +++ b/interfaces/IPackager.h @@ -23,6 +23,7 @@ namespace Thunder { namespace Exchange { + // @json 1.0.0 @text:legacy_lowercase struct EXTERNAL IPackager : virtual public Core::IUnknown { enum { ID = ID_PACKAGER }; @@ -49,7 +50,7 @@ namespace Exchange { enum { ID = ID_PACKAGER_INSTALLATIONINFO }; virtual state State() const = 0; virtual uint8_t Progress() const = 0; - virtual string AppName() const = 0; + virtual string AppName() const = 0; virtual uint32_t ErrorCode() const = 0; virtual uint32_t Abort() = 0; }; @@ -67,10 +68,25 @@ namespace Exchange { virtual void RepositorySynchronize(uint32_t status) = 0; }; + // @json:omit virtual void Register(INotification* observer) = 0; + // @json:omit virtual void Unregister(const INotification* observer) = 0; - virtual uint32_t Configure(PluginHost::IShell* service) = 0; - virtual uint32_t Install(const string& name, const string& version, const string& arch) = 0; + // @json:omit + DEPRECATED virtual uint32_t Configure(PluginHost::IShell* service) = 0; + + // @brief Install a package given by a name, an URL or a file path + // @param name: Name, URL or file path of the package to install (e.g. thunder-plugin-netflix) + // @param version: Version of the package to install (e.g. 1.0) + // @param arch: Architecture of the package to install (e.g. arm) + // @retval ERROR_INPROGRESS Other installation/synchronization is already in progress + // @retval ERROR_GENERAL Opkg package manager not initialized successfully + virtual uint32_t Install(const string& name, const string& version /* @opptional */, const string& arch /* @opptional */) = 0; + + // @brief Synchronize repository manifest with a repository + // @alt::deprecated synchronize + // @retval ERROR_INPROGRESS Other installation/synchronization is already in progress + // @retval ERROR_GENERAL Opkg package manager not initialized successfully virtual uint32_t SynchronizeRepository() = 0; }; } diff --git a/jsonrpc/Packager.json b/jsonrpc/Packager.json deleted file mode 100644 index ab7b9d13..00000000 --- a/jsonrpc/Packager.json +++ /dev/null @@ -1,62 +0,0 @@ -{ - "$schema": "interface.schema.json", - "jsonrpc": "2.0", - "info": { - "version": "1.0.0", - "title": "Packager API", - "class": "Packager", - "description": "Packager JSON-RPC interface" - }, - "common": { - "$ref": "common.json" - }, - "methods": { - "install": { - "summary": "Installs a package given by a name, an URL or a file path", - "params": { - "type": "object", - "properties": { - "package": { - "description": "A name, an URL or a file path of the package to install", - "type": "string", - "example": "thunder-plugin-netflix" - }, - "version": { - "description": "Version of the package to install", - "type": "string", - "example": "1.0" - }, - "architecture": { - "description": "Architecture of the package to install", - "type": "string", - "example": "arm" - } - }, - "required": [ - "package" - ] - }, - "result": { - "$ref": "#/common/results/void" - }, - "errors": [ - { - "description": "Returned when the function is called while other installation/synchronization is already in progress.", - "$ref": "#/common/errors/inprogress" - } - ] - }, - "synchronize": { - "summary": "Synchronizes repository manifest with a repository", - "result": { - "$ref": "#/common/results/void" - }, - "errors": [ - { - "description": "Returned when the function is called while other installation/synchronization is already in progress.", - "$ref": "#/common/errors/inprogress" - } - ] - } - } -}