# Source code for api.reputation.v1.source

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

    @register_command(extending=('reputation','v1','source'))
    def list_sources(search: str = None, offset: int = None, limit: int = 25,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict:
        """List reputation sources (INTERNAL)

        :param str search: Limit result to sources matching this search string
        :param int offset: Offset result
        :param int limit: Limit result
        :raises AuthenticationFailedException: on 401
        :raises ValidationErrorException: on 412
        :raises AccessDeniedException: on 403
        :returns: {"offset": 666, "limit": 5, "responseCode": 200, "count": 396, "data": [{"id": 415, "alias": "Them set writer west specific national.", "name": "Kenneth Walker", "confidence": 192, "activePeriod": 818, "fudgePeriod": 750, "lastUpdatedTimestamp": 841584259, "deleted": false, "monitored": false, "lastTransitionTimestamp": 420599733, "useForReputationCalc": false, "private": false}], "metaData": {"additionalProperties": {}}, "messages": [{"message": "Again kid camera adult.", "messageTemplate": "Among run short eye thing size think.", "field": "Tell staff cell position fly bag trade.", "parameter": {}, "timestamp": 83825896}], "currentPage": 187, "size": 426}
        """
        from requests import get
        from argus_api.exceptions import http

        url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/reputation/v1/source".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 search:
            body.update({"search": search})

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

        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=('reputation','v1','source'))
    def add_new_source(alias: str = None, name: str = None, confidence: int = 0.0, activePeriod: int = 0, fudgePeriod: int = 0, useForReputationCalc: bool = 'False', monitored: bool = 'False', private: bool = 'False',json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict:
        """Add reputation source (INTERNAL)

        :param str alias: Source alias  => [a-zA-Z0-9_\-\.]*
        :param str name: Source name  => [a-zA-Z0-9_\-\.]*
        :param int confidence: Source confidence (default 0.0)
        :param int activePeriod: Source active period (default 0)
        :param int fudgePeriod: Source fudge period (default 0)
        :param bool useForReputationCalc:
        :param bool monitored:
        :param bool private:
        :raises AuthenticationFailedException: on 401
        :raises ValidationErrorException: on 412
        :raises AccessDeniedException: on 403
        :returns: {"offset": 700, "limit": 627, "responseCode": 200, "count": 879, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Edge themselves yeah night sing game.", "messageTemplate": "Democratic director wide form deal half finish.", "field": "Around Democrat head.", "parameter": {}, "timestamp": 50670735}], "currentPage": 434, "size": 327}
        """
        from requests import post
        from argus_api.exceptions import http

        url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/reputation/v1/source".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 alias:
            body.update({"alias": alias})

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

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

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

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

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

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

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

        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=('reputation','v1','source'))
    def find_sources(limit: int = None, offset: int = None, includeFlags: int = None, excludeFlags: int = None, subCriteria: list = None, id: list = None, searchString: str = None, includeDeleted: bool = 'False', exclude: bool = 'False', required: bool = 'False',json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict:
        """Search reputation sources (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 id:
        :param str searchString:
        :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).
        :raises AuthenticationFailedException: on 401
        :raises ValidationErrorException: on 412
        :raises AccessDeniedException: on 403
        :returns: {"offset": 26, "limit": 525, "responseCode": 200, "count": 516, "data": [{"id": 39, "alias": "Conference teach probably wear.", "name": "Devin Fisher", "confidence": 75, "activePeriod": 593, "fudgePeriod": 282, "lastUpdatedTimestamp": 377672571, "deleted": false, "monitored": false, "lastTransitionTimestamp": 308104099, "useForReputationCalc": false, "private": true}], "metaData": {"additionalProperties": {}}, "messages": [{"message": "Theory admit surface but card wonder deal.", "messageTemplate": "Less technology do say vote whether.", "field": "Early lose democratic audience.", "parameter": {}, "timestamp": 1462078312}], "currentPage": 459, "size": 211}
        """
        from requests import post
        from argus_api.exceptions import http

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

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

        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=('reputation','v1','source'))
    def get_source_by_alias(alias: str,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict:
        """Fetch reputation source by alias (INTERNAL)

        :param str alias: Alias of source to fetch
        :raises AuthenticationFailedException: on 401
        :raises ValidationErrorException: on 412
        :raises AccessDeniedException: on 403
        :raises ObjectNotFoundException: on 404
        :returns: {"offset": 791, "limit": 970, "responseCode": 200, "count": 481, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Everyone part meet begin.", "messageTemplate": "Have with wrong attorney wrong music card.", "field": "Prepare can ok response.", "parameter": {}, "timestamp": 1179009589}], "currentPage": 875, "size": 553}
        """
        from requests import get
        from argus_api.exceptions import http

        url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/reputation/v1/source/{alias}".format(alias=alias)
        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=('reputation','v1','source'))
    def get_source_by_id(id: int,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict:
        """Fetch reputation source by ID (INTERNAL)

        :param int id: ID of source to fetch
        :raises AuthenticationFailedException: on 401
        :raises ValidationErrorException: on 412
        :raises AccessDeniedException: on 403
        :raises ObjectNotFoundException: on 404
        :returns: {"offset": 835, "limit": 997, "responseCode": 200, "count": 184, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Success if consider.", "messageTemplate": "Trial event opportunity for opportunity.", "field": "Others pick even bag short rest energy ball.", "parameter": {}, "timestamp": 210083674}], "currentPage": 772, "size": 580}
        """
        from requests import get
        from argus_api.exceptions import http

        url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/reputation/v1/source/{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=('reputation','v1','source'))
    def update_source(id: int, alias: str = None, name: str = None, confidence: int = None, activePeriod: int = None, fudgePeriod: int = None, useForReputationCalc: bool = 'False', monitored: bool = 'False', private: bool = 'False',json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict:
        """Update reputation source (INTERNAL)

        :param int id: ID of source to update
        :param str alias: [a-zA-Z0-9_\-\.]*
        :param str name: [a-zA-Z0-9_\-\.]*
        :param int confidence:
        :param int activePeriod:
        :param int fudgePeriod:
        :param bool useForReputationCalc:
        :param bool monitored:
        :param bool private:
        :raises AuthenticationFailedException: on 401
        :raises ValidationErrorException: on 412
        :raises AccessDeniedException: on 403
        :raises ObjectNotFoundException: on 404
        :returns: {"offset": 70, "limit": 823, "responseCode": 200, "count": 277, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Morning say look will.", "messageTemplate": "Choose floor ever natural PM stage.", "field": "In name garden big price prove.", "parameter": {}, "timestamp": 629609045}], "currentPage": 461, "size": 766}
        """
        from requests import put
        from argus_api.exceptions import http

        url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/reputation/v1/source/{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 alias:
            body.update({"alias": alias})

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

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

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

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

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

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

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

        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=('reputation','v1','source'))
    def delete_source(id: int,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict:
        """Delete reputation source (INTERNAL)

        :param int id: ID of source to delete
        :raises AuthenticationFailedException: on 401
        :raises ValidationErrorException: on 412
        :raises AccessDeniedException: on 403
        :raises ObjectNotFoundException: on 404
        :returns: {"offset": 48, "limit": 630, "responseCode": 200, "count": 375, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Financial admit act spring thus.", "messageTemplate": "Hotel policy remain shake name hope.", "field": "Safe avoid water sometimes one process play.", "parameter": {}, "timestamp": 559320347}], "currentPage": 467, "size": 510}
        """
        from requests import delete
        from argus_api.exceptions import http

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