Skip to content

Commit

Permalink
feat: first generated version
Browse files Browse the repository at this point in the history
  • Loading branch information
AuHau committed Aug 23, 2024
1 parent 6b483a7 commit bc41cb9
Show file tree
Hide file tree
Showing 97 changed files with 13,354 additions and 1 deletion.
38 changes: 38 additions & 0 deletions .github/workflows/python.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# NOTE: This file is auto generated by OpenAPI Generator.
# URL: https://openapi-generator.tech
#
# ref: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python

name: codex_client Python package

on: [push, pull_request]

jobs:
build:

runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]

steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
if [ -f test-requirements.txt ]; then pip install -r test-requirements.txt; fi
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
run: |
pytest
66 changes: 66 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
env/
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
*.egg-info/
.installed.cfg
*.egg

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*,cover
.hypothesis/
venv/
.venv/
.python-version
.pytest_cache

# Translations
*.mo
*.pot

# Django stuff:
*.log

# Sphinx documentation
docs/_build/

# PyBuilder
target/

#Ipython Notebook
.ipynb_checkpoints
31 changes: 31 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# NOTE: This file is auto generated by OpenAPI Generator.
# URL: https://openapi-generator.tech
#
# ref: https://docs.gitlab.com/ee/ci/README.html
# ref: https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/ci/templates/Python.gitlab-ci.yml

stages:
- test

.pytest:
stage: test
script:
- pip install -r requirements.txt
- pip install -r test-requirements.txt
- pytest --cov=codex_client

pytest-3.7:
extends: .pytest
image: python:3.7-alpine
pytest-3.8:
extends: .pytest
image: python:3.8-alpine
pytest-3.9:
extends: .pytest
image: python:3.9-alpine
pytest-3.10:
extends: .pytest
image: python:3.10-alpine
pytest-3.11:
extends: .pytest
image: python:3.11-alpine
23 changes: 23 additions & 0 deletions .openapi-generator-ignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# OpenAPI Generator Ignore
# Generated by openapi-generator https://github.com/openapitools/openapi-generator

# Use this file to prevent files from being overwritten by the generator.
# The patterns follow closely to .gitignore or .dockerignore.

# As an example, the C# client generator defines ApiClient.cs.
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
#ApiClient.cs

# You can match any string of characters against a directory, file or extension with a single asterisk (*):
#foo/*/qux
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux

# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
#foo/**/qux
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux

# You can also negate patterns with an exclamation (!).
# For example, you can ignore all files in a docs folder with the file extension .md:
#docs/*.md
# Then explicitly reverse the ignore rule for a single file:
#!docs/README.md
68 changes: 68 additions & 0 deletions .openapi-generator/FILES
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
.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/space.py
codex_client/models/spr_read.py
codex_client/models/storage_ask.py
codex_client/models/storage_request.py
codex_client/models/storage_request_creation.py
codex_client/py.typed
codex_client/rest.py
docs/Content.md
docs/DataApi.md
docs/DataItem.md
docs/DataList.md
docs/DebugApi.md
docs/DebugInfo.md
docs/ErasureParameters.md
docs/ManifestItem.md
docs/MarketplaceApi.md
docs/NodeApi.md
docs/PeerIdRead.md
docs/PoRParameters.md
docs/Purchase.md
docs/Reservation.md
docs/SPRRead.md
docs/SalesAvailability.md
docs/SalesAvailabilityCREATE.md
docs/SalesAvailabilityREAD.md
docs/Slot.md
docs/Space.md
docs/StorageAsk.md
docs/StorageRequest.md
docs/StorageRequestCreation.md
git_push.sh
pyproject.toml
requirements.txt
setup.cfg
setup.py
test-requirements.txt
test/__init__.py
tox.ini
1 change: 1 addition & 0 deletions .openapi-generator/VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
7.8.0
17 changes: 17 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# ref: https://docs.travis-ci.com/user/languages/python
language: python
python:
- "3.7"
- "3.8"
- "3.9"
- "3.10"
- "3.11"
# uncomment the following if needed
#- "3.11-dev" # 3.11 development branch
#- "nightly" # nightly build
# command to install dependencies
install:
- "pip install -r requirements.txt"
- "pip install -r test-requirements.txt"
# command to run tests
script: pytest --cov=codex_client
143 changes: 142 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,142 @@
# py-codex-api
# Codex API Client
List of endpoints and interfaces available to Codex API users

This Python package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:

- API version: 0.0.1
- Package version: 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:

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

Then import the package:
```python
import codex_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
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**](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* | [**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.
*DebugApi* | [**get_debug_info**](docs/DebugApi.md#get_debug_info) | **GET** /debug/info | Gets node information
*DebugApi* | [**set_debug_log_level**](docs/DebugApi.md#set_debug_log_level) | **POST** /debug/chronicles/loglevel | Set log level at run time
*MarketplaceApi* | [**create_storage_request**](docs/MarketplaceApi.md#create_storage_request) | **POST** /storage/request/{cid} | Creates a new Request for storage
*MarketplaceApi* | [**get_active_slot_by_id**](docs/MarketplaceApi.md#get_active_slot_by_id) | **GET** /sales/slots/{slotId} | Returns active slot with id {slotId} for the host
*MarketplaceApi* | [**get_active_slots**](docs/MarketplaceApi.md#get_active_slots) | **GET** /sales/slots | Returns active slots
*MarketplaceApi* | [**get_offered_storage**](docs/MarketplaceApi.md#get_offered_storage) | **GET** /sales/availability | Returns storage that is for sale
*MarketplaceApi* | [**get_purchase**](docs/MarketplaceApi.md#get_purchase) | **GET** /storage/purchases/{id} | Returns purchase details
*MarketplaceApi* | [**get_purchases**](docs/MarketplaceApi.md#get_purchases) | **GET** /storage/purchases | Returns list of purchase IDs
*MarketplaceApi* | [**get_reservations**](docs/MarketplaceApi.md#get_reservations) | **PATCH** /sales/availability/{id}/reservations | Get availability's reservations
*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


## Documentation For Models

- [Content](docs/Content.md)
- [DataItem](docs/DataItem.md)
- [DataList](docs/DataList.md)
- [DebugInfo](docs/DebugInfo.md)
- [ErasureParameters](docs/ErasureParameters.md)
- [ManifestItem](docs/ManifestItem.md)
- [PeerIdRead](docs/PeerIdRead.md)
- [PoRParameters](docs/PoRParameters.md)
- [Purchase](docs/Purchase.md)
- [Reservation](docs/Reservation.md)
- [SPRRead](docs/SPRRead.md)
- [SalesAvailability](docs/SalesAvailability.md)
- [SalesAvailabilityCREATE](docs/SalesAvailabilityCREATE.md)
- [SalesAvailabilityREAD](docs/SalesAvailabilityREAD.md)
- [Slot](docs/Slot.md)
- [Space](docs/Space.md)
- [StorageAsk](docs/StorageAsk.md)
- [StorageRequest](docs/StorageRequest.md)
- [StorageRequestCreation](docs/StorageRequestCreation.md)


<a id="documentation-for-authorization"></a>
## Documentation For Authorization

Endpoints do not require authorization.


## Author




Loading

0 comments on commit bc41cb9

Please sign in to comment.