huvrdata / huvr-client

HUVR client
BSD 2-Clause "Simplified" License
5 stars 1 forks source link

generate h3 client from openapi spec and begin to use github releases #13

Closed david-wolgemuth closed 11 months ago

david-wolgemuth commented 11 months ago

Note - i deleted a bunch of outdated files (examples, docs, some config stuffs) - plan to add it back, but wanted a clean start


# make ipython

c = get_huvr_client(
  "https://dev.testing3.huvrdata.dev",
  "clienttest-748d29.service-account@dev.testing3.huvrdata.dev",
  "<redacted>"
)

c.verbose = True

response = c.users.me_read()
c.users.me_read().json()
# HUVR HTTP REQUEST: get https://dev.testing3.huvrdata.dev/api/users/me/ {'headers': {'Content-Type': 'application/json', 'Accept': 'application/json'}, 'params': None}
Out[19]:
{'id': 143,
 'name': 'ClientTest',
 'username': 'clienttest-748d29.service-account@dev.testing3.huvrdata.dev',
 'email': 'clienttest-748d29.service-account@dev.testing3.huvrdata.dev',
 'first_name': '',
 'last_name': '',
 'last_login': None,
 'is_active': True,
 'company': [],
 'date_joined': '2023-09-20T18:41:58.441447Z',
 'display_name': 'ClientTest',
 'roles': [],
 'crews': [],
 'permissions': []}

doc strings

In [4]: help(c.users.list)
Help on method list in module huvr_client.api.users:

list(params=None, **kwargs) method of huvr_client.api.users.UsersApiModule instance
    Returns an array users.

    :param dict params: company: string
    date_joined: string
    email: string
    is_active: string
    last_login: string
    limit: integer
    name: string
    offset: integer
    ordering: string
    roles: string
    search: string

    :returns: properties:
      count:
        type: integer
      next:
        format: uri
        nullable: true
        type: string
      previous:
        format: uri
        nullable: true
        type: string
      results:
        items:
          $ref: '#/components/schemas/User'
        type: array
    required:
    - count
    - results
    type: object

    https://docs.huvrdata.app/reference/api_users_list

running tests

(3.10.5) [huvr-client] make test                                                                                                         15:13:05 | master  ✗ ➦ ✭ ✱
make run cmd="pytest huvr_client"
docker compose run --rm --interactive --tty python pytest huvr_client
======================================================================= test session starts ========================================================================
platform linux -- Python 3.11.5, pytest-7.4.2, pluggy-0.13.1
rootdir: /app
collected 1 item

huvr_client/tests/test_client.py .                                                                                                                           [100%]

======================================================================== 1 passed in 1.53s =========================================================================