kodexa 7.4.413228596953__py3-none-any.whl → 7.4.413229965531__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
kodexa/platform/client.py CHANGED
@@ -86,7 +86,8 @@ from kodexa.model.objects import (
86
86
  PageExtensionPack,
87
87
  PageOrganization,
88
88
  DocumentFamilyStatistics, MessageContext, PagePrompt, Prompt, GuidanceSet, PageGuidanceSet, DocumentEmbedding,
89
- DocumentExternalData, Task, PageTask, RetainedGuidance, PageRetainedGuidance,
89
+ DocumentExternalData, Task, PageTask, RetainedGuidance, PageRetainedGuidance, TaskTemplate, TaskStatus,
90
+ TaskActivity, TaskDocumentFamily, TaskTag,
90
91
  )
91
92
 
92
93
  logger = logging.getLogger()
@@ -1174,8 +1175,171 @@ class PagePipelineEndpoint(PagePipeline, PageEndpoint):
1174
1175
 
1175
1176
 
1176
1177
  class PageTaskEndpoint(PageTask, PageEndpoint):
1178
+ """
1179
+ Represents a page of tasks.
1180
+ """
1181
+ def get_type(self) -> Optional[str]:
1182
+ return "tasks"
1183
+
1184
+ class PageTaskActivityEndpoint(PageEndpoint):
1185
+ """
1186
+ Represents a page of task activities.
1187
+ """
1188
+ def get_type(self) -> Optional[str]:
1189
+ return "taskActivities"
1190
+
1191
+ class PageTaskDocumentFamilyEndpoint(PageEndpoint):
1192
+ """
1193
+ Represents a page of task document families.
1194
+ """
1195
+ def get_type(self) -> Optional[str]:
1196
+ return "taskDocumentFamilies"
1197
+
1198
+ class PageTaskTagEndpoint(PageEndpoint):
1199
+ """
1200
+ Represents a page of task tags.
1201
+ """
1202
+ def get_type(self) -> Optional[str]:
1203
+ return "taskTags"
1204
+
1205
+ class TaskEndpoint(EntityEndpoint, Task):
1206
+ """
1207
+ Represents a task endpoint.
1208
+ """
1209
+ def get_type(self) -> str:
1210
+ return "tasks"
1211
+
1212
+ def create_with_request(self, task: Task, task_template: Optional[TaskTemplate] = None, document_families: Optional[List[DocumentFamily]] = None):
1213
+ """Create a task with the given request."""
1214
+ url = "/api/tasks/createTaskWithRequest"
1215
+ response = self.client.post(url, body={
1216
+ "task": task.model_dump(mode="json", by_alias=True),
1217
+ "taskTemplate": task_template.model_dump(mode="json", by_alias=True) if task_template else None,
1218
+ "documentFamilies": [df.model_dump(mode="json", by_alias=True) for df in document_families] if document_families else None
1219
+ })
1220
+ return TaskEndpoint.model_validate(response.json()).set_client(self.client)
1221
+
1222
+ def update_status(self, status: TaskStatus):
1223
+ """Update the status of the task."""
1224
+ url = f"/api/tasks/{self.id}/status"
1225
+ response = self.client.put(url, body=status)
1226
+ return TaskEndpoint.model_validate(response.json()).set_client(self.client)
1227
+
1228
+ def remove_status(self):
1229
+ """Remove the task status."""
1230
+ url = f"/api/tasks/{self.id}/status"
1231
+ response = self.client.delete(url)
1232
+ return TaskEndpoint.model_validate(response.json()).set_client(self.client)
1233
+
1234
+ def update_assignee(self, assignee: User):
1235
+ """Update the assignee of the task."""
1236
+ url = f"/api/tasks/{self.id}/assignee"
1237
+ response = self.client.put(url, body=assignee.model_dump(mode="json", by_alias=True))
1238
+ return TaskEndpoint.model_validate(response.json()).set_client(self.client)
1239
+
1240
+ def remove_assignee(self):
1241
+ """Remove the task assignee."""
1242
+ url = f"/api/tasks/{self.id}/assignee"
1243
+ response = self.client.delete(url)
1244
+ return TaskEndpoint.model_validate(response.json()).set_client(self.client)
1245
+
1246
+ class TasksEndpoint(EntitiesEndpoint):
1247
+ """
1248
+ Represents tasks endpoints.
1249
+ """
1250
+ def get_type(self) -> str:
1251
+ return "tasks"
1252
+
1253
+ def get_instance_class(self, object_dict=None):
1254
+ return TaskEndpoint
1255
+
1256
+ def get_page_class(self, object_dict=None):
1257
+ return PageTaskEndpoint
1258
+
1259
+ class TaskTemplateEndpoint(EntityEndpoint, TaskTemplate):
1260
+ """
1261
+ Represents a task template endpoint.
1262
+ """
1263
+ def get_type(self) -> str:
1264
+ return "taskTemplates"
1265
+
1266
+ class TaskTemplatesEndpoint(EntitiesEndpoint):
1267
+ """
1268
+ Represents task templates endpoints.
1269
+ """
1270
+ def get_type(self) -> str:
1271
+ return "taskTemplates"
1272
+
1273
+ def get_instance_class(self, object_dict=None):
1274
+ return TaskTemplateEndpoint
1275
+
1276
+ def get_page_class(self, object_dict=None):
1277
+ return PageTaskTemplateEndpoint
1278
+
1279
+ class TaskActivityEndpoint(EntityEndpoint, TaskActivity):
1280
+ """
1281
+ Represents a task activity endpoint.
1282
+ """
1283
+ def get_type(self) -> str:
1284
+ return "taskActivities"
1285
+
1286
+ class TaskActivitiesEndpoint(EntitiesEndpoint):
1287
+ """
1288
+ Represents task activities endpoints.
1289
+ """
1290
+ def get_type(self) -> str:
1291
+ return "taskActivities"
1292
+
1293
+ def get_instance_class(self, object_dict=None):
1294
+ return TaskActivityEndpoint
1295
+
1296
+ def get_page_class(self, object_dict=None):
1297
+ return PageTaskActivityEndpoint
1298
+
1299
+ class TaskDocumentFamilyEndpoint(EntityEndpoint, TaskDocumentFamily):
1300
+ """
1301
+ Represents a task document family endpoint.
1302
+ """
1303
+ def get_type(self) -> str:
1304
+ return "taskDocumentFamilies"
1305
+
1306
+ class TaskDocumentFamiliesEndpoint(EntitiesEndpoint):
1307
+ """
1308
+ Represents task document families endpoints.
1309
+ """
1310
+ def get_type(self) -> str:
1311
+ return "taskDocumentFamilies"
1312
+
1313
+ def get_instance_class(self, object_dict=None):
1314
+ return TaskDocumentFamilyEndpoint
1315
+
1316
+ def get_page_class(self, object_dict=None):
1317
+ return PageTaskDocumentFamilyEndpoint
1318
+
1319
+ class TaskTagEndpoint(EntityEndpoint, TaskTag):
1320
+ """
1321
+ Represents a task tag endpoint.
1322
+ """
1323
+ def get_type(self) -> str:
1324
+ return "taskTags"
1325
+
1326
+ class TaskTagsEndpoint(EntitiesEndpoint):
1327
+ """
1328
+ Represents task tags endpoints.
1329
+ """
1330
+ def get_type(self) -> str:
1331
+ return "taskTags"
1332
+
1333
+ def get_instance_class(self, object_dict=None):
1334
+ return TaskTagEndpoint
1335
+
1336
+ def get_page_class(self, object_dict=None):
1337
+ return PageTaskTagEndpoint
1338
+
1339
+
1340
+ class PageTaskTemplateEndpoint(PageTask, PageEndpoint):
1177
1341
  def get_type(self) -> Optional[str]:
