From 87afa996ae291a1ebfc23b63372b73e0180205ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20Uhl=C3=AD=C5=99?= Date: Sun, 25 Aug 2024 14:41:02 +0200 Subject: [PATCH] chore: update --- .openapi-generator/FILES | 3 + README.md | 1 + codex.yaml | 74 ++++++++--- codex_client/__init__.py | 1 + codex_client/api/marketplace_api.py | 11 +- codex_client/models/__init__.py | 1 + codex_client/models/purchase.py | 4 +- codex_client/models/reservation.py | 9 +- codex_client/models/sales_availability.py | 3 +- .../models/sales_availability_create.py | 3 +- .../models/sales_availability_read.py | 3 +- codex_client/models/slot.py | 2 +- codex_client/models/slot_agent.py | 116 ++++++++++++++++++ docs/MarketplaceApi.md | 24 ++-- docs/Reservation.md | 2 +- docs/Slot.md | 2 +- docs/SlotAgent.md | 34 +++++ test/test_slot_agent.py | 80 ++++++++++++ 18 files changed, 324 insertions(+), 49 deletions(-) create mode 100644 codex_client/models/slot_agent.py create mode 100644 docs/SlotAgent.md create mode 100644 test/test_slot_agent.py diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES index 0348989..e481b4f 100644 --- a/.openapi-generator/FILES +++ b/.openapi-generator/FILES @@ -28,6 +28,7 @@ codex_client/models/sales_availability.py codex_client/models/sales_availability_create.py codex_client/models/sales_availability_read.py codex_client/models/slot.py +codex_client/models/slot_agent.py codex_client/models/space.py codex_client/models/spr_read.py codex_client/models/storage_ask.py @@ -54,6 +55,7 @@ docs/SalesAvailability.md docs/SalesAvailabilityCREATE.md docs/SalesAvailabilityREAD.md docs/Slot.md +docs/SlotAgent.md docs/Space.md docs/StorageAsk.md docs/StorageRequest.md @@ -65,4 +67,5 @@ setup.cfg setup.py test-requirements.txt test/__init__.py +test/test_slot_agent.py tox.ini diff --git a/README.md b/README.md index dfbe6c2..72367f6 100644 --- a/README.md +++ b/README.md @@ -123,6 +123,7 @@ Class | Method | HTTP request | Description - [SalesAvailabilityCREATE](docs/SalesAvailabilityCREATE.md) - [SalesAvailabilityREAD](docs/SalesAvailabilityREAD.md) - [Slot](docs/Slot.md) + - [SlotAgent](docs/SlotAgent.md) - [Space](docs/Space.md) - [StorageAsk](docs/StorageAsk.md) - [StorageRequest](docs/StorageRequest.md) diff --git a/codex.yaml b/codex.yaml index 4bc100a..225f931 100644 --- a/codex.yaml +++ b/codex.yaml @@ -23,6 +23,8 @@ components: Id: type: string description: 32bits identifier encoded in hex-decimal string. + minLength: 66 + maxLength: 66 example: 0x... BigInt: @@ -168,7 +170,39 @@ components: $ref: "#/components/schemas/StorageRequest" slotIndex: type: string - description: Slot Index as hexadecimal string + description: Slot Index as decimal string + + SlotAgent: + type: object + properties: + id: + $ref: "#/components/schemas/SlotId" + slotIndex: + type: string + description: Slot Index as decimal string + requestId: + $ref: "#/components/schemas/Id" + request: + $ref: "#/components/schemas/StorageRequest" + reservation: + $ref: "#/components/schemas/Reservation" + state: + type: string + description: Description of the slot's + enum: + - SaleCancelled + - SaleDownloading + - SaleErrored + - SaleFailed + - SaleFilled + - SaleFilling + - SaleFinished + - SaleIgnored + - SaleInitialProving + - SalePayout + - SalePreparing + - SaleProving + - SaleUnknown Reservation: type: object @@ -183,7 +217,7 @@ components: $ref: "#/components/schemas/Id" slotIndex: type: string - description: Slot Index as hexadecimal string + description: Slot Index as decimal string StorageRequestCreation: type: object @@ -260,14 +294,14 @@ components: type: string description: Description of the Request's state enum: - - cancelled - - error - - failed - - finished - - pending - - started - - submitted - - unknown + - PurchaseCancelled + - PurchaseError + - PurchaseFailed + - PurchaseFinished + - PurchasePending + - PurchaseStarted + - PurchaseSubmitted + - PurchaseUnknown error: type: string description: If Request failed, then here is presented the error message @@ -500,7 +534,7 @@ paths: $ref: "#/components/schemas/Slot" "503": - description: Sales are unavailable + description: Persistence is not enabled "/sales/slots/{slotId}": get: @@ -520,7 +554,7 @@ paths: content: application/json: schema: - $ref: "#/components/schemas/Slot" + $ref: "#/components/schemas/SlotAgent" "400": description: Invalid or missing SlotId @@ -529,7 +563,7 @@ paths: description: Host is not in an active sale for the slot "503": - description: Sales are unavailable + description: Persistence is not enabled "/sales/availability": get: @@ -548,7 +582,7 @@ paths: "500": description: Error getting unused availabilities "503": - description: Sales are unavailable + description: Persistence is not enabled post: summary: "Offers storage for sale" @@ -573,7 +607,7 @@ paths: "500": description: Error reserving availability "503": - description: Sales are unavailable + description: Persistence is not enabled "/sales/availability/{id}": patch: summary: "Updates availability" @@ -606,7 +640,7 @@ paths: "500": description: Error reserving availability "503": - description: Sales are unavailable + description: Persistence is not enabled "/sales/availability/{id}/reservations": get: @@ -637,7 +671,7 @@ paths: "500": description: Error getting reservations "503": - description: Sales are unavailable + description: Persistence is not enabled "/storage/request/{cid}": post: @@ -668,7 +702,7 @@ paths: "404": description: Request ID not found "503": - description: Purchasing is unavailable + description: Persistence is not enabled "/storage/purchases": get: @@ -685,7 +719,7 @@ paths: items: type: string "503": - description: Purchasing is unavailable + description: Persistence is not enabled "/storage/purchases/{id}": get: @@ -711,7 +745,7 @@ paths: "404": description: Purchase not found "503": - description: Purchasing is unavailable + description: Persistence is not enabled "/node/spr": get: diff --git a/codex_client/__init__.py b/codex_client/__init__.py index 8c1dcd5..dde07c0 100644 --- a/codex_client/__init__.py +++ b/codex_client/__init__.py @@ -49,6 +49,7 @@ from codex_client.models.sales_availability import SalesAvailability from codex_client.models.sales_availability_create import SalesAvailabilityCREATE from codex_client.models.sales_availability_read import SalesAvailabilityREAD from codex_client.models.slot import Slot +from codex_client.models.slot_agent import SlotAgent from codex_client.models.space import Space from codex_client.models.storage_ask import StorageAsk from codex_client.models.storage_request import StorageRequest diff --git a/codex_client/api/marketplace_api.py b/codex_client/api/marketplace_api.py index 6082fb2..39f6ba4 100644 --- a/codex_client/api/marketplace_api.py +++ b/codex_client/api/marketplace_api.py @@ -25,6 +25,7 @@ from codex_client.models.sales_availability import SalesAvailability from codex_client.models.sales_availability_create import SalesAvailabilityCREATE from codex_client.models.sales_availability_read import SalesAvailabilityREAD from codex_client.models.slot import Slot +from codex_client.models.slot_agent import SlotAgent from codex_client.models.storage_request_creation import StorageRequestCreation from codex_client.api_client import ApiClient, RequestSerialized @@ -353,7 +354,7 @@ class MarketplaceApi: _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> Slot: + ) -> SlotAgent: """Returns active slot with id {slotId} for the host @@ -390,7 +391,7 @@ class MarketplaceApi: ) _response_types_map: Dict[str, Optional[str]] = { - '200': "Slot", + '200': "SlotAgent", '400': None, '404': None, '503': None, @@ -422,7 +423,7 @@ class MarketplaceApi: _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[Slot]: + ) -> ApiResponse[SlotAgent]: """Returns active slot with id {slotId} for the host @@ -459,7 +460,7 @@ class MarketplaceApi: ) _response_types_map: Dict[str, Optional[str]] = { - '200': "Slot", + '200': "SlotAgent", '400': None, '404': None, '503': None, @@ -528,7 +529,7 @@ class MarketplaceApi: ) _response_types_map: Dict[str, Optional[str]] = { - '200': "Slot", + '200': "SlotAgent", '400': None, '404': None, '503': None, diff --git a/codex_client/models/__init__.py b/codex_client/models/__init__.py index d8c6520..dd29b20 100644 --- a/codex_client/models/__init__.py +++ b/codex_client/models/__init__.py @@ -29,6 +29,7 @@ from codex_client.models.sales_availability import SalesAvailability from codex_client.models.sales_availability_create import SalesAvailabilityCREATE from codex_client.models.sales_availability_read import SalesAvailabilityREAD from codex_client.models.slot import Slot +from codex_client.models.slot_agent import SlotAgent from codex_client.models.space import Space from codex_client.models.storage_ask import StorageAsk from codex_client.models.storage_request import StorageRequest diff --git a/codex_client/models/purchase.py b/codex_client/models/purchase.py index e0648ea..b1427be 100644 --- a/codex_client/models/purchase.py +++ b/codex_client/models/purchase.py @@ -38,8 +38,8 @@ class Purchase(BaseModel): 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')") + if value not in set(['PurchaseCancelled', 'PurchaseError', 'PurchaseFailed', 'PurchaseFinished', 'PurchasePending', 'PurchaseStarted', 'PurchaseSubmitted', 'PurchaseUnknown']): + raise ValueError("must be one of enum values ('PurchaseCancelled', 'PurchaseError', 'PurchaseFailed', 'PurchaseFinished', 'PurchasePending', 'PurchaseStarted', 'PurchaseSubmitted', 'PurchaseUnknown')") return value model_config = ConfigDict( diff --git a/codex_client/models/reservation.py b/codex_client/models/reservation.py index aad174f..6f3f2fc 100644 --- a/codex_client/models/reservation.py +++ b/codex_client/models/reservation.py @@ -19,6 +19,7 @@ import json from pydantic import BaseModel, ConfigDict, Field, StrictStr from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated from typing import Optional, Set from typing_extensions import Self @@ -26,11 +27,11 @@ class Reservation(BaseModel): """ Reservation """ # noqa: E501 - id: Optional[StrictStr] = Field(default=None, description="32bits identifier encoded in hex-decimal string.") - availability_id: Optional[StrictStr] = Field(default=None, description="32bits identifier encoded in hex-decimal string.", alias="availabilityId") + id: Optional[Annotated[str, Field(min_length=66, strict=True, max_length=66)]] = Field(default=None, description="32bits identifier encoded in hex-decimal string.") + availability_id: Optional[Annotated[str, Field(min_length=66, strict=True, max_length=66)]] = Field(default=None, description="32bits identifier encoded in hex-decimal string.", alias="availabilityId") size: Optional[StrictStr] = Field(default=None, description="Integer represented as decimal string") - request_id: Optional[StrictStr] = Field(default=None, description="32bits identifier encoded in hex-decimal string.", alias="requestId") - slot_index: Optional[StrictStr] = Field(default=None, description="Slot Index as hexadecimal string", alias="slotIndex") + request_id: Optional[Annotated[str, Field(min_length=66, strict=True, max_length=66)]] = Field(default=None, description="32bits identifier encoded in hex-decimal string.", alias="requestId") + slot_index: Optional[StrictStr] = Field(default=None, description="Slot Index as decimal string", alias="slotIndex") __properties: ClassVar[List[str]] = ["id", "availabilityId", "size", "requestId", "slotIndex"] model_config = ConfigDict( diff --git a/codex_client/models/sales_availability.py b/codex_client/models/sales_availability.py index 16c4906..d04fe66 100644 --- a/codex_client/models/sales_availability.py +++ b/codex_client/models/sales_availability.py @@ -19,6 +19,7 @@ import json from pydantic import BaseModel, ConfigDict, Field, StrictStr from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated from typing import Optional, Set from typing_extensions import Self @@ -26,7 +27,7 @@ class SalesAvailability(BaseModel): """ SalesAvailability """ # noqa: E501 - id: Optional[StrictStr] = Field(default=None, description="32bits identifier encoded in hex-decimal string.") + id: Optional[Annotated[str, Field(min_length=66, strict=True, max_length=66)]] = Field(default=None, description="32bits identifier encoded in hex-decimal string.") total_size: Optional[StrictStr] = Field(default=None, description="Total size of availability's storage in bytes as decimal string", alias="totalSize") duration: Optional[StrictStr] = Field(default=None, description="The duration of the request in seconds as decimal string") min_price: Optional[StrictStr] = Field(default=None, description="Minimum price to be paid (in amount of tokens) as decimal string", alias="minPrice") diff --git a/codex_client/models/sales_availability_create.py b/codex_client/models/sales_availability_create.py index 9065ce1..b81e29e 100644 --- a/codex_client/models/sales_availability_create.py +++ b/codex_client/models/sales_availability_create.py @@ -19,6 +19,7 @@ import json from pydantic import BaseModel, ConfigDict, Field, StrictStr from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated from typing import Optional, Set from typing_extensions import Self @@ -26,7 +27,7 @@ class SalesAvailabilityCREATE(BaseModel): """ SalesAvailabilityCREATE """ # noqa: E501 - id: Optional[StrictStr] = Field(default=None, description="32bits identifier encoded in hex-decimal string.") + id: Optional[Annotated[str, Field(min_length=66, strict=True, max_length=66)]] = Field(default=None, description="32bits identifier encoded in hex-decimal string.") total_size: StrictStr = Field(description="Total size of availability's storage in bytes as decimal string", alias="totalSize") duration: StrictStr = Field(description="The duration of the request in seconds as decimal string") min_price: StrictStr = Field(description="Minimum price to be paid (in amount of tokens) as decimal string", alias="minPrice") diff --git a/codex_client/models/sales_availability_read.py b/codex_client/models/sales_availability_read.py index 8b3f304..ba67360 100644 --- a/codex_client/models/sales_availability_read.py +++ b/codex_client/models/sales_availability_read.py @@ -19,6 +19,7 @@ import json from pydantic import BaseModel, ConfigDict, Field, StrictStr from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated from typing import Optional, Set from typing_extensions import Self @@ -26,7 +27,7 @@ class SalesAvailabilityREAD(BaseModel): """ SalesAvailabilityREAD """ # noqa: E501 - id: Optional[StrictStr] = Field(default=None, description="32bits identifier encoded in hex-decimal string.") + id: Optional[Annotated[str, Field(min_length=66, strict=True, max_length=66)]] = Field(default=None, description="32bits identifier encoded in hex-decimal string.") total_size: Optional[StrictStr] = Field(default=None, description="Total size of availability's storage in bytes as decimal string", alias="totalSize") duration: Optional[StrictStr] = Field(default=None, description="The duration of the request in seconds as decimal string") min_price: Optional[StrictStr] = Field(default=None, description="Minimum price to be paid (in amount of tokens) as decimal string", alias="minPrice") diff --git a/codex_client/models/slot.py b/codex_client/models/slot.py index e21e951..fe0c119 100644 --- a/codex_client/models/slot.py +++ b/codex_client/models/slot.py @@ -29,7 +29,7 @@ class Slot(BaseModel): """ # noqa: E501 id: Optional[StrictStr] = Field(default=None, description="Keccak hash of the abi encoded tuple (RequestId, slot index)") request: Optional[StorageRequest] = None - slot_index: Optional[StrictStr] = Field(default=None, description="Slot Index as hexadecimal string", alias="slotIndex") + slot_index: Optional[StrictStr] = Field(default=None, description="Slot Index as decimal string", alias="slotIndex") __properties: ClassVar[List[str]] = ["id", "request", "slotIndex"] model_config = ConfigDict( diff --git a/codex_client/models/slot_agent.py b/codex_client/models/slot_agent.py new file mode 100644 index 0000000..3308ac0 --- /dev/null +++ b/codex_client/models/slot_agent.py @@ -0,0 +1,116 @@ +# coding: utf-8 + +""" + Codex API + + List of endpoints and interfaces available to Codex API users + + The version of the OpenAPI document: 0.0.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from codex_client.models.reservation import Reservation +from codex_client.models.storage_request import StorageRequest +from typing import Optional, Set +from typing_extensions import Self + +class SlotAgent(BaseModel): + """ + SlotAgent + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Keccak hash of the abi encoded tuple (RequestId, slot index)") + slot_index: Optional[StrictStr] = Field(default=None, description="Slot Index as decimal string", alias="slotIndex") + request_id: Optional[Annotated[str, Field(min_length=66, strict=True, max_length=66)]] = Field(default=None, description="32bits identifier encoded in hex-decimal string.", alias="requestId") + request: Optional[StorageRequest] = None + reservation: Optional[Reservation] = None + state: Optional[StrictStr] = Field(default=None, description="Description of the slot's") + __properties: ClassVar[List[str]] = ["id", "slotIndex", "requestId", "request", "reservation", "state"] + + @field_validator('state') + def state_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['SaleCancelled', 'SaleDownloading', 'SaleErrored', 'SaleFailed', 'SaleFilled', 'SaleFilling', 'SaleFinished', 'SaleIgnored', 'SaleInitialProving', 'SalePayout', 'SalePreparing', 'SaleProving', 'SaleUnknown']): + raise ValueError("must be one of enum values ('SaleCancelled', 'SaleDownloading', 'SaleErrored', 'SaleFailed', 'SaleFilled', 'SaleFilling', 'SaleFinished', 'SaleIgnored', 'SaleInitialProving', 'SalePayout', 'SalePreparing', 'SaleProving', 'SaleUnknown')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of SlotAgent from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of request + if self.request: + _dict['request'] = self.request.to_dict() + # override the default output from pydantic by calling `to_dict()` of reservation + if self.reservation: + _dict['reservation'] = self.reservation.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of SlotAgent from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "slotIndex": obj.get("slotIndex"), + "requestId": obj.get("requestId"), + "request": StorageRequest.from_dict(obj["request"]) if obj.get("request") is not None else None, + "reservation": Reservation.from_dict(obj["reservation"]) if obj.get("reservation") is not None else None, + "state": obj.get("state") + }) + return _obj + + diff --git a/docs/MarketplaceApi.md b/docs/MarketplaceApi.md index aaa8422..e4bd8c5 100644 --- a/docs/MarketplaceApi.md +++ b/docs/MarketplaceApi.md @@ -82,12 +82,12 @@ No authorization required **200** | Returns the Request ID as decimal string | - | **400** | Invalid or missing Request ID | - | **404** | Request ID not found | - | -**503** | Purchasing is unavailable | - | +**503** | Persistence is not enabled | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **get_active_slot_by_id** -> Slot get_active_slot_by_id(slot_id) +> SlotAgent get_active_slot_by_id(slot_id) Returns active slot with id {slotId} for the host @@ -96,7 +96,7 @@ Returns active slot with id {slotId} for the host ```python import codex_client -from codex_client.models.slot import Slot +from codex_client.models.slot_agent import SlotAgent from codex_client.rest import ApiException from pprint import pprint @@ -133,7 +133,7 @@ Name | Type | Description | Notes ### Return type -[**Slot**](Slot.md) +[**SlotAgent**](SlotAgent.md) ### Authorization @@ -151,7 +151,7 @@ No authorization required **200** | Retrieved active slot | - | **400** | Invalid or missing SlotId | - | **404** | Host is not in an active sale for the slot | - | -**503** | Sales are unavailable | - | +**503** | Persistence is not enabled | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -214,7 +214,7 @@ No authorization required | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | Retrieved active slots | - | -**503** | Sales are unavailable | - | +**503** | Persistence is not enabled | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -278,7 +278,7 @@ No authorization required |-------------|-------------|------------------| **200** | Retrieved storage availabilities of the node | - | **500** | Error getting unused availabilities | - | -**503** | Sales are unavailable | - | +**503** | Persistence is not enabled | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -347,7 +347,7 @@ No authorization required **200** | Purchase details | - | **400** | Invalid or missing Purchase ID | - | **404** | Purchase not found | - | -**503** | Purchasing is unavailable | - | +**503** | Persistence is not enabled | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -409,7 +409,7 @@ No authorization required | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | Gets all purchase IDs stored in node | - | -**503** | Purchasing is unavailable | - | +**503** | Persistence is not enabled | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -481,7 +481,7 @@ No authorization required **400** | Invalid Availability ID | - | **404** | Availability not found | - | **500** | Error getting reservations | - | -**503** | Sales are unavailable | - | +**503** | Persistence is not enabled | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -552,7 +552,7 @@ No authorization required **400** | Invalid data input | - | **422** | Not enough node's storage quota available | - | **500** | Error reserving availability | - | -**503** | Sales are unavailable | - | +**503** | Persistence is not enabled | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -625,7 +625,7 @@ No authorization required **404** | Availability not found | - | **422** | Not enough node's storage quota available | - | **500** | Error reserving availability | - | -**503** | Sales are unavailable | - | +**503** | Persistence is not enabled | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) diff --git a/docs/Reservation.md b/docs/Reservation.md index 6f23910..b830e00 100644 --- a/docs/Reservation.md +++ b/docs/Reservation.md @@ -9,7 +9,7 @@ Name | Type | Description | Notes **availability_id** | **str** | 32bits identifier encoded in hex-decimal string. | [optional] **size** | **str** | Integer represented as decimal string | [optional] **request_id** | **str** | 32bits identifier encoded in hex-decimal string. | [optional] -**slot_index** | **str** | Slot Index as hexadecimal string | [optional] +**slot_index** | **str** | Slot Index as decimal string | [optional] ## Example diff --git a/docs/Slot.md b/docs/Slot.md index 69ab984..df7bd12 100644 --- a/docs/Slot.md +++ b/docs/Slot.md @@ -7,7 +7,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **id** | **str** | Keccak hash of the abi encoded tuple (RequestId, slot index) | [optional] **request** | [**StorageRequest**](StorageRequest.md) | | [optional] -**slot_index** | **str** | Slot Index as hexadecimal string | [optional] +**slot_index** | **str** | Slot Index as decimal string | [optional] ## Example diff --git a/docs/SlotAgent.md b/docs/SlotAgent.md new file mode 100644 index 0000000..8b986f6 --- /dev/null +++ b/docs/SlotAgent.md @@ -0,0 +1,34 @@ +# SlotAgent + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Keccak hash of the abi encoded tuple (RequestId, slot index) | [optional] +**slot_index** | **str** | Slot Index as decimal string | [optional] +**request_id** | **str** | 32bits identifier encoded in hex-decimal string. | [optional] +**request** | [**StorageRequest**](StorageRequest.md) | | [optional] +**reservation** | [**Reservation**](Reservation.md) | | [optional] +**state** | **str** | Description of the slot's | [optional] + +## Example + +```python +from codex_client.models.slot_agent import SlotAgent + +# TODO update the JSON string below +json = "{}" +# create an instance of SlotAgent from a JSON string +slot_agent_instance = SlotAgent.from_json(json) +# print the JSON string representation of the object +print(SlotAgent.to_json()) + +# convert the object into a dict +slot_agent_dict = slot_agent_instance.to_dict() +# create an instance of SlotAgent from a dict +slot_agent_from_dict = SlotAgent.from_dict(slot_agent_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/test/test_slot_agent.py b/test/test_slot_agent.py new file mode 100644 index 0000000..14a52e4 --- /dev/null +++ b/test/test_slot_agent.py @@ -0,0 +1,80 @@ +# coding: utf-8 + +""" + Codex API + + List of endpoints and interfaces available to Codex API users + + The version of the OpenAPI document: 0.0.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from codex_client.models.slot_agent import SlotAgent + +class TestSlotAgent(unittest.TestCase): + """SlotAgent unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> SlotAgent: + """Test SlotAgent + include_optional is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # uncomment below to create an instance of `SlotAgent` + """ + model = SlotAgent() + if include_optional: + return SlotAgent( + id = '268a781e0db3f7cf36b18e5f4fdb7f586ec9edd08e5500b17c0e518a769f114a', + slot_index = '', + request_id = '0x...', + request = codex_client.models.storage_request.StorageRequest( + id = '', + client = '', + ask = codex_client.models.storage_ask.StorageAsk( + slots = 56, + slot_size = '', + duration = '', + proof_probability = '', + reward = '', + max_slot_loss = 56, ), + content = codex_client.models.content.Content( + cid = 'QmYyQSo1c1Ym7orWxLYvCrM2EmxFTANf8wXmmE7DWjhx5N', + erasure = codex_client.models.erasure_parameters.ErasureParameters( + total_chunks = 56, ), + por = codex_client.models.po_r_parameters.PoRParameters( + u = '', + public_key = '', + name = '', ), ), + expiry = '10 minutes', + nonce = '', ), + reservation = codex_client.models.reservation.Reservation( + id = '0x...', + availability_id = '0x...', + size = '', + request_id = '0x...', + slot_index = '', ), + state = 'SaleCancelled' + ) + else: + return SlotAgent( + ) + """ + + def testSlotAgent(self): + """Test SlotAgent""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main()