mirror of
https://github.com/logos-storage/logos-storage-py-api-client.git
synced 2026-01-02 13:33:11 +00:00
tweaking
This commit is contained in:
parent
fa33bfb967
commit
3b3b8b3ba3
57
.github/workflows/generate.yml
vendored
Normal file
57
.github/workflows/generate.yml
vendored
Normal file
@ -0,0 +1,57 @@
|
||||
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
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 20
|
||||
cache: 'npm'
|
||||
|
||||
- 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'
|
||||
commit-message: 'Generated API update'
|
||||
|
||||
2
.github/workflows/python.yml
vendored
2
.github/workflows/python.yml
vendored
@ -3,7 +3,7 @@
|
||||
#
|
||||
# ref: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
|
||||
|
||||
name: codex_client Python package
|
||||
name: codex_api_client Python package
|
||||
|
||||
on: [push, pull_request]
|
||||
|
||||
|
||||
44
.github/workflows/release.yml
vendored
Normal file
44
.github/workflows/release.yml
vendored
Normal file
@ -0,0 +1,44 @@
|
||||
name: Release
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [published]
|
||||
|
||||
jobs:
|
||||
publish:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 20
|
||||
cache: 'npm'
|
||||
|
||||
- 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.9
|
||||
|
||||
- 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: Create Pull Request
|
||||
uses: peter-evans/create-pull-request@v7
|
||||
with:
|
||||
branch: released
|
||||
delete-branch: 'true'
|
||||
title: 'Version update'
|
||||
commit-message: 'Version update after release'
|
||||
@ -1,31 +0,0 @@
|
||||
# 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
|
||||
@ -21,3 +21,7 @@
|
||||
#docs/*.md
|
||||
# Then explicitly reverse the ignore rule for a single file:
|
||||
#!docs/README.md
|
||||
|
||||
.gitlab-ci.yml
|
||||
.travis.yml
|
||||
git_push.sh
|
||||
|
||||
@ -1,53 +1,53 @@
|
||||
.github/workflows/python.yml
|
||||
.gitignore
|
||||
.gitlab-ci.yml
|
||||
.travis.yml
|
||||
README.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
|
||||
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_create.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
|
||||
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/PoRParameters.md
|
||||
docs/PeersTable.md
|
||||
docs/Purchase.md
|
||||
docs/Reservation.md
|
||||
docs/SPRRead.md
|
||||
@ -60,7 +60,6 @@ docs/Space.md
|
||||
docs/StorageAsk.md
|
||||
docs/StorageRequest.md
|
||||
docs/StorageRequestCreation.md
|
||||
git_push.sh
|
||||
pyproject.toml
|
||||
requirements.txt
|
||||
setup.cfg
|
||||
|
||||
38
.openapi-generator/templates/README.mustache
Normal file
38
.openapi-generator/templates/README.mustache
Normal file
@ -0,0 +1,38 @@
|
||||
# {{{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
17
.travis.yml
@ -1,17 +0,0 @@
|
||||
# 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
|
||||
53
README.md
53
README.md
@ -4,7 +4,7 @@ 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: 1.0.0
|
||||
- Package version: 0.1.0
|
||||
- Generator version: 7.8.0
|
||||
- Build package: org.openapitools.codegen.languages.PythonClientCodegen
|
||||
|
||||
@ -12,61 +12,39 @@ This Python package is automatically generated by the [OpenAPI Generator](https:
|
||||
|
||||
Python 3.7+
|
||||
|
||||
## Installation & Usage
|
||||
### pip install
|
||||
|
||||
If the python package is hosted on a repository, you can install directly using:
|
||||
## Installation
|
||||
|
||||
```sh
|
||||
pip install git+https://github.com/auhau/py-codex-api.git
|
||||
pip install codex_api_client
|
||||
```
|
||||
(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_client
|
||||
import codex_api_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_client
|
||||
from codex_client.rest import ApiException
|
||||
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_client.Configuration(
|
||||
configuration = codex_api_client.Configuration(
|
||||
host = "http://localhost:8080/api/codex/v1"
|
||||
)
|
||||
|
||||
|
||||
|
||||
# Enter a context with an instance of the API client
|
||||
with codex_client.ApiClient(configuration) as api_client:
|
||||
with codex_api_client.ApiClient(configuration) as api_client:
|
||||
# Create an instance of the API class
|
||||
api_instance = codex_client.DataApi(api_client)
|
||||
api_instance = codex_api_client.DataApi(api_client)
|
||||
cid = 'cid_example' # str | File to be downloaded.
|
||||
|
||||
try:
|
||||
@ -86,7 +64,9 @@ All URIs are relative to *http://localhost:8080/api/codex/v1*
|
||||
Class | Method | HTTP request | Description
|
||||
------------ | ------------- | ------------- | -------------
|
||||
*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) | **GET** /data/{cid}/network | Download a file from the network in a streaming manner. If the file is not available locally, it will be retrieved from other nodes in the network if able.
|
||||
*DataApi* | [**download_network**](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* | [**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.
|
||||
@ -102,20 +82,21 @@ 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** /node/peerid | Get Node's PeerID
|
||||
*NodeApi* | [**get_spr**](docs/NodeApi.md#get_spr) | **GET** /node/spr | Get Node's SPR
|
||||
*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
|
||||
|
||||
|
||||
## 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)
|
||||
- [PoRParameters](docs/PoRParameters.md)
|
||||
- [PeersTable](docs/PeersTable.md)
|
||||
- [Purchase](docs/Purchase.md)
|
||||
- [Reservation](docs/Reservation.md)
|
||||
- [SPRRead](docs/SPRRead.md)
|
||||
|
||||
164
codex.yaml
164
codex.yaml
@ -83,33 +83,46 @@ 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
|
||||
description: Parameters specifying the content
|
||||
properties:
|
||||
cid:
|
||||
$ref: "#/components/schemas/Cid"
|
||||
erasure:
|
||||
$ref: "#/components/schemas/ErasureParameters"
|
||||
por:
|
||||
$ref: "#/components/schemas/PoRParameters"
|
||||
|
||||
Node:
|
||||
type: object
|
||||
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
|
||||
|
||||
PeersTable:
|
||||
type: object
|
||||
properties:
|
||||
localNode:
|
||||
$ref: "#/components/schemas/Node"
|
||||
nodes:
|
||||
type: array
|
||||
items:
|
||||
$ref: "#/components/schemas/Node"
|
||||
|
||||
DebugInfo:
|
||||
type: object
|
||||
@ -125,6 +138,10 @@ components:
|
||||
description: Path of the data repository where all nodes data are stored
|
||||
spr:
|
||||
$ref: "#/components/schemas/SPR"
|
||||
table:
|
||||
$ref: "#/components/schemas/PeersTable"
|
||||
codex:
|
||||
$ref: "#/components/schemas/CodexVersion"
|
||||
|
||||
SalesAvailability:
|
||||
type: object
|
||||
@ -138,7 +155,7 @@ components:
|
||||
$ref: "#/components/schemas/Duration"
|
||||
minPrice:
|
||||
type: string
|
||||
description: Minimum price to be paid (in amount of tokens) as decimal string
|
||||
description: Minimal price paid (in amount of tokens) for the whole hosted request's slot for the request's duration as decimal string
|
||||
maxCollateral:
|
||||
type: string
|
||||
description: Maximum collateral user is willing to pay per filled Slot (in amount of tokens) as decimal string
|
||||
@ -327,10 +344,10 @@ components:
|
||||
ManifestItem:
|
||||
type: object
|
||||
properties:
|
||||
rootHash:
|
||||
treeCid:
|
||||
$ref: "#/components/schemas/Cid"
|
||||
description: "Root hash of the content"
|
||||
originalBytes:
|
||||
description: "Unique data identifier"
|
||||
datasetSize:
|
||||
type: integer
|
||||
format: int64
|
||||
description: "Length of original content in bytes"
|
||||
@ -340,6 +357,22 @@ 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
|
||||
uploadedAt:
|
||||
type: integer
|
||||
format: int64
|
||||
nullable: true
|
||||
description: "The UTC upload timestamp in seconds"
|
||||
example: 1729244192
|
||||
|
||||
Space:
|
||||
type: object
|
||||
@ -351,15 +384,15 @@ components:
|
||||
quotaMaxBytes:
|
||||
type: integer
|
||||
format: int64
|
||||
description: "Maximum storage space used by the node"
|
||||
description: "Maximum storage space (in bytes) available for the node in Codex's local repository."
|
||||
quotaUsedBytes:
|
||||
type: integer
|
||||
format: int64
|
||||
description: "Amount of storage space currently in use"
|
||||
description: "Amount of storage space (in bytes) currently used for storing files in Codex's local repository."
|
||||
quotaReservedBytes:
|
||||
type: integer
|
||||
format: int64
|
||||
description: "Amount of storage space reserved"
|
||||
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."
|
||||
|
||||
servers:
|
||||
- url: "http://localhost:8080/api/codex/v1"
|
||||
@ -425,12 +458,29 @@ 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 ]
|
||||
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:
|
||||
@ -476,10 +526,36 @@ paths:
|
||||
description: Well it was bad-bad
|
||||
|
||||
"/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: downloadNetwork
|
||||
operationId: downloadNetworkStream
|
||||
parameters:
|
||||
- in: path
|
||||
name: cid
|
||||
@ -502,6 +578,32 @@ 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."
|
||||
@ -747,7 +849,7 @@ paths:
|
||||
"503":
|
||||
description: Persistence is not enabled
|
||||
|
||||
"/node/spr":
|
||||
"/spr":
|
||||
get:
|
||||
summary: "Get Node's SPR"
|
||||
operationId: getSPR
|
||||
@ -765,7 +867,7 @@ paths:
|
||||
"503":
|
||||
description: Node SPR not ready, try again later
|
||||
|
||||
"/node/peerid":
|
||||
"/peerid":
|
||||
get:
|
||||
summary: "Get Node's PeerID"
|
||||
operationId: getPeerId
|
||||
|
||||
57
codex_api_client/__init__.py
Normal file
57
codex_api_client/__init__.py
Normal file
@ -0,0 +1,57 @@
|
||||
# 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.1.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_create import SalesAvailabilityCREATE
|
||||
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
|
||||
8
codex_api_client/api/__init__.py
Normal file
8
codex_api_client/api/__init__.py
Normal file
@ -0,0 +1,8 @@
|
||||
# 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
|
||||
|
||||
@ -19,12 +19,13 @@ from typing_extensions import Annotated
|
||||
from pydantic import Field, StrictBytes, StrictStr
|
||||
from typing import Optional, Union
|
||||
from typing_extensions import Annotated
|
||||
from codex_client.models.data_list import DataList
|
||||
from codex_client.models.space import Space
|
||||
from codex_api_client.models.data_item import DataItem
|
||||
from codex_api_client.models.data_list import DataList
|
||||
from codex_api_client.models.space import Space
|
||||
|
||||
from codex_client.api_client import ApiClient, RequestSerialized
|
||||
from codex_client.api_response import ApiResponse
|
||||
from codex_client.rest import RESTResponseType
|
||||
from codex_api_client.api_client import ApiClient, RequestSerialized
|
||||
from codex_api_client.api_response import ApiResponse
|
||||
from codex_api_client.rest import RESTResponseType
|
||||
|
||||
|
||||
class DataApi:
|
||||
@ -320,8 +321,8 @@ class DataApi:
|
||||
_content_type: Optional[StrictStr] = None,
|
||||
_headers: Optional[Dict[StrictStr, Any]] = None,
|
||||
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
||||
) -> bytearray:
|
||||
"""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.
|
||||
) -> DataItem:
|
||||
"""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.
|
||||
|
||||
|
||||
:param cid: File to be downloaded. (required)
|
||||
@ -357,7 +358,7 @@ class DataApi:
|
||||
)
|
||||
|
||||
_response_types_map: Dict[str, Optional[str]] = {
|
||||
'200': "bytearray",
|
||||
'200': "DataItem",
|
||||
'400': None,
|
||||
'404': None,
|
||||
'500': None,
|
||||
@ -389,8 +390,8 @@ class DataApi:
|
||||
_content_type: Optional[StrictStr] = None,
|
||||
_headers: Optional[Dict[StrictStr, Any]] = None,
|
||||
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
||||
) -> ApiResponse[bytearray]:
|
||||
"""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.
|
||||
) -> ApiResponse[DataItem]:
|
||||
"""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.
|
||||
|
||||
|
||||
:param cid: File to be downloaded. (required)
|
||||
@ -426,7 +427,7 @@ class DataApi:
|
||||
)
|
||||
|
||||
_response_types_map: Dict[str, Optional[str]] = {
|
||||
'200': "bytearray",
|
||||
'200': "DataItem",
|
||||
'400': None,
|
||||
'404': None,
|
||||
'500': None,
|
||||
@ -459,7 +460,7 @@ class DataApi:
|
||||
_headers: Optional[Dict[StrictStr, Any]] = None,
|
||||
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
||||
) -> RESTResponseType:
|
||||
"""Download a file from the network in a streaming manner. If the file is not available locally, it will be retrieved from other nodes in the network if able.
|
||||
"""Download a file from the network to the local node if it's not available locally. Note: Download is performed async. Call can return before download is completed.
|
||||
|
||||
|
||||
:param cid: File to be downloaded. (required)
|
||||
@ -495,7 +496,7 @@ class DataApi:
|
||||
)
|
||||
|
||||
_response_types_map: Dict[str, Optional[str]] = {
|
||||
'200': "bytearray",
|
||||
'200': "DataItem",
|
||||
'400': None,
|
||||
'404': None,
|
||||
'500': None,
|
||||
@ -537,6 +538,534 @@ class DataApi:
|
||||
# process the body parameter
|
||||
|
||||
|
||||
# set the HTTP header `Accept`
|
||||
if 'Accept' not in _header_params:
|
||||
_header_params['Accept'] = self.api_client.select_header_accept(
|
||||
[
|
||||
'application/json'
|
||||
]
|
||||
)
|
||||
|
||||
|
||||
# authentication setting
|
||||
_auth_settings: List[str] = [
|
||||
]
|
||||
|
||||
return self.api_client.param_serialize(
|
||||
method='POST',
|
||||
resource_path='/data/{cid}/network',
|
||||
path_params=_path_params,
|
||||
query_params=_query_params,
|
||||
header_params=_header_params,
|
||||
body=_body_params,
|
||||
post_params=_form_params,
|
||||
files=_files,
|
||||
auth_settings=_auth_settings,
|
||||
collection_formats=_collection_formats,
|
||||
_host=_host,
|
||||
_request_auth=_request_auth
|
||||
)
|
||||
|
||||
|
||||
|
||||
|
||||
@validate_call
|
||||
def download_network_manifest(
|
||||
self,
|
||||
cid: Annotated[StrictStr, Field(description="File for which the manifest is to be downloaded.")],
|
||||
_request_timeout: Union[
|
||||
None,
|
||||
Annotated[StrictFloat, Field(gt=0)],
|
||||
Tuple[
|
||||
Annotated[StrictFloat, Field(gt=0)],
|
||||
Annotated[StrictFloat, Field(gt=0)]
|
||||
]
|
||||
] = None,
|
||||
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
||||
_content_type: Optional[StrictStr] = None,
|
||||
_headers: Optional[Dict[StrictStr, Any]] = None,
|
||||
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
||||
) -> DataItem:
|
||||
"""Download only the dataset manifest from the network to the local node if it's not available locally.
|
||||
|
||||
|
||||
:param cid: File for which the manifest is to be downloaded. (required)
|
||||
:type cid: str
|
||||
: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
|
||||
(connection, read) timeouts.
|
||||
:type _request_timeout: int, tuple(int, int), optional
|
||||
:param _request_auth: set to override the auth_settings for an a single
|
||||
request; this effectively ignores the
|
||||
authentication in the spec for a single request.
|
||||
:type _request_auth: dict, optional
|
||||
:param _content_type: force content-type for the request.
|
||||
:type _content_type: str, Optional
|
||||
:param _headers: set to override the headers for a single
|
||||
request; this effectively ignores the headers
|
||||
in the spec for a single request.
|
||||
:type _headers: dict, optional
|
||||
:param _host_index: set to override the host_index for a single
|
||||
request; this effectively ignores the host_index
|
||||
in the spec for a single request.
|
||||
:type _host_index: int, optional
|
||||
:return: Returns the result object.
|
||||
""" # noqa: E501
|
||||
|
||||
_param = self._download_network_manifest_serialize(
|
||||
cid=cid,
|
||||
_request_auth=_request_auth,
|
||||
_content_type=_content_type,
|
||||
_headers=_headers,
|
||||
_host_index=_host_index
|
||||
)
|
||||
|
||||
_response_types_map: Dict[str, Optional[str]] = {
|
||||
'200': "DataItem",
|
||||
'400': None,
|
||||
'404': None,
|
||||
'500': None,
|
||||
}
|
||||
response_data = self.api_client.call_api(
|
||||
*_param,
|
||||
_request_timeout=_request_timeout
|
||||
)
|
||||
response_data.read()
|
||||
return self.api_client.response_deserialize(
|
||||
response_data=response_data,
|
||||
response_types_map=_response_types_map,
|
||||
).data
|
||||
|
||||
|
||||
@validate_call
|
||||
def download_network_manifest_with_http_info(
|
||||
self,
|
||||
cid: Annotated[StrictStr, Field(description="File for which the manifest is to be downloaded.")],
|
||||
_request_timeout: Union[
|
||||
None,
|
||||
Annotated[StrictFloat, Field(gt=0)],
|
||||
Tuple[
|
||||
Annotated[StrictFloat, Field(gt=0)],
|
||||
Annotated[StrictFloat, Field(gt=0)]
|
||||
]
|
||||
] = None,
|
||||
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
||||
_content_type: Optional[StrictStr] = None,
|
||||
_headers: Optional[Dict[StrictStr, Any]] = None,
|
||||
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
||||
) -> ApiResponse[DataItem]:
|
||||
"""Download only the dataset manifest from the network to the local node if it's not available locally.
|
||||
|
||||
|
||||
:param cid: File for which the manifest is to be downloaded. (required)
|
||||
:type cid: str
|
||||
: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
|
||||
(connection, read) timeouts.
|
||||
:type _request_timeout: int, tuple(int, int), optional
|
||||
:param _request_auth: set to override the auth_settings for an a single
|
||||
request; this effectively ignores the
|
||||
authentication in the spec for a single request.
|
||||
:type _request_auth: dict, optional
|
||||
:param _content_type: force content-type for the request.
|
||||
:type _content_type: str, Optional
|
||||
:param _headers: set to override the headers for a single
|
||||
request; this effectively ignores the headers
|
||||
in the spec for a single request.
|
||||
:type _headers: dict, optional
|
||||
:param _host_index: set to override the host_index for a single
|
||||
request; this effectively ignores the host_index
|
||||
in the spec for a single request.
|
||||
:type _host_index: int, optional
|
||||
:return: Returns the result object.
|
||||
""" # noqa: E501
|
||||
|
||||
_param = self._download_network_manifest_serialize(
|
||||
cid=cid,
|
||||
_request_auth=_request_auth,
|
||||
_content_type=_content_type,
|
||||
_headers=_headers,
|
||||
_host_index=_host_index
|
||||
)
|
||||
|
||||
_response_types_map: Dict[str, Optional[str]] = {
|
||||
'200': "DataItem",
|
||||
'400': None,
|
||||
'404': None,
|
||||
'500': None,
|
||||
}
|
||||
response_data = self.api_client.call_api(
|
||||
*_param,
|
||||
_request_timeout=_request_timeout
|
||||
)
|
||||
response_data.read()
|
||||
return self.api_client.response_deserialize(
|
||||
response_data=response_data,
|
||||
response_types_map=_response_types_map,
|
||||
)
|
||||
|
||||
|
||||
@validate_call
|
||||
def download_network_manifest_without_preload_content(
|
||||
self,
|
||||
cid: Annotated[StrictStr, Field(description="File for which the manifest is to be downloaded.")],
|
||||
_request_timeout: Union[
|
||||
None,
|
||||
Annotated[StrictFloat, Field(gt=0)],
|
||||
Tuple[
|
||||
Annotated[StrictFloat, Field(gt=0)],
|
||||
Annotated[StrictFloat, Field(gt=0)]
|
||||
]
|
||||
] = None,
|
||||
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
||||
_content_type: Optional[StrictStr] = None,
|
||||
_headers: Optional[Dict[StrictStr, Any]] = None,
|
||||
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
||||
) -> RESTResponseType:
|
||||
"""Download only the dataset manifest from the network to the local node if it's not available locally.
|
||||
|
||||
|
||||
:param cid: File for which the manifest is to be downloaded. (required)
|
||||
:type cid: str
|
||||
: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
|
||||
(connection, read) timeouts.
|
||||
:type _request_timeout: int, tuple(int, int), optional
|
||||
:param _request_auth: set to override the auth_settings for an a single
|
||||
request; this effectively ignores the
|
||||
authentication in the spec for a single request.
|
||||
:type _request_auth: dict, optional
|
||||
:param _content_type: force content-type for the request.
|
||||
:type _content_type: str, Optional
|
||||
:param _headers: set to override the headers for a single
|
||||
request; this effectively ignores the headers
|
||||
in the spec for a single request.
|
||||
:type _headers: dict, optional
|
||||
:param _host_index: set to override the host_index for a single
|
||||
request; this effectively ignores the host_index
|
||||
in the spec for a single request.
|
||||
:type _host_index: int, optional
|
||||
:return: Returns the result object.
|
||||
""" # noqa: E501
|
||||
|
||||
_param = self._download_network_manifest_serialize(
|
||||
cid=cid,
|
||||
_request_auth=_request_auth,
|
||||
_content_type=_content_type,
|
||||
_headers=_headers,
|
||||
_host_index=_host_index
|
||||
)
|
||||
|
||||
_response_types_map: Dict[str, Optional[str]] = {
|
||||
'200': "DataItem",
|
||||
'400': None,
|
||||
'404': None,
|
||||
'500': None,
|
||||
}
|
||||
response_data = self.api_client.call_api(
|
||||
*_param,
|
||||
_request_timeout=_request_timeout
|
||||
)
|
||||
return response_data.response
|
||||
|
||||
|
||||
def _download_network_manifest_serialize(
|
||||
self,
|
||||
cid,
|
||||
_request_auth,
|
||||
_content_type,
|
||||
_headers,
|
||||
_host_index,
|
||||
) -> RequestSerialized:
|
||||
|
||||
_host = None
|
||||
|
||||
_collection_formats: Dict[str, str] = {
|
||||
}
|
||||
|
||||
_path_params: Dict[str, str] = {}
|
||||
_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]] = {}
|
||||
_body_params: Optional[bytes] = None
|
||||
|
||||
# process the path parameters
|
||||
if cid is not None:
|
||||
_path_params['cid'] = cid
|
||||
# process the query parameters
|
||||
# process the header parameters
|
||||
# process the form parameters
|
||||
# process the body parameter
|
||||
|
||||
|
||||
# set the HTTP header `Accept`
|
||||
if 'Accept' not in _header_params:
|
||||
_header_params['Accept'] = self.api_client.select_header_accept(
|
||||
[
|
||||
'application/json'
|
||||
]
|
||||
)
|
||||
|
||||
|
||||
# authentication setting
|
||||
_auth_settings: List[str] = [
|
||||
]
|
||||
|
||||
return self.api_client.param_serialize(
|
||||
method='GET',
|
||||
resource_path='/data/{cid}/network/manifest',
|
||||
path_params=_path_params,
|
||||
query_params=_query_params,
|
||||
header_params=_header_params,
|
||||
body=_body_params,
|
||||
post_params=_form_params,
|
||||
files=_files,
|
||||
auth_settings=_auth_settings,
|
||||
collection_formats=_collection_formats,
|
||||
_host=_host,
|
||||
_request_auth=_request_auth
|
||||
)
|
||||
|
||||
|
||||
|
||||
|
||||
@validate_call
|
||||
def download_network_stream(
|
||||
self,
|
||||
cid: Annotated[StrictStr, Field(description="File to be downloaded.")],
|
||||
_request_timeout: Union[
|
||||
None,
|
||||
Annotated[StrictFloat, Field(gt=0)],
|
||||
Tuple[
|
||||
Annotated[StrictFloat, Field(gt=0)],
|
||||
Annotated[StrictFloat, Field(gt=0)]
|
||||
]
|
||||
] = None,
|
||||
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
||||
_content_type: Optional[StrictStr] = None,
|
||||
_headers: Optional[Dict[StrictStr, Any]] = None,
|
||||
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
||||
) -> bytearray:
|
||||
"""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.
|
||||
|
||||
|
||||
:param cid: File to be downloaded. (required)
|
||||
:type cid: str
|
||||
: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
|
||||
(connection, read) timeouts.
|
||||
:type _request_timeout: int, tuple(int, int), optional
|
||||
:param _request_auth: set to override the auth_settings for an a single
|
||||
request; this effectively ignores the
|
||||
authentication in the spec for a single request.
|
||||
:type _request_auth: dict, optional
|
||||
:param _content_type: force content-type for the request.
|
||||
:type _content_type: str, Optional
|
||||
:param _headers: set to override the headers for a single
|
||||
request; this effectively ignores the headers
|
||||
in the spec for a single request.
|
||||
:type _headers: dict, optional
|
||||
:param _host_index: set to override the host_index for a single
|
||||
request; this effectively ignores the host_index
|
||||
in the spec for a single request.
|
||||
:type _host_index: int, optional
|
||||
:return: Returns the result object.
|
||||
""" # noqa: E501
|
||||
|
||||
_param = self._download_network_stream_serialize(
|
||||
cid=cid,
|
||||
_request_auth=_request_auth,
|
||||
_content_type=_content_type,
|
||||
_headers=_headers,
|
||||
_host_index=_host_index
|
||||
)
|
||||
|
||||
_response_types_map: Dict[str, Optional[str]] = {
|
||||
'200': "bytearray",
|
||||
'400': None,
|
||||
'404': None,
|
||||
'500': None,
|
||||
}
|
||||
response_data = self.api_client.call_api(
|
||||
*_param,
|
||||
_request_timeout=_request_timeout
|
||||
)
|
||||
response_data.read()
|
||||
return self.api_client.response_deserialize(
|
||||
response_data=response_data,
|
||||
response_types_map=_response_types_map,
|
||||
).data
|
||||
|
||||
|
||||
@validate_call
|
||||
def download_network_stream_with_http_info(
|
||||
self,
|
||||
cid: Annotated[StrictStr, Field(description="File to be downloaded.")],
|
||||
_request_timeout: Union[
|
||||
None,
|
||||
Annotated[StrictFloat, Field(gt=0)],
|
||||
Tuple[
|
||||
Annotated[StrictFloat, Field(gt=0)],
|
||||
Annotated[StrictFloat, Field(gt=0)]
|
||||
]
|
||||
] = None,
|
||||
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
||||
_content_type: Optional[StrictStr] = None,
|
||||
_headers: Optional[Dict[StrictStr, Any]] = None,
|
||||
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
||||
) -> ApiResponse[bytearray]:
|
||||
"""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.
|
||||
|
||||
|
||||
:param cid: File to be downloaded. (required)
|
||||
:type cid: str
|
||||
: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
|
||||
(connection, read) timeouts.
|
||||
:type _request_timeout: int, tuple(int, int), optional
|
||||
:param _request_auth: set to override the auth_settings for an a single
|
||||
request; this effectively ignores the
|
||||
authentication in the spec for a single request.
|
||||
:type _request_auth: dict, optional
|
||||
:param _content_type: force content-type for the request.
|
||||
:type _content_type: str, Optional
|
||||
:param _headers: set to override the headers for a single
|
||||
request; this effectively ignores the headers
|
||||
in the spec for a single request.
|
||||
:type _headers: dict, optional
|
||||
:param _host_index: set to override the host_index for a single
|
||||
request; this effectively ignores the host_index
|
||||
in the spec for a single request.
|
||||
:type _host_index: int, optional
|
||||
:return: Returns the result object.
|
||||
""" # noqa: E501
|
||||
|
||||
_param = self._download_network_stream_serialize(
|
||||
cid=cid,
|
||||
_request_auth=_request_auth,
|
||||
_content_type=_content_type,
|
||||
_headers=_headers,
|
||||
_host_index=_host_index
|
||||
)
|
||||
|
||||
_response_types_map: Dict[str, Optional[str]] = {
|
||||
'200': "bytearray",
|
||||
'400': None,
|
||||
'404': None,
|
||||
'500': None,
|
||||
}
|
||||
response_data = self.api_client.call_api(
|
||||
*_param,
|
||||
_request_timeout=_request_timeout
|
||||
)
|
||||
response_data.read()
|
||||
return self.api_client.response_deserialize(
|
||||
response_data=response_data,
|
||||
response_types_map=_response_types_map,
|
||||
)
|
||||
|
||||
|
||||
@validate_call
|
||||
def download_network_stream_without_preload_content(
|
||||
self,
|
||||
cid: Annotated[StrictStr, Field(description="File to be downloaded.")],
|
||||
_request_timeout: Union[
|
||||
None,
|
||||
Annotated[StrictFloat, Field(gt=0)],
|
||||
Tuple[
|
||||
Annotated[StrictFloat, Field(gt=0)],
|
||||
Annotated[StrictFloat, Field(gt=0)]
|
||||
]
|
||||
] = None,
|
||||
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
||||
_content_type: Optional[StrictStr] = None,
|
||||
_headers: Optional[Dict[StrictStr, Any]] = None,
|
||||
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
||||
) -> RESTResponseType:
|
||||
"""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.
|
||||
|
||||
|
||||
:param cid: File to be downloaded. (required)
|
||||
:type cid: str
|
||||
: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
|
||||
(connection, read) timeouts.
|
||||
:type _request_timeout: int, tuple(int, int), optional
|
||||
:param _request_auth: set to override the auth_settings for an a single
|
||||
request; this effectively ignores the
|
||||
authentication in the spec for a single request.
|
||||
:type _request_auth: dict, optional
|
||||
:param _content_type: force content-type for the request.
|
||||
:type _content_type: str, Optional
|
||||
:param _headers: set to override the headers for a single
|
||||
request; this effectively ignores the headers
|
||||
in the spec for a single request.
|
||||
:type _headers: dict, optional
|
||||
:param _host_index: set to override the host_index for a single
|
||||
request; this effectively ignores the host_index
|
||||
in the spec for a single request.
|
||||
:type _host_index: int, optional
|
||||
:return: Returns the result object.
|
||||
""" # noqa: E501
|
||||
|
||||
_param = self._download_network_stream_serialize(
|
||||
cid=cid,
|
||||
_request_auth=_request_auth,
|
||||
_content_type=_content_type,
|
||||
_headers=_headers,
|
||||
_host_index=_host_index
|
||||
)
|
||||
|
||||
_response_types_map: Dict[str, Optional[str]] = {
|
||||
'200': "bytearray",
|
||||
'400': None,
|
||||
'404': None,
|
||||
'500': None,
|
||||
}
|
||||
response_data = self.api_client.call_api(
|
||||
*_param,
|
||||
_request_timeout=_request_timeout
|
||||
)
|
||||
return response_data.response
|
||||
|
||||
|
||||
def _download_network_stream_serialize(
|
||||
self,
|
||||
cid,
|
||||
_request_auth,
|
||||
_content_type,
|
||||
_headers,
|
||||
_host_index,
|
||||
) -> RequestSerialized:
|
||||
|
||||
_host = None
|
||||
|
||||
_collection_formats: Dict[str, str] = {
|
||||
}
|
||||
|
||||
_path_params: Dict[str, str] = {}
|
||||
_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]] = {}
|
||||
_body_params: Optional[bytes] = None
|
||||
|
||||
# process the path parameters
|
||||
if cid is not None:
|
||||
_path_params['cid'] = cid
|
||||
# process the query parameters
|
||||
# process the header parameters
|
||||
# process the form parameters
|
||||
# process the body parameter
|
||||
|
||||
|
||||
# set the HTTP header `Accept`
|
||||
if 'Accept' not in _header_params:
|
||||
_header_params['Accept'] = self.api_client.select_header_accept(
|
||||
@ -552,7 +1081,7 @@ class DataApi:
|
||||
|
||||
return self.api_client.param_serialize(
|
||||
method='GET',
|
||||
resource_path='/data/{cid}/network',
|
||||
resource_path='/data/{cid}/network/stream',
|
||||
path_params=_path_params,
|
||||
query_params=_query_params,
|
||||
header_params=_header_params,
|
||||
@ -620,6 +1149,7 @@ class DataApi:
|
||||
'200': "DataList",
|
||||
'400': None,
|
||||
'404': None,
|
||||
'422': None,
|
||||
'500': None,
|
||||
}
|
||||
response_data = self.api_client.call_api(
|
||||
@ -685,6 +1215,7 @@ class DataApi:
|
||||
'200': "DataList",
|
||||
'400': None,
|
||||
'404': None,
|
||||
'422': None,
|
||||
'500': None,
|
||||
}
|
||||
response_data = self.api_client.call_api(
|
||||
@ -750,6 +1281,7 @@ class DataApi:
|
||||
'200': "DataList",
|
||||
'400': None,
|
||||
'404': None,
|
||||
'422': None,
|
||||
'500': None,
|
||||
}
|
||||
response_data = self.api_client.call_api(
|
||||
@ -1063,6 +1595,8 @@ class DataApi:
|
||||
@validate_call
|
||||
def upload(
|
||||
self,
|
||||
content_type: Annotated[Optional[StrictStr], Field(description="The content type of the file. Must be valid.")] = None,
|
||||
content_disposition: Annotated[Optional[StrictStr], Field(description="The content disposition used to send the filename.")] = None,
|
||||
body: Optional[Union[StrictBytes, StrictStr]] = None,
|
||||
_request_timeout: Union[
|
||||
None,
|
||||
@ -1080,6 +1614,10 @@ class DataApi:
|
||||
"""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.
|
||||
|
||||
|
||||
:param content_type: The content type of the file. Must be valid.
|
||||
:type content_type: str
|
||||
:param content_disposition: The content disposition used to send the filename.
|
||||
:type content_disposition: str
|
||||
:param body:
|
||||
:type body: bytearray
|
||||
:param _request_timeout: timeout setting for this request. If one
|
||||
@ -1105,6 +1643,8 @@ class DataApi:
|
||||
""" # noqa: E501
|
||||
|
||||
_param = self._upload_serialize(
|
||||
content_type=content_type,
|
||||
content_disposition=content_disposition,
|
||||
body=body,
|
||||
_request_auth=_request_auth,
|
||||
_content_type=_content_type,
|
||||
@ -1130,6 +1670,8 @@ class DataApi:
|
||||
@validate_call
|
||||
def upload_with_http_info(
|
||||
self,
|
||||
content_type: Annotated[Optional[StrictStr], Field(description="The content type of the file. Must be valid.")] = None,
|
||||
content_disposition: Annotated[Optional[StrictStr], Field(description="The content disposition used to send the filename.")] = None,
|
||||
body: Optional[Union[StrictBytes, StrictStr]] = None,
|
||||
_request_timeout: Union[
|
||||
None,
|
||||
@ -1147,6 +1689,10 @@ class DataApi:
|
||||
"""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.
|
||||
|
||||
|
||||
:param content_type: The content type of the file. Must be valid.
|
||||
:type content_type: str
|
||||
:param content_disposition: The content disposition used to send the filename.
|
||||
:type content_disposition: str
|
||||
:param body:
|
||||
:type body: bytearray
|
||||
:param _request_timeout: timeout setting for this request. If one
|
||||
@ -1172,6 +1718,8 @@ class DataApi:
|
||||
""" # noqa: E501
|
||||
|
||||
_param = self._upload_serialize(
|
||||
content_type=content_type,
|
||||
content_disposition=content_disposition,
|
||||
body=body,
|
||||
_request_auth=_request_auth,
|
||||
_content_type=_content_type,
|
||||
@ -1197,6 +1745,8 @@ class DataApi:
|
||||
@validate_call
|
||||
def upload_without_preload_content(
|
||||
self,
|
||||
content_type: Annotated[Optional[StrictStr], Field(description="The content type of the file. Must be valid.")] = None,
|
||||
content_disposition: Annotated[Optional[StrictStr], Field(description="The content disposition used to send the filename.")] = None,
|
||||
body: Optional[Union[StrictBytes, StrictStr]] = None,
|
||||
_request_timeout: Union[
|
||||
None,
|
||||
@ -1214,6 +1764,10 @@ class DataApi:
|
||||
"""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.
|
||||
|
||||
|
||||
:param content_type: The content type of the file. Must be valid.
|
||||
:type content_type: str
|
||||
:param content_disposition: The content disposition used to send the filename.
|
||||
:type content_disposition: str
|
||||
:param body:
|
||||
:type body: bytearray
|
||||
:param _request_timeout: timeout setting for this request. If one
|
||||
@ -1239,6 +1793,8 @@ class DataApi:
|
||||
""" # noqa: E501
|
||||
|
||||
_param = self._upload_serialize(
|
||||
content_type=content_type,
|
||||
content_disposition=content_disposition,
|
||||
body=body,
|
||||
_request_auth=_request_auth,
|
||||
_content_type=_content_type,
|
||||
@ -1259,6 +1815,8 @@ class DataApi:
|
||||
|
||||
def _upload_serialize(
|
||||
self,
|
||||
content_type,
|
||||
content_disposition,
|
||||
body,
|
||||
_request_auth,
|
||||
_content_type,
|
||||
@ -1281,6 +1839,10 @@ class DataApi:
|
||||
# process the path parameters
|
||||
# process the query parameters
|
||||
# process the header parameters
|
||||
if content_type is not None:
|
||||
_header_params['content-type'] = content_type
|
||||
if content_disposition is not None:
|
||||
_header_params['content-disposition'] = content_disposition
|
||||
# process the form parameters
|
||||
# process the body parameter
|
||||
if body is not None:
|
||||
@ -17,11 +17,11 @@ from typing import Any, Dict, List, Optional, Tuple, Union
|
||||
from typing_extensions import Annotated
|
||||
|
||||
from pydantic import StrictStr
|
||||
from codex_client.models.debug_info import DebugInfo
|
||||
from codex_api_client.models.debug_info import DebugInfo
|
||||
|
||||
from codex_client.api_client import ApiClient, RequestSerialized
|
||||
from codex_client.api_response import ApiResponse
|
||||
from codex_client.rest import RESTResponseType
|
||||
from codex_api_client.api_client import ApiClient, RequestSerialized
|
||||
from codex_api_client.api_response import ApiResponse
|
||||
from codex_api_client.rest import RESTResponseType
|
||||
|
||||
|
||||
class DebugApi:
|
||||
@ -19,18 +19,18 @@ from typing_extensions import Annotated
|
||||
from pydantic import Field, StrictStr
|
||||
from typing import List, Optional
|
||||
from typing_extensions import Annotated
|
||||
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.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_create import SalesAvailabilityCREATE
|
||||
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.api_client import ApiClient, RequestSerialized
|
||||
from codex_client.api_response import ApiResponse
|
||||
from codex_client.rest import RESTResponseType
|
||||
from codex_api_client.api_client import ApiClient, RequestSerialized
|
||||
from codex_api_client.api_response import ApiResponse
|
||||
from codex_api_client.rest import RESTResponseType
|
||||
|
||||
|
||||
class MarketplaceApi:
|
||||
@ -20,9 +20,9 @@ from pydantic import Field, StrictStr
|
||||
from typing import List, Optional
|
||||
from typing_extensions import Annotated
|
||||
|
||||
from codex_client.api_client import ApiClient, RequestSerialized
|
||||
from codex_client.api_response import ApiResponse
|
||||
from codex_client.rest import RESTResponseType
|
||||
from codex_api_client.api_client import ApiClient, RequestSerialized
|
||||
from codex_api_client.api_response import ApiResponse
|
||||
from codex_api_client.rest import RESTResponseType
|
||||
|
||||
|
||||
class NodeApi:
|
||||
@ -535,7 +535,7 @@ class NodeApi:
|
||||
|
||||
return self.api_client.param_serialize(
|
||||
method='GET',
|
||||
resource_path='/node/peerid',
|
||||
resource_path='/peerid',
|
||||
path_params=_path_params,
|
||||
query_params=_query_params,
|
||||
header_params=_header_params,
|
||||
@ -779,7 +779,7 @@ class NodeApi:
|
||||
|
||||
return self.api_client.param_serialize(
|
||||
method='GET',
|
||||
resource_path='/node/spr',
|
||||
resource_path='/spr',
|
||||
path_params=_path_params,
|
||||
query_params=_query_params,
|
||||
header_params=_header_params,
|
||||
@ -26,11 +26,11 @@ from urllib.parse import quote
|
||||
from typing import Tuple, Optional, List, Dict, Union
|
||||
from pydantic import SecretStr
|
||||
|
||||
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 (
|
||||
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 (
|
||||
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_client'
|
||||
self.user_agent = 'py_codex_api_client'
|
||||
self.client_side_validation = configuration.client_side_validation
|
||||
|
||||
def __enter__(self):
|
||||
@ -449,7 +449,7 @@ class ApiClient:
|
||||
if klass in self.NATIVE_TYPES_MAPPING:
|
||||
klass = self.NATIVE_TYPES_MAPPING[klass]
|
||||
else:
|
||||
klass = getattr(codex_client.models, klass)
|
||||
klass = getattr(codex_api_client.models, klass)
|
||||
|
||||
if klass in self.PRIMITIVE_TYPES:
|
||||
return self.__deserialize_primitive(data, klass)
|
||||
@ -120,7 +120,7 @@ class Configuration:
|
||||
self.logger = {}
|
||||
"""Logging Settings
|
||||
"""
|
||||
self.logger["package_logger"] = logging.getLogger("codex_client")
|
||||
self.logger["package_logger"] = logging.getLogger("codex_api_client")
|
||||
self.logger["urllib3_logger"] = logging.getLogger("urllib3")
|
||||
self.logger_format = '%(asctime)s %(levelname)s %(message)s'
|
||||
"""Log format
|
||||
@ -384,7 +384,7 @@ class Configuration:
|
||||
"OS: {env}\n"\
|
||||
"Python Version: {pyversion}\n"\
|
||||
"Version of the API: 0.0.1\n"\
|
||||
"SDK Package Version: 1.0.0".\
|
||||
"SDK Package Version: 0.1.0".\
|
||||
format(env=sys.platform, pyversion=sys.version)
|
||||
|
||||
def get_host_settings(self):
|
||||
37
codex_api_client/models/__init__.py
Normal file
37
codex_api_client/models/__init__.py
Normal file
@ -0,0 +1,37 @@
|
||||
# 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_create import SalesAvailabilityCREATE
|
||||
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
|
||||
@ -17,17 +17,18 @@ import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, Field, StrictInt
|
||||
from pydantic import BaseModel, ConfigDict, StrictStr
|
||||
from typing import Any, ClassVar, Dict, List, Optional
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
|
||||
class ErasureParameters(BaseModel):
|
||||
class CodexVersion(BaseModel):
|
||||
"""
|
||||
ErasureParameters
|
||||
CodexVersion
|
||||
""" # noqa: E501
|
||||
total_chunks: Optional[StrictInt] = Field(default=None, alias="totalChunks")
|
||||
__properties: ClassVar[List[str]] = ["totalChunks"]
|
||||
version: Optional[StrictStr] = None
|
||||
revision: Optional[StrictStr] = None
|
||||
__properties: ClassVar[List[str]] = ["version", "revision"]
|
||||
|
||||
model_config = ConfigDict(
|
||||
populate_by_name=True,
|
||||
@ -47,7 +48,7 @@ class ErasureParameters(BaseModel):
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||
"""Create an instance of ErasureParameters from a JSON string"""
|
||||
"""Create an instance of CodexVersion from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
@ -72,7 +73,7 @@ class ErasureParameters(BaseModel):
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||
"""Create an instance of ErasureParameters from a dict"""
|
||||
"""Create an instance of CodexVersion from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
@ -80,7 +81,8 @@ class ErasureParameters(BaseModel):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"totalChunks": obj.get("totalChunks")
|
||||
"version": obj.get("version"),
|
||||
"revision": obj.get("revision")
|
||||
})
|
||||
return _obj
|
||||
|
||||
@ -22,14 +22,12 @@ from typing import Any, ClassVar, Dict, List, Optional
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
|
||||
class PoRParameters(BaseModel):
|
||||
class Content(BaseModel):
|
||||
"""
|
||||
Parameters for Proof of Retrievability
|
||||
Parameters specifying the content
|
||||
""" # noqa: E501
|
||||
u: Optional[StrictStr] = None
|
||||
public_key: Optional[StrictStr] = Field(default=None, alias="publicKey")
|
||||
name: Optional[StrictStr] = None
|
||||
__properties: ClassVar[List[str]] = ["u", "publicKey", "name"]
|
||||
cid: Optional[StrictStr] = Field(default=None, description="Content Identifier as specified at https://github.com/multiformats/cid")
|
||||
__properties: ClassVar[List[str]] = ["cid"]
|
||||
|
||||
model_config = ConfigDict(
|
||||
populate_by_name=True,
|
||||
@ -49,7 +47,7 @@ class PoRParameters(BaseModel):
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||
"""Create an instance of PoRParameters 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]:
|
||||
@ -74,7 +72,7 @@ class PoRParameters(BaseModel):
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||
"""Create an instance of PoRParameters from a dict"""
|
||||
"""Create an instance of Content from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
@ -82,9 +80,7 @@ class PoRParameters(BaseModel):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"u": obj.get("u"),
|
||||
"publicKey": obj.get("publicKey"),
|
||||
"name": obj.get("name")
|
||||
"cid": obj.get("cid")
|
||||
})
|
||||
return _obj
|
||||
|
||||
@ -19,7 +19,7 @@ import json
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, Field, StrictStr
|
||||
from typing import Any, ClassVar, Dict, List, Optional
|
||||
from codex_client.models.manifest_item import ManifestItem
|
||||
from codex_api_client.models.manifest_item import ManifestItem
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
|
||||
@ -19,7 +19,7 @@ import json
|
||||
|
||||
from pydantic import BaseModel, ConfigDict
|
||||
from typing import Any, ClassVar, Dict, List, Optional
|
||||
from codex_client.models.data_item import DataItem
|
||||
from codex_api_client.models.data_item import DataItem
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
|
||||
@ -19,6 +19,8 @@ import json
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, Field, StrictStr
|
||||
from typing import Any, ClassVar, Dict, List, Optional
|
||||
from codex_api_client.models.codex_version import CodexVersion
|
||||
from codex_api_client.models.peers_table import PeersTable
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
|
||||
@ -30,7 +32,9 @@ class DebugInfo(BaseModel):
|
||||
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"]
|
||||
table: Optional[PeersTable] = None
|
||||
codex: Optional[CodexVersion] = None
|
||||
__properties: ClassVar[List[str]] = ["id", "addrs", "repo", "spr", "table", "codex"]
|
||||
|
||||
model_config = ConfigDict(
|
||||
populate_by_name=True,
|
||||
@ -71,6 +75,12 @@ 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
|
||||
@ -86,7 +96,9 @@ class DebugInfo(BaseModel):
|
||||
"id": obj.get("id"),
|
||||
"addrs": obj.get("addrs"),
|
||||
"repo": obj.get("repo"),
|
||||
"spr": obj.get("spr")
|
||||
"spr": obj.get("spr"),
|
||||
"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
|
||||
})
|
||||
return _obj
|
||||
|
||||
114
codex_api_client/models/manifest_item.py
Normal file
114
codex_api_client/models/manifest_item.py
Normal file
@ -0,0 +1,114 @@
|
||||
# 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: Optional[StrictStr] = Field(default=None, description="Content Identifier as specified at https://github.com/multiformats/cid", alias="treeCid")
|
||||
dataset_size: Optional[StrictInt] = Field(default=None, description="Length of original content in bytes", alias="datasetSize")
|
||||
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")
|
||||
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)")
|
||||
uploaded_at: Optional[StrictInt] = Field(default=None, description="The UTC upload timestamp in seconds", alias="uploadedAt")
|
||||
__properties: ClassVar[List[str]] = ["treeCid", "datasetSize", "blockSize", "protected", "filename", "mimetype", "uploadedAt"]
|
||||
|
||||
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
|
||||
|
||||
# set to None if uploaded_at (nullable) is None
|
||||
# and model_fields_set contains the field
|
||||
if self.uploaded_at is None and "uploaded_at" in self.model_fields_set:
|
||||
_dict['uploadedAt'] = 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"),
|
||||
"uploadedAt": obj.get("uploadedAt")
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
@ -17,20 +17,21 @@ import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr
|
||||
from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr
|
||||
from typing import Any, ClassVar, Dict, List, Optional
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
|
||||
class ManifestItem(BaseModel):
|
||||
class Node(BaseModel):
|
||||
"""
|
||||
ManifestItem
|
||||
Node
|
||||
""" # 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"]
|
||||
node_id: Optional[StrictStr] = Field(default=None, alias="nodeId")
|
||||
peer_id: Optional[StrictStr] = Field(default=None, alias="peerId")
|
||||
record: Optional[StrictStr] = None
|
||||
address: Optional[StrictStr] = None
|
||||
seen: Optional[StrictBool] = None
|
||||
__properties: ClassVar[List[str]] = ["nodeId", "peerId", "record", "address", "seen"]
|
||||
|
||||
model_config = ConfigDict(
|
||||
populate_by_name=True,
|
||||
@ -50,7 +51,7 @@ class ManifestItem(BaseModel):
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||
"""Create an instance of ManifestItem from a JSON string"""
|
||||
"""Create an instance of Node from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
@ -75,7 +76,7 @@ class ManifestItem(BaseModel):
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||
"""Create an instance of ManifestItem from a dict"""
|
||||
"""Create an instance of Node from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
@ -83,10 +84,11 @@ class ManifestItem(BaseModel):
|
||||
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")
|
||||
"nodeId": obj.get("nodeId"),
|
||||
"peerId": obj.get("peerId"),
|
||||
"record": obj.get("record"),
|
||||
"address": obj.get("address"),
|
||||
"seen": obj.get("seen")
|
||||
})
|
||||
return _obj
|
||||
|
||||
@ -17,21 +17,19 @@ import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, Field, StrictStr
|
||||
from pydantic import BaseModel, ConfigDict, Field
|
||||
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 codex_api_client.models.node import Node
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
|
||||
class Content(BaseModel):
|
||||
class PeersTable(BaseModel):
|
||||
"""
|
||||
Parameters specifying the content
|
||||
PeersTable
|
||||
""" # noqa: E501
|
||||
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"]
|
||||
local_node: Optional[Node] = Field(default=None, alias="localNode")
|
||||
nodes: Optional[List[Node]] = None
|
||||
__properties: ClassVar[List[str]] = ["localNode", "nodes"]
|
||||
|
||||
model_config = ConfigDict(
|
||||
populate_by_name=True,
|
||||
@ -51,7 +49,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 PeersTable from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
@ -72,17 +70,21 @@ class Content(BaseModel):
|
||||
exclude=excluded_fields,
|
||||
exclude_none=True,
|
||||
)
|
||||
# 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()
|
||||
# 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
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||
"""Create an instance of Content from a dict"""
|
||||
"""Create an instance of PeersTable from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
@ -90,9 +92,8 @@ class Content(BaseModel):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"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
|
||||
"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
|
||||
})
|
||||
return _obj
|
||||
|
||||
@ -19,7 +19,7 @@ import json
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
|
||||
from typing import Any, ClassVar, Dict, List, Optional
|
||||
from codex_client.models.storage_request import StorageRequest
|
||||
from codex_api_client.models.storage_request import StorageRequest
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
|
||||
@ -30,7 +30,7 @@ class SalesAvailability(BaseModel):
|
||||
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")
|
||||
min_price: Optional[StrictStr] = Field(default=None, description="Minimal price paid (in amount of tokens) for the whole hosted request's slot for the request's duration as decimal string", alias="minPrice")
|
||||
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"]
|
||||
|
||||
@ -30,7 +30,7 @@ class SalesAvailabilityCREATE(BaseModel):
|
||||
id: Optional[Annotated[str, Field(min_length=66, strict=True, max_length=66)]] = Field(default=None, description="32bits identifier encoded in hex-decimal string.")
|
||||
total_size: StrictStr = Field(description="Total size of availability's storage in bytes as decimal string", alias="totalSize")
|
||||
duration: StrictStr = Field(description="The duration of the request in seconds as decimal string")
|
||||
min_price: StrictStr = Field(description="Minimum price to be paid (in amount of tokens) as decimal string", alias="minPrice")
|
||||
min_price: StrictStr = Field(description="Minimal price paid (in amount of tokens) for the whole hosted request's slot for the request's duration as decimal string", alias="minPrice")
|
||||
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"]
|
||||
|
||||
@ -30,7 +30,7 @@ class SalesAvailabilityREAD(BaseModel):
|
||||
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")
|
||||
min_price: Optional[StrictStr] = Field(default=None, description="Minimal price paid (in amount of tokens) for the whole hosted request's slot for the request's duration as decimal string", alias="minPrice")
|
||||
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"]
|
||||
@ -19,7 +19,7 @@ import json
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, Field, StrictStr
|
||||
from typing import Any, ClassVar, Dict, List, Optional
|
||||
from codex_client.models.storage_request import StorageRequest
|
||||
from codex_api_client.models.storage_request import StorageRequest
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
|
||||
@ -20,8 +20,8 @@ import json
|
||||
from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
|
||||
from typing import Any, ClassVar, Dict, List, Optional
|
||||
from typing_extensions import Annotated
|
||||
from codex_client.models.reservation import Reservation
|
||||
from codex_client.models.storage_request import StorageRequest
|
||||
from codex_api_client.models.reservation import Reservation
|
||||
from codex_api_client.models.storage_request import StorageRequest
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
|
||||
@ -27,9 +27,9 @@ class Space(BaseModel):
|
||||
Space
|
||||
""" # noqa: E501
|
||||
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")
|
||||
quota_max_bytes: Optional[StrictInt] = Field(default=None, description="Maximum storage space (in bytes) available for the node in Codex's local repository.", alias="quotaMaxBytes")
|
||||
quota_used_bytes: Optional[StrictInt] = Field(default=None, description="Amount of storage space (in bytes) currently used for storing files in Codex's local repository.", alias="quotaUsedBytes")
|
||||
quota_reserved_bytes: Optional[StrictInt] = Field(default=None, 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")
|
||||
__properties: ClassVar[List[str]] = ["totalBlocks", "quotaMaxBytes", "quotaUsedBytes", "quotaReservedBytes"]
|
||||
|
||||
model_config = ConfigDict(
|
||||
@ -19,8 +19,8 @@ import json
|
||||
|
||||
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 codex_api_client.models.content import Content
|
||||
from codex_api_client.models.storage_ask import StorageAsk
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
|
||||
@ -19,7 +19,7 @@ import ssl
|
||||
|
||||
import urllib3
|
||||
|
||||
from codex_client.exceptions import ApiException, ApiValueError
|
||||
from codex_api_client.exceptions import ApiException, ApiValueError
|
||||
|
||||
SUPPORTED_SOCKS_PROXIES = {"socks5", "socks5h", "socks4", "socks4a"}
|
||||
RESTResponseType = urllib3.HTTPResponse
|
||||
@ -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__ = "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
|
||||
@ -1,8 +0,0 @@
|
||||
# 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
|
||||
|
||||
@ -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_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
|
||||
30
docs/CodexVersion.md
Normal file
30
docs/CodexVersion.md
Normal file
@ -0,0 +1,30 @@
|
||||
# CodexVersion
|
||||
|
||||
|
||||
## Properties
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**version** | **str** | | [optional]
|
||||
**revision** | **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)
|
||||
|
||||
|
||||
@ -7,13 +7,11 @@ Parameters specifying the content
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**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_client.models.content import Content
|
||||
from codex_api_client.models.content import Content
|
||||
|
||||
# TODO update the JSON string below
|
||||
json = "{}"
|
||||
|
||||
215
docs/DataApi.md
215
docs/DataApi.md
@ -1,11 +1,13 @@
|
||||
# codex_client.DataApi
|
||||
# codex_api_client.DataApi
|
||||
|
||||
All URIs are relative to *http://localhost:8080/api/codex/v1*
|
||||
|
||||
Method | HTTP request | Description
|
||||
------------- | ------------- | -------------
|
||||
[**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) | **GET** /data/{cid}/network | Download a file from the network in a streaming manner. If the file is not available locally, it will be retrieved from other nodes in the network if able.
|
||||
[**download_network**](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.
|
||||
[**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's not available locally.
|
||||
[**download_network_stream**](DataApi.md#download_network_stream) | **GET** /data/{cid}/network/stream | Download a file from the network in a streaming manner. If the file is not available locally, it will be retrieved from other nodes in the network if able.
|
||||
[**list_data**](DataApi.md#list_data) | **GET** /data | Lists manifest CIDs stored locally in node.
|
||||
[**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.
|
||||
@ -20,21 +22,21 @@ Download a file from the local node in a streaming manner. If the file is not av
|
||||
|
||||
|
||||
```python
|
||||
import codex_client
|
||||
from codex_client.rest import ApiException
|
||||
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_client.Configuration(
|
||||
configuration = codex_api_client.Configuration(
|
||||
host = "http://localhost:8080/api/codex/v1"
|
||||
)
|
||||
|
||||
|
||||
# Enter a context with an instance of the API client
|
||||
with codex_client.ApiClient(configuration) as api_client:
|
||||
with codex_api_client.ApiClient(configuration) as api_client:
|
||||
# Create an instance of the API class
|
||||
api_instance = codex_client.DataApi(api_client)
|
||||
api_instance = codex_api_client.DataApi(api_client)
|
||||
cid = 'cid_example' # str | File to be downloaded.
|
||||
|
||||
try:
|
||||
@ -80,7 +82,145 @@ 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**
|
||||
> bytearray download_network(cid)
|
||||
> 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)
|
||||
|
||||
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.
|
||||
|
||||
@ -88,30 +228,30 @@ Download a file from the network in a streaming manner. If the file is not avail
|
||||
|
||||
|
||||
```python
|
||||
import codex_client
|
||||
from codex_client.rest import ApiException
|
||||
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_client.Configuration(
|
||||
configuration = codex_api_client.Configuration(
|
||||
host = "http://localhost:8080/api/codex/v1"
|
||||
)
|
||||
|
||||
|
||||
# Enter a context with an instance of the API client
|
||||
with codex_client.ApiClient(configuration) as api_client:
|
||||
with codex_api_client.ApiClient(configuration) as api_client:
|
||||
# Create an instance of the API class
|
||||
api_instance = codex_client.DataApi(api_client)
|
||||
api_instance = codex_api_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(cid)
|
||||
print("The response of DataApi->download_network:\n")
|
||||
api_response = api_instance.download_network_stream(cid)
|
||||
print("The response of DataApi->download_network_stream:\n")
|
||||
pprint(api_response)
|
||||
except Exception as e:
|
||||
print("Exception when calling DataApi->download_network: %s\n" % e)
|
||||
print("Exception when calling DataApi->download_network_stream: %s\n" % e)
|
||||
```
|
||||
|
||||
|
||||
@ -156,22 +296,22 @@ Lists manifest CIDs stored locally in node.
|
||||
|
||||
|
||||
```python
|
||||
import codex_client
|
||||
from codex_client.models.data_list import DataList
|
||||
from codex_client.rest import ApiException
|
||||
import codex_api_client
|
||||
from codex_api_client.models.data_list import DataList
|
||||
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_client.Configuration(
|
||||
configuration = codex_api_client.Configuration(
|
||||
host = "http://localhost:8080/api/codex/v1"
|
||||
)
|
||||
|
||||
|
||||
# Enter a context with an instance of the API client
|
||||
with codex_client.ApiClient(configuration) as api_client:
|
||||
with codex_api_client.ApiClient(configuration) as api_client:
|
||||
# Create an instance of the API class
|
||||
api_instance = codex_client.DataApi(api_client)
|
||||
api_instance = codex_api_client.DataApi(api_client)
|
||||
|
||||
try:
|
||||
# Lists manifest CIDs stored locally in node.
|
||||
@ -208,6 +348,7 @@ 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)
|
||||
@ -221,22 +362,22 @@ Gets a summary of the storage space allocation of the node.
|
||||
|
||||
|
||||
```python
|
||||
import codex_client
|
||||
from codex_client.models.space import Space
|
||||
from codex_client.rest import ApiException
|
||||
import codex_api_client
|
||||
from codex_api_client.models.space import Space
|
||||
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_client.Configuration(
|
||||
configuration = codex_api_client.Configuration(
|
||||
host = "http://localhost:8080/api/codex/v1"
|
||||
)
|
||||
|
||||
|
||||
# Enter a context with an instance of the API client
|
||||
with codex_client.ApiClient(configuration) as api_client:
|
||||
with codex_api_client.ApiClient(configuration) as api_client:
|
||||
# Create an instance of the API class
|
||||
api_instance = codex_client.DataApi(api_client)
|
||||
api_instance = codex_api_client.DataApi(api_client)
|
||||
|
||||
try:
|
||||
# Gets a summary of the storage space allocation of the node.
|
||||
@ -276,7 +417,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(body=body)
|
||||
> str upload(content_type=content_type, content_disposition=content_disposition, 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.
|
||||
|
||||
@ -284,26 +425,28 @@ Upload a file in a streaming manner. Once finished, the file is stored in the no
|
||||
|
||||
|
||||
```python
|
||||
import codex_client
|
||||
from codex_client.rest import ApiException
|
||||
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_client.Configuration(
|
||||
configuration = codex_api_client.Configuration(
|
||||
host = "http://localhost:8080/api/codex/v1"
|
||||
)
|
||||
|
||||
|
||||
# Enter a context with an instance of the API client
|
||||
with codex_client.ApiClient(configuration) as api_client:
|
||||
with codex_api_client.ApiClient(configuration) as api_client:
|
||||
# Create an instance of the API class
|
||||
api_instance = codex_client.DataApi(api_client)
|
||||
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)
|
||||
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(body=body)
|
||||
api_response = api_instance.upload(content_type=content_type, content_disposition=content_disposition, body=body)
|
||||
print("The response of DataApi->upload:\n")
|
||||
pprint(api_response)
|
||||
except Exception as e:
|
||||
@ -317,6 +460,8 @@ with codex_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
|
||||
|
||||
@ -11,7 +11,7 @@ Name | Type | Description | Notes
|
||||
## Example
|
||||
|
||||
```python
|
||||
from codex_client.models.data_item import DataItem
|
||||
from codex_api_client.models.data_item import DataItem
|
||||
|
||||
# TODO update the JSON string below
|
||||
json = "{}"
|
||||
|
||||
@ -10,7 +10,7 @@ Name | Type | Description | Notes
|
||||
## Example
|
||||
|
||||
```python
|
||||
from codex_client.models.data_list import DataList
|
||||
from codex_api_client.models.data_list import DataList
|
||||
|
||||
# TODO update the JSON string below
|
||||
json = "{}"
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
# codex_client.DebugApi
|
||||
# codex_api_client.DebugApi
|
||||
|
||||
All URIs are relative to *http://localhost:8080/api/codex/v1*
|
||||
|
||||
@ -17,22 +17,22 @@ Gets node information
|
||||
|
||||
|
||||
```python
|
||||
import codex_client
|
||||
from codex_client.models.debug_info import DebugInfo
|
||||
from codex_client.rest import ApiException
|
||||
import codex_api_client
|
||||
from codex_api_client.models.debug_info import DebugInfo
|
||||
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_client.Configuration(
|
||||
configuration = codex_api_client.Configuration(
|
||||
host = "http://localhost:8080/api/codex/v1"
|
||||
)
|
||||
|
||||
|
||||
# Enter a context with an instance of the API client
|
||||
with codex_client.ApiClient(configuration) as api_client:
|
||||
with codex_api_client.ApiClient(configuration) as api_client:
|
||||
# Create an instance of the API class
|
||||
api_instance = codex_client.DebugApi(api_client)
|
||||
api_instance = codex_api_client.DebugApi(api_client)
|
||||
|
||||
try:
|
||||
# Gets node information
|
||||
@ -79,21 +79,21 @@ Set log level at run time
|
||||
|
||||
|
||||
```python
|
||||
import codex_client
|
||||
from codex_client.rest import ApiException
|
||||
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_client.Configuration(
|
||||
configuration = codex_api_client.Configuration(
|
||||
host = "http://localhost:8080/api/codex/v1"
|
||||
)
|
||||
|
||||
|
||||
# Enter a context with an instance of the API client
|
||||
with codex_client.ApiClient(configuration) as api_client:
|
||||
with codex_api_client.ApiClient(configuration) as api_client:
|
||||
# Create an instance of the API class
|
||||
api_instance = codex_client.DebugApi(api_client)
|
||||
api_instance = codex_api_client.DebugApi(api_client)
|
||||
level = 'level_example' # str |
|
||||
|
||||
try:
|
||||
|
||||
@ -9,11 +9,13 @@ Name | Type | Description | Notes
|
||||
**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]
|
||||
**table** | [**PeersTable**](PeersTable.md) | | [optional]
|
||||
**codex** | [**CodexVersion**](CodexVersion.md) | | [optional]
|
||||
|
||||
## Example
|
||||
|
||||
```python
|
||||
from codex_client.models.debug_info import DebugInfo
|
||||
from codex_api_client.models.debug_info import DebugInfo
|
||||
|
||||
# TODO update the JSON string below
|
||||
json = "{}"
|
||||
|
||||
@ -5,15 +5,18 @@
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**root_hash** | **str** | Content Identifier as specified at https://github.com/multiformats/cid | [optional]
|
||||
**original_bytes** | **int** | Length of original content in bytes | [optional]
|
||||
**tree_cid** | **str** | Content Identifier as specified at https://github.com/multiformats/cid | [optional]
|
||||
**dataset_size** | **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]
|
||||
**filename** | **str** | The original name of the uploaded content (optional) | [optional]
|
||||
**mimetype** | **str** | The original mimetype of the uploaded content (optional) | [optional]
|
||||
**uploaded_at** | **int** | The UTC upload timestamp in seconds | [optional]
|
||||
|
||||
## Example
|
||||
|
||||
```python
|
||||
from codex_client.models.manifest_item import ManifestItem
|
||||
from codex_api_client.models.manifest_item import ManifestItem
|
||||
|
||||
# TODO update the JSON string below
|
||||
json = "{}"
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
# codex_client.MarketplaceApi
|
||||
# codex_api_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_client
|
||||
from codex_client.models.storage_request_creation import StorageRequestCreation
|
||||
from codex_client.rest import ApiException
|
||||
import codex_api_client
|
||||
from codex_api_client.models.storage_request_creation import StorageRequestCreation
|
||||
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_client.Configuration(
|
||||
configuration = codex_api_client.Configuration(
|
||||
host = "http://localhost:8080/api/codex/v1"
|
||||
)
|
||||
|
||||
|
||||
# Enter a context with an instance of the API client
|
||||
with codex_client.ApiClient(configuration) as api_client:
|
||||
with codex_api_client.ApiClient(configuration) as api_client:
|
||||
# Create an instance of the API class
|
||||
api_instance = codex_client.MarketplaceApi(api_client)
|
||||
api_instance = codex_api_client.MarketplaceApi(api_client)
|
||||
cid = 'cid_example' # str | CID of the uploaded data that should be stored
|
||||
storage_request_creation = codex_client.StorageRequestCreation() # StorageRequestCreation | (optional)
|
||||
storage_request_creation = codex_api_client.StorageRequestCreation() # StorageRequestCreation | (optional)
|
||||
|
||||
try:
|
||||
# Creates a new Request for storage
|
||||
@ -95,22 +95,22 @@ Returns active slot with id {slotId} for the host
|
||||
|
||||
|
||||
```python
|
||||
import codex_client
|
||||
from codex_client.models.slot_agent import SlotAgent
|
||||
from codex_client.rest import ApiException
|
||||
import codex_api_client
|
||||
from codex_api_client.models.slot_agent import SlotAgent
|
||||
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_client.Configuration(
|
||||
configuration = codex_api_client.Configuration(
|
||||
host = "http://localhost:8080/api/codex/v1"
|
||||
)
|
||||
|
||||
|
||||
# Enter a context with an instance of the API client
|
||||
with codex_client.ApiClient(configuration) as api_client:
|
||||
with codex_api_client.ApiClient(configuration) as api_client:
|
||||
# Create an instance of the API class
|
||||
api_instance = codex_client.MarketplaceApi(api_client)
|
||||
api_instance = codex_api_client.MarketplaceApi(api_client)
|
||||
slot_id = 'slot_id_example' # str | File to be downloaded.
|
||||
|
||||
try:
|
||||
@ -164,22 +164,22 @@ Returns active slots
|
||||
|
||||
|
||||
```python
|
||||
import codex_client
|
||||
from codex_client.models.slot import Slot
|
||||
from codex_client.rest import ApiException
|
||||
import codex_api_client
|
||||
from codex_api_client.models.slot import Slot
|
||||
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_client.Configuration(
|
||||
configuration = codex_api_client.Configuration(
|
||||
host = "http://localhost:8080/api/codex/v1"
|
||||
)
|
||||
|
||||
|
||||
# Enter a context with an instance of the API client
|
||||
with codex_client.ApiClient(configuration) as api_client:
|
||||
with codex_api_client.ApiClient(configuration) as api_client:
|
||||
# Create an instance of the API class
|
||||
api_instance = codex_client.MarketplaceApi(api_client)
|
||||
api_instance = codex_api_client.MarketplaceApi(api_client)
|
||||
|
||||
try:
|
||||
# Returns active slots
|
||||
@ -227,22 +227,22 @@ Returns storage that is for sale
|
||||
|
||||
|
||||
```python
|
||||
import codex_client
|
||||
from codex_client.models.sales_availability_read import SalesAvailabilityREAD
|
||||
from codex_client.rest import ApiException
|
||||
import codex_api_client
|
||||
from codex_api_client.models.sales_availability_read import SalesAvailabilityREAD
|
||||
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_client.Configuration(
|
||||
configuration = codex_api_client.Configuration(
|
||||
host = "http://localhost:8080/api/codex/v1"
|
||||
)
|
||||
|
||||
|
||||
# Enter a context with an instance of the API client
|
||||
with codex_client.ApiClient(configuration) as api_client:
|
||||
with codex_api_client.ApiClient(configuration) as api_client:
|
||||
# Create an instance of the API class
|
||||
api_instance = codex_client.MarketplaceApi(api_client)
|
||||
api_instance = codex_api_client.MarketplaceApi(api_client)
|
||||
|
||||
try:
|
||||
# Returns storage that is for sale
|
||||
@ -291,22 +291,22 @@ Returns purchase details
|
||||
|
||||
|
||||
```python
|
||||
import codex_client
|
||||
from codex_client.models.purchase import Purchase
|
||||
from codex_client.rest import ApiException
|
||||
import codex_api_client
|
||||
from codex_api_client.models.purchase import Purchase
|
||||
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_client.Configuration(
|
||||
configuration = codex_api_client.Configuration(
|
||||
host = "http://localhost:8080/api/codex/v1"
|
||||
)
|
||||
|
||||
|
||||
# Enter a context with an instance of the API client
|
||||
with codex_client.ApiClient(configuration) as api_client:
|
||||
with codex_api_client.ApiClient(configuration) as api_client:
|
||||
# Create an instance of the API class
|
||||
api_instance = codex_client.MarketplaceApi(api_client)
|
||||
api_instance = codex_api_client.MarketplaceApi(api_client)
|
||||
id = 'id_example' # str | Hexadecimal ID of a Purchase
|
||||
|
||||
try:
|
||||
@ -360,21 +360,21 @@ Returns list of purchase IDs
|
||||
|
||||
|
||||
```python
|
||||
import codex_client
|
||||
from codex_client.rest import ApiException
|
||||
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_client.Configuration(
|
||||
configuration = codex_api_client.Configuration(
|
||||
host = "http://localhost:8080/api/codex/v1"
|
||||
)
|
||||
|
||||
|
||||
# Enter a context with an instance of the API client
|
||||
with codex_client.ApiClient(configuration) as api_client:
|
||||
with codex_api_client.ApiClient(configuration) as api_client:
|
||||
# Create an instance of the API class
|
||||
api_instance = codex_client.MarketplaceApi(api_client)
|
||||
api_instance = codex_api_client.MarketplaceApi(api_client)
|
||||
|
||||
try:
|
||||
# Returns list of purchase IDs
|
||||
@ -424,22 +424,22 @@ Return's list of Reservations for ongoing Storage Requests that the node hosts.
|
||||
|
||||
|
||||
```python
|
||||
import codex_client
|
||||
from codex_client.models.reservation import Reservation
|
||||
from codex_client.rest import ApiException
|
||||
import codex_api_client
|
||||
from codex_api_client.models.reservation import Reservation
|
||||
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_client.Configuration(
|
||||
configuration = codex_api_client.Configuration(
|
||||
host = "http://localhost:8080/api/codex/v1"
|
||||
)
|
||||
|
||||
|
||||
# Enter a context with an instance of the API client
|
||||
with codex_client.ApiClient(configuration) as api_client:
|
||||
with codex_api_client.ApiClient(configuration) as api_client:
|
||||
# Create an instance of the API class
|
||||
api_instance = codex_client.MarketplaceApi(api_client)
|
||||
api_instance = codex_api_client.MarketplaceApi(api_client)
|
||||
id = 'id_example' # str | ID of Availability
|
||||
|
||||
try:
|
||||
@ -494,24 +494,24 @@ Offers storage for sale
|
||||
|
||||
|
||||
```python
|
||||
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
|
||||
import codex_api_client
|
||||
from codex_api_client.models.sales_availability_create import SalesAvailabilityCREATE
|
||||
from codex_api_client.models.sales_availability_read import SalesAvailabilityREAD
|
||||
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_client.Configuration(
|
||||
configuration = codex_api_client.Configuration(
|
||||
host = "http://localhost:8080/api/codex/v1"
|
||||
)
|
||||
|
||||
|
||||
# Enter a context with an instance of the API client
|
||||
with codex_client.ApiClient(configuration) as api_client:
|
||||
with codex_api_client.ApiClient(configuration) as api_client:
|
||||
# Create an instance of the API class
|
||||
api_instance = codex_client.MarketplaceApi(api_client)
|
||||
sales_availability_create = codex_client.SalesAvailabilityCREATE() # SalesAvailabilityCREATE | (optional)
|
||||
api_instance = codex_api_client.MarketplaceApi(api_client)
|
||||
sales_availability_create = codex_api_client.SalesAvailabilityCREATE() # SalesAvailabilityCREATE | (optional)
|
||||
|
||||
try:
|
||||
# Offers storage for sale
|
||||
@ -567,24 +567,24 @@ The new parameters will be only considered for new requests. Existing Requests l
|
||||
|
||||
|
||||
```python
|
||||
import codex_client
|
||||
from codex_client.models.sales_availability import SalesAvailability
|
||||
from codex_client.rest import ApiException
|
||||
import codex_api_client
|
||||
from codex_api_client.models.sales_availability import SalesAvailability
|
||||
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_client.Configuration(
|
||||
configuration = codex_api_client.Configuration(
|
||||
host = "http://localhost:8080/api/codex/v1"
|
||||
)
|
||||
|
||||
|
||||
# Enter a context with an instance of the API client
|
||||
with codex_client.ApiClient(configuration) as api_client:
|
||||
with codex_api_client.ApiClient(configuration) as api_client:
|
||||
# Create an instance of the API class
|
||||
api_instance = codex_client.MarketplaceApi(api_client)
|
||||
api_instance = codex_api_client.MarketplaceApi(api_client)
|
||||
id = 'id_example' # str | ID of Availability
|
||||
sales_availability = codex_client.SalesAvailability() # SalesAvailability | (optional)
|
||||
sales_availability = codex_api_client.SalesAvailability() # SalesAvailability | (optional)
|
||||
|
||||
try:
|
||||
# Updates availability
|
||||
|
||||
33
docs/Node.md
Normal file
33
docs/Node.md
Normal file
@ -0,0 +1,33 @@
|
||||
# Node
|
||||
|
||||
|
||||
## Properties
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**node_id** | **str** | | [optional]
|
||||
**peer_id** | **str** | | [optional]
|
||||
**record** | **str** | | [optional]
|
||||
**address** | **str** | | [optional]
|
||||
**seen** | **bool** | | [optional]
|
||||
|
||||
## 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)
|
||||
|
||||
|
||||
@ -1,12 +1,12 @@
|
||||
# codex_client.NodeApi
|
||||
# codex_api_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** /node/peerid | Get Node's PeerID
|
||||
[**get_spr**](NodeApi.md#get_spr) | **GET** /node/spr | Get Node's SPR
|
||||
[**get_peer_id**](NodeApi.md#get_peer_id) | **GET** /peerid | Get Node's PeerID
|
||||
[**get_spr**](NodeApi.md#get_spr) | **GET** /spr | Get Node's SPR
|
||||
|
||||
|
||||
# **connect_peer**
|
||||
@ -20,21 +20,21 @@ If `addrs` param is supplied, it will be used to dial the peer, otherwise the `p
|
||||
|
||||
|
||||
```python
|
||||
import codex_client
|
||||
from codex_client.rest import ApiException
|
||||
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_client.Configuration(
|
||||
configuration = codex_api_client.Configuration(
|
||||
host = "http://localhost:8080/api/codex/v1"
|
||||
)
|
||||
|
||||
|
||||
# Enter a context with an instance of the API client
|
||||
with codex_client.ApiClient(configuration) as api_client:
|
||||
with codex_api_client.ApiClient(configuration) as api_client:
|
||||
# Create an instance of the API class
|
||||
api_instance = codex_client.NodeApi(api_client)
|
||||
api_instance = codex_api_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)
|
||||
|
||||
@ -86,21 +86,21 @@ Get Node's PeerID
|
||||
|
||||
|
||||
```python
|
||||
import codex_client
|
||||
from codex_client.rest import ApiException
|
||||
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_client.Configuration(
|
||||
configuration = codex_api_client.Configuration(
|
||||
host = "http://localhost:8080/api/codex/v1"
|
||||
)
|
||||
|
||||
|
||||
# Enter a context with an instance of the API client
|
||||
with codex_client.ApiClient(configuration) as api_client:
|
||||
with codex_api_client.ApiClient(configuration) as api_client:
|
||||
# Create an instance of the API class
|
||||
api_instance = codex_client.NodeApi(api_client)
|
||||
api_instance = codex_api_client.NodeApi(api_client)
|
||||
|
||||
try:
|
||||
# Get Node's PeerID
|
||||
@ -147,21 +147,21 @@ Get Node's SPR
|
||||
|
||||
|
||||
```python
|
||||
import codex_client
|
||||
from codex_client.rest import ApiException
|
||||
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_client.Configuration(
|
||||
configuration = codex_api_client.Configuration(
|
||||
host = "http://localhost:8080/api/codex/v1"
|
||||
)
|
||||
|
||||
|
||||
# Enter a context with an instance of the API client
|
||||
with codex_client.ApiClient(configuration) as api_client:
|
||||
with codex_api_client.ApiClient(configuration) as api_client:
|
||||
# Create an instance of the API class
|
||||
api_instance = codex_client.NodeApi(api_client)
|
||||
api_instance = codex_api_client.NodeApi(api_client)
|
||||
|
||||
try:
|
||||
# Get Node's SPR
|
||||
|
||||
@ -10,7 +10,7 @@ Name | Type | Description | Notes
|
||||
## Example
|
||||
|
||||
```python
|
||||
from codex_client.models.peer_id_read import PeerIdRead
|
||||
from codex_api_client.models.peer_id_read import PeerIdRead
|
||||
|
||||
# TODO update the JSON string below
|
||||
json = "{}"
|
||||
|
||||
30
docs/PeersTable.md
Normal file
30
docs/PeersTable.md
Normal file
@ -0,0 +1,30 @@
|
||||
# PeersTable
|
||||
|
||||
|
||||
## Properties
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**local_node** | [**Node**](Node.md) | | [optional]
|
||||
**nodes** | [**List[Node]**](Node.md) | | [optional]
|
||||
|
||||
## 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)
|
||||
|
||||
|
||||
@ -12,7 +12,7 @@ Name | Type | Description | Notes
|
||||
## Example
|
||||
|
||||
```python
|
||||
from codex_client.models.purchase import Purchase
|
||||
from codex_api_client.models.purchase import Purchase
|
||||
|
||||
# TODO update the JSON string below
|
||||
json = "{}"
|
||||
|
||||
@ -14,7 +14,7 @@ Name | Type | Description | Notes
|
||||
## Example
|
||||
|
||||
```python
|
||||
from codex_client.models.reservation import Reservation
|
||||
from codex_api_client.models.reservation import Reservation
|
||||
|
||||
# TODO update the JSON string below
|
||||
json = "{}"
|
||||
|
||||
@ -10,7 +10,7 @@ Name | Type | Description | Notes
|
||||
## Example
|
||||
|
||||
```python
|
||||
from codex_client.models.spr_read import SPRRead
|
||||
from codex_api_client.models.spr_read import SPRRead
|
||||
|
||||
# TODO update the JSON string below
|
||||
json = "{}"
|
||||
|
||||
@ -8,13 +8,13 @@ Name | Type | Description | Notes
|
||||
**id** | **str** | 32bits identifier encoded in hex-decimal string. | [optional]
|
||||
**total_size** | **str** | Total size of availability'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]
|
||||
**min_price** | **str** | Minimal price paid (in amount of tokens) for the whole hosted request's slot for the request's duration 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_client.models.sales_availability import SalesAvailability
|
||||
from codex_api_client.models.sales_availability import SalesAvailability
|
||||
|
||||
# TODO update the JSON string below
|
||||
json = "{}"
|
||||
|
||||
@ -8,13 +8,13 @@ Name | Type | Description | Notes
|
||||
**id** | **str** | 32bits identifier encoded in hex-decimal string. | [optional]
|
||||
**total_size** | **str** | Total size of availability'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 |
|
||||
**min_price** | **str** | Minimal price paid (in amount of tokens) for the whole hosted request's slot for the request's duration 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_client.models.sales_availability_create import SalesAvailabilityCREATE
|
||||
from codex_api_client.models.sales_availability_create import SalesAvailabilityCREATE
|
||||
|
||||
# TODO update the JSON string below
|
||||
json = "{}"
|
||||
|
||||
@ -8,14 +8,14 @@ Name | Type | Description | Notes
|
||||
**id** | **str** | 32bits identifier encoded in hex-decimal string. | [optional]
|
||||
**total_size** | **str** | Total size of availability'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]
|
||||
**min_price** | **str** | Minimal price paid (in amount of tokens) for the whole hosted request's slot for the request's duration 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's storage in bytes as decimal string | [optional]
|
||||
|
||||
## Example
|
||||
|
||||
```python
|
||||
from codex_client.models.sales_availability_read import SalesAvailabilityREAD
|
||||
from codex_api_client.models.sales_availability_read import SalesAvailabilityREAD
|
||||
|
||||
# TODO update the JSON string below
|
||||
json = "{}"
|
||||
|
||||
@ -12,7 +12,7 @@ Name | Type | Description | Notes
|
||||
## Example
|
||||
|
||||
```python
|
||||
from codex_client.models.slot import Slot
|
||||
from codex_api_client.models.slot import Slot
|
||||
|
||||
# TODO update the JSON string below
|
||||
json = "{}"
|
||||
|
||||
@ -15,7 +15,7 @@ Name | Type | Description | Notes
|
||||
## Example
|
||||
|
||||
```python
|
||||
from codex_client.models.slot_agent import SlotAgent
|
||||
from codex_api_client.models.slot_agent import SlotAgent
|
||||
|
||||
# TODO update the JSON string below
|
||||
json = "{}"
|
||||
|
||||
@ -6,14 +6,14 @@
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**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]
|
||||
**quota_max_bytes** | **int** | Maximum storage space (in bytes) available for the node in Codex's local repository. | [optional]
|
||||
**quota_used_bytes** | **int** | Amount of storage space (in bytes) currently used for storing files in Codex's local repository. | [optional]
|
||||
**quota_reserved_bytes** | **int** | 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. | [optional]
|
||||
|
||||
## Example
|
||||
|
||||
```python
|
||||
from codex_client.models.space import Space
|
||||
from codex_api_client.models.space import Space
|
||||
|
||||
# TODO update the JSON string below
|
||||
json = "{}"
|
||||
|
||||
@ -15,7 +15,7 @@ Name | Type | Description | Notes
|
||||
## Example
|
||||
|
||||
```python
|
||||
from codex_client.models.storage_ask import StorageAsk
|
||||
from codex_api_client.models.storage_ask import StorageAsk
|
||||
|
||||
# TODO update the JSON string below
|
||||
json = "{}"
|
||||
|
||||
@ -15,7 +15,7 @@ Name | Type | Description | Notes
|
||||
## Example
|
||||
|
||||
```python
|
||||
from codex_client.models.storage_request import StorageRequest
|
||||
from codex_api_client.models.storage_request import StorageRequest
|
||||
|
||||
# TODO update the JSON string below
|
||||
json = "{}"
|
||||
|
||||
@ -16,7 +16,7 @@ Name | Type | Description | Notes
|
||||
## Example
|
||||
|
||||
```python
|
||||
from codex_client.models.storage_request_creation import StorageRequestCreation
|
||||
from codex_api_client.models.storage_request_creation import StorageRequestCreation
|
||||
|
||||
# TODO update the JSON string below
|
||||
json = "{}"
|
||||
|
||||
13
generate.sh
13
generate.sh
@ -1,8 +1,15 @@
|
||||
#!/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_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
|
||||
--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
|
||||
|
||||
57
git_push.sh
57
git_push.sh
@ -1,57 +0,0 @@
|
||||
#!/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'
|
||||
@ -1,13 +1,13 @@
|
||||
[tool.poetry]
|
||||
name = "codex_client"
|
||||
version = "1.0.0"
|
||||
name = "codex_api_client"
|
||||
version = "0.1.0"
|
||||
description = "Codex API"
|
||||
authors = ["OpenAPI Generator Community <team@openapitools.org>"]
|
||||
license = "NoLicense"
|
||||
readme = "README.md"
|
||||
repository = "https://github.com/auhau/py-codex-api"
|
||||
repository = "https://github.com/codex-storage/py-codex-api-client"
|
||||
keywords = ["OpenAPI", "OpenAPI-Generator", "Codex API"]
|
||||
include = ["codex_client/py.typed"]
|
||||
include = ["codex_api_client/py.typed"]
|
||||
|
||||
[tool.poetry.dependencies]
|
||||
python = "^3.7"
|
||||
@ -34,7 +34,7 @@ extension-pkg-whitelist = "pydantic"
|
||||
|
||||
[tool.mypy]
|
||||
files = [
|
||||
"codex_client",
|
||||
"codex_api_client",
|
||||
#"test", # auto-generated tests
|
||||
"tests", # hand-written tests
|
||||
]
|
||||
|
||||
6
setup.py
6
setup.py
@ -21,7 +21,7 @@ from setuptools import setup, find_packages # noqa: H301
|
||||
# prerequisite: setuptools
|
||||
# http://pypi.python.org/pypi/setuptools
|
||||
NAME = "Codex API Client"
|
||||
VERSION = "1.0.0"
|
||||
VERSION = "0.1.0"
|
||||
PYTHON_REQUIRES = ">=3.7"
|
||||
REQUIRES = [
|
||||
"urllib3 >= 1.25.3, < 2.1.0",
|
||||
@ -36,7 +36,7 @@ setup(
|
||||
description="Codex API",
|
||||
author="OpenAPI Generator community",
|
||||
author_email="team@openapitools.org",
|
||||
url="https://github.com/AuHau/py-codex-api",
|
||||
url="https://github.com/codex-storage/py-codex-api-client",
|
||||
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_client": ["py.typed"]},
|
||||
package_data={"codex_api_client": ["py.typed"]},
|
||||
)
|
||||
|
||||
52
test/test_codex_version.py
Normal file
52
test/test_codex_version.py
Normal file
@ -0,0 +1,52 @@
|
||||
# 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.codex_version import CodexVersion
|
||||
|
||||
class TestCodexVersion(unittest.TestCase):
|
||||
"""CodexVersion unit test stubs"""
|
||||
|
||||
def setUp(self):
|
||||
pass
|
||||
|
||||
def tearDown(self):
|
||||
pass
|
||||
|
||||
def make_instance(self, include_optional) -> CodexVersion:
|
||||
"""Test CodexVersion
|
||||
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`
|
||||
"""
|
||||
model = CodexVersion()
|
||||
if include_optional:
|
||||
return CodexVersion(
|
||||
version = 'v0.1.7',
|
||||
revision = '0c647d8'
|
||||
)
|
||||
else:
|
||||
return CodexVersion(
|
||||
)
|
||||
"""
|
||||
|
||||
def testCodexVersion(self):
|
||||
"""Test CodexVersion"""
|
||||
# inst_req_only = self.make_instance(include_optional=False)
|
||||
# inst_req_and_optional = self.make_instance(include_optional=True)
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
55
test/test_node.py
Normal file
55
test/test_node.py
Normal file
@ -0,0 +1,55 @@
|
||||
# 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.node import Node
|
||||
|
||||
class TestNode(unittest.TestCase):
|
||||
"""Node unit test stubs"""
|
||||
|
||||
def setUp(self):
|
||||
pass
|
||||
|
||||
def tearDown(self):
|
||||
pass
|
||||
|
||||
def make_instance(self, include_optional) -> Node:
|
||||
"""Test Node
|
||||
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`
|
||||
"""
|
||||
model = Node()
|
||||
if include_optional:
|
||||
return Node(
|
||||
node_id = '',
|
||||
peer_id = '',
|
||||
record = '',
|
||||
address = '',
|
||||
seen = True
|
||||
)
|
||||
else:
|
||||
return Node(
|
||||
)
|
||||
"""
|
||||
|
||||
def testNode(self):
|
||||
"""Test Node"""
|
||||
# inst_req_only = self.make_instance(include_optional=False)
|
||||
# inst_req_and_optional = self.make_instance(include_optional=True)
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
64
test/test_peers_table.py
Normal file
64
test/test_peers_table.py
Normal file
@ -0,0 +1,64 @@
|
||||
# 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()
|
||||
Loading…
x
Reference in New Issue
Block a user