diff --git a/codex/rest/api.nim b/codex/rest/api.nim index d523ab53..88b1b4df 100644 --- a/codex/rest/api.nim +++ b/codex/rest/api.nim @@ -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") diff --git a/openapi.yaml b/openapi.yaml index 90fdc732..4444304a 100644 --- a/openapi.yaml +++ b/openapi.yaml @@ -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,9 +526,7 @@ paths: content: application/json: schema: - type: array - items: - $ref: "#/components/schemas/Purchase" + $ref: "#/components/schemas/Purchase" "400": description: Invalid or missing Purchase ID "404":