0
kittycad/.gitignore → .gitignore
vendored
0
kittycad/.gitignore → .gitignore
vendored
8
Makefile
8
Makefile
@ -7,17 +7,17 @@ endif
|
|||||||
|
|
||||||
# For this to work, you need to install toml-cli: https://github.com/gnprice/toml-cli
|
# For this to work, you need to install toml-cli: https://github.com/gnprice/toml-cli
|
||||||
# `cargo install toml-cli`
|
# `cargo install toml-cli`
|
||||||
VERSION := $(shell toml get $(CURDIR)/kittycad/pyproject.toml tool.poetry.version | jq -r .)
|
VERSION := $(shell toml get $(CURDIR)/pyproject.toml tool.poetry.version | jq -r .)
|
||||||
|
|
||||||
.PHONY: generate
|
.PHONY: generate
|
||||||
generate: docker-image
|
generate: docker-image
|
||||||
docker run --rm -i $(DOCKER_FLAGS) \
|
docker run --rm -i $(DOCKER_FLAGS) \
|
||||||
--name python-generator \
|
--name python-generator \
|
||||||
-v $(CURDIR):/usr/src \
|
-v $(CURDIR):/usr/kittycad \
|
||||||
--workdir /usr/src \
|
--workdir /usr \
|
||||||
$(DOCKER_IMAGE_NAME) openapi-python-client update \
|
$(DOCKER_IMAGE_NAME) openapi-python-client update \
|
||||||
--url https://api.kittycad.io \
|
--url https://api.kittycad.io \
|
||||||
--config /usr/src/config.yml
|
--config /usr/kittycad/config.yml
|
||||||
|
|
||||||
.PHONY: docker-image
|
.PHONY: docker-image
|
||||||
docker-image:
|
docker-image:
|
||||||
|
41
README.md
41
README.md
@ -25,3 +25,44 @@ $ make generate
|
|||||||
|
|
||||||
Please do not change the code directly since it is generated. PRs that change
|
Please do not change the code directly since it is generated. PRs that change
|
||||||
the code directly will be automatically closed by a bot.
|
the code directly will be automatically closed by a bot.
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
First, create an authenticated client:
|
||||||
|
|
||||||
|
```python
|
||||||
|
from kittycad import AuthenticatedClient
|
||||||
|
|
||||||
|
client = AuthenticatedClient(token="your_token")
|
||||||
|
```
|
||||||
|
|
||||||
|
If you want to use the environment variable `KITTYCAD_API_TOKEN` to do
|
||||||
|
authentication and not pass one to the client, do the following:
|
||||||
|
|
||||||
|
```python
|
||||||
|
from kittycad import AuthenticatedClientFromEnv
|
||||||
|
|
||||||
|
client = AuthenticatedClientFromEnv()
|
||||||
|
```
|
||||||
|
|
||||||
|
Now call your endpoint and use your models:
|
||||||
|
|
||||||
|
```python
|
||||||
|
from kittycad.models import AuthSession
|
||||||
|
from kittycad.api.meta import meta_debug_session
|
||||||
|
from kittycad.types import Response
|
||||||
|
|
||||||
|
session: AuthSession = meta_debug_session.sync(client=client)
|
||||||
|
# or if you need more info (e.g. status_code)
|
||||||
|
response: Response[AuthSession] = meta_debug_session.sync_detailed(client=client)
|
||||||
|
```
|
||||||
|
|
||||||
|
Or do the same thing with an async version:
|
||||||
|
|
||||||
|
```python
|
||||||
|
from kittycad.models import AuthSession
|
||||||
|
from kittycad.api.meta import meta_debug_session
|
||||||
|
from kittycad.types import Response
|
||||||
|
|
||||||
|
session: AuthSession = await meta_debug_session.asyncio(client=client)
|
||||||
|
response: Response[AuthSession] = await meta_debug_session.asyncio_detailed(client=client)
|
||||||
|
```
|
||||||
|
@ -1,43 +0,0 @@
|
|||||||
# kittycad
|
|
||||||
A client library for accessing KittyCAD
|
|
||||||
|
|
||||||
## Usage
|
|
||||||
First, create an authenticated client:
|
|
||||||
|
|
||||||
```python
|
|
||||||
from kittycad import AuthenticatedClient
|
|
||||||
|
|
||||||
client = AuthenticatedClient(token="your_token")
|
|
||||||
```
|
|
||||||
|
|
||||||
If you want to use the environment variable `KITTYCAD_API_TOKEN` to do
|
|
||||||
authentication and not pass one to the client, do the following:
|
|
||||||
|
|
||||||
```python
|
|
||||||
from kittycad import AuthenticatedClientFromEnv
|
|
||||||
|
|
||||||
client = AuthenticatedClientFromEnv()
|
|
||||||
```
|
|
||||||
|
|
||||||
Now call your endpoint and use your models:
|
|
||||||
|
|
||||||
```python
|
|
||||||
from kittycad.models import AuthSession
|
|
||||||
from kittycad.api.meta import meta_debug_session
|
|
||||||
from kittycad.types import Response
|
|
||||||
|
|
||||||
session: AuthSession = meta_debug_session.sync(client=client)
|
|
||||||
# or if you need more info (e.g. status_code)
|
|
||||||
response: Response[AuthSession] = meta_debug_session.sync_detailed(client=client)
|
|
||||||
```
|
|
||||||
|
|
||||||
Or do the same thing with an async version:
|
|
||||||
|
|
||||||
```python
|
|
||||||
from kittycad.models import AuthSession
|
|
||||||
from kittycad.api.meta import meta_debug_session
|
|
||||||
from kittycad.types import Response
|
|
||||||
|
|
||||||
session: AuthSession = await meta_debug_session.asyncio(client=client)
|
|
||||||
response: Response[AuthSession] = await meta_debug_session.asyncio_detailed(client=client)
|
|
||||||
```
|
|
Reference in New Issue
Block a user