-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add full project documentation * Add examples * Use consistent naming for the project * Automatically build and deploy to gh-pages via CircleCI
- Loading branch information
1 parent
dbd6bcd
commit 2912ba6
Showing
15 changed files
with
857 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,53 @@ jobs: | |
- store_test_results: | ||
path: test-results | ||
|
||
build-docs: | ||
docker: | ||
- image: cimg/python:3.12 | ||
steps: | ||
- checkout | ||
- python/install-packages: | ||
pkg-manager: poetry | ||
- run: | ||
name: Install MkDocs and plugins | ||
command: poetry add mkdocs mkdocs-material mkdocstrings[python] | ||
- run: | ||
name: Build documentation | ||
command: poetry run mkdocs build | ||
- persist_to_workspace: | ||
root: . | ||
paths: | ||
- site | ||
|
||
deploy-docs: | ||
docker: | ||
- image: cimg/base:stable | ||
steps: | ||
- checkout | ||
- attach_workspace: | ||
at: . | ||
- run: | ||
name: Deploy to GitHub Pages | ||
command: | | ||
ls -al | ||
git clone -b gh-pages https://github.com/hyperb1iss/signalrgb-python.git gh-pages | ||
rm -rf gh-pages/* | ||
mv -f site/* gh-pages/ | ||
pushd gh-pages | ||
git config user.email "[email protected]" | ||
git config user.name "signalrgb-python CI bot" | ||
git add . | ||
echo "commit" | ||
if ! git diff-index --quiet HEAD; then | ||
git commit -m ":books: Update documentation for ${CIRCLE_TAG} [skip ci]" | ||
echo "push to github" | ||
GIT_SSH_COMMAND="ssh -o StrictHostKeyChecking=accept-new" git push [email protected]:hyperb1iss/signalrgb-python.git gh-pages | ||
else | ||
echo "nothing to deploy" | ||
fi | ||
echo "done" | ||
popd | ||
release: | ||
docker: | ||
- image: cimg/python:3.12 | ||
|
@@ -49,9 +96,24 @@ workflows: | |
filters: | ||
tags: | ||
only: /.*/ | ||
- build-docs: | ||
requires: | ||
- build-and-test | ||
filters: | ||
tags: | ||
only: /.*/ | ||
- deploy-docs: | ||
requires: | ||
- build-docs | ||
filters: | ||
tags: | ||
only: /v[0-9]+(\.[0-9]+)*/ | ||
branches: | ||
ignore: /.*/ | ||
- release: | ||
requires: | ||
- build-and-test | ||
- deploy-docs | ||
filters: | ||
tags: | ||
only: /v[0-9]+(\.[0-9]+)*/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
# SignalRGB Client API Reference | ||
|
||
This page provides detailed API documentation for the `SignalRGBClient` class, which is the main interface for interacting with the SignalRGB API. | ||
|
||
## SignalRGBClient | ||
|
||
::: signalrgb.client.SignalRGBClient | ||
options: | ||
show_root_heading: true | ||
show_source: true | ||
|
||
## Exceptions | ||
|
||
The SignalRGB client defines several custom exceptions for error handling: | ||
|
||
::: signalrgb.client.SignalRGBException | ||
options: | ||
show_root_heading: true | ||
show_source: true | ||
|
||
::: signalrgb.client.ConnectionError | ||
options: | ||
show_root_heading: true | ||
show_source: true | ||
|
||
::: signalrgb.client.APIError | ||
options: | ||
show_root_heading: true | ||
show_source: true | ||
|
||
::: signalrgb.client.EffectNotFoundError | ||
options: | ||
show_root_heading: true | ||
show_source: true | ||
|
||
## Usage Example | ||
|
||
Here's a basic example of how to use the SignalRGBClient: | ||
|
||
```python | ||
from signalrgb import SignalRGBClient | ||
|
||
# Initialize the client | ||
client = SignalRGBClient(host="localhost", port=16038) | ||
|
||
# Get all effects | ||
effects = client.get_effects() | ||
for effect in effects: | ||
print(f"Effect: {effect.attributes.name}") | ||
|
||
# Apply an effect | ||
client.apply_effect_by_name("Rainbow Wave") | ||
|
||
# Get current effect | ||
current_effect = client.get_current_effect() | ||
print(f"Current effect: {current_effect.attributes.name}") | ||
``` | ||
|
||
For more detailed usage examples, please refer to the [Python Library Usage](../usage/library.md) guide. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
# SignalRGB Models API Reference | ||
|
||
This page provides detailed API documentation for the data models used in the SignalRGB Python client. These models represent various data structures used in the SignalRGB API, including effects, responses, and error information. | ||
|
||
## Attributes | ||
|
||
::: signalrgb.model.Attributes | ||
options: | ||
show_root_heading: true | ||
show_source: true | ||
|
||
## Links | ||
|
||
::: signalrgb.model.Links | ||
options: | ||
show_root_heading: true | ||
show_source: true | ||
|
||
## Effect | ||
|
||
::: signalrgb.model.Effect | ||
options: | ||
show_root_heading: true | ||
show_source: true | ||
|
||
## EffectList | ||
|
||
::: signalrgb.model.EffectList | ||
options: | ||
show_root_heading: true | ||
show_source: true | ||
|
||
## Error | ||
|
||
::: signalrgb.model.Error | ||
options: | ||
show_root_heading: true | ||
show_source: true | ||
|
||
## SignalRGBResponse | ||
|
||
::: signalrgb.model.SignalRGBResponse | ||
options: | ||
show_root_heading: true | ||
show_source: true | ||
|
||
## EffectDetailsResponse | ||
|
||
::: signalrgb.model.EffectDetailsResponse | ||
options: | ||
show_root_heading: true | ||
show_source: true | ||
|
||
## EffectListResponse | ||
|
||
::: signalrgb.model.EffectListResponse | ||
options: | ||
show_root_heading: true | ||
show_source: true | ||
|
||
## Usage Example | ||
|
||
Here's a basic example of how to work with these models: | ||
|
||
```python | ||
from signalrgb import SignalRGBClient | ||
from signalrgb.model import Effect, Attributes | ||
|
||
# Initialize the client | ||
client = SignalRGBClient() | ||
|
||
# Get an effect | ||
effect: Effect = client.get_effect_by_name("Sakura") | ||
|
||
# Access effect attributes | ||
print(f"Effect name: {effect.attributes.name}") | ||
print(f"Effect description: {effect.attributes.description}") | ||
print(f"Effect uses audio: {effect.attributes.uses_audio}") | ||
|
||
# Create a new effect (note: this is just an example, you can't actually create new effects via the API) | ||
new_effect = Effect( | ||
id="custom_effect_1", | ||
type="lighting", | ||
links=Links(apply="/api/v1/effects/custom_effect_1/apply"), | ||
attributes=Attributes( | ||
name="My Custom Effect", | ||
description="A custom lighting effect", | ||
uses_audio=True | ||
) | ||
) | ||
``` | ||
|
||
For more detailed usage examples, please refer to the [Python Library Usage](../usage/library.md) guide. |
Oops, something went wrong.