Skip to content

Commit ce94c34

Browse files
committed
add submit workflow task apis
1 parent 586c636 commit ce94c34

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

seatable_api/main.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,12 @@ def _send_toast_notification_url(self):
181181
'dtable_uuid': self.dtable_uuid
182182
}
183183

184+
def _add_workflow_task_url(self, token):
185+
return '%(server_url)s/api/v2.1/workflows/%(token)s/external-task-submit/' % {
186+
'server_url': self.server_url,
187+
'token': token
188+
}
189+
184190
def _get_account_detail(self, account_name):
185191
url = self._third_party_accounts_url()
186192
params = {
@@ -918,6 +924,22 @@ def send_toast_notification(self, user_id, msg, toast_type='success'):
918924
}
919925
}, headers=self.headers)
920926

927+
def add_workflow_task(self, workflow_token, row_data, link_rows=None, new_linked_rows=None):
928+
url = self._add_workflow_task_url(workflow_token)
929+
headers = {'Authorization': 'Token ' + self.jwt_token}
930+
response = requests.post(url, data={
931+
'row_data': json.dumps(row_data),
932+
'link_rows': json.dumps(link_rows or []),
933+
'new_linked_rows': json.dumps(new_linked_rows or [])
934+
}, headers=headers)
935+
return parse_response(response)['task']
936+
937+
def add_workflow_task_with_existed_row(self, workflow_token, row_id):
938+
url = self._add_workflow_task_url(workflow_token)
939+
headers = {'Authorization': 'Token ' + self.jwt_token}
940+
response = requests.post(url, data={'row_id': row_id}, headers=headers)
941+
return parse_response(response)['task']
942+
921943

922944
class Account(object):
923945
def __init__(self, login_name, password, server_url):

0 commit comments

Comments
 (0)