Skip to content

Commit

Permalink
fix: reservations are get endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
AuHau committed Aug 24, 2024
1 parent bc41cb9 commit c4562c8
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 8 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ Class | Method | HTTP request | Description
*MarketplaceApi* | [**get_offered_storage**](docs/MarketplaceApi.md#get_offered_storage) | **GET** /sales/availability | Returns storage that is for sale
*MarketplaceApi* | [**get_purchase**](docs/MarketplaceApi.md#get_purchase) | **GET** /storage/purchases/{id} | Returns purchase details
*MarketplaceApi* | [**get_purchases**](docs/MarketplaceApi.md#get_purchases) | **GET** /storage/purchases | Returns list of purchase IDs
*MarketplaceApi* | [**get_reservations**](docs/MarketplaceApi.md#get_reservations) | **PATCH** /sales/availability/{id}/reservations | Get availability's reservations
*MarketplaceApi* | [**get_reservations**](docs/MarketplaceApi.md#get_reservations) | **GET** /sales/availability/{id}/reservations | Get availability's reservations
*MarketplaceApi* | [**offer_storage**](docs/MarketplaceApi.md#offer_storage) | **POST** /sales/availability | Offers storage for sale
*MarketplaceApi* | [**update_offered_storage**](docs/MarketplaceApi.md#update_offered_storage) | **PATCH** /sales/availability/{id} | Updates availability
*NodeApi* | [**connect_peer**](docs/NodeApi.md#connect_peer) | **GET** /connect/{peerId} | Connect to a peer
Expand Down
17 changes: 13 additions & 4 deletions codex.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,15 @@ components:
state:
type: string
description: Description of the Request's state
enum:
- cancelled
- error
- failed
- finished
- pending
- started
- submitted
- unknown
error:
type: string
description: If Request failed, then here is presented the error message
Expand Down Expand Up @@ -345,7 +354,7 @@ paths:
name: peerId
required: true
schema:
$ref: "#/components/schemas/PeerId"
$ref: "#/components/schemas/PeerId"
description: Peer that should be dialed.
- in: query
name: addrs
Expand Down Expand Up @@ -414,7 +423,7 @@ paths:
name: cid
required: true
schema:
$ref: "#/components/schemas/Cid"
$ref: "#/components/schemas/Cid"
description: File to be downloaded.

responses:
Expand Down Expand Up @@ -442,7 +451,7 @@ paths:
name: cid
required: true
schema:
$ref: "#/components/schemas/Cid"
$ref: "#/components/schemas/Cid"
description: "File to be downloaded."
responses:
"200":
Expand Down Expand Up @@ -600,7 +609,7 @@ paths:
description: Sales are unavailable

"/sales/availability/{id}/reservations":
patch:
get:
summary: "Get availability's reservations"
description: Return's list of Reservations for ongoing Storage Requests that the node hosts.
operationId: getReservations
Expand Down
2 changes: 1 addition & 1 deletion codex_client/api/marketplace_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -1850,7 +1850,7 @@ def _get_reservations_serialize(
]

return self.api_client.param_serialize(
method='PATCH',
method='GET',
resource_path='/sales/availability/{id}/reservations',
path_params=_path_params,
query_params=_query_params,
Expand Down
12 changes: 11 additions & 1 deletion codex_client/models/purchase.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import re # noqa: F401
import json

from pydantic import BaseModel, ConfigDict, Field, StrictStr
from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
from typing import Any, ClassVar, Dict, List, Optional
from codex_client.models.storage_request import StorageRequest
from typing import Optional, Set
Expand All @@ -32,6 +32,16 @@ class Purchase(BaseModel):
request: Optional[StorageRequest] = None
__properties: ClassVar[List[str]] = ["state", "error", "request"]

@field_validator('state')
def state_validate_enum(cls, value):
"""Validates the enum"""
if value is None:
return value

if value not in set(['cancelled', 'error', 'failed', 'finished', 'pending', 'started', 'submitted', 'unknown']):
raise ValueError("must be one of enum values ('cancelled', 'error', 'failed', 'finished', 'pending', 'started', 'submitted', 'unknown')")
return value

model_config = ConfigDict(
populate_by_name=True,
validate_assignment=True,
Expand Down
2 changes: 1 addition & 1 deletion docs/MarketplaceApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Method | HTTP request | Description
[**get_offered_storage**](MarketplaceApi.md#get_offered_storage) | **GET** /sales/availability | Returns storage that is for sale
[**get_purchase**](MarketplaceApi.md#get_purchase) | **GET** /storage/purchases/{id} | Returns purchase details
[**get_purchases**](MarketplaceApi.md#get_purchases) | **GET** /storage/purchases | Returns list of purchase IDs
[**get_reservations**](MarketplaceApi.md#get_reservations) | **PATCH** /sales/availability/{id}/reservations | Get availability's reservations
[**get_reservations**](MarketplaceApi.md#get_reservations) | **GET** /sales/availability/{id}/reservations | Get availability's reservations
[**offer_storage**](MarketplaceApi.md#offer_storage) | **POST** /sales/availability | Offers storage for sale
[**update_offered_storage**](MarketplaceApi.md#update_offered_storage) | **PATCH** /sales/availability/{id} | Updates availability

Expand Down

0 comments on commit c4562c8

Please sign in to comment.