1178
- return "task"
1342
+ return "taskTemplate"
1179
1343
 
1180
1344
 
1181
1345
  class PageRetainedGuidanceEndpoint(PageRetainedGuidance, PageEndpoint):
@@ -2546,6 +2710,21 @@ class WorkspaceEndpoint(EntityEndpoint, Workspace):
2546
2710
  raise ValueError("Workspace has no channel")
2547
2711
 
2548
2712
 
2713
+ class TaskTemplateEndpoint(EntityEndpoint, Task):
2714
+ """Represents a task endpoint.
2715
+
2716
+ This class is used to interact with the task endpoint of the API.
2717
+ """
2718
+
2719
+ def get_type(self) -> str:
2720
+ """Get the type of the endpoint.
2721
+
2722
+ Returns:
2723
+ str: The type of the endpoint, in this case "projects".
2724
+ """
2725
+ return "taskTemplates"
2726
+
2727
+
2549
2728
  class TaskEndpoint(EntityEndpoint, Task):
2550
2729
  """Represents a task endpoint.
2551
2730
 
@@ -2906,6 +3085,37 @@ class AssistantsEndpoint(EntitiesEndpoint):
2906
3085
  return PageAssistantEndpoint
2907
3086
 
2908
3087
 
3088
+ class TaskTemplatesEndpoint(EntitiesEndpoint):
3089
+ """Represents a projects endpoint"""
3090
+
3091
+ def get_type(self) -> str:
3092
+ """
3093
+ Get the type of the endpoint.
3094
+
3095
+ Returns:
3096
+ str: The type of the endpoint.
3097
+ """
3098
+ return "taskTemplates"
3099
+
3100
+ def get_instance_class(self, object_dict=None):
3101
+ """
3102
+ Get the instance class of the endpoint.
3103
+
3104
+ Returns:
3105
+ ProjectEndpoint: The instance class of the endpoint.
3106
+ """
3107
+ return TaskTemplateEndpoint
3108
+
3109
+ def get_page_class(self, object_dict=None):
3110
+ """
3111
+ Get the page class of the endpoint.
3112
+
3113
+ Returns:
3114
+ PageProjectEndpoint: The page class of the endpoint.
3115
+ """
3116
+ return PageTaskTemplateEndpoint
3117
+
3118
+
2909
3119
  class TasksEndpoint(EntitiesEndpoint):
2910
3120
  """Represents a projects endpoint"""
2911
3121
 
@@ -4616,11 +4826,11 @@ class DocumentFamilyEndpoint(DocumentFamily, ClientEndpoint):
4616
4826
  url = f"/api/documentFamilies/{self.id}/externalData"
4617
4827
  response = self.client.put(url, body=external_data)
4618
4828
  return response.json()
4619
-
4829
+
4620
4830
  def get_json(
4621
4831
  self,
4622
4832
  project_id: str,
4623
- friendly_names=False,
4833
+ friendly_names=False,
4624
4834
  ) -> str:
4625
4835
  """Get the JSON export for the document family
