Skip to content

Commit

Permalink
fixup! Explicate typing for zgw client factory
Browse files Browse the repository at this point in the history
  • Loading branch information
swrichards committed Jun 19, 2024
1 parent dd3f053 commit 1fda3be
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/open_inwoner/openzaak/clients.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import base64
import logging
from datetime import date
from typing import Literal, Mapping, TypeAlias
from typing import Literal, Mapping, Type, TypeAlias

from django.conf import settings
from django.core.files.uploadedfile import InMemoryUploadedFile
Expand Down Expand Up @@ -694,12 +694,14 @@ def fetch_open_tasks(self, bsn: str) -> list[OpenTask]:


ZgwClientType = Literal["zaak", "catalogi", "document", "form"]
ZgwClient: TypeAlias = ZakenClient | CatalogiClient | DocumentenClient | FormClient
ZgwClientFactoryReturn: TypeAlias = (
ZakenClient | CatalogiClient | DocumentenClient | FormClient
)


def _build_zgw_client(type_: ZgwClientType) -> ZgwClient | None:
def _build_zgw_client(type_: ZgwClientType) -> ZgwClientFactoryReturn | None:
config = OpenZaakConfig.get_solo()
services_to_client_mapping: Mapping[ZgwClientType, ZgwClient] = {
services_to_client_mapping: Mapping[ZgwClientType, Type[ZgwClientFactoryReturn]] = {
"zaak": ZakenClient,
"catalogi": CatalogiClient,
"document": DocumentenClient,
Expand Down

0 comments on commit 1fda3be

Please sign in to comment.