slicer_package_manager.api package

Submodules

slicer_package_manager.api.app module

The internal server API of Slicer Package Manager. Use these endpoints to create new applications, new releases, and upload or download application and extensions packages.

class slicer_package_manager.api.app.App

Bases: Resource

createNewRelease(name, app_id, app_revision, description, public)

Create a new release with the name within the application. The app_revision will be used to automatically choose this release when uploading an application or extension package with a matching application revision metadata.

Parameters:
  • name – Name of the new release

  • app_id – Application ID

  • app_revision – Revision of the application corresponding to this release

  • description – Description of the new release

  • public – Whether the release should be publicly visible

Returns:

The new release folder

createOrUpdateExtension(app_id, os, arch, baseName, repository_type, repository_url, revision, app_revision, description, icon_url, development_status, category, enabled, homepage, screenshots, contributors, dependency, license)

Create or update an extension item.

If a release identified by app_revision exists, it is used to create or lookup the corresponding release folder. Otherwise, a draft sub-folder named after app_revision is either used or created.

If an extension with matching metadata meta.baseName, meta.os, meta.arch and meta.app_revision is found, the extension name and other metadata are updated.

Parameters:
  • app_id – The ID of the application.

  • os – The operation system used for the extension.

  • arch – The architecture compatible with the extension.

  • baseName – The base name of the extension.

  • repository_type – The type of repository (github, gitlab, …).

  • repository_url – The Url of the repository.

  • revision – The revision of the extension.

  • app_revision – The revision of the application.

  • description – The description of the extension.

Returns:

The created/updated extension.

createOrUpdatePackage(app_id, os, arch, baseName, repository_type, repository_url, revision, version, description, pre_release, build_date)

Create or update a package item.

If a release identified by revision exists, it is used to create or lookup the corresponding release folder. Otherwise, a draft sub-folder named after revision is either used or created.

If a package with matching metadata meta.baseName, meta.os, meta.arch and meta.revision is found, the package name and other metadata are updated.

Parameters:
  • app_id – The ID of the application.

  • os – The operation system used for the package.

  • arch – The architecture compatible with the application package.

  • baseName – The base name of the package.

  • repository_type – The type of repository (github, gitlab, …).

  • repository_url – The Url of the repository.

  • revision – The revision of the application.

  • version – The version of the application.

  • description – Description of the application package

  • pre_release – Boolean to specify if the package is a full release ready to be distributed

  • build_date – The build timestamp specified as datetime string. Default set to current date and time.

Returns:

The created/updated package.

deleteApp(app_folder, progress)

Delete an application by ID.

Parameters:

app_folder – Application folder loaded using app_id route parameter.

Returns:

Confirmation message with the deleted application name

deleteExtension(app_id, ext_model)

Delete an extension by ID.

Parameters:
  • app_id – Application ID

  • ext_model – Extension model loaded using ext_id route parameter.

Returns:

The deleted extension

deletePackage(app_id, pkg_model)

Delete an application package by ID.

Parameters:
  • app_id – Application ID

  • pkg_model – Package model loaded using pkg_id route parameter.

Returns:

The deleted package

deleteReleaseByIdOrName(app_folder, release_id_or_name, progress)

Delete a release by ID or name.

Parameters:
  • app_folder – Application folder loaded using app_id route parameter.

  • release_id_or_name – Could be either the release ID or the release name

  • progress – Whether to record progress on this task

Returns:

Confirmation message with the deleted release name

getAllDraftReleases(app_id, revision, limit, offset, sort)

Get a list of all the draft release of an application. It’s also possible to filter this list by the metadata revision.

Parameters:
  • app_id – Application ID

  • revision – Revision of one of the draft release

Returns:

List of all release within the application

getDownloadStats(app_id)

Get all the download count of all the application and extension packages from an application.

Parameters:

app_id – Application ID

Returns:

The JSON document of all the download statistics

getExtensions(app_id, extension_name, release_id, extension_id, os, arch, app_revision, baseName, q, limit, sort, offset=0)

Get a list of extension which is filtered by some optional parameters. If the release_id provided correspond to the draft release, then you must provide the app_revision to use this parameters. If not, it will just be ignored.

Parameters:
  • app_id – Application ID

  • extension_name – Extension name

  • release_id – Release ID

  • extension_id – Extension ID

  • os – The operation system used for the extension.

  • arch – The architecture compatible with the extension.

  • app_revision – The revision of the application

  • baseName – The baseName of the extension

  • q – Text expected to be found in the extension name or description

Returns:

The list of extensions

getPackages(app_id, package_name, release_id_or_name, package_id, os, arch, revision, baseName, limit, offset, sort)

Get a list of package which is filtered by some optional parameters. If the release_id provided correspond to the draft release, then you must provide the revision to use this parameters. If not, it will just be ignored.

Parameters:
  • app_id – Application ID

  • package_name – Package name

  • release_id_or_name – Could be either the release ID or the release name

  • package_id – Package ID

  • os – The operation system used for the application package.

  • arch – The architecture compatible with the application package.

  • revision – The revision of the application

  • baseName – The baseName of the package

Returns:

The list of application packages

getReleases(app_id, release_id_or_name, limit, offset, sort)

Get a list of all the stable release of an application. You can also search for a specific release if you provide the release_id_or_name parameter. If the release_id_or_name parameter doesn’t correspond to any existing release, this will just return None.

Parameters:
  • app_id – Application ID

  • release_id_or_name – Could be either the release ID or the release name

Returns:

List of all release within the application or a specific release folder

initApp(name, app_description, collection_id, collection_name, collection_description, public)

Create the directory for start a new application. By default, without specifying a collection_id, it will create a new collection name either collection_name if provided, or ‘Applications’. If the collection ‘Applications already exist it will get it. Return the new application (as a folder) that always contain a default sub-folder named ‘draft’.

Parameters:
  • name – Name of the new application

  • app_description – Description of the new application

  • collection_id – Id of the collection within create the application

  • collection_name – Name of the collection which will be created

  • collection_description – Description of the new collection

  • public – Whether the new collection should be publicly visible

Returns:

The new application folder

listApp(app_id, collection_id, name, text, limit, offset, sort)

List existing applications base on some optional parameters. For searching application which aren’t in the default collection (Applications), the parameter collection_id need to be provided.

Parameters:
  • app_id – Application ID

  • collection_id – Collection ID

  • name – Name of the application

  • text – Provide text search on the name of the application

Returns:

List of applications