add openapi spec for /sales/slots/{slotId}

This commit is contained in:
Eric 2023-11-16 13:30:13 +11:00
parent 658302802f
commit 34c4fb07fe
No known key found for this signature in database
2 changed files with 25 additions and 4 deletions

View File

@ -199,7 +199,8 @@ proc initSalesApi(node: CodexNodeRef, router: var RestRouter) =
router.api(
MethodGet,
"/api/codex/v1/sales/slots/{slotId}") do (slotId: SlotId) -> RestApiResponse:
## Returns active slots for the host
## Returns active slot with id {slotId} for the host. Returns 404 if the
## slot is not active for the host.
without contracts =? node.contracts.host:
return RestApiResponse.error(Http503, "Sales unavailable")

View File

@ -402,6 +402,28 @@ paths:
"503":
description: Sales are unavailable
"/sales/slots/{slotId}":
get:
summary: "Returns active slot with id {slotId} for the host"
tags: [ Marketplace ]
operationId: getActiveSlotById
responses:
"200":
description: Retrieved active slot
content:
application/json:
schema:
$ref: "#/components/schemas/Slot"
"400":
description: Invalid or missing SlotId
"404":
description: Host is not in an active sale for the slot
"503":
description: Sales are unavailable
"/sales/availability":
get:
summary: "Returns storage that is for sale"
@ -504,8 +526,6 @@ paths:
content:
application/json:
schema:
type: array
items:
$ref: "#/components/schemas/Purchase"
"400":
description: Invalid or missing Purchase ID