4626
4836
 
@@ -4635,7 +4845,7 @@ class DocumentFamilyEndpoint(DocumentFamily, ClientEndpoint):
4635
4845
  raise Exception(
4636
4846
  f"Project ID is required"
4637
4847
  )
4638
-
4848
+
4639
4849
  url = f"/api/stores/{self.store_ref.replace(':', '/')}/families/{self.id}/dataObjects"
4640
4850
  params = {
4641
4851
  "format": "json",
@@ -4698,9 +4908,9 @@ class DocumentFamilyEndpoint(DocumentFamily, ClientEndpoint):
4698
4908
  "Waiting for mixin and/or label to be available on document family %s",
4699
4909
  self.id,
4700
4910
  )
4701
- if polling_delay_in_seconds < 5:
4911
+ if polling_delay_in_seconds < 5:
4702
4912
  polling_delay_in_seconds = 5
4703
-
4913
+
4704
4914
  start = time.time()
4705
4915
  while time.time() - start < timeout:
4706
4916
  url = f"/api/stores/{self.store_ref.replace(':', '/')}/families/{self.id}"
@@ -4856,6 +5066,7 @@ class DocumentFamilyEndpoint(DocumentFamily, ClientEndpoint):
4856
5066
  params=params,
4857
5067
  files={"file": document.to_kddb()},
4858
5068
  )
5069
+
4859
5070
  def export_as_zip(self) -> bytes:
4860
5071
  """
4861
5072
  Export the document family as bytes.
@@ -5172,7 +5383,7 @@ class DataStoreEndpoint(StoreEndpoint):
5172
5383
 
5173
5384
  response = self.client.get(url, params=params)
5174
5385
  return response.text
5175
-
5386
+
5176
5387
  def get_taxonomies(self) -> List[Taxonomy]:
5177
5388
  """Get the taxonomies of the store
5178
5389
 
@@ -6386,6 +6597,20 @@ OBJECT_TYPES = {
6386
6597
  "global": True,
6387
6598
  "endpoint": MembershipsEndpoint,
6388
6599
  },
