Skip to content

Commit c73aef8

Browse files
committed
updates to python sdk
1 parent 129179a commit c73aef8

File tree

2 files changed

+60
-14
lines changed

2 files changed

+60
-14
lines changed

las/__version__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@
77
__maintainer_email__ ='[email protected]'
88
__title__ = 'lucidtech-las'
99
__url__ = 'https://github.com/LucidtechAI/las-sdk-python'
10-
__version__ = '11.4.1'
10+
__version__ = '12.0.0'

las/client.py

Lines changed: 59 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2677,13 +2677,25 @@ def list_validations(self, *, max_results: Optional[int] = None, next_token: Opt
26772677
}
26782678
return self._make_request(requests.get, '/validations', params=params)
26792679

2680-
def create_validation(self, *, metadata: Optional[dict] = None, **optional_args) -> Dict:
2680+
def create_validation(
2681+
self,
2682+
project_id: str,
2683+
*,
2684+
config: Optional[dict] = None,
2685+
metadata: Optional[dict] = None,
2686+
**optional_args,
2687+
) -> Dict:
2688+
26812689
"""Creates a validation, calls the POST /validations endpoint.
26822690
2691+
:param project_id: Id of the project
2692+
:type project_id: str
26832693
:param name: Name of the validation
26842694
:type name: str, optional
26852695
:param description: Description of the validation
26862696
:type description: str, optional
2697+
:param config: Dictionary that is used for configuration of the validation
2698+
:type config: dict, optional
26872699
:param metadata: Dictionary that can be used to store additional information
26882700
:type metadata: dict, optional
26892701
:return: Dataset response from REST API
@@ -2692,7 +2704,11 @@ def create_validation(self, *, metadata: Optional[dict] = None, **optional_args)
26922704
:raises: :py:class:`~las.InvalidCredentialsException`, :py:class:`~las.TooManyRequestsException`,\
26932705
:py:class:`~las.LimitExceededException`, :py:class:`requests.exception.RequestException`
26942706
"""
2695-
body = dictstrip({'metadata': metadata})
2707+
body = dictstrip({
2708+
'projectId': project_id,
2709+
'config': config,
2710+
'metadata': metadata,
2711+
})
26962712
body.update(**optional_args)
26972713
return self._make_request(requests.post, '/validations', body=body)
26982714

@@ -2736,6 +2752,7 @@ def update_validation_task(
27362752
validation_id: str,
27372753
validation_task_id: str,
27382754
output: dict,
2755+
status: str,
27392756
*,
27402757
metadata: Optional[dict] = None,
27412758
**optional_args,
@@ -2747,7 +2764,9 @@ def update_validation_task(
27472764
:param validation_task_id: Id of the validation task
27482765
:type validation_task_id: str
27492766
:param output: Dictionary that can be used to store additional information
2750-
:type output: dict, optional
2767+
:type output: dict, required if status is present, otherwise optional
2768+
:param status: Status of the task
2769+
:type status: str, required if output is present, otherwise optional
27512770
:param name: Name of the validation
27522771
:type name: str, optional
27532772
:param description: Description of the validation
@@ -2760,14 +2779,45 @@ def update_validation_task(
27602779
:raises: :py:class:`~las.InvalidCredentialsException`, :py:class:`~las.TooManyRequestsException`,\
27612780
:py:class:`~las.LimitExceededException`, :py:class:`requests.exception.RequestException`
27622781
"""
2763-
body = dictstrip({'output': output, 'metadata': metadata})
2782+
body = dictstrip({'output': output, 'metadata': metadata, 'status': status})
27642783
body.update(**optional_args)
27652784
return self._make_request(
27662785
requests_fn=requests.patch,
27672786
path=f'/validations/{validation_id}/tasks/{validation_task_id}',
27682787
body=body,
27692788
)
27702789

2790+
def list_validation_tasks(
2791+
self,
2792+
validation_id: str,
2793+
*,
2794+
max_results: Optional[int] = None,
2795+
next_token: Optional[str] = None,
2796+
status: Optional[Queryparam] = None,
2797+
) -> Dict:
2798+
"""List validation tasks, calls the GET /validations/{validationId}/tasks endpoint.
2799+
2800+
:param validation_id: Id of the validation
2801+
:type validation_id: str
2802+
:param max_results: Maximum number of results to be returned
2803+
:type max_results: int, optional
2804+
:param next_token: A unique token for each page, use the returned token to retrieve the next page.
2805+
:type next_token: str, optional
2806+
:param status: Statuses of the validation tasks
2807+
:type status: Queryparam, optional
2808+
:return: ValidationTasks response from REST API without the content of each validation
2809+
:rtype: dict
2810+
2811+
:raises: :py:class:`~las.InvalidCredentialsException`, :py:class:`~las.TooManyRequestsException`,\
2812+
:py:class:`~las.LimitExceededException`, :py:class:`requests.exception.RequestException`
2813+
"""
2814+
params = dictstrip({
2815+
'maxResults': max_results,
2816+
'nextToken': next_token,
2817+
'status': status,
2818+
})
2819+
return self._make_request(requests.get, f'/validations/{validation_id}/tasks', params=dictstrip(params))
2820+
27712821
def create_project(
27722822
self,
27732823
*,
@@ -2970,13 +3020,13 @@ def get_hook(self, hook_id: str) -> Dict:
29703020
def create_hook(
29713021
self,
29723022
project_id: str,
2973-
condition: str,
29743023
trigger: str,
2975-
true_action_id: str,
29763024
*,
29773025
config: Optional[dict] = None,
29783026
description: Optional[str] = None,
29793027
enabled: Optional[bool] = None,
3028+
function_id: Optional[str] = None,
3029+
true_action_id: Optional[str] = None,
29803030
false_action_id: Optional[str] = None,
29813031
metadata: Optional[dict] = None,
29823032
name: Optional[str] = None,
@@ -2986,10 +3036,10 @@ def create_hook(
29863036
29873037
:param project_id: Id of the project the hook belongs to
29883038
:type project_id: str
2989-
:param condition: The condition to evaluate true or false when hook is run
2990-
:type condition: str
29913039
:param trigger: What will trigger the hook to be run
29923040
:type trigger: str
3041+
:param function_id: Id of the function to evaluate whether to run the false or true action
3042+
:type function_id: str
29933043
:param true_action_id: Id of the action that will happen when hook run evaluates to true
29943044
:type true_action_id: str
29953045
:param enabled: If the hook is enabled or not
@@ -3011,11 +3061,11 @@ def create_hook(
30113061
:py:class:`~las.LimitExceededException`, :py:class:`requests.exception.RequestException`
30123062
"""
30133063
body = dictstrip({
3014-
'condition': condition,
30153064
'config': config,
30163065
'description': description,
30173066
'enabled': enabled,
30183067
'falseActionId': false_action_id,
3068+
'functionId': function_id,
30193069
'metadata': metadata,
30203070
'name': name,
30213071
'projectId': project_id,
@@ -3041,7 +3091,6 @@ def update_hook(
30413091
self,
30423092
hook_id: str,
30433093
*,
3044-
condition: Optional[str] = None,
30453094
trigger: Optional[str] = None,
30463095
true_action_id: Optional[str] = None,
30473096
config: Optional[dict] = None,
@@ -3055,8 +3104,6 @@ def update_hook(
30553104
30563105
:param hook_id: Id of the hook the hook belongs to
30573106
:type hook_id: str
3058-
:param condition: The condition to evaluate true or false when hook is run
3059-
:type condition: str, optional
30603107
:param trigger: What will trigger the hook to be run
30613108
:type trigger: str, optional
30623109
:param true_action_id: Id of the action that will happen when hook run evaluates to true
@@ -3080,7 +3127,6 @@ def update_hook(
30803127
:py:class:`~las.LimitExceededException`, :py:class:`requests.exception.RequestException`
30813128
"""
30823129
body = dictstrip({
3083-
'condition': condition,
30843130
'config': config,
30853131
'enabled': enabled,
30863132
'falseActionId': false_action_id,

0 commit comments

Comments
 (0)