Skip to content

Commit

Permalink
Merge pull request #41 from rodneyosodo/NOISSUE-updatesdk
Browse files Browse the repository at this point in the history
NOISSUE - Update SDK
  • Loading branch information
drasko authored Aug 10, 2023
2 parents 9b9be4d + 776c5af commit 0902c1b
Show file tree
Hide file tree
Showing 44 changed files with 1,955 additions and 1,036 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
- name: Check api docs
run: |
python3 setup.py install
lazydocs --src-base-url="https://github.com/mainflux/sdk-py/blob/main/" --overview-file="README.md" --output-path="tmp/docs" lib
lazydocs --src-base-url="https://github.com/mainflux/sdk-py/blob/main/" --overview-file="README.md" --output-path="tmp/docs" mainflux
DOCS=docs/*.md
for filename in $DOCS; do
echo "Comparing $filename with tmp/$filename"
Expand Down
35 changes: 35 additions & 0 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# This workflows will upload a Python Package using Twine when a release is created
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries

on:
release:
types: [created, published]

push:
tags:
- v*

name: Upload Python Package to PYPI

jobs:
deploy:
name: Publish python packages
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python setup.py sdist bdist_wheel
twine upload dist/*
4 changes: 2 additions & 2 deletions .github/workflows/python-testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ jobs:
pip install flake8 pytest requests requests_mock coverage
- name: Lint with flake8
run: |
flake8 lib
flake8 mainflux examples --count --exit-zero --max-complexity=10 --max-line-length=80 --statistics
- name: Test with pytest
run: |
pytest tests
coverage run --source=lib -m pytest -v tests && coverage report -m
coverage run --source=mainflux -m pytest -v tests && coverage report -m
10 changes: 8 additions & 2 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,26 @@

## Modules

- [`api`](./api.md#module-api)
- [`boostrap`](./boostrap.md#module-boostrap)
- [`certs`](./certs.md#module-certs)
- [`channels`](./channels.md#module-channels)
- [`errors`](./errors.md#module-errors)
- [`groups`](./groups.md#module-groups)
- [`keys`](./keys.md#module-keys)
- [`messages`](./messages.md#module-messages)
- [`response`](./response.md#module-response)
- [`sdk`](./sdk.md#module-sdk)
- [`things`](./things.md#module-things)
- [`users`](./users.md#module-users)
- [`utils`](./utils.md#module-utils)

## Classes

- [`api.Keys`](./api.md#class-keys)
- [`boostrap.Bootstrap`](./boostrap.md#class-bootstrap)
- [`certs.Certs`](./certs.md#class-certs)
- [`channels.Channels`](./channels.md#class-channels)
- [`groups.Groups`](./groups.md#class-groups)
- [`keys.Keys`](./keys.md#class-keys)
- [`messages.Messages`](./messages.md#class-messages)
- [`response.Error`](./response.md#class-error)
- [`response.Response`](./response.md#class-response)
Expand All @@ -29,6 +34,7 @@
## Functions

- [`errors.handle_error`](./errors.md#function-handle_error)
- [`utils.construct_header`](./utils.md#function-construct_header)


---
Expand Down
77 changes: 0 additions & 77 deletions docs/api.md

This file was deleted.

131 changes: 131 additions & 0 deletions docs/boostrap.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
<!-- markdownlint-disable -->

<a href="https://github.com/mainflux/sdk-py/blob/main/mainflux/boostrap.py#L0"><img align="right" style="float:right;" src="https://img.shields.io/badge/-source-cccccc?style=flat-square"></a>

# <kbd>module</kbd> `boostrap`






---

<a href="https://github.com/mainflux/sdk-py/blob/main/mainflux/boostrap.py#L8"><img align="right" style="float:right;" src="https://img.shields.io/badge/-source-cccccc?style=flat-square"></a>

## <kbd>class</kbd> `Bootstrap`




<a href="https://github.com/mainflux/sdk-py/blob/main/mainflux/boostrap.py#L14"><img align="right" style="float:right;" src="https://img.shields.io/badge/-source-cccccc?style=flat-square"></a>

### <kbd>method</kbd> `__init__`

```python
__init__(url: str)
```








---

<a href="https://github.com/mainflux/sdk-py/blob/main/mainflux/boostrap.py#L17"><img align="right" style="float:right;" src="https://img.shields.io/badge/-source-cccccc?style=flat-square"></a>

### <kbd>method</kbd> `add`

```python
add(config: dict, token: str)
```

Adds new config to the list of config owned by user identified using the provided access token.

---

<a href="https://github.com/mainflux/sdk-py/blob/main/mainflux/boostrap.py#L130"><img align="right" style="float:right;" src="https://img.shields.io/badge/-source-cccccc?style=flat-square"></a>

### <kbd>method</kbd> `bootstrap`

```python
bootstrap(external_id: str, external_key: str)
```

Retrieves a configuration with given external ID and external key.

---

<a href="https://github.com/mainflux/sdk-py/blob/main/mainflux/boostrap.py#L114"><img align="right" style="float:right;" src="https://img.shields.io/badge/-source-cccccc?style=flat-square"></a>

### <kbd>method</kbd> `remove`

```python
remove(config_id: str, token: str)
```

Removes a Config. In case of successful removal the service will ensure that the removed config is disconnected from all the Mainflux channels.

---

<a href="https://github.com/mainflux/sdk-py/blob/main/mainflux/boostrap.py#L72"><img align="right" style="float:right;" src="https://img.shields.io/badge/-source-cccccc?style=flat-square"></a>

### <kbd>method</kbd> `update`

```python
update(config: dict, token: str)
```

Update is performed by replacing the current resource data with values provided in a request payload. Note that the owner, ID, external ID, external key, Mainflux Thing ID and key cannot be changed.

---

<a href="https://github.com/mainflux/sdk-py/blob/main/mainflux/boostrap.py#L93"><img align="right" style="float:right;" src="https://img.shields.io/badge/-source-cccccc?style=flat-square"></a>

### <kbd>method</kbd> `update_certs`

```python
update_certs(
config_id: str,
client_cert: str,
client_key: str,
ca: str,
token: str
)
```

Update is performed by replacing the current certificate data with values provided in a request payload.

---

<a href="https://github.com/mainflux/sdk-py/blob/main/mainflux/boostrap.py#L56"><img align="right" style="float:right;" src="https://img.shields.io/badge/-source-cccccc?style=flat-square"></a>

### <kbd>method</kbd> `view`

```python
view(config_id: str, token: str)
```

Retrieves a configuration with given config id

---

<a href="https://github.com/mainflux/sdk-py/blob/main/mainflux/boostrap.py#L36"><img align="right" style="float:right;" src="https://img.shields.io/badge/-source-cccccc?style=flat-square"></a>

### <kbd>method</kbd> `whitelist`

```python
whitelist(config: dict, token: str)
```

Updating state represents enabling/disabling Config, i.e.connecting and disconnecting corresponding Mainflux Thing to the list of Channels.




---

_This file was automatically generated via [lazydocs](https://github.com/ml-tooling/lazydocs)._
81 changes: 81 additions & 0 deletions docs/certs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
<!-- markdownlint-disable -->

<a href="https://github.com/mainflux/sdk-py/blob/main/mainflux/certs.py#L0"><img align="right" style="float:right;" src="https://img.shields.io/badge/-source-cccccc?style=flat-square"></a>

# <kbd>module</kbd> `certs`






---

<a href="https://github.com/mainflux/sdk-py/blob/main/mainflux/certs.py#L8"><img align="right" style="float:right;" src="https://img.shields.io/badge/-source-cccccc?style=flat-square"></a>

## <kbd>class</kbd> `Certs`




<a href="https://github.com/mainflux/sdk-py/blob/main/mainflux/certs.py#L11"><img align="right" style="float:right;" src="https://img.shields.io/badge/-source-cccccc?style=flat-square"></a>

### <kbd>method</kbd> `__init__`

```python
__init__(url: str)
```








---

<a href="https://github.com/mainflux/sdk-py/blob/main/mainflux/certs.py#L14"><img align="right" style="float:right;" src="https://img.shields.io/badge/-source-cccccc?style=flat-square"></a>

### <kbd>method</kbd> `issue`

```python
issue(thing_id: str, key_bits: int, key_type: str, valid: str, token: str)
```





---

<a href="https://github.com/mainflux/sdk-py/blob/main/mainflux/certs.py#L55"><img align="right" style="float:right;" src="https://img.shields.io/badge/-source-cccccc?style=flat-square"></a>

### <kbd>method</kbd> `revoke`

```python
revoke(thing_id: str, token: str)
```





---

<a href="https://github.com/mainflux/sdk-py/blob/main/mainflux/certs.py#L41"><img align="right" style="float:right;" src="https://img.shields.io/badge/-source-cccccc?style=flat-square"></a>

### <kbd>method</kbd> `view`

```python
view(thing_id: str, token: str)
```

Generates an access token when provided with proper credentials.




---

_This file was automatically generated via [lazydocs](https://github.com/ml-tooling/lazydocs)._
Loading

0 comments on commit 0902c1b

Please sign in to comment.