6600
+ "tasks": {
6601
+ "name": "task",
6602
+ "plural": "tasks",
6603
+ "type": TaskEndpoint,
6604
+ "global": True,
6605
+ "endpoint": TasksEndpoint,
6606
+ },
6607
+ "taskTemplates": {
6608
+ "name": "taskTemplate",
6609
+ "plural": "taskTemplates",
6610
+ "type": TaskTemplateEndpoint,
6611
+ "global": True,
6612
+ "endpoint": TaskTemplatesEndpoint,
6613
+ }
6389
6614
  }
6390
6615
 
6391
6616
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: kodexa
3
- Version: 7.4.413228596953
3
+ Version: 7.4.413229965531
4
4
  Summary: Python SDK for the Kodexa Platform
5
5
  Author: Austin Redenbaugh
6
6
  Author-email: austin@kodexa.com
@@ -19,7 +19,7 @@ kodexa/model/utils.py,sha256=6R-3rFiW9irBwj0Mq5yhp7EDXkNUFaeFhr3bWmnlW4g,2961
19
19
  kodexa/pipeline/__init__.py,sha256=sA7f5D6qkdMrpp2xTIeefnrUBI6xxEEWostvxfX_1Cs,236
20
20
  kodexa/pipeline/pipeline.py,sha256=Z4O6UwoISeP_HMlxm6l6kbcvFBDw3Glm7lT4cUibri4,25461
21
21
  kodexa/platform/__init__.py,sha256=1O3oiWMg292NPL_NacKDnK1T3_R6cMorrPRue_9e-O4,216
22
- kodexa/platform/client.py,sha256=UdMLp_1fcWa8bJc30AD8kwLyqM6zxWLQp57cZKYZV9Q,228861
22
+ kodexa/platform/client.py,sha256=odEggW0k-Y8R4jOcY3gSiDzrHnfcTihIQTMs0hhtcso,235436
23
23
  kodexa/platform/interaction.py,sha256=6zpcwXKNZstUGNS6m4JsoRXAqCZPJHWI-ZN3co8nnF0,1055
24
24
  kodexa/platform/kodexa.py,sha256=tPXHO500q3S75GhKGDcaxO51Viq2PNlHmAzpBZlahgo,34857
25
25
  kodexa/selectors/__init__.py,sha256=xA9-4vpyaAZWPSk3bh2kvDLkdv6XEmm7PjFbpziiTIk,100
@@ -44,7 +44,7 @@ kodexa/testing/test_utils.py,sha256=v44p__gE7ia67W7WeHN2HBFCWSCUrCZt7G4xBNCmwf8,
44
44
  kodexa/training/__init__.py,sha256=xs2L62YpRkIRfslQwtQZ5Yxjhm7sLzX2TrVX6EuBnZQ,52
45
45
  kodexa/training/train_utils.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
46
46
  kodexa/utils/__init__.py,sha256=Pnim1o9_db5YEnNvDTxpM7HG-qTlL6n8JwFwOafU9wo,5928
47
- kodexa-7.4.413228596953.dist-info/LICENSE,sha256=WNHhf_5RCaeuKWyq_K39vmp9F28LxKsB4SpomwSZ2L0,11357
48
- kodexa-7.4.413228596953.dist-info/METADATA,sha256=xfHJukntAuWThxb0FO0wtQ8ZU-SPV3MSzrz4JA6jUw8,3528
49
- kodexa-7.4.413228596953.dist-info/WHEEL,sha256=Zb28QaM1gQi8f4VCBhsUklF61CTlNYfs9YAZn-TOGFk,88
50
- kodexa-7.4.413228596953.dist-info/RECORD,,
47
+ kodexa-7.4.413229965531.dist-info/LICENSE,sha256=WNHhf_5RCaeuKWyq_K39vmp9F28LxKsB4SpomwSZ2L0,11357
48
+ kodexa-7.4.413229965531.dist-info/METADATA,sha256=Hp1AzXcktjapvukfwkTv9nEzon8dlaiDZxxzhyUMSv0,3528
49
+ kodexa-7.4.413229965531.dist-info/WHEEL,sha256=Zb28QaM1gQi8f4VCBhsUklF61CTlNYfs9YAZn-TOGFk,88
50
+ kodexa-7.4.413229965531.dist-info/RECORD,,