Skip to content

Commit

Permalink
Merge pull request skycoin#118 from simelo/stdevMac_t86_generate_pyth…
Browse files Browse the repository at this point in the history
…on_api

[restapi] fixes skycoin#86 Add Python client for skycoin
  • Loading branch information
olemis authored Mar 13, 2019
2 parents f027d1f + 6bad8d1 commit 1b73050
Show file tree
Hide file tree
Showing 97 changed files with 24,381 additions and 9,124 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@

Issue tracker is **ONLY** used for reporting bugs, features and enhancements. NO SUPPORT TICKETS ACCEPTED! Use [stackoverflow](https://stackoverflow.com) for supporting issues.
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: 'bug'
assignees: ''

---

## Expected Behavior

Expand Down
22 changes: 22 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: 'feature'
assignees: ''

---

Issue tracker is **ONLY** used for reporting bugs, features and enhancements. NO SUPPORT TICKETS ACCEPTED! Use [stackoverflow](https://stackoverflow.com) for supporting issues.

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.
2 changes: 2 additions & 0 deletions .travis/install-linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ chmod +x "$HOME/bin/gimme"
# Install Python libraries
$PIP install --upgrade pip setuptools tox-travis
$PIP install -r "$REPO_ROOT/requirements.dev.txt"
$PIP install -r "$REPO_ROOT/skyapi/requirements.txt"
$PIP install -r "$REPO_ROOT/skyapi/test-requirements.txt"

# Compile SWIG
mkdir swig_build && \
Expand Down
22 changes: 15 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
.DEFAULT_GOAL := help
.PHONY: configure build-libc build-swig develop build-libc-swig build
.PHONY: configure build-libc build-swig develop build-libc-swig build
.PHONY: test test-ci help

# Compilation output
.ONESHELL:
SHELL := /bin/bash

PYTHON_BIN = python
PYTHON = python
PWD = $(shell pwd)
GOPATH_DIR = $(PWD)/gopath
SKYCOIN_DIR = gopath/src/github.com/skycoin/skycoin
Expand All @@ -25,6 +25,8 @@ SRC_FILES = $(shell find $(SKYCOIN_DIR)/src -type f -name "*.go")
SWIG_FILES = $(shell find $(LIBSWIG_DIR) -type f -name "*.i")
HEADER_FILES = $(shell find $(SKYCOIN_DIR)/include -type f -name "*.h")

PYTHON_CLIENT_DIR = skyapi

ifeq ($(shell uname -s),Linux)
TEMP_DIR = tmp
else ifeq ($(shell uname -s),Darwin)
Expand Down Expand Up @@ -65,24 +67,30 @@ build-swig: ## Generate Python C module from SWIG interfaces
swig -python -Iswig/include -I$(INCLUDE_DIR) -outdir ./skycoin/ -o swig/pyskycoin_wrap.c $(LIBSWIG_DIR)/pyskycoin.i

develop: ## Install PySkycoin for development
$(PYTHON_BIN) setup.py develop
$(PYTHON) setup.py develop
(cd $(PYTHON_CLIENT_DIR) && $(PYTHON) setup.py develop)

build-libc-swig: build-libc build-swig

build: build-libc-swig ## Build PySkycoin Python package
$(PYTHON_BIN) setup.py build
$(PYTHON) setup.py build
(cd $(PYTHON_CLIENT_DIR) && $(PYTHON) setup.py build)

test-ci: ## Run tests on (Travis) CI build
tox
(cd $(PYTHON_CLIENT_DIR) && tox)

test: build-libc build-swig develop ## Run project test suite
$(PYTHON_BIN) setup.py test
$(PYTHON) setup.py test
(cd $(PYTHON_CLIENT_DIR) && $(PYTHON) setup.py test)

sdist: ## Create source distribution archive
$(PYTHON_BIN) setup.py sdist --formats=gztar
$(PYTHON) setup.py sdist --formats=gztar
(cd $(PYTHON_CLIENT_DIR) && $(PYTHON) setup.py sdist --formats=gztar)

bdist_wheel: ## Create architecture-specific binary wheel distribution archive
$(PYTHON_BIN) setup.py bdist_wheel
$(PYTHON) setup.py bdist_wheel
(cd $(PYTHON_CLIENT_DIR) && $(PYTHON) setup.py bdist_wheel)

# FIXME: After libskycoin 32-bits binaries add bdist_manylinux_i686
bdist_manylinux: bdist_manylinux_amd64 ## Create multilinux binary wheel distribution archives
Expand Down
12 changes: 12 additions & 0 deletions docs/BuildInfo.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# BuildInfo

## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**branch** | **str** | git branch name | [optional]
**commit** | **str** | git commit id | [optional]
**version** | **str** | version number | [optional]

[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)


256 changes: 256 additions & 0 deletions docs/DefaultApi.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,256 @@
# swagger_client.DefaultApi

All URIs are relative to *http://staging.node.skycoin.net*

Method | HTTP request | Description
------------- | ------------- | -------------
[**coin_supply**](DefaultApi.md#coin_supply) | **GET** /api/v1/coinSupply |
[**csrf_token**](DefaultApi.md#csrf_token) | **GET** /api/v1/csrf | Creates a new CSRF token. Previous CSRF tokens are invalidated by this call.
[**resend_unconfirmed_txns**](DefaultApi.md#resend_unconfirmed_txns) | **POST** /api/v1/resendUnconfirmedTxns |
[**version**](DefaultApi.md#version) | **GET** /api/v1/version |
[**wallet_folder**](DefaultApi.md#wallet_folder) | **GET** /api/v1/wallets/folderName |


# **coin_supply**
> coin_supply()


coinSupplyHandler returns coin distribution supply stats

### Example
```python
from __future__ import print_function
import time
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint

# Configure API key authorization: csrfAuth
configuration = swagger_client.Configuration()
configuration.api_key['csrf_Token'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['csrf_Token'] = 'Bearer'

# create an instance of the API class
api_instance = swagger_client.DefaultApi(swagger_client.ApiClient(configuration))

try:
api_instance.coin_supply()
except ApiException as e:
print("Exception when calling DefaultApi->coin_supply: %s\n" % e)
```

### Parameters
This endpoint does not need any parameter.

### Return type

void (empty response body)

### Authorization

[csrfAuth](../README.md#csrfAuth)

### HTTP request headers

- **Content-Type**: application/json
- **Accept**: application/json

[[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)

# **csrf_token**
> InlineResponse200 csrf_token()
Creates a new CSRF token. Previous CSRF tokens are invalidated by this call.

Response -> CSRF token to use in POST requests

### Example
```python
from __future__ import print_function
import time
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint

# Configure API key authorization: csrfAuth
configuration = swagger_client.Configuration()
configuration.api_key['csrf_Token'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['csrf_Token'] = 'Bearer'

# create an instance of the API class
api_instance = swagger_client.DefaultApi(swagger_client.ApiClient(configuration))

try:
# Creates a new CSRF token. Previous CSRF tokens are invalidated by this call.
api_response = api_instance.csrf_token()
pprint(api_response)
except ApiException as e:
print("Exception when calling DefaultApi->csrf_token: %s\n" % e)
```

### Parameters
This endpoint does not need any parameter.

### Return type

[**InlineResponse200**](InlineResponse200.md)

### Authorization

[csrfAuth](../README.md#csrfAuth)

### HTTP request headers

- **Content-Type**: application/json
- **Accept**: application/json

[[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)

# **resend_unconfirmed_txns**
> resend_unconfirmed_txns()


Broadcasts all unconfirmed transactions from the unconfirmed transaction pool

### Example
```python
from __future__ import print_function
import time
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint

# Configure API key authorization: csrfAuth
configuration = swagger_client.Configuration()
configuration.api_key['csrf_Token'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['csrf_Token'] = 'Bearer'

# create an instance of the API class
api_instance = swagger_client.DefaultApi(swagger_client.ApiClient(configuration))

try:
api_instance.resend_unconfirmed_txns()
except ApiException as e:
print("Exception when calling DefaultApi->resend_unconfirmed_txns: %s\n" % e)
```

### Parameters
This endpoint does not need any parameter.

### Return type

void (empty response body)

### Authorization

[csrfAuth](../README.md#csrfAuth)

### HTTP request headers

- **Content-Type**: application/json
- **Accept**: application/json

[[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)

# **version**
> BuildInfo version()


versionHandler returns the application version info

### Example
```python
from __future__ import print_function
import time
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint

# Configure API key authorization: csrfAuth
configuration = swagger_client.Configuration()
configuration.api_key['csrf_Token'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['csrf_Token'] = 'Bearer'

# create an instance of the API class
api_instance = swagger_client.DefaultApi(swagger_client.ApiClient(configuration))

try:
api_response = api_instance.version()
pprint(api_response)
except ApiException as e:
print("Exception when calling DefaultApi->version: %s\n" % e)
```

### Parameters
This endpoint does not need any parameter.

### Return type

[**BuildInfo**](BuildInfo.md)

### Authorization

[csrfAuth](../README.md#csrfAuth)

### HTTP request headers

- **Content-Type**: application/json
- **Accept**: application/json

[[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)

# **wallet_folder**
> wallet_folder()


Returns the wallet directory path

### Example
```python
from __future__ import print_function
import time
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint

# Configure API key authorization: csrfAuth
configuration = swagger_client.Configuration()
configuration.api_key['csrf_Token'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['csrf_Token'] = 'Bearer'

# create an instance of the API class
api_instance = swagger_client.DefaultApi(swagger_client.ApiClient(configuration))

try:
api_instance.wallet_folder()
except ApiException as e:
print("Exception when calling DefaultApi->wallet_folder: %s\n" % e)
```

### Parameters
This endpoint does not need any parameter.

### Return type

void (empty response body)

### Authorization

[csrfAuth](../README.md#csrfAuth)

### HTTP request headers

- **Content-Type**: application/json
- **Accept**: application/json

[[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)

10 changes: 10 additions & 0 deletions docs/InlineResponse200.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# InlineResponse200

## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**csrf_token** | **str** | Csrf Token is here | [optional]

[[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 changes: 12 additions & 0 deletions docs/InlineResponse422.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# InlineResponse422

## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**code** | **int** | | [optional]
**field** | **str** | | [optional]
**message** | **str** | | [optional]

[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)


Loading

0 comments on commit 1b73050

Please sign in to comment.