Skip to content

Commit 1f6c065

Browse files
committed
feature/add_internal_notification_filters: added notification_filter_url_user_internal
1 parent 299061b commit 1f6c065

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
from __future__ import annotations
2+
3+
from typing import List, Dict
4+
5+
from bunq.sdk.http.api_client import ApiClient
6+
from bunq.sdk.http.bunq_response import BunqResponse
7+
from bunq.sdk.json import converter
8+
from bunq.sdk.model.generated.endpoint import NotificationFilterUrlUser
9+
from bunq.sdk.model.generated.object_ import NotificationFilterUrl
10+
11+
12+
class NotificationFilterUrlUserInternal(NotificationFilterUrlUser):
13+
@classmethod
14+
def create_with_list_response(cls,
15+
all_notification_filter: List[NotificationFilterUrl] = None,
16+
custom_headers: Dict[str, str] = None
17+
) -> BunqResponse[List[NotificationFilterUrl]]:
18+
if all_notification_filter is None:
19+
all_notification_filter = []
20+
21+
if custom_headers is None:
22+
custom_headers = {}
23+
24+
request_map = {
25+
cls.FIELD_NOTIFICATION_FILTERS: all_notification_filter
26+
}
27+
request_map_string = converter.class_to_json(request_map)
28+
request_map_string = cls._remove_field_for_request(request_map_string)
29+
30+
api_client = ApiClient(cls._get_api_context())
31+
request_bytes = request_map_string.encode()
32+
endpoint_url = cls._ENDPOINT_URL_CREATE.format(cls._determine_user_id())
33+
response_raw = api_client.post(endpoint_url, request_bytes, custom_headers)
34+
35+
return NotificationFilterUrl._from_json_list(response_raw, cls._OBJECT_TYPE_GET)

0 commit comments

Comments
 (0)