mirror of
https://github.com/logos-storage/logos-storage-py-api-client.git
synced 2026-01-02 13:33:11 +00:00
chore: update
This commit is contained in:
parent
c4562c894c
commit
87afa996ae
@ -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
|
||||
|
||||
@ -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)
|
||||
|
||||
74
codex.yaml
74
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:
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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,
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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(
|
||||
|
||||
@ -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(
|
||||
|
||||
@ -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")
|
||||
|
||||
@ -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")
|
||||
|
||||
@ -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")
|
||||
|
||||
@ -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(
|
||||
|
||||
116
codex_client/models/slot_agent.py
Normal file
116
codex_client/models/slot_agent.py
Normal file
@ -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
|
||||
|
||||
|
||||
@ -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)
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
|
||||
34
docs/SlotAgent.md
Normal file
34
docs/SlotAgent.md
Normal file
@ -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)
|
||||
|
||||
|
||||
80
test/test_slot_agent.py
Normal file
80
test/test_slot_agent.py
Normal file
@ -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()
|
||||
Loading…
x
Reference in New Issue
Block a user