A client library for accessing Hub REST API
Project description
hub-rest-client 0.1.5
A client library for accessing Hub REST API
⚠️This SDK generated using 2021.1.13439
OpenAPI version by custom openapi-python-client which is under development.
It may have some bugs. Use with caution.⚠️
If you find a bug or want to request a new feature, please create an issue in YouTrack.
Usage
First, create a client:
from hub_rest_client import Client
client = Client(hub_base_url="https://hub.jetbrains.com/api/rest")
If the endpoints you're going to hit require authentication, use AuthenticatedClient
instead:
import os
from hub_rest_client import AuthenticatedClient
client = AuthenticatedClient(hub_base_url="https://hub.jetbrains.com/api/rest", token=os.getenv("HUB_TOKEN"))
Now call your endpoint and use your models:
from hub_rest_client.models import MyDataModel
from hub_rest_client.api.my_tag import get_my_data_model
from hub_rest_client.types import Response
my_data: MyDataModel = get_my_data_model.sync(client=client)
# or if you need more info (e.g. status_code)
response: Response[MyDataModel] = get_my_data_model.sync_detailed(client=client)
Or do the same thing with an async version:
from hub_rest_client.models import MyDataModel
from hub_rest_client.api.my_tag import get_my_data_model
from hub_rest_client.types import Response
my_data: MyDataModel = await get_my_data_model.asyncio(client=client)
response: Response[MyDataModel] = await get_my_data_model.asyncio_detailed(client=client)
Things to know:
- Every path/method combo becomes a Python module with four functions:
sync
: Blocking request that returns parsed data (if successful) orNone
sync_detailed
: Blocking request that always returns aRequest
, optionally withparsed
set if the request was successful.asyncio
: Likesync
but the async instead of blockingasyncio_detailed
: Likesync_detailed
by async instead of blocking
- All path/query params, and bodies become method arguments.
- If your endpoint had any tags on it, the first tag will be used as a module name for the function (my_tag above)
- Any endpoint which did not have a tag will be in
hub_rest_client.api.default
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
hub-rest-client-0.1.5.tar.gz
(125.2 kB
view hashes)
Built Distribution
Close
Hashes for hub_rest_client-0.1.5-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 726bc74673a719c61e99408ef63695529bd7cdddd6a5ee1c761c95029bc7a5c1 |
|
MD5 | 95b66aafa348577c18ef0010cdf44909 |
|
BLAKE2b-256 | 07ba30880bccffe1fe5cf8a31ef520f273b9f8e9e6b66d2120bffff946d25340 |