Skip to content

Commit 299061b

Browse files
committed
feature/add_internal_notification_filters: added notification_filter_url_monetary_account_internal.py
1 parent 7506143 commit 299061b

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
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 NotificationFilterUrlMonetaryAccount
9+
from bunq.sdk.model.generated.object_ import NotificationFilterUrl
10+
11+
12+
class NotificationFilterUrlMonetaryAccountInternal(NotificationFilterUrlMonetaryAccount):
13+
@classmethod
14+
def create_with_list_response(cls,
15+
monetary_account_id: int = None,
16+
all_notification_filter: List[NotificationFilterUrl] = None,
17+
custom_headers: Dict[str, str] = None
18+
) -> BunqResponse[List[NotificationFilterUrl]]:
19+
if all_notification_filter is None:
20+
all_notification_filter = []
21+
22+
if custom_headers is None:
23+
custom_headers = {}
24+
25+
request_map = {
26+
cls.FIELD_NOTIFICATION_FILTERS: all_notification_filter
27+
}
28+
request_map_string = converter.class_to_json(request_map)
29+
request_map_string = cls._remove_field_for_request(request_map_string)
30+
31+
api_client = ApiClient(cls._get_api_context())
32+
request_bytes = request_map_string.encode()
33+
endpoint_url = cls._ENDPOINT_URL_CREATE.format(cls._determine_user_id(),
34+
cls._determine_monetary_account_id(monetary_account_id))
35+
response_raw = api_client.post(endpoint_url, request_bytes, custom_headers)
36+
37+
return NotificationFilterUrl._from_json_list(response_raw, cls._OBJECT_TYPE_GET)

0 commit comments

Comments
 (0)