Skip to content

Commit

Permalink
feat: implement dioptra v1 rest api python client
Browse files Browse the repository at this point in the history
examples: begin creating demo of v1client

feat: update test_client for users and auth

feat: update client demo

feat: correct location of demo client

feat: update logging and add queues for dioptra v1 client

feat: correct some comments

feat: update demo of v1 client to include plugins

feat: change id parameter names to be more descriptive and not conflict with python builtin id

feat: ensure testing of more than one parameter per plugin task

feat: put client in correct place and consolidate tags feature for most endpoints

feat: fix tag usage examples in notebook; fix lint in client

chore: lint fixes on client

chore: fix linting issues

feat: fix tags client class, move address definition, default Session

chore: linting errors

feat: update client

feat: define a DioptraSession class and begin refactoring to use it

refactor: work-in-progress to consolidate and streamline client

refactor: add boilerplate comment

refactor: update the dioptra client to have proper session management

This is a work-in-progress. In addition to the session manager, the endpoint clients are being
broken out into separate files to avoid having one very large file. Proper type annotations are
being added, and the logic for building the endpoint urls has been consolidated so that there's
less url building and passing in the code in general.

chore: add stubs for the other endpoint client files

test: implement DioptraFlaskClientSession for testing purposes

This update creates the DioptraFlaskClientSession class that serves that adapts the FlaskClient and
TestResponse classes to work within DioptraClient. This allows the DioptraClient to be directly
exercised in unit tests.

test: refactor users endpoint tests to use the DioptraClient

refactor: remove __init__ from DioptraSession base class

The __init__ should be customizable to the particular requests library. In addition, the url
property is now an abstractmethod and must be defined in every inheriting class. Finally, the
session property in DioptraRequestsSession has been demoted to a private method since there is no
special reason the requests Session class should be accessible to the user as a public-facing
attribute.

refactor: add ClassVar type annotations

fix: move abstractmethod below property decorator, set None defaults

feat: create DioptraClientError base class for client exceptions

feat: create a fields validation error exception for the client

test: set V1_ROOT as the DioptraFlaskClientSession url property

feat: create a SubEndpoint base class for the client

feat: implement the drafts subendpoint component for the client

feat: implement the tags subendpoint component for the client

feat: implement the queues endpoint support in the client

test: convert first unit test for queues to using new client

fix: fix url construction for drafts with existing resources

fix: add missing group_id argument in queues client

test: migrate common drafts assert statements to new dioptra client

test: migrate queue testing code to using new dioptra client

test: update docstrings

refactor: fix generic typevars and consolidate sessions code

test: refactor test session client to consolidate code and use generic types

test: change pytest.raises assertions back to status code checks

refactor: remove unused debug logging functions

refactor: hide client method kwargs from logger

Secrets can end up here, so its not a good idea to just show everything in the logger messages.

refactor: wrap_request_method is a better name than wrap_response

test: wrap_request_method is a better name than wrap_response

feat: add factory functions for constructing response and json dioptra clients

refactor: move api address construction into client factory functions

refactor: remove None options from modify_current_user in client

refactor: move validate_ids_argument to bottom of file and prefix with underscore

refactor: rename set to append in tags subclient

test: update to use append instead of set name

docs: add docstrings to drafts, queues, tags, users in client

feat: create snapshots subendpoint and attach to queues client

test: exercise queues snapshots subendpoint in unit tests

chore: run code formatter

refactor: move 2xx status code check into separate function

Expand the check to the full 200 status code range.

refactor: remove None option from address kwarg

docs: add docstrings to all existing DioptraClient related classes

refactor: reorder properties in DioptraResquestProtocol

test: remove unused imports

test: add docstrings to the dioptra test client and responses

test: remove unused imports

test: fix whitespace

chore: run black and isort

chore: run black and isort

test: run black and isort

test: run black and isort

chore: satisfy flake8

feat: implement the tags endpoint client

test: update tags unit tests to use the dioptra client

refactor: append "Client" suffix to base endpoint and subendpoint classes

refactor: append "Client" to all subendpoint classes

test: propagate new subendpoint class names

feat: declare a SubEndpointChildrenClient interface

feat: begin implementing the SubEndpointChildren version of Tags

refactor: rename build_child_url to build_resource_url

chore: run black and isort

docs: add docstrings

refactor: moved to collection/sub collection naming scheme for client

This refactor standardizes the naming scheme for the different endpoint clients on the terms
collection and sub collection and updates the logic for the sub-collections to better handle
arbitrary nesting of sub-collections. This follows the concepts outlined in this page:
https://restful-api-design.readthedocs.io/en/latest/resources.html

Co-authored-by: jtsextonMITRE <[email protected]>
  • Loading branch information
jkglasbrenner and jtsextonMITRE committed Oct 4, 2024
1 parent a2fcac8 commit 0de0293
Show file tree
Hide file tree
Showing 29 changed files with 4,415 additions and 1,255 deletions.
14 changes: 10 additions & 4 deletions src/dioptra/client/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,14 @@
#
# ACCESS THE FULL CC BY 4.0 LICENSE HERE:
# https://creativecommons.org/licenses/by/4.0/legalcode
from __future__ import annotations
from .client import (
DioptraClient,
connect_json_dioptra_client,
connect_response_dioptra_client,
)

from ._client import DioptraClient

__all__ = ["DioptraClient"]
__all__ = [
"connect_response_dioptra_client",
"connect_json_dioptra_client",
"DioptraClient",
]
Loading

0 comments on commit 0de0293

Please sign in to comment.