Skip to content

Commit 00a3c7a

Browse files
Generated API update (#7)
Co-authored-by: codex-storage-bot <154258435+codex-storage-bot@users.noreply.github.com>
1 parent 9e07596 commit 00a3c7a

File tree

6 files changed

+350
-8
lines changed

6 files changed

+350
-8
lines changed

README.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,13 @@ configuration = codex_api_client.Configuration(
4545
with codex_api_client.ApiClient(configuration) as api_client:
4646
# Create an instance of the API class
4747
api_instance = codex_api_client.DataApi(api_client)
48-
cid = 'cid_example' # str | File to be downloaded.
48+
cid = 'cid_example' # str | Block or dataset to be deleted.
4949

5050
try:
51-
# Download a file from the local node in a streaming manner. If the file is not available locally, a 404 is returned.
52-
api_response = api_instance.download_local(cid)
53-
print("The response of DataApi->download_local:\n")
54-
pprint(api_response)
51+
# Deletes either a single block or an entire dataset from the local node.
52+
api_instance.delete_local(cid)
5553
except ApiException as e:
56-
print("Exception when calling DataApi->download_local: %s\n" % e)
54+
print("Exception when calling DataApi->delete_local: %s\n" % e)
5755

5856
```
5957

@@ -63,6 +61,7 @@ All URIs are relative to *http://localhost:8080/api/codex/v1*
6361

6462
Class | Method | HTTP request | Description
6563
------------ | ------------- | ------------- | -------------
64+
*DataApi* | [**delete_local**](docs/DataApi.md#delete_local) | **DELETE** /data/{cid} | Deletes either a single block or an entire dataset from the local node.
6665
*DataApi* | [**download_local**](docs/DataApi.md#download_local) | **GET** /data/{cid} | Download a file from the local node in a streaming manner. If the file is not available locally, a 404 is returned.
6766
*DataApi* | [**download_network**](docs/DataApi.md#download_network) | **POST** /data/{cid}/network | Download a file from the network to the local node if it&#39;s not available locally. Note: Download is performed async. Call can return before download is completed.
6867
*DataApi* | [**download_network_manifest**](docs/DataApi.md#download_network_manifest) | **GET** /data/{cid}/network/manifest | Download only the dataset manifest from the network to the local node if it&#39;s not available locally.

codex.yaml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,7 @@ components:
205205
required:
206206
- id
207207
- totalRemainingCollateral
208+
- freeSize
208209
allOf:
209210
- $ref: "#/components/schemas/SalesAvailability"
210211
- type: object
@@ -627,6 +628,26 @@ paths:
627628
"500":
628629
description: Well it was bad-bad
629630

631+
delete:
632+
summary: "Deletes either a single block or an entire dataset from the local node."
633+
tags: [Data]
634+
operationId: deleteLocal
635+
parameters:
636+
- in: path
637+
name: cid
638+
required: true
639+
schema:
640+
$ref: "#/components/schemas/Cid"
641+
description: Block or dataset to be deleted.
642+
643+
responses:
644+
"204":
645+
description: Data was successfully deleted.
646+
"400":
647+
description: Invalid CID is specified
648+
"500":
649+
description: There was an error during deletion
650+
630651
"/data/{cid}/network":
631652
post:
632653
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."

codex_api_client/api/data_api.py

Lines changed: 256 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,262 @@ def __init__(self, api_client=None) -> None:
4141
self.api_client = api_client
4242

4343

44+
@validate_call
45+
def delete_local(
46+
self,
47+
cid: Annotated[StrictStr, Field(description="Block or dataset to be deleted.")],
48+
_request_timeout: Union[
49+
None,
50+
Annotated[StrictFloat, Field(gt=0)],
51+
Tuple[
52+
Annotated[StrictFloat, Field(gt=0)],
53+
Annotated[StrictFloat, Field(gt=0)]
54+
]
55+
] = None,
56+
_request_auth: Optional[Dict[StrictStr, Any]] = None,
57+
_content_type: Optional[StrictStr] = None,
58+
_headers: Optional[Dict[StrictStr, Any]] = None,
59+
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
60+
) -> None:
61+
"""Deletes either a single block or an entire dataset from the local node.
62+
63+
64+
:param cid: Block or dataset to be deleted. (required)
65+
:type cid: str
66+
:param _request_timeout: timeout setting for this request. If one
67+
number provided, it will be total request
68+
timeout. It can also be a pair (tuple) of
69+
(connection, read) timeouts.
70+
:type _request_timeout: int, tuple(int, int), optional
71+
:param _request_auth: set to override the auth_settings for an a single
72+
request; this effectively ignores the
73+
authentication in the spec for a single request.
74+
:type _request_auth: dict, optional
75+
:param _content_type: force content-type for the request.
76+
:type _content_type: str, Optional
77+
:param _headers: set to override the headers for a single
78+
request; this effectively ignores the headers
79+
in the spec for a single request.
80+
:type _headers: dict, optional
81+
:param _host_index: set to override the host_index for a single
82+
request; this effectively ignores the host_index
83+
in the spec for a single request.
84+
:type _host_index: int, optional
85+
:return: Returns the result object.
86+
""" # noqa: E501
87+
88+
_param = self._delete_local_serialize(
89+
cid=cid,
90+
_request_auth=_request_auth,
91+
_content_type=_content_type,
92+
_headers=_headers,
93+
_host_index=_host_index
94+
)
95+
96+
_response_types_map: Dict[str, Optional[str]] = {
97+
'204': None,
98+
'400': None,
99+
'500': None,
100+
}
101+
response_data = self.api_client.call_api(
102+
*_param,
103+
_request_timeout=_request_timeout
104+
)
105+
response_data.read()
106+
return self.api_client.response_deserialize(
107+
response_data=response_data,
108+
response_types_map=_response_types_map,
109+
).data
110+
111+
112+
@validate_call
113+
def delete_local_with_http_info(
114+
self,
115+
cid: Annotated[StrictStr, Field(description="Block or dataset to be deleted.")],
116+
_request_timeout: Union[
117+
None,
118+
Annotated[StrictFloat, Field(gt=0)],
119+
Tuple[
120+
Annotated[StrictFloat, Field(gt=0)],
121+
Annotated[StrictFloat, Field(gt=0)]
122+
]
123+
] = None,
124+
_request_auth: Optional[Dict[StrictStr, Any]] = None,
125+
_content_type: Optional[StrictStr] = None,
126+
_headers: Optional[Dict[StrictStr, Any]] = None,
127+
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
128+
) -> ApiResponse[None]:
129+
"""Deletes either a single block or an entire dataset from the local node.
130+
131+
132+
:param cid: Block or dataset to be deleted. (required)
133+
:type cid: str
134+
:param _request_timeout: timeout setting for this request. If one
135+
number provided, it will be total request
136+
timeout. It can also be a pair (tuple) of
137+
(connection, read) timeouts.
138+
:type _request_timeout: int, tuple(int, int), optional
139+
:param _request_auth: set to override the auth_settings for an a single
140+
request; this effectively ignores the
141+
authentication in the spec for a single request.
142+
:type _request_auth: dict, optional
143+
:param _content_type: force content-type for the request.
144+
:type _content_type: str, Optional
145+
:param _headers: set to override the headers for a single
146+
request; this effectively ignores the headers
147+
in the spec for a single request.
148+
:type _headers: dict, optional
149+
:param _host_index: set to override the host_index for a single
150+
request; this effectively ignores the host_index
151+
in the spec for a single request.
152+
:type _host_index: int, optional
153+
:return: Returns the result object.
154+
""" # noqa: E501
155+
156+
_param = self._delete_local_serialize(
157+
cid=cid,
158+
_request_auth=_request_auth,
159+
_content_type=_content_type,
160+
_headers=_headers,
161+
_host_index=_host_index
162+
)
163+
164+
_response_types_map: Dict[str, Optional[str]] = {
165+
'204': None,
166+
'400': None,
167+
'500': None,
168+
}
169+
response_data = self.api_client.call_api(
170+
*_param,
171+
_request_timeout=_request_timeout
172+
)
173+
response_data.read()
174+
return self.api_client.response_deserialize(
175+
response_data=response_data,
176+
response_types_map=_response_types_map,
177+
)
178+
179+
180+
@validate_call
181+
def delete_local_without_preload_content(
182+
self,
183+
cid: Annotated[StrictStr, Field(description="Block or dataset to be deleted.")],
184+
_request_timeout: Union[
185+
None,
186+
Annotated[StrictFloat, Field(gt=0)],
187+
Tuple[
188+
Annotated[StrictFloat, Field(gt=0)],
189+
Annotated[StrictFloat, Field(gt=0)]
190+
]
191+
] = None,
192+
_request_auth: Optional[Dict[StrictStr, Any]] = None,
193+
_content_type: Optional[StrictStr] = None,
194+
_headers: Optional[Dict[StrictStr, Any]] = None,
195+
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
196+
) -> RESTResponseType:
197+
"""Deletes either a single block or an entire dataset from the local node.
198+
199+
200+
:param cid: Block or dataset to be deleted. (required)
201+
:type cid: str
202+
:param _request_timeout: timeout setting for this request. If one
203+
number provided, it will be total request
204+
timeout. It can also be a pair (tuple) of
205+
(connection, read) timeouts.
206+
:type _request_timeout: int, tuple(int, int), optional
207+
:param _request_auth: set to override the auth_settings for an a single
208+
request; this effectively ignores the
209+
authentication in the spec for a single request.
210+
:type _request_auth: dict, optional
211+
:param _content_type: force content-type for the request.
212+
:type _content_type: str, Optional
213+
:param _headers: set to override the headers for a single
214+
request; this effectively ignores the headers
215+
in the spec for a single request.
216+
:type _headers: dict, optional
217+
:param _host_index: set to override the host_index for a single
218+
request; this effectively ignores the host_index
219+
in the spec for a single request.
220+
:type _host_index: int, optional
221+
:return: Returns the result object.
222+
""" # noqa: E501
223+
224+
_param = self._delete_local_serialize(
225+
cid=cid,
226+
_request_auth=_request_auth,
227+
_content_type=_content_type,
228+
_headers=_headers,
229+
_host_index=_host_index
230+
)
231+
232+
_response_types_map: Dict[str, Optional[str]] = {
233+
'204': None,
234+
'400': None,
235+
'500': None,
236+
}
237+
response_data = self.api_client.call_api(
238+
*_param,
239+
_request_timeout=_request_timeout
240+
)
241+
return response_data.response
242+
243+
244+
def _delete_local_serialize(
245+
self,
246+
cid,
247+
_request_auth,
248+
_content_type,
249+
_headers,
250+
_host_index,
251+
) -> RequestSerialized:
252+
253+
_host = None
254+
255+
_collection_formats: Dict[str, str] = {
256+
}
257+
258+
_path_params: Dict[str, str] = {}
259+
_query_params: List[Tuple[str, str]] = []
260+
_header_params: Dict[str, Optional[str]] = _headers or {}
261+
_form_params: List[Tuple[str, str]] = []
262+
_files: Dict[
263+
str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
264+
] = {}
265+
_body_params: Optional[bytes] = None
266+
267+
# process the path parameters
268+
if cid is not None:
269+
_path_params['cid'] = cid
270+
# process the query parameters
271+
# process the header parameters
272+
# process the form parameters
273+
# process the body parameter
274+
275+
276+
277+
278+
# authentication setting
279+
_auth_settings: List[str] = [
280+
]
281+
282+
return self.api_client.param_serialize(
283+
method='DELETE',
284+
resource_path='/data/{cid}',
285+
path_params=_path_params,
286+
query_params=_query_params,
287+
header_params=_header_params,
288+
body=_body_params,
289+
post_params=_form_params,
290+
files=_files,
291+
auth_settings=_auth_settings,
292+
collection_formats=_collection_formats,
293+
_host=_host,
294+
_request_auth=_request_auth
295+
)
296+
297+
298+
299+
44300
@validate_call
45301
def download_local(
46302
self,

codex_api_client/models/sales_availability_read.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class SalesAvailabilityREAD(BaseModel):
3434
enabled: Optional[StrictBool] = Field(default=True, description="Enable the ability to receive sales on this availability.")
3535
until: Optional[StrictInt] = Field(default=0, description="Specifies the latest timestamp, after which the availability will no longer host any slots. If set to 0, there will be no restrictions.")
3636
id: Annotated[str, Field(min_length=66, strict=True, max_length=66)] = Field(description="32bits identifier encoded in hex-decimal string.")
37-
free_size: Optional[StrictInt] = Field(default=None, description="Unused size of availability's storage in bytes as decimal string", alias="freeSize")
37+
free_size: StrictInt = Field(description="Unused size of availability's storage in bytes as decimal string", alias="freeSize")
3838
total_remaining_collateral: StrictStr = Field(description="Total collateral effective (in amount of tokens) that can be used for matching requests", alias="totalRemainingCollateral")
3939
__properties: ClassVar[List[str]] = ["totalSize", "duration", "minPricePerBytePerSecond", "totalCollateral", "enabled", "until", "id", "freeSize", "totalRemainingCollateral"]
4040

0 commit comments

Comments
 (0)