InventoryAPI¶
- class minim.api.discogs.InventoryAPI(client: APIClient, /)[source]¶
Bases:
DiscogsResourceAPIInventory Export and Inventory Upload API endpoints for the Discogs API.
Important
This class is managed by
DiscogsAPIClientand should not be instantiated directly.- Parameters:
- clientminim.api._shared.APIClient
API client instance used to make HTTP requests.
Methods
Inventory Export > Download an Export: Download the comma-separated values (CSV) for a Discogs marketplace inventory export.
Inventory Export > Export Your Inventory: Export the current user's Discogs marketplace inventory as comma-separated values (CSV).
Inventory > Get an Export: Get Discogs resource information for a marketplace inventory export.
Inventory Upload > Get an Upload: Get Discogs catalog information for a marketplace inventory upload.
Inventory Export > Get Recent Exports: Get Discogs resource information for the current user's recent marketplace inventory exports.
Inventory Upload > Get Recent Uploads: Get Discogs resource information for the current user's recent marketplace inventory uploads.
Inventory Upload > Add Inventory: Add Discogs marketplace listings by uploading comma-separated values (CSV).
Inventory Upload > Delete Inventory: Delete Discogs marketplace listings by uploading comma-separated values (CSV).
Inventory Upload > Change Inventory: Update Discogs marketplace listings by uploading comma-separated values (CSV).
- download_inventory_export(export_id: int | str, /, *, target: str | Path | None = None) bytes | Path[source]¶
Inventory Export > Download an Export: Download the comma-separated values (CSV) for a Discogs marketplace inventory export.
User authentication
- User authentication
Access protected endpoints.
- Parameters:
- export_idint or str; positional-only
Discogs ID of the inventory export.
Examples:
599632,"16105411".- targetstr or pathlib.Path; keyword-only; optional
Target directory or file. If provided, a CSV file is written in the specified folder or with the specified filename. Otherwise, the raw CSV data is returned.
- Returns:
- export_csvbytes or pathlib.Path
Raw CSV data or absolute path to the saved CSV file for the inventory export.
- export_my_inventory() str[source]¶
Inventory Export > Export Your Inventory: Export the current user’s Discogs marketplace inventory as comma-separated values (CSV).
User authentication
- User authentication
Access protected endpoints.
- Returns:
- resource_urlstr
Resource URL for the inventory export.
See also
get_inventory_export()– Get information for an inventory export.download_inventory_export()– Download an inventory export CSV.
- get_inventory_export(export_id: int | str, /) dict[str, Any][source]¶
Inventory > Get an Export: Get Discogs resource information for a marketplace inventory export.
User authentication
- User authentication
Access protected endpoints.
- Parameters:
- export_idint or str; positional-only
Discogs ID of the inventory export.
Examples:
599632,"16105411".
- Returns:
- exportdict[str, Any]
Discogs metadata for an inventory export.
Sample response
{ "id": <int>, "created_ts": <str>, "download_url": <str>, "filename": <str>, "finished_ts": <str>, "status": <str>, "url": <str>, }
- get_inventory_upload(upload_id: int | str, /) dict[str, Any][source]¶
Inventory Upload > Get an Upload: Get Discogs catalog information for a marketplace inventory upload.
User authentication
- User authentication
Access protected endpoints.
- Parameters:
- upload_idint or str; positional-only
Discogs ID of the inventory upload.
Examples:
119615,"119615".
- Returns:
- uploaddict[str, Any]
Discogs metadata for the inventory upload.
Sample response
{ "created_ts": <str>, "filename": <str>, "finished_ts": <str>, "id": <int>, "results": <str>, "status": <str>, "type": <str> }
- get_my_inventory_exports(*, limit: int | None = None, page: int | None = None) dict[str, Any][source]¶
Inventory Export > Get Recent Exports: Get Discogs resource information for the current user’s recent marketplace inventory exports.
User authentication
- User authentication
Access protected endpoints.
- Parameters:
- limitint; keyword-only; optional
Maximum number of exports to return.
Valid range:
1to100.API default:
50.- pageint; keyword-only; optional
Page number. Use with limit to get the next page of exports.
Minimum value:
1.API default:
1.
- Returns:
- exportsdict[str, Any]
Page of Discogs metadata for the current user’s recent inventory exports.
Sample response
{ "items": [ { "id": <int>, "created_ts": <str>, "download_url": <str>, "filename": <str>, "finished_ts": <str>, "status": <str>, "url": <str>, } ], "pagination": { "items": <int>, "page": <int>, "pages": <int>, "per_page": <int>, "urls": { "first": <str>, "last": <str>, "next": <str>, "prev": <str> } } }
- get_my_inventory_uploads(*, limit: int | None = None, page: int | None = None) dict[str, Any][source]¶
Inventory Upload > Get Recent Uploads: Get Discogs resource information for the current user’s recent marketplace inventory uploads.
User authentication
- User authentication
Access protected endpoints.
- Parameters:
- limitint; keyword-only; optional
Maximum number of uploads to return.
Valid range:
1to100.API default:
50.- pageint; keyword-only; optional
Page number. Use with limit to get the next page of uploads.
Minimum value:
1.API default:
1.
- Returns:
- uploadsdict[str, Any]
Page of Discogs metadata for the current user’s recent inventory uploads.
Sample response
{ "items": [ { "created_ts": <str>, "filename": <str>, "finished_ts": <str>, "id": <int>, "results": <str>, "status": <str>, "type": <str> } ], "pagination": { "items": <int>, "page": <int>, "pages": <int>, "per_page": <int>, "urls": { "first": <str>, "last": <str>, "next": <str>, "prev": <str> } } }
- upload_inventory_additions(inventory_csv: bytes | str | Path, /) str[source]¶
Inventory Upload > Add Inventory: Add Discogs marketplace listings by uploading comma-separated values (CSV).
User authentication
- User authentication
Access protected endpoints.
Note
Listings are marked as “For Sale”. Currency information is pulled from the current user’s marketplace settings.
- Parameters:
- inventory_csvbytes, str, or pathlib.Path; positional-only
Path to, name of, or contents of a CSV file containing the listings to add.
Required fields:
release_id,price,media_condition.Optional fields:
sleeve_condition,comments,accept_offer,location,external_id,weight,format_quantity.
- Returns:
- resource_urlstr
Resource URL to get Discogs metadata for the inventory upload.
See also
get_inventory_upload()– Get information for an inventory upload.
- upload_inventory_deletions(inventory_csv: bytes | str | Path, /) str[source]¶
Inventory Upload > Delete Inventory: Delete Discogs marketplace listings by uploading comma-separated values (CSV).
User authentication
- User authentication
Access protected endpoints.
- Parameters:
- inventory_csvstr or pathlib.Path; positional-only
Path to, name of, or contents of a CSV file containing the listings to delete.
Required field:
listing_id.
- Returns:
- resource_urlstr
Resource URL to get Discogs metadata for the inventory upload.
See also
get_inventory_upload()– Get information for an inventory upload.
- upload_inventory_updates(inventory_csv: bytes | str | Path, /) str[source]¶
Inventory Upload > Change Inventory: Update Discogs marketplace listings by uploading comma-separated values (CSV).
User authentication
- User authentication
Access protected endpoints.
Note
Currency information is pulled from the current user’s marketplace settings.
- Parameters:
- inventory_csvstr or pathlib.Path; positional-only
Path to, name of, or contents of a CSV file containing the listings to update.
Required field:
release_id.Optional fields:
price,media_condition,sleeve_condition,comments,accept_offer,location,external_id,weight,format_quantity.
- Returns:
- resource_urlstr
Resource URL to get Discogs metadata for the inventory upload.
See also
get_inventory_upload()– Get information for an inventory upload.