itk-dev-shared-components 2.1.0__tar.gz → 2.2.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {itk_dev_shared_components-2.1.0 → itk_dev_shared_components-2.2.0}/PKG-INFO +1 -1
- {itk_dev_shared_components-2.1.0 → itk_dev_shared_components-2.2.0}/itk_dev_shared_components/kmd_nova/nova_documents.py +23 -3
- itk_dev_shared_components-2.2.0/itk_dev_shared_components/kmd_nova/nova_notes.py +141 -0
- {itk_dev_shared_components-2.1.0 → itk_dev_shared_components-2.2.0}/itk_dev_shared_components/kmd_nova/nova_objects.py +1 -0
- {itk_dev_shared_components-2.1.0 → itk_dev_shared_components-2.2.0}/itk_dev_shared_components.egg-info/PKG-INFO +1 -1
- {itk_dev_shared_components-2.1.0 → itk_dev_shared_components-2.2.0}/itk_dev_shared_components.egg-info/SOURCES.txt +1 -0
- {itk_dev_shared_components-2.1.0 → itk_dev_shared_components-2.2.0}/pyproject.toml +1 -1
- {itk_dev_shared_components-2.1.0 → itk_dev_shared_components-2.2.0}/LICENSE +0 -0
- {itk_dev_shared_components-2.1.0 → itk_dev_shared_components-2.2.0}/README.md +0 -0
- {itk_dev_shared_components-2.1.0 → itk_dev_shared_components-2.2.0}/itk_dev_shared_components/__init__.py +0 -0
- {itk_dev_shared_components-2.1.0 → itk_dev_shared_components-2.2.0}/itk_dev_shared_components/graph/__init__.py +0 -0
- {itk_dev_shared_components-2.1.0 → itk_dev_shared_components-2.2.0}/itk_dev_shared_components/graph/authentication.py +0 -0
- {itk_dev_shared_components-2.1.0 → itk_dev_shared_components-2.2.0}/itk_dev_shared_components/graph/mail.py +0 -0
- {itk_dev_shared_components-2.1.0 → itk_dev_shared_components-2.2.0}/itk_dev_shared_components/kmd_nova/__init__.py +0 -0
- {itk_dev_shared_components-2.1.0 → itk_dev_shared_components-2.2.0}/itk_dev_shared_components/kmd_nova/authentication.py +0 -0
- {itk_dev_shared_components-2.1.0 → itk_dev_shared_components-2.2.0}/itk_dev_shared_components/kmd_nova/cpr.py +0 -0
- {itk_dev_shared_components-2.1.0 → itk_dev_shared_components-2.2.0}/itk_dev_shared_components/kmd_nova/nova_cases.py +0 -0
- {itk_dev_shared_components-2.1.0 → itk_dev_shared_components-2.2.0}/itk_dev_shared_components/kmd_nova/nova_tasks.py +0 -0
- {itk_dev_shared_components-2.1.0 → itk_dev_shared_components-2.2.0}/itk_dev_shared_components/kmd_nova/util.py +0 -0
- {itk_dev_shared_components-2.1.0 → itk_dev_shared_components-2.2.0}/itk_dev_shared_components/misc/__init__.py +0 -0
- {itk_dev_shared_components-2.1.0 → itk_dev_shared_components-2.2.0}/itk_dev_shared_components/misc/cpr_util.py +0 -0
- {itk_dev_shared_components-2.1.0 → itk_dev_shared_components-2.2.0}/itk_dev_shared_components/sap/__init__.py +0 -0
- {itk_dev_shared_components-2.1.0 → itk_dev_shared_components-2.2.0}/itk_dev_shared_components/sap/fmcacov.py +0 -0
- {itk_dev_shared_components-2.1.0 → itk_dev_shared_components-2.2.0}/itk_dev_shared_components/sap/gridview_util.py +0 -0
- {itk_dev_shared_components-2.1.0 → itk_dev_shared_components-2.2.0}/itk_dev_shared_components/sap/multi_session.py +0 -0
- {itk_dev_shared_components-2.1.0 → itk_dev_shared_components-2.2.0}/itk_dev_shared_components/sap/opret_kundekontakt.py +0 -0
- {itk_dev_shared_components-2.1.0 → itk_dev_shared_components-2.2.0}/itk_dev_shared_components/sap/sap_login.py +0 -0
- {itk_dev_shared_components-2.1.0 → itk_dev_shared_components-2.2.0}/itk_dev_shared_components/sap/sap_util.py +0 -0
- {itk_dev_shared_components-2.1.0 → itk_dev_shared_components-2.2.0}/itk_dev_shared_components/sap/tree_util.py +0 -0
- {itk_dev_shared_components-2.1.0 → itk_dev_shared_components-2.2.0}/itk_dev_shared_components/smtp/__init__.py +0 -0
- {itk_dev_shared_components-2.1.0 → itk_dev_shared_components-2.2.0}/itk_dev_shared_components/smtp/smtp_util.py +0 -0
- {itk_dev_shared_components-2.1.0 → itk_dev_shared_components-2.2.0}/itk_dev_shared_components.egg-info/dependency_links.txt +0 -0
- {itk_dev_shared_components-2.1.0 → itk_dev_shared_components-2.2.0}/itk_dev_shared_components.egg-info/requires.txt +0 -0
- {itk_dev_shared_components-2.1.0 → itk_dev_shared_components-2.2.0}/itk_dev_shared_components.egg-info/top_level.txt +0 -0
- {itk_dev_shared_components-2.1.0 → itk_dev_shared_components-2.2.0}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: itk_dev_shared_components
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.2.0
|
|
4
4
|
Summary: Shared components to use in RPA projects
|
|
5
5
|
Author-email: ITK Development <itk-rpa@mkb.aarhus.dk>
|
|
6
6
|
Project-URL: Homepage, https://github.com/itk-dev-rpa/itk-dev-shared-components
|
|
@@ -10,7 +10,7 @@ import urllib.parse
|
|
|
10
10
|
import requests
|
|
11
11
|
|
|
12
12
|
from itk_dev_shared_components.kmd_nova.authentication import NovaAccess
|
|
13
|
-
from itk_dev_shared_components.kmd_nova.nova_objects import Document
|
|
13
|
+
from itk_dev_shared_components.kmd_nova.nova_objects import Document, Caseworker
|
|
14
14
|
from itk_dev_shared_components.kmd_nova. util import datetime_from_iso_string
|
|
15
15
|
|
|
16
16
|
|
|
@@ -44,7 +44,8 @@ def get_documents(case_uuid: str, nova_access: NovaAccess) -> list[Document]:
|
|
|
44
44
|
"approved": True,
|
|
45
45
|
"documentDate": True,
|
|
46
46
|
"fileExtension": True,
|
|
47
|
-
"documentCategory": True
|
|
47
|
+
"documentCategory": True,
|
|
48
|
+
"caseworker": True
|
|
48
49
|
}
|
|
49
50
|
}
|
|
50
51
|
|
|
@@ -55,6 +56,16 @@ def get_documents(case_uuid: str, nova_access: NovaAccess) -> list[Document]:
|
|
|
55
56
|
|
|
56
57
|
documents = []
|
|
57
58
|
for document_dict in response.json()['documents']:
|
|
59
|
+
|
|
60
|
+
if 'caseworker' in document_dict:
|
|
61
|
+
caseworker = Caseworker(
|
|
62
|
+
uuid = document_dict['caseworker']['kspIdentity']['novaUserId'],
|
|
63
|
+
name = document_dict['caseworker']['kspIdentity']['fullName'],
|
|
64
|
+
ident = document_dict['caseworker']['kspIdentity']['racfId']
|
|
65
|
+
)
|
|
66
|
+
else:
|
|
67
|
+
caseworker = None
|
|
68
|
+
|
|
58
69
|
doc = Document(
|
|
59
70
|
uuid = document_dict['documentUuid'],
|
|
60
71
|
document_number = document_dict['documentNumber'],
|
|
@@ -66,7 +77,8 @@ def get_documents(case_uuid: str, nova_access: NovaAccess) -> list[Document]:
|
|
|
66
77
|
document_date = datetime_from_iso_string(document_dict['documentDate']),
|
|
67
78
|
file_extension = document_dict['fileExtension'],
|
|
68
79
|
category_name = document_dict.get('documentCategoryName'),
|
|
69
|
-
category_uuid = document_dict.get('documentCategoryUuid')
|
|
80
|
+
category_uuid = document_dict.get('documentCategoryUuid'),
|
|
81
|
+
caseworker=caseworker
|
|
70
82
|
)
|
|
71
83
|
documents.append(doc)
|
|
72
84
|
|
|
@@ -184,6 +196,14 @@ def attach_document_to_case(case_uuid: str, document: Document, nova_access: Nov
|
|
|
184
196
|
"accessToDocuments": True
|
|
185
197
|
}
|
|
186
198
|
|
|
199
|
+
if document.caseworker:
|
|
200
|
+
payload['caseworker'] = {
|
|
201
|
+
"kspIdentity": {
|
|
202
|
+
"racfId": document.caseworker.ident,
|
|
203
|
+
"fullName": document.caseworker.name
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
|
|
187
207
|
headers = {'Content-Type': 'application/json', 'Authorization': f"Bearer {nova_access.get_bearer_token()}"}
|
|
188
208
|
response = requests.post(url, params=params, headers=headers, json=payload, timeout=60)
|
|
189
209
|
response.raise_for_status()
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
"""This module has functions to do with journal note related calls to the KMD Nova api."""
|
|
2
|
+
|
|
3
|
+
import base64
|
|
4
|
+
import uuid
|
|
5
|
+
import urllib.parse
|
|
6
|
+
from datetime import datetime
|
|
7
|
+
|
|
8
|
+
import requests
|
|
9
|
+
|
|
10
|
+
from itk_dev_shared_components.kmd_nova.authentication import NovaAccess
|
|
11
|
+
from itk_dev_shared_components.kmd_nova.nova_objects import JournalNote
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def add_text_note(case_uuid: str, note_title: str, note_text: str, approved: bool, nova_access: NovaAccess) -> str:
|
|
15
|
+
"""Add a text based journal note to a Nova case.
|
|
16
|
+
|
|
17
|
+
Args:
|
|
18
|
+
case_uuid: The uuid of the case to add the journal note to.
|
|
19
|
+
note_title: The title of the note.
|
|
20
|
+
note_text: The text content of the note.
|
|
21
|
+
approved: Whether the journal note should be marked as approved in Nova.
|
|
22
|
+
nova_access: The NovaAccess object used to authenticate.
|
|
23
|
+
|
|
24
|
+
Returns:
|
|
25
|
+
The uuid of the created journal note.
|
|
26
|
+
"""
|
|
27
|
+
note_uuid = str(uuid.uuid4())
|
|
28
|
+
|
|
29
|
+
url = urllib.parse.urljoin(nova_access.domain, "api/Case/Update")
|
|
30
|
+
params = {"api-version": "1.0-Case"}
|
|
31
|
+
|
|
32
|
+
payload = {
|
|
33
|
+
"common": {
|
|
34
|
+
"transactionId": str(uuid.uuid4()),
|
|
35
|
+
"uuid": case_uuid
|
|
36
|
+
},
|
|
37
|
+
"journalNotes": [
|
|
38
|
+
{
|
|
39
|
+
"uuid": note_uuid,
|
|
40
|
+
"approved": approved,
|
|
41
|
+
"journalNoteAttributes": {
|
|
42
|
+
"journalNoteDate": datetime.today().isoformat(),
|
|
43
|
+
"title": note_title,
|
|
44
|
+
"journalNoteType": "Bruger",
|
|
45
|
+
"format": "Text",
|
|
46
|
+
"note": _encode_text(note_text)
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
]
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
headers = {'Content-Type': 'application/json', 'Authorization': f"Bearer {nova_access.get_bearer_token()}"}
|
|
53
|
+
|
|
54
|
+
response = requests.patch(url, params=params, headers=headers, json=payload, timeout=60)
|
|
55
|
+
response.raise_for_status()
|
|
56
|
+
|
|
57
|
+
return note_uuid
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
def _encode_text(string: str) -> str:
|
|
61
|
+
"""Encode a string to a base64 string.
|
|
62
|
+
Ensure the base64 string doesn't contain padding by inserting spaces at the end of the input string.
|
|
63
|
+
There is a bug in the Nova api that corrupts the string if it contains padding.
|
|
64
|
+
The extra spaces will not show up in the Nova user interface.
|
|
65
|
+
|
|
66
|
+
Args:
|
|
67
|
+
string: The string to encode.
|
|
68
|
+
|
|
69
|
+
Returns:
|
|
70
|
+
A base64 string containing no padding.
|
|
71
|
+
"""
|
|
72
|
+
def b64(s: str) -> str:
|
|
73
|
+
"""Helper function to convert a string to base64."""
|
|
74
|
+
return base64.b64encode(s.encode()).decode()
|
|
75
|
+
|
|
76
|
+
while (s := b64(string)).endswith("="):
|
|
77
|
+
string += ' '
|
|
78
|
+
|
|
79
|
+
return s
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
def get_notes(case_uuid: str, nova_access: NovaAccess, offset: int = 0, limit: int = 100) -> tuple[JournalNote, ...]:
|
|
83
|
+
"""Get all journal notes from the given case.
|
|
84
|
+
|
|
85
|
+
Args:
|
|
86
|
+
case_uuid: The uuid of the case to get notes from.
|
|
87
|
+
nova_access: The NovaAccess object used to authenticate.
|
|
88
|
+
offset: The number of journal notes to skip.
|
|
89
|
+
limit: The maximum number of journal notes to get (1-500).
|
|
90
|
+
|
|
91
|
+
Returns:
|
|
92
|
+
A tuple of JournalNote objects.
|
|
93
|
+
"""
|
|
94
|
+
url = urllib.parse.urljoin(nova_access.domain, "api/Case/GetList")
|
|
95
|
+
params = {"api-version": "1.0-Case"}
|
|
96
|
+
|
|
97
|
+
payload = {
|
|
98
|
+
"common": {
|
|
99
|
+
"transactionId": str(uuid.uuid4()),
|
|
100
|
+
"uuid": case_uuid
|
|
101
|
+
},
|
|
102
|
+
"paging": {
|
|
103
|
+
"startRow": offset+1,
|
|
104
|
+
"numberOfRows": limit
|
|
105
|
+
},
|
|
106
|
+
"caseGetOutput": {
|
|
107
|
+
"journalNotes": {
|
|
108
|
+
"uuid": True,
|
|
109
|
+
"approved": True,
|
|
110
|
+
"journalNoteAttributes": {
|
|
111
|
+
"title": True,
|
|
112
|
+
"format": True,
|
|
113
|
+
"note": True,
|
|
114
|
+
"createdTime": True
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
headers = {'Content-Type': 'application/json', 'Authorization': f"Bearer {nova_access.get_bearer_token()}"}
|
|
121
|
+
|
|
122
|
+
response = requests.put(url, params=params, headers=headers, json=payload, timeout=60)
|
|
123
|
+
response.raise_for_status()
|
|
124
|
+
|
|
125
|
+
note_dicts = response.json()['cases'][0]['journalNotes']['journalNotes']
|
|
126
|
+
|
|
127
|
+
notes_list = []
|
|
128
|
+
|
|
129
|
+
for note_dict in note_dicts:
|
|
130
|
+
notes_list.append(
|
|
131
|
+
JournalNote(
|
|
132
|
+
uuid=note_dict['uuid'],
|
|
133
|
+
title=note_dict['journalNoteAttributes']['title'],
|
|
134
|
+
approved=note_dict['approved'],
|
|
135
|
+
journal_date=note_dict['journalNoteAttributes']['createdTime'],
|
|
136
|
+
note=note_dict['journalNoteAttributes']['note'],
|
|
137
|
+
note_format=note_dict['journalNoteAttributes']['format']
|
|
138
|
+
)
|
|
139
|
+
)
|
|
140
|
+
|
|
141
|
+
return tuple(notes_list)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: itk_dev_shared_components
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.2.0
|
|
4
4
|
Summary: Shared components to use in RPA projects
|
|
5
5
|
Author-email: ITK Development <itk-rpa@mkb.aarhus.dk>
|
|
6
6
|
Project-URL: Homepage, https://github.com/itk-dev-rpa/itk-dev-shared-components
|
|
@@ -15,6 +15,7 @@ itk_dev_shared_components/kmd_nova/authentication.py
|
|
|
15
15
|
itk_dev_shared_components/kmd_nova/cpr.py
|
|
16
16
|
itk_dev_shared_components/kmd_nova/nova_cases.py
|
|
17
17
|
itk_dev_shared_components/kmd_nova/nova_documents.py
|
|
18
|
+
itk_dev_shared_components/kmd_nova/nova_notes.py
|
|
18
19
|
itk_dev_shared_components/kmd_nova/nova_objects.py
|
|
19
20
|
itk_dev_shared_components/kmd_nova/nova_tasks.py
|
|
20
21
|
itk_dev_shared_components/kmd_nova/util.py
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|