Skip to content

Commit 3734425

Browse files
Generated API update (#1)
Co-authored-by: AuHau <[email protected]>
1 parent b029e89 commit 3734425

15 files changed

+82
-89
lines changed

codex.yaml

+44-46
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ info:
66
description: "List of endpoints and interfaces available to Codex API users"
77

88
security:
9-
- { }
9+
- {}
1010

1111
components:
1212
schemas:
@@ -50,9 +50,9 @@ components:
5050
type: string
5151
description: Address of Ethereum address
5252

53-
Reward:
53+
PricePerBytePerSecond:
5454
type: string
55-
description: The maximum amount of tokens paid per second per slot to hosts the client is willing to pay
55+
description: The amount of tokens paid per byte per second per slot to hosts the client is willing to pay
5656

5757
Duration:
5858
type: string
@@ -138,6 +138,10 @@ components:
138138
description: Path of the data repository where all nodes data are stored
139139
spr:
140140
$ref: "#/components/schemas/SPR"
141+
announceAddresses:
142+
type: array
143+
items:
144+
$ref: "#/components/schemas/MultiAddress"
141145
table:
142146
$ref: "#/components/schemas/PeersTable"
143147
codex:
@@ -153,12 +157,12 @@ components:
153157
description: Total size of availability's storage in bytes as decimal string
154158
duration:
155159
$ref: "#/components/schemas/Duration"
156-
minPrice:
160+
minPricePerBytePerSecond:
157161
type: string
158-
description: Minimal price paid (in amount of tokens) for the whole hosted request's slot for the request's duration as decimal string
159-
maxCollateral:
162+
description: Minimal price per byte per second paid (in amount of tokens) for the hosted request's slot for the request's duration as decimal string
163+
totalCollateral:
160164
type: string
161-
description: Maximum collateral user is willing to pay per filled Slot (in amount of tokens) as decimal string
165+
description: Total collateral (in amount of tokens) that can be used for matching requests
162166

163167
SalesAvailabilityREAD:
164168
allOf:
@@ -174,8 +178,8 @@ components:
174178
- $ref: "#/components/schemas/SalesAvailability"
175179
- required:
176180
- totalSize
177-
- minPrice
178-
- maxCollateral
181+
- minPricePerBytePerSecond
182+
- totalCollateral
179183
- duration
180184

181185
Slot:
@@ -239,16 +243,16 @@ components:
239243
StorageRequestCreation:
240244
type: object
241245
required:
242-
- reward
246+
- pricePerBytePerSecond
243247
- duration
244248
- proofProbability
245-
- collateral
249+
- collateralPerByte
246250
- expiry
247251
properties:
248252
duration:
249253
$ref: "#/components/schemas/Duration"
250-
reward:
251-
$ref: "#/components/schemas/Reward"
254+
pricePerBytePerSecond:
255+
$ref: "#/components/schemas/PricePerBytePerSecond"
252256
proofProbability:
253257
$ref: "#/components/schemas/ProofProbability"
254258
nodes:
@@ -259,16 +263,16 @@ components:
259263
description: Additional number of nodes on top of the `nodes` property that can be lost before pronouncing the content lost
260264
type: integer
261265
default: 0
262-
collateral:
266+
collateralPerByte:
263267
type: string
264-
description: Number as decimal string that represents how much collateral is asked from hosts that wants to fill a slots
268+
description: Number as decimal string that represents how much collateral per byte is asked from hosts that wants to fill a slots
265269
expiry:
266270
type: string
267271
description: Number as decimal string that represents expiry threshold in seconds from when the Request is submitted. When the threshold is reached and the Request does not find requested amount of nodes to host the data, the Request is voided. The number of seconds can not be higher then the Request's duration itself.
268272
StorageAsk:
269273
type: object
270274
required:
271-
- reward
275+
- pricePerBytePerSecond
272276
properties:
273277
slots:
274278
description: Number of slots (eq. hosts) that the Request want to have the content spread over
@@ -280,8 +284,8 @@ components:
280284
$ref: "#/components/schemas/Duration"
281285
proofProbability:
282286
$ref: "#/components/schemas/ProofProbability"
283-
reward:
284-
$ref: "#/components/schemas/Reward"
287+
pricePerBytePerSecond:
288+
$ref: "#/components/schemas/PricePerBytePerSecond"
285289
maxSlotLoss:
286290
type: integer
287291
description: Max slots that can be lost without data considered to be lost
@@ -367,12 +371,6 @@ components:
367371
nullable: true
368372
description: "The original mimetype of the uploaded content (optional)"
369373
example: image/png
370-
uploadedAt:
371-
type: integer
372-
format: int64
373-
nullable: true
374-
description: "The UTC upload timestamp in seconds"
375-
example: 1729244192
376374

377375
Space:
378376
type: object
@@ -414,7 +412,7 @@ paths:
414412
description: |
415413
If `addrs` param is supplied, it will be used to dial the peer, otherwise the `peerId` is used
416414
to invoke peer discovery, if it succeeds the returned addresses will be used to dial.
417-
tags: [ Node ]
415+
tags: [Node]
418416
operationId: connectPeer
419417
parameters:
420418
- in: path
@@ -444,7 +442,7 @@ paths:
444442
"/data":
445443
get:
446444
summary: "Lists manifest CIDs stored locally in node."
447-
tags: [ Data ]
445+
tags: [Data]
448446
operationId: listData
449447
responses:
450448
"200":
@@ -464,7 +462,7 @@ paths:
464462
description: Well it was bad-bad
465463
post:
466464
summary: "Upload a file in a streaming manner. Once finished, the file is stored in the node and can be retrieved by any node in the network using the returned CID."
467-
tags: [ Data ]
465+
tags: [Data]
468466
operationId: upload
469467
parameters:
470468
- name: content-type
@@ -480,7 +478,7 @@ paths:
480478
description: The content disposition used to send the filename.
481479
schema:
482480
type: string
483-
example: "attachment; filename=\"codex.png\""
481+
example: 'attachment; filename="codex.png"'
484482
requestBody:
485483
content:
486484
application/octet-stream:
@@ -500,7 +498,7 @@ paths:
500498
"/data/{cid}":
501499
get:
502500
summary: "Download a file from the local node in a streaming manner. If the file is not available locally, a 404 is returned."
503-
tags: [ Data ]
501+
tags: [Data]
504502
operationId: downloadLocal
505503
parameters:
506504
- in: path
@@ -528,7 +526,7 @@ paths:
528526
"/data/{cid}/network":
529527
post:
530528
summary: "Download a file from the network to the local node if it's not available locally. Note: Download is performed async. Call can return before download is completed."
531-
tags: [ Data ]
529+
tags: [Data]
532530
operationId: downloadNetwork
533531
parameters:
534532
- in: path
@@ -554,7 +552,7 @@ paths:
554552
"/data/{cid}/network/stream":
555553
get:
556554
summary: "Download a file from the network in a streaming manner. If the file is not available locally, it will be retrieved from other nodes in the network if able."
557-
tags: [ Data ]
555+
tags: [Data]
558556
operationId: downloadNetworkStream
559557
parameters:
560558
- in: path
@@ -581,7 +579,7 @@ paths:
581579
"/data/{cid}/network/manifest":
582580
get:
583581
summary: "Download only the dataset manifest from the network to the local node if it's not available locally."
584-
tags: [ Data ]
582+
tags: [Data]
585583
operationId: downloadNetworkManifest
586584
parameters:
587585
- in: path
@@ -607,7 +605,7 @@ paths:
607605
"/space":
608606
get:
609607
summary: "Gets a summary of the storage space allocation of the node."
610-
tags: [ Data ]
608+
tags: [Data]
611609
operationId: space
612610
responses:
613611
"200":
@@ -623,7 +621,7 @@ paths:
623621
"/sales/slots":
624622
get:
625623
summary: "Returns active slots"
626-
tags: [ Marketplace ]
624+
tags: [Marketplace]
627625
operationId: getActiveSlots
628626
responses:
629627
"200":
@@ -641,7 +639,7 @@ paths:
641639
"/sales/slots/{slotId}":
642640
get:
643641
summary: "Returns active slot with id {slotId} for the host"
644-
tags: [ Marketplace ]
642+
tags: [Marketplace]
645643
operationId: getActiveSlotById
646644
parameters:
647645
- in: path
@@ -670,7 +668,7 @@ paths:
670668
"/sales/availability":
671669
get:
672670
summary: "Returns storage that is for sale"
673-
tags: [ Marketplace ]
671+
tags: [Marketplace]
674672
operationId: getAvailabilities
675673
responses:
676674
"200":
@@ -689,7 +687,7 @@ paths:
689687
post:
690688
summary: "Offers storage for sale"
691689
operationId: offerStorage
692-
tags: [ Marketplace ]
690+
tags: [Marketplace]
693691
requestBody:
694692
content:
695693
application/json:
@@ -717,7 +715,7 @@ paths:
717715
The new parameters will be only considered for new requests.
718716
Existing Requests linked to this Availability will continue as is.
719717
operationId: updateOfferedStorage
720-
tags: [ Marketplace ]
718+
tags: [Marketplace]
721719
parameters:
722720
- in: path
723721
name: id
@@ -749,7 +747,7 @@ paths:
749747
summary: "Get availability's reservations"
750748
description: Return's list of Reservations for ongoing Storage Requests that the node hosts.
751749
operationId: getReservations
752-
tags: [ Marketplace ]
750+
tags: [Marketplace]
753751
parameters:
754752
- in: path
755753
name: id
@@ -778,7 +776,7 @@ paths:
778776
"/storage/request/{cid}":
779777
post:
780778
summary: "Creates a new Request for storage"
781-
tags: [ Marketplace ]
779+
tags: [Marketplace]
782780
operationId: createStorageRequest
783781
parameters:
784782
- in: path
@@ -809,7 +807,7 @@ paths:
809807
"/storage/purchases":
810808
get:
811809
summary: "Returns list of purchase IDs"
812-
tags: [ Marketplace ]
810+
tags: [Marketplace]
813811
operationId: getPurchases
814812
responses:
815813
"200":
@@ -826,7 +824,7 @@ paths:
826824
"/storage/purchases/{id}":
827825
get:
828826
summary: "Returns purchase details"
829-
tags: [ Marketplace ]
827+
tags: [Marketplace]
830828
operationId: getPurchase
831829
parameters:
832830
- in: path
@@ -853,7 +851,7 @@ paths:
853851
get:
854852
summary: "Get Node's SPR"
855853
operationId: getSPR
856-
tags: [ Node ]
854+
tags: [Node]
857855
responses:
858856
"200":
859857
description: Node's SPR
@@ -871,7 +869,7 @@ paths:
871869
get:
872870
summary: "Get Node's PeerID"
873871
operationId: getPeerId
874-
tags: [ Node ]
872+
tags: [Node]
875873
responses:
876874
"200":
877875
description: Node's Peer ID
@@ -886,7 +884,7 @@ paths:
886884
"/debug/chronicles/loglevel":
887885
post:
888886
summary: "Set log level at run time"
889-
tags: [ Debug ]
887+
tags: [Debug]
890888
operationId: setDebugLogLevel
891889

892890
parameters:
@@ -908,7 +906,7 @@ paths:
908906
get:
909907
summary: "Gets node information"
910908
operationId: getDebugInfo
911-
tags: [ Debug ]
909+
tags: [Debug]
912910
responses:
913911
"200":
914912
description: Node's information

codex_api_client/models/debug_info.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,10 @@ class DebugInfo(BaseModel):
3232
addrs: Optional[List[StrictStr]] = None
3333
repo: Optional[StrictStr] = Field(default=None, description="Path of the data repository where all nodes data are stored")
3434
spr: Optional[StrictStr] = Field(default=None, description="Signed Peer Record (libp2p)")
35+
announce_addresses: Optional[List[StrictStr]] = Field(default=None, alias="announceAddresses")
3536
table: Optional[PeersTable] = None
3637
codex: Optional[CodexVersion] = None
37-
__properties: ClassVar[List[str]] = ["id", "addrs", "repo", "spr", "table", "codex"]
38+
__properties: ClassVar[List[str]] = ["id", "addrs", "repo", "spr", "announceAddresses", "table", "codex"]
3839

3940
model_config = ConfigDict(
4041
populate_by_name=True,
@@ -97,6 +98,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
9798
"addrs": obj.get("addrs"),
9899
"repo": obj.get("repo"),
99100
"spr": obj.get("spr"),
101+
"announceAddresses": obj.get("announceAddresses"),
100102
"table": PeersTable.from_dict(obj["table"]) if obj.get("table") is not None else None,
101103
"codex": CodexVersion.from_dict(obj["codex"]) if obj.get("codex") is not None else None
102104
})

