Source code for api.reports.v1.plan

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




[docs]@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
[docs]@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
[docs]@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
[docs]@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