예제 #1
0
def correlate(data: CorrelationMessageDto = CorrelationMessageDto()) -> Optional[
    MessageCorrelationResultWithVariableDto]:
    api = use_api()
    result = api.post("/message", data=data.dict(exclude_unset=True, by_alias=True))

    if result:
        return MessageCorrelationResultWithVariableDto.parse_obj(result)
예제 #2
0
def complete(
    id: str, data: CompleteTaskDto = CompleteTaskDto()
) -> Optional[Mapping[str, VariableValueDto]]:
    api = use_api()
    result = api.post(f"/task/{id}/complete",
                      data=data.dict(exclude_unset=True, by_alias=True))
    if result:
        return {k: VariableValueDto.parse_obj(v) for k, v in result.items()}
def get_xml(id: str = None,
            key: str = None,
            tenant_id: str = None) -> ProcessDefinitionDiagramDto:
    if not id or key:
        raise ValueError("You need to provide either id or key")

    api = use_api()

    if id:
        path = f"/process-definition/{id}/xml"
    elif key and tenant_id:
        path = f"/process-definition/key/{key}/tenant-id/{tenant_id}/xml"
    else:
        path = f"/process-definition/key/{key}/xml"

    result = api.get(path)
    return ProcessDefinitionDiagramDto.parse_obj(result)
예제 #4
0
def get_variables(id: str) -> Mapping[str, VariableValueDto]:
    api = use_api()
    result = api.get(f"/process-instance/{id}/variables")
    return {key: VariableValueDto.parse_obj(value) for key, value in result.items()}
예제 #5
0
def update_variables(id: str, data: PatchVariablesDto):
    api = use_api()
    api.post(f"/process-instance/{id}/variables", data=data.dict(exclude_unset=True, by_alias=True))
예제 #6
0
def get_list(data: ProcessInstanceQueryDto = ProcessInstanceQueryDto()) -> Sequence[ProcessInstanceDto]:
    api = use_api()
    result = api.post("/process-instance", data=data.dict(exclude_unset=True, by_alias=True))
    return [ProcessInstanceDto.parse_obj(item) for item in result]
예제 #7
0
def get(id: str):
    api = use_api()
    result = api.get(f"/process-instance/{id}")
    return ProcessInstanceDto.parse_obj(result)
예제 #8
0
def version() -> str:
    api = use_api()
    result = api.get("/version")
    return result['version']
예제 #9
0
def get_identity_links(id: str):
    api = use_api()
    result = api.get(f"/task/{id}/identity-links")
    return [IdentityLinkDto.parse_obj(item) for item in result]
예제 #10
0
def set_assignee(id: str, user_id: str):
    api = use_api()
    api.post(f"/task/{id}/assignee", data={"userId": user_id})
예제 #11
0
def unclaim(id: str):
    api = use_api()
    api.post(f"/task/{id}/unclaim")
예제 #12
0
def claim(id: str, user_id: str):
    api = use_api()
    api.post(f"/task/{id}/claim", data={"userId": user_id})
예제 #13
0
def get_variables(id: str):
    api = use_api()
    result = api.get(f"/task/{id}/variables")
    return {k: VariableValueDto.parse_obj(v) for k, v in result.items()}
예제 #14
0
def get(id: str) -> TaskDto:
    api = use_api()
    result = api.get(f"/task/{id}")
    return TaskDto.parse_obj(result)
예제 #15
0
def get_list(query: TaskQueryDto = TaskQueryDto()) -> List[TaskDto]:
    api = use_api()

    data = query.dict(exclude_unset=True, by_alias=True)
    result = api.post("/task", data=data)
    return [TaskDto.parse_obj(task) for task in result]
def get(id: str) -> ProcessDefinitionDto:
    api = use_api()
    result = api.get(f"/process-definition/{id}")
    return ProcessDefinitionDto.parse_obj(result)