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
name: codex_api_client Python package
name: codex_client Python package
on: [push, pull_request]
@ -13,10 +13,10 @@ jobs:
runs-on: ubuntu-latest
strategy:
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:
- uses: actions/checkout@v4
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
@ -24,8 +24,15 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -r test-requirements.txt
pip install flake8 pytest
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
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
# Then explicitly reverse the ignore rule for a single file:
#!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
.gitlab-ci.yml
.travis.yml
README.md
codex_api_client/__init__.py
codex_api_client/api/__init__.py
codex_api_client/api/data_api.py
codex_api_client/api/debug_api.py
codex_api_client/api/marketplace_api.py
codex_api_client/api/node_api.py
codex_api_client/api_client.py
codex_api_client/api_response.py
codex_api_client/configuration.py
codex_api_client/exceptions.py
codex_api_client/models/__init__.py
codex_api_client/models/codex_version.py
codex_api_client/models/content.py
codex_api_client/models/data_item.py
codex_api_client/models/data_list.py
codex_api_client/models/debug_info.py
codex_api_client/models/manifest_item.py
codex_api_client/models/node.py
codex_api_client/models/peer_id_read.py
codex_api_client/models/peers_table.py
codex_api_client/models/purchase.py
codex_api_client/models/reservation.py
codex_api_client/models/sales_availability.py
codex_api_client/models/sales_availability_read.py
codex_api_client/models/slot.py
codex_api_client/models/slot_agent.py
codex_api_client/models/space.py
codex_api_client/models/spr_read.py
codex_api_client/models/storage_ask.py
codex_api_client/models/storage_request.py
codex_api_client/models/storage_request_creation.py
codex_api_client/py.typed
codex_api_client/rest.py
docs/CodexVersion.md
codex_client/__init__.py
codex_client/api/__init__.py
codex_client/api/data_api.py
codex_client/api/debug_api.py
codex_client/api/marketplace_api.py
codex_client/api/node_api.py
codex_client/api_client.py
codex_client/api_response.py
codex_client/configuration.py
codex_client/exceptions.py
codex_client/models/__init__.py
codex_client/models/content.py
codex_client/models/data_item.py
codex_client/models/data_list.py
codex_client/models/debug_info.py
codex_client/models/erasure_parameters.py
codex_client/models/manifest_item.py
codex_client/models/peer_id_read.py
codex_client/models/po_r_parameters.py
codex_client/models/purchase.py
codex_client/models/reservation.py
codex_client/models/sales_availability.py
codex_client/models/sales_availability_create.py
codex_client/models/sales_availability_read.py
codex_client/models/slot.py
codex_client/models/slot_agent.py
codex_client/models/space.py
codex_client/models/spr_read.py
codex_client/models/storage_ask.py
codex_client/models/storage_request.py
codex_client/models/storage_request_creation.py
codex_client/py.typed
codex_client/rest.py
docs/Content.md
docs/DataApi.md
docs/DataItem.md
docs/DataList.md
docs/DebugApi.md
docs/DebugInfo.md
docs/ErasureParameters.md
docs/ManifestItem.md
docs/MarketplaceApi.md
docs/Node.md
docs/NodeApi.md
docs/PeerIdRead.md
docs/PeersTable.md
docs/PoRParameters.md
docs/Purchase.md
docs/Reservation.md
docs/SPRRead.md
docs/SalesAvailability.md
docs/SalesAvailabilityCREATE.md
docs/SalesAvailabilityREAD.md
docs/Slot.md
docs/SlotAgent.md
@ -57,6 +60,7 @@ docs/Space.md
docs/StorageAsk.md
docs/StorageRequest.md
docs/StorageRequestCreation.md
git_push.sh
pyproject.toml
requirements.txt
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
This Python package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:
- API version: 0.0.1
- Package version: 0.4.0
- Generator version: 7.12.0
- Package version: 1.0.0
- Generator version: 7.8.0
- Build package: org.openapitools.codegen.languages.PythonClientCodegen
## 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
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:
```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
Please follow the [installation procedure](#installation--usage) and then run the following:
```python
import codex_api_client
from codex_api_client.rest import ApiException
import codex_client
from codex_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(
configuration = codex_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:
with codex_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.
api_instance = codex_client.DataApi(api_client)
cid = 'cid_example' # str | File to be downloaded.
try:
# Deletes either a single block or an entire dataset from the local node.
api_instance.delete_local(cid)
# Download a file from the local node in a streaming manner. If the file is not available locally, a 404 is returned.
api_response = api_instance.download_local(cid)
print("The response of DataApi->download_local:\n")
pprint(api_response)
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
------------ | ------------- | ------------- | -------------
*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_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_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* | [**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* | [**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* | [**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* | [**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* | [**get_peer_id**](docs/NodeApi.md#get_peer_id) | **GET** /peerid | Get Node's PeerID
*NodeApi* | [**get_spr**](docs/NodeApi.md#get_spr) | **GET** /spr | Get Node's SPR
*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** /node/spr | Get Node's SPR
## Documentation For Models
- [CodexVersion](docs/CodexVersion.md)
- [Content](docs/Content.md)
- [DataItem](docs/DataItem.md)
- [DataList](docs/DataList.md)
- [DebugInfo](docs/DebugInfo.md)
- [ErasureParameters](docs/ErasureParameters.md)
- [ManifestItem](docs/ManifestItem.md)
- [Node](docs/Node.md)
- [PeerIdRead](docs/PeerIdRead.md)
- [PeersTable](docs/PeersTable.md)
- [PoRParameters](docs/PoRParameters.md)
- [Purchase](docs/Purchase.md)
- [Reservation](docs/Reservation.md)
- [SPRRead](docs/SPRRead.md)
- [SalesAvailability](docs/SalesAvailability.md)
- [SalesAvailabilityCREATE](docs/SalesAvailabilityCREATE.md)
- [SalesAvailabilityREAD](docs/SalesAvailabilityREAD.md)
- [Slot](docs/Slot.md)
- [SlotAgent](docs/SlotAgent.md)

View File

@ -6,7 +6,7 @@ info:
description: "List of endpoints and interfaces available to Codex API users"
security:
- {}
- { }
components:
schemas:
@ -27,6 +27,10 @@ components:
maxLength: 66
example: 0x...
BigInt:
type: string
description: Integer represented as decimal string
Cid:
type: string
description: Content Identifier as specified at https://github.com/multiformats/cid
@ -46,27 +50,22 @@ components:
type: string
description: Address of Ethereum address
PricePerBytePerSecond:
Reward:
type: string
description: The amount of tokens paid per byte 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
description: The maximum amount of tokens paid per second per slot to hosts the client is willing to pay
Duration:
type: integer
format: int64
description: The duration of the request in seconds
type: string
description: The duration of the request in seconds as decimal string
ProofProbability:
type: string
description: How often storage proofs are required as decimal string
Expiry:
type: integer
format: int64
type: string
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:
type: string
@ -74,8 +73,6 @@ components:
SPRRead:
type: object
required:
- spr
properties:
spr:
$ref: "#/components/schemas/SPR"
@ -86,71 +83,36 @@ components:
id:
$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:
type: object
required:
- cid
description: Parameters specifying the content
properties:
cid:
$ref: "#/components/schemas/Cid"
Node:
type: object
required:
- 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"
erasure:
$ref: "#/components/schemas/ErasureParameters"
por:
$ref: "#/components/schemas/PoRParameters"
DebugInfo:
type: object
required:
- id
- addrs
- repo
- spr
- announceAddresses
- table
- codex
properties:
id:
$ref: "#/components/schemas/PeerId"
@ -163,93 +125,61 @@ components:
description: Path of the data repository where all nodes data are stored
spr:
$ref: "#/components/schemas/SPR"
announceAddresses:
type: array
items:
$ref: "#/components/schemas/MultiAddress"
table:
$ref: "#/components/schemas/PeersTable"
codex:
$ref: "#/components/schemas/CodexVersion"
SalesAvailability:
type: object
required:
- totalSize
- duration
- minPricePerBytePerSecond
- totalCollateral
properties:
id:
$ref: "#/components/schemas/Id"
totalSize:
type: integer
format: int64
description: Total size of availability's storage in bytes
type: string
description: Total size of availability's storage in bytes as decimal string
duration:
$ref: "#/components/schemas/Duration"
minPricePerBytePerSecond:
minPrice:
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
totalCollateral:
description: Minimum price to be paid (in amount of tokens) as decimal string
maxCollateral:
type: string
description: Total collateral (in amount of tokens) that can be used for matching requests
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
description: Maximum collateral user is willing to pay per filled Slot (in amount of tokens) as decimal string
SalesAvailabilityREAD:
required:
- id
- totalRemainingCollateral
- freeSize
allOf:
- $ref: "#/components/schemas/SalesAvailability"
- type: object
properties:
id:
$ref: "#/components/schemas/Id"
readonly: true
freeSize:
type: integer
format: int64
description: Unused size of availability's storage in bytes as decimal string
readOnly: true
totalRemainingCollateral:
type: string
description: Total collateral effective (in amount of tokens) that can be used for matching requests
readOnly: true
description: Unused size of availability's storage in bytes as decimal string
SalesAvailabilityCREATE:
allOf:
- $ref: "#/components/schemas/SalesAvailability"
- required:
- totalSize
- minPrice
- maxCollateral
- duration
Slot:
type: object
required:
- id
- request
- slotIndex
properties:
id:
$ref: "#/components/schemas/SlotId"
request:
$ref: "#/components/schemas/StorageRequest"
slotIndex:
type: integer
format: int64
description: Slot Index number
type: string
description: Slot Index as decimal string
SlotAgent:
type: object
required:
- state
- requestId
- slotIndex
properties:
id:
$ref: "#/components/schemas/SlotId"
slotIndex:
type: integer
format: int64
description: Slot Index number
type: string
description: Slot Index as decimal string
requestId:
$ref: "#/components/schemas/Id"
request:
@ -276,104 +206,71 @@ components:
Reservation:
type: object
required:
- id
- availabilityId
- size
- requestId
- slotIndex
- validUntil
properties:
id:
$ref: "#/components/schemas/Id"
availabilityId:
$ref: "#/components/schemas/Id"
size:
type: integer
format: int64
description: Size of the slot in bytes
$ref: "#/components/schemas/BigInt"
requestId:
$ref: "#/components/schemas/Id"
slotIndex:
type: integer
format: int64
description: Slot Index number
validUntil:
type: integer
description: Timestamp after which the reservation will no longer be valid.
type: string
description: Slot Index as decimal string
StorageRequestCreation:
type: object
required:
- pricePerBytePerSecond
- reward
- duration
- proofProbability
- collateralPerByte
- collateral
- expiry
properties:
duration:
$ref: "#/components/schemas/Duration"
pricePerBytePerSecond:
$ref: "#/components/schemas/PricePerBytePerSecond"
reward:
$ref: "#/components/schemas/Reward"
proofProbability:
$ref: "#/components/schemas/ProofProbability"
nodes:
description: Minimal number of nodes the content should be stored on
type: integer
default: 3
minimum: 3
default: 1
tolerance:
description: Additional number of nodes on top of the `nodes` property that can be lost before pronouncing the content lost
type: integer
default: 1
minimum: 1
collateralPerByte:
$ref: "#/components/schemas/CollateralPerByte"
default: 0
collateral:
type: string
description: Number as decimal string that represents how much collateral is asked from hosts that wants to fill a slots
expiry:
type: integer
format: int64
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.
type: string
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.
StorageAsk:
type: object
required:
- slots
- slotSize
- duration
- proofProbability
- pricePerBytePerSecond
- collateralPerByte
- maxSlotLoss
- reward
properties:
slots:
description: Number of slots (eq. hosts) that the Request want to have the content spread over
type: integer
format: int64
slotSize:
type: integer
format: int64
description: Amount of storage per slot in bytes
type: string
description: Amount of storage per slot (in bytes) as decimal string
duration:
$ref: "#/components/schemas/Duration"
proofProbability:
$ref: "#/components/schemas/ProofProbability"
pricePerBytePerSecond:
$ref: "#/components/schemas/PricePerBytePerSecond"
collateralPerByte:
$ref: "#/components/schemas/CollateralPerByte"
reward:
$ref: "#/components/schemas/Reward"
maxSlotLoss:
type: integer
format: int64
description: Max slots that can be lost without data considered to be lost
StorageRequest:
type: object
required:
- id
- client
- ask
- content
- expiry
- nonce
properties:
id:
type: string
@ -392,16 +289,13 @@ components:
Purchase:
type: object
required:
- state
- requestId
properties:
state:
type: string
description: Description of the Request's state
enum:
- cancelled
- errored
- error
- failed
- finished
- pending
@ -410,17 +304,12 @@ components:
- unknown
error:
type: string
nullable: true
description: If Request failed, then here is presented the error message
request:
$ref: "#/components/schemas/StorageRequest"
requestId:
$ref: "#/components/schemas/Id"
DataList:
type: object
required:
- content
properties:
content:
type: array
@ -429,9 +318,6 @@ components:
DataItem:
type: object
required:
- cid
- manifest
properties:
cid:
$ref: "#/components/schemas/Cid"
@ -440,16 +326,11 @@ components:
ManifestItem:
type: object
required:
- treeCid
- datasetSize
- blockSize
- protected
properties:
treeCid:
rootHash:
$ref: "#/components/schemas/Cid"
description: "Unique data identifier"
datasetSize:
description: "Root hash of the content"
originalBytes:
type: integer
format: int64
description: "Length of original content in bytes"
@ -459,24 +340,9 @@ components:
protected:
type: boolean
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:
type: object
required:
- totalBlocks
- quotaMaxBytes
- quotaUsedBytes
- quotaReservedBytes
properties:
totalBlocks:
description: "Number of blocks stored by the node"
@ -485,15 +351,15 @@ components:
quotaMaxBytes:
type: integer
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:
type: integer
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:
type: integer
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:
- url: "http://localhost:8080/api/codex/v1"
@ -515,7 +381,7 @@ paths:
description: |
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.
tags: [Node]
tags: [ Node ]
operationId: connectPeer
parameters:
- in: path
@ -545,7 +411,7 @@ paths:
"/data":
get:
summary: "Lists manifest CIDs stored locally in node."
tags: [Data]
tags: [ Data ]
operationId: listData
responses:
"200":
@ -559,29 +425,12 @@ paths:
description: Invalid CID is specified
"404":
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":
description: Well it was bad-bad
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."
tags: [Data]
tags: [ Data ]
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:
content:
application/octet-stream:
@ -595,15 +444,13 @@ paths:
text/plain:
schema:
type: string
"422":
description: The mimetype of the filename is invalid
"500":
description: Well it was bad-bad and the upload did not work out
"/data/{cid}":
get:
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
parameters:
- in: path
@ -628,57 +475,11 @@ paths:
"500":
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":
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:
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]
operationId: downloadNetworkStream
tags: [ Data ]
operationId: downloadNetwork
parameters:
- in: path
name: cid
@ -701,36 +502,10 @@ paths:
"500":
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":
get:
summary: "Gets a summary of the storage space allocation of the node."
tags: [Data]
tags: [ Data ]
operationId: space
responses:
"200":
@ -746,7 +521,7 @@ paths:
"/sales/slots":
get:
summary: "Returns active slots"
tags: [Marketplace]
tags: [ Marketplace ]
operationId: getActiveSlots
responses:
"200":
@ -764,7 +539,7 @@ paths:
"/sales/slots/{slotId}":
get:
summary: "Returns active slot with id {slotId} for the host"
tags: [Marketplace]
tags: [ Marketplace ]
operationId: getActiveSlotById
parameters:
- in: path
@ -793,7 +568,7 @@ paths:
"/sales/availability":
get:
summary: "Returns storage that is for sale"
tags: [Marketplace]
tags: [ Marketplace ]
operationId: getAvailabilities
responses:
"200":
@ -812,12 +587,12 @@ paths:
post:
summary: "Offers storage for sale"
operationId: offerStorage
tags: [Marketplace]
tags: [ Marketplace ]
requestBody:
content:
application/json:
schema:
$ref: "#/components/schemas/SalesAvailability"
$ref: "#/components/schemas/SalesAvailabilityCREATE"
responses:
"201":
description: Created storage availability
@ -828,7 +603,7 @@ paths:
"400":
description: Invalid data input
"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":
description: Error reserving availability
"503":
@ -840,7 +615,7 @@ paths:
The new parameters will be only considered for new requests.
Existing Requests linked to this Availability will continue as is.
operationId: updateOfferedStorage
tags: [Marketplace]
tags: [ Marketplace ]
parameters:
- in: path
name: id
@ -861,7 +636,7 @@ paths:
"404":
description: Availability not found
"422":
description: The provided parameters did not pass validation
description: Not enough node's storage quota available
"500":
description: Error reserving availability
"503":
@ -872,7 +647,7 @@ paths:
summary: "Get availability's reservations"
description: Return's list of Reservations for ongoing Storage Requests that the node hosts.
operationId: getReservations
tags: [Marketplace]
tags: [ Marketplace ]
parameters:
- in: path
name: id
@ -901,7 +676,7 @@ paths:
"/storage/request/{cid}":
post:
summary: "Creates a new Request for storage"
tags: [Marketplace]
tags: [ Marketplace ]
operationId: createStorageRequest
parameters:
- in: path
@ -924,8 +699,6 @@ paths:
type: string
"400":
description: Invalid or missing Request ID
"422":
description: The storage request parameters are not valid
"404":
description: Request ID not found
"503":
@ -934,7 +707,7 @@ paths:
"/storage/purchases":
get:
summary: "Returns list of purchase IDs"
tags: [Marketplace]
tags: [ Marketplace ]
operationId: getPurchases
responses:
"200":
@ -951,7 +724,7 @@ paths:
"/storage/purchases/{id}":
get:
summary: "Returns purchase details"
tags: [Marketplace]
tags: [ Marketplace ]
operationId: getPurchase
parameters:
- in: path
@ -974,16 +747,16 @@ paths:
"503":
description: Persistence is not enabled
"/spr":
"/node/spr":
get:
summary: "Get Node's SPR"
operationId: getSPR
tags: [Node]
tags: [ Node ]
responses:
"200":
description: Node's SPR
content:
text/plain:
plain/text:
schema:
$ref: "#/components/schemas/SPR"
application/json:
@ -992,16 +765,16 @@ paths:
"503":
description: Node SPR not ready, try again later
"/peerid":
"/node/peerid":
get:
summary: "Get Node's PeerID"
operationId: getPeerId
tags: [Node]
tags: [ Node ]
responses:
"200":
description: Node's Peer ID
content:
text/plain:
plain/text:
schema:
$ref: "#/components/schemas/PeerId"
application/json:
@ -1011,7 +784,7 @@ paths:
"/debug/chronicles/loglevel":
post:
summary: "Set log level at run time"
tags: [Debug]
tags: [ Debug ]
operationId: setDebugLogLevel
parameters:
@ -1033,7 +806,7 @@ paths:
get:
summary: "Gets node information"
operationId: getDebugInfo
tags: [Debug]
tags: [ Debug ]
responses:
"200":
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 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_api_client.api_response import ApiResponse
from codex_api_client.rest import RESTResponseType
from codex_client.api_client import ApiClient, RequestSerialized
from codex_client.api_response import ApiResponse
from codex_client.rest import RESTResponseType
class DebugApi:
@ -236,9 +236,7 @@ class DebugApi:
_query_params: List[Tuple[str, str]] = []
_header_params: Dict[str, Optional[str]] = _headers or {}
_form_params: List[Tuple[str, str]] = []
_files: Dict[
str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
] = {}
_files: Dict[str, Union[str, bytes]] = {}
_body_params: Optional[bytes] = None
# process the path parameters
@ -497,9 +495,7 @@ class DebugApi:
_query_params: List[Tuple[str, str]] = []
_header_params: Dict[str, Optional[str]] = _headers or {}
_form_params: List[Tuple[str, str]] = []
_files: Dict[
str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
] = {}
_files: Dict[str, Union[str, bytes]] = {}
_body_params: Optional[bytes] = None
# process the path parameters

View File

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

View File

@ -20,9 +20,9 @@ from pydantic import Field, StrictStr
from typing import List, Optional
from typing_extensions import Annotated
from codex_api_client.api_client import ApiClient, RequestSerialized
from codex_api_client.api_response import ApiResponse
from codex_api_client.rest import RESTResponseType
from codex_client.api_client import ApiClient, RequestSerialized
from codex_client.api_response import ApiResponse
from codex_client.rest import RESTResponseType
class NodeApi:
@ -270,9 +270,7 @@ class NodeApi:
_query_params: List[Tuple[str, str]] = []
_header_params: Dict[str, Optional[str]] = _headers or {}
_form_params: List[Tuple[str, str]] = []
_files: Dict[
str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
] = {}
_files: Dict[str, Union[str, bytes]] = {}
_body_params: Optional[bytes] = None
# process the path parameters
@ -511,9 +509,7 @@ class NodeApi:
_query_params: List[Tuple[str, str]] = []
_header_params: Dict[str, Optional[str]] = _headers or {}
_form_params: List[Tuple[str, str]] = []
_files: Dict[
str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
] = {}
_files: Dict[str, Union[str, bytes]] = {}
_body_params: Optional[bytes] = None
# process the path parameters
@ -527,7 +523,7 @@ class NodeApi:
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'text/plain',
'plain/text',
'application/json'
]
)
@ -539,7 +535,7 @@ class NodeApi:
return self.api_client.param_serialize(
method='GET',
resource_path='/peerid',
resource_path='/node/peerid',
path_params=_path_params,
query_params=_query_params,
header_params=_header_params,
@ -757,9 +753,7 @@ class NodeApi:
_query_params: List[Tuple[str, str]] = []
_header_params: Dict[str, Optional[str]] = _headers or {}
_form_params: List[Tuple[str, str]] = []
_files: Dict[
str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
] = {}
_files: Dict[str, Union[str, bytes]] = {}
_body_params: Optional[bytes] = None
# process the path parameters
@ -773,7 +767,7 @@ class NodeApi:
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'text/plain',
'plain/text',
'application/json'
]
)
@ -785,7 +779,7 @@ class NodeApi:
return self.api_client.param_serialize(
method='GET',
resource_path='/spr',
resource_path='/node/spr',
path_params=_path_params,
query_params=_query_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 pydantic import SecretStr
from codex_api_client.configuration import Configuration
from codex_api_client.api_response import ApiResponse, T as ApiResponseT
import codex_api_client.models
from codex_api_client import rest
from codex_api_client.exceptions import (
from codex_client.configuration import Configuration
from codex_client.api_response import ApiResponse, T as ApiResponseT
import codex_client.models
from codex_client import rest
from codex_client.exceptions import (
ApiValueError,
ApiException,
BadRequestException,
@ -90,7 +90,7 @@ class ApiClient:
self.default_headers[header_name] = header_value
self.cookie = cookie
# 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
def __enter__(self):
@ -404,12 +404,12 @@ class ApiClient:
data = json.loads(response_text)
except ValueError:
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 == "":
data = ""
else:
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
else:
raise ApiException(
@ -449,7 +449,7 @@ class ApiClient:
if klass in self.NATIVE_TYPES_MAPPING:
klass = self.NATIVE_TYPES_MAPPING[klass]
else:
klass = getattr(codex_api_client.models, klass)
klass = getattr(codex_client.models, klass)
if klass in self.PRIMITIVE_TYPES:
return self.__deserialize_primitive(data, klass)
@ -517,7 +517,7 @@ class ApiClient:
if k in collection_formats:
collection_format = collection_formats[k]
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:
if collection_format == 'ssv':
delimiter = ' '
@ -535,10 +535,7 @@ class ApiClient:
return "&".join(["=".join(map(str, item)) for item in new_params])
def files_parameters(
self,
files: Dict[str, Union[str, bytes, List[str], List[bytes], Tuple[str, bytes]]],
):
def files_parameters(self, files: Dict[str, Union[str, bytes]]):
"""Builds form parameters.
:param files: File parameters.
@ -553,12 +550,6 @@ class ApiClient:
elif isinstance(v, bytes):
filename = k
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:
raise ValueError("Unsupported file value")
mimetype = (

View File

@ -13,16 +13,14 @@
import copy
import http.client as httplib
import logging
from logging import FileHandler
import multiprocessing
import sys
from typing import Any, ClassVar, Dict, List, Literal, Optional, TypedDict, Union
from typing_extensions import NotRequired, Self
from typing import Optional
import urllib3
import http.client as httplib
JSON_SCHEMA_VALIDATION_KEYWORDS = {
'multipleOf', 'maximum', 'exclusiveMaximum',
@ -30,106 +28,6 @@ JSON_SCHEMA_VALIDATION_KEYWORDS = {
'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:
"""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
in PEM format.
: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__(
self,
host: Optional[str]=None,
api_key: Optional[Dict[str, str]]=None,
api_key_prefix: Optional[Dict[str, str]]=None,
username: Optional[str]=None,
password: Optional[str]=None,
access_token: Optional[str]=None,
server_index: Optional[int]=None,
server_variables: Optional[ServerVariablesT]=None,
server_operation_index: Optional[Dict[int, int]]=None,
server_operation_variables: Optional[Dict[int, ServerVariablesT]]=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:
def __init__(self, host=None,
api_key=None, api_key_prefix=None,
username=None, password=None,
access_token=None,
server_index=None, server_variables=None,
server_operation_index=None, server_operation_variables=None,
ignore_operation_servers=False,
ssl_ca_cert=None,
retries=None,
*,
debug: Optional[bool] = None
) -> None:
"""Constructor
"""
self._base_path = "http://localhost:8080/api/codex/v1" if host is None else host
@ -231,7 +120,7 @@ class Configuration:
self.logger = {}
"""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_format = '%(asctime)s %(levelname)s %(message)s'
"""Log format
@ -260,10 +149,6 @@ class Configuration:
self.ssl_ca_cert = ssl_ca_cert
"""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
"""client certificate file
"""
@ -313,7 +198,7 @@ class Configuration:
"""date format
"""
def __deepcopy__(self, memo: Dict[int, Any]) -> Self:
def __deepcopy__(self, memo):
cls = self.__class__
result = cls.__new__(cls)
memo[id(self)] = result
@ -327,11 +212,11 @@ class Configuration:
result.debug = self.debug
return result
def __setattr__(self, name: str, value: Any) -> None:
def __setattr__(self, name, value):
object.__setattr__(self, name, value)
@classmethod
def set_default(cls, default: Optional[Self]) -> None:
def set_default(cls, default):
"""Set default instance of configuration.
It stores default configuration, which can be
@ -342,7 +227,7 @@ class Configuration:
cls._default = default
@classmethod
def get_default_copy(cls) -> Self:
def get_default_copy(cls):
"""Deprecated. Please use `get_default` instead.
Deprecated. Please use `get_default` instead.
@ -352,7 +237,7 @@ class Configuration:
return cls.get_default()
@classmethod
def get_default(cls) -> Self:
def get_default(cls):
"""Return the default configuration.
This method returns newly created, based on default constructor,
@ -362,11 +247,11 @@ class Configuration:
:return: The configuration object.
"""
if cls._default is None:
cls._default = cls()
cls._default = Configuration()
return cls._default
@property
def logger_file(self) -> Optional[str]:
def logger_file(self):
"""The logger file.
If the logger_file is None, then add stream handler and remove file
@ -378,7 +263,7 @@ class Configuration:
return self.__logger_file
@logger_file.setter
def logger_file(self, value: Optional[str]) -> None:
def logger_file(self, value):
"""The logger 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)
@property
def debug(self) -> bool:
def debug(self):
"""Debug status
:param value: The debug status, True or False.
@ -406,7 +291,7 @@ class Configuration:
return self.__debug
@debug.setter
def debug(self, value: bool) -> None:
def debug(self, value):
"""Debug status
:param value: The debug status, True or False.
@ -428,7 +313,7 @@ class Configuration:
httplib.HTTPConnection.debuglevel = 0
@property
def logger_format(self) -> str:
def logger_format(self):
"""The logger format.
The logger_formatter will be updated when sets logger_format.
@ -439,7 +324,7 @@ class Configuration:
return self.__logger_format
@logger_format.setter
def logger_format(self, value: str) -> None:
def logger_format(self, value):
"""The logger format.
The logger_formatter will be updated when sets logger_format.
@ -450,7 +335,7 @@ class Configuration:
self.__logger_format = value
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).
:param identifier: The identifier of apiKey.
@ -467,9 +352,7 @@ class Configuration:
else:
return key
return None
def get_basic_auth_token(self) -> Optional[str]:
def get_basic_auth_token(self):
"""Gets HTTP basic authentication header (string).
:return: The token for basic HTTP authentication.
@ -484,15 +367,15 @@ class Configuration:
basic_auth=username + ':' + password
).get('authorization')
def auth_settings(self)-> AuthSettings:
def auth_settings(self):
"""Gets Auth Settings dict for api client.
:return: The Auth Settings information dict.
"""
auth: AuthSettings = {}
auth = {}
return auth
def to_debug_report(self) -> str:
def to_debug_report(self):
"""Gets the essential information for debugging.
:return: The report for debugging.
@ -501,10 +384,10 @@ class Configuration:
"OS: {env}\n"\
"Python Version: {pyversion}\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)
def get_host_settings(self) -> List[HostSetting]:
def get_host_settings(self):
"""Gets an array of host settings
:return: An array of host settings
@ -516,12 +399,7 @@ class Configuration:
}
]
def get_host_from_settings(
self,
index: Optional[int],
variables: Optional[ServerVariablesT]=None,
servers: Optional[List[HostSetting]]=None,
) -> str:
def get_host_from_settings(self, index, variables=None, servers=None):
"""Gets host URL based on the index and variables
:param index: array index of the host settings
:param variables: hash of variable and the corresponding value
@ -561,12 +439,12 @@ class Configuration:
return url
@property
def host(self) -> str:
def host(self):
"""Return generated host."""
return self.get_host_from_settings(self.server_index, variables=self.server_variables)
@host.setter
def host(self, value: str) -> None:
def host(self, value):
"""Fix base path."""
self._base_path = value
self.server_index = None

View File

@ -150,13 +150,6 @@ class ApiException(OpenApiException):
if http_resp.status == 404:
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:
raise ServiceException(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
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):
"""Returns a string representation of a path"""
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 json
from pydantic import BaseModel, ConfigDict, Field
from typing import Any, ClassVar, Dict, List
from codex_api_client.models.node import Node
from pydantic import BaseModel, ConfigDict, Field, StrictStr
from typing import Any, ClassVar, Dict, List, Optional
from codex_client.models.erasure_parameters import ErasureParameters
from codex_client.models.po_r_parameters import PoRParameters
from typing import Optional, Set
from typing_extensions import Self
class PeersTable(BaseModel):
class Content(BaseModel):
"""
PeersTable
Parameters specifying the content
""" # noqa: E501
local_node: Node = Field(alias="localNode")
nodes: List[Node]
__properties: ClassVar[List[str]] = ["localNode", "nodes"]
cid: Optional[StrictStr] = Field(default=None, description="Content Identifier as specified at https://github.com/multiformats/cid")
erasure: Optional[ErasureParameters] = None
por: Optional[PoRParameters] = None
__properties: ClassVar[List[str]] = ["cid", "erasure", "por"]
model_config = ConfigDict(
populate_by_name=True,
@ -49,7 +51,7 @@ class PeersTable(BaseModel):
@classmethod
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))
def to_dict(self) -> Dict[str, Any]:
@ -70,21 +72,17 @@ class PeersTable(BaseModel):
exclude=excluded_fields,
exclude_none=True,
)
# override the default output from pydantic by calling `to_dict()` of local_node
if self.local_node:
_dict['localNode'] = self.local_node.to_dict()
# override the default output from pydantic by calling `to_dict()` of each item in nodes (list)
_items = []
if self.nodes:
for _item_nodes in self.nodes:
if _item_nodes:
_items.append(_item_nodes.to_dict())
_dict['nodes'] = _items
# override the default output from pydantic by calling `to_dict()` of erasure
if self.erasure:
_dict['erasure'] = self.erasure.to_dict()
# override the default output from pydantic by calling `to_dict()` of por
if self.por:
_dict['por'] = self.por.to_dict()
return _dict
@classmethod
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:
return None
@ -92,8 +90,9 @@ class PeersTable(BaseModel):
return cls.model_validate(obj)
_obj = cls.model_validate({
"localNode": Node.from_dict(obj["localNode"]) if obj.get("localNode") is not None else None,
"nodes": [Node.from_dict(_item) for _item in obj["nodes"]] if obj.get("nodes") is not None else None
"cid": obj.get("cid"),
"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

View File

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

View File

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

View File

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

View File

@ -17,17 +17,17 @@ import pprint
import re # noqa: F401
import json
from pydantic import BaseModel, ConfigDict, Field, StrictStr
from typing import Any, ClassVar, Dict, List
from pydantic import BaseModel, ConfigDict, Field, StrictInt
from typing import Any, ClassVar, Dict, List, Optional
from typing import Optional, Set
from typing_extensions import Self
class Content(BaseModel):
class ErasureParameters(BaseModel):
"""
Parameters specifying the content
ErasureParameters
""" # noqa: E501
cid: StrictStr = Field(description="Content Identifier as specified at https://github.com/multiformats/cid")
__properties: ClassVar[List[str]] = ["cid"]
total_chunks: Optional[StrictInt] = Field(default=None, alias="totalChunks")
__properties: ClassVar[List[str]] = ["totalChunks"]
model_config = ConfigDict(
populate_by_name=True,
@ -47,7 +47,7 @@ class Content(BaseModel):
@classmethod
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))
def to_dict(self) -> Dict[str, Any]:
@ -72,7 +72,7 @@ class Content(BaseModel):
@classmethod
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:
return None
@ -80,7 +80,7 @@ class Content(BaseModel):
return cls.model_validate(obj)
_obj = cls.model_validate({
"cid": obj.get("cid")
"totalChunks": obj.get("totalChunks")
})
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 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 Optional, Set
from typing_extensions import Self
class CodexVersion(BaseModel):
class PoRParameters(BaseModel):
"""
CodexVersion
Parameters for Proof of Retrievability
""" # noqa: E501
version: Optional[StrictStr] = None
revision: Optional[StrictStr] = None
contracts: Optional[StrictStr] = None
__properties: ClassVar[List[str]] = ["version", "revision", "contracts"]
u: Optional[StrictStr] = None
public_key: Optional[StrictStr] = Field(default=None, alias="publicKey")
name: Optional[StrictStr] = None
__properties: ClassVar[List[str]] = ["u", "publicKey", "name"]
model_config = ConfigDict(
populate_by_name=True,
@ -49,7 +49,7 @@ class CodexVersion(BaseModel):
@classmethod
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))
def to_dict(self) -> Dict[str, Any]:
@ -74,7 +74,7 @@ class CodexVersion(BaseModel):
@classmethod
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:
return None
@ -82,9 +82,9 @@ class CodexVersion(BaseModel):
return cls.model_validate(obj)
_obj = cls.model_validate({
"version": obj.get("version"),
"revision": obj.get("revision"),
"contracts": obj.get("contracts")
"u": obj.get("u"),
"publicKey": obj.get("publicKey"),
"name": obj.get("name")
})
return _obj

View File

@ -19,8 +19,7 @@ import json
from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
from typing import Any, ClassVar, Dict, List, Optional
from typing_extensions import Annotated
from codex_api_client.models.storage_request import StorageRequest
from codex_client.models.storage_request import StorageRequest
from typing import Optional, Set
from typing_extensions import Self
@ -28,17 +27,19 @@ class Purchase(BaseModel):
"""
Purchase
""" # 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")
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", "requestId"]
__properties: ClassVar[List[str]] = ["state", "error", "request"]
@field_validator('state')
def state_validate_enum(cls, value):
"""Validates the enum"""
if value not in set(['cancelled', 'errored', 'failed', 'finished', 'pending', 'started', 'submitted', 'unknown']):
raise ValueError("must be one of enum values ('cancelled', 'errored', 'failed', 'finished', 'pending', 'started', 'submitted', 'unknown')")
if value is None:
return value
if value not in set(['cancelled', 'error', 'failed', 'finished', 'pending', 'started', 'submitted', 'unknown']):
raise ValueError("must be one of enum values ('cancelled', 'error', 'failed', 'finished', 'pending', 'started', 'submitted', 'unknown')")
return value
model_config = ConfigDict(
@ -83,11 +84,6 @@ class Purchase(BaseModel):
# override the default output from pydantic by calling `to_dict()` of request
if self.request:
_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
@classmethod
@ -102,8 +98,7 @@ class Purchase(BaseModel):
_obj = cls.model_validate({
"state": obj.get("state"),
"error": obj.get("error"),
"request": StorageRequest.from_dict(obj["request"]) if obj.get("request") is not None else None,
"requestId": obj.get("requestId")
"request": StorageRequest.from_dict(obj["request"]) if obj.get("request") is not None else None
})
return _obj

View File

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

View File

@ -17,8 +17,9 @@ import pprint
import re # noqa: F401
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_extensions import Annotated
from typing import Optional, Set
from typing_extensions import Self
@ -26,13 +27,12 @@ class SalesAvailability(BaseModel):
"""
SalesAvailability
""" # 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.")
__properties: ClassVar[List[str]] = ["totalSize", "duration", "minPricePerBytePerSecond", "totalCollateral", "enabled", "until"]
id: Optional[Annotated[str, Field(min_length=66, strict=True, max_length=66)]] = Field(default=None, description="32bits identifier encoded in hex-decimal string.")
total_size: Optional[StrictStr] = Field(default=None, description="Total size of availability's storage in bytes as decimal string", alias="totalSize")
duration: Optional[StrictStr] = Field(default=None, description="The duration of the request in seconds as decimal string")
min_price: Optional[StrictStr] = Field(default=None, description="Minimum price to be paid (in amount of tokens) as decimal string", alias="minPrice")
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")
__properties: ClassVar[List[str]] = ["id", "totalSize", "duration", "minPrice", "maxCollateral"]
model_config = ConfigDict(
populate_by_name=True,
@ -85,12 +85,11 @@ class SalesAvailability(BaseModel):
return cls.model_validate(obj)
_obj = cls.model_validate({
"id": obj.get("id"),
"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
"minPrice": obj.get("minPrice"),
"maxCollateral": obj.get("maxCollateral")
})
return _obj

View File

@ -17,7 +17,7 @@ import pprint
import re # noqa: F401
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_extensions import Annotated
from typing import Optional, Set
@ -28,11 +28,11 @@ class SalesAvailabilityCREATE(BaseModel):
SalesAvailabilityCREATE
""" # 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.")
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")
__properties: ClassVar[List[str]] = ["id", "totalSize", "duration", "minPricePerBytePerSecond", "totalCollateral"]
total_size: StrictStr = Field(description="Total size of availability's storage in bytes as decimal string", alias="totalSize")
duration: StrictStr = Field(description="The duration of the request in seconds as decimal string")
min_price: StrictStr = Field(description="Minimum price to be paid (in amount of tokens) as decimal string", alias="minPrice")
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", "minPrice", "maxCollateral"]
model_config = ConfigDict(
populate_by_name=True,
@ -88,8 +88,8 @@ class SalesAvailabilityCREATE(BaseModel):
"id": obj.get("id"),
"totalSize": obj.get("totalSize"),
"duration": obj.get("duration"),
"minPricePerBytePerSecond": obj.get("minPricePerBytePerSecond"),
"totalCollateral": obj.get("totalCollateral")
"minPrice": obj.get("minPrice"),
"maxCollateral": obj.get("maxCollateral")
})
return _obj

View File

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

View File

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

View File

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

View File

@ -18,7 +18,7 @@ import re # noqa: F401
import json
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_extensions import Self
@ -26,10 +26,10 @@ class Space(BaseModel):
"""
Space
""" # noqa: E501
total_blocks: StrictInt = Field(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_used_bytes: StrictInt = Field(description="Amount of storage space (in bytes) currently used for storing files in Codex's local repository.", 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")
total_blocks: Optional[StrictInt] = Field(default=None, description="Number of blocks stored by the node", alias="totalBlocks")
quota_max_bytes: Optional[StrictInt] = Field(default=None, description="Maximum storage space used by the node", alias="quotaMaxBytes")
quota_used_bytes: Optional[StrictInt] = Field(default=None, description="Amount of storage space currently in use", alias="quotaUsedBytes")
quota_reserved_bytes: Optional[StrictInt] = Field(default=None, description="Amount of storage space reserved", alias="quotaReservedBytes")
__properties: ClassVar[List[str]] = ["totalBlocks", "quotaMaxBytes", "quotaUsedBytes", "quotaReservedBytes"]
model_config = ConfigDict(

View File

@ -18,7 +18,7 @@ import re # noqa: F401
import json
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_extensions import Self
@ -26,7 +26,7 @@ class SPRRead(BaseModel):
"""
SPRRead
""" # 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"]
model_config = ConfigDict(

View File

@ -18,7 +18,7 @@ import re # noqa: F401
import json
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_extensions import Self
@ -26,14 +26,13 @@ class StorageAsk(BaseModel):
"""
StorageAsk
""" # noqa: E501
slots: StrictInt = Field(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")
duration: StrictInt = Field(description="The duration of the request in seconds")
proof_probability: StrictStr = Field(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")
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: 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", "pricePerBytePerSecond", "collateralPerByte", "maxSlotLoss"]
slots: Optional[StrictInt] = Field(default=None, description="Number of slots (eq. hosts) that the Request want to have the content spread over")
slot_size: Optional[StrictStr] = Field(default=None, description="Amount of storage per slot (in bytes) as decimal string", alias="slotSize")
duration: Optional[StrictStr] = Field(default=None, description="The duration of the request in seconds as decimal string")
proof_probability: Optional[StrictStr] = Field(default=None, description="How often storage proofs are required as decimal string", alias="proofProbability")
reward: StrictStr = Field(description="The maximum amount of tokens paid per second per slot to hosts the client is willing to pay")
max_slot_loss: Optional[StrictInt] = Field(default=None, 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"]
model_config = ConfigDict(
populate_by_name=True,
@ -90,8 +89,7 @@ class StorageAsk(BaseModel):
"slotSize": obj.get("slotSize"),
"duration": obj.get("duration"),
"proofProbability": obj.get("proofProbability"),
"pricePerBytePerSecond": obj.get("pricePerBytePerSecond"),
"collateralPerByte": obj.get("collateralPerByte"),
"reward": obj.get("reward"),
"maxSlotLoss": obj.get("maxSlotLoss")
})
return _obj

View File

@ -17,10 +17,10 @@ import pprint
import re # noqa: F401
import json
from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr
from typing import Any, ClassVar, Dict, List
from codex_api_client.models.content import Content
from codex_api_client.models.storage_ask import StorageAsk
from pydantic import BaseModel, ConfigDict, Field, StrictStr
from typing import Any, ClassVar, Dict, List, Optional
from codex_client.models.content import Content
from codex_client.models.storage_ask import StorageAsk
from typing import Optional, Set
from typing_extensions import Self
@ -28,12 +28,12 @@ class StorageRequest(BaseModel):
"""
StorageRequest
""" # noqa: E501
id: StrictStr = Field(description="Request ID")
client: StrictStr = Field(description="Address of Ethereum address")
ask: StorageAsk
content: Content
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.")
nonce: StrictStr = Field(description="Random data")
id: Optional[StrictStr] = Field(default=None, description="Request ID")
client: Optional[StrictStr] = Field(default=None, description="Address of Ethereum address")
ask: Optional[StorageAsk] = None
content: Optional[Content] = None
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: Optional[StrictStr] = Field(default=None, description="Random data")
__properties: ClassVar[List[str]] = ["id", "client", "ask", "content", "expiry", "nonce"]
model_config = ConfigDict(
@ -97,7 +97,7 @@ class StorageRequest(BaseModel):
"client": obj.get("client"),
"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,
"expiry": obj.get("expiry"),
"expiry": obj.get("expiry") if obj.get("expiry") is not None else '10 minutes',
"nonce": obj.get("nonce")
})
return _obj

View File

@ -19,7 +19,6 @@ import json
from pydantic import BaseModel, ConfigDict, Field, 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
@ -27,14 +26,14 @@ class StorageRequestCreation(BaseModel):
"""
StorageRequestCreation
""" # noqa: E501
duration: StrictInt = Field(description="The duration of the request in seconds")
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")
duration: StrictStr = Field(description="The duration of the request in seconds as decimal string")
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")
nodes: Optional[Annotated[int, Field(strict=True, ge=3)]] = Field(default=3, 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")
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")
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.")
__properties: ClassVar[List[str]] = ["duration", "pricePerBytePerSecond", "proofProbability", "nodes", "tolerance", "collateralPerByte", "expiry"]
nodes: Optional[StrictInt] = Field(default=1, description="Minimal number of nodes the content should be stored on")
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: StrictStr = Field(description="Number as decimal string that represents how much collateral is asked from hosts that wants to fill a slots")
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", "reward", "proofProbability", "nodes", "tolerance", "collateral", "expiry"]
model_config = ConfigDict(
populate_by_name=True,
@ -88,11 +87,11 @@ class StorageRequestCreation(BaseModel):
_obj = cls.model_validate({
"duration": obj.get("duration"),
"pricePerBytePerSecond": obj.get("pricePerBytePerSecond"),
"reward": obj.get("reward"),
"proofProbability": obj.get("proofProbability"),
"nodes": obj.get("nodes") if obj.get("nodes") is not None else 3,
"tolerance": obj.get("tolerance") if obj.get("tolerance") is not None else 1,
"collateralPerByte": obj.get("collateralPerByte"),
"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 0,
"collateral": obj.get("collateral"),
"expiry": obj.get("expiry")
})
return _obj

View File

@ -19,7 +19,7 @@ import ssl
import urllib3
from codex_api_client.exceptions import ApiException, ApiValueError
from codex_client.exceptions import ApiException, ApiValueError
SUPPORTED_SOCKS_PROXIES = {"socks5", "socks5h", "socks4", "socks4a"}
RESTResponseType = urllib3.HTTPResponse
@ -76,7 +76,6 @@ class RESTClientObject:
"ca_certs": configuration.ssl_ca_cert,
"cert_file": configuration.cert_file,
"key_file": configuration.key_file,
"ca_cert_data": configuration.ca_cert_data,
}
if configuration.assert_hostname is not None:
pool_args['assert_hostname'] = (
@ -226,7 +225,7 @@ class RESTClientObject:
headers=headers,
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"
r = self.pool_manager.request(
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
------------ | ------------- | ------------- | -------------
**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
```python
from codex_api_client.models.content import Content
from codex_client.models.content import Content
# TODO update the JSON string below
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*
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_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_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.
[**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.
[**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.
[**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**
> 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
import codex_api_client
from codex_api_client.rest import ApiException
import codex_client
from codex_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(
configuration = codex_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:
with codex_client.ApiClient(configuration) as api_client:
# 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.
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)
# **download_network**
> DataItem 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)
> bytearray download_network(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.
@ -294,30 +88,30 @@ Download a file from the network in a streaming manner. If the file is not avail
```python
import codex_api_client
from codex_api_client.rest import ApiException
import codex_client
from codex_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(
configuration = codex_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:
with codex_client.ApiClient(configuration) as api_client:
# 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.
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.
api_response = api_instance.download_network_stream(cid)
print("The response of DataApi->download_network_stream:\n")
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_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
import codex_api_client
from codex_api_client.models.data_list import DataList
from codex_api_client.rest import ApiException
import codex_client
from codex_client.models.data_list import DataList
from codex_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(
configuration = codex_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:
with codex_client.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = codex_api_client.DataApi(api_client)
api_instance = codex_client.DataApi(api_client)
try:
# Lists manifest CIDs stored locally in node.
@ -414,7 +208,6 @@ No authorization required
**200** | Retrieved list of content CIDs | - |
**400** | Invalid CID is specified | - |
**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 | - |
[[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
import codex_api_client
from codex_api_client.models.space import Space
from codex_api_client.rest import ApiException
import codex_client
from codex_client.models.space import Space
from codex_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(
configuration = codex_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:
with codex_client.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = codex_api_client.DataApi(api_client)
api_instance = codex_client.DataApi(api_client)
try:
# 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)
# **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.
@ -491,28 +284,26 @@ Upload a file in a streaming manner. Once finished, the file is stored in the no
```python
import codex_api_client
from codex_api_client.rest import ApiException
import codex_client
from codex_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(
configuration = codex_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:
with codex_client.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = codex_api_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)
api_instance = codex_client.DataApi(api_client)
body = None # bytearray | (optional)
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.
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")
pprint(api_response)
except Exception as e:
@ -526,8 +317,6 @@ with codex_api_client.ApiClient(configuration) as api_client:
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]
### Return type
@ -548,7 +337,6 @@ No authorization required
| Status code | Description | Response headers |
|-------------|-------------|------------------|
**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 | - |
[[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
------------ | ------------- | ------------- | -------------
**cid** | **str** | Content Identifier as specified at https://github.com/multiformats/cid |
**manifest** | [**ManifestItem**](ManifestItem.md) | |
**cid** | **str** | Content Identifier as specified at https://github.com/multiformats/cid | [optional]
**manifest** | [**ManifestItem**](ManifestItem.md) | | [optional]
## Example
```python
from codex_api_client.models.data_item import DataItem
from codex_client.models.data_item import DataItem
# TODO update the JSON string below
json = "{}"

View File

@ -5,12 +5,12 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**content** | [**List[DataItem]**](DataItem.md) | |
**content** | [**List[DataItem]**](DataItem.md) | | [optional]
## Example
```python
from codex_api_client.models.data_list import DataList
from codex_client.models.data_list import DataList
# TODO update the JSON string below
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*
@ -17,22 +17,22 @@ Gets node information
```python
import codex_api_client
from codex_api_client.models.debug_info import DebugInfo
from codex_api_client.rest import ApiException
import codex_client
from codex_client.models.debug_info import DebugInfo
from codex_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(
configuration = codex_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:
with codex_client.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = codex_api_client.DebugApi(api_client)
api_instance = codex_client.DebugApi(api_client)
try:
# Gets node information
@ -79,21 +79,21 @@ Set log level at run time
```python
import codex_api_client
from codex_api_client.rest import ApiException
import codex_client
from codex_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(
configuration = codex_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:
with codex_client.ApiClient(configuration) as api_client:
# 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 |
try:

View File

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

View File

@ -5,17 +5,15 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**tree_cid** | **str** | Content Identifier as specified at https://github.com/multiformats/cid |
**dataset_size** | **int** | Length of original content in bytes |
**block_size** | **int** | Size of blocks |
**protected** | **bool** | Indicates if content is protected by erasure-coding |
**filename** | **str** | The original name of the uploaded content (optional) | [optional]
**mimetype** | **str** | The original mimetype of the uploaded content (optional) | [optional]
**root_hash** | **str** | Content Identifier as specified at https://github.com/multiformats/cid | [optional]
**original_bytes** | **int** | Length of original content in bytes | [optional]
**block_size** | **int** | Size of blocks | [optional]
**protected** | **bool** | Indicates if content is protected by erasure-coding | [optional]
## Example
```python
from codex_api_client.models.manifest_item import ManifestItem
from codex_client.models.manifest_item import ManifestItem
# TODO update the JSON string below
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*
@ -24,24 +24,24 @@ Creates a new Request for storage
```python
import codex_api_client
from codex_api_client.models.storage_request_creation import StorageRequestCreation
from codex_api_client.rest import ApiException
import codex_client
from codex_client.models.storage_request_creation import StorageRequestCreation
from codex_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(
configuration = codex_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:
with codex_client.ApiClient(configuration) as api_client:
# 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
storage_request_creation = codex_api_client.StorageRequestCreation() # StorageRequestCreation | (optional)
storage_request_creation = codex_client.StorageRequestCreation() # StorageRequestCreation | (optional)
try:
# Creates a new Request for storage
@ -81,7 +81,6 @@ No authorization required
|-------------|-------------|------------------|
**200** | Returns the Request ID as decimal string | - |
**400** | Invalid or missing Request ID | - |
**422** | The storage request parameters are not valid | - |
**404** | Request ID not found | - |
**503** | Persistence is not enabled | - |
@ -96,22 +95,22 @@ Returns active slot with id {slotId} for the host
```python
import codex_api_client
from codex_api_client.models.slot_agent import SlotAgent
from codex_api_client.rest import ApiException
import codex_client
from codex_client.models.slot_agent import SlotAgent
from codex_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(
configuration = codex_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:
with codex_client.ApiClient(configuration) as api_client:
# 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.
try:
@ -165,22 +164,22 @@ Returns active slots
```python
import codex_api_client
from codex_api_client.models.slot import Slot
from codex_api_client.rest import ApiException
import codex_client
from codex_client.models.slot import Slot
from codex_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(
configuration = codex_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:
with codex_client.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = codex_api_client.MarketplaceApi(api_client)
api_instance = codex_client.MarketplaceApi(api_client)
try:
# Returns active slots
@ -228,22 +227,22 @@ Returns storage that is for sale
```python
import codex_api_client
from codex_api_client.models.sales_availability_read import SalesAvailabilityREAD
from codex_api_client.rest import ApiException
import codex_client
from codex_client.models.sales_availability_read import SalesAvailabilityREAD
from codex_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(
configuration = codex_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:
with codex_client.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = codex_api_client.MarketplaceApi(api_client)
api_instance = codex_client.MarketplaceApi(api_client)
try:
# Returns storage that is for sale
@ -292,22 +291,22 @@ Returns purchase details
```python
import codex_api_client
from codex_api_client.models.purchase import Purchase
from codex_api_client.rest import ApiException
import codex_client
from codex_client.models.purchase import Purchase
from codex_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(
configuration = codex_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:
with codex_client.ApiClient(configuration) as api_client:
# 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
try:
@ -361,21 +360,21 @@ Returns list of purchase IDs
```python
import codex_api_client
from codex_api_client.rest import ApiException
import codex_client
from codex_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(
configuration = codex_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:
with codex_client.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = codex_api_client.MarketplaceApi(api_client)
api_instance = codex_client.MarketplaceApi(api_client)
try:
# Returns list of purchase IDs
@ -425,22 +424,22 @@ Return's list of Reservations for ongoing Storage Requests that the node hosts.
```python
import codex_api_client
from codex_api_client.models.reservation import Reservation
from codex_api_client.rest import ApiException
import codex_client
from codex_client.models.reservation import Reservation
from codex_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(
configuration = codex_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:
with codex_client.ApiClient(configuration) as api_client:
# 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
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)
# **offer_storage**
> SalesAvailabilityREAD offer_storage(sales_availability=sales_availability)
> SalesAvailabilityREAD offer_storage(sales_availability_create=sales_availability_create)
Offers storage for sale
@ -495,28 +494,28 @@ Offers storage for sale
```python
import codex_api_client
from codex_api_client.models.sales_availability import SalesAvailability
from codex_api_client.models.sales_availability_read import SalesAvailabilityREAD
from codex_api_client.rest import ApiException
import codex_client
from codex_client.models.sales_availability_create import SalesAvailabilityCREATE
from codex_client.models.sales_availability_read import SalesAvailabilityREAD
from codex_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(
configuration = codex_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:
with codex_client.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = codex_api_client.MarketplaceApi(api_client)
sales_availability = codex_api_client.SalesAvailability() # SalesAvailability | (optional)
api_instance = codex_client.MarketplaceApi(api_client)
sales_availability_create = codex_client.SalesAvailabilityCREATE() # SalesAvailabilityCREATE | (optional)
try:
# 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")
pprint(api_response)
except Exception as e:
@ -530,7 +529,7 @@ with codex_api_client.ApiClient(configuration) as api_client:
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**sales_availability** | [**SalesAvailability**](SalesAvailability.md)| | [optional]
**sales_availability_create** | [**SalesAvailabilityCREATE**](SalesAvailabilityCREATE.md)| | [optional]
### Return type
@ -551,7 +550,7 @@ No authorization required
|-------------|-------------|------------------|
**201** | Created storage availability | - |
**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 | - |
**503** | Persistence is not enabled | - |
@ -562,32 +561,30 @@ No authorization required
Updates availability
The new parameters will be only considered for new requests.
Existing Requests linked to this Availability will continue as is.
The new parameters will be only considered for new requests. Existing Requests linked to this Availability will continue as is.
### Example
```python
import codex_api_client
from codex_api_client.models.sales_availability import SalesAvailability
from codex_api_client.rest import ApiException
import codex_client
from codex_client.models.sales_availability import SalesAvailability
from codex_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(
configuration = codex_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:
with codex_client.ApiClient(configuration) as api_client:
# 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
sales_availability = codex_api_client.SalesAvailability() # SalesAvailability | (optional)
sales_availability = codex_client.SalesAvailability() # SalesAvailability | (optional)
try:
# Updates availability
@ -626,7 +623,7 @@ No authorization required
**204** | Availability successfully updated | - |
**400** | Invalid data input | - |
**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 | - |
**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*
Method | HTTP request | Description
------------- | ------------- | -------------
[**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_spr**](NodeApi.md#get_spr) | **GET** /spr | Get Node&#39;s SPR
[**get_peer_id**](NodeApi.md#get_peer_id) | **GET** /node/peerid | Get Node&#39;s PeerID
[**get_spr**](NodeApi.md#get_spr) | **GET** /node/spr | Get Node&#39;s SPR
# **connect_peer**
@ -14,29 +14,27 @@ Method | HTTP request | Description
Connect to a peer
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.
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.
### Example
```python
import codex_api_client
from codex_api_client.rest import ApiException
import codex_client
from codex_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(
configuration = codex_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:
with codex_client.ApiClient(configuration) as api_client:
# 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.
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
import codex_api_client
from codex_api_client.rest import ApiException
import codex_client
from codex_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(
configuration = codex_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:
with codex_client.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = codex_api_client.NodeApi(api_client)
api_instance = codex_client.NodeApi(api_client)
try:
# Get Node's PeerID
@ -130,7 +128,7 @@ No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: text/plain, application/json
- **Accept**: plain/text, application/json
### HTTP response details
@ -149,21 +147,21 @@ Get Node's SPR
```python
import codex_api_client
from codex_api_client.rest import ApiException
import codex_client
from codex_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(
configuration = codex_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:
with codex_client.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = codex_api_client.NodeApi(api_client)
api_instance = codex_client.NodeApi(api_client)
try:
# Get Node's SPR
@ -191,7 +189,7 @@ No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: text/plain, application/json
- **Accept**: plain/text, application/json
### HTTP response details

View File

@ -10,7 +10,7 @@ Name | Type | Description | Notes
## Example
```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
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
------------ | ------------- | ------------- | -------------
**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]
**request** | [**StorageRequest**](StorageRequest.md) | | [optional]
**request_id** | **str** | 32bits identifier encoded in hex-decimal string. |
## Example
```python
from codex_api_client.models.purchase import Purchase
from codex_client.models.purchase import Purchase
# TODO update the JSON string below
json = "{}"

View File

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

View File

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

View File

@ -5,17 +5,16 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**total_size** | **int** | Total size of availability&#39;s storage in bytes |
**duration** | **int** | The duration of the request in seconds |
**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 |
**total_collateral** | **str** | Total collateral (in amount of tokens) that can be used for matching requests |
**enabled** | **bool** | Enable the ability to receive sales on this availability. | [optional] [default to True]
**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]
**id** | **str** | 32bits identifier encoded in hex-decimal string. | [optional]
**total_size** | **str** | Total size of availability&#39;s storage in bytes as decimal string | [optional]
**duration** | **str** | The duration of the request in seconds as decimal string | [optional]
**min_price** | **str** | Minimum price to be paid (in amount of tokens) as decimal string | [optional]
**max_collateral** | **str** | Maximum collateral user is willing to pay per filled Slot (in amount of tokens) as decimal string | [optional]
## Example
```python
from codex_api_client.models.sales_availability import SalesAvailability
from codex_client.models.sales_availability import SalesAvailability
# TODO update the JSON string below
json = "{}"

View File

@ -6,15 +6,15 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**id** | **str** | 32bits identifier encoded in hex-decimal string. | [optional]
**total_size** | **int** | Total size of availability&#39;s storage in bytes |
**duration** | **int** | The duration of the request in seconds |
**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 |
**total_collateral** | **str** | Total collateral (in amount of tokens) that can be used for matching requests |
**total_size** | **str** | Total size of availability&#39;s storage in bytes as decimal string |
**duration** | **str** | The duration of the request in seconds as decimal string |
**min_price** | **str** | Minimum price to be paid (in amount of tokens) as decimal string |
**max_collateral** | **str** | Maximum collateral user is willing to pay per filled Slot (in amount of tokens) as decimal string |
## Example
```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
json = "{}"

View File

@ -5,20 +5,17 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**total_size** | **int** | Total size of availability&#39;s storage in bytes |
**duration** | **int** | The duration of the request in seconds |
**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 |
**total_collateral** | **str** | Total collateral (in amount of tokens) that can be used for matching requests |
**enabled** | **bool** | Enable the ability to receive sales on this availability. | [optional] [default to True]
**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]
**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]
**id** | **str** | 32bits identifier encoded in hex-decimal string. | [optional]
**total_size** | **str** | Total size of availability&#39;s storage in bytes as decimal string | [optional]
**duration** | **str** | The duration of the request in seconds as decimal string | [optional]
**min_price** | **str** | Minimum price to be paid (in amount of tokens) as decimal string | [optional]
**max_collateral** | **str** | Maximum collateral user is willing to pay per filled Slot (in amount of tokens) as decimal string | [optional]
**free_size** | **str** | Unused size of availability&#39;s storage in bytes as decimal string | [optional]
## Example
```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
json = "{}"

View File

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

View File

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

View File

@ -5,15 +5,15 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**total_blocks** | **int** | Number of blocks stored by the node |
**quota_max_bytes** | **int** | Maximum storage space (in bytes) available for the node in Codex&#39;s local repository. |
**quota_used_bytes** | **int** | Amount of storage space (in bytes) currently used for storing files in Codex&#39;s local repository. |
**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. |
**total_blocks** | **int** | Number of blocks stored by the node | [optional]
**quota_max_bytes** | **int** | Maximum storage space used by the node | [optional]
**quota_used_bytes** | **int** | Amount of storage space currently in use | [optional]
**quota_reserved_bytes** | **int** | Amount of storage space reserved | [optional]
## Example
```python
from codex_api_client.models.space import Space
from codex_client.models.space import Space
# TODO update the JSON string below
json = "{}"

View File

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

View File

@ -5,17 +5,17 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**id** | **str** | Request ID |
**client** | **str** | Address of Ethereum address |
**ask** | [**StorageAsk**](StorageAsk.md) | |
**content** | [**Content**](Content.md) | |
**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. |
**nonce** | **str** | Random data |
**id** | **str** | Request ID | [optional]
**client** | **str** | Address of Ethereum address | [optional]
**ask** | [**StorageAsk**](StorageAsk.md) | | [optional]
**content** | [**Content**](Content.md) | | [optional]
**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 | [optional]
## Example
```python
from codex_api_client.models.storage_request import StorageRequest
from codex_client.models.storage_request import StorageRequest
# TODO update the JSON string below
json = "{}"

View File

@ -5,18 +5,18 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**duration** | **int** | The duration of the request in seconds |
**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 |
**duration** | **str** | The duration of the request in seconds as decimal string |
**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 |
**nodes** | **int** | Minimal number of nodes the content should be stored on | [optional] [default to 3]
**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]
**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 |
**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. |
**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 0]
**collateral** | **str** | Number as decimal string that represents how much collateral is asked from hosts that wants to fill a slots |
**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
```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
json = "{}"

View File

@ -1,15 +1,8 @@
#!/bin/sh
if [ -z "$1" ]; then
echo "No version supplied"
exit 1
fi
openapi-generator-cli generate \
-t .openapi-generator/templates \
-g python \
-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" \
--git-repo-id py-codex-api-client --git-user-id codex-storage \
--http-user-agent py_codex_api_client
--additional-properties="packageName=codex_client,projectName=Codex\ API\ Client,packageUrl=https://github.com/AuHau/py-codex-api" \
--git-repo-id py-codex-api --git-user-id auhau \
--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",
"spaces": 2,
"generator-cli": {
"version": "7.12.0"
"version": "7.8.0"
}
}

View File

@ -1,29 +1,28 @@
[tool.poetry]
name = "codex_api_client"
version = "0.4.0"
name = "codex_client"
version = "1.0.0"
description = "Codex API"
authors = ["OpenAPI Generator Community <team@openapitools.org>"]
license = "NoLicense"
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"]
include = ["codex_api_client/py.typed"]
include = ["codex_client/py.typed"]
[tool.poetry.dependencies]
python = "^3.8"
python = "^3.7"
urllib3 = ">= 1.25.3, < 3.0.0"
python-dateutil = ">= 2.8.2"
pydantic = ">= 2"
typing-extensions = ">= 4.7.1"
urllib3 = ">= 1.25.3"
python-dateutil = ">=2.8.2"
pydantic = ">=2"
typing-extensions = ">=4.7.1"
[tool.poetry.dev-dependencies]
pytest = ">= 7.2.1"
pytest-cov = ">= 2.8.1"
tox = ">= 3.9.0"
flake8 = ">= 4.0.0"
types-python-dateutil = ">= 2.8.19.14"
mypy = ">= 1.5"
pytest = ">=7.2.1"
tox = ">=3.9.0"
flake8 = ">=4.0.0"
types-python-dateutil = ">=2.8.19.14"
mypy = "1.4.1"
[build-system]
@ -35,7 +34,7 @@ extension-pkg-whitelist = "pydantic"
[tool.mypy]
files = [
"codex_api_client",
"codex_client",
#"test", # auto-generated tests
"tests", # hand-written tests
]
@ -49,7 +48,7 @@ warn_unused_ignores = true
## Getting these passing should be easy
strict_equality = true
extra_checks = true
strict_concatenate = true
## Strongly recommend enabling this one as soon as you can
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
#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.8.2
python_dateutil >= 2.5.3
setuptools >= 21.0.0
urllib3 >= 1.25.3, < 2.1.0
pydantic >= 2
typing-extensions >= 4.7.1

View File

@ -20,12 +20,12 @@ from setuptools import setup, find_packages # noqa: H301
#
# prerequisite: setuptools
# http://pypi.python.org/pypi/setuptools
NAME = "codex-api-client"
VERSION = "0.4.0"
PYTHON_REQUIRES = ">= 3.8"
NAME = "Codex API Client"
VERSION = "1.0.0"
PYTHON_REQUIRES = ">=3.7"
REQUIRES = [
"urllib3 >= 1.25.3, < 3.0.0",
"python-dateutil >= 2.8.2",
"urllib3 >= 1.25.3, < 2.1.0",
"python-dateutil",
"pydantic >= 2",
"typing-extensions >= 4.7.1",
]
@ -36,7 +36,7 @@ setup(
description="Codex API",
author="OpenAPI Generator community",
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"],
install_requires=REQUIRES,
packages=find_packages(exclude=["test", "tests"]),
@ -45,5 +45,5 @@ setup(
long_description="""\
List of endpoints and interfaces available to Codex API users
""", # 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-cov >= 2.8.1
tox >= 3.9.0
flake8 >= 4.0.0
types-python-dateutil >= 2.8.19.14
mypy >= 1.5
pytest~=7.1.3
pytest-cov>=2.8.1
pytest-randomly>=3.12.0
mypy>=1.4.1
types-python-dateutil>=2.8.19

View File

@ -14,7 +14,7 @@
import unittest
from codex_api_client.models.content import Content
from codex_client.models.content import Content
class TestContent(unittest.TestCase):
"""Content unit test stubs"""
@ -35,7 +35,13 @@ class TestContent(unittest.TestCase):
model = Content()
if include_optional:
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:
return Content(

View File

@ -14,7 +14,7 @@
import unittest
from codex_api_client.api.data_api import DataApi
from codex_client.api.data_api import DataApi
class TestDataApi(unittest.TestCase):
@ -36,20 +36,6 @@ class TestDataApi(unittest.TestCase):
def test_download_network(self) -> None:
"""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.
"""
pass

View File

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

View File

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

View File

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

View File

@ -14,7 +14,7 @@
import unittest
from codex_api_client.models.debug_info import DebugInfo
from codex_client.models.debug_info import DebugInfo
class TestDebugInfo(unittest.TestCase):
"""DebugInfo unit test stubs"""
@ -40,25 +40,7 @@ class TestDebugInfo(unittest.TestCase):
'/ip4/127.0.0.1/tcp/8080'
],
repo = '',
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', )
spr = ''
)
else:
return DebugInfo(

View File

@ -14,10 +14,10 @@
import unittest
from codex_api_client.models.codex_version import CodexVersion
from codex_client.models.erasure_parameters import ErasureParameters
class TestCodexVersion(unittest.TestCase):
"""CodexVersion unit test stubs"""
class TestErasureParameters(unittest.TestCase):
"""ErasureParameters unit test stubs"""
def setUp(self):
pass
@ -25,26 +25,25 @@ class TestCodexVersion(unittest.TestCase):
def tearDown(self):
pass
def make_instance(self, include_optional) -> CodexVersion:
"""Test CodexVersion
def make_instance(self, include_optional) -> ErasureParameters:
"""Test ErasureParameters
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 `CodexVersion`
# uncomment below to create an instance of `ErasureParameters`
"""
model = CodexVersion()
model = ErasureParameters()
if include_optional:
return CodexVersion(
version = 'v0.1.7',
revision = '0c647d8'
return ErasureParameters(
total_chunks = 56
)
else:
return CodexVersion(
return ErasureParameters(
)
"""
def testCodexVersion(self):
"""Test CodexVersion"""
def testErasureParameters(self):
"""Test ErasureParameters"""
# inst_req_only = self.make_instance(include_optional=False)
# inst_req_and_optional = self.make_instance(include_optional=True)

View File

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

View File

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

View File

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

View File

@ -14,7 +14,7 @@
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):
"""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
from codex_api_client.models.node import Node
from codex_client.models.po_r_parameters import PoRParameters
class TestNode(unittest.TestCase):
"""Node unit test stubs"""
class TestPoRParameters(unittest.TestCase):
"""PoRParameters unit test stubs"""
def setUp(self):
pass
@ -25,29 +25,27 @@ class TestNode(unittest.TestCase):
def tearDown(self):
pass
def make_instance(self, include_optional) -> Node:
"""Test Node
def make_instance(self, include_optional) -> PoRParameters:
"""Test PoRParameters
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 `Node`
# uncomment below to create an instance of `PoRParameters`
"""
model = Node()
model = PoRParameters()
if include_optional:
return Node(
node_id = '',
peer_id = '',
record = '',
address = '',
seen = True
return PoRParameters(
u = '',
public_key = '',
name = ''
)
else:
return Node(
return PoRParameters(
)
"""
def testNode(self):
"""Test Node"""
def testPoRParameters(self):
"""Test PoRParameters"""
# inst_req_only = self.make_instance(include_optional=False)
# inst_req_and_optional = self.make_instance(include_optional=True)

View File

@ -14,7 +14,7 @@
import unittest
from codex_api_client.models.purchase import Purchase
from codex_client.models.purchase import Purchase
class TestPurchase(unittest.TestCase):
"""Purchase unit test stubs"""
@ -35,20 +35,26 @@ class TestPurchase(unittest.TestCase):
model = Purchase()
if include_optional:
return Purchase(
state = 'cancelled',
state = '',
error = '',
request = codex_api_client.models.storage_request.StorageRequest(
request = codex_client.models.storage_request.StorageRequest(
id = '',
client = '',
ask = codex_api_client.models.storage_ask.StorageAsk(
ask = codex_client.models.storage_ask.StorageAsk(
slots = 56,
slot_size = '',
duration = '',
proof_probability = '',
reward = '',
max_slot_loss = 56, ),
content = codex_api_client.models.content.Content(
cid = 'QmYyQSo1c1Ym7orWxLYvCrM2EmxFTANf8wXmmE7DWjhx5N', ),
content = codex_client.models.content.Content(
cid = 'QmYyQSo1c1Ym7orWxLYvCrM2EmxFTANf8wXmmE7DWjhx5N',
erasure = codex_client.models.erasure_parameters.ErasureParameters(
total_chunks = 56, ),
por = codex_client.models.po_r_parameters.PoRParameters(
u = '',
public_key = '',
name = '', ), ),
expiry = '10 minutes',
nonce = '', )
)

View File

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

View File

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

View File

@ -14,7 +14,7 @@
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):
"""SalesAvailabilityCREATE unit test stubs"""

View File

@ -14,7 +14,7 @@
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):
"""SalesAvailabilityREAD unit test stubs"""

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