# Source code for api.system.components.configuration.v1.template

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

    @register_command(extending=('system','components','configuration','v1','template'))
    def list(search: str = None, orderDesc: bool = None, includeComments: bool = 'True', includeDeleted: bool = 'True', offset: int = 0, limit: int = 25, orderBy: str = 'name',json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict:
        """List configuration templates (INTERNAL)

        :param str search:
        :param bool orderDesc: Sort results descending
        :param bool includeComments:
        :param bool includeDeleted:
        :param int offset:
        :param int limit:
        :param str orderBy: Sort results
        :raises AuthenticationFailedException: on 401
        :raises ValidationErrorException: on 412
        :raises AccessDeniedException: on 403
        :returns: {"offset": 549, "limit": 461, "responseCode": 200, "count": 349, "data": [{"id": 507, "name": "Jeffery Bell", "mnemonic": "Fast too available song real if.", "shortName": "You thank high issue behavior his six.", "configurationData": "Treat surface social six.", "properties": {"additionalProperties": "For push activity girl go."}, "flags": 269, "revision": 414, "masterID": 320, "createdTimestamp": 965656292, "lastUpdatedTimestamp": 110671943, "lastUpdatedByUser": {"id": 533, "customerID": 243, "userName": "melaniejordan", "name": "Russell Keller"}, "information": "Thought design north computer.", "comments": [{"timestamp": 430344760, "comment": "Dog place any fire."}]}], "metaData": {"additionalProperties": {}}, "messages": [{"message": "Future few less later long experience.", "messageTemplate": "Food maybe rather citizen present suggest.", "field": "Remain of reality join myself ago.", "parameter": {}, "timestamp": 883110583}], "currentPage": 412, "size": 769}
        """
        from requests import get
        from argus_api.exceptions import http

        url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/system/components/configuration/v1/template".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 includeComments:
            body.update({"includeComments": includeComments})

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

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

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

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

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

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

        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','configuration','v1','template'))
    def create(name: str = None, shortName: str = None, mnemonic: str = None, configuration: str = None, properties: dict = None, information: str = None, dependsOnID: int = None, codeProfile: str = None,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict:
        """Create new configuration template (INTERNAL)

        :param str name: [a-zA-Z0-9_\-\.]*
        :param str shortName: [a-zA-Z0-9_\-\.]*
        :param str mnemonic: [a-zA-Z0-9_\-\.]*
        :param str configuration: format:xml
        :param dict properties:
        :param str information: [\s\w\{\}\$\-\(\)\.\[\]"\'_/\\,\*\+\#:@!?;]*
        :param int dependsOnID:
        :param str codeProfile: [a-zA-Z0-9_\-\.]*
        :raises AuthenticationFailedException: on 401
        :raises ValidationErrorException: on 412
        :raises AccessDeniedException: on 403
        :returns: {"offset": 569, "limit": 441, "responseCode": 200, "count": 191, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Attorney drug step behavior course leave.", "messageTemplate": "Test begin measure city town everybody throw glass.", "field": "Task body entire community film American.", "parameter": {}, "timestamp": 342578577}], "currentPage": 418, "size": 418}
        """
        from requests import post
        from argus_api.exceptions import http

        url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/system/components/configuration/v1/template".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 name:
            body.update({"name": name})

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

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

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

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

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

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

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

        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=('system','components','configuration','v1','template'))
    def search(limit: int = None, offset: int = None, includeFlags: int = None, excludeFlags: int = None, subCriteria: list = None, codeProfile: list = None, keywords: list = None, dependingOnID: list = None, sortBy: list = None, includeDeleted: bool = 'False', exclude: bool = 'False', required: bool = 'False', includeComments: bool = 'False',json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict:
        """Search configuration templates (INTERNAL)

        :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 codeProfile: If true, filter on templates having any of these code profiles.
        :param list keywords: If true, filter on templates where name matches these keywords.
        :param list dependingOnID: If set, filter on templates set to depend on any of the given template IDs.
        :param list sortBy: List of properties to sort by (prefix with "-" to sort descending).
        :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 includeComments: If true, also include comments on output.
        :raises AuthenticationFailedException: on 401
        :raises ValidationErrorException: on 412
        :raises AccessDeniedException: on 403
        :returns: {"offset": 727, "limit": 691, "responseCode": 200, "count": 885, "data": [{"id": 113, "name": "Elizabeth Mcmahon", "mnemonic": "World majority thought miss energy report.", "shortName": "Very case down risk.", "configurationData": "Before go than.", "properties": {"additionalProperties": "Size dream strategy nation exactly."}, "flags": 327, "revision": 946, "masterID": 786, "createdTimestamp": 848038798, "lastUpdatedTimestamp": 367897776, "lastUpdatedByUser": {"id": 906, "customerID": 418, "userName": "arielwalker", "name": "Sherri Hopkins"}, "information": "Structure explain benefit human truth adult option.", "comments": [{"timestamp": 1262389358, "comment": "Professor from politics century second show meet."}]}], "metaData": {"additionalProperties": {}}, "messages": [{"message": "Card instead station they.", "messageTemplate": "Technology answer fact tree easy.", "field": "Career eat lose surface.", "parameter": {}, "timestamp": 382732151}], "currentPage": 408, "size": 210}
        """
        from requests import post
        from argus_api.exceptions import http

        url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/system/components/configuration/v1/template/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 codeProfile:
            body.update({"codeProfile": codeProfile})

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

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

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

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

        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=('system','components','configuration','v1','template'))
    def view(id: int,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict:
        """Fetch configuration template (INTERNAL)

        :param int id: ID of template to fetch
        :raises AuthenticationFailedException: on 401
        :raises ValidationErrorException: on 412
        :raises AccessDeniedException: on 403
        :raises ObjectNotFoundException: on 404
        :returns: {"offset": 643, "limit": 866, "responseCode": 200, "count": 391, "metaData": {"additionalProperties": {}}, "messages": [{"message": "We summer lot future system explain Mr chance.", "messageTemplate": "He environmental subject color wide.", "field": "Past become prevent easy.", "parameter": {}, "timestamp": 9186035}], "currentPage": 522, "size": 962}
        """
        from requests import get
        from argus_api.exceptions import http

        url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/system/components/configuration/v1/template/{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=('system','components','configuration','v1','template'))
    def update(id: int, name: str = None, mnemonic: str = None, shortName: str = None, configuration: str = None, properties: dict = None, information: str = None, dependsOnID: int = None, codeProfile: str = None,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict:
        """Update configuration template (INTERNAL)

        :param int id: ID of template to update
        :param str name: [a-zA-Z0-9_\-\.]*
        :param str mnemonic: [a-zA-Z0-9_\-\.]*
        :param str shortName: [a-zA-Z0-9_\-\.]*
        :param str configuration: format:xml
        :param dict properties:
        :param str information: [\s\w\{\}\$\-\(\)\.\[\]"\'_/\\,\*\+\#:@!?;]*
        :param int dependsOnID:
        :param str codeProfile: [a-zA-Z0-9_\-\.]*
        :raises AuthenticationFailedException: on 401
        :raises ValidationErrorException: on 412
        :raises AccessDeniedException: on 403
        :raises ObjectNotFoundException: on 404
        :returns: {"offset": 327, "limit": 967, "responseCode": 200, "count": 664, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Candidate section policy.", "messageTemplate": "Past give west somebody main.", "field": "Value know this mean industry finally.", "parameter": {}, "timestamp": 558035845}], "currentPage": 760, "size": 380}
        """
        from requests import put
        from argus_api.exceptions import http

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

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

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

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

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

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

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

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

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

        response = put(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','configuration','v1','template'))
    def delete(id: int,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict:
        """Delete configuration template (INTERNAL)

        :param int id: ID of template to delete
        :raises AuthenticationFailedException: on 401
        :raises ValidationErrorException: on 412
        :raises AccessDeniedException: on 403
        :raises ObjectNotFoundException: on 404
        :returns: {"offset": 863, "limit": 718, "responseCode": 200, "count": 771, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Onto cause expert news region hot.", "messageTemplate": "Age meet see walk.", "field": "Cell class physical image any.", "parameter": {}, "timestamp": 185856517}], "currentPage": 760, "size": 952}
        """
        from requests import delete
        from argus_api.exceptions import http

        url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/system/components/configuration/v1/template/{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=('system','components','configuration','v1','template'))
    def add_comment(id: int, body: str = None,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict:
        """Add a comment to a configuration template (INTERNAL)

        :param int id: ID of template to add comment to
        :param  body: Comment
        :raises AuthenticationFailedException: on 401
        :raises ValidationErrorException: on 412
        :raises AccessDeniedException: on 403
        :returns: {"offset": 915, "limit": 377, "responseCode": 200, "count": 989, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Third might high reduce.", "messageTemplate": "Over thank drop.", "field": "Small rise good evening itself activity.", "parameter": {}, "timestamp": 1068458354}], "currentPage": 465, "size": 937}
        """
        from requests import post
        from argus_api.exceptions import http

        url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/system/components/configuration/v1/template/{id}/comment".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 body:
            body.update({"body": body})

        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=('system','components','configuration','v1','template'))
    def duplicate(id: int,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict:
        """Create a duplicate of a configuration template (INTERNAL)

        :param int id: ID of template to duplicate
        :raises AuthenticationFailedException: on 401
        :raises ValidationErrorException: on 412
        :raises AccessDeniedException: on 403
        :returns: {"offset": 662, "limit": 164, "responseCode": 200, "count": 22, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Scientist three exist thank view bill.", "messageTemplate": "Improve remain task.", "field": "Simply instead front clearly college forget.", "parameter": {}, "timestamp": 1086888620}], "currentPage": 455, "size": 813}
        """
        from requests import post
        from argus_api.exceptions import http

        url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/system/components/configuration/v1/template/{id}/duplicate".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 = 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=('system','components','configuration','v1','template'))
    def revisions(id: int, limit: int = 25,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict:
        """List revisions of configuration template (INTERNAL)

        :param int id: ID of template
        :param int limit: Max number of revisions to fetch
        :returns: {"offset": 678, "limit": 889, "responseCode": 200, "count": 171, "data": [{"id": 222, "name": "Tammy Bishop", "mnemonic": "Performance political doctor then always.", "shortName": "Blood woman why sound wait.", "configurationData": "Beautiful glass bar employee.", "properties": {"additionalProperties": "Best say head."}, "flags": 429, "revision": 453, "masterID": 426, "createdTimestamp": 531682624, "lastUpdatedTimestamp": 943594106, "lastUpdatedByUser": {"id": 40, "customerID": 339, "userName": "jennifer12", "name": "Eric Miller"}, "information": "Weight word information quite.", "comments": [{"timestamp": 1075546513, "comment": "One them democratic child."}]}], "metaData": {"additionalProperties": {}}, "messages": [{"message": "Public analysis least note.", "messageTemplate": "Weight exactly wide owner will whom.", "field": "Institution enter group knowledge talk really.", "parameter": {}, "timestamp": 671695124}], "currentPage": 785, "size": 354}
        """
        from requests import get
        from argus_api.exceptions import http

        url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/system/components/configuration/v1/template/{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})

        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