Implemented the GET /marketplace/stats/{release_id} endpoint for the Open API specification document in the library target.

This commit is contained in:
2025-11-10 01:04:55 +01:00
parent e5f0430087
commit 57e07b8b0a
+52
View File
@@ -2312,6 +2312,42 @@ paths:
$ref: '#/components/responses/NotFound'
'500':
$ref: '#/components/responses/InternalError'
/marketplace/stats/{release_id}:
get:
tags:
- Marketplace
summary: Get some statistics of a release.
description: |
Retrieves some statistics for a release in a marketplace.
These statistics reflect the currentt state of a release in a marketplace, and include the number of items currently for sale, lowest listed price of any item for sale, and whether the item is blocked for sale in a marketplace.
This endpoints mandates that authentication is optional. In case of authentication, the lowest currency expressed in their own buyer currency, configurable in buyer settings by default, in the absence of the `curr_abbr` parameter in the query. Otherwise, the price expressed in US dollars, if no currency is provided.
Releases that have no items for sale in a marketplace returns no data in the `lowest_price` and `num_for_sale` keys. Releases that are blocked for sale will also have no data for these keys.
operationId: getStatistics
parameters:
- $ref: '#/components/parameters/ReleaseId'
- $ref: '#/components/parameters/Currency'
responses:
'200':
description: Successfully retrieved statistics for a given release.
headers:
X-Discogs-RateLimit:
$ref: '#/components/headers/RateLimit'
X-Discogs-RateLimit-Used:
$ref: '#/components/headers/RateLimitUsed'
X-Discogs-RateLimit-Remaining:
$ref: '#/components/headers/RateLimitRemaining'
content:
application/json:
schema:
description: A group of statistics for a release.
$ref: '#/components/schemas/ReleaseStatistics'
'404':
$ref: '#/components/responses/NotFound'
'500':
$ref: '#/components/responses/InternalError'
components:
headers:
Link:
@@ -4367,6 +4403,22 @@ components:
required:
- num_have
- num_want
ReleaseStatistics:
description: A type that represents the statistics of a release.
type: object
properties:
blocked_from_sale:
description: A flag that indicates whether a release is blocked from sale in a marketplace or not.
type: boolean
num_for_sale:
description: A number of items for sale in a marketplace.
type: integer
minimum: 0
lowest_price:
description: A number for a lowest price of a release in a marketplace.
$ref: '#/components/schemas/Price'
required:
- blocked_from_sale
ReleaseVersion:
description: A type that represents a version of a release.
type: object