codex_api_client/models/manifest_item.py

+2-9
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,7 @@ class ManifestItem(BaseModel):
3232
protected: Optional[StrictBool] = Field(default=None, description="Indicates if content is protected by erasure-coding")
3333
filename: Optional[StrictStr] = Field(default=None, description="The original name of the uploaded content (optional)")
3434
mimetype: Optional[StrictStr] = Field(default=None, description="The original mimetype of the uploaded content (optional)")
35-
uploaded_at: Optional[StrictInt] = Field(default=None, description="The UTC upload timestamp in seconds", alias="uploadedAt")
36-
__properties: ClassVar[List[str]] = ["treeCid", "datasetSize", "blockSize", "protected", "filename", "mimetype", "uploadedAt"]
35+
__properties: ClassVar[List[str]] = ["treeCid", "datasetSize", "blockSize", "protected", "filename", "mimetype"]
3736

3837
model_config = ConfigDict(
3938
populate_by_name=True,
@@ -84,11 +83,6 @@ def to_dict(self) -> Dict[str, Any]:
8483
if self.mimetype is None and "mimetype" in self.model_fields_set:
8584
_dict['mimetype'] = None
8685

87-
# set to None if uploaded_at (nullable) is None
88-
# and model_fields_set contains the field
89-
if self.uploaded_at is None and "uploaded_at" in self.model_fields_set:
90-
_dict['uploadedAt'] = None
91-
9286
return _dict
9387

9488
@classmethod
@@ -106,8 +100,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
106100
"blockSize": obj.get("blockSize"),
107101
"protected": obj.get("protected"),
108102
"filename": obj.get("filename"),
109-
"mimetype": obj.get("mimetype"),
110-
"uploadedAt": obj.get("uploadedAt")
103+
"mimetype": obj.get("mimetype")
111104
})
112105
return _obj
113106

codex_api_client/models/sales_availability.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ class SalesAvailability(BaseModel):
3030
id: Optional[Annotated[str, Field(min_length=66, strict=True, max_length=66)]] = Field(default=None, description="32bits identifier encoded in hex-decimal string.")
3131
total_size: Optional[StrictStr] = Field(default=None, description="Total size of availability's storage in bytes as decimal string", alias="totalSize")
3232
duration: Optional[StrictStr] = Field(default=None, description="The duration of the request in seconds as decimal string")
33-
min_price: Optional[StrictStr] = Field(default=None, description="Minimal price paid (in amount of tokens) for the whole hosted request's slot for the request's duration as decimal string", alias="minPrice")
34-
max_collateral: Optional[StrictStr] = Field(default=None, description="Maximum collateral user is willing to pay per filled Slot (in amount of tokens) as decimal string", alias="maxCollateral")
35-
__properties: ClassVar[List[str]] = ["id", "totalSize", "duration", "minPrice", "maxCollateral"]
33+
min_price_per_byte_per_second: Optional[StrictStr] = Field(default=None, description="Minimal price per byte per second paid (in amount of tokens) for the hosted request's slot for the request's duration as decimal string", alias="minPricePerBytePerSecond")
34+
total_collateral: Optional[StrictStr] = Field(default=None, description="Total collateral (in amount of tokens) that can be used for matching requests", alias="totalCollateral")
35+
__properties: ClassVar[List[str]] = ["id", "totalSize", "duration", "minPricePerBytePerSecond", "totalCollateral"]
3636

3737
model_config = ConfigDict(
3838
populate_by_name=True,
@@ -88,8 +88,8 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
8888
"id": obj.get("id"),
8989
"totalSize": obj.get("totalSize"),
9090
"duration": obj.get("duration"),
91-
"minPrice": obj.get("minPrice"),
92-
"maxCollateral": obj.get("maxCollateral")
91+
"minPricePerBytePerSecond": obj.get("minPricePerBytePerSecond"),
92+
"totalCollateral": obj.get("totalCollateral")
9393
})
9494
return _obj
9595

0 commit comments

Comments
 (0)