Skip to content

Commit

Permalink
Merge pull request #19 from foarsitter/release
Browse files Browse the repository at this point in the history
Release
  • Loading branch information
foarsitter authored Dec 22, 2022
2 parents 8224630 + f081cce commit 117e82c
Show file tree
Hide file tree
Showing 13 changed files with 251 additions and 179 deletions.
8 changes: 5 additions & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,22 @@ jobs:
- { python: "3.9", os: "ubuntu-latest", session: "mypy" }
- { python: "3.8", os: "ubuntu-latest", session: "mypy" }
- { python: "3.7", os: "ubuntu-latest", session: "mypy" }
- { python: "3.11", os: "ubuntu-latest", session: "tests" }
- { python: "3.10", os: "ubuntu-latest", session: "tests" }
- { python: "3.9", os: "ubuntu-latest", session: "tests" }
- { python: "3.8", os: "ubuntu-latest", session: "tests" }
- { python: "3.7", os: "ubuntu-latest", session: "tests" }
- { python: "3.10", os: "windows-latest", session: "tests" }
- { python: "3.10", os: "macos-latest", session: "tests" }
- { python: "3.10", os: "ubuntu-latest", session: "typeguard" }
- { python: "3.10", os: "ubuntu-latest", session: "xdoctest" }
- { python: "3.10", os: "ubuntu-latest", session: "docs-build" }

env:
NOXSESSION: ${{ matrix.session }}
FORCE_COLOR: "1"
PRE_COMMIT_COLOR: "always"
CHECKEDID_EMPLOYEE_CODE: ${{ secrets.CHECKEDID_EMPLOYEE_CODE }}
CHECKEDID_CUSTOMER_CODE: ${{ secrets.CHECKEDID_CUSTOMER_CODE }}
CHECKEDID_PASSWORD: ${{ secrets.CHECKEDID_PASSWORD }}
CHECKEDID_USERNAME: ${{ secrets.CHECKEDID_USERNAME }}

steps:
- name: Check out the repository
Expand Down
6 changes: 3 additions & 3 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@


package = "checkedid"
python_versions = ["3.10", "3.9", "3.8", "3.7"]
python_versions = ["3.10", "3.9", "3.8", "3.7", "3.11"]
nox.needs_version = ">= 2021.6.6"
nox.options.sessions = (
"pre-commit",
"safety",
"mypy",
"tests",
"typeguard",
# "typeguard",
"xdoctest",
"docs-build",
)
Expand Down Expand Up @@ -161,7 +161,7 @@ def mypy(session: Session) -> None:
def tests(session: Session) -> None:
"""Run the test suite."""
session.install(".")
session.install("coverage[toml]", "pytest", "pygments")
session.install("coverage[toml]", "pytest", "pygments", "respx")
try:
session.run("coverage", "run", "--parallel", "-m", "pytest", *session.posargs)
finally:
Expand Down
40 changes: 27 additions & 13 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 4 additions & 7 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "checkedid-python-client"
version = "0.1.2"
name = "checkedid"
version = "0.2.0"
description = "CheckedID Python API client"
authors = ["Jelmer Draaijer <jelmer.draaijer@dok.works.nl>"]
license = "MIT"
Expand All @@ -20,7 +20,6 @@ Changelog = "https://github.com/foarsitter/checkedid-python-client/releases"

[tool.poetry.dependencies]
python = "^3.7"
click = ">=8.0.1"
pydantic = "^1.10.2"
httpx = "^0.23.1"

Expand Down Expand Up @@ -49,9 +48,7 @@ sphinx-click = ">=3.0.2"
typeguard = ">=2.13.3"
xdoctest = {extras = ["colors"], version = ">=0.15.10"}
myst-parser = {version = ">=0.16.1"}

[tool.poetry.scripts]
checkedid-python-client = "checkedid.__main__:main"
respx = "^0.20.1"

[tool.coverage.paths]
source = ["src", "*/site-packages"]
Expand All @@ -63,7 +60,7 @@ source = ["checkedid", "tests"]

[tool.coverage.report]
show_missing = true
fail_under = 100
fail_under = 90

[tool.isort]
profile = "black"
Expand Down
12 changes: 0 additions & 12 deletions src/checkedid/__main__.py

This file was deleted.

21 changes: 19 additions & 2 deletions src/checkedid/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
from httpx import Response

from . import models
from .models.generated import CustomerDetails


class Client:
Expand Down Expand Up @@ -54,7 +53,7 @@ def invitation_status(

def invitations_create(
self, invitations: List[models.CreateInvitationRequest]
) -> Union[CustomerDetails, models.ErrorResponse]:
) -> Union[models.CustomerDetails, models.ErrorResponse]:
obj = models.CreateInvitationDetails(
CustomerCode=self.customer_code, Invitations=invitations
)
Expand Down Expand Up @@ -83,6 +82,24 @@ def invitation_delete(
else:
return self.handle_error_response(response)

def dossier(
self, dossier_number: str
) -> Union[models.ReportResponse, models.ErrorResponse]:
response = self.httpx.get(f"/report/{dossier_number}")

if response.status_code == 200:
return models.ReportResponse(**response.json())
return self.handle_error_response(response)

def dossier_with_scope(
self, dossier_number: str, scope: str
) -> Union[models.ReportDataV3, models.ErrorResponse]:
response = self.httpx.get(f"/reportdata/{dossier_number}/{scope}")

if response.status_code == 200:
return models.ReportDataV3(**response.json())
return self.handle_error_response(response)

def handle_error_response(self, response: Response) -> models.ErrorResponse:
try:
json = response.json()
Expand Down
4 changes: 4 additions & 0 deletions src/checkedid/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
from .generated import CreateInvitationDetails
from .generated import CreateInvitationRequest
from .generated import CustomerDetails
from .generated import ReportDataV3
from .generated import ReportResponse
from .missing import OAuthToken
from .renamed import Invitation

Expand All @@ -13,4 +15,6 @@
"CreateInvitationRequest",
"CreateInvitationDetails",
"CustomerDetails",
"ReportResponse",
"ReportDataV3",
]
Loading

0 comments on commit 117e82c

Please sign in to comment.