# Source code for api.system.components.runtime.v1.task

    """Autogenerated API"""
    import requests
    from argus_cli.plugin import register_command

    @register_command(extending=('system','components','runtime','v1','task'))
    def list_tasks(json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict:
        """List current tasks for currentuser (INTERNAL)

        :raises AuthenticationFailedException: on 401
        :raises AccessDeniedException: on 403
        :returns: {"offset": 557, "limit": 845, "responseCode": 200, "count": 542, "data": [{"id": "At bag lose could.", "state": "DONE", "method": "Black position they number down.", "arguments": [{}], "result": {}, "started": 527, "finished": 272, "children": [{"id": "Drop service concern can.", "state": "EXCEPTION", "method": "Question poor rich give method choose.", "arguments": [{}], "started": 549, "finished": 730, "children": [{"id": "Yeah effect month industry look popular.", "state": "RUNNING", "method": "Sister book soldier without.", "arguments": [{}], "started": 306, "finished": 272, "children": [{"id": "Both easy money.", "state": "RUNNING", "method": "Hospital full something minute data.", "arguments": [{}], "started": 282, "finished": 58, "children": [{"id": "Cover however within day.", "state": "EXCEPTION", "method": "Well network half within.", "arguments": [{}], "started": 707, "finished": 930, "children": [{"id": "Somebody wish race significant.", "state": "TIMEOUT", "method": "Lay mission bag actually form expert.", "arguments": [{}], "started": 623, "finished": 693, "children": [{"id": "Pass car yard area summer level.", "state": "EXCEPTION", "method": "Four Mr win example.", "arguments": [{}], "started": 732, "finished": 338, "children": [{"id": "Million happen interesting six surface per.", "state": "EXCEPTION", "method": "Hour meet environment.", "arguments": [{}], "started": 677, "finished": 138, "children": [{"id": "Once direction travel thank.", "state": "RUNNING", "method": "Or rate policy find get interesting staff perhaps.", "arguments": [{}], "started": 666, "finished": 749, "children": [{"id": "Green hand garden back away discussion yourself.", "state": "EXCEPTION", "method": "Try page staff social figure free.", "arguments": [{}], "started": 509, "finished": 687, "children": [{"id": "Everything according month traditional push.", "state": "EXCEPTION", "method": "Skill clearly yeah support big study.", "arguments": [{}], "started": 19, "finished": 900, "children": [{"id": "Interview son why more mission yes not environmental.", "state": "TIMEOUT", "method": "Become pattern itself particularly wide someone.", "arguments": [{}], "started": 270, "finished": 547, "children": [{"id": "White section fly meet best.", "state": "TIMEOUT", "method": "Poor key teacher simple.", "arguments": [{}], "started": 558, "finished": 783, "children": [{"id": "Government picture certain assume several.", "state": "DONE", "method": "Local moment as true person discuss contain unit.", "arguments": [{}], "started": 984, "finished": 205, "children": [{"id": "Article list book tax wall leave other.", "state": "TIMEOUT", "method": "It manage power practice Mr however top green.", "arguments": [{}], "started": 941, "finished": 952, "children": [{"id": "Free partner fall mean soon hair way.", "state": "RUNNING", "method": "Level kid lay early argue fight thousand.", "arguments": [{}], "started": 756, "finished": 258, "children": [{"id": "Smile than source recent mother fish gas.", "state": "RUNNING", "method": "Catch force though reason.", "arguments": [{}], "started": 881, "finished": 960, "children": [{"id": "Bit ability value brother ahead health fund.", "state": "TIMEOUT", "method": "Fill financial ball.", "arguments": [{}], "started": 930, "finished": 219, "children": [{"id": "Site law production by somebody again treatment.", "state": "TIMEOUT", "method": "Show serious man reflect coach customer notice.", "arguments": [{}], "started": 72, "finished": 205, "children": [{"id": "Paper forget child song evidence.", "state": "DONE", "method": "Risk travel up live head.", "arguments": [{}], "started": 412, "finished": 444, "children": [{"id": "Stuff clear speak challenge enough.", "state": "EXCEPTION", "method": "Letter watch product move member become.", "arguments": [{}], "started": 659, "finished": 511, "children": [{"id": "Worry impact door court hospital network more.", "state": "RUNNING", "method": "Friend drug like employee enter spring tax.", "arguments": [{}], "started": 582, "finished": 405, "children": [{"id": "Interesting that establish.", "state": "TIMEOUT", "method": "None whole them example.", "arguments": [{}], "started": 36, "finished": 372, "children": [{"id": "No still send marriage.", "state": "RUNNING", "method": "Soon feel change beat close trip ground dream.", "arguments": [{}], "started": 212, "finished": 437, "children": [{"id": "Act leader cold often far behavior determine color.", "state": "RUNNING", "method": "These ready Congress community.", "arguments": [{}], "started": 911, "finished": 473, "children": [{"id": "Century they break marriage short wear.", "state": "TIMEOUT", "method": "Attorney music main write you.", "arguments": [{}], "started": 568, "finished": 925, "children": [{"id": "Professional major north old world production.", "state": "TIMEOUT", "method": "Easy discussion bag past as street.", "arguments": [{}], "started": 279, "finished": 942, "children": [{"id": "Realize change involve lead concern.", "state": "RUNNING", "method": "Democrat style manage cup.", "arguments": [{}], "started": 501, "finished": 726, "children": [{"id": "Society open position.", "state": "TIMEOUT", "method": "Fast return time serve.", "arguments": [{}], "started": 539, "finished": 724, "children": [{"id": "Say Congress cause thought.", "state": "RUNNING", "method": "Foreign company realize everyone site two about provide.", "arguments": [{}], "started": 402, "finished": 138, "children": [{"id": "Daughter building our shoulder fight pass.", "state": "TIMEOUT", "method": "What picture table music.", "arguments": [{}], "started": 80, "finished": 224, "children": [{"id": "For expect soldier institution run.", "state": "TIMEOUT", "method": "Strategy represent full put mind pretty.", "arguments": [{}], "started": 343, "finished": 35, "children": [{"id": "Many ground impact cost third benefit account.", "state": "TIMEOUT", "method": "All whether so hospital good heart.", "arguments": [{}], "started": 613, "finished": 234, "children": [{"id": "Cup allow major choice any include.", "state": "TIMEOUT", "method": "Boy sort modern moment should employee.", "arguments": [{}], "started": 617, "finished": 185, "children": [{"id": "Serious agree design country could ten.", "state": "EXCEPTION", "method": "Hundred three baby pattern break.", "arguments": [{}], "started": 873, "finished": 90, "children": [{"id": "Require another father.", "state": "DONE", "method": "Ball likely reason receive whatever whatever civil.", "arguments": [{}], "started": 269, "finished": 417, "children": [{"id": "Expert try continue senior any worker recent would.", "state": "EXCEPTION", "method": "Senior ground significant to.", "arguments": [{}], "started": 480, "finished": 278, "children": [{"id": "Professor build seek vote.", "state": "DONE", "method": "Employee describe figure stock.", "arguments": [{}], "started": 651, "finished": 681, "children": [{"id": "Really who ago care miss.", "state": "DONE", "method": "Fund special environmental new.", "arguments": [{}], "started": 65, "finished": 956, "children": [{"id": "Nature land operation receive.", "state": "TIMEOUT", "method": "Result spring thank well minute.", "arguments": [{}], "started": 409, "finished": 965, "children": [{"id": "Together able song may.", "state": "TIMEOUT", "method": "To perform win Congress consider health.", "arguments": [{}], "started": 18, "finished": 421, "children": [{"id": "After usually foot when.", "state": "EXCEPTION", "method": "Continue inside student impact certain upon.", "arguments": [{}], "started": 434, "finished": 84, "children": [{"id": "Money dark bank resource.", "state": "TIMEOUT", "method": "Hear market ahead push nation.", "arguments": [{}], "started": 229, "finished": 587, "children": [{"id": "Job can truth mission must recognize create.", "state": "DONE", "method": "Yeah only if.", "arguments": [{}], "started": 421, "finished": 705, "children": [{"id": "Must rule sport discuss save organization range.", "state": "EXCEPTION", "method": "Other study stand society fund candidate quickly.", "arguments": [{}], "started": 719, "finished": 917, "children": [{"id": "Total raise particular nearly individual seem pattern.", "state": "EXCEPTION", "method": "Theory despite nothing well well do newspaper expect.", "arguments": [{}], "started": 269, "finished": 289, "children": [{"id": "Tell large small appear.", "state": "TIMEOUT", "method": "Specific painting source get party.", "arguments": ["Edge try hair example."], "started": 425, "finished": 448, "children": [{"id": "Expect statement ago sure.", "state": "Move bed different best attorney.", "method": "Whose improve action better federal present.", "arguments": {"items": "Cut total visit certainly dream home give."}, "started": "Land step here what series each describe.", "finished": "Daughter sing which power article.", "children": {"items": "Check health view close middle window."}}]}]}]}]}]}]}]}]}]}]}]}]}]}]}]}]}]}]}]}]}]}]}]}]}]}]}]}]}]}]}]}]}]}]}]}]}]}]}]}]}]}]}]}]}]}]}]}], "metaData": {"additionalProperties": {}}, "messages": [{"message": "Carry land unit.", "messageTemplate": "Act walk protect commercial run protect.", "field": "Fire executive generation.", "parameter": {}, "timestamp": 34238899}], "currentPage": 147, "size": 101}
        """
        from requests import get
        from argus_api.exceptions import http

        url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/system/components/runtime/v1/task".format()
        headers = {
            'Content-Type': 'application/json',
            'User-Agent': 'ArgusToolbelt/1.0'
        }

        if apiKey:
            headers["Argus-API-Key"] = apiKey
        elif authentication and isinstance(authentication, dict):
            headers.update(authentication)
        elif callable(authentication):
            headers.update(authentication(url))

        body = {}

        response = get(url, json=body if body else None, verify=verify, headers=headers)

        errors = []
        if response.status_code == 401:
            raise http.AuthenticationFailedException(response)
        elif response.status_code == 403:
            raise http.AccessDeniedException(response)
        elif response.status_code == 412:
            raise http.ValidationErrorException(response)
        elif response.status_code == 404:
            raise http.ObjectNotFoundException(response)

        return response.json() if json else response

    @register_command(extending=('system','components','runtime','v1','task'))
    def get_task(id: str,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict:
        """Fetch specified task (INTERNAL)

        :param str id: ID of task to fetch
        :raises AuthenticationFailedException: on 401
        :raises AccessDeniedException: on 403
        :raises ObjectNotFoundException: on 404
        :returns: {"offset": 445, "limit": 439, "responseCode": 200, "count": 282, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Blue woman low Mrs vote modern good sort.", "messageTemplate": "Mr effect play during style necessary sort.", "field": "Wife off middle opportunity toward light allow field.", "parameter": {}, "timestamp": 907117553}], "currentPage": 202, "size": 149}
        """
        from requests import get
        from argus_api.exceptions import http

        url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/system/components/runtime/v1/task/{id}".format(id=id)
        headers = {
            'Content-Type': 'application/json',
            'User-Agent': 'ArgusToolbelt/1.0'
        }

        if apiKey:
            headers["Argus-API-Key"] = apiKey
        elif authentication and isinstance(authentication, dict):
            headers.update(authentication)
        elif callable(authentication):
            headers.update(authentication(url))

        body = {}

        response = get(url, json=body if body else None, verify=verify, headers=headers)

        errors = []
        if response.status_code == 401:
            raise http.AuthenticationFailedException(response)
        elif response.status_code == 403:
            raise http.AccessDeniedException(response)
        elif response.status_code == 412:
            raise http.ValidationErrorException(response)
        elif response.status_code == 404:
            raise http.ObjectNotFoundException(response)

        return response.json() if json else response