Source code for api.cases.v1.servicetypes

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


[docs]@register_command(extending=('cases','v1','servicetypes')) def get(json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict: """List servicetypes (TEST) :raises AuthenticationFailedException: on 401 :raises ValidationErrorException: on 412 :raises AccessDeniedException: on 403 :raises ObjectNotFoundException: on 404 :returns: {"offset": 487, "limit": 157, "responseCode": 200, "count": 749, "data": [{"id": 454, "name": "Sierra Gomez", "flags": 850, "description": "Own example her military bill foreign.", "logoURL": "Sit teacher fine much task forget suddenly.", "notificationEmail": "Activity commercial common population.", "text": "Class quality key fight nature perhaps reveal always."}], "metaData": {"additionalProperties": {}}, "messages": [{"message": "Clear rate who continue.", "messageTemplate": "Throw media his woman or sometimes mouth.", "field": "Stay question position sell today.", "parameter": {}, "timestamp": 733455834}], "currentPage": 129, "size": 827} """ from requests import get from argus_api.exceptions import http url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/cases/v1/servicetypes".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
[docs]@register_command(extending=('cases','v1','servicetypes')) def get_case(id: int,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict: """Fetch servicetype by ID (TEST) :param int id: Servicetype ID :raises AuthenticationFailedException: on 401 :raises ValidationErrorException: on 412 :raises AccessDeniedException: on 403 :raises ObjectNotFoundException: on 404 :returns: {"offset": 147, "limit": 876, "responseCode": 200, "count": 187, "metaData": {"additionalProperties": {}}, "messages": [{"message": "School very television hit above though.", "messageTemplate": "Tree service gun partner possible.", "field": "Price soldier international affect theory stage still.", "parameter": {}, "timestamp": 1515951318}], "currentPage": 137, "size": 357} """ from requests import get from argus_api.exceptions import http url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/cases/v1/servicetypes/{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