diff --git a/README.md b/README.md index e3f9b72..dfbe6c2 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/codex.yaml b/codex.yaml index 94450bf..4bc100a 100644 --- a/codex.yaml +++ b/codex.yaml @@ -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 @@ -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 @@ -414,7 +423,7 @@ paths: name: cid required: true schema: - $ref: "#/components/schemas/Cid" + $ref: "#/components/schemas/Cid" description: File to be downloaded. responses: @@ -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": @@ -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 diff --git a/codex_client/api/marketplace_api.py b/codex_client/api/marketplace_api.py index c1f62cf..6082fb2 100644 --- a/codex_client/api/marketplace_api.py +++ b/codex_client/api/marketplace_api.py @@ -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, diff --git a/codex_client/models/purchase.py b/codex_client/models/purchase.py index daf3e0a..e0648ea 100644 --- a/codex_client/models/purchase.py +++ b/codex_client/models/purchase.py @@ -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 @@ -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, diff --git a/docs/MarketplaceApi.md b/docs/MarketplaceApi.md index a587d3a..aaa8422 100644 --- a/docs/MarketplaceApi.md +++ b/docs/MarketplaceApi.md @@ -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