move around files

Signed-off-by: Jess Frazelle <github@jessfraz.com>
This commit is contained in:
Jess Frazelle
2021-12-15 01:05:44 -08:00
parent 7ee7964440
commit 3ee3ae9a6c
26 changed files with 45 additions and 47 deletions

View File

View File

@ -7,17 +7,17 @@ endif
# For this to work, you need to install toml-cli: https://github.com/gnprice/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
generate: docker-image
docker run --rm -i $(DOCKER_FLAGS) \
--name python-generator \
-v $(CURDIR):/usr/src \
--workdir /usr/src \
-v $(CURDIR):/usr/kittycad \
--workdir /usr \
$(DOCKER_IMAGE_NAME) openapi-python-client update \
--url https://api.kittycad.io \
--config /usr/src/config.yml
--config /usr/kittycad/config.yml
.PHONY: docker-image
docker-image:

View File

@ -25,3 +25,44 @@ $ make generate
Please do not change the code directly since it is generated. PRs that change
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)
```

View File

@ -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)
```