Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions src/opendms/api/clients/zaken.py

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you rebase onto main, you'll see a different pattern in the client you can follow.

Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from typing import NotRequired

from msgspec.json import decode
from zgw_consumers.api_models.zaken import ZaakInformatieObject
from zgw_consumers.client import build_client
from zgw_consumers.models import Service
from zgw_consumers.nlx import NLXClient
Expand Down Expand Up @@ -95,6 +96,40 @@ def create_zaak(self, data: dict) -> Zaak:
response.raise_for_status()
return decode(response.content, type=Zaak)

def create_zaakinformatieobject(self, data: dict) -> dict:
response = self.post(
"zaakinformatieobjecten",
json=data,
)
response.raise_for_status()
return response.json()

def get_paginated_zaakinformatieobjecten(
self,
params: Mapping[str, object] = {},
) -> dict:
results = self.make_request(
"zaakinformatieobjecten",
params=params,
headers=CRS_HEADERS,
parse_into=list[ZaakInformatieObject],
)

return {
"count": len(results),
"results": results,
}

def get_zaakinformatieobject(
self,
uuid: str,
) -> ZaakInformatieObject:
return self.make_request(
f"zaakinformatieobjecten/{uuid}",
headers=CRS_HEADERS,
parse_into=ZaakInformatieObject,
)


def get_zaken_client(service: Service) -> ZaakClient:
return build_client(service, client_factory=ZaakClient)
133 changes: 133 additions & 0 deletions src/opendms/api/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@
license:
name: EUPL 1.2
url: https://opensource.org/licenses/EUPL-1.2
paths:

Check warning on line 15 in src/opendms/api/openapi.yaml

View workflow job for this annotation

GitHub Actions / Checks / Lint OAS

paths-open-api-json-resource-exists There does not exist a resource `/openapi.json` that returns the OpenAPI specification document
/api/v1/accounts/login:
post:
operationId: apiV1AccountsLoginCreate
description: Authenticates the user, returns whoami details on successful login.
summary: login
tags:
- accounts

Check warning on line 22 in src/opendms/api/openapi.yaml

View workflow job for this annotation

GitHub Actions / Checks / Lint OAS

operation-tag-defined Operation tags must be defined in global tags.
requestBody:
content:
application/json:
Expand Down Expand Up @@ -48,7 +48,7 @@
type: string
description: 'Geeft een specifieke API-versie aan in de context van
een specifieke aanroep. Voorbeeld: 1.2.1.'
content:

Check warning on line 51 in src/opendms/api/openapi.yaml

View workflow job for this annotation

GitHub Actions / Checks / Lint OAS

use-problem-schema The content type of an error response should be application/problem+json or application/problem+xml to match RFC 9457.
application/json:
schema:
$ref: '#/components/schemas/ValidatieFout'
Expand All @@ -60,7 +60,7 @@
type: string
description: 'Geeft een specifieke API-versie aan in de context van
een specifieke aanroep. Voorbeeld: 1.2.1.'
content:

Check warning on line 63 in src/opendms/api/openapi.yaml

View workflow job for this annotation

GitHub Actions / Checks / Lint OAS

use-problem-schema The content type of an error response should be application/problem+json or application/problem+xml to match RFC 9457.
application/json:
schema:
$ref: '#/components/schemas/Fout'
Expand All @@ -72,7 +72,7 @@
session data.
summary: logout
tags:
- accounts

Check warning on line 75 in src/opendms/api/openapi.yaml

View workflow job for this annotation

GitHub Actions / Checks / Lint OAS

operation-tag-defined Operation tags must be defined in global tags.
security:
- cookieAuth: []
responses:
Expand All @@ -90,7 +90,7 @@
description: Returns the current logged in user.
summary: whoami
tags:
- accounts

Check warning on line 93 in src/opendms/api/openapi.yaml

View workflow job for this annotation

GitHub Actions / Checks / Lint OAS

operation-tag-defined Operation tags must be defined in global tags.
security:
- cookieAuth: []
responses:
Expand All @@ -112,7 +112,7 @@
description: Search the document records.
summary: Search
tags:
- search

Check warning on line 115 in src/opendms/api/openapi.yaml

View workflow job for this annotation

GitHub Actions / Checks / Lint OAS

operation-tag-defined Operation tags must be defined in global tags.
requestBody:
content:
application/json:
Expand All @@ -134,7 +134,7 @@
$ref: '#/components/schemas/SearchResponse'
description: ''
/api/v1/services:
get:

Check warning on line 137 in src/opendms/api/openapi.yaml

View workflow job for this annotation

GitHub Actions / Checks / Lint OAS

operation-description Operation "description" must be present and non-empty string.
operationId: apiV1ServicesList
parameters:
- name: page
Expand All @@ -157,7 +157,7 @@
schema:
type: string
tags:
- api

Check warning on line 160 in src/opendms/api/openapi.yaml

View workflow job for this annotation

GitHub Actions / Checks / Lint OAS

operation-tag-defined Operation tags must be defined in global tags.
security:
- cookieAuth: []
responses:
Expand All @@ -174,7 +174,7 @@
$ref: '#/components/schemas/PaginatedServiceList'
description: ''
/api/v1/services/{serviceSlug}/informatieobjecttypen:
get:

Check warning on line 177 in src/opendms/api/openapi.yaml

View workflow job for this annotation

GitHub Actions / Checks / Lint OAS

operation-description Operation "description" must be present and non-empty string.
operationId: apiV1ServicesInformatieobjecttypenList
parameters:
- in: path
Expand Down Expand Up @@ -296,6 +296,110 @@
schema:
$ref: '#/components/schemas/StatusType'
description: ''
/api/v1/services/{serviceSlug}/zaakinformatieobjecten:
get:
operationId: apiV1ServicesZaakinformatieobjectenList
parameters:
- name: page
required: false
in: query
description: A page number within the paginated result set.
schema:
type: integer
- name: pageSize
required: false
in: query
description: 'Het aantal resultaten terug te geven per pagina. (default: 100,
maximum: 500).'
schema:
type: integer
- in: path
name: serviceSlug
schema:
type: string
required: true
tags:
- api
security:
- cookieAuth: []
responses:
'200':
headers:
API-version:
schema:
type: string
description: 'Geeft een specifieke API-versie aan in de context van
een specifieke aanroep. Voorbeeld: 1.2.1.'
content:
application/json:
schema:
$ref: '#/components/schemas/PaginatedZaakInformatieObjectCreateList'
description: ''
post:
operationId: apiV1ServicesZaakinformatieobjectenCreate
summary: zaakinformatieobjectCreate
parameters:
- in: path
name: serviceSlug
schema:
type: string
required: true
tags:
- api
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/ZaakInformatieObjectCreate'
required: true
security:
- cookieAuth: []
responses:
'201':
headers:
API-version:
schema:
type: string
description: 'Geeft een specifieke API-versie aan in de context van
een specifieke aanroep. Voorbeeld: 1.2.1.'
content:
application/json:
schema:
type: object
additionalProperties: {}
description: ''
/api/v1/services/{serviceSlug}/zaakinformatieobjecten/{id}:
get:
operationId: apiV1ServicesZaakinformatieobjectenRetrieve
parameters:
- in: path
name: id
schema:
type: string
format: uuid
required: true
- in: path
name: serviceSlug
schema:
type: string
required: true
tags:
- api
security:
- cookieAuth: []
responses:
'200':
headers:
API-version:
schema:
type: string
description: 'Geeft een specifieke API-versie aan in de context van
een specifieke aanroep. Voorbeeld: 1.2.1.'
content:
application/json:
schema:
$ref: '#/components/schemas/ZaakInformatieObjectCreate'
description: ''
/api/v1/services/{serviceSlug}/zaaktypen:
get:
operationId: apiV1ServicesZaaktypenList
Expand Down Expand Up @@ -1599,6 +1703,19 @@
type: array
items:
$ref: '#/components/schemas/StatusType'
PaginatedZaakInformatieObjectCreateList:
type: object
required:
- count
- results
properties:
count:
type: integer
example: 123
results:
type: array
items:
$ref: '#/components/schemas/ZaakInformatieObjectCreate'
PaginatedZaakList:
type: object
required:
Expand Down Expand Up @@ -1979,6 +2096,22 @@
- startdatum
- verantwoordelijkeOrganisatie
- zaaktype
ZaakInformatieObjectCreate:
type: object
properties:
zaak:
type: string
format: uri
informatieobject:
type: string
format: uri
titel:
type: string
beschrijving:
type: string
required:
- informatieobject
- zaak
ZaakType:
type: object
properties:
Expand Down
7 changes: 7 additions & 0 deletions src/opendms/api/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -697,3 +697,10 @@ class DocumentCreateSerializer(serializers.Serializer):
child=serializers.CharField(),
required=False,
)


class ZaakInformatieObjectCreateSerializer(serializers.Serializer):
zaak = serializers.URLField()
informatieobject = serializers.URLField()
titel = serializers.CharField(required=False)
beschrijving = serializers.CharField(required=False)
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
interactions:
- request:
body: '{"zaak": "http://localhost:8003/zaken/api/v1/zaken/840a1355-dd6d-48a4-a849-38fbf832db44",
"informatieobject": "http://localhost:8003/documenten/api/v1/enkelvoudiginformatieobjecten/ea16fa8c-4bab-4065-a28a-f6574625205d"}'
headers:
Accept:
- '*/*'
Accept-Encoding:
- gzip, deflate, br, zstd
Connection:
- keep-alive
Content-Length:
- '219'
Content-Type:
- application/json
User-Agent:
- python-requests/2.33.1
method: POST
uri: http://localhost:8003/zaken/api/v1/zaakinformatieobjecten
response:
body:
string: '{"url":"http://localhost:8003/zaken/api/v1/zaakinformatieobjecten/7c01c899-b44e-4cb2-8ebc-9d2a48b6a186","uuid":"7c01c899-b44e-4cb2-8ebc-9d2a48b6a186","informatieobject":"http://localhost:8003/documenten/api/v1/enkelvoudiginformatieobjecten/ea16fa8c-4bab-4065-a28a-f6574625205d","zaak":"http://localhost:8003/zaken/api/v1/zaken/840a1355-dd6d-48a4-a849-38fbf832db44","aardRelatieWeergave":"Hoort
bij, omgekeerd: kent","titel":"","beschrijving":"","registratiedatum":"2026-06-10T10:47:07.902351Z","vernietigingsdatum":null,"status":null}'
headers:
API-version:
- 1.5.1
Allow:
- GET, POST, HEAD, OPTIONS
Content-Length:
- '534'
Content-Security-Policy:
- 'object-src ''none''; frame-src ''self''; script-src ''self'' ''unsafe-inline''
cdnjs.cloudflare.com cdn.jsdelivr.net; font-src ''self'' fonts.gstatic.com;
form-action ''self''; base-uri ''self''; frame-ancestors ''none''; worker-src
''self'' blob:; default-src ''self''; style-src ''self'' ''unsafe-inline''
fonts.googleapis.com cdnjs.cloudflare.com cdn.jsdelivr.net; img-src ''self''
data: cdn.redoc.ly cdnjs.cloudflare.com tile.openstreetmap.org'
Content-Type:
- application/json
Cross-Origin-Opener-Policy:
- same-origin
Location:
- http://localhost:8003/zaken/api/v1/zaakinformatieobjecten/7c01c899-b44e-4cb2-8ebc-9d2a48b6a186
Referrer-Policy:
- same-origin
Vary:
- Accept, origin, Cookie
X-Content-Type-Options:
- nosniff
X-Frame-Options:
- DENY
status:
code: 201
message: Created
version: 1
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
interactions:
- request:
body: null
headers:
Accept:
- '*/*'
Accept-Crs:
- EPSG:4326
Accept-Encoding:
- gzip, deflate, br, zstd
Connection:
- keep-alive
Content-Crs:
- EPSG:4326
User-Agent:
- python-requests/2.33.1
method: GET
uri: http://localhost:8003/zaken/api/v1/zaakinformatieobjecten/00000000-0000-0000-0000-000000000000
response:
body:
string: '{"type":"http://localhost:8003/ref/fouten/NotFound/","code":"not_found","title":"Niet
gevonden.","status":404,"detail":"Niet gevonden.","instance":"urn:uuid:8ab7e2b1-7e64-4792-be23-166f51aacb62"}'
headers:
API-version:
- 1.5.1
Allow:
- GET, PUT, PATCH, DELETE, HEAD, OPTIONS
Content-Length:
- '195'
Content-Security-Policy:
- 'object-src ''none''; frame-src ''self''; script-src ''self'' ''unsafe-inline''
cdnjs.cloudflare.com cdn.jsdelivr.net; font-src ''self'' fonts.gstatic.com;
form-action ''self''; base-uri ''self''; frame-ancestors ''none''; worker-src
''self'' blob:; default-src ''self''; style-src ''self'' ''unsafe-inline''
fonts.googleapis.com cdnjs.cloudflare.com cdn.jsdelivr.net; img-src ''self''
data: cdn.redoc.ly cdnjs.cloudflare.com tile.openstreetmap.org'
Content-Type:
- application/json
Cross-Origin-Opener-Policy:
- same-origin
Referrer-Policy:
- same-origin
Vary:
- Accept, origin, Cookie
X-Content-Type-Options:
- nosniff
X-Frame-Options:
- DENY
status:
code: 404
message: Not Found
version: 1
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
interactions:
- request:
body: null
headers:
Accept:
- '*/*'
Accept-Crs:
- EPSG:4326
Accept-Encoding:
- gzip, deflate, br, zstd
Connection:
- keep-alive
Content-Crs:
- EPSG:4326
User-Agent:
- python-requests/2.33.1
method: GET
uri: http://localhost:8003/zaken/api/v1/zaakinformatieobjecten/f931b3f6-f92e-4c46-b484-f68aa68acc18
response:
body:
string: '{"url":"http://localhost:8003/zaken/api/v1/zaakinformatieobjecten/f931b3f6-f92e-4c46-b484-f68aa68acc18","uuid":"f931b3f6-f92e-4c46-b484-f68aa68acc18","informatieobject":"http://localhost:8003/documenten/api/v1/enkelvoudiginformatieobjecten/a9c82615-cee7-4e9d-b7a8-460623882c38","zaak":"http://localhost:8003/zaken/api/v1/zaken/840a1355-dd6d-48a4-a849-38fbf832db44","aardRelatieWeergave":"Hoort
bij, omgekeerd: kent","titel":"","beschrijving":"","registratiedatum":"2026-03-25T11:39:18.968000Z","vernietigingsdatum":null,"status":null}'
headers:
API-version:
- 1.5.1
Allow:
- GET, PUT, PATCH, DELETE, HEAD, OPTIONS
Content-Length:
- '534'
Content-Security-Policy:
- 'object-src ''none''; frame-src ''self''; script-src ''self'' ''unsafe-inline''
cdnjs.cloudflare.com cdn.jsdelivr.net; font-src ''self'' fonts.gstatic.com;
form-action ''self''; base-uri ''self''; frame-ancestors ''none''; worker-src
''self'' blob:; default-src ''self''; style-src ''self'' ''unsafe-inline''
fonts.googleapis.com cdnjs.cloudflare.com cdn.jsdelivr.net; img-src ''self''
data: cdn.redoc.ly cdnjs.cloudflare.com tile.openstreetmap.org'
Content-Type:
- application/json
Cross-Origin-Opener-Policy:
- same-origin
ETag:
- '"8c0b5e87d0ec32426a0574fcd7f272fd"'
Referrer-Policy:
- same-origin
Vary:
- Accept, origin, Cookie
X-Content-Type-Options:
- nosniff
X-Frame-Options:
- DENY
status:
code: 200
message: OK
version: 1
Loading
Loading