Package Operations¶
Operations for managing Stash packages.
Bases: StashClientProtocol
Mixin for package-related client methods.
Functions¶
install_packages
async
¶
install_packages(
package_type: PackageType | str,
packages: list[PackageSpecInput] | list[dict[str, Any]],
) -> str
Install packages.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
package_type
|
PackageType | str
|
Type of packages to install (PackageType.SCRAPER or PackageType.PLUGIN) |
required |
packages
|
list[PackageSpecInput] | list[dict[str, Any]]
|
List of PackageSpecInput objects or dictionaries containing: - id: Package ID (required) - sourceURL: Source URL for the package (required) |
required |
Returns:
| Type | Description |
|---|---|
str
|
Job ID for the installation task |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the input data is invalid |
TransportError
|
If the request fails |
Examples:
Install a scraper package:
from stash_graphql_client.types import PackageType, PackageSpecInput
packages = [
PackageSpecInput(id="package-id", source_url="https://example.com/package.yml")
]
job_id = await client.install_packages(PackageType.SCRAPER, packages)
print(f"Installation job started: {job_id}")
Install multiple plugin packages using dictionaries:
update_packages
async
¶
update_packages(
package_type: PackageType | str,
packages: list[PackageSpecInput]
| list[dict[str, Any]]
| None = None,
) -> str
Update packages.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
package_type
|
PackageType | str
|
Type of packages to update (PackageType.SCRAPER or PackageType.PLUGIN) |
required |
packages
|
list[PackageSpecInput] | list[dict[str, Any]] | None
|
Optional list of PackageSpecInput objects or dictionaries containing: - id: Package ID (required) - sourceURL: Source URL for the package (required) If None, all packages of the given type will be updated. |
None
|
Returns:
| Type | Description |
|---|---|
str
|
Job ID for the update task |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the input data is invalid |
TransportError
|
If the request fails |
Examples:
Update all scraper packages:
from stash_graphql_client.types import PackageType
job_id = await client.update_packages(PackageType.SCRAPER)
print(f"Update job started: {job_id}")
Update specific plugin packages:
from stash_graphql_client.types import PackageType, PackageSpecInput
packages = [
PackageSpecInput(id="plugin-id", source_url="https://example.com/plugin.yml")
]
job_id = await client.update_packages(PackageType.PLUGIN, packages)
Update using dictionaries:
uninstall_packages
async
¶
uninstall_packages(
package_type: PackageType | str,
packages: list[PackageSpecInput] | list[dict[str, Any]],
) -> str
Uninstall packages.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
package_type
|
PackageType | str
|
Type of packages to uninstall (PackageType.SCRAPER or PackageType.PLUGIN) |
required |
packages
|
list[PackageSpecInput] | list[dict[str, Any]]
|
List of PackageSpecInput objects or dictionaries containing: - id: Package ID (required) - sourceURL: Source URL for the package (required) |
required |
Returns:
| Type | Description |
|---|---|
str
|
Job ID for the uninstallation task |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the input data is invalid |
TransportError
|
If the request fails |
Examples:
Uninstall a scraper package:
from stash_graphql_client.types import PackageType, PackageSpecInput
packages = [
PackageSpecInput(id="package-id", source_url="https://example.com/package.yml")
]
job_id = await client.uninstall_packages(PackageType.SCRAPER, packages)
print(f"Uninstallation job started: {job_id}")
Uninstall multiple plugin packages using dictionaries:
installed_packages
async
¶
installed_packages(
package_type: PackageType | str,
) -> list[Package]
List installed packages.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
package_type
|
PackageType | str
|
Type of packages to list (PackageType.SCRAPER or PackageType.PLUGIN) |
required |
Returns:
| Type | Description |
|---|---|
list[Package]
|
List of Package objects representing installed packages |
Raises:
| Type | Description |
|---|---|
TransportError
|
If the request fails |
Examples:
List all installed scrapers:
from stash_graphql_client.types import PackageType
packages = await client.installed_packages(PackageType.SCRAPER)
for pkg in packages:
print(f"{pkg.name} v{pkg.version} - {pkg.package_id}")
List all installed plugins:
available_packages
async
¶
available_packages(
package_type: PackageType | str, source: str
) -> list[Package]
List available packages from a source.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
package_type
|
PackageType | str
|
Type of packages to list (PackageType.SCRAPER or PackageType.PLUGIN) |
required |
source
|
str
|
Source URL to query for available packages |
required |
Returns:
| Type | Description |
|---|---|
list[Package]
|
List of Package objects representing available packages |
Raises:
| Type | Description |
|---|---|
TransportError
|
If the request fails |
Examples:
List available scrapers from official source:
from stash_graphql_client.types import PackageType
packages = await client.available_packages(
PackageType.SCRAPER,
"https://stashapp.github.io/scrapers"
)
for pkg in packages:
print(f"{pkg.name} v{pkg.version} - {pkg.package_id}")
List available plugins: