Compare commits

..

No commits in common. "master" and "0.0.1" have entirely different histories.

108 changed files with 1168 additions and 2986 deletions

View File

@ -1 +0,0 @@
{"name": "🏃", "description": "Run Docker container to upload Python distribution packages to PyPI", "inputs": {"user": {"description": "PyPI user", "required": false}, "password": {"description": "Password for your PyPI user or an access token", "required": false}, "repository-url": {"description": "The repository URL to use", "required": false}, "packages-dir": {"description": "The target directory for distribution", "required": false}, "verify-metadata": {"description": "Check metadata before uploading", "required": false}, "skip-existing": {"description": "Do not fail if a Python package distribution exists in the target package index", "required": false}, "verbose": {"description": "Show verbose output.", "required": false}, "print-hash": {"description": "Show hash values of files to be uploaded", "required": false}, "attestations": {"description": "[EXPERIMENTAL] Enable experimental support for PEP 740 attestations. Only works with PyPI and TestPyPI via Trusted Publishing.", "required": false}}, "runs": {"using": "docker", "image": "docker://ghcr.io/pypa/gh-action-pypi-publish:release-v1"}}

View File

@ -1,61 +0,0 @@
name: Generate code
permissions:
contents: write
pull-requests: write
on:
repository_dispatch:
types: [generate]
workflow_dispatch:
inputs:
openapi_url:
description: "OpenAPI URL that should be used"
required: true
type: string
jobs:
generate:
runs-on: ubuntu-latest
steps:
- name: Inputs handling
run: |
if [ "${{ github.event_name }}" == "repository_dispatch" ]; then
if [ -z "${{ github.event.client_payload.openapi_url }}" ]; then
echo "Error: 'openapi_url' is missing in client_payload."
exit 1
fi
echo "OPENAPI_URL=${{ github.event.client_payload.openapi_url }}" >> $GITHUB_ENV
else
echo "OPENAPI_URL=${{ github.event.inputs.openapi_url }}" >> $GITHUB_ENV
fi
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: 20
- name: Install OpenAPI Generator
run: npm install @openapitools/openapi-generator-cli -g
- name: Download OpenAPI spec
run: wget $OPENAPI_URL -O codex.yaml
- name: Run generation
run: |
LATEST_VERSION=$(git describe --tags `git rev-list --tags --max-count=1`)
./generate.sh $LATEST_VERSION
- name: Create Pull Request
uses: peter-evans/create-pull-request@v7
with:
branch: generator
delete-branch: 'true'
title: 'Generated API update'
body: 'Update of the client library using OpenAPI from: ${{ env.OPENAPI_URL }}'
commit-message: 'Generated API update'

View File

@ -3,7 +3,7 @@
# #
# ref: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python # ref: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
name: codex_api_client Python package name: codex_client Python package
on: [push, pull_request] on: [push, pull_request]
@ -13,10 +13,10 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy: strategy:
matrix: matrix:
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"] python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }} - name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4 uses: actions/setup-python@v4
with: with:
@ -24,8 +24,15 @@ jobs:
- name: Install dependencies - name: Install dependencies
run: | run: |
python -m pip install --upgrade pip python -m pip install --upgrade pip
pip install -r requirements.txt pip install flake8 pytest
pip install -r test-requirements.txt if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
if [ -f test-requirements.txt ]; then pip install -r test-requirements.txt; fi
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest - name: Test with pytest
run: | run: |
pytest --cov={{packageName}} pytest

View File

@ -1,43 +0,0 @@
name: Release
permissions:
contents: write
on:
release:
types: [published]
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- name: Install OpenAPI Generator
run: npm install @openapitools/openapi-generator-cli -g
- name: Run generation
run: ./generate.sh ${{ github.event.release.tag_name }}
- uses: actions/setup-python@v4
with:
python-version: 3.13
- name: Build distribution 📦
run: |
pip install build --user
python -m build
- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}
- name: Push the changes
uses: stefanzweifel/git-auto-commit-action@v5
with:
branch: master
commit_message: 'Version bump'

31
.gitlab-ci.yml Normal file
View File

@ -0,0 +1,31 @@
# NOTE: This file is auto generated by OpenAPI Generator.
# URL: https://openapi-generator.tech
#
# ref: https://docs.gitlab.com/ee/ci/README.html
# ref: https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/ci/templates/Python.gitlab-ci.yml
stages:
- test
.pytest:
stage: test
script:
- pip install -r requirements.txt
- pip install -r test-requirements.txt
- pytest --cov=codex_client
pytest-3.7:
extends: .pytest
image: python:3.7-alpine
pytest-3.8:
extends: .pytest
image: python:3.8-alpine
pytest-3.9:
extends: .pytest
image: python:3.9-alpine
pytest-3.10:
extends: .pytest
image: python:3.10-alpine
pytest-3.11:
extends: .pytest
image: python:3.11-alpine

View File

@ -21,8 +21,3 @@
#docs/*.md #docs/*.md
# Then explicitly reverse the ignore rule for a single file: # Then explicitly reverse the ignore rule for a single file:
#!docs/README.md #!docs/README.md
.gitlab-ci.yml
.travis.yml
git_push.sh
.github/workflows/python.yml

View File

@ -1,55 +1,58 @@
.github/workflows/python.yml
.gitignore .gitignore
.gitlab-ci.yml
.travis.yml
README.md README.md
codex_api_client/__init__.py codex_client/__init__.py
codex_api_client/api/__init__.py codex_client/api/__init__.py
codex_api_client/api/data_api.py codex_client/api/data_api.py
codex_api_client/api/debug_api.py codex_client/api/debug_api.py
codex_api_client/api/marketplace_api.py codex_client/api/marketplace_api.py
codex_api_client/api/node_api.py codex_client/api/node_api.py
codex_api_client/api_client.py codex_client/api_client.py
codex_api_client/api_response.py codex_client/api_response.py
codex_api_client/configuration.py codex_client/configuration.py
codex_api_client/exceptions.py codex_client/exceptions.py
codex_api_client/models/__init__.py codex_client/models/__init__.py
codex_api_client/models/codex_version.py codex_client/models/content.py
codex_api_client/models/content.py codex_client/models/data_item.py
codex_api_client/models/data_item.py codex_client/models/data_list.py
codex_api_client/models/data_list.py codex_client/models/debug_info.py
codex_api_client/models/debug_info.py codex_client/models/erasure_parameters.py
codex_api_client/models/manifest_item.py codex_client/models/manifest_item.py
codex_api_client/models/node.py codex_client/models/peer_id_read.py
codex_api_client/models/peer_id_read.py codex_client/models/po_r_parameters.py
codex_api_client/models/peers_table.py codex_client/models/purchase.py
codex_api_client/models/purchase.py codex_client/models/reservation.py
codex_api_client/models/reservation.py codex_client/models/sales_availability.py
codex_api_client/models/sales_availability.py codex_client/models/sales_availability_create.py
codex_api_client/models/sales_availability_read.py codex_client/models/sales_availability_read.py
codex_api_client/models/slot.py codex_client/models/slot.py
codex_api_client/models/slot_agent.py codex_client/models/slot_agent.py
codex_api_client/models/space.py codex_client/models/space.py
codex_api_client/models/spr_read.py codex_client/models/spr_read.py
codex_api_client/models/storage_ask.py codex_client/models/storage_ask.py
codex_api_client/models/storage_request.py codex_client/models/storage_request.py
codex_api_client/models/storage_request_creation.py codex_client/models/storage_request_creation.py
codex_api_client/py.typed codex_client/py.typed
codex_api_client/rest.py codex_client/rest.py
docs/CodexVersion.md
docs/Content.md docs/Content.md
docs/DataApi.md docs/DataApi.md
docs/DataItem.md docs/DataItem.md
docs/DataList.md docs/DataList.md
docs/DebugApi.md docs/DebugApi.md
docs/DebugInfo.md docs/DebugInfo.md
docs/ErasureParameters.md
docs/ManifestItem.md docs/ManifestItem.md
docs/MarketplaceApi.md docs/MarketplaceApi.md
docs/Node.md
docs/NodeApi.md docs/NodeApi.md
docs/PeerIdRead.md docs/PeerIdRead.md
docs/PeersTable.md docs/PoRParameters.md
docs/Purchase.md docs/Purchase.md
docs/Reservation.md docs/Reservation.md
docs/SPRRead.md docs/SPRRead.md
docs/SalesAvailability.md docs/SalesAvailability.md
docs/SalesAvailabilityCREATE.md
docs/SalesAvailabilityREAD.md docs/SalesAvailabilityREAD.md
docs/Slot.md docs/Slot.md
docs/SlotAgent.md docs/SlotAgent.md
@ -57,6 +60,7 @@ docs/Space.md
docs/StorageAsk.md docs/StorageAsk.md
docs/StorageRequest.md docs/StorageRequest.md
docs/StorageRequestCreation.md docs/StorageRequestCreation.md
git_push.sh
pyproject.toml pyproject.toml
requirements.txt requirements.txt
setup.cfg setup.cfg

View File

@ -1 +1 @@
7.12.0 7.8.0

View File

@ -1,38 +0,0 @@
# {{{projectName}}}
{{#appDescriptionWithNewLines}}
{{{.}}}
{{/appDescriptionWithNewLines}}
This Python package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:
- API version: {{appVersion}}
- Package version: {{packageVersion}}
{{^hideGenerationTimestamp}}
- Build date: {{generatedDate}}
{{/hideGenerationTimestamp}}
- Generator version: {{generatorVersion}}
- Build package: {{generatorClass}}
{{#infoUrl}}
For more information, please visit [{{{infoUrl}}}]({{{infoUrl}}})
{{/infoUrl}}
## Requirements.
Python {{{generatorLanguageVersion}}}
## Installation
```sh
pip install {{{packageName}}}
```
Then import the package:
```python
import {{{packageName}}}
```
## Getting Started
Please follow the [installation procedure](#installation--usage) and then run the following:
{{> common_README }}

17
.travis.yml Normal file
View File

@ -0,0 +1,17 @@
# ref: https://docs.travis-ci.com/user/languages/python
language: python
python:
- "3.7"
- "3.8"
- "3.9"
- "3.10"
- "3.11"
# uncomment the following if needed
#- "3.11-dev" # 3.11 development branch
#- "nightly" # nightly build
# command to install dependencies
install:
- "pip install -r requirements.txt"
- "pip install -r test-requirements.txt"
# command to run tests
script: pytest --cov=codex_client

View File

@ -1,57 +1,81 @@
# codex-api-client # Codex API Client
List of endpoints and interfaces available to Codex API users List of endpoints and interfaces available to Codex API users
This Python package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: This Python package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:
- API version: 0.0.1 - API version: 0.0.1
- Package version: 0.4.0 - Package version: 1.0.0
- Generator version: 7.12.0 - Generator version: 7.8.0
- Build package: org.openapitools.codegen.languages.PythonClientCodegen - Build package: org.openapitools.codegen.languages.PythonClientCodegen
## Requirements. ## Requirements.
Python 3.8+ Python 3.7+
## Installation ## Installation & Usage
### pip install
If the python package is hosted on a repository, you can install directly using:
```sh ```sh
pip install codex_api_client pip install git+https://github.com/auhau/py-codex-api.git
``` ```
(you may need to run `pip` with root permission: `sudo pip install git+https://github.com/auhau/py-codex-api.git`)
Then import the package: Then import the package:
```python ```python
import codex_api_client import codex_client
``` ```
### Setuptools
Install via [Setuptools](http://pypi.python.org/pypi/setuptools).
```sh
python setup.py install --user
```
(or `sudo python setup.py install` to install the package for all users)
Then import the package:
```python
import codex_client
```
### Tests
Execute `pytest` to run the tests.
## Getting Started ## Getting Started
Please follow the [installation procedure](#installation--usage) and then run the following: Please follow the [installation procedure](#installation--usage) and then run the following:
```python ```python
import codex_api_client import codex_client
from codex_api_client.rest import ApiException from codex_client.rest import ApiException
from pprint import pprint from pprint import pprint
# Defining the host is optional and defaults to http://localhost:8080/api/codex/v1 # Defining the host is optional and defaults to http://localhost:8080/api/codex/v1
# See configuration.py for a list of all supported configuration parameters. # See configuration.py for a list of all supported configuration parameters.
configuration = codex_api_client.Configuration( configuration = codex_client.Configuration(
host = "http://localhost:8080/api/codex/v1" host = "http://localhost:8080/api/codex/v1"
) )
# Enter a context with an instance of the API client # Enter a context with an instance of the API client
with codex_api_client.ApiClient(configuration) as api_client: with codex_client.ApiClient(configuration) as api_client:
# Create an instance of the API class # Create an instance of the API class
api_instance = codex_api_client.DataApi(api_client) api_instance = codex_client.DataApi(api_client)
cid = 'cid_example' # str | Block or dataset to be deleted. cid = 'cid_example' # str | File to be downloaded.
try: try:
# Deletes either a single block or an entire dataset from the local node. # Download a file from the local node in a streaming manner. If the file is not available locally, a 404 is returned.
api_instance.delete_local(cid) api_response = api_instance.download_local(cid)
print("The response of DataApi->download_local:\n")
pprint(api_response)
except ApiException as e: except ApiException as e:
print("Exception when calling DataApi->delete_local: %s\n" % e) print("Exception when calling DataApi->download_local: %s\n" % e)
``` ```
@ -61,11 +85,8 @@ All URIs are relative to *http://localhost:8080/api/codex/v1*
Class | Method | HTTP request | Description Class | Method | HTTP request | Description
------------ | ------------- | ------------- | ------------- ------------ | ------------- | ------------- | -------------
*DataApi* | [**delete_local**](docs/DataApi.md#delete_local) | **DELETE** /data/{cid} | Deletes either a single block or an entire dataset from the local node.
*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. *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.
*DataApi* | [**download_network**](docs/DataApi.md#download_network) | **POST** /data/{cid}/network | 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. *DataApi* | [**download_network**](docs/DataApi.md#download_network) | **GET** /data/{cid}/network | 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.
*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's not available locally.
*DataApi* | [**download_network_stream**](docs/DataApi.md#download_network_stream) | **GET** /data/{cid}/network/stream | 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.
*DataApi* | [**list_data**](docs/DataApi.md#list_data) | **GET** /data | Lists manifest CIDs stored locally in node. *DataApi* | [**list_data**](docs/DataApi.md#list_data) | **GET** /data | Lists manifest CIDs stored locally in node.
*DataApi* | [**space**](docs/DataApi.md#space) | **GET** /space | Gets a summary of the storage space allocation of the node. *DataApi* | [**space**](docs/DataApi.md#space) | **GET** /space | Gets a summary of the storage space allocation of the node.
*DataApi* | [**upload**](docs/DataApi.md#upload) | **POST** /data | 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. *DataApi* | [**upload**](docs/DataApi.md#upload) | **POST** /data | 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.
@ -81,25 +102,25 @@ Class | Method | HTTP request | Description
*MarketplaceApi* | [**offer_storage**](docs/MarketplaceApi.md#offer_storage) | **POST** /sales/availability | Offers storage for sale *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 *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 *NodeApi* | [**connect_peer**](docs/NodeApi.md#connect_peer) | **GET** /connect/{peerId} | Connect to a peer
*NodeApi* | [**get_peer_id**](docs/NodeApi.md#get_peer_id) | **GET** /peerid | Get Node's PeerID *NodeApi* | [**get_peer_id**](docs/NodeApi.md#get_peer_id) | **GET** /node/peerid | Get Node's PeerID
*NodeApi* | [**get_spr**](docs/NodeApi.md#get_spr) | **GET** /spr | Get Node's SPR *NodeApi* | [**get_spr**](docs/NodeApi.md#get_spr) | **GET** /node/spr | Get Node's SPR
## Documentation For Models ## Documentation For Models
- [CodexVersion](docs/CodexVersion.md)
- [Content](docs/Content.md) - [Content](docs/Content.md)
- [DataItem](docs/DataItem.md) - [DataItem](docs/DataItem.md)
- [DataList](docs/DataList.md) - [DataList](docs/DataList.md)
- [DebugInfo](docs/DebugInfo.md) - [DebugInfo](docs/DebugInfo.md)
- [ErasureParameters](docs/ErasureParameters.md)
- [ManifestItem](docs/ManifestItem.md) - [ManifestItem](docs/ManifestItem.md)
- [Node](docs/Node.md)
- [PeerIdRead](docs/PeerIdRead.md) - [PeerIdRead](docs/PeerIdRead.md)
- [PeersTable](docs/PeersTable.md) - [PoRParameters](docs/PoRParameters.md)
- [Purchase](docs/Purchase.md) - [Purchase](docs/Purchase.md)
- [Reservation](docs/Reservation.md) - [Reservation](docs/Reservation.md)
- [SPRRead](docs/SPRRead.md) - [SPRRead](docs/SPRRead.md)
- [SalesAvailability](docs/SalesAvailability.md) - [SalesAvailability](docs/SalesAvailability.md)
- [SalesAvailabilityCREATE](docs/SalesAvailabilityCREATE.md)
- [SalesAvailabilityREAD](docs/SalesAvailabilityREAD.md) - [SalesAvailabilityREAD](docs/SalesAvailabilityREAD.md)
- [Slot](docs/Slot.md) - [Slot](docs/Slot.md)
- [SlotAgent](docs/SlotAgent.md) - [SlotAgent](docs/SlotAgent.md)

View File

@ -6,7 +6,7 @@ info:
description: "List of endpoints and interfaces available to Codex API users" description: "List of endpoints and interfaces available to Codex API users"
security: security:
- {} - { }
components: components:
schemas: schemas:
@ -27,6 +27,10 @@ components:
maxLength: 66 maxLength: 66
example: 0x... example: 0x...
BigInt:
type: string
description: Integer represented as decimal string
Cid: Cid:
type: string type: string
description: Content Identifier as specified at https://github.com/multiformats/cid description: Content Identifier as specified at https://github.com/multiformats/cid
@ -46,27 +50,22 @@ components:
type: string type: string
description: Address of Ethereum address description: Address of Ethereum address
PricePerBytePerSecond: Reward:
type: string type: string
description: The amount of tokens paid per byte per second per slot to hosts the client is willing to pay description: The maximum amount of tokens paid per second per slot to hosts the client is willing to pay
CollateralPerByte:
type: string
description: Number as decimal string that represents how much collateral per byte is asked from hosts that wants to fill a slots
Duration: Duration:
type: integer type: string
format: int64 description: The duration of the request in seconds as decimal string
description: The duration of the request in seconds
ProofProbability: ProofProbability:
type: string type: string
description: How often storage proofs are required as decimal string description: How often storage proofs are required as decimal string
Expiry: Expiry:
type: integer type: string
format: int64
description: A timestamp as seconds since unix epoch at which this request expires if the Request does not find requested amount of nodes to host the data. description: A timestamp as seconds since unix epoch at which this request expires if the Request does not find requested amount of nodes to host the data.
default: 10 minutes
SPR: SPR:
type: string type: string
@ -74,8 +73,6 @@ components:
SPRRead: SPRRead:
type: object type: object
required:
- spr
properties: properties:
spr: spr:
$ref: "#/components/schemas/SPR" $ref: "#/components/schemas/SPR"
@ -86,71 +83,36 @@ components:
id: id:
$ref: "#/components/schemas/PeerId" $ref: "#/components/schemas/PeerId"
ErasureParameters:
type: object
properties:
totalChunks:
type: integer
PoRParameters:
description: Parameters for Proof of Retrievability
type: object
properties:
u:
type: string
publicKey:
type: string
name:
type: string
Content: Content:
type: object type: object
required:
- cid
description: Parameters specifying the content description: Parameters specifying the content
properties: properties:
cid: cid:
$ref: "#/components/schemas/Cid" $ref: "#/components/schemas/Cid"
erasure:
Node: $ref: "#/components/schemas/ErasureParameters"
type: object por:
required: $ref: "#/components/schemas/PoRParameters"
- nodeId
- peerId
- record
- address
- seen
properties:
nodeId:
type: string
peerId:
type: string
record:
type: string
address:
type: string
seen:
type: boolean
CodexVersion:
type: object
properties:
version:
type: string
example: v0.1.7
revision:
type: string
example: 0c647d8
contracts:
type: string
example: 0b537c7
PeersTable:
type: object
required:
- localNode
- nodes
properties:
localNode:
$ref: "#/components/schemas/Node"
nodes:
type: array
items:
$ref: "#/components/schemas/Node"
DebugInfo: DebugInfo:
type: object type: object
required:
- id
- addrs
- repo
- spr
- announceAddresses
- table
- codex
properties: properties:
id: id:
$ref: "#/components/schemas/PeerId" $ref: "#/components/schemas/PeerId"
@ -163,93 +125,61 @@ components:
description: Path of the data repository where all nodes data are stored description: Path of the data repository where all nodes data are stored
spr: spr:
$ref: "#/components/schemas/SPR" $ref: "#/components/schemas/SPR"
announceAddresses:
type: array
items:
$ref: "#/components/schemas/MultiAddress"
table:
$ref: "#/components/schemas/PeersTable"
codex:
$ref: "#/components/schemas/CodexVersion"
SalesAvailability: SalesAvailability:
type: object type: object
required:
- totalSize
- duration
- minPricePerBytePerSecond
- totalCollateral
properties: properties:
id:
$ref: "#/components/schemas/Id"
totalSize: totalSize:
type: integer type: string
format: int64 description: Total size of availability's storage in bytes as decimal string
description: Total size of availability's storage in bytes
duration: duration:
$ref: "#/components/schemas/Duration" $ref: "#/components/schemas/Duration"
minPricePerBytePerSecond: minPrice:
type: string type: string
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 description: Minimum price to be paid (in amount of tokens) as decimal string
totalCollateral: maxCollateral:
type: string type: string
description: Total collateral (in amount of tokens) that can be used for matching requests description: Maximum collateral user is willing to pay per filled Slot (in amount of tokens) as decimal string
enabled:
type: boolean
description: Enable the ability to receive sales on this availability.
default: true
until:
type: integer
description: Specifies the latest timestamp, after which the availability will no longer host any slots. If set to 0, there will be no restrictions.
default: 0
SalesAvailabilityREAD: SalesAvailabilityREAD:
required:
- id
- totalRemainingCollateral
- freeSize
allOf: allOf:
- $ref: "#/components/schemas/SalesAvailability" - $ref: "#/components/schemas/SalesAvailability"
- type: object - type: object
properties: properties:
id:
$ref: "#/components/schemas/Id"
readonly: true
freeSize: freeSize:
type: integer
format: int64
description: Unused size of availability's storage in bytes as decimal string
readOnly: true
totalRemainingCollateral:
type: string type: string
description: Total collateral effective (in amount of tokens) that can be used for matching requests description: Unused size of availability's storage in bytes as decimal string
readOnly: true
SalesAvailabilityCREATE:
allOf:
- $ref: "#/components/schemas/SalesAvailability"
- required:
- totalSize
- minPrice
- maxCollateral
- duration
Slot: Slot:
type: object type: object
required:
- id
- request
- slotIndex
properties: properties:
id: id:
$ref: "#/components/schemas/SlotId" $ref: "#/components/schemas/SlotId"
request: request:
$ref: "#/components/schemas/StorageRequest" $ref: "#/components/schemas/StorageRequest"
slotIndex: slotIndex:
type: integer type: string
format: int64 description: Slot Index as decimal string
description: Slot Index number
SlotAgent: SlotAgent:
type: object type: object
required:
- state
- requestId
- slotIndex
properties: properties:
id:
$ref: "#/components/schemas/SlotId"
slotIndex: slotIndex:
type: integer type: string
format: int64 description: Slot Index as decimal string
description: Slot Index number
requestId: requestId:
$ref: "#/components/schemas/Id" $ref: "#/components/schemas/Id"
request: request:
@ -276,104 +206,71 @@ components:
Reservation: Reservation:
type: object type: object
required:
- id
- availabilityId
- size
- requestId
- slotIndex
- validUntil
properties: properties:
id: id:
$ref: "#/components/schemas/Id" $ref: "#/components/schemas/Id"
availabilityId: availabilityId:
$ref: "#/components/schemas/Id" $ref: "#/components/schemas/Id"
size: size:
type: integer $ref: "#/components/schemas/BigInt"
format: int64
description: Size of the slot in bytes
requestId: requestId:
$ref: "#/components/schemas/Id" $ref: "#/components/schemas/Id"
slotIndex: slotIndex:
type: integer type: string
format: int64 description: Slot Index as decimal string
description: Slot Index number
validUntil:
type: integer
description: Timestamp after which the reservation will no longer be valid.
StorageRequestCreation: StorageRequestCreation:
type: object type: object
required: required:
- pricePerBytePerSecond - reward
- duration - duration
- proofProbability - proofProbability
- collateralPerByte - collateral
- expiry - expiry
properties: properties:
duration: duration:
$ref: "#/components/schemas/Duration" $ref: "#/components/schemas/Duration"
pricePerBytePerSecond: reward:
$ref: "#/components/schemas/PricePerBytePerSecond" $ref: "#/components/schemas/Reward"
proofProbability: proofProbability:
$ref: "#/components/schemas/ProofProbability" $ref: "#/components/schemas/ProofProbability"
nodes: nodes:
description: Minimal number of nodes the content should be stored on description: Minimal number of nodes the content should be stored on
type: integer type: integer
default: 3 default: 1
minimum: 3
tolerance: tolerance:
description: Additional number of nodes on top of the `nodes` property that can be lost before pronouncing the content lost description: Additional number of nodes on top of the `nodes` property that can be lost before pronouncing the content lost
type: integer type: integer
default: 1 default: 0
minimum: 1 collateral:
collateralPerByte: type: string
$ref: "#/components/schemas/CollateralPerByte" description: Number as decimal string that represents how much collateral is asked from hosts that wants to fill a slots
expiry: expiry:
type: integer type: string
format: int64 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.
description: Number 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.
StorageAsk: StorageAsk:
type: object type: object
required: required:
- slots - reward
- slotSize
- duration
- proofProbability
- pricePerBytePerSecond
- collateralPerByte
- maxSlotLoss
properties: properties:
slots: slots:
description: Number of slots (eq. hosts) that the Request want to have the content spread over description: Number of slots (eq. hosts) that the Request want to have the content spread over
type: integer type: integer
format: int64
slotSize: slotSize:
type: integer type: string
format: int64 description: Amount of storage per slot (in bytes) as decimal string
description: Amount of storage per slot in bytes
duration: duration:
$ref: "#/components/schemas/Duration" $ref: "#/components/schemas/Duration"
proofProbability: proofProbability:
$ref: "#/components/schemas/ProofProbability" $ref: "#/components/schemas/ProofProbability"
pricePerBytePerSecond: reward:
$ref: "#/components/schemas/PricePerBytePerSecond" $ref: "#/components/schemas/Reward"
collateralPerByte:
$ref: "#/components/schemas/CollateralPerByte"
maxSlotLoss: maxSlotLoss:
type: integer type: integer
format: int64
description: Max slots that can be lost without data considered to be lost description: Max slots that can be lost without data considered to be lost
StorageRequest: StorageRequest:
type: object type: object
required:
- id
- client
- ask
- content
- expiry
- nonce
properties: properties:
id: id:
type: string type: string
@ -392,16 +289,13 @@ components:
Purchase: Purchase:
type: object type: object
required:
- state
- requestId
properties: properties:
state: state:
type: string type: string
description: Description of the Request's state description: Description of the Request's state
enum: enum:
- cancelled - cancelled
- errored - error
- failed - failed
- finished - finished
- pending - pending
@ -410,17 +304,12 @@ components:
- unknown - unknown
error: error:
type: string type: string
nullable: true
description: If Request failed, then here is presented the error message description: If Request failed, then here is presented the error message
request: request:
$ref: "#/components/schemas/StorageRequest" $ref: "#/components/schemas/StorageRequest"
requestId:
$ref: "#/components/schemas/Id"
DataList: DataList:
type: object type: object
required:
- content
properties: properties:
content: content:
type: array type: array
@ -429,9 +318,6 @@ components:
DataItem: DataItem:
type: object type: object
required:
- cid
- manifest
properties: properties:
cid: cid:
$ref: "#/components/schemas/Cid" $ref: "#/components/schemas/Cid"
@ -440,16 +326,11 @@ components:
ManifestItem: ManifestItem:
type: object type: object
required:
- treeCid
- datasetSize
- blockSize
- protected
properties: properties:
treeCid: rootHash:
$ref: "#/components/schemas/Cid" $ref: "#/components/schemas/Cid"
description: "Unique data identifier" description: "Root hash of the content"
datasetSize: originalBytes:
type: integer type: integer
format: int64 format: int64
description: "Length of original content in bytes" description: "Length of original content in bytes"
@ -459,24 +340,9 @@ components:
protected: protected:
type: boolean type: boolean
description: "Indicates if content is protected by erasure-coding" description: "Indicates if content is protected by erasure-coding"
filename:
type: string
nullable: true
description: "The original name of the uploaded content (optional)"
example: codex.png
mimetype:
type: string
nullable: true
description: "The original mimetype of the uploaded content (optional)"
example: image/png
Space: Space:
type: object type: object
required:
- totalBlocks
- quotaMaxBytes
- quotaUsedBytes
- quotaReservedBytes
properties: properties:
totalBlocks: totalBlocks:
description: "Number of blocks stored by the node" description: "Number of blocks stored by the node"
@ -485,15 +351,15 @@ components:
quotaMaxBytes: quotaMaxBytes:
type: integer type: integer
format: int64 format: int64
description: "Maximum storage space (in bytes) available for the node in Codex's local repository." description: "Maximum storage space used by the node"
quotaUsedBytes: quotaUsedBytes:
type: integer type: integer
format: int64 format: int64
description: "Amount of storage space (in bytes) currently used for storing files in Codex's local repository." description: "Amount of storage space currently in use"
quotaReservedBytes: quotaReservedBytes:
type: integer type: integer
format: int64 format: int64
description: "Amount of storage reserved (in bytes) in the Codex's local repository for future use when storage requests will be picked up and hosted by the node using node's availabilities. This does not include the storage currently in use." description: "Amount of storage space reserved"
servers: servers:
- url: "http://localhost:8080/api/codex/v1" - url: "http://localhost:8080/api/codex/v1"
@ -515,7 +381,7 @@ paths:
description: | description: |
If `addrs` param is supplied, it will be used to dial the peer, otherwise the `peerId` is used If `addrs` param is supplied, it will be used to dial the peer, otherwise the `peerId` is used
to invoke peer discovery, if it succeeds the returned addresses will be used to dial. to invoke peer discovery, if it succeeds the returned addresses will be used to dial.
tags: [Node] tags: [ Node ]
operationId: connectPeer operationId: connectPeer
parameters: parameters:
- in: path - in: path
@ -545,7 +411,7 @@ paths:
"/data": "/data":
get: get:
summary: "Lists manifest CIDs stored locally in node." summary: "Lists manifest CIDs stored locally in node."
tags: [Data] tags: [ Data ]
operationId: listData operationId: listData
responses: responses:
"200": "200":
@ -559,29 +425,12 @@ paths:
description: Invalid CID is specified description: Invalid CID is specified
"404": "404":
description: Content specified by the CID is not found description: Content specified by the CID is not found
"422":
description: The content type is not a valid content type or the filename is not valid
"500": "500":
description: Well it was bad-bad description: Well it was bad-bad
post: post:
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." 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."
tags: [Data] tags: [ Data ]
operationId: upload operationId: upload
parameters:
- name: content-type
in: header
required: false
description: The content type of the file. Must be valid.
schema:
type: string
example: "image/png"
- name: content-disposition
in: header
required: false
description: The content disposition used to send the filename.
schema:
type: string
example: 'attachment; filename="codex.png"'
requestBody: requestBody:
content: content:
application/octet-stream: application/octet-stream:
@ -595,15 +444,13 @@ paths:
text/plain: text/plain:
schema: schema:
type: string type: string
"422":
description: The mimetype of the filename is invalid
"500": "500":
description: Well it was bad-bad and the upload did not work out description: Well it was bad-bad and the upload did not work out
"/data/{cid}": "/data/{cid}":
get: get:
summary: "Download a file from the local node in a streaming manner. If the file is not available locally, a 404 is returned." summary: "Download a file from the local node in a streaming manner. If the file is not available locally, a 404 is returned."
tags: [Data] tags: [ Data ]
operationId: downloadLocal operationId: downloadLocal
parameters: parameters:
- in: path - in: path
@ -628,57 +475,11 @@ paths:
"500": "500":
description: Well it was bad-bad description: Well it was bad-bad
delete:
summary: "Deletes either a single block or an entire dataset from the local node."
tags: [Data]
operationId: deleteLocal
parameters:
- in: path
name: cid
required: true
schema:
$ref: "#/components/schemas/Cid"
description: Block or dataset to be deleted.
responses:
"204":
description: Data was successfully deleted.
"400":
description: Invalid CID is specified
"500":
description: There was an error during deletion
"/data/{cid}/network": "/data/{cid}/network":
post:
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."
tags: [Data]
operationId: downloadNetwork
parameters:
- in: path
name: cid
required: true
schema:
$ref: "#/components/schemas/Cid"
description: "File to be downloaded."
responses:
"200":
description: Manifest information for download that has been started.
content:
application/json:
schema:
$ref: "#/components/schemas/DataItem"
"400":
description: Invalid CID is specified
"404":
description: Failed to download dataset manifest
"500":
description: Well it was bad-bad
"/data/{cid}/network/stream":
get: get:
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." 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."
tags: [Data] tags: [ Data ]
operationId: downloadNetworkStream operationId: downloadNetwork
parameters: parameters:
- in: path - in: path
name: cid name: cid
@ -701,36 +502,10 @@ paths:
"500": "500":
description: Well it was bad-bad description: Well it was bad-bad
"/data/{cid}/network/manifest":
get:
summary: "Download only the dataset manifest from the network to the local node if it's not available locally."
tags: [Data]
operationId: downloadNetworkManifest
parameters:
- in: path
name: cid
required: true
schema:
$ref: "#/components/schemas/Cid"
description: "File for which the manifest is to be downloaded."
responses:
"200":
description: Manifest information.
content:
application/json:
schema:
$ref: "#/components/schemas/DataItem"
"400":
description: Invalid CID is specified
"404":
description: Failed to download dataset manifest
"500":
description: Well it was bad-bad
"/space": "/space":
get: get:
summary: "Gets a summary of the storage space allocation of the node." summary: "Gets a summary of the storage space allocation of the node."
tags: [Data] tags: [ Data ]
operationId: space operationId: space
responses: responses:
"200": "200":
@ -746,7 +521,7 @@ paths:
"/sales/slots": "/sales/slots":
get: get:
summary: "Returns active slots" summary: "Returns active slots"
tags: [Marketplace] tags: [ Marketplace ]
operationId: getActiveSlots operationId: getActiveSlots
responses: responses:
"200": "200":
@ -764,7 +539,7 @@ paths:
"/sales/slots/{slotId}": "/sales/slots/{slotId}":
get: get:
summary: "Returns active slot with id {slotId} for the host" summary: "Returns active slot with id {slotId} for the host"
tags: [Marketplace] tags: [ Marketplace ]
operationId: getActiveSlotById operationId: getActiveSlotById
parameters: parameters:
- in: path - in: path
@ -793,7 +568,7 @@ paths:
"/sales/availability": "/sales/availability":
get: get:
summary: "Returns storage that is for sale" summary: "Returns storage that is for sale"
tags: [Marketplace] tags: [ Marketplace ]
operationId: getAvailabilities operationId: getAvailabilities
responses: responses:
"200": "200":
@ -812,12 +587,12 @@ paths:
post: post:
summary: "Offers storage for sale" summary: "Offers storage for sale"
operationId: offerStorage operationId: offerStorage
tags: [Marketplace] tags: [ Marketplace ]
requestBody: requestBody:
content: content:
application/json: application/json:
schema: schema:
$ref: "#/components/schemas/SalesAvailability" $ref: "#/components/schemas/SalesAvailabilityCREATE"
responses: responses:
"201": "201":
description: Created storage availability description: Created storage availability
@ -828,7 +603,7 @@ paths:
"400": "400":
description: Invalid data input description: Invalid data input
"422": "422":
description: Not enough node's storage quota available or the provided parameters did not pass validation description: Not enough node's storage quota available
"500": "500":
description: Error reserving availability description: Error reserving availability
"503": "503":
@ -840,7 +615,7 @@ paths:
The new parameters will be only considered for new requests. The new parameters will be only considered for new requests.
Existing Requests linked to this Availability will continue as is. Existing Requests linked to this Availability will continue as is.
operationId: updateOfferedStorage operationId: updateOfferedStorage
tags: [Marketplace] tags: [ Marketplace ]
parameters: parameters:
- in: path - in: path
name: id name: id
@ -861,7 +636,7 @@ paths:
"404": "404":
description: Availability not found description: Availability not found
"422": "422":
description: The provided parameters did not pass validation description: Not enough node's storage quota available
"500": "500":
description: Error reserving availability description: Error reserving availability
"503": "503":
@ -872,7 +647,7 @@ paths:
summary: "Get availability's reservations" summary: "Get availability's reservations"
description: Return's list of Reservations for ongoing Storage Requests that the node hosts. description: Return's list of Reservations for ongoing Storage Requests that the node hosts.
operationId: getReservations operationId: getReservations
tags: [Marketplace] tags: [ Marketplace ]
parameters: parameters:
- in: path - in: path
name: id name: id
@ -901,7 +676,7 @@ paths:
"/storage/request/{cid}": "/storage/request/{cid}":
post: post:
summary: "Creates a new Request for storage" summary: "Creates a new Request for storage"
tags: [Marketplace] tags: [ Marketplace ]
operationId: createStorageRequest operationId: createStorageRequest
parameters: parameters:
- in: path - in: path
@ -924,8 +699,6 @@ paths:
type: string type: string
"400": "400":
description: Invalid or missing Request ID description: Invalid or missing Request ID
"422":
description: The storage request parameters are not valid
"404": "404":
description: Request ID not found description: Request ID not found
"503": "503":
@ -934,7 +707,7 @@ paths:
"/storage/purchases": "/storage/purchases":
get: get:
summary: "Returns list of purchase IDs" summary: "Returns list of purchase IDs"
tags: [Marketplace] tags: [ Marketplace ]
operationId: getPurchases operationId: getPurchases
responses: responses:
"200": "200":
@ -951,7 +724,7 @@ paths:
"/storage/purchases/{id}": "/storage/purchases/{id}":
get: get:
summary: "Returns purchase details" summary: "Returns purchase details"
tags: [Marketplace] tags: [ Marketplace ]
operationId: getPurchase operationId: getPurchase
parameters: parameters:
- in: path - in: path
@ -974,16 +747,16 @@ paths:
"503": "503":
description: Persistence is not enabled description: Persistence is not enabled
"/spr": "/node/spr":
get: get:
summary: "Get Node's SPR" summary: "Get Node's SPR"
operationId: getSPR operationId: getSPR
tags: [Node] tags: [ Node ]
responses: responses:
"200": "200":
description: Node's SPR description: Node's SPR
content: content:
text/plain: plain/text:
schema: schema:
$ref: "#/components/schemas/SPR" $ref: "#/components/schemas/SPR"
application/json: application/json:
@ -992,16 +765,16 @@ paths:
"503": "503":
description: Node SPR not ready, try again later description: Node SPR not ready, try again later
"/peerid": "/node/peerid":
get: get:
summary: "Get Node's PeerID" summary: "Get Node's PeerID"
operationId: getPeerId operationId: getPeerId
tags: [Node] tags: [ Node ]
responses: responses:
"200": "200":
description: Node's Peer ID description: Node's Peer ID
content: content:
text/plain: plain/text:
schema: schema:
$ref: "#/components/schemas/PeerId" $ref: "#/components/schemas/PeerId"
application/json: application/json:
@ -1011,7 +784,7 @@ paths:
"/debug/chronicles/loglevel": "/debug/chronicles/loglevel":
post: post:
summary: "Set log level at run time" summary: "Set log level at run time"
tags: [Debug] tags: [ Debug ]
operationId: setDebugLogLevel operationId: setDebugLogLevel
parameters: parameters:
@ -1033,7 +806,7 @@ paths:
get: get:
summary: "Gets node information" summary: "Gets node information"
operationId: getDebugInfo operationId: getDebugInfo
tags: [Debug] tags: [ Debug ]
responses: responses:
"200": "200":
description: Node's information description: Node's information

View File

@ -1,56 +0,0 @@
# coding: utf-8
# flake8: noqa
"""
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
__version__ = "0.4.0"
# import apis into sdk package
from codex_api_client.api.data_api import DataApi
from codex_api_client.api.debug_api import DebugApi
from codex_api_client.api.marketplace_api import MarketplaceApi
from codex_api_client.api.node_api import NodeApi
# import ApiClient
from codex_api_client.api_response import ApiResponse
from codex_api_client.api_client import ApiClient
from codex_api_client.configuration import Configuration
from codex_api_client.exceptions import OpenApiException
from codex_api_client.exceptions import ApiTypeError
from codex_api_client.exceptions import ApiValueError
from codex_api_client.exceptions import ApiKeyError
from codex_api_client.exceptions import ApiAttributeError
from codex_api_client.exceptions import ApiException
# import models into sdk package
from codex_api_client.models.codex_version import CodexVersion
from codex_api_client.models.content import Content
from codex_api_client.models.data_item import DataItem
from codex_api_client.models.data_list import DataList
from codex_api_client.models.debug_info import DebugInfo
from codex_api_client.models.manifest_item import ManifestItem
from codex_api_client.models.node import Node
from codex_api_client.models.peer_id_read import PeerIdRead
from codex_api_client.models.peers_table import PeersTable
from codex_api_client.models.purchase import Purchase
from codex_api_client.models.reservation import Reservation
from codex_api_client.models.spr_read import SPRRead
from codex_api_client.models.sales_availability import SalesAvailability
from codex_api_client.models.sales_availability_read import SalesAvailabilityREAD
from codex_api_client.models.slot import Slot
from codex_api_client.models.slot_agent import SlotAgent
from codex_api_client.models.space import Space
from codex_api_client.models.storage_ask import StorageAsk
from codex_api_client.models.storage_request import StorageRequest
from codex_api_client.models.storage_request_creation import StorageRequestCreation

View File

@ -1,8 +0,0 @@
# flake8: noqa
# import apis into api package
from codex_api_client.api.data_api import DataApi
from codex_api_client.api.debug_api import DebugApi
from codex_api_client.api.marketplace_api import MarketplaceApi
from codex_api_client.api.node_api import NodeApi

View File

@ -1,36 +0,0 @@
# coding: utf-8
# flake8: noqa
"""
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 models into model package
from codex_api_client.models.codex_version import CodexVersion
from codex_api_client.models.content import Content
from codex_api_client.models.data_item import DataItem
from codex_api_client.models.data_list import DataList
from codex_api_client.models.debug_info import DebugInfo
from codex_api_client.models.manifest_item import ManifestItem
from codex_api_client.models.node import Node
from codex_api_client.models.peer_id_read import PeerIdRead
from codex_api_client.models.peers_table import PeersTable
from codex_api_client.models.purchase import Purchase
from codex_api_client.models.reservation import Reservation
from codex_api_client.models.spr_read import SPRRead
from codex_api_client.models.sales_availability import SalesAvailability
from codex_api_client.models.sales_availability_read import SalesAvailabilityREAD
from codex_api_client.models.slot import Slot
from codex_api_client.models.slot_agent import SlotAgent
from codex_api_client.models.space import Space
from codex_api_client.models.storage_ask import StorageAsk
from codex_api_client.models.storage_request import StorageRequest
from codex_api_client.models.storage_request_creation import StorageRequestCreation

View File

@ -1,107 +0,0 @@
# 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, StrictBool, StrictInt, StrictStr
from typing import Any, ClassVar, Dict, List, Optional
from typing import Optional, Set
from typing_extensions import Self
class ManifestItem(BaseModel):
"""
ManifestItem
""" # noqa: E501
tree_cid: StrictStr = Field(description="Content Identifier as specified at https://github.com/multiformats/cid", alias="treeCid")
dataset_size: StrictInt = Field(description="Length of original content in bytes", alias="datasetSize")
block_size: StrictInt = Field(description="Size of blocks", alias="blockSize")
protected: StrictBool = Field(description="Indicates if content is protected by erasure-coding")
filename: Optional[StrictStr] = Field(default=None, description="The original name of the uploaded content (optional)")
mimetype: Optional[StrictStr] = Field(default=None, description="The original mimetype of the uploaded content (optional)")
__properties: ClassVar[List[str]] = ["treeCid", "datasetSize", "blockSize", "protected", "filename", "mimetype"]
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 ManifestItem 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,
)
# set to None if filename (nullable) is None
# and model_fields_set contains the field
if self.filename is None and "filename" in self.model_fields_set:
_dict['filename'] = None
# set to None if mimetype (nullable) is None
# and model_fields_set contains the field
if self.mimetype is None and "mimetype" in self.model_fields_set:
_dict['mimetype'] = None
return _dict
@classmethod
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
"""Create an instance of ManifestItem from a dict"""
if obj is None:
return None
if not isinstance(obj, dict):
return cls.model_validate(obj)
_obj = cls.model_validate({
"treeCid": obj.get("treeCid"),
"datasetSize": obj.get("datasetSize"),
"blockSize": obj.get("blockSize"),
"protected": obj.get("protected"),
"filename": obj.get("filename"),
"mimetype": obj.get("mimetype")
})
return _obj

View File

@ -1,108 +0,0 @@
# 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, StrictBool, StrictInt, StrictStr
from typing import Any, ClassVar, Dict, List, Optional
from typing_extensions import Annotated
from typing import Optional, Set
from typing_extensions import Self
class SalesAvailabilityREAD(BaseModel):
"""
SalesAvailabilityREAD
""" # noqa: E501
total_size: StrictInt = Field(description="Total size of availability's storage in bytes", alias="totalSize")
duration: StrictInt = Field(description="The duration of the request in seconds")
min_price_per_byte_per_second: StrictStr = Field(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")
total_collateral: StrictStr = Field(description="Total collateral (in amount of tokens) that can be used for matching requests", alias="totalCollateral")
enabled: Optional[StrictBool] = Field(default=True, description="Enable the ability to receive sales on this availability.")
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.")
id: Annotated[str, Field(min_length=66, strict=True, max_length=66)] = Field(description="32bits identifier encoded in hex-decimal string.")
free_size: StrictInt = Field(description="Unused size of availability's storage in bytes as decimal string", alias="freeSize")
total_remaining_collateral: StrictStr = Field(description="Total collateral effective (in amount of tokens) that can be used for matching requests", alias="totalRemainingCollateral")
__properties: ClassVar[List[str]] = ["totalSize", "duration", "minPricePerBytePerSecond", "totalCollateral", "enabled", "until", "id", "freeSize", "totalRemainingCollateral"]
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 SalesAvailabilityREAD 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.
* OpenAPI `readOnly` fields are excluded.
* OpenAPI `readOnly` fields are excluded.
"""
excluded_fields: Set[str] = set([
"free_size",
"total_remaining_collateral",
])
_dict = self.model_dump(
by_alias=True,
exclude=excluded_fields,
exclude_none=True,
)
return _dict
@classmethod
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
"""Create an instance of SalesAvailabilityREAD from a dict"""
if obj is None:
return None
if not isinstance(obj, dict):
return cls.model_validate(obj)
_obj = cls.model_validate({
"totalSize": obj.get("totalSize"),
"duration": obj.get("duration"),
"minPricePerBytePerSecond": obj.get("minPricePerBytePerSecond"),
"totalCollateral": obj.get("totalCollateral"),
"enabled": obj.get("enabled") if obj.get("enabled") is not None else True,
"until": obj.get("until") if obj.get("until") is not None else 0,
"id": obj.get("id"),
"freeSize": obj.get("freeSize"),
"totalRemainingCollateral": obj.get("totalRemainingCollateral")
})
return _obj

56
codex_client/__init__.py Normal file
View File

@ -0,0 +1,56 @@
# coding: utf-8
# flake8: noqa
"""
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
__version__ = "1.0.0"
# import apis into sdk package
from codex_client.api.data_api import DataApi
from codex_client.api.debug_api import DebugApi
from codex_client.api.marketplace_api import MarketplaceApi
from codex_client.api.node_api import NodeApi
# import ApiClient
from codex_client.api_response import ApiResponse
from codex_client.api_client import ApiClient
from codex_client.configuration import Configuration
from codex_client.exceptions import OpenApiException
from codex_client.exceptions import ApiTypeError
from codex_client.exceptions import ApiValueError
from codex_client.exceptions import ApiKeyError
from codex_client.exceptions import ApiAttributeError
from codex_client.exceptions import ApiException
# import models into sdk package
from codex_client.models.content import Content
from codex_client.models.data_item import DataItem
from codex_client.models.data_list import DataList
from codex_client.models.debug_info import DebugInfo
from codex_client.models.erasure_parameters import ErasureParameters
from codex_client.models.manifest_item import ManifestItem
from codex_client.models.peer_id_read import PeerIdRead
from codex_client.models.po_r_parameters import PoRParameters
from codex_client.models.purchase import Purchase
from codex_client.models.reservation import Reservation
from codex_client.models.spr_read import SPRRead
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
from codex_client.models.storage_request_creation import StorageRequestCreation

View File

@ -0,0 +1,8 @@
# flake8: noqa
# import apis into api package
from codex_client.api.data_api import DataApi
from codex_client.api.debug_api import DebugApi
from codex_client.api.marketplace_api import MarketplaceApi
from codex_client.api.node_api import NodeApi

View File

@ -17,11 +17,11 @@ from typing import Any, Dict, List, Optional, Tuple, Union
from typing_extensions import Annotated from typing_extensions import Annotated
from pydantic import StrictStr from pydantic import StrictStr
from codex_api_client.models.debug_info import DebugInfo from codex_client.models.debug_info import DebugInfo
from codex_api_client.api_client import ApiClient, RequestSerialized from codex_client.api_client import ApiClient, RequestSerialized
from codex_api_client.api_response import ApiResponse from codex_client.api_response import ApiResponse
from codex_api_client.rest import RESTResponseType from codex_client.rest import RESTResponseType
class DebugApi: class DebugApi:
@ -236,9 +236,7 @@ class DebugApi:
_query_params: List[Tuple[str, str]] = [] _query_params: List[Tuple[str, str]] = []
_header_params: Dict[str, Optional[str]] = _headers or {} _header_params: Dict[str, Optional[str]] = _headers or {}
_form_params: List[Tuple[str, str]] = [] _form_params: List[Tuple[str, str]] = []
_files: Dict[ _files: Dict[str, Union[str, bytes]] = {}
str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
] = {}
_body_params: Optional[bytes] = None _body_params: Optional[bytes] = None
# process the path parameters # process the path parameters
@ -497,9 +495,7 @@ class DebugApi:
_query_params: List[Tuple[str, str]] = [] _query_params: List[Tuple[str, str]] = []
_header_params: Dict[str, Optional[str]] = _headers or {} _header_params: Dict[str, Optional[str]] = _headers or {}
_form_params: List[Tuple[str, str]] = [] _form_params: List[Tuple[str, str]] = []
_files: Dict[ _files: Dict[str, Union[str, bytes]] = {}
str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
] = {}
_body_params: Optional[bytes] = None _body_params: Optional[bytes] = None
# process the path parameters # process the path parameters

View File

@ -19,17 +19,18 @@ from typing_extensions import Annotated
from pydantic import Field, StrictStr from pydantic import Field, StrictStr
from typing import List, Optional from typing import List, Optional
from typing_extensions import Annotated from typing_extensions import Annotated
from codex_api_client.models.purchase import Purchase from codex_client.models.purchase import Purchase
from codex_api_client.models.reservation import Reservation from codex_client.models.reservation import Reservation
from codex_api_client.models.sales_availability import SalesAvailability from codex_client.models.sales_availability import SalesAvailability
from codex_api_client.models.sales_availability_read import SalesAvailabilityREAD from codex_client.models.sales_availability_create import SalesAvailabilityCREATE
from codex_api_client.models.slot import Slot from codex_client.models.sales_availability_read import SalesAvailabilityREAD
from codex_api_client.models.slot_agent import SlotAgent from codex_client.models.slot import Slot
from codex_api_client.models.storage_request_creation import StorageRequestCreation from codex_client.models.slot_agent import SlotAgent
from codex_client.models.storage_request_creation import StorageRequestCreation
from codex_api_client.api_client import ApiClient, RequestSerialized from codex_client.api_client import ApiClient, RequestSerialized
from codex_api_client.api_response import ApiResponse from codex_client.api_response import ApiResponse
from codex_api_client.rest import RESTResponseType from codex_client.rest import RESTResponseType
class MarketplaceApi: class MarketplaceApi:
@ -104,7 +105,6 @@ class MarketplaceApi:
_response_types_map: Dict[str, Optional[str]] = { _response_types_map: Dict[str, Optional[str]] = {
'200': "str", '200': "str",
'400': None, '400': None,
'422': None,
'404': None, '404': None,
'503': None, '503': None,
} }
@ -178,7 +178,6 @@ class MarketplaceApi:
_response_types_map: Dict[str, Optional[str]] = { _response_types_map: Dict[str, Optional[str]] = {
'200': "str", '200': "str",
'400': None, '400': None,
'422': None,
'404': None, '404': None,
'503': None, '503': None,
} }
@ -252,7 +251,6 @@ class MarketplaceApi:
_response_types_map: Dict[str, Optional[str]] = { _response_types_map: Dict[str, Optional[str]] = {
'200': "str", '200': "str",
'400': None, '400': None,
'422': None,
'404': None, '404': None,
'503': None, '503': None,
} }
@ -282,9 +280,7 @@ class MarketplaceApi:
_query_params: List[Tuple[str, str]] = [] _query_params: List[Tuple[str, str]] = []
_header_params: Dict[str, Optional[str]] = _headers or {} _header_params: Dict[str, Optional[str]] = _headers or {}
_form_params: List[Tuple[str, str]] = [] _form_params: List[Tuple[str, str]] = []
_files: Dict[ _files: Dict[str, Union[str, bytes]] = {}
str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
] = {}
_body_params: Optional[bytes] = None _body_params: Optional[bytes] = None
# process the path parameters # process the path parameters
@ -563,9 +559,7 @@ class MarketplaceApi:
_query_params: List[Tuple[str, str]] = [] _query_params: List[Tuple[str, str]] = []
_header_params: Dict[str, Optional[str]] = _headers or {} _header_params: Dict[str, Optional[str]] = _headers or {}
_form_params: List[Tuple[str, str]] = [] _form_params: List[Tuple[str, str]] = []
_files: Dict[ _files: Dict[str, Union[str, bytes]] = {}
str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
] = {}
_body_params: Optional[bytes] = None _body_params: Optional[bytes] = None
# process the path parameters # process the path parameters
@ -810,9 +804,7 @@ class MarketplaceApi:
_query_params: List[Tuple[str, str]] = [] _query_params: List[Tuple[str, str]] = []
_header_params: Dict[str, Optional[str]] = _headers or {} _header_params: Dict[str, Optional[str]] = _headers or {}
_form_params: List[Tuple[str, str]] = [] _form_params: List[Tuple[str, str]] = []
_files: Dict[ _files: Dict[str, Union[str, bytes]] = {}
str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
] = {}
_body_params: Optional[bytes] = None _body_params: Optional[bytes] = None
# process the path parameters # process the path parameters
@ -1058,9 +1050,7 @@ class MarketplaceApi:
_query_params: List[Tuple[str, str]] = [] _query_params: List[Tuple[str, str]] = []
_header_params: Dict[str, Optional[str]] = _headers or {} _header_params: Dict[str, Optional[str]] = _headers or {}
_form_params: List[Tuple[str, str]] = [] _form_params: List[Tuple[str, str]] = []
_files: Dict[ _files: Dict[str, Union[str, bytes]] = {}
str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
] = {}
_body_params: Optional[bytes] = None _body_params: Optional[bytes] = None
# process the path parameters # process the path parameters
@ -1322,9 +1312,7 @@ class MarketplaceApi:
_query_params: List[Tuple[str, str]] = [] _query_params: List[Tuple[str, str]] = []
_header_params: Dict[str, Optional[str]] = _headers or {} _header_params: Dict[str, Optional[str]] = _headers or {}
_form_params: List[Tuple[str, str]] = [] _form_params: List[Tuple[str, str]] = []
_files: Dict[ _files: Dict[str, Union[str, bytes]] = {}
str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
] = {}
_body_params: Optional[bytes] = None _body_params: Optional[bytes] = None
# process the path parameters # process the path parameters
@ -1569,9 +1557,7 @@ class MarketplaceApi:
_query_params: List[Tuple[str, str]] = [] _query_params: List[Tuple[str, str]] = []
_header_params: Dict[str, Optional[str]] = _headers or {} _header_params: Dict[str, Optional[str]] = _headers or {}
_form_params: List[Tuple[str, str]] = [] _form_params: List[Tuple[str, str]] = []
_files: Dict[ _files: Dict[str, Union[str, bytes]] = {}
str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
] = {}
_body_params: Optional[bytes] = None _body_params: Optional[bytes] = None
# process the path parameters # process the path parameters
@ -1839,9 +1825,7 @@ class MarketplaceApi:
_query_params: List[Tuple[str, str]] = [] _query_params: List[Tuple[str, str]] = []
_header_params: Dict[str, Optional[str]] = _headers or {} _header_params: Dict[str, Optional[str]] = _headers or {}
_form_params: List[Tuple[str, str]] = [] _form_params: List[Tuple[str, str]] = []
_files: Dict[ _files: Dict[str, Union[str, bytes]] = {}
str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
] = {}
_body_params: Optional[bytes] = None _body_params: Optional[bytes] = None
# process the path parameters # process the path parameters
@ -1887,7 +1871,7 @@ class MarketplaceApi:
@validate_call @validate_call
def offer_storage( def offer_storage(
self, self,
sales_availability: Optional[SalesAvailability] = None, sales_availability_create: Optional[SalesAvailabilityCREATE] = None,
_request_timeout: Union[ _request_timeout: Union[
None, None,
Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)],
@ -1904,8 +1888,8 @@ class MarketplaceApi:
"""Offers storage for sale """Offers storage for sale
:param sales_availability: :param sales_availability_create:
:type sales_availability: SalesAvailability :type sales_availability_create: SalesAvailabilityCREATE
:param _request_timeout: timeout setting for this request. If one :param _request_timeout: timeout setting for this request. If one
number provided, it will be total request number provided, it will be total request
timeout. It can also be a pair (tuple) of timeout. It can also be a pair (tuple) of
@ -1929,7 +1913,7 @@ class MarketplaceApi:
""" # noqa: E501 """ # noqa: E501
_param = self._offer_storage_serialize( _param = self._offer_storage_serialize(
sales_availability=sales_availability, sales_availability_create=sales_availability_create,
_request_auth=_request_auth, _request_auth=_request_auth,
_content_type=_content_type, _content_type=_content_type,
_headers=_headers, _headers=_headers,
@ -1957,7 +1941,7 @@ class MarketplaceApi:
@validate_call @validate_call
def offer_storage_with_http_info( def offer_storage_with_http_info(
self, self,
sales_availability: Optional[SalesAvailability] = None, sales_availability_create: Optional[SalesAvailabilityCREATE] = None,
_request_timeout: Union[ _request_timeout: Union[
None, None,
Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)],
@ -1974,8 +1958,8 @@ class MarketplaceApi:
"""Offers storage for sale """Offers storage for sale
:param sales_availability: :param sales_availability_create:
:type sales_availability: SalesAvailability :type sales_availability_create: SalesAvailabilityCREATE
:param _request_timeout: timeout setting for this request. If one :param _request_timeout: timeout setting for this request. If one
number provided, it will be total request number provided, it will be total request
timeout. It can also be a pair (tuple) of timeout. It can also be a pair (tuple) of
@ -1999,7 +1983,7 @@ class MarketplaceApi:
""" # noqa: E501 """ # noqa: E501
_param = self._offer_storage_serialize( _param = self._offer_storage_serialize(
sales_availability=sales_availability, sales_availability_create=sales_availability_create,
_request_auth=_request_auth, _request_auth=_request_auth,
_content_type=_content_type, _content_type=_content_type,
_headers=_headers, _headers=_headers,
@ -2027,7 +2011,7 @@ class MarketplaceApi:
@validate_call @validate_call
def offer_storage_without_preload_content( def offer_storage_without_preload_content(
self, self,
sales_availability: Optional[SalesAvailability] = None, sales_availability_create: Optional[SalesAvailabilityCREATE] = None,
_request_timeout: Union[ _request_timeout: Union[
None, None,
Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)],
@ -2044,8 +2028,8 @@ class MarketplaceApi:
"""Offers storage for sale """Offers storage for sale
:param sales_availability: :param sales_availability_create:
:type sales_availability: SalesAvailability :type sales_availability_create: SalesAvailabilityCREATE
:param _request_timeout: timeout setting for this request. If one :param _request_timeout: timeout setting for this request. If one
number provided, it will be total request number provided, it will be total request
timeout. It can also be a pair (tuple) of timeout. It can also be a pair (tuple) of
@ -2069,7 +2053,7 @@ class MarketplaceApi:
""" # noqa: E501 """ # noqa: E501
_param = self._offer_storage_serialize( _param = self._offer_storage_serialize(
sales_availability=sales_availability, sales_availability_create=sales_availability_create,
_request_auth=_request_auth, _request_auth=_request_auth,
_content_type=_content_type, _content_type=_content_type,
_headers=_headers, _headers=_headers,
@ -2092,7 +2076,7 @@ class MarketplaceApi:
def _offer_storage_serialize( def _offer_storage_serialize(
self, self,
sales_availability, sales_availability_create,
_request_auth, _request_auth,
_content_type, _content_type,
_headers, _headers,
@ -2108,9 +2092,7 @@ class MarketplaceApi:
_query_params: List[Tuple[str, str]] = [] _query_params: List[Tuple[str, str]] = []
_header_params: Dict[str, Optional[str]] = _headers or {} _header_params: Dict[str, Optional[str]] = _headers or {}
_form_params: List[Tuple[str, str]] = [] _form_params: List[Tuple[str, str]] = []
_files: Dict[ _files: Dict[str, Union[str, bytes]] = {}
str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
] = {}
_body_params: Optional[bytes] = None _body_params: Optional[bytes] = None
# process the path parameters # process the path parameters
@ -2118,8 +2100,8 @@ class MarketplaceApi:
# process the header parameters # process the header parameters
# process the form parameters # process the form parameters
# process the body parameter # process the body parameter
if sales_availability is not None: if sales_availability_create is not None:
_body_params = sales_availability _body_params = sales_availability_create
# set the HTTP header `Accept` # set the HTTP header `Accept`
@ -2409,9 +2391,7 @@ class MarketplaceApi:
_query_params: List[Tuple[str, str]] = [] _query_params: List[Tuple[str, str]] = []
_header_params: Dict[str, Optional[str]] = _headers or {} _header_params: Dict[str, Optional[str]] = _headers or {}
_form_params: List[Tuple[str, str]] = [] _form_params: List[Tuple[str, str]] = []
_files: Dict[ _files: Dict[str, Union[str, bytes]] = {}
str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
] = {}
_body_params: Optional[bytes] = None _body_params: Optional[bytes] = None
# process the path parameters # process the path parameters

View File

@ -20,9 +20,9 @@ from pydantic import Field, StrictStr
from typing import List, Optional from typing import List, Optional
from typing_extensions import Annotated from typing_extensions import Annotated
from codex_api_client.api_client import ApiClient, RequestSerialized from codex_client.api_client import ApiClient, RequestSerialized
from codex_api_client.api_response import ApiResponse from codex_client.api_response import ApiResponse
from codex_api_client.rest import RESTResponseType from codex_client.rest import RESTResponseType
class NodeApi: class NodeApi:
@ -270,9 +270,7 @@ class NodeApi:
_query_params: List[Tuple[str, str]] = [] _query_params: List[Tuple[str, str]] = []
_header_params: Dict[str, Optional[str]] = _headers or {} _header_params: Dict[str, Optional[str]] = _headers or {}
_form_params: List[Tuple[str, str]] = [] _form_params: List[Tuple[str, str]] = []
_files: Dict[ _files: Dict[str, Union[str, bytes]] = {}
str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
] = {}
_body_params: Optional[bytes] = None _body_params: Optional[bytes] = None
# process the path parameters # process the path parameters
@ -511,9 +509,7 @@ class NodeApi:
_query_params: List[Tuple[str, str]] = [] _query_params: List[Tuple[str, str]] = []
_header_params: Dict[str, Optional[str]] = _headers or {} _header_params: Dict[str, Optional[str]] = _headers or {}
_form_params: List[Tuple[str, str]] = [] _form_params: List[Tuple[str, str]] = []
_files: Dict[ _files: Dict[str, Union[str, bytes]] = {}
str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
] = {}
_body_params: Optional[bytes] = None _body_params: Optional[bytes] = None
# process the path parameters # process the path parameters
@ -527,7 +523,7 @@ class NodeApi:
if 'Accept' not in _header_params: if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept( _header_params['Accept'] = self.api_client.select_header_accept(
[ [
'text/plain', 'plain/text',
'application/json' 'application/json'
] ]
) )
@ -539,7 +535,7 @@ class NodeApi:
return self.api_client.param_serialize( return self.api_client.param_serialize(
method='GET', method='GET',
resource_path='/peerid', resource_path='/node/peerid',
path_params=_path_params, path_params=_path_params,
query_params=_query_params, query_params=_query_params,
header_params=_header_params, header_params=_header_params,
@ -757,9 +753,7 @@ class NodeApi:
_query_params: List[Tuple[str, str]] = [] _query_params: List[Tuple[str, str]] = []
_header_params: Dict[str, Optional[str]] = _headers or {} _header_params: Dict[str, Optional[str]] = _headers or {}
_form_params: List[Tuple[str, str]] = [] _form_params: List[Tuple[str, str]] = []
_files: Dict[ _files: Dict[str, Union[str, bytes]] = {}
str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
] = {}
_body_params: Optional[bytes] = None _body_params: Optional[bytes] = None
# process the path parameters # process the path parameters
@ -773,7 +767,7 @@ class NodeApi:
if 'Accept' not in _header_params: if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept( _header_params['Accept'] = self.api_client.select_header_accept(
[ [
'text/plain', 'plain/text',
'application/json' 'application/json'
] ]
) )
@ -785,7 +779,7 @@ class NodeApi:
return self.api_client.param_serialize( return self.api_client.param_serialize(
method='GET', method='GET',
resource_path='/spr', resource_path='/node/spr',
path_params=_path_params, path_params=_path_params,
query_params=_query_params, query_params=_query_params,
header_params=_header_params, header_params=_header_params,

View File

@ -26,11 +26,11 @@ from urllib.parse import quote
from typing import Tuple, Optional, List, Dict, Union from typing import Tuple, Optional, List, Dict, Union
from pydantic import SecretStr from pydantic import SecretStr
from codex_api_client.configuration import Configuration from codex_client.configuration import Configuration
from codex_api_client.api_response import ApiResponse, T as ApiResponseT from codex_client.api_response import ApiResponse, T as ApiResponseT
import codex_api_client.models import codex_client.models
from codex_api_client import rest from codex_client import rest
from codex_api_client.exceptions import ( from codex_client.exceptions import (
ApiValueError, ApiValueError,
ApiException, ApiException,
BadRequestException, BadRequestException,
@ -90,7 +90,7 @@ class ApiClient:
self.default_headers[header_name] = header_value self.default_headers[header_name] = header_value
self.cookie = cookie self.cookie = cookie
# Set default User-Agent. # Set default User-Agent.
self.user_agent = 'py_codex_api_client' self.user_agent = 'py_codex_client'
self.client_side_validation = configuration.client_side_validation self.client_side_validation = configuration.client_side_validation
def __enter__(self): def __enter__(self):
@ -404,12 +404,12 @@ class ApiClient:
data = json.loads(response_text) data = json.loads(response_text)
except ValueError: except ValueError:
data = response_text data = response_text
elif re.match(r'^application/(json|[\w!#$&.+-^_]+\+json)\s*(;|$)', content_type, re.IGNORECASE): elif content_type.startswith("application/json"):
if response_text == "": if response_text == "":
data = "" data = ""
else: else:
data = json.loads(response_text) data = json.loads(response_text)
elif re.match(r'^text\/[a-z.+-]+\s*(;|$)', content_type, re.IGNORECASE): elif content_type.startswith("text/plain"):
data = response_text data = response_text
else: else:
raise ApiException( raise ApiException(
@ -449,7 +449,7 @@ class ApiClient:
if klass in self.NATIVE_TYPES_MAPPING: if klass in self.NATIVE_TYPES_MAPPING:
klass = self.NATIVE_TYPES_MAPPING[klass] klass = self.NATIVE_TYPES_MAPPING[klass]
else: else:
klass = getattr(codex_api_client.models, klass) klass = getattr(codex_client.models, klass)
if klass in self.PRIMITIVE_TYPES: if klass in self.PRIMITIVE_TYPES:
return self.__deserialize_primitive(data, klass) return self.__deserialize_primitive(data, klass)
@ -517,7 +517,7 @@ class ApiClient:
if k in collection_formats: if k in collection_formats:
collection_format = collection_formats[k] collection_format = collection_formats[k]
if collection_format == 'multi': if collection_format == 'multi':
new_params.extend((k, quote(str(value))) for value in v) new_params.extend((k, str(value)) for value in v)
else: else:
if collection_format == 'ssv': if collection_format == 'ssv':
delimiter = ' ' delimiter = ' '
@ -535,10 +535,7 @@ class ApiClient:
return "&".join(["=".join(map(str, item)) for item in new_params]) return "&".join(["=".join(map(str, item)) for item in new_params])
def files_parameters( def files_parameters(self, files: Dict[str, Union[str, bytes]]):
self,
files: Dict[str, Union[str, bytes, List[str], List[bytes], Tuple[str, bytes]]],
):
"""Builds form parameters. """Builds form parameters.
:param files: File parameters. :param files: File parameters.
@ -553,12 +550,6 @@ class ApiClient:
elif isinstance(v, bytes): elif isinstance(v, bytes):
filename = k filename = k
filedata = v filedata = v
elif isinstance(v, tuple):
filename, filedata = v
elif isinstance(v, list):
for file_param in v:
params.extend(self.files_parameters({k: file_param}))
continue
else: else:
raise ValueError("Unsupported file value") raise ValueError("Unsupported file value")
mimetype = ( mimetype = (

View File

@ -13,16 +13,14 @@
import copy import copy
import http.client as httplib
import logging import logging
from logging import FileHandler from logging import FileHandler
import multiprocessing import multiprocessing
import sys import sys
from typing import Any, ClassVar, Dict, List, Literal, Optional, TypedDict, Union from typing import Optional
from typing_extensions import NotRequired, Self
import urllib3 import urllib3
import http.client as httplib
JSON_SCHEMA_VALIDATION_KEYWORDS = { JSON_SCHEMA_VALIDATION_KEYWORDS = {
'multipleOf', 'maximum', 'exclusiveMaximum', 'multipleOf', 'maximum', 'exclusiveMaximum',
@ -30,106 +28,6 @@ JSON_SCHEMA_VALIDATION_KEYWORDS = {
'minLength', 'pattern', 'maxItems', 'minItems' 'minLength', 'pattern', 'maxItems', 'minItems'
} }
ServerVariablesT = Dict[str, str]
GenericAuthSetting = TypedDict(
"GenericAuthSetting",
{
"type": str,
"in": str,
"key": str,
"value": str,
},
)
OAuth2AuthSetting = TypedDict(
"OAuth2AuthSetting",
{
"type": Literal["oauth2"],
"in": Literal["header"],
"key": Literal["Authorization"],
"value": str,
},
)
APIKeyAuthSetting = TypedDict(
"APIKeyAuthSetting",
{
"type": Literal["api_key"],
"in": str,
"key": str,
"value": Optional[str],
},
)
BasicAuthSetting = TypedDict(
"BasicAuthSetting",
{
"type": Literal["basic"],
"in": Literal["header"],
"key": Literal["Authorization"],
"value": Optional[str],
},
)
BearerFormatAuthSetting = TypedDict(
"BearerFormatAuthSetting",
{
"type": Literal["bearer"],
"in": Literal["header"],
"format": Literal["JWT"],
"key": Literal["Authorization"],
"value": str,
},
)
BearerAuthSetting = TypedDict(
"BearerAuthSetting",
{
"type": Literal["bearer"],
"in": Literal["header"],
"key": Literal["Authorization"],
"value": str,
},
)
HTTPSignatureAuthSetting = TypedDict(
"HTTPSignatureAuthSetting",
{
"type": Literal["http-signature"],
"in": Literal["header"],
"key": Literal["Authorization"],
"value": None,
},
)
AuthSettings = TypedDict(
"AuthSettings",
{
},
total=False,
)
class HostSettingVariable(TypedDict):
description: str
default_value: str
enum_values: List[str]
class HostSetting(TypedDict):
url: str
description: str
variables: NotRequired[Dict[str, HostSettingVariable]]
class Configuration: class Configuration:
"""This class contains various settings of the API client. """This class contains various settings of the API client.
@ -160,32 +58,23 @@ class Configuration:
:param ssl_ca_cert: str - the path to a file of concatenated CA certificates :param ssl_ca_cert: str - the path to a file of concatenated CA certificates
in PEM format. in PEM format.
:param retries: Number of retries for API requests. :param retries: Number of retries for API requests.
:param ca_cert_data: verify the peer using concatenated CA certificate data
in PEM (str) or DER (bytes) format.
""" """
_default: ClassVar[Optional[Self]] = None _default = None
def __init__( def __init__(self, host=None,
self, api_key=None, api_key_prefix=None,
host: Optional[str]=None, username=None, password=None,
api_key: Optional[Dict[str, str]]=None, access_token=None,
api_key_prefix: Optional[Dict[str, str]]=None, server_index=None, server_variables=None,
username: Optional[str]=None, server_operation_index=None, server_operation_variables=None,
password: Optional[str]=None, ignore_operation_servers=False,
access_token: Optional[str]=None, ssl_ca_cert=None,
server_index: Optional[int]=None, retries=None,
server_variables: Optional[ServerVariablesT]=None, *,
server_operation_index: Optional[Dict[int, int]]=None, debug: Optional[bool] = None
server_operation_variables: Optional[Dict[int, ServerVariablesT]]=None, ) -> None:
ignore_operation_servers: bool=False,
ssl_ca_cert: Optional[str]=None,
retries: Optional[int] = None,
ca_cert_data: Optional[Union[str, bytes]] = None,
*,
debug: Optional[bool] = None,
) -> None:
"""Constructor """Constructor
""" """
self._base_path = "http://localhost:8080/api/codex/v1" if host is None else host self._base_path = "http://localhost:8080/api/codex/v1" if host is None else host
@ -231,7 +120,7 @@ class Configuration:
self.logger = {} self.logger = {}
"""Logging Settings """Logging Settings
""" """
self.logger["package_logger"] = logging.getLogger("codex_api_client") self.logger["package_logger"] = logging.getLogger("codex_client")
self.logger["urllib3_logger"] = logging.getLogger("urllib3") self.logger["urllib3_logger"] = logging.getLogger("urllib3")
self.logger_format = '%(asctime)s %(levelname)s %(message)s' self.logger_format = '%(asctime)s %(levelname)s %(message)s'
"""Log format """Log format
@ -260,10 +149,6 @@ class Configuration:
self.ssl_ca_cert = ssl_ca_cert self.ssl_ca_cert = ssl_ca_cert
"""Set this to customize the certificate file to verify the peer. """Set this to customize the certificate file to verify the peer.
""" """
self.ca_cert_data = ca_cert_data
"""Set this to verify the peer using PEM (str) or DER (bytes)
certificate data.
"""
self.cert_file = None self.cert_file = None
"""client certificate file """client certificate file
""" """
@ -313,7 +198,7 @@ class Configuration:
"""date format """date format
""" """
def __deepcopy__(self, memo: Dict[int, Any]) -> Self: def __deepcopy__(self, memo):
cls = self.__class__ cls = self.__class__
result = cls.__new__(cls) result = cls.__new__(cls)
memo[id(self)] = result memo[id(self)] = result
@ -327,11 +212,11 @@ class Configuration:
result.debug = self.debug result.debug = self.debug
return result return result
def __setattr__(self, name: str, value: Any) -> None: def __setattr__(self, name, value):
object.__setattr__(self, name, value) object.__setattr__(self, name, value)
@classmethod @classmethod
def set_default(cls, default: Optional[Self]) -> None: def set_default(cls, default):
"""Set default instance of configuration. """Set default instance of configuration.
It stores default configuration, which can be It stores default configuration, which can be
@ -342,7 +227,7 @@ class Configuration:
cls._default = default cls._default = default
@classmethod @classmethod
def get_default_copy(cls) -> Self: def get_default_copy(cls):
"""Deprecated. Please use `get_default` instead. """Deprecated. Please use `get_default` instead.
Deprecated. Please use `get_default` instead. Deprecated. Please use `get_default` instead.
@ -352,7 +237,7 @@ class Configuration:
return cls.get_default() return cls.get_default()
@classmethod @classmethod
def get_default(cls) -> Self: def get_default(cls):
"""Return the default configuration. """Return the default configuration.
This method returns newly created, based on default constructor, This method returns newly created, based on default constructor,
@ -362,11 +247,11 @@ class Configuration:
:return: The configuration object. :return: The configuration object.
""" """
if cls._default is None: if cls._default is None:
cls._default = cls() cls._default = Configuration()
return cls._default return cls._default
@property @property
def logger_file(self) -> Optional[str]: def logger_file(self):
"""The logger file. """The logger file.
If the logger_file is None, then add stream handler and remove file If the logger_file is None, then add stream handler and remove file
@ -378,7 +263,7 @@ class Configuration:
return self.__logger_file return self.__logger_file
@logger_file.setter @logger_file.setter
def logger_file(self, value: Optional[str]) -> None: def logger_file(self, value):
"""The logger file. """The logger file.
If the logger_file is None, then add stream handler and remove file If the logger_file is None, then add stream handler and remove file
@ -397,7 +282,7 @@ class Configuration:
logger.addHandler(self.logger_file_handler) logger.addHandler(self.logger_file_handler)
@property @property
def debug(self) -> bool: def debug(self):
"""Debug status """Debug status
:param value: The debug status, True or False. :param value: The debug status, True or False.
@ -406,7 +291,7 @@ class Configuration:
return self.__debug return self.__debug
@debug.setter @debug.setter
def debug(self, value: bool) -> None: def debug(self, value):
"""Debug status """Debug status
:param value: The debug status, True or False. :param value: The debug status, True or False.
@ -428,7 +313,7 @@ class Configuration:
httplib.HTTPConnection.debuglevel = 0 httplib.HTTPConnection.debuglevel = 0
@property @property
def logger_format(self) -> str: def logger_format(self):
"""The logger format. """The logger format.
The logger_formatter will be updated when sets logger_format. The logger_formatter will be updated when sets logger_format.
@ -439,7 +324,7 @@ class Configuration:
return self.__logger_format return self.__logger_format
@logger_format.setter @logger_format.setter
def logger_format(self, value: str) -> None: def logger_format(self, value):
"""The logger format. """The logger format.
The logger_formatter will be updated when sets logger_format. The logger_formatter will be updated when sets logger_format.
@ -450,7 +335,7 @@ class Configuration:
self.__logger_format = value self.__logger_format = value
self.logger_formatter = logging.Formatter(self.__logger_format) self.logger_formatter = logging.Formatter(self.__logger_format)
def get_api_key_with_prefix(self, identifier: str, alias: Optional[str]=None) -> Optional[str]: def get_api_key_with_prefix(self, identifier, alias=None):
"""Gets API key (with prefix if set). """Gets API key (with prefix if set).
:param identifier: The identifier of apiKey. :param identifier: The identifier of apiKey.
@ -467,9 +352,7 @@ class Configuration:
else: else:
return key return key
return None def get_basic_auth_token(self):
def get_basic_auth_token(self) -> Optional[str]:
"""Gets HTTP basic authentication header (string). """Gets HTTP basic authentication header (string).
:return: The token for basic HTTP authentication. :return: The token for basic HTTP authentication.
@ -484,15 +367,15 @@ class Configuration:
basic_auth=username + ':' + password basic_auth=username + ':' + password
).get('authorization') ).get('authorization')
def auth_settings(self)-> AuthSettings: def auth_settings(self):
"""Gets Auth Settings dict for api client. """Gets Auth Settings dict for api client.
:return: The Auth Settings information dict. :return: The Auth Settings information dict.
""" """
auth: AuthSettings = {} auth = {}
return auth return auth
def to_debug_report(self) -> str: def to_debug_report(self):
"""Gets the essential information for debugging. """Gets the essential information for debugging.
:return: The report for debugging. :return: The report for debugging.
@ -501,10 +384,10 @@ class Configuration:
"OS: {env}\n"\ "OS: {env}\n"\
"Python Version: {pyversion}\n"\ "Python Version: {pyversion}\n"\
"Version of the API: 0.0.1\n"\ "Version of the API: 0.0.1\n"\
"SDK Package Version: 0.4.0".\ "SDK Package Version: 1.0.0".\
format(env=sys.platform, pyversion=sys.version) format(env=sys.platform, pyversion=sys.version)
def get_host_settings(self) -> List[HostSetting]: def get_host_settings(self):
"""Gets an array of host settings """Gets an array of host settings
:return: An array of host settings :return: An array of host settings
@ -516,12 +399,7 @@ class Configuration:
} }
] ]
def get_host_from_settings( def get_host_from_settings(self, index, variables=None, servers=None):
self,
index: Optional[int],
variables: Optional[ServerVariablesT]=None,
servers: Optional[List[HostSetting]]=None,
) -> str:
"""Gets host URL based on the index and variables """Gets host URL based on the index and variables
:param index: array index of the host settings :param index: array index of the host settings
:param variables: hash of variable and the corresponding value :param variables: hash of variable and the corresponding value
@ -561,12 +439,12 @@ class Configuration:
return url return url
@property @property
def host(self) -> str: def host(self):
"""Return generated host.""" """Return generated host."""
return self.get_host_from_settings(self.server_index, variables=self.server_variables) return self.get_host_from_settings(self.server_index, variables=self.server_variables)
@host.setter @host.setter
def host(self, value: str) -> None: def host(self, value):
"""Fix base path.""" """Fix base path."""
self._base_path = value self._base_path = value
self.server_index = None self.server_index = None

View File

@ -150,13 +150,6 @@ class ApiException(OpenApiException):
if http_resp.status == 404: if http_resp.status == 404:
raise NotFoundException(http_resp=http_resp, body=body, data=data) raise NotFoundException(http_resp=http_resp, body=body, data=data)
# Added new conditions for 409 and 422
if http_resp.status == 409:
raise ConflictException(http_resp=http_resp, body=body, data=data)
if http_resp.status == 422:
raise UnprocessableEntityException(http_resp=http_resp, body=body, data=data)
if 500 <= http_resp.status <= 599: if 500 <= http_resp.status <= 599:
raise ServiceException(http_resp=http_resp, body=body, data=data) raise ServiceException(http_resp=http_resp, body=body, data=data)
raise ApiException(http_resp=http_resp, body=body, data=data) raise ApiException(http_resp=http_resp, body=body, data=data)
@ -195,16 +188,6 @@ class ServiceException(ApiException):
pass pass
class ConflictException(ApiException):
"""Exception for HTTP 409 Conflict."""
pass
class UnprocessableEntityException(ApiException):
"""Exception for HTTP 422 Unprocessable Entity."""
pass
def render_path(path_to_item): def render_path(path_to_item):
"""Returns a string representation of a path""" """Returns a string representation of a path"""
result = "" result = ""

View File

@ -0,0 +1,36 @@
# coding: utf-8
# flake8: noqa
"""
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 models into model package
from codex_client.models.content import Content
from codex_client.models.data_item import DataItem
from codex_client.models.data_list import DataList
from codex_client.models.debug_info import DebugInfo
from codex_client.models.erasure_parameters import ErasureParameters
from codex_client.models.manifest_item import ManifestItem
from codex_client.models.peer_id_read import PeerIdRead
from codex_client.models.po_r_parameters import PoRParameters
from codex_client.models.purchase import Purchase
from codex_client.models.reservation import Reservation
from codex_client.models.spr_read import SPRRead
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
from codex_client.models.storage_request_creation import StorageRequestCreation

View File

@ -17,19 +17,21 @@ import pprint
import re # noqa: F401 import re # noqa: F401
import json import json
from pydantic import BaseModel, ConfigDict, Field from pydantic import BaseModel, ConfigDict, Field, StrictStr
from typing import Any, ClassVar, Dict, List from typing import Any, ClassVar, Dict, List, Optional
from codex_api_client.models.node import Node from codex_client.models.erasure_parameters import ErasureParameters
from codex_client.models.po_r_parameters import PoRParameters
from typing import Optional, Set from typing import Optional, Set
from typing_extensions import Self from typing_extensions import Self
class PeersTable(BaseModel): class Content(BaseModel):
""" """
PeersTable Parameters specifying the content
""" # noqa: E501 """ # noqa: E501
local_node: Node = Field(alias="localNode") cid: Optional[StrictStr] = Field(default=None, description="Content Identifier as specified at https://github.com/multiformats/cid")
nodes: List[Node] erasure: Optional[ErasureParameters] = None
__properties: ClassVar[List[str]] = ["localNode", "nodes"] por: Optional[PoRParameters] = None
__properties: ClassVar[List[str]] = ["cid", "erasure", "por"]
model_config = ConfigDict( model_config = ConfigDict(
populate_by_name=True, populate_by_name=True,
@ -49,7 +51,7 @@ class PeersTable(BaseModel):
@classmethod @classmethod
def from_json(cls, json_str: str) -> Optional[Self]: def from_json(cls, json_str: str) -> Optional[Self]:
"""Create an instance of PeersTable from a JSON string""" """Create an instance of Content from a JSON string"""
return cls.from_dict(json.loads(json_str)) return cls.from_dict(json.loads(json_str))
def to_dict(self) -> Dict[str, Any]: def to_dict(self) -> Dict[str, Any]:
@ -70,21 +72,17 @@ class PeersTable(BaseModel):
exclude=excluded_fields, exclude=excluded_fields,
exclude_none=True, exclude_none=True,
) )
# override the default output from pydantic by calling `to_dict()` of local_node # override the default output from pydantic by calling `to_dict()` of erasure
if self.local_node: if self.erasure:
_dict['localNode'] = self.local_node.to_dict() _dict['erasure'] = self.erasure.to_dict()
# override the default output from pydantic by calling `to_dict()` of each item in nodes (list) # override the default output from pydantic by calling `to_dict()` of por
_items = [] if self.por:
if self.nodes: _dict['por'] = self.por.to_dict()
for _item_nodes in self.nodes:
if _item_nodes:
_items.append(_item_nodes.to_dict())
_dict['nodes'] = _items
return _dict return _dict
@classmethod @classmethod
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
"""Create an instance of PeersTable from a dict""" """Create an instance of Content from a dict"""
if obj is None: if obj is None:
return None return None
@ -92,8 +90,9 @@ class PeersTable(BaseModel):
return cls.model_validate(obj) return cls.model_validate(obj)
_obj = cls.model_validate({ _obj = cls.model_validate({
"localNode": Node.from_dict(obj["localNode"]) if obj.get("localNode") is not None else None, "cid": obj.get("cid"),
"nodes": [Node.from_dict(_item) for _item in obj["nodes"]] if obj.get("nodes") is not None else None "erasure": ErasureParameters.from_dict(obj["erasure"]) if obj.get("erasure") is not None else None,
"por": PoRParameters.from_dict(obj["por"]) if obj.get("por") is not None else None
}) })
return _obj return _obj

View File

@ -18,8 +18,8 @@ import re # noqa: F401
import json import json
from pydantic import BaseModel, ConfigDict, Field, StrictStr from pydantic import BaseModel, ConfigDict, Field, StrictStr
from typing import Any, ClassVar, Dict, List from typing import Any, ClassVar, Dict, List, Optional
from codex_api_client.models.manifest_item import ManifestItem from codex_client.models.manifest_item import ManifestItem
from typing import Optional, Set from typing import Optional, Set
from typing_extensions import Self from typing_extensions import Self
@ -27,8 +27,8 @@ class DataItem(BaseModel):
""" """
DataItem DataItem
""" # noqa: E501 """ # noqa: E501
cid: StrictStr = Field(description="Content Identifier as specified at https://github.com/multiformats/cid") cid: Optional[StrictStr] = Field(default=None, description="Content Identifier as specified at https://github.com/multiformats/cid")
manifest: ManifestItem manifest: Optional[ManifestItem] = None
__properties: ClassVar[List[str]] = ["cid", "manifest"] __properties: ClassVar[List[str]] = ["cid", "manifest"]
model_config = ConfigDict( model_config = ConfigDict(

View File

@ -18,8 +18,8 @@ import re # noqa: F401
import json import json
from pydantic import BaseModel, ConfigDict from pydantic import BaseModel, ConfigDict
from typing import Any, ClassVar, Dict, List from typing import Any, ClassVar, Dict, List, Optional
from codex_api_client.models.data_item import DataItem from codex_client.models.data_item import DataItem
from typing import Optional, Set from typing import Optional, Set
from typing_extensions import Self from typing_extensions import Self
@ -27,7 +27,7 @@ class DataList(BaseModel):
""" """
DataList DataList
""" # noqa: E501 """ # noqa: E501
content: List[DataItem] content: Optional[List[DataItem]] = None
__properties: ClassVar[List[str]] = ["content"] __properties: ClassVar[List[str]] = ["content"]
model_config = ConfigDict( model_config = ConfigDict(

View File

@ -17,21 +17,20 @@ import pprint
import re # noqa: F401 import re # noqa: F401
import json import json
from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr from pydantic import BaseModel, ConfigDict, Field, StrictStr
from typing import Any, ClassVar, Dict, List from typing import Any, ClassVar, Dict, List, Optional
from typing import Optional, Set from typing import Optional, Set
from typing_extensions import Self from typing_extensions import Self
class Node(BaseModel): class DebugInfo(BaseModel):
""" """
Node DebugInfo
""" # noqa: E501 """ # noqa: E501
node_id: StrictStr = Field(alias="nodeId") id: Optional[StrictStr] = Field(default=None, description="Peer Identity reference as specified at https://docs.libp2p.io/concepts/fundamentals/peers/")
peer_id: StrictStr = Field(alias="peerId") addrs: Optional[List[StrictStr]] = None
record: StrictStr repo: Optional[StrictStr] = Field(default=None, description="Path of the data repository where all nodes data are stored")
address: StrictStr spr: Optional[StrictStr] = Field(default=None, description="Signed Peer Record (libp2p)")
seen: StrictBool __properties: ClassVar[List[str]] = ["id", "addrs", "repo", "spr"]
__properties: ClassVar[List[str]] = ["nodeId", "peerId", "record", "address", "seen"]
model_config = ConfigDict( model_config = ConfigDict(
populate_by_name=True, populate_by_name=True,
@ -51,7 +50,7 @@ class Node(BaseModel):
@classmethod @classmethod
def from_json(cls, json_str: str) -> Optional[Self]: def from_json(cls, json_str: str) -> Optional[Self]:
"""Create an instance of Node from a JSON string""" """Create an instance of DebugInfo from a JSON string"""
return cls.from_dict(json.loads(json_str)) return cls.from_dict(json.loads(json_str))
def to_dict(self) -> Dict[str, Any]: def to_dict(self) -> Dict[str, Any]:
@ -76,7 +75,7 @@ class Node(BaseModel):
@classmethod @classmethod
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
"""Create an instance of Node from a dict""" """Create an instance of DebugInfo from a dict"""
if obj is None: if obj is None:
return None return None
@ -84,11 +83,10 @@ class Node(BaseModel):
return cls.model_validate(obj) return cls.model_validate(obj)
_obj = cls.model_validate({ _obj = cls.model_validate({
"nodeId": obj.get("nodeId"), "id": obj.get("id"),
"peerId": obj.get("peerId"), "addrs": obj.get("addrs"),
"record": obj.get("record"), "repo": obj.get("repo"),
"address": obj.get("address"), "spr": obj.get("spr")
"seen": obj.get("seen")
}) })
return _obj return _obj

View File

@ -17,17 +17,17 @@ import pprint
import re # noqa: F401 import re # noqa: F401
import json import json
from pydantic import BaseModel, ConfigDict, Field, StrictStr from pydantic import BaseModel, ConfigDict, Field, StrictInt
from typing import Any, ClassVar, Dict, List from typing import Any, ClassVar, Dict, List, Optional
from typing import Optional, Set from typing import Optional, Set
from typing_extensions import Self from typing_extensions import Self
class Content(BaseModel): class ErasureParameters(BaseModel):
""" """
Parameters specifying the content ErasureParameters
""" # noqa: E501 """ # noqa: E501
cid: StrictStr = Field(description="Content Identifier as specified at https://github.com/multiformats/cid") total_chunks: Optional[StrictInt] = Field(default=None, alias="totalChunks")
__properties: ClassVar[List[str]] = ["cid"] __properties: ClassVar[List[str]] = ["totalChunks"]
model_config = ConfigDict( model_config = ConfigDict(
populate_by_name=True, populate_by_name=True,
@ -47,7 +47,7 @@ class Content(BaseModel):
@classmethod @classmethod
def from_json(cls, json_str: str) -> Optional[Self]: def from_json(cls, json_str: str) -> Optional[Self]:
"""Create an instance of Content from a JSON string""" """Create an instance of ErasureParameters from a JSON string"""
return cls.from_dict(json.loads(json_str)) return cls.from_dict(json.loads(json_str))
def to_dict(self) -> Dict[str, Any]: def to_dict(self) -> Dict[str, Any]:
@ -72,7 +72,7 @@ class Content(BaseModel):
@classmethod @classmethod
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
"""Create an instance of Content from a dict""" """Create an instance of ErasureParameters from a dict"""
if obj is None: if obj is None:
return None return None
@ -80,7 +80,7 @@ class Content(BaseModel):
return cls.model_validate(obj) return cls.model_validate(obj)
_obj = cls.model_validate({ _obj = cls.model_validate({
"cid": obj.get("cid") "totalChunks": obj.get("totalChunks")
}) })
return _obj return _obj

View File

@ -0,0 +1,93 @@
# 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, StrictBool, StrictInt, StrictStr
from typing import Any, ClassVar, Dict, List, Optional
from typing import Optional, Set
from typing_extensions import Self
class ManifestItem(BaseModel):
"""
ManifestItem
""" # noqa: E501
root_hash: Optional[StrictStr] = Field(default=None, description="Content Identifier as specified at https://github.com/multiformats/cid", alias="rootHash")
original_bytes: Optional[StrictInt] = Field(default=None, description="Length of original content in bytes", alias="originalBytes")
block_size: Optional[StrictInt] = Field(default=None, description="Size of blocks", alias="blockSize")
protected: Optional[StrictBool] = Field(default=None, description="Indicates if content is protected by erasure-coding")
__properties: ClassVar[List[str]] = ["rootHash", "originalBytes", "blockSize", "protected"]
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 ManifestItem 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,
)
return _dict
@classmethod
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
"""Create an instance of ManifestItem from a dict"""
if obj is None:
return None
if not isinstance(obj, dict):
return cls.model_validate(obj)
_obj = cls.model_validate({
"rootHash": obj.get("rootHash"),
"originalBytes": obj.get("originalBytes"),
"blockSize": obj.get("blockSize"),
"protected": obj.get("protected")
})
return _obj

View File

@ -17,19 +17,19 @@ import pprint
import re # noqa: F401 import re # noqa: F401
import json import json
from pydantic import BaseModel, ConfigDict, StrictStr from pydantic import BaseModel, ConfigDict, Field, StrictStr
from typing import Any, ClassVar, Dict, List, Optional from typing import Any, ClassVar, Dict, List, Optional
from typing import Optional, Set from typing import Optional, Set
from typing_extensions import Self from typing_extensions import Self
class CodexVersion(BaseModel): class PoRParameters(BaseModel):
""" """
CodexVersion Parameters for Proof of Retrievability
""" # noqa: E501 """ # noqa: E501
version: Optional[StrictStr] = None u: Optional[StrictStr] = None
revision: Optional[StrictStr] = None public_key: Optional[StrictStr] = Field(default=None, alias="publicKey")
contracts: Optional[StrictStr] = None name: Optional[StrictStr] = None
__properties: ClassVar[List[str]] = ["version", "revision", "contracts"] __properties: ClassVar[List[str]] = ["u", "publicKey", "name"]
model_config = ConfigDict( model_config = ConfigDict(
populate_by_name=True, populate_by_name=True,
@ -49,7 +49,7 @@ class CodexVersion(BaseModel):
@classmethod @classmethod
def from_json(cls, json_str: str) -> Optional[Self]: def from_json(cls, json_str: str) -> Optional[Self]:
"""Create an instance of CodexVersion from a JSON string""" """Create an instance of PoRParameters from a JSON string"""
return cls.from_dict(json.loads(json_str)) return cls.from_dict(json.loads(json_str))
def to_dict(self) -> Dict[str, Any]: def to_dict(self) -> Dict[str, Any]:
@ -74,7 +74,7 @@ class CodexVersion(BaseModel):
@classmethod @classmethod
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
"""Create an instance of CodexVersion from a dict""" """Create an instance of PoRParameters from a dict"""
if obj is None: if obj is None:
return None return None
@ -82,9 +82,9 @@ class CodexVersion(BaseModel):
return cls.model_validate(obj) return cls.model_validate(obj)
_obj = cls.model_validate({ _obj = cls.model_validate({
"version": obj.get("version"), "u": obj.get("u"),
"revision": obj.get("revision"), "publicKey": obj.get("publicKey"),
"contracts": obj.get("contracts") "name": obj.get("name")
}) })
return _obj return _obj

View File

@ -19,8 +19,7 @@ import json
from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
from typing import Any, ClassVar, Dict, List, Optional from typing import Any, ClassVar, Dict, List, Optional
from typing_extensions import Annotated from codex_client.models.storage_request import StorageRequest
from codex_api_client.models.storage_request import StorageRequest
from typing import Optional, Set from typing import Optional, Set
from typing_extensions import Self from typing_extensions import Self
@ -28,17 +27,19 @@ class Purchase(BaseModel):
""" """
Purchase Purchase
""" # noqa: E501 """ # noqa: E501
state: StrictStr = Field(description="Description of the Request's state") state: Optional[StrictStr] = Field(default=None, description="Description of the Request's state")
error: Optional[StrictStr] = Field(default=None, description="If Request failed, then here is presented the error message") error: Optional[StrictStr] = Field(default=None, description="If Request failed, then here is presented the error message")
request: Optional[StorageRequest] = None request: Optional[StorageRequest] = None
request_id: Annotated[str, Field(min_length=66, strict=True, max_length=66)] = Field(description="32bits identifier encoded in hex-decimal string.", alias="requestId") __properties: ClassVar[List[str]] = ["state", "error", "request"]
__properties: ClassVar[List[str]] = ["state", "error", "request", "requestId"]
@field_validator('state') @field_validator('state')
def state_validate_enum(cls, value): def state_validate_enum(cls, value):
"""Validates the enum""" """Validates the enum"""
if value not in set(['cancelled', 'errored', 'failed', 'finished', 'pending', 'started', 'submitted', 'unknown']): if value is None:
raise ValueError("must be one of enum values ('cancelled', 'errored', 'failed', 'finished', 'pending', 'started', 'submitted', 'unknown')") 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 return value
model_config = ConfigDict( model_config = ConfigDict(
@ -83,11 +84,6 @@ class Purchase(BaseModel):
# override the default output from pydantic by calling `to_dict()` of request # override the default output from pydantic by calling `to_dict()` of request
if self.request: if self.request:
_dict['request'] = self.request.to_dict() _dict['request'] = self.request.to_dict()
# set to None if error (nullable) is None
# and model_fields_set contains the field
if self.error is None and "error" in self.model_fields_set:
_dict['error'] = None
return _dict return _dict
@classmethod @classmethod
@ -102,8 +98,7 @@ class Purchase(BaseModel):
_obj = cls.model_validate({ _obj = cls.model_validate({
"state": obj.get("state"), "state": obj.get("state"),
"error": obj.get("error"), "error": obj.get("error"),
"request": StorageRequest.from_dict(obj["request"]) if obj.get("request") is not None else None, "request": StorageRequest.from_dict(obj["request"]) if obj.get("request") is not None else None
"requestId": obj.get("requestId")
}) })
return _obj return _obj

View File

@ -17,8 +17,8 @@ import pprint
import re # noqa: F401 import re # noqa: F401
import json import json
from pydantic import BaseModel, ConfigDict, Field, StrictInt from pydantic import BaseModel, ConfigDict, Field, StrictStr
from typing import Any, ClassVar, Dict, List from typing import Any, ClassVar, Dict, List, Optional
from typing_extensions import Annotated from typing_extensions import Annotated
from typing import Optional, Set from typing import Optional, Set
from typing_extensions import Self from typing_extensions import Self
@ -27,13 +27,12 @@ class Reservation(BaseModel):
""" """
Reservation Reservation
""" # noqa: E501 """ # noqa: E501
id: Annotated[str, Field(min_length=66, strict=True, max_length=66)] = Field(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.")
availability_id: Annotated[str, Field(min_length=66, strict=True, max_length=66)] = Field(description="32bits identifier encoded in hex-decimal string.", alias="availabilityId") 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: StrictInt = Field(description="Size of the slot in bytes") size: Optional[StrictStr] = Field(default=None, description="Integer represented as decimal string")
request_id: Annotated[str, Field(min_length=66, strict=True, max_length=66)] = Field(description="32bits identifier encoded in hex-decimal string.", alias="requestId") 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: StrictInt = Field(description="Slot Index number", alias="slotIndex") slot_index: Optional[StrictStr] = Field(default=None, description="Slot Index as decimal string", alias="slotIndex")
valid_until: StrictInt = Field(description="Timestamp after which the reservation will no longer be valid.", alias="validUntil") __properties: ClassVar[List[str]] = ["id", "availabilityId", "size", "requestId", "slotIndex"]
__properties: ClassVar[List[str]] = ["id", "availabilityId", "size", "requestId", "slotIndex", "validUntil"]
model_config = ConfigDict( model_config = ConfigDict(
populate_by_name=True, populate_by_name=True,
@ -90,8 +89,7 @@ class Reservation(BaseModel):
"availabilityId": obj.get("availabilityId"), "availabilityId": obj.get("availabilityId"),
"size": obj.get("size"), "size": obj.get("size"),
"requestId": obj.get("requestId"), "requestId": obj.get("requestId"),
"slotIndex": obj.get("slotIndex"), "slotIndex": obj.get("slotIndex")
"validUntil": obj.get("validUntil")
}) })
return _obj return _obj

View File

@ -17,8 +17,9 @@ import pprint
import re # noqa: F401 import re # noqa: F401
import json import json
from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr from pydantic import BaseModel, ConfigDict, Field, StrictStr
from typing import Any, ClassVar, Dict, List, Optional from typing import Any, ClassVar, Dict, List, Optional
from typing_extensions import Annotated
from typing import Optional, Set from typing import Optional, Set
from typing_extensions import Self from typing_extensions import Self
@ -26,13 +27,12 @@ class SalesAvailability(BaseModel):
""" """
SalesAvailability SalesAvailability
""" # noqa: E501 """ # noqa: E501
total_size: StrictInt = Field(description="Total size of availability's storage in bytes", alias="totalSize") id: Optional[Annotated[str, Field(min_length=66, strict=True, max_length=66)]] = Field(default=None, description="32bits identifier encoded in hex-decimal string.")
duration: StrictInt = Field(description="The duration of the request in seconds") total_size: Optional[StrictStr] = Field(default=None, description="Total size of availability's storage in bytes as decimal string", alias="totalSize")
min_price_per_byte_per_second: StrictStr = Field(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") duration: Optional[StrictStr] = Field(default=None, description="The duration of the request in seconds as decimal string")
total_collateral: StrictStr = Field(description="Total collateral (in amount of tokens) that can be used for matching requests", alias="totalCollateral") min_price: Optional[StrictStr] = Field(default=None, description="Minimum price to be paid (in amount of tokens) as decimal string", alias="minPrice")
enabled: Optional[StrictBool] = Field(default=True, description="Enable the ability to receive sales on this availability.") 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")
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.") __properties: ClassVar[List[str]] = ["id", "totalSize", "duration", "minPrice", "maxCollateral"]
__properties: ClassVar[List[str]] = ["totalSize", "duration", "minPricePerBytePerSecond", "totalCollateral", "enabled", "until"]
model_config = ConfigDict( model_config = ConfigDict(
populate_by_name=True, populate_by_name=True,
@ -85,12 +85,11 @@ class SalesAvailability(BaseModel):
return cls.model_validate(obj) return cls.model_validate(obj)
_obj = cls.model_validate({ _obj = cls.model_validate({
"id": obj.get("id"),
"totalSize": obj.get("totalSize"), "totalSize": obj.get("totalSize"),
"duration": obj.get("duration"), "duration": obj.get("duration"),
"minPricePerBytePerSecond": obj.get("minPricePerBytePerSecond"), "minPrice": obj.get("minPrice"),
"totalCollateral": obj.get("totalCollateral"), "maxCollateral": obj.get("maxCollateral")
"enabled": obj.get("enabled") if obj.get("enabled") is not None else True,
"until": obj.get("until") if obj.get("until") is not None else 0
}) })
return _obj return _obj

View File

@ -17,7 +17,7 @@ import pprint
import re # noqa: F401 import re # noqa: F401
import json import json
from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr from pydantic import BaseModel, ConfigDict, Field, StrictStr
from typing import Any, ClassVar, Dict, List, Optional from typing import Any, ClassVar, Dict, List, Optional
from typing_extensions import Annotated from typing_extensions import Annotated
from typing import Optional, Set from typing import Optional, Set
@ -28,11 +28,11 @@ class SalesAvailabilityCREATE(BaseModel):
SalesAvailabilityCREATE SalesAvailabilityCREATE
""" # noqa: E501 """ # noqa: E501
id: Optional[Annotated[str, Field(min_length=66, strict=True, max_length=66)]] = 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: StrictInt = Field(description="Total size of availability's storage in bytes", alias="totalSize") total_size: StrictStr = Field(description="Total size of availability's storage in bytes as decimal string", alias="totalSize")
duration: StrictInt = Field(description="The duration of the request in seconds") duration: StrictStr = Field(description="The duration of the request in seconds as decimal string")
min_price_per_byte_per_second: StrictStr = Field(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") min_price: StrictStr = Field(description="Minimum price to be paid (in amount of tokens) as decimal string", alias="minPrice")
total_collateral: StrictStr = Field(description="Total collateral (in amount of tokens) that can be used for matching requests", alias="totalCollateral") max_collateral: StrictStr = Field(description="Maximum collateral user is willing to pay per filled Slot (in amount of tokens) as decimal string", alias="maxCollateral")
__properties: ClassVar[List[str]] = ["id", "totalSize", "duration", "minPricePerBytePerSecond", "totalCollateral"] __properties: ClassVar[List[str]] = ["id", "totalSize", "duration", "minPrice", "maxCollateral"]
model_config = ConfigDict( model_config = ConfigDict(
populate_by_name=True, populate_by_name=True,
@ -88,8 +88,8 @@ class SalesAvailabilityCREATE(BaseModel):
"id": obj.get("id"), "id": obj.get("id"),
"totalSize": obj.get("totalSize"), "totalSize": obj.get("totalSize"),
"duration": obj.get("duration"), "duration": obj.get("duration"),
"minPricePerBytePerSecond": obj.get("minPricePerBytePerSecond"), "minPrice": obj.get("minPrice"),
"totalCollateral": obj.get("totalCollateral") "maxCollateral": obj.get("maxCollateral")
}) })
return _obj return _obj

View File

@ -18,24 +18,22 @@ import re # noqa: F401
import json import json
from pydantic import BaseModel, ConfigDict, Field, StrictStr from pydantic import BaseModel, ConfigDict, Field, StrictStr
from typing import Any, ClassVar, Dict, List from typing import Any, ClassVar, Dict, List, Optional
from codex_api_client.models.codex_version import CodexVersion from typing_extensions import Annotated
from codex_api_client.models.peers_table import PeersTable
from typing import Optional, Set from typing import Optional, Set
from typing_extensions import Self from typing_extensions import Self
class DebugInfo(BaseModel): class SalesAvailabilityREAD(BaseModel):
""" """
DebugInfo SalesAvailabilityREAD
""" # noqa: E501 """ # noqa: E501
id: StrictStr = Field(description="Peer Identity reference as specified at https://docs.libp2p.io/concepts/fundamentals/peers/") id: Optional[Annotated[str, Field(min_length=66, strict=True, max_length=66)]] = Field(default=None, description="32bits identifier encoded in hex-decimal string.")
addrs: List[StrictStr] total_size: Optional[StrictStr] = Field(default=None, description="Total size of availability's storage in bytes as decimal string", alias="totalSize")
repo: StrictStr = Field(description="Path of the data repository where all nodes data are stored") duration: Optional[StrictStr] = Field(default=None, description="The duration of the request in seconds as decimal string")
spr: StrictStr = Field(description="Signed Peer Record (libp2p)") min_price: Optional[StrictStr] = Field(default=None, description="Minimum price to be paid (in amount of tokens) as decimal string", alias="minPrice")
announce_addresses: List[StrictStr] = Field(alias="announceAddresses") 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")
table: PeersTable free_size: Optional[StrictStr] = Field(default=None, description="Unused size of availability's storage in bytes as decimal string", alias="freeSize")
codex: CodexVersion __properties: ClassVar[List[str]] = ["id", "totalSize", "duration", "minPrice", "maxCollateral", "freeSize"]
__properties: ClassVar[List[str]] = ["id", "addrs", "repo", "spr", "announceAddresses", "table", "codex"]
model_config = ConfigDict( model_config = ConfigDict(
populate_by_name=True, populate_by_name=True,
@ -55,7 +53,7 @@ class DebugInfo(BaseModel):
@classmethod @classmethod
def from_json(cls, json_str: str) -> Optional[Self]: def from_json(cls, json_str: str) -> Optional[Self]:
"""Create an instance of DebugInfo from a JSON string""" """Create an instance of SalesAvailabilityREAD from a JSON string"""
return cls.from_dict(json.loads(json_str)) return cls.from_dict(json.loads(json_str))
def to_dict(self) -> Dict[str, Any]: def to_dict(self) -> Dict[str, Any]:
@ -76,17 +74,11 @@ class DebugInfo(BaseModel):
exclude=excluded_fields, exclude=excluded_fields,
exclude_none=True, exclude_none=True,
) )
# override the default output from pydantic by calling `to_dict()` of table
if self.table:
_dict['table'] = self.table.to_dict()
# override the default output from pydantic by calling `to_dict()` of codex
if self.codex:
_dict['codex'] = self.codex.to_dict()
return _dict return _dict
@classmethod @classmethod
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
"""Create an instance of DebugInfo from a dict""" """Create an instance of SalesAvailabilityREAD from a dict"""
if obj is None: if obj is None:
return None return None
@ -95,12 +87,11 @@ class DebugInfo(BaseModel):
_obj = cls.model_validate({ _obj = cls.model_validate({
"id": obj.get("id"), "id": obj.get("id"),
"addrs": obj.get("addrs"), "totalSize": obj.get("totalSize"),
"repo": obj.get("repo"), "duration": obj.get("duration"),
"spr": obj.get("spr"), "minPrice": obj.get("minPrice"),
"announceAddresses": obj.get("announceAddresses"), "maxCollateral": obj.get("maxCollateral"),
"table": PeersTable.from_dict(obj["table"]) if obj.get("table") is not None else None, "freeSize": obj.get("freeSize")
"codex": CodexVersion.from_dict(obj["codex"]) if obj.get("codex") is not None else None
}) })
return _obj return _obj

View File

@ -17,9 +17,9 @@ import pprint
import re # noqa: F401 import re # noqa: F401
import json import json
from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr from pydantic import BaseModel, ConfigDict, Field, StrictStr
from typing import Any, ClassVar, Dict, List from typing import Any, ClassVar, Dict, List, Optional
from codex_api_client.models.storage_request import StorageRequest from codex_client.models.storage_request import StorageRequest
from typing import Optional, Set from typing import Optional, Set
from typing_extensions import Self from typing_extensions import Self
@ -27,9 +27,9 @@ class Slot(BaseModel):
""" """
Slot Slot
""" # noqa: E501 """ # noqa: E501
id: StrictStr = Field(description="Keccak hash of the abi encoded tuple (RequestId, slot index)") id: Optional[StrictStr] = Field(default=None, description="Keccak hash of the abi encoded tuple (RequestId, slot index)")
request: StorageRequest request: Optional[StorageRequest] = None
slot_index: StrictInt = Field(description="Slot Index number", alias="slotIndex") slot_index: Optional[StrictStr] = Field(default=None, description="Slot Index as decimal string", alias="slotIndex")
__properties: ClassVar[List[str]] = ["id", "request", "slotIndex"] __properties: ClassVar[List[str]] = ["id", "request", "slotIndex"]
model_config = ConfigDict( model_config = ConfigDict(

View File

@ -17,11 +17,11 @@ import pprint
import re # noqa: F401 import re # noqa: F401
import json import json
from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr, field_validator from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
from typing import Any, ClassVar, Dict, List, Optional from typing import Any, ClassVar, Dict, List, Optional
from typing_extensions import Annotated from typing_extensions import Annotated
from codex_api_client.models.reservation import Reservation from codex_client.models.reservation import Reservation
from codex_api_client.models.storage_request import StorageRequest from codex_client.models.storage_request import StorageRequest
from typing import Optional, Set from typing import Optional, Set
from typing_extensions import Self from typing_extensions import Self
@ -29,16 +29,20 @@ class SlotAgent(BaseModel):
""" """
SlotAgent SlotAgent
""" # noqa: E501 """ # noqa: E501
slot_index: StrictInt = Field(description="Slot Index number", alias="slotIndex") id: Optional[StrictStr] = Field(default=None, description="Keccak hash of the abi encoded tuple (RequestId, slot index)")
request_id: Annotated[str, Field(min_length=66, strict=True, max_length=66)] = Field(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")
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 request: Optional[StorageRequest] = None
reservation: Optional[Reservation] = None reservation: Optional[Reservation] = None
state: StrictStr = Field(description="Description of the slot's") state: Optional[StrictStr] = Field(default=None, description="Description of the slot's")
__properties: ClassVar[List[str]] = ["slotIndex", "requestId", "request", "reservation", "state"] __properties: ClassVar[List[str]] = ["id", "slotIndex", "requestId", "request", "reservation", "state"]
@field_validator('state') @field_validator('state')
def state_validate_enum(cls, value): def state_validate_enum(cls, value):
"""Validates the enum""" """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']): 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')") raise ValueError("must be one of enum values ('SaleCancelled', 'SaleDownloading', 'SaleErrored', 'SaleFailed', 'SaleFilled', 'SaleFilling', 'SaleFinished', 'SaleIgnored', 'SaleInitialProving', 'SalePayout', 'SalePreparing', 'SaleProving', 'SaleUnknown')")
return value return value
@ -100,6 +104,7 @@ class SlotAgent(BaseModel):
return cls.model_validate(obj) return cls.model_validate(obj)
_obj = cls.model_validate({ _obj = cls.model_validate({
"id": obj.get("id"),
"slotIndex": obj.get("slotIndex"), "slotIndex": obj.get("slotIndex"),
"requestId": obj.get("requestId"), "requestId": obj.get("requestId"),
"request": StorageRequest.from_dict(obj["request"]) if obj.get("request") is not None else None, "request": StorageRequest.from_dict(obj["request"]) if obj.get("request") is not None else None,

View File

@ -18,7 +18,7 @@ import re # noqa: F401
import json import json
from pydantic import BaseModel, ConfigDict, Field, StrictInt from pydantic import BaseModel, ConfigDict, Field, StrictInt
from typing import Any, ClassVar, Dict, List from typing import Any, ClassVar, Dict, List, Optional
from typing import Optional, Set from typing import Optional, Set
from typing_extensions import Self from typing_extensions import Self
@ -26,10 +26,10 @@ class Space(BaseModel):
""" """
Space Space
""" # noqa: E501 """ # noqa: E501
total_blocks: StrictInt = Field(description="Number of blocks stored by the node", alias="totalBlocks") total_blocks: Optional[StrictInt] = Field(default=None, description="Number of blocks stored by the node", alias="totalBlocks")
quota_max_bytes: StrictInt = Field(description="Maximum storage space (in bytes) available for the node in Codex's local repository.", alias="quotaMaxBytes") quota_max_bytes: Optional[StrictInt] = Field(default=None, description="Maximum storage space used by the node", alias="quotaMaxBytes")
quota_used_bytes: StrictInt = Field(description="Amount of storage space (in bytes) currently used for storing files in Codex's local repository.", alias="quotaUsedBytes") quota_used_bytes: Optional[StrictInt] = Field(default=None, description="Amount of storage space currently in use", alias="quotaUsedBytes")
quota_reserved_bytes: StrictInt = Field(description="Amount of storage reserved (in bytes) in the Codex's local repository for future use when storage requests will be picked up and hosted by the node using node's availabilities. This does not include the storage currently in use.", alias="quotaReservedBytes") quota_reserved_bytes: Optional[StrictInt] = Field(default=None, description="Amount of storage space reserved", alias="quotaReservedBytes")
__properties: ClassVar[List[str]] = ["totalBlocks", "quotaMaxBytes", "quotaUsedBytes", "quotaReservedBytes"] __properties: ClassVar[List[str]] = ["totalBlocks", "quotaMaxBytes", "quotaUsedBytes", "quotaReservedBytes"]
model_config = ConfigDict( model_config = ConfigDict(

View File

@ -18,7 +18,7 @@ import re # noqa: F401
import json import json
from pydantic import BaseModel, ConfigDict, Field, StrictStr from pydantic import BaseModel, ConfigDict, Field, StrictStr
from typing import Any, ClassVar, Dict, List from typing import Any, ClassVar, Dict, List, Optional
from typing import Optional, Set from typing import Optional, Set
from typing_extensions import Self from typing_extensions import Self
@ -26,7 +26,7 @@ class SPRRead(BaseModel):
""" """
SPRRead SPRRead
""" # noqa: E501 """ # noqa: E501
spr: StrictStr = Field(description="Signed Peer Record (libp2p)") spr: Optional[StrictStr] = Field(default=None, description="Signed Peer Record (libp2p)")
__properties: ClassVar[List[str]] = ["spr"] __properties: ClassVar[List[str]] = ["spr"]
model_config = ConfigDict( model_config = ConfigDict(

View File

@ -18,7 +18,7 @@ import re # noqa: F401
import json import json
from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr
from typing import Any, ClassVar, Dict, List from typing import Any, ClassVar, Dict, List, Optional
from typing import Optional, Set from typing import Optional, Set
from typing_extensions import Self from typing_extensions import Self
@ -26,14 +26,13 @@ class StorageAsk(BaseModel):
""" """
StorageAsk StorageAsk
""" # noqa: E501 """ # noqa: E501
slots: StrictInt = Field(description="Number of slots (eq. hosts) that the Request want to have the content spread over") slots: Optional[StrictInt] = Field(default=None, description="Number of slots (eq. hosts) that the Request want to have the content spread over")
slot_size: StrictInt = Field(description="Amount of storage per slot in bytes", alias="slotSize") slot_size: Optional[StrictStr] = Field(default=None, description="Amount of storage per slot (in bytes) as decimal string", alias="slotSize")
duration: StrictInt = Field(description="The duration of the request in seconds") duration: Optional[StrictStr] = Field(default=None, description="The duration of the request in seconds as decimal string")
proof_probability: StrictStr = Field(description="How often storage proofs are required as decimal string", alias="proofProbability") proof_probability: Optional[StrictStr] = Field(default=None, description="How often storage proofs are required as decimal string", alias="proofProbability")
price_per_byte_per_second: StrictStr = Field(description="The amount of tokens paid per byte per second per slot to hosts the client is willing to pay", alias="pricePerBytePerSecond") reward: StrictStr = Field(description="The maximum amount of tokens paid per second per slot to hosts the client is willing to pay")
collateral_per_byte: StrictStr = Field(description="Number as decimal string that represents how much collateral per byte is asked from hosts that wants to fill a slots", alias="collateralPerByte") max_slot_loss: Optional[StrictInt] = Field(default=None, description="Max slots that can be lost without data considered to be lost", alias="maxSlotLoss")
max_slot_loss: StrictInt = Field(description="Max slots that can be lost without data considered to be lost", alias="maxSlotLoss") __properties: ClassVar[List[str]] = ["slots", "slotSize", "duration", "proofProbability", "reward", "maxSlotLoss"]
__properties: ClassVar[List[str]] = ["slots", "slotSize", "duration", "proofProbability", "pricePerBytePerSecond", "collateralPerByte", "maxSlotLoss"]
model_config = ConfigDict( model_config = ConfigDict(
populate_by_name=True, populate_by_name=True,
@ -90,8 +89,7 @@ class StorageAsk(BaseModel):
"slotSize": obj.get("slotSize"), "slotSize": obj.get("slotSize"),
"duration": obj.get("duration"), "duration": obj.get("duration"),
"proofProbability": obj.get("proofProbability"), "proofProbability": obj.get("proofProbability"),
"pricePerBytePerSecond": obj.get("pricePerBytePerSecond"), "reward": obj.get("reward"),
"collateralPerByte": obj.get("collateralPerByte"),
"maxSlotLoss": obj.get("maxSlotLoss") "maxSlotLoss": obj.get("maxSlotLoss")
}) })
return _obj return _obj

View File

@ -17,10 +17,10 @@ import pprint
import re # noqa: F401 import re # noqa: F401
import json import json
from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr from pydantic import BaseModel, ConfigDict, Field, StrictStr
from typing import Any, ClassVar, Dict, List from typing import Any, ClassVar, Dict, List, Optional
from codex_api_client.models.content import Content from codex_client.models.content import Content
from codex_api_client.models.storage_ask import StorageAsk from codex_client.models.storage_ask import StorageAsk
from typing import Optional, Set from typing import Optional, Set
from typing_extensions import Self from typing_extensions import Self
@ -28,12 +28,12 @@ class StorageRequest(BaseModel):
""" """
StorageRequest StorageRequest
""" # noqa: E501 """ # noqa: E501
id: StrictStr = Field(description="Request ID") id: Optional[StrictStr] = Field(default=None, description="Request ID")
client: StrictStr = Field(description="Address of Ethereum address") client: Optional[StrictStr] = Field(default=None, description="Address of Ethereum address")
ask: StorageAsk ask: Optional[StorageAsk] = None
content: Content content: Optional[Content] = None
expiry: StrictInt = Field(description="A timestamp as seconds since unix epoch at which this request expires if the Request does not find requested amount of nodes to host the data.") expiry: Optional[StrictStr] = Field(default='10 minutes', description="A timestamp as seconds since unix epoch at which this request expires if the Request does not find requested amount of nodes to host the data.")
nonce: StrictStr = Field(description="Random data") nonce: Optional[StrictStr] = Field(default=None, description="Random data")
__properties: ClassVar[List[str]] = ["id", "client", "ask", "content", "expiry", "nonce"] __properties: ClassVar[List[str]] = ["id", "client", "ask", "content", "expiry", "nonce"]
model_config = ConfigDict( model_config = ConfigDict(
@ -97,7 +97,7 @@ class StorageRequest(BaseModel):
"client": obj.get("client"), "client": obj.get("client"),
"ask": StorageAsk.from_dict(obj["ask"]) if obj.get("ask") is not None else None, "ask": StorageAsk.from_dict(obj["ask"]) if obj.get("ask") is not None else None,
"content": Content.from_dict(obj["content"]) if obj.get("content") is not None else None, "content": Content.from_dict(obj["content"]) if obj.get("content") is not None else None,
"expiry": obj.get("expiry"), "expiry": obj.get("expiry") if obj.get("expiry") is not None else '10 minutes',
"nonce": obj.get("nonce") "nonce": obj.get("nonce")
}) })
return _obj return _obj

View File

@ -19,7 +19,6 @@ import json
from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr
from typing import Any, ClassVar, Dict, List, Optional from typing import Any, ClassVar, Dict, List, Optional
from typing_extensions import Annotated
from typing import Optional, Set from typing import Optional, Set
from typing_extensions import Self from typing_extensions import Self
@ -27,14 +26,14 @@ class StorageRequestCreation(BaseModel):
""" """
StorageRequestCreation StorageRequestCreation
""" # noqa: E501 """ # noqa: E501
duration: StrictInt = Field(description="The duration of the request in seconds") duration: StrictStr = Field(description="The duration of the request in seconds as decimal string")
price_per_byte_per_second: StrictStr = Field(description="The amount of tokens paid per byte per second per slot to hosts the client is willing to pay", alias="pricePerBytePerSecond") reward: StrictStr = Field(description="The maximum amount of tokens paid per second per slot to hosts the client is willing to pay")
proof_probability: StrictStr = Field(description="How often storage proofs are required as decimal string", alias="proofProbability") proof_probability: StrictStr = Field(description="How often storage proofs are required as decimal string", alias="proofProbability")
nodes: Optional[Annotated[int, Field(strict=True, ge=3)]] = Field(default=3, description="Minimal number of nodes the content should be stored on") nodes: Optional[StrictInt] = Field(default=1, description="Minimal number of nodes the content should be stored on")
tolerance: Optional[Annotated[int, Field(strict=True, ge=1)]] = Field(default=1, description="Additional number of nodes on top of the `nodes` property that can be lost before pronouncing the content lost") tolerance: Optional[StrictInt] = Field(default=0, description="Additional number of nodes on top of the `nodes` property that can be lost before pronouncing the content lost")
collateral_per_byte: StrictStr = Field(description="Number as decimal string that represents how much collateral per byte is asked from hosts that wants to fill a slots", alias="collateralPerByte") collateral: StrictStr = Field(description="Number as decimal string that represents how much collateral is asked from hosts that wants to fill a slots")
expiry: StrictInt = Field(description="Number 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.") expiry: StrictStr = Field(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.")
__properties: ClassVar[List[str]] = ["duration", "pricePerBytePerSecond", "proofProbability", "nodes", "tolerance", "collateralPerByte", "expiry"] __properties: ClassVar[List[str]] = ["duration", "reward", "proofProbability", "nodes", "tolerance", "collateral", "expiry"]
model_config = ConfigDict( model_config = ConfigDict(
populate_by_name=True, populate_by_name=True,
@ -88,11 +87,11 @@ class StorageRequestCreation(BaseModel):
_obj = cls.model_validate({ _obj = cls.model_validate({
"duration": obj.get("duration"), "duration": obj.get("duration"),
"pricePerBytePerSecond": obj.get("pricePerBytePerSecond"), "reward": obj.get("reward"),
"proofProbability": obj.get("proofProbability"), "proofProbability": obj.get("proofProbability"),
"nodes": obj.get("nodes") if obj.get("nodes") is not None else 3, "nodes": obj.get("nodes") if obj.get("nodes") is not None else 1,
"tolerance": obj.get("tolerance") if obj.get("tolerance") is not None else 1, "tolerance": obj.get("tolerance") if obj.get("tolerance") is not None else 0,
"collateralPerByte": obj.get("collateralPerByte"), "collateral": obj.get("collateral"),
"expiry": obj.get("expiry") "expiry": obj.get("expiry")
}) })
return _obj return _obj

View File

@ -19,7 +19,7 @@ import ssl
import urllib3 import urllib3
from codex_api_client.exceptions import ApiException, ApiValueError from codex_client.exceptions import ApiException, ApiValueError
SUPPORTED_SOCKS_PROXIES = {"socks5", "socks5h", "socks4", "socks4a"} SUPPORTED_SOCKS_PROXIES = {"socks5", "socks5h", "socks4", "socks4a"}
RESTResponseType = urllib3.HTTPResponse RESTResponseType = urllib3.HTTPResponse
@ -76,7 +76,6 @@ class RESTClientObject:
"ca_certs": configuration.ssl_ca_cert, "ca_certs": configuration.ssl_ca_cert,
"cert_file": configuration.cert_file, "cert_file": configuration.cert_file,
"key_file": configuration.key_file, "key_file": configuration.key_file,
"ca_cert_data": configuration.ca_cert_data,
} }
if configuration.assert_hostname is not None: if configuration.assert_hostname is not None:
pool_args['assert_hostname'] = ( pool_args['assert_hostname'] = (
@ -226,7 +225,7 @@ class RESTClientObject:
headers=headers, headers=headers,
preload_content=False preload_content=False
) )
elif headers['Content-Type'].startswith('text/') and isinstance(body, bool): elif headers['Content-Type'] == 'text/plain' and isinstance(body, bool):
request_body = "true" if body else "false" request_body = "true" if body else "false"
r = self.pool_manager.request( r = self.pool_manager.request(
method, method,

View File

@ -1,31 +0,0 @@
# CodexVersion
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**version** | **str** | | [optional]
**revision** | **str** | | [optional]
**contracts** | **str** | | [optional]
## Example
```python
from codex_api_client.models.codex_version import CodexVersion
# TODO update the JSON string below
json = "{}"
# create an instance of CodexVersion from a JSON string
codex_version_instance = CodexVersion.from_json(json)
# print the JSON string representation of the object
print(CodexVersion.to_json())
# convert the object into a dict
codex_version_dict = codex_version_instance.to_dict()
# create an instance of CodexVersion from a dict
codex_version_from_dict = CodexVersion.from_dict(codex_version_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)

View File

@ -6,12 +6,14 @@ Parameters specifying the content
Name | Type | Description | Notes Name | Type | Description | Notes
------------ | ------------- | ------------- | ------------- ------------ | ------------- | ------------- | -------------
**cid** | **str** | Content Identifier as specified at https://github.com/multiformats/cid | **cid** | **str** | Content Identifier as specified at https://github.com/multiformats/cid | [optional]
**erasure** | [**ErasureParameters**](ErasureParameters.md) | | [optional]
**por** | [**PoRParameters**](PoRParameters.md) | | [optional]
## Example ## Example
```python ```python
from codex_api_client.models.content import Content from codex_client.models.content import Content
# TODO update the JSON string below # TODO update the JSON string below
json = "{}" json = "{}"

View File

@ -1,84 +1,16 @@
# codex_api_client.DataApi # codex_client.DataApi
All URIs are relative to *http://localhost:8080/api/codex/v1* All URIs are relative to *http://localhost:8080/api/codex/v1*
Method | HTTP request | Description Method | HTTP request | Description
------------- | ------------- | ------------- ------------- | ------------- | -------------
[**delete_local**](DataApi.md#delete_local) | **DELETE** /data/{cid} | Deletes either a single block or an entire dataset from the local node.
[**download_local**](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. [**download_local**](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.
[**download_network**](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. [**download_network**](DataApi.md#download_network) | **GET** /data/{cid}/network | 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.
[**download_network_manifest**](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.
[**download_network_stream**](DataApi.md#download_network_stream) | **GET** /data/{cid}/network/stream | 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.
[**list_data**](DataApi.md#list_data) | **GET** /data | Lists manifest CIDs stored locally in node. [**list_data**](DataApi.md#list_data) | **GET** /data | Lists manifest CIDs stored locally in node.
[**space**](DataApi.md#space) | **GET** /space | Gets a summary of the storage space allocation of the node. [**space**](DataApi.md#space) | **GET** /space | Gets a summary of the storage space allocation of the node.
[**upload**](DataApi.md#upload) | **POST** /data | 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. [**upload**](DataApi.md#upload) | **POST** /data | 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.
# **delete_local**
> delete_local(cid)
Deletes either a single block or an entire dataset from the local node.
### Example
```python
import codex_api_client
from codex_api_client.rest import ApiException
from pprint import pprint
# Defining the host is optional and defaults to http://localhost:8080/api/codex/v1
# See configuration.py for a list of all supported configuration parameters.
configuration = codex_api_client.Configuration(
host = "http://localhost:8080/api/codex/v1"
)
# Enter a context with an instance of the API client
with codex_api_client.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = codex_api_client.DataApi(api_client)
cid = 'cid_example' # str | Block or dataset to be deleted.
try:
# Deletes either a single block or an entire dataset from the local node.
api_instance.delete_local(cid)
except Exception as e:
print("Exception when calling DataApi->delete_local: %s\n" % e)
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**cid** | **str**| Block or dataset to be deleted. |
### Return type
void (empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
**204** | Data was successfully deleted. | - |
**400** | Invalid CID is specified | - |
**500** | There was an error during deletion | - |
[[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)
# **download_local** # **download_local**
> bytearray download_local(cid) > bytearray download_local(cid)
@ -88,21 +20,21 @@ Download a file from the local node in a streaming manner. If the file is not av
```python ```python
import codex_api_client import codex_client
from codex_api_client.rest import ApiException from codex_client.rest import ApiException
from pprint import pprint from pprint import pprint
# Defining the host is optional and defaults to http://localhost:8080/api/codex/v1 # Defining the host is optional and defaults to http://localhost:8080/api/codex/v1
# See configuration.py for a list of all supported configuration parameters. # See configuration.py for a list of all supported configuration parameters.
configuration = codex_api_client.Configuration( configuration = codex_client.Configuration(
host = "http://localhost:8080/api/codex/v1" host = "http://localhost:8080/api/codex/v1"
) )
# Enter a context with an instance of the API client # Enter a context with an instance of the API client
with codex_api_client.ApiClient(configuration) as api_client: with codex_client.ApiClient(configuration) as api_client:
# Create an instance of the API class # Create an instance of the API class
api_instance = codex_api_client.DataApi(api_client) api_instance = codex_client.DataApi(api_client)
cid = 'cid_example' # str | File to be downloaded. cid = 'cid_example' # str | File to be downloaded.
try: try:
@ -148,145 +80,7 @@ No authorization required
[[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) [[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)
# **download_network** # **download_network**
> DataItem download_network(cid) > bytearray download_network(cid)
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.
### Example
```python
import codex_api_client
from codex_api_client.models.data_item import DataItem
from codex_api_client.rest import ApiException
from pprint import pprint
# Defining the host is optional and defaults to http://localhost:8080/api/codex/v1
# See configuration.py for a list of all supported configuration parameters.
configuration = codex_api_client.Configuration(
host = "http://localhost:8080/api/codex/v1"
)
# Enter a context with an instance of the API client
with codex_api_client.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = codex_api_client.DataApi(api_client)
cid = 'cid_example' # str | File to be downloaded.
try:
# 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.
api_response = api_instance.download_network(cid)
print("The response of DataApi->download_network:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling DataApi->download_network: %s\n" % e)
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**cid** | **str**| File to be downloaded. |
### Return type
[**DataItem**](DataItem.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
**200** | Manifest information for download that has been started. | - |
**400** | Invalid CID is specified | - |
**404** | Failed to download dataset manifest | - |
**500** | Well it was bad-bad | - |
[[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)
# **download_network_manifest**
> DataItem download_network_manifest(cid)
Download only the dataset manifest from the network to the local node if it's not available locally.
### Example
```python
import codex_api_client
from codex_api_client.models.data_item import DataItem
from codex_api_client.rest import ApiException
from pprint import pprint
# Defining the host is optional and defaults to http://localhost:8080/api/codex/v1
# See configuration.py for a list of all supported configuration parameters.
configuration = codex_api_client.Configuration(
host = "http://localhost:8080/api/codex/v1"
)
# Enter a context with an instance of the API client
with codex_api_client.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = codex_api_client.DataApi(api_client)
cid = 'cid_example' # str | File for which the manifest is to be downloaded.
try:
# Download only the dataset manifest from the network to the local node if it's not available locally.
api_response = api_instance.download_network_manifest(cid)
print("The response of DataApi->download_network_manifest:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling DataApi->download_network_manifest: %s\n" % e)
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**cid** | **str**| File for which the manifest is to be downloaded. |
### Return type
[**DataItem**](DataItem.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
**200** | Manifest information. | - |
**400** | Invalid CID is specified | - |
**404** | Failed to download dataset manifest | - |
**500** | Well it was bad-bad | - |
[[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)
# **download_network_stream**
> bytearray download_network_stream(cid)
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. 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.
@ -294,30 +88,30 @@ Download a file from the network in a streaming manner. If the file is not avail
```python ```python
import codex_api_client import codex_client
from codex_api_client.rest import ApiException from codex_client.rest import ApiException
from pprint import pprint from pprint import pprint
# Defining the host is optional and defaults to http://localhost:8080/api/codex/v1 # Defining the host is optional and defaults to http://localhost:8080/api/codex/v1
# See configuration.py for a list of all supported configuration parameters. # See configuration.py for a list of all supported configuration parameters.
configuration = codex_api_client.Configuration( configuration = codex_client.Configuration(
host = "http://localhost:8080/api/codex/v1" host = "http://localhost:8080/api/codex/v1"
) )
# Enter a context with an instance of the API client # Enter a context with an instance of the API client
with codex_api_client.ApiClient(configuration) as api_client: with codex_client.ApiClient(configuration) as api_client:
# Create an instance of the API class # Create an instance of the API class
api_instance = codex_api_client.DataApi(api_client) api_instance = codex_client.DataApi(api_client)
cid = 'cid_example' # str | File to be downloaded. cid = 'cid_example' # str | File to be downloaded.
try: try:
# 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. # 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.
api_response = api_instance.download_network_stream(cid) api_response = api_instance.download_network(cid)
print("The response of DataApi->download_network_stream:\n") print("The response of DataApi->download_network:\n")
pprint(api_response) pprint(api_response)
except Exception as e: except Exception as e:
print("Exception when calling DataApi->download_network_stream: %s\n" % e) print("Exception when calling DataApi->download_network: %s\n" % e)
``` ```
@ -362,22 +156,22 @@ Lists manifest CIDs stored locally in node.
```python ```python
import codex_api_client import codex_client
from codex_api_client.models.data_list import DataList from codex_client.models.data_list import DataList
from codex_api_client.rest import ApiException from codex_client.rest import ApiException
from pprint import pprint from pprint import pprint
# Defining the host is optional and defaults to http://localhost:8080/api/codex/v1 # Defining the host is optional and defaults to http://localhost:8080/api/codex/v1
# See configuration.py for a list of all supported configuration parameters. # See configuration.py for a list of all supported configuration parameters.
configuration = codex_api_client.Configuration( configuration = codex_client.Configuration(
host = "http://localhost:8080/api/codex/v1" host = "http://localhost:8080/api/codex/v1"
) )
# Enter a context with an instance of the API client # Enter a context with an instance of the API client
with codex_api_client.ApiClient(configuration) as api_client: with codex_client.ApiClient(configuration) as api_client:
# Create an instance of the API class # Create an instance of the API class
api_instance = codex_api_client.DataApi(api_client) api_instance = codex_client.DataApi(api_client)
try: try:
# Lists manifest CIDs stored locally in node. # Lists manifest CIDs stored locally in node.
@ -414,7 +208,6 @@ No authorization required
**200** | Retrieved list of content CIDs | - | **200** | Retrieved list of content CIDs | - |
**400** | Invalid CID is specified | - | **400** | Invalid CID is specified | - |
**404** | Content specified by the CID is not found | - | **404** | Content specified by the CID is not found | - |
**422** | The content type is not a valid content type or the filename is not valid | - |
**500** | Well it was bad-bad | - | **500** | Well it was bad-bad | - |
[[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) [[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)
@ -428,22 +221,22 @@ Gets a summary of the storage space allocation of the node.
```python ```python
import codex_api_client import codex_client
from codex_api_client.models.space import Space from codex_client.models.space import Space
from codex_api_client.rest import ApiException from codex_client.rest import ApiException
from pprint import pprint from pprint import pprint
# Defining the host is optional and defaults to http://localhost:8080/api/codex/v1 # Defining the host is optional and defaults to http://localhost:8080/api/codex/v1
# See configuration.py for a list of all supported configuration parameters. # See configuration.py for a list of all supported configuration parameters.
configuration = codex_api_client.Configuration( configuration = codex_client.Configuration(
host = "http://localhost:8080/api/codex/v1" host = "http://localhost:8080/api/codex/v1"
) )
# Enter a context with an instance of the API client # Enter a context with an instance of the API client
with codex_api_client.ApiClient(configuration) as api_client: with codex_client.ApiClient(configuration) as api_client:
# Create an instance of the API class # Create an instance of the API class
api_instance = codex_api_client.DataApi(api_client) api_instance = codex_client.DataApi(api_client)
try: try:
# Gets a summary of the storage space allocation of the node. # Gets a summary of the storage space allocation of the node.
@ -483,7 +276,7 @@ No authorization required
[[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) [[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)
# **upload** # **upload**
> str upload(content_type=content_type, content_disposition=content_disposition, body=body) > str upload(body=body)
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. 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.
@ -491,28 +284,26 @@ Upload a file in a streaming manner. Once finished, the file is stored in the no
```python ```python
import codex_api_client import codex_client
from codex_api_client.rest import ApiException from codex_client.rest import ApiException
from pprint import pprint from pprint import pprint
# Defining the host is optional and defaults to http://localhost:8080/api/codex/v1 # Defining the host is optional and defaults to http://localhost:8080/api/codex/v1
# See configuration.py for a list of all supported configuration parameters. # See configuration.py for a list of all supported configuration parameters.
configuration = codex_api_client.Configuration( configuration = codex_client.Configuration(
host = "http://localhost:8080/api/codex/v1" host = "http://localhost:8080/api/codex/v1"
) )
# Enter a context with an instance of the API client # Enter a context with an instance of the API client
with codex_api_client.ApiClient(configuration) as api_client: with codex_client.ApiClient(configuration) as api_client:
# Create an instance of the API class # Create an instance of the API class
api_instance = codex_api_client.DataApi(api_client) api_instance = codex_client.DataApi(api_client)
content_type = 'image/png' # str | The content type of the file. Must be valid. (optional)
content_disposition = 'attachment; filename=\"codex.png\"' # str | The content disposition used to send the filename. (optional)
body = None # bytearray | (optional) body = None # bytearray | (optional)
try: try:
# 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. # 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.
api_response = api_instance.upload(content_type=content_type, content_disposition=content_disposition, body=body) api_response = api_instance.upload(body=body)
print("The response of DataApi->upload:\n") print("The response of DataApi->upload:\n")
pprint(api_response) pprint(api_response)
except Exception as e: except Exception as e:
@ -526,8 +317,6 @@ with codex_api_client.ApiClient(configuration) as api_client:
Name | Type | Description | Notes Name | Type | Description | Notes
------------- | ------------- | ------------- | ------------- ------------- | ------------- | ------------- | -------------
**content_type** | **str**| The content type of the file. Must be valid. | [optional]
**content_disposition** | **str**| The content disposition used to send the filename. | [optional]
**body** | **bytearray**| | [optional] **body** | **bytearray**| | [optional]
### Return type ### Return type
@ -548,7 +337,6 @@ No authorization required
| Status code | Description | Response headers | | Status code | Description | Response headers |
|-------------|-------------|------------------| |-------------|-------------|------------------|
**200** | CID of uploaded file | - | **200** | CID of uploaded file | - |
**422** | The mimetype of the filename is invalid | - |
**500** | Well it was bad-bad and the upload did not work out | - | **500** | Well it was bad-bad and the upload did not work out | - |
[[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) [[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)

View File

@ -5,13 +5,13 @@
Name | Type | Description | Notes Name | Type | Description | Notes
------------ | ------------- | ------------- | ------------- ------------ | ------------- | ------------- | -------------
**cid** | **str** | Content Identifier as specified at https://github.com/multiformats/cid | **cid** | **str** | Content Identifier as specified at https://github.com/multiformats/cid | [optional]
**manifest** | [**ManifestItem**](ManifestItem.md) | | **manifest** | [**ManifestItem**](ManifestItem.md) | | [optional]
## Example ## Example
```python ```python
from codex_api_client.models.data_item import DataItem from codex_client.models.data_item import DataItem
# TODO update the JSON string below # TODO update the JSON string below
json = "{}" json = "{}"

View File

@ -5,12 +5,12 @@
Name | Type | Description | Notes Name | Type | Description | Notes
------------ | ------------- | ------------- | ------------- ------------ | ------------- | ------------- | -------------
**content** | [**List[DataItem]**](DataItem.md) | | **content** | [**List[DataItem]**](DataItem.md) | | [optional]
## Example ## Example
```python ```python
from codex_api_client.models.data_list import DataList from codex_client.models.data_list import DataList
# TODO update the JSON string below # TODO update the JSON string below
json = "{}" json = "{}"

View File

@ -1,4 +1,4 @@
# codex_api_client.DebugApi # codex_client.DebugApi
All URIs are relative to *http://localhost:8080/api/codex/v1* All URIs are relative to *http://localhost:8080/api/codex/v1*
@ -17,22 +17,22 @@ Gets node information
```python ```python
import codex_api_client import codex_client
from codex_api_client.models.debug_info import DebugInfo from codex_client.models.debug_info import DebugInfo
from codex_api_client.rest import ApiException from codex_client.rest import ApiException
from pprint import pprint from pprint import pprint
# Defining the host is optional and defaults to http://localhost:8080/api/codex/v1 # Defining the host is optional and defaults to http://localhost:8080/api/codex/v1
# See configuration.py for a list of all supported configuration parameters. # See configuration.py for a list of all supported configuration parameters.
configuration = codex_api_client.Configuration( configuration = codex_client.Configuration(
host = "http://localhost:8080/api/codex/v1" host = "http://localhost:8080/api/codex/v1"
) )
# Enter a context with an instance of the API client # Enter a context with an instance of the API client
with codex_api_client.ApiClient(configuration) as api_client: with codex_client.ApiClient(configuration) as api_client:
# Create an instance of the API class # Create an instance of the API class
api_instance = codex_api_client.DebugApi(api_client) api_instance = codex_client.DebugApi(api_client)
try: try:
# Gets node information # Gets node information
@ -79,21 +79,21 @@ Set log level at run time
```python ```python
import codex_api_client import codex_client
from codex_api_client.rest import ApiException from codex_client.rest import ApiException
from pprint import pprint from pprint import pprint
# Defining the host is optional and defaults to http://localhost:8080/api/codex/v1 # Defining the host is optional and defaults to http://localhost:8080/api/codex/v1
# See configuration.py for a list of all supported configuration parameters. # See configuration.py for a list of all supported configuration parameters.
configuration = codex_api_client.Configuration( configuration = codex_client.Configuration(
host = "http://localhost:8080/api/codex/v1" host = "http://localhost:8080/api/codex/v1"
) )
# Enter a context with an instance of the API client # Enter a context with an instance of the API client
with codex_api_client.ApiClient(configuration) as api_client: with codex_client.ApiClient(configuration) as api_client:
# Create an instance of the API class # Create an instance of the API class
api_instance = codex_api_client.DebugApi(api_client) api_instance = codex_client.DebugApi(api_client)
level = 'level_example' # str | level = 'level_example' # str |
try: try:

View File

@ -5,18 +5,15 @@
Name | Type | Description | Notes Name | Type | Description | Notes
------------ | ------------- | ------------- | ------------- ------------ | ------------- | ------------- | -------------
**id** | **str** | Peer Identity reference as specified at https://docs.libp2p.io/concepts/fundamentals/peers/ | **id** | **str** | Peer Identity reference as specified at https://docs.libp2p.io/concepts/fundamentals/peers/ | [optional]
**addrs** | **List[str]** | | **addrs** | **List[str]** | | [optional]
**repo** | **str** | Path of the data repository where all nodes data are stored | **repo** | **str** | Path of the data repository where all nodes data are stored | [optional]
**spr** | **str** | Signed Peer Record (libp2p) | **spr** | **str** | Signed Peer Record (libp2p) | [optional]
**announce_addresses** | **List[str]** | |
**table** | [**PeersTable**](PeersTable.md) | |
**codex** | [**CodexVersion**](CodexVersion.md) | |
## Example ## Example
```python ```python
from codex_api_client.models.debug_info import DebugInfo from codex_client.models.debug_info import DebugInfo
# TODO update the JSON string below # TODO update the JSON string below
json = "{}" json = "{}"

View File

@ -5,17 +5,15 @@
Name | Type | Description | Notes Name | Type | Description | Notes
------------ | ------------- | ------------- | ------------- ------------ | ------------- | ------------- | -------------
**tree_cid** | **str** | Content Identifier as specified at https://github.com/multiformats/cid | **root_hash** | **str** | Content Identifier as specified at https://github.com/multiformats/cid | [optional]
**dataset_size** | **int** | Length of original content in bytes | **original_bytes** | **int** | Length of original content in bytes | [optional]
**block_size** | **int** | Size of blocks | **block_size** | **int** | Size of blocks | [optional]
**protected** | **bool** | Indicates if content is protected by erasure-coding | **protected** | **bool** | Indicates if content is protected by erasure-coding | [optional]
**filename** | **str** | The original name of the uploaded content (optional) | [optional]
**mimetype** | **str** | The original mimetype of the uploaded content (optional) | [optional]
## Example ## Example
```python ```python
from codex_api_client.models.manifest_item import ManifestItem from codex_client.models.manifest_item import ManifestItem
# TODO update the JSON string below # TODO update the JSON string below
json = "{}" json = "{}"

View File

@ -1,4 +1,4 @@
# codex_api_client.MarketplaceApi # codex_client.MarketplaceApi
All URIs are relative to *http://localhost:8080/api/codex/v1* All URIs are relative to *http://localhost:8080/api/codex/v1*
@ -24,24 +24,24 @@ Creates a new Request for storage
```python ```python
import codex_api_client import codex_client
from codex_api_client.models.storage_request_creation import StorageRequestCreation from codex_client.models.storage_request_creation import StorageRequestCreation
from codex_api_client.rest import ApiException from codex_client.rest import ApiException
from pprint import pprint from pprint import pprint
# Defining the host is optional and defaults to http://localhost:8080/api/codex/v1 # Defining the host is optional and defaults to http://localhost:8080/api/codex/v1
# See configuration.py for a list of all supported configuration parameters. # See configuration.py for a list of all supported configuration parameters.
configuration = codex_api_client.Configuration( configuration = codex_client.Configuration(
host = "http://localhost:8080/api/codex/v1" host = "http://localhost:8080/api/codex/v1"
) )
# Enter a context with an instance of the API client # Enter a context with an instance of the API client
with codex_api_client.ApiClient(configuration) as api_client: with codex_client.ApiClient(configuration) as api_client:
# Create an instance of the API class # Create an instance of the API class
api_instance = codex_api_client.MarketplaceApi(api_client) api_instance = codex_client.MarketplaceApi(api_client)
cid = 'cid_example' # str | CID of the uploaded data that should be stored cid = 'cid_example' # str | CID of the uploaded data that should be stored
storage_request_creation = codex_api_client.StorageRequestCreation() # StorageRequestCreation | (optional) storage_request_creation = codex_client.StorageRequestCreation() # StorageRequestCreation | (optional)
try: try:
# Creates a new Request for storage # Creates a new Request for storage
@ -81,7 +81,6 @@ No authorization required
|-------------|-------------|------------------| |-------------|-------------|------------------|
**200** | Returns the Request ID as decimal string | - | **200** | Returns the Request ID as decimal string | - |
**400** | Invalid or missing Request ID | - | **400** | Invalid or missing Request ID | - |
**422** | The storage request parameters are not valid | - |
**404** | Request ID not found | - | **404** | Request ID not found | - |
**503** | Persistence is not enabled | - | **503** | Persistence is not enabled | - |
@ -96,22 +95,22 @@ Returns active slot with id {slotId} for the host
```python ```python
import codex_api_client import codex_client
from codex_api_client.models.slot_agent import SlotAgent from codex_client.models.slot_agent import SlotAgent
from codex_api_client.rest import ApiException from codex_client.rest import ApiException
from pprint import pprint from pprint import pprint
# Defining the host is optional and defaults to http://localhost:8080/api/codex/v1 # Defining the host is optional and defaults to http://localhost:8080/api/codex/v1
# See configuration.py for a list of all supported configuration parameters. # See configuration.py for a list of all supported configuration parameters.
configuration = codex_api_client.Configuration( configuration = codex_client.Configuration(
host = "http://localhost:8080/api/codex/v1" host = "http://localhost:8080/api/codex/v1"
) )
# Enter a context with an instance of the API client # Enter a context with an instance of the API client
with codex_api_client.ApiClient(configuration) as api_client: with codex_client.ApiClient(configuration) as api_client:
# Create an instance of the API class # Create an instance of the API class
api_instance = codex_api_client.MarketplaceApi(api_client) api_instance = codex_client.MarketplaceApi(api_client)
slot_id = 'slot_id_example' # str | File to be downloaded. slot_id = 'slot_id_example' # str | File to be downloaded.
try: try:
@ -165,22 +164,22 @@ Returns active slots
```python ```python
import codex_api_client import codex_client
from codex_api_client.models.slot import Slot from codex_client.models.slot import Slot
from codex_api_client.rest import ApiException from codex_client.rest import ApiException
from pprint import pprint from pprint import pprint
# Defining the host is optional and defaults to http://localhost:8080/api/codex/v1 # Defining the host is optional and defaults to http://localhost:8080/api/codex/v1
# See configuration.py for a list of all supported configuration parameters. # See configuration.py for a list of all supported configuration parameters.
configuration = codex_api_client.Configuration( configuration = codex_client.Configuration(
host = "http://localhost:8080/api/codex/v1" host = "http://localhost:8080/api/codex/v1"
) )
# Enter a context with an instance of the API client # Enter a context with an instance of the API client
with codex_api_client.ApiClient(configuration) as api_client: with codex_client.ApiClient(configuration) as api_client:
# Create an instance of the API class # Create an instance of the API class
api_instance = codex_api_client.MarketplaceApi(api_client) api_instance = codex_client.MarketplaceApi(api_client)
try: try:
# Returns active slots # Returns active slots
@ -228,22 +227,22 @@ Returns storage that is for sale
```python ```python
import codex_api_client import codex_client
from codex_api_client.models.sales_availability_read import SalesAvailabilityREAD from codex_client.models.sales_availability_read import SalesAvailabilityREAD
from codex_api_client.rest import ApiException from codex_client.rest import ApiException
from pprint import pprint from pprint import pprint
# Defining the host is optional and defaults to http://localhost:8080/api/codex/v1 # Defining the host is optional and defaults to http://localhost:8080/api/codex/v1
# See configuration.py for a list of all supported configuration parameters. # See configuration.py for a list of all supported configuration parameters.
configuration = codex_api_client.Configuration( configuration = codex_client.Configuration(
host = "http://localhost:8080/api/codex/v1" host = "http://localhost:8080/api/codex/v1"
) )
# Enter a context with an instance of the API client # Enter a context with an instance of the API client
with codex_api_client.ApiClient(configuration) as api_client: with codex_client.ApiClient(configuration) as api_client:
# Create an instance of the API class # Create an instance of the API class
api_instance = codex_api_client.MarketplaceApi(api_client) api_instance = codex_client.MarketplaceApi(api_client)
try: try:
# Returns storage that is for sale # Returns storage that is for sale
@ -292,22 +291,22 @@ Returns purchase details
```python ```python
import codex_api_client import codex_client
from codex_api_client.models.purchase import Purchase from codex_client.models.purchase import Purchase
from codex_api_client.rest import ApiException from codex_client.rest import ApiException
from pprint import pprint from pprint import pprint
# Defining the host is optional and defaults to http://localhost:8080/api/codex/v1 # Defining the host is optional and defaults to http://localhost:8080/api/codex/v1
# See configuration.py for a list of all supported configuration parameters. # See configuration.py for a list of all supported configuration parameters.
configuration = codex_api_client.Configuration( configuration = codex_client.Configuration(
host = "http://localhost:8080/api/codex/v1" host = "http://localhost:8080/api/codex/v1"
) )
# Enter a context with an instance of the API client # Enter a context with an instance of the API client
with codex_api_client.ApiClient(configuration) as api_client: with codex_client.ApiClient(configuration) as api_client:
# Create an instance of the API class # Create an instance of the API class
api_instance = codex_api_client.MarketplaceApi(api_client) api_instance = codex_client.MarketplaceApi(api_client)
id = 'id_example' # str | Hexadecimal ID of a Purchase id = 'id_example' # str | Hexadecimal ID of a Purchase
try: try:
@ -361,21 +360,21 @@ Returns list of purchase IDs
```python ```python
import codex_api_client import codex_client
from codex_api_client.rest import ApiException from codex_client.rest import ApiException
from pprint import pprint from pprint import pprint
# Defining the host is optional and defaults to http://localhost:8080/api/codex/v1 # Defining the host is optional and defaults to http://localhost:8080/api/codex/v1
# See configuration.py for a list of all supported configuration parameters. # See configuration.py for a list of all supported configuration parameters.
configuration = codex_api_client.Configuration( configuration = codex_client.Configuration(
host = "http://localhost:8080/api/codex/v1" host = "http://localhost:8080/api/codex/v1"
) )
# Enter a context with an instance of the API client # Enter a context with an instance of the API client
with codex_api_client.ApiClient(configuration) as api_client: with codex_client.ApiClient(configuration) as api_client:
# Create an instance of the API class # Create an instance of the API class
api_instance = codex_api_client.MarketplaceApi(api_client) api_instance = codex_client.MarketplaceApi(api_client)
try: try:
# Returns list of purchase IDs # Returns list of purchase IDs
@ -425,22 +424,22 @@ Return's list of Reservations for ongoing Storage Requests that the node hosts.
```python ```python
import codex_api_client import codex_client
from codex_api_client.models.reservation import Reservation from codex_client.models.reservation import Reservation
from codex_api_client.rest import ApiException from codex_client.rest import ApiException
from pprint import pprint from pprint import pprint
# Defining the host is optional and defaults to http://localhost:8080/api/codex/v1 # Defining the host is optional and defaults to http://localhost:8080/api/codex/v1
# See configuration.py for a list of all supported configuration parameters. # See configuration.py for a list of all supported configuration parameters.
configuration = codex_api_client.Configuration( configuration = codex_client.Configuration(
host = "http://localhost:8080/api/codex/v1" host = "http://localhost:8080/api/codex/v1"
) )
# Enter a context with an instance of the API client # Enter a context with an instance of the API client
with codex_api_client.ApiClient(configuration) as api_client: with codex_client.ApiClient(configuration) as api_client:
# Create an instance of the API class # Create an instance of the API class
api_instance = codex_api_client.MarketplaceApi(api_client) api_instance = codex_client.MarketplaceApi(api_client)
id = 'id_example' # str | ID of Availability id = 'id_example' # str | ID of Availability
try: try:
@ -487,7 +486,7 @@ No authorization required
[[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) [[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)
# **offer_storage** # **offer_storage**
> SalesAvailabilityREAD offer_storage(sales_availability=sales_availability) > SalesAvailabilityREAD offer_storage(sales_availability_create=sales_availability_create)
Offers storage for sale Offers storage for sale
@ -495,28 +494,28 @@ Offers storage for sale
```python ```python
import codex_api_client import codex_client
from codex_api_client.models.sales_availability import SalesAvailability from codex_client.models.sales_availability_create import SalesAvailabilityCREATE
from codex_api_client.models.sales_availability_read import SalesAvailabilityREAD from codex_client.models.sales_availability_read import SalesAvailabilityREAD
from codex_api_client.rest import ApiException from codex_client.rest import ApiException
from pprint import pprint from pprint import pprint
# Defining the host is optional and defaults to http://localhost:8080/api/codex/v1 # Defining the host is optional and defaults to http://localhost:8080/api/codex/v1
# See configuration.py for a list of all supported configuration parameters. # See configuration.py for a list of all supported configuration parameters.
configuration = codex_api_client.Configuration( configuration = codex_client.Configuration(
host = "http://localhost:8080/api/codex/v1" host = "http://localhost:8080/api/codex/v1"
) )
# Enter a context with an instance of the API client # Enter a context with an instance of the API client
with codex_api_client.ApiClient(configuration) as api_client: with codex_client.ApiClient(configuration) as api_client:
# Create an instance of the API class # Create an instance of the API class
api_instance = codex_api_client.MarketplaceApi(api_client) api_instance = codex_client.MarketplaceApi(api_client)
sales_availability = codex_api_client.SalesAvailability() # SalesAvailability | (optional) sales_availability_create = codex_client.SalesAvailabilityCREATE() # SalesAvailabilityCREATE | (optional)
try: try:
# Offers storage for sale # Offers storage for sale
api_response = api_instance.offer_storage(sales_availability=sales_availability) api_response = api_instance.offer_storage(sales_availability_create=sales_availability_create)
print("The response of MarketplaceApi->offer_storage:\n") print("The response of MarketplaceApi->offer_storage:\n")
pprint(api_response) pprint(api_response)
except Exception as e: except Exception as e:
@ -530,7 +529,7 @@ with codex_api_client.ApiClient(configuration) as api_client:
Name | Type | Description | Notes Name | Type | Description | Notes
------------- | ------------- | ------------- | ------------- ------------- | ------------- | ------------- | -------------
**sales_availability** | [**SalesAvailability**](SalesAvailability.md)| | [optional] **sales_availability_create** | [**SalesAvailabilityCREATE**](SalesAvailabilityCREATE.md)| | [optional]
### Return type ### Return type
@ -551,7 +550,7 @@ No authorization required
|-------------|-------------|------------------| |-------------|-------------|------------------|
**201** | Created storage availability | - | **201** | Created storage availability | - |
**400** | Invalid data input | - | **400** | Invalid data input | - |
**422** | Not enough node&#39;s storage quota available or the provided parameters did not pass validation | - | **422** | Not enough node&#39;s storage quota available | - |
**500** | Error reserving availability | - | **500** | Error reserving availability | - |
**503** | Persistence is not enabled | - | **503** | Persistence is not enabled | - |
@ -562,32 +561,30 @@ No authorization required
Updates availability Updates availability
The new parameters will be only considered for new requests. The new parameters will be only considered for new requests. Existing Requests linked to this Availability will continue as is.
Existing Requests linked to this Availability will continue as is.
### Example ### Example
```python ```python
import codex_api_client import codex_client
from codex_api_client.models.sales_availability import SalesAvailability from codex_client.models.sales_availability import SalesAvailability
from codex_api_client.rest import ApiException from codex_client.rest import ApiException
from pprint import pprint from pprint import pprint
# Defining the host is optional and defaults to http://localhost:8080/api/codex/v1 # Defining the host is optional and defaults to http://localhost:8080/api/codex/v1
# See configuration.py for a list of all supported configuration parameters. # See configuration.py for a list of all supported configuration parameters.
configuration = codex_api_client.Configuration( configuration = codex_client.Configuration(
host = "http://localhost:8080/api/codex/v1" host = "http://localhost:8080/api/codex/v1"
) )
# Enter a context with an instance of the API client # Enter a context with an instance of the API client
with codex_api_client.ApiClient(configuration) as api_client: with codex_client.ApiClient(configuration) as api_client:
# Create an instance of the API class # Create an instance of the API class
api_instance = codex_api_client.MarketplaceApi(api_client) api_instance = codex_client.MarketplaceApi(api_client)
id = 'id_example' # str | ID of Availability id = 'id_example' # str | ID of Availability
sales_availability = codex_api_client.SalesAvailability() # SalesAvailability | (optional) sales_availability = codex_client.SalesAvailability() # SalesAvailability | (optional)
try: try:
# Updates availability # Updates availability
@ -626,7 +623,7 @@ No authorization required
**204** | Availability successfully updated | - | **204** | Availability successfully updated | - |
**400** | Invalid data input | - | **400** | Invalid data input | - |
**404** | Availability not found | - | **404** | Availability not found | - |
**422** | The provided parameters did not pass validation | - | **422** | Not enough node&#39;s storage quota available | - |
**500** | Error reserving availability | - | **500** | Error reserving availability | - |
**503** | Persistence is not enabled | - | **503** | Persistence is not enabled | - |

View File

@ -1,33 +0,0 @@
# Node
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**node_id** | **str** | |
**peer_id** | **str** | |
**record** | **str** | |
**address** | **str** | |
**seen** | **bool** | |
## Example
```python
from codex_api_client.models.node import Node
# TODO update the JSON string below
json = "{}"
# create an instance of Node from a JSON string
node_instance = Node.from_json(json)
# print the JSON string representation of the object
print(Node.to_json())
# convert the object into a dict
node_dict = node_instance.to_dict()
# create an instance of Node from a dict
node_from_dict = Node.from_dict(node_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)

View File

@ -1,12 +1,12 @@
# codex_api_client.NodeApi # codex_client.NodeApi
All URIs are relative to *http://localhost:8080/api/codex/v1* All URIs are relative to *http://localhost:8080/api/codex/v1*
Method | HTTP request | Description Method | HTTP request | Description
------------- | ------------- | ------------- ------------- | ------------- | -------------
[**connect_peer**](NodeApi.md#connect_peer) | **GET** /connect/{peerId} | Connect to a peer [**connect_peer**](NodeApi.md#connect_peer) | **GET** /connect/{peerId} | Connect to a peer
[**get_peer_id**](NodeApi.md#get_peer_id) | **GET** /peerid | Get Node&#39;s PeerID [**get_peer_id**](NodeApi.md#get_peer_id) | **GET** /node/peerid | Get Node&#39;s PeerID
[**get_spr**](NodeApi.md#get_spr) | **GET** /spr | Get Node&#39;s SPR [**get_spr**](NodeApi.md#get_spr) | **GET** /node/spr | Get Node&#39;s SPR
# **connect_peer** # **connect_peer**
@ -14,29 +14,27 @@ Method | HTTP request | Description
Connect to a peer Connect to a peer
If `addrs` param is supplied, it will be used to dial the peer, otherwise the `peerId` is used If `addrs` param is supplied, it will be used to dial the peer, otherwise the `peerId` is used to invoke peer discovery, if it succeeds the returned addresses will be used to dial.
to invoke peer discovery, if it succeeds the returned addresses will be used to dial.
### Example ### Example
```python ```python
import codex_api_client import codex_client
from codex_api_client.rest import ApiException from codex_client.rest import ApiException
from pprint import pprint from pprint import pprint
# Defining the host is optional and defaults to http://localhost:8080/api/codex/v1 # Defining the host is optional and defaults to http://localhost:8080/api/codex/v1
# See configuration.py for a list of all supported configuration parameters. # See configuration.py for a list of all supported configuration parameters.
configuration = codex_api_client.Configuration( configuration = codex_client.Configuration(
host = "http://localhost:8080/api/codex/v1" host = "http://localhost:8080/api/codex/v1"
) )
# Enter a context with an instance of the API client # Enter a context with an instance of the API client
with codex_api_client.ApiClient(configuration) as api_client: with codex_client.ApiClient(configuration) as api_client:
# Create an instance of the API class # Create an instance of the API class
api_instance = codex_api_client.NodeApi(api_client) api_instance = codex_client.NodeApi(api_client)
peer_id = 'peer_id_example' # str | Peer that should be dialed. peer_id = 'peer_id_example' # str | Peer that should be dialed.
addrs = ['addrs_example'] # List[str] | If supplied, it will be used to dial the peer. The address has to target the listening address of the peer, which is specified with the `--listen-addrs` CLI flag. (optional) addrs = ['addrs_example'] # List[str] | If supplied, it will be used to dial the peer. The address has to target the listening address of the peer, which is specified with the `--listen-addrs` CLI flag. (optional)
@ -88,21 +86,21 @@ Get Node's PeerID
```python ```python
import codex_api_client import codex_client
from codex_api_client.rest import ApiException from codex_client.rest import ApiException
from pprint import pprint from pprint import pprint
# Defining the host is optional and defaults to http://localhost:8080/api/codex/v1 # Defining the host is optional and defaults to http://localhost:8080/api/codex/v1
# See configuration.py for a list of all supported configuration parameters. # See configuration.py for a list of all supported configuration parameters.
configuration = codex_api_client.Configuration( configuration = codex_client.Configuration(
host = "http://localhost:8080/api/codex/v1" host = "http://localhost:8080/api/codex/v1"
) )
# Enter a context with an instance of the API client # Enter a context with an instance of the API client
with codex_api_client.ApiClient(configuration) as api_client: with codex_client.ApiClient(configuration) as api_client:
# Create an instance of the API class # Create an instance of the API class
api_instance = codex_api_client.NodeApi(api_client) api_instance = codex_client.NodeApi(api_client)
try: try:
# Get Node's PeerID # Get Node's PeerID
@ -130,7 +128,7 @@ No authorization required
### HTTP request headers ### HTTP request headers
- **Content-Type**: Not defined - **Content-Type**: Not defined
- **Accept**: text/plain, application/json - **Accept**: plain/text, application/json
### HTTP response details ### HTTP response details
@ -149,21 +147,21 @@ Get Node's SPR
```python ```python
import codex_api_client import codex_client
from codex_api_client.rest import ApiException from codex_client.rest import ApiException
from pprint import pprint from pprint import pprint
# Defining the host is optional and defaults to http://localhost:8080/api/codex/v1 # Defining the host is optional and defaults to http://localhost:8080/api/codex/v1
# See configuration.py for a list of all supported configuration parameters. # See configuration.py for a list of all supported configuration parameters.
configuration = codex_api_client.Configuration( configuration = codex_client.Configuration(
host = "http://localhost:8080/api/codex/v1" host = "http://localhost:8080/api/codex/v1"
) )
# Enter a context with an instance of the API client # Enter a context with an instance of the API client
with codex_api_client.ApiClient(configuration) as api_client: with codex_client.ApiClient(configuration) as api_client:
# Create an instance of the API class # Create an instance of the API class
api_instance = codex_api_client.NodeApi(api_client) api_instance = codex_client.NodeApi(api_client)
try: try:
# Get Node's SPR # Get Node's SPR
@ -191,7 +189,7 @@ No authorization required
### HTTP request headers ### HTTP request headers
- **Content-Type**: Not defined - **Content-Type**: Not defined
- **Accept**: text/plain, application/json - **Accept**: plain/text, application/json
### HTTP response details ### HTTP response details

View File

@ -10,7 +10,7 @@ Name | Type | Description | Notes
## Example ## Example
```python ```python
from codex_api_client.models.peer_id_read import PeerIdRead from codex_client.models.peer_id_read import PeerIdRead
# TODO update the JSON string below # TODO update the JSON string below
json = "{}" json = "{}"

View File

@ -1,30 +0,0 @@
# PeersTable
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**local_node** | [**Node**](Node.md) | |
**nodes** | [**List[Node]**](Node.md) | |
## Example
```python
from codex_api_client.models.peers_table import PeersTable
# TODO update the JSON string below
json = "{}"
# create an instance of PeersTable from a JSON string
peers_table_instance = PeersTable.from_json(json)
# print the JSON string representation of the object
print(PeersTable.to_json())
# convert the object into a dict
peers_table_dict = peers_table_instance.to_dict()
# create an instance of PeersTable from a dict
peers_table_from_dict = PeersTable.from_dict(peers_table_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)

View File

@ -5,15 +5,14 @@
Name | Type | Description | Notes Name | Type | Description | Notes
------------ | ------------- | ------------- | ------------- ------------ | ------------- | ------------- | -------------
**state** | **str** | Description of the Request&#39;s state | **state** | **str** | Description of the Request&#39;s state | [optional]
**error** | **str** | If Request failed, then here is presented the error message | [optional] **error** | **str** | If Request failed, then here is presented the error message | [optional]
**request** | [**StorageRequest**](StorageRequest.md) | | [optional] **request** | [**StorageRequest**](StorageRequest.md) | | [optional]
**request_id** | **str** | 32bits identifier encoded in hex-decimal string. |
## Example ## Example
```python ```python
from codex_api_client.models.purchase import Purchase from codex_client.models.purchase import Purchase
# TODO update the JSON string below # TODO update the JSON string below
json = "{}" json = "{}"

View File

@ -5,17 +5,16 @@
Name | Type | Description | Notes Name | Type | Description | Notes
------------ | ------------- | ------------- | ------------- ------------ | ------------- | ------------- | -------------
**id** | **str** | 32bits identifier encoded in hex-decimal string. | **id** | **str** | 32bits identifier encoded in hex-decimal string. | [optional]
**availability_id** | **str** | 32bits identifier encoded in hex-decimal string. | **availability_id** | **str** | 32bits identifier encoded in hex-decimal string. | [optional]
**size** | **int** | Size of the slot in bytes | **size** | **str** | Integer represented as decimal string | [optional]
**request_id** | **str** | 32bits identifier encoded in hex-decimal string. | **request_id** | **str** | 32bits identifier encoded in hex-decimal string. | [optional]
**slot_index** | **int** | Slot Index number | **slot_index** | **str** | Slot Index as decimal string | [optional]
**valid_until** | **int** | Timestamp after which the reservation will no longer be valid. |
## Example ## Example
```python ```python
from codex_api_client.models.reservation import Reservation from codex_client.models.reservation import Reservation
# TODO update the JSON string below # TODO update the JSON string below
json = "{}" json = "{}"

View File

@ -5,12 +5,12 @@
Name | Type | Description | Notes Name | Type | Description | Notes
------------ | ------------- | ------------- | ------------- ------------ | ------------- | ------------- | -------------
**spr** | **str** | Signed Peer Record (libp2p) | **spr** | **str** | Signed Peer Record (libp2p) | [optional]
## Example ## Example
```python ```python
from codex_api_client.models.spr_read import SPRRead from codex_client.models.spr_read import SPRRead
# TODO update the JSON string below # TODO update the JSON string below
json = "{}" json = "{}"

View File

@ -5,17 +5,16 @@
Name | Type | Description | Notes Name | Type | Description | Notes
------------ | ------------- | ------------- | ------------- ------------ | ------------- | ------------- | -------------
**total_size** | **int** | Total size of availability&#39;s storage in bytes | **id** | **str** | 32bits identifier encoded in hex-decimal string. | [optional]
**duration** | **int** | The duration of the request in seconds | **total_size** | **str** | Total size of availability&#39;s storage in bytes as decimal string | [optional]
**min_price_per_byte_per_second** | **str** | Minimal price per byte per second paid (in amount of tokens) for the hosted request&#39;s slot for the request&#39;s duration as decimal string | **duration** | **str** | The duration of the request in seconds as decimal string | [optional]
**total_collateral** | **str** | Total collateral (in amount of tokens) that can be used for matching requests | **min_price** | **str** | Minimum price to be paid (in amount of tokens) as decimal string | [optional]
**enabled** | **bool** | Enable the ability to receive sales on this availability. | [optional] [default to True] **max_collateral** | **str** | Maximum collateral user is willing to pay per filled Slot (in amount of tokens) as decimal string | [optional]
**until** | **int** | Specifies the latest timestamp, after which the availability will no longer host any slots. If set to 0, there will be no restrictions. | [optional] [default to 0]
## Example ## Example
```python ```python
from codex_api_client.models.sales_availability import SalesAvailability from codex_client.models.sales_availability import SalesAvailability
# TODO update the JSON string below # TODO update the JSON string below
json = "{}" json = "{}"

View File

@ -6,15 +6,15 @@
Name | Type | Description | Notes Name | Type | Description | Notes
------------ | ------------- | ------------- | ------------- ------------ | ------------- | ------------- | -------------
**id** | **str** | 32bits identifier encoded in hex-decimal string. | [optional] **id** | **str** | 32bits identifier encoded in hex-decimal string. | [optional]
**total_size** | **int** | Total size of availability&#39;s storage in bytes | **total_size** | **str** | Total size of availability&#39;s storage in bytes as decimal string |
**duration** | **int** | The duration of the request in seconds | **duration** | **str** | The duration of the request in seconds as decimal string |
**min_price_per_byte_per_second** | **str** | Minimal price per byte per second paid (in amount of tokens) for the hosted request&#39;s slot for the request&#39;s duration as decimal string | **min_price** | **str** | Minimum price to be paid (in amount of tokens) as decimal string |
**total_collateral** | **str** | Total collateral (in amount of tokens) that can be used for matching requests | **max_collateral** | **str** | Maximum collateral user is willing to pay per filled Slot (in amount of tokens) as decimal string |
## Example ## Example
```python ```python
from codex_api_client.models.sales_availability_create import SalesAvailabilityCREATE from codex_client.models.sales_availability_create import SalesAvailabilityCREATE
# TODO update the JSON string below # TODO update the JSON string below
json = "{}" json = "{}"

View File

@ -5,20 +5,17 @@
Name | Type | Description | Notes Name | Type | Description | Notes
------------ | ------------- | ------------- | ------------- ------------ | ------------- | ------------- | -------------
**total_size** | **int** | Total size of availability&#39;s storage in bytes | **id** | **str** | 32bits identifier encoded in hex-decimal string. | [optional]
**duration** | **int** | The duration of the request in seconds | **total_size** | **str** | Total size of availability&#39;s storage in bytes as decimal string | [optional]
**min_price_per_byte_per_second** | **str** | Minimal price per byte per second paid (in amount of tokens) for the hosted request&#39;s slot for the request&#39;s duration as decimal string | **duration** | **str** | The duration of the request in seconds as decimal string | [optional]
**total_collateral** | **str** | Total collateral (in amount of tokens) that can be used for matching requests | **min_price** | **str** | Minimum price to be paid (in amount of tokens) as decimal string | [optional]
**enabled** | **bool** | Enable the ability to receive sales on this availability. | [optional] [default to True] **max_collateral** | **str** | Maximum collateral user is willing to pay per filled Slot (in amount of tokens) as decimal string | [optional]
**until** | **int** | Specifies the latest timestamp, after which the availability will no longer host any slots. If set to 0, there will be no restrictions. | [optional] [default to 0] **free_size** | **str** | Unused size of availability&#39;s storage in bytes as decimal string | [optional]
**id** | **str** | 32bits identifier encoded in hex-decimal string. |
**free_size** | **int** | Unused size of availability&#39;s storage in bytes as decimal string | [readonly]
**total_remaining_collateral** | **str** | Total collateral effective (in amount of tokens) that can be used for matching requests | [readonly]
## Example ## Example
```python ```python
from codex_api_client.models.sales_availability_read import SalesAvailabilityREAD from codex_client.models.sales_availability_read import SalesAvailabilityREAD
# TODO update the JSON string below # TODO update the JSON string below
json = "{}" json = "{}"

View File

@ -5,14 +5,14 @@
Name | Type | Description | Notes Name | Type | Description | Notes
------------ | ------------- | ------------- | ------------- ------------ | ------------- | ------------- | -------------
**id** | **str** | Keccak hash of the abi encoded tuple (RequestId, slot index) | **id** | **str** | Keccak hash of the abi encoded tuple (RequestId, slot index) | [optional]
**request** | [**StorageRequest**](StorageRequest.md) | | **request** | [**StorageRequest**](StorageRequest.md) | | [optional]
**slot_index** | **int** | Slot Index number | **slot_index** | **str** | Slot Index as decimal string | [optional]
## Example ## Example
```python ```python
from codex_api_client.models.slot import Slot from codex_client.models.slot import Slot
# TODO update the JSON string below # TODO update the JSON string below
json = "{}" json = "{}"

View File

@ -5,16 +5,17 @@
Name | Type | Description | Notes Name | Type | Description | Notes
------------ | ------------- | ------------- | ------------- ------------ | ------------- | ------------- | -------------
**slot_index** | **int** | Slot Index number | **id** | **str** | Keccak hash of the abi encoded tuple (RequestId, slot index) | [optional]
**request_id** | **str** | 32bits identifier encoded in hex-decimal string. | **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] **request** | [**StorageRequest**](StorageRequest.md) | | [optional]
**reservation** | [**Reservation**](Reservation.md) | | [optional] **reservation** | [**Reservation**](Reservation.md) | | [optional]
**state** | **str** | Description of the slot&#39;s | **state** | **str** | Description of the slot&#39;s | [optional]
## Example ## Example
```python ```python
from codex_api_client.models.slot_agent import SlotAgent from codex_client.models.slot_agent import SlotAgent
# TODO update the JSON string below # TODO update the JSON string below
json = "{}" json = "{}"

View File

@ -5,15 +5,15 @@
Name | Type | Description | Notes Name | Type | Description | Notes
------------ | ------------- | ------------- | ------------- ------------ | ------------- | ------------- | -------------
**total_blocks** | **int** | Number of blocks stored by the node | **total_blocks** | **int** | Number of blocks stored by the node | [optional]
**quota_max_bytes** | **int** | Maximum storage space (in bytes) available for the node in Codex&#39;s local repository. | **quota_max_bytes** | **int** | Maximum storage space used by the node | [optional]
**quota_used_bytes** | **int** | Amount of storage space (in bytes) currently used for storing files in Codex&#39;s local repository. | **quota_used_bytes** | **int** | Amount of storage space currently in use | [optional]
**quota_reserved_bytes** | **int** | Amount of storage reserved (in bytes) in the Codex&#39;s local repository for future use when storage requests will be picked up and hosted by the node using node&#39;s availabilities. This does not include the storage currently in use. | **quota_reserved_bytes** | **int** | Amount of storage space reserved | [optional]
## Example ## Example
```python ```python
from codex_api_client.models.space import Space from codex_client.models.space import Space
# TODO update the JSON string below # TODO update the JSON string below
json = "{}" json = "{}"

View File

@ -5,18 +5,17 @@
Name | Type | Description | Notes Name | Type | Description | Notes
------------ | ------------- | ------------- | ------------- ------------ | ------------- | ------------- | -------------
**slots** | **int** | Number of slots (eq. hosts) that the Request want to have the content spread over | **slots** | **int** | Number of slots (eq. hosts) that the Request want to have the content spread over | [optional]
**slot_size** | **int** | Amount of storage per slot in bytes | **slot_size** | **str** | Amount of storage per slot (in bytes) as decimal string | [optional]
**duration** | **int** | The duration of the request in seconds | **duration** | **str** | The duration of the request in seconds as decimal string | [optional]
**proof_probability** | **str** | How often storage proofs are required as decimal string | **proof_probability** | **str** | How often storage proofs are required as decimal string | [optional]
**price_per_byte_per_second** | **str** | The amount of tokens paid per byte per second per slot to hosts the client is willing to pay | **reward** | **str** | The maximum amount of tokens paid per second per slot to hosts the client is willing to pay |
**collateral_per_byte** | **str** | Number as decimal string that represents how much collateral per byte is asked from hosts that wants to fill a slots | **max_slot_loss** | **int** | Max slots that can be lost without data considered to be lost | [optional]
**max_slot_loss** | **int** | Max slots that can be lost without data considered to be lost |
## Example ## Example
```python ```python
from codex_api_client.models.storage_ask import StorageAsk from codex_client.models.storage_ask import StorageAsk
# TODO update the JSON string below # TODO update the JSON string below
json = "{}" json = "{}"

View File

@ -5,17 +5,17 @@
Name | Type | Description | Notes Name | Type | Description | Notes
------------ | ------------- | ------------- | ------------- ------------ | ------------- | ------------- | -------------
**id** | **str** | Request ID | **id** | **str** | Request ID | [optional]
**client** | **str** | Address of Ethereum address | **client** | **str** | Address of Ethereum address | [optional]
**ask** | [**StorageAsk**](StorageAsk.md) | | **ask** | [**StorageAsk**](StorageAsk.md) | | [optional]
**content** | [**Content**](Content.md) | | **content** | [**Content**](Content.md) | | [optional]
**expiry** | **int** | A timestamp as seconds since unix epoch at which this request expires if the Request does not find requested amount of nodes to host the data. | **expiry** | **str** | A timestamp as seconds since unix epoch at which this request expires if the Request does not find requested amount of nodes to host the data. | [optional] [default to '10 minutes']
**nonce** | **str** | Random data | **nonce** | **str** | Random data | [optional]
## Example ## Example
```python ```python
from codex_api_client.models.storage_request import StorageRequest from codex_client.models.storage_request import StorageRequest
# TODO update the JSON string below # TODO update the JSON string below
json = "{}" json = "{}"

View File

@ -5,18 +5,18 @@
Name | Type | Description | Notes Name | Type | Description | Notes
------------ | ------------- | ------------- | ------------- ------------ | ------------- | ------------- | -------------
**duration** | **int** | The duration of the request in seconds | **duration** | **str** | The duration of the request in seconds as decimal string |
**price_per_byte_per_second** | **str** | The amount of tokens paid per byte per second per slot to hosts the client is willing to pay | **reward** | **str** | The maximum amount of tokens paid per second per slot to hosts the client is willing to pay |
**proof_probability** | **str** | How often storage proofs are required as decimal string | **proof_probability** | **str** | How often storage proofs are required as decimal string |
**nodes** | **int** | Minimal number of nodes the content should be stored on | [optional] [default to 3] **nodes** | **int** | Minimal number of nodes the content should be stored on | [optional] [default to 1]
**tolerance** | **int** | Additional number of nodes on top of the &#x60;nodes&#x60; property that can be lost before pronouncing the content lost | [optional] [default to 1] **tolerance** | **int** | Additional number of nodes on top of the &#x60;nodes&#x60; property that can be lost before pronouncing the content lost | [optional] [default to 0]
**collateral_per_byte** | **str** | Number as decimal string that represents how much collateral per byte is asked from hosts that wants to fill a slots | **collateral** | **str** | Number as decimal string that represents how much collateral is asked from hosts that wants to fill a slots |
**expiry** | **int** | Number 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&#39;s duration itself. | **expiry** | **str** | 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&#39;s duration itself. |
## Example ## Example
```python ```python
from codex_api_client.models.storage_request_creation import StorageRequestCreation from codex_client.models.storage_request_creation import StorageRequestCreation
# TODO update the JSON string below # TODO update the JSON string below
json = "{}" json = "{}"

View File

@ -1,15 +1,8 @@
#!/bin/sh #!/bin/sh
if [ -z "$1" ]; then
echo "No version supplied"
exit 1
fi
openapi-generator-cli generate \ openapi-generator-cli generate \
-t .openapi-generator/templates \
-g python \ -g python \
-i codex.yaml \ -i codex.yaml \
--additional-properties="packageName=codex_api_client,projectName=codex-api-client,packageUrl=https://github.com/codex-storage/py-codex-api-client,packageVersion=$1" \ --additional-properties="packageName=codex_client,projectName=Codex\ API\ Client,packageUrl=https://github.com/AuHau/py-codex-api" \
--git-repo-id py-codex-api-client --git-user-id codex-storage \ --git-repo-id py-codex-api --git-user-id auhau \
--http-user-agent py_codex_api_client --http-user-agent py_codex_client

57
git_push.sh Normal file
View File

@ -0,0 +1,57 @@
#!/bin/sh
# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
#
# Usage example: /bin/sh ./git_push.sh wing328 openapi-petstore-perl "minor update" "gitlab.com"
git_user_id=$1
git_repo_id=$2
release_note=$3
git_host=$4
if [ "$git_host" = "" ]; then
git_host="github.com"
echo "[INFO] No command line input provided. Set \$git_host to $git_host"
fi
if [ "$git_user_id" = "" ]; then
git_user_id="auhau"
echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id"
fi
if [ "$git_repo_id" = "" ]; then
git_repo_id="py-codex-api"
echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id"
fi
if [ "$release_note" = "" ]; then
release_note="Minor update"
echo "[INFO] No command line input provided. Set \$release_note to $release_note"
fi
# Initialize the local directory as a Git repository
git init
# Adds the files in the local repository and stages them for commit.
git add .
# Commits the tracked changes and prepares them to be pushed to a remote repository.
git commit -m "$release_note"
# Sets the new remote
git_remote=$(git remote)
if [ "$git_remote" = "" ]; then # git remote not defined
if [ "$GIT_TOKEN" = "" ]; then
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git
else
git remote add origin https://${git_user_id}:"${GIT_TOKEN}"@${git_host}/${git_user_id}/${git_repo_id}.git
fi
fi
git pull origin master
# Pushes (Forces) the changes in the local repository up to the remote repository
echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git"
git push origin master 2>&1 | grep -v 'To https'

View File

@ -2,6 +2,6 @@
"$schema": "./node_modules/@openapitools/openapi-generator-cli/config.schema.json", "$schema": "./node_modules/@openapitools/openapi-generator-cli/config.schema.json",
"spaces": 2, "spaces": 2,
"generator-cli": { "generator-cli": {
"version": "7.12.0" "version": "7.8.0"
} }
} }

View File

@ -1,29 +1,28 @@
[tool.poetry] [tool.poetry]
name = "codex_api_client" name = "codex_client"
version = "0.4.0" version = "1.0.0"
description = "Codex API" description = "Codex API"
authors = ["OpenAPI Generator Community <team@openapitools.org>"] authors = ["OpenAPI Generator Community <team@openapitools.org>"]
license = "NoLicense" license = "NoLicense"
readme = "README.md" readme = "README.md"
repository = "https://github.com/codex-storage/py-codex-api-client" repository = "https://github.com/auhau/py-codex-api"
keywords = ["OpenAPI", "OpenAPI-Generator", "Codex API"] keywords = ["OpenAPI", "OpenAPI-Generator", "Codex API"]
include = ["codex_api_client/py.typed"] include = ["codex_client/py.typed"]
[tool.poetry.dependencies] [tool.poetry.dependencies]
python = "^3.8" python = "^3.7"
urllib3 = ">= 1.25.3, < 3.0.0" urllib3 = ">= 1.25.3"
python-dateutil = ">= 2.8.2" python-dateutil = ">=2.8.2"
pydantic = ">= 2" pydantic = ">=2"
typing-extensions = ">= 4.7.1" typing-extensions = ">=4.7.1"
[tool.poetry.dev-dependencies] [tool.poetry.dev-dependencies]
pytest = ">= 7.2.1" pytest = ">=7.2.1"
pytest-cov = ">= 2.8.1" tox = ">=3.9.0"
tox = ">= 3.9.0" flake8 = ">=4.0.0"
flake8 = ">= 4.0.0" types-python-dateutil = ">=2.8.19.14"
types-python-dateutil = ">= 2.8.19.14" mypy = "1.4.1"
mypy = ">= 1.5"
[build-system] [build-system]
@ -35,7 +34,7 @@ extension-pkg-whitelist = "pydantic"
[tool.mypy] [tool.mypy]
files = [ files = [
"codex_api_client", "codex_client",
#"test", # auto-generated tests #"test", # auto-generated tests
"tests", # hand-written tests "tests", # hand-written tests
] ]
@ -49,7 +48,7 @@ warn_unused_ignores = true
## Getting these passing should be easy ## Getting these passing should be easy
strict_equality = true strict_equality = true
extra_checks = true strict_concatenate = true
## Strongly recommend enabling this one as soon as you can ## Strongly recommend enabling this one as soon as you can
check_untyped_defs = true check_untyped_defs = true
@ -70,20 +69,3 @@ disallow_any_generics = true
# #
### This one can be tricky to get passing if you use a lot of untyped libraries ### This one can be tricky to get passing if you use a lot of untyped libraries
#warn_return_any = true #warn_return_any = true
[[tool.mypy.overrides]]
module = [
"codex_api_client.configuration",
]
warn_unused_ignores = true
strict_equality = true
extra_checks = true
check_untyped_defs = true
disallow_subclassing_any = true
disallow_untyped_decorators = true
disallow_any_generics = true
disallow_untyped_calls = true
disallow_incomplete_defs = true
disallow_untyped_defs = true
no_implicit_reexport = true
warn_return_any = true

View File

@ -1,4 +1,5 @@
urllib3 >= 1.25.3, < 3.0.0 python_dateutil >= 2.5.3
python_dateutil >= 2.8.2 setuptools >= 21.0.0
urllib3 >= 1.25.3, < 2.1.0
pydantic >= 2 pydantic >= 2
typing-extensions >= 4.7.1 typing-extensions >= 4.7.1

View File

@ -20,12 +20,12 @@ from setuptools import setup, find_packages # noqa: H301
# #
# prerequisite: setuptools # prerequisite: setuptools
# http://pypi.python.org/pypi/setuptools # http://pypi.python.org/pypi/setuptools
NAME = "codex-api-client" NAME = "Codex API Client"
VERSION = "0.4.0" VERSION = "1.0.0"
PYTHON_REQUIRES = ">= 3.8" PYTHON_REQUIRES = ">=3.7"
REQUIRES = [ REQUIRES = [
"urllib3 >= 1.25.3, < 3.0.0", "urllib3 >= 1.25.3, < 2.1.0",
"python-dateutil >= 2.8.2", "python-dateutil",
"pydantic >= 2", "pydantic >= 2",
"typing-extensions >= 4.7.1", "typing-extensions >= 4.7.1",
] ]
@ -36,7 +36,7 @@ setup(
description="Codex API", description="Codex API",
author="OpenAPI Generator community", author="OpenAPI Generator community",
author_email="team@openapitools.org", author_email="team@openapitools.org",
url="https://github.com/codex-storage/py-codex-api-client", url="https://github.com/AuHau/py-codex-api",
keywords=["OpenAPI", "OpenAPI-Generator", "Codex API"], keywords=["OpenAPI", "OpenAPI-Generator", "Codex API"],
install_requires=REQUIRES, install_requires=REQUIRES,
packages=find_packages(exclude=["test", "tests"]), packages=find_packages(exclude=["test", "tests"]),
@ -45,5 +45,5 @@ setup(
long_description="""\ long_description="""\
List of endpoints and interfaces available to Codex API users List of endpoints and interfaces available to Codex API users
""", # noqa: E501 """, # noqa: E501
package_data={"codex_api_client": ["py.typed"]}, package_data={"codex_client": ["py.typed"]},
) )

View File

@ -1,6 +1,5 @@
pytest >= 7.2.1 pytest~=7.1.3
pytest-cov >= 2.8.1 pytest-cov>=2.8.1
tox >= 3.9.0 pytest-randomly>=3.12.0
flake8 >= 4.0.0 mypy>=1.4.1
types-python-dateutil >= 2.8.19.14 types-python-dateutil>=2.8.19
mypy >= 1.5

View File

@ -14,7 +14,7 @@
import unittest import unittest
from codex_api_client.models.content import Content from codex_client.models.content import Content
class TestContent(unittest.TestCase): class TestContent(unittest.TestCase):
"""Content unit test stubs""" """Content unit test stubs"""
@ -35,7 +35,13 @@ class TestContent(unittest.TestCase):
model = Content() model = Content()
if include_optional: if include_optional:
return Content( return Content(
cid = 'QmYyQSo1c1Ym7orWxLYvCrM2EmxFTANf8wXmmE7DWjhx5N' cid = 'QmYyQSo1c1Ym7orWxLYvCrM2EmxFTANf8wXmmE7DWjhx5N',
erasure = codex_client.models.erasure_parameters.ErasureParameters(
total_chunks = 56, ),
por = codex_client.models.po_r_parameters.PoRParameters(
u = '',
public_key = '',
name = '', )
) )
else: else:
return Content( return Content(

View File

@ -14,7 +14,7 @@
import unittest import unittest
from codex_api_client.api.data_api import DataApi from codex_client.api.data_api import DataApi
class TestDataApi(unittest.TestCase): class TestDataApi(unittest.TestCase):
@ -36,20 +36,6 @@ class TestDataApi(unittest.TestCase):
def test_download_network(self) -> None: def test_download_network(self) -> None:
"""Test case for download_network """Test case for download_network
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.
"""
pass
def test_download_network_manifest(self) -> None:
"""Test case for download_network_manifest
Download only the dataset manifest from the network to the local node if it's not available locally.
"""
pass
def test_download_network_stream(self) -> None:
"""Test case for download_network_stream
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. 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.
""" """
pass pass

View File

@ -14,7 +14,7 @@
import unittest import unittest
from codex_api_client.models.data_item import DataItem from codex_client.models.data_item import DataItem
class TestDataItem(unittest.TestCase): class TestDataItem(unittest.TestCase):
"""DataItem unit test stubs""" """DataItem unit test stubs"""
@ -36,14 +36,11 @@ class TestDataItem(unittest.TestCase):
if include_optional: if include_optional:
return DataItem( return DataItem(
cid = 'QmYyQSo1c1Ym7orWxLYvCrM2EmxFTANf8wXmmE7DWjhx5N', cid = 'QmYyQSo1c1Ym7orWxLYvCrM2EmxFTANf8wXmmE7DWjhx5N',
manifest = codex_api_client.models.manifest_item.ManifestItem( manifest = codex_client.models.manifest_item.ManifestItem(
tree_cid = 'QmYyQSo1c1Ym7orWxLYvCrM2EmxFTANf8wXmmE7DWjhx5N', root_hash = 'QmYyQSo1c1Ym7orWxLYvCrM2EmxFTANf8wXmmE7DWjhx5N',
dataset_size = 56, original_bytes = 56,
block_size = 56, block_size = 56,
protected = True, protected = True, )
filename = 'codex.png',
mimetype = 'image/png',
uploaded_at = 1729244192, )
) )
else: else:
return DataItem( return DataItem(

View File

@ -14,7 +14,7 @@
import unittest import unittest
from codex_api_client.models.data_list import DataList from codex_client.models.data_list import DataList
class TestDataList(unittest.TestCase): class TestDataList(unittest.TestCase):
"""DataList unit test stubs""" """DataList unit test stubs"""
@ -36,16 +36,13 @@ class TestDataList(unittest.TestCase):
if include_optional: if include_optional:
return DataList( return DataList(
content = [ content = [
codex_api_client.models.data_item.DataItem( codex_client.models.data_item.DataItem(
cid = 'QmYyQSo1c1Ym7orWxLYvCrM2EmxFTANf8wXmmE7DWjhx5N', cid = 'QmYyQSo1c1Ym7orWxLYvCrM2EmxFTANf8wXmmE7DWjhx5N',
manifest = codex_api_client.models.manifest_item.ManifestItem( manifest = codex_client.models.manifest_item.ManifestItem(
tree_cid = 'QmYyQSo1c1Ym7orWxLYvCrM2EmxFTANf8wXmmE7DWjhx5N', root_hash = 'QmYyQSo1c1Ym7orWxLYvCrM2EmxFTANf8wXmmE7DWjhx5N',
dataset_size = 56, original_bytes = 56,
block_size = 56, block_size = 56,
protected = True, protected = True, ), )
filename = 'codex.png',
mimetype = 'image/png',
uploaded_at = 1729244192, ), )
] ]
) )
else: else:

View File

@ -14,7 +14,7 @@
import unittest import unittest
from codex_api_client.api.debug_api import DebugApi from codex_client.api.debug_api import DebugApi
class TestDebugApi(unittest.TestCase): class TestDebugApi(unittest.TestCase):

View File

@ -14,7 +14,7 @@
import unittest import unittest
from codex_api_client.models.debug_info import DebugInfo from codex_client.models.debug_info import DebugInfo
class TestDebugInfo(unittest.TestCase): class TestDebugInfo(unittest.TestCase):
"""DebugInfo unit test stubs""" """DebugInfo unit test stubs"""
@ -40,25 +40,7 @@ class TestDebugInfo(unittest.TestCase):
'/ip4/127.0.0.1/tcp/8080' '/ip4/127.0.0.1/tcp/8080'
], ],
repo = '', repo = '',
spr = '', spr = ''
table = codex_api_client.models.peers_table.PeersTable(
local_node = codex_api_client.models.node.Node(
node_id = '',
peer_id = '',
record = '',
address = '',
seen = True, ),
nodes = [
codex_api_client.models.node.Node(
node_id = '',
peer_id = '',
record = '',
address = '',
seen = True, )
], ),
codex = codex_api_client.models.codex_version.CodexVersion(
version = 'v0.1.7',
revision = '0c647d8', )
) )
else: else:
return DebugInfo( return DebugInfo(

View File

@ -14,10 +14,10 @@
import unittest import unittest
from codex_api_client.models.codex_version import CodexVersion from codex_client.models.erasure_parameters import ErasureParameters
class TestCodexVersion(unittest.TestCase): class TestErasureParameters(unittest.TestCase):
"""CodexVersion unit test stubs""" """ErasureParameters unit test stubs"""
def setUp(self): def setUp(self):
pass pass
@ -25,26 +25,25 @@ class TestCodexVersion(unittest.TestCase):
def tearDown(self): def tearDown(self):
pass pass
def make_instance(self, include_optional) -> CodexVersion: def make_instance(self, include_optional) -> ErasureParameters:
"""Test CodexVersion """Test ErasureParameters
include_optional is a boolean, when False only required include_optional is a boolean, when False only required
params are included, when True both required and params are included, when True both required and
optional params are included """ optional params are included """
# uncomment below to create an instance of `CodexVersion` # uncomment below to create an instance of `ErasureParameters`
""" """
model = CodexVersion() model = ErasureParameters()
if include_optional: if include_optional:
return CodexVersion( return ErasureParameters(
version = 'v0.1.7', total_chunks = 56
revision = '0c647d8'
) )
else: else:
return CodexVersion( return ErasureParameters(
) )
""" """
def testCodexVersion(self): def testErasureParameters(self):
"""Test CodexVersion""" """Test ErasureParameters"""
# inst_req_only = self.make_instance(include_optional=False) # inst_req_only = self.make_instance(include_optional=False)
# inst_req_and_optional = self.make_instance(include_optional=True) # inst_req_and_optional = self.make_instance(include_optional=True)

View File

@ -14,7 +14,7 @@
import unittest import unittest
from codex_api_client.models.manifest_item import ManifestItem from codex_client.models.manifest_item import ManifestItem
class TestManifestItem(unittest.TestCase): class TestManifestItem(unittest.TestCase):
"""ManifestItem unit test stubs""" """ManifestItem unit test stubs"""
@ -35,13 +35,10 @@ class TestManifestItem(unittest.TestCase):
model = ManifestItem() model = ManifestItem()
if include_optional: if include_optional:
return ManifestItem( return ManifestItem(
tree_cid = 'QmYyQSo1c1Ym7orWxLYvCrM2EmxFTANf8wXmmE7DWjhx5N', root_hash = 'QmYyQSo1c1Ym7orWxLYvCrM2EmxFTANf8wXmmE7DWjhx5N',
dataset_size = 56, original_bytes = 56,
block_size = 56, block_size = 56,
protected = True, protected = True
filename = 'codex.png',
mimetype = 'image/png',
uploaded_at = 1729244192
) )
else: else:
return ManifestItem( return ManifestItem(

View File

@ -14,7 +14,7 @@
import unittest import unittest
from codex_api_client.api.marketplace_api import MarketplaceApi from codex_client.api.marketplace_api import MarketplaceApi
class TestMarketplaceApi(unittest.TestCase): class TestMarketplaceApi(unittest.TestCase):
@ -47,8 +47,8 @@ class TestMarketplaceApi(unittest.TestCase):
""" """
pass pass
def test_get_availabilities(self) -> None: def test_get_offered_storage(self) -> None:
"""Test case for get_availabilities """Test case for get_offered_storage
Returns storage that is for sale Returns storage that is for sale
""" """

View File

@ -14,7 +14,7 @@
import unittest import unittest
from codex_api_client.api.node_api import NodeApi from codex_client.api.node_api import NodeApi
class TestNodeApi(unittest.TestCase): class TestNodeApi(unittest.TestCase):

View File

@ -14,7 +14,7 @@
import unittest import unittest
from codex_api_client.models.peer_id_read import PeerIdRead from codex_client.models.peer_id_read import PeerIdRead
class TestPeerIdRead(unittest.TestCase): class TestPeerIdRead(unittest.TestCase):
"""PeerIdRead unit test stubs""" """PeerIdRead unit test stubs"""

View File

@ -1,64 +0,0 @@
# 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_api_client.models.peers_table import PeersTable
class TestPeersTable(unittest.TestCase):
"""PeersTable unit test stubs"""
def setUp(self):
pass
def tearDown(self):
pass
def make_instance(self, include_optional) -> PeersTable:
"""Test PeersTable
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 `PeersTable`
"""
model = PeersTable()
if include_optional:
return PeersTable(
local_node = codex_api_client.models.node.Node(
node_id = '',
peer_id = '',
record = '',
address = '',
seen = True, ),
nodes = [
codex_api_client.models.node.Node(
node_id = '',
peer_id = '',
record = '',
address = '',
seen = True, )
]
)
else:
return PeersTable(
)
"""
def testPeersTable(self):
"""Test PeersTable"""
# inst_req_only = self.make_instance(include_optional=False)
# inst_req_and_optional = self.make_instance(include_optional=True)
if __name__ == '__main__':
unittest.main()

View File

@ -14,10 +14,10 @@
import unittest import unittest
from codex_api_client.models.node import Node from codex_client.models.po_r_parameters import PoRParameters
class TestNode(unittest.TestCase): class TestPoRParameters(unittest.TestCase):
"""Node unit test stubs""" """PoRParameters unit test stubs"""
def setUp(self): def setUp(self):
pass pass
@ -25,29 +25,27 @@ class TestNode(unittest.TestCase):
def tearDown(self): def tearDown(self):
pass pass
def make_instance(self, include_optional) -> Node: def make_instance(self, include_optional) -> PoRParameters:
"""Test Node """Test PoRParameters
include_optional is a boolean, when False only required include_optional is a boolean, when False only required
params are included, when True both required and params are included, when True both required and
optional params are included """ optional params are included """
# uncomment below to create an instance of `Node` # uncomment below to create an instance of `PoRParameters`
""" """
model = Node() model = PoRParameters()
if include_optional: if include_optional:
return Node( return PoRParameters(
node_id = '', u = '',
peer_id = '', public_key = '',
record = '', name = ''
address = '',
seen = True
) )
else: else:
return Node( return PoRParameters(
) )
""" """
def testNode(self): def testPoRParameters(self):
"""Test Node""" """Test PoRParameters"""
# inst_req_only = self.make_instance(include_optional=False) # inst_req_only = self.make_instance(include_optional=False)
# inst_req_and_optional = self.make_instance(include_optional=True) # inst_req_and_optional = self.make_instance(include_optional=True)

View File

@ -14,7 +14,7 @@
import unittest import unittest
from codex_api_client.models.purchase import Purchase from codex_client.models.purchase import Purchase
class TestPurchase(unittest.TestCase): class TestPurchase(unittest.TestCase):
"""Purchase unit test stubs""" """Purchase unit test stubs"""
@ -35,20 +35,26 @@ class TestPurchase(unittest.TestCase):
model = Purchase() model = Purchase()
if include_optional: if include_optional:
return Purchase( return Purchase(
state = 'cancelled', state = '',
error = '', error = '',
request = codex_api_client.models.storage_request.StorageRequest( request = codex_client.models.storage_request.StorageRequest(
id = '', id = '',
client = '', client = '',
ask = codex_api_client.models.storage_ask.StorageAsk( ask = codex_client.models.storage_ask.StorageAsk(
slots = 56, slots = 56,
slot_size = '', slot_size = '',
duration = '', duration = '',
proof_probability = '', proof_probability = '',
reward = '', reward = '',
max_slot_loss = 56, ), max_slot_loss = 56, ),
content = codex_api_client.models.content.Content( content = codex_client.models.content.Content(
cid = 'QmYyQSo1c1Ym7orWxLYvCrM2EmxFTANf8wXmmE7DWjhx5N', ), 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', expiry = '10 minutes',
nonce = '', ) nonce = '', )
) )

View File

@ -14,7 +14,7 @@
import unittest import unittest
from codex_api_client.models.reservation import Reservation from codex_client.models.reservation import Reservation
class TestReservation(unittest.TestCase): class TestReservation(unittest.TestCase):
"""Reservation unit test stubs""" """Reservation unit test stubs"""

View File

@ -14,7 +14,7 @@
import unittest import unittest
from codex_api_client.models.sales_availability import SalesAvailability from codex_client.models.sales_availability import SalesAvailability
class TestSalesAvailability(unittest.TestCase): class TestSalesAvailability(unittest.TestCase):
"""SalesAvailability unit test stubs""" """SalesAvailability unit test stubs"""

View File

@ -14,7 +14,7 @@
import unittest import unittest
from codex_api_client.models.sales_availability_create import SalesAvailabilityCREATE from codex_client.models.sales_availability_create import SalesAvailabilityCREATE
class TestSalesAvailabilityCREATE(unittest.TestCase): class TestSalesAvailabilityCREATE(unittest.TestCase):
"""SalesAvailabilityCREATE unit test stubs""" """SalesAvailabilityCREATE unit test stubs"""

View File

@ -14,7 +14,7 @@
import unittest import unittest
from codex_api_client.models.sales_availability_read import SalesAvailabilityREAD from codex_client.models.sales_availability_read import SalesAvailabilityREAD
class TestSalesAvailabilityREAD(unittest.TestCase): class TestSalesAvailabilityREAD(unittest.TestCase):
"""SalesAvailabilityREAD unit test stubs""" """SalesAvailabilityREAD unit test stubs"""

Some files were not shown because too many files have changed in this diff Show More