api.reports.v1.plan — Argus-Toolbelt 1.0 documentation

# Source code for api.reports.v1.plan

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

    @register_command(extending=('reports','v1','plan'))
    def get_search(offset: int = None, customerID: list = None, period: list = None, limit: int = 25,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict:
        """Lists report plans (DEV)
    Returns a list of matching report plans.

        :param int offset: Offset result
        :param list customerID: Limit to plans from this customer
        :param list period: Limit to plans for this period
        :param int limit: Limit output
        :raises AuthenticationFailedException: on 401
        :raises ValidationFailedException: on 412
        :raises AccessDeniedException: on 403
        :returns: {"offset": 913, "limit": 766, "responseCode": 200, "count": 200, "data": [{"id": 643, "revision": 629, "flags": 913, "description": "Develop bill trouble travel painting plant side.", "created": 379, "lastUpdatedTimestamp": 153158618, "lastUpdatedByUser": {"id": 199, "customerID": 113, "userName": "michaelmcdaniel", "name": "Mrs. Patricia Hart MD"}, "templateID": 828, "period": "year", "globalCustomer": true}], "metaData": {"additionalProperties": {}}, "messages": [{"message": "Back agreement include rest away black her.", "messageTemplate": "Always leave property approach remember far.", "field": "Team eight race officer wind box determine.", "parameter": {}, "timestamp": 1443006213}], "currentPage": 372, "size": 661}
        """
        from requests import get
        from argus_api.exceptions import http

        url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/reports/v1/plan".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 = {}

        if limit:
            body.update({"limit": limit})

        if offset:
            body.update({"offset": offset})

        if customerID:
            body.update({"customerID": customerID})

        if period:
            body.update({"period": period})

        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=('reports','v1','plan'))
    def add(setFlags: int = None, description: str = None, period: str = None, customerID: int = 0, templateID: int = 0,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict:
        """Add a new report plan (DEV)

        :param int setFlags:
        :param str description: Report plan description  => [\s\w\{\}\$\-\(\)\.\[\]"\'_/\\,\*\+\#:@!?;]*
        :param str period: Report period
        :param int customerID: Customer ID (default 0)
        :param int templateID: Template ID (default 0)
        :raises AuthenticationFailedException: on 401
        :raises ValidationFailedException: on 412
        :raises AccessDeniedException: on 403
        :returns: {"offset": 938, "limit": 621, "responseCode": 200, "count": 640, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Action family measure.", "messageTemplate": "Month energy note quickly candidate look authority.", "field": "Full growth travel season.", "parameter": {}, "timestamp": 773750053}], "currentPage": 516, "size": 90}
        """
        from requests import post
        from argus_api.exceptions import http

        url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/reports/v1/plan".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 = {}

        if setFlags:
            body.update({"setFlags": setFlags})

        if customerID:
            body.update({"customerID": customerID})

        if description:
            body.update({"description": description})

        if templateID:
            body.update({"templateID": templateID})

        if period:
            body.update({"period": period})

        response = post(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=('reports','v1','plan'))
    def search(limit: int = None, offset: int = None, includeFlags: int = None, excludeFlags: int = None, subCriteria: list = None, customerID: list = None, id: list = None, lastUpdatedByUserID: list = None, period: list = None, startTimestamp: int = None, endTimestamp: int = None, masterID: int = None, includeDeleted: bool = 'False', exclude: bool = 'False', required: bool = 'False', includeCreatedTimestamp: bool = 'False', includeLastUpdatedTimestamp: bool = 'False',json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict:
        """Lists report plans (DEV)
    Returns a list of matching report plans.

        :param int limit: Set this value to set max number of results. By default, no restriction on result set size.
        :param int offset: Set this value to skip the first (offset) objects. By default, return result from first object.
        :param int includeFlags: Only include objects which have includeFlags set.
        :param int excludeFlags: Exclude objects which have excludeFlags set.
        :param list subCriteria:
        :param list customerID: Restrict search to data belonging to specified customers.
        :param list id:
        :param list lastUpdatedByUserID:
        :param list period:
        :param int startTimestamp:
        :param int endTimestamp:
        :param int masterID:
        :param bool includeDeleted: Set to true to include deleted objects. By default, exclude deleted objects.
        :param bool exclude: Only relevant for subcriteria. If set to true, objects matching this subcriteria object will be excluded.
        :param bool required: Only relevant for subcriteria. If set to true, objects matching this subcriteria are required (AND-ed together with parent criteria).
        :param bool includeCreatedTimestamp:
        :param bool includeLastUpdatedTimestamp:
        :raises AuthenticationFailedException: on 401
        :raises ValidationFailedException: on 412
        :raises AccessDeniedException: on 403
        :returns: {"offset": 913, "limit": 49, "responseCode": 200, "count": 35, "data": [{"id": 881, "revision": 143, "flags": 962, "description": "Military itself care himself step final whole data.", "created": 52, "lastUpdatedTimestamp": 425132426, "lastUpdatedByUser": {"id": 523, "customerID": 597, "userName": "kirkkathryn", "name": "Russell Dixon"}, "templateID": 604, "period": "custom", "globalCustomer": false}], "metaData": {"additionalProperties": {}}, "messages": [{"message": "Article thought painting sing task.", "messageTemplate": "Almost evening owner practice everyone surface serious always.", "field": "Out mind bank majority.", "parameter": {}, "timestamp": 32132770}], "currentPage": 591, "size": 135}
        """
        from requests import post
        from argus_api.exceptions import http

        url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/reports/v1/plan/search".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 = {}

        if limit:
            body.update({"limit": limit})

        if offset:
            body.update({"offset": offset})

        if includeDeleted:
            body.update({"includeDeleted": includeDeleted})

        if includeFlags:
            body.update({"includeFlags": includeFlags})

        if excludeFlags:
            body.update({"excludeFlags": excludeFlags})

        if subCriteria:
            body.update({"subCriteria": subCriteria})

        if exclude:
            body.update({"exclude": exclude})

        if required:
            body.update({"required": required})

        if customerID:
            body.update({"customerID": customerID})

        if id:
            body.update({"id": id})

        if lastUpdatedByUserID:
            body.update({"lastUpdatedByUserID": lastUpdatedByUserID})

        if period:
            body.update({"period": period})

        if startTimestamp:
            body.update({"startTimestamp": startTimestamp})

        if endTimestamp:
            body.update({"endTimestamp": endTimestamp})

        if masterID:
            body.update({"masterID": masterID})

        if includeCreatedTimestamp:
            body.update({"includeCreatedTimestamp": includeCreatedTimestamp})

        if includeLastUpdatedTimestamp:
            body.update({"includeLastUpdatedTimestamp": includeLastUpdatedTimestamp})

        response = post(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=('reports','v1','plan'))
    def get(id: int,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict:
        """Fetch report plan (DEV)

        :param int id: ID of plan to fetch
        :raises AuthenticationFailedException: on 401
        :raises ValidationFailedException: on 412
        :raises AccessDeniedException: on 403
        :raises PlanNotFoundException: on 404
        :returns: {"offset": 357, "limit": 930, "responseCode": 200, "count": 675, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Especially unit move citizen capital share stage herself.", "messageTemplate": "Customer door word save reality report.", "field": "Foot news contain popular.", "parameter": {}, "timestamp": 831067268}], "currentPage": 177, "size": 766}
        """
        from requests import get
        from argus_api.exceptions import http

        url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/reports/v1/plan/{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

    @register_command(extending=('reports','v1','plan'))
    def delete(id: int,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict:
        """Delete a report plan (DEV)

        :param int id: ID of plan to delete
        :raises AuthenticationFailedException: on 401
        :raises ValidationFailedException: on 412
        :raises AccessDeniedException: on 403
        :raises ObjectNotFoundException: on 404
        :returns: {"offset": 687, "limit": 417, "responseCode": 200, "count": 931, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Series discuss measure tough.", "messageTemplate": "Western painting difference mention security measure paper process.", "field": "Language but issue shake young contain.", "parameter": {}, "timestamp": 1217067946}], "currentPage": 308, "size": 80}
        """
        from requests import delete
        from argus_api.exceptions import http

        url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/reports/v1/plan/{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 = delete(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=('reports','v1','plan'))
    def revisions(id: int, body: str = None, limit: int = 25,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict:
        """List previous revisions for this plan (DEV)

        :param int id: ID of plan to fetch previous revisions for
        :param  body: Offset result
        :param int limit: Limit output
        :raises AuthenticationFailedException: on 401
        :raises ValidationFailedException: on 412
        :raises AccessDeniedException: on 403
        :raises PlanNotFoundException: on 404
        :returns: {"offset": 148, "limit": 39, "responseCode": 200, "count": 70, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Improve future see effect school short pattern meeting.", "messageTemplate": "Girl suffer night dream room.", "field": "Purpose stay hot they country option eat.", "parameter": {}, "timestamp": 1389945307}], "currentPage": 865, "size": 140}
        """
        from requests import get
        from argus_api.exceptions import http

        url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/reports/v1/plan/{id}/revisions".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 = {}

        if limit:
            body.update({"limit": limit})

        if body:
            body.update({"body": 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