6.0 KiB

Codex API Client

List of endpoints and interfaces available to Codex API users

This Python package is automatically generated by the OpenAPI Generator project:

  • API version: 0.0.1
  • Package version: 1.0.0
  • Generator version: 7.8.0
  • Build package: org.openapitools.codegen.languages.PythonClientCodegen

Requirements.

Python 3.7+

Installation & Usage

pip install

If the python package is hosted on a repository, you can install directly using:

pip install git+https://github.com/auhau/py-codex-api.git

(you may need to run pip with root permission: sudo pip install git+https://github.com/auhau/py-codex-api.git)

Then import the package:

import codex_client

Setuptools

Install via Setuptools.

python setup.py install --user

(or sudo python setup.py install to install the package for all users)

Then import the package:

import codex_client

Tests

Execute pytest to run the tests.

Getting Started

Please follow the installation procedure and then run the following:


import codex_client
from codex_client.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to http://localhost:8080/api/codex/v1
# See configuration.py for a list of all supported configuration parameters.
configuration = codex_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:
    # Create an instance of the API class
    api_instance = codex_client.DataApi(api_client)
    cid = 'cid_example' # str | File to be downloaded.

    try:
        # Download a file from the local node in a streaming manner. If the file is not available locally, a 404 is returned.
        api_response = api_instance.download_local(cid)
        print("The response of DataApi->download_local:\n")
        pprint(api_response)
    except ApiException as e:
        print("Exception when calling DataApi->download_local: %s\n" % e)

Documentation for API Endpoints

All URIs are relative to http://localhost:8080/api/codex/v1

Class Method HTTP request Description
DataApi 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 GET /data/{cid}/network Download a file from the network in a streaming manner. If the file is not available locally, it will be retrieved from other nodes in the network if able.
DataApi list_data GET /data Lists manifest CIDs stored locally in node.
DataApi space GET /space Gets a summary of the storage space allocation of the node.
DataApi 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.
DebugApi get_debug_info GET /debug/info Gets node information
DebugApi set_debug_log_level POST /debug/chronicles/loglevel Set log level at run time
MarketplaceApi create_storage_request POST /storage/request/{cid} Creates a new Request for storage
MarketplaceApi get_active_slot_by_id GET /sales/slots/{slotId} Returns active slot with id {slotId} for the host
MarketplaceApi get_active_slots GET /sales/slots Returns active slots
MarketplaceApi get_availabilities GET /sales/availability Returns storage that is for sale
MarketplaceApi get_purchase GET /storage/purchases/{id} Returns purchase details
MarketplaceApi get_purchases GET /storage/purchases Returns list of purchase IDs
MarketplaceApi get_reservations GET /sales/availability/{id}/reservations Get availability's reservations
MarketplaceApi offer_storage POST /sales/availability Offers storage for sale
MarketplaceApi update_offered_storage PATCH /sales/availability/{id} Updates availability
NodeApi connect_peer GET /connect/{peerId} Connect to a peer
NodeApi get_peer_id GET /node/peerid Get Node's PeerID
NodeApi get_spr GET /node/spr Get Node's SPR

Documentation For Models

Documentation For Authorization

Endpoints do not require authorization.

Author