-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #17 from open-formulieren/feature/3489-update-for-…
…new-api-clients Use new client approach in refactored Open Forms
- Loading branch information
Showing
6 changed files
with
61 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Shipped in Open Forms | ||
from openforms.contrib.hal_client import HALClient | ||
from openforms.pre_requests.clients import PreRequestMixin | ||
from zgw_consumers_ext.api_client import ServiceClientFactory | ||
|
||
from .models import HaalCentraalHRConfig | ||
|
||
|
||
class NoServiceConfigured(RuntimeError): | ||
pass | ||
|
||
|
||
def get_client(**kwargs) -> "Client": | ||
config = HaalCentraalHRConfig.get_solo() | ||
assert isinstance(config, HaalCentraalHRConfig) | ||
if not (service := config.service): | ||
raise NoServiceConfigured("No service configured!") | ||
service_client_factory = ServiceClientFactory(service) | ||
return Client.configure_from(service_client_factory, **kwargs) | ||
|
||
|
||
class Client(PreRequestMixin, HALClient): | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters