Skip to content

Commit 117e82c

Browse files
authored
Merge pull request #19 from foarsitter/release
Release
2 parents 8224630 + f081cce commit 117e82c

13 files changed

Lines changed: 251 additions & 179 deletions

File tree

.github/workflows/tests.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,20 +18,22 @@ jobs:
1818
- { python: "3.9", os: "ubuntu-latest", session: "mypy" }
1919
- { python: "3.8", os: "ubuntu-latest", session: "mypy" }
2020
- { python: "3.7", os: "ubuntu-latest", session: "mypy" }
21+
- { python: "3.11", os: "ubuntu-latest", session: "tests" }
2122
- { python: "3.10", os: "ubuntu-latest", session: "tests" }
2223
- { python: "3.9", os: "ubuntu-latest", session: "tests" }
2324
- { python: "3.8", os: "ubuntu-latest", session: "tests" }
2425
- { python: "3.7", os: "ubuntu-latest", session: "tests" }
25-
- { python: "3.10", os: "windows-latest", session: "tests" }
26-
- { python: "3.10", os: "macos-latest", session: "tests" }
27-
- { python: "3.10", os: "ubuntu-latest", session: "typeguard" }
2826
- { python: "3.10", os: "ubuntu-latest", session: "xdoctest" }
2927
- { python: "3.10", os: "ubuntu-latest", session: "docs-build" }
3028

3129
env:
3230
NOXSESSION: ${{ matrix.session }}
3331
FORCE_COLOR: "1"
3432
PRE_COMMIT_COLOR: "always"
33+
CHECKEDID_EMPLOYEE_CODE: ${{ secrets.CHECKEDID_EMPLOYEE_CODE }}
34+
CHECKEDID_CUSTOMER_CODE: ${{ secrets.CHECKEDID_CUSTOMER_CODE }}
35+
CHECKEDID_PASSWORD: ${{ secrets.CHECKEDID_PASSWORD }}
36+
CHECKEDID_USERNAME: ${{ secrets.CHECKEDID_USERNAME }}
3537

3638
steps:
3739
- name: Check out the repository

noxfile.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,14 @@
2323

2424

2525
package = "checkedid"
26-
python_versions = ["3.10", "3.9", "3.8", "3.7"]
26+
python_versions = ["3.10", "3.9", "3.8", "3.7", "3.11"]
2727
nox.needs_version = ">= 2021.6.6"
2828
nox.options.sessions = (
2929
"pre-commit",
3030
"safety",
3131
"mypy",
3232
"tests",
33-
"typeguard",
33+
# "typeguard",
3434
"xdoctest",
3535
"docs-build",
3636
)
@@ -161,7 +161,7 @@ def mypy(session: Session) -> None:
161161
def tests(session: Session) -> None:
162162
"""Run the test suite."""
163163
session.install(".")
164-
session.install("coverage[toml]", "pytest", "pygments")
164+
session.install("coverage[toml]", "pytest", "pygments", "respx")
165165
try:
166166
session.run("coverage", "run", "--parallel", "-m", "pytest", *session.posargs)
167167
finally:

poetry.lock

Lines changed: 27 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
2-
name = "checkedid-python-client"
3-
version = "0.1.2"
2+
name = "checkedid"
3+
version = "0.2.0"
44
description = "CheckedID Python API client"
55
authors = ["Jelmer Draaijer <jelmer.draaijer@dok.works.nl>"]
66
license = "MIT"
@@ -20,7 +20,6 @@ Changelog = "https://github.com/foarsitter/checkedid-python-client/releases"
2020

2121
[tool.poetry.dependencies]
2222
python = "^3.7"
23-
click = ">=8.0.1"
2423
pydantic = "^1.10.2"
2524
httpx = "^0.23.1"
2625

@@ -49,9 +48,7 @@ sphinx-click = ">=3.0.2"
4948
typeguard = ">=2.13.3"
5049
xdoctest = {extras = ["colors"], version = ">=0.15.10"}
5150
myst-parser = {version = ">=0.16.1"}
52-
53-
[tool.poetry.scripts]
54-
checkedid-python-client = "checkedid.__main__:main"
51+
respx = "^0.20.1"
5552

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

6461
[tool.coverage.report]
6562
show_missing = true
66-
fail_under = 100
63+
fail_under = 90
6764

6865
[tool.isort]
6966
profile = "black"

src/checkedid/__main__.py

Lines changed: 0 additions & 12 deletions
This file was deleted.

src/checkedid/client.py

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
from httpx import Response
99

1010
from . import models
11-
from .models.generated import CustomerDetails
1211

1312

1413
class Client:
@@ -54,7 +53,7 @@ def invitation_status(
5453

5554
def invitations_create(
5655
self, invitations: List[models.CreateInvitationRequest]
57-
) -> Union[CustomerDetails, models.ErrorResponse]:
56+
) -> Union[models.CustomerDetails, models.ErrorResponse]:
5857
obj = models.CreateInvitationDetails(
5958
CustomerCode=self.customer_code, Invitations=invitations
6059
)
@@ -83,6 +82,24 @@ def invitation_delete(
8382
else:
8483
return self.handle_error_response(response)
8584

85+
def dossier(
86+
self, dossier_number: str
87+
) -> Union[models.ReportResponse, models.ErrorResponse]:
88+
response = self.httpx.get(f"/report/{dossier_number}")
89+
90+
if response.status_code == 200:
91+
return models.ReportResponse(**response.json())
92+
return self.handle_error_response(response)
93+
94+
def dossier_with_scope(
95+
self, dossier_number: str, scope: str
96+
) -> Union[models.ReportDataV3, models.ErrorResponse]:
97+
response = self.httpx.get(f"/reportdata/{dossier_number}/{scope}")
98+
99+
if response.status_code == 200:
100+
return models.ReportDataV3(**response.json())
101+
return self.handle_error_response(response)
102+
86103
def handle_error_response(self, response: Response) -> models.ErrorResponse:
87104
try:
88105
json = response.json()

src/checkedid/models/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
from .generated import CreateInvitationDetails
33
from .generated import CreateInvitationRequest
44
from .generated import CustomerDetails
5+
from .generated import ReportDataV3
6+
from .generated import ReportResponse
57
from .missing import OAuthToken
68
from .renamed import Invitation
79

@@ -13,4 +15,6 @@
1315
"CreateInvitationRequest",
1416
"CreateInvitationDetails",
1517
"CustomerDetails",
18+
"ReportResponse",
19+
"ReportDataV3",
1620
]

0 commit comments

Comments
 (0)