# Source code for api.sampledb.v1.submission.submission_search

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

    @register_command(extending=('sampledb','v1','submission','search'))
    def search_meta_submissions(customerID: list = None, tlp: list = None, keywords: list = None, startTimestamp: int = None, endTimestamp: int = None, includeAnonymousResults: bool = 'True', limit: int = 25, offset: int = 0,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict:
        """Search for submissions matching given search criteria (DEV)

        :param list customerID: Set of customer IDs containing submissions. If not specified, search will be performed against all accessible customers.
        :param list tlp: Set of TLPs to search for. If not specified, search will be performed against all TLPs (WHITE, GREEN, AMBER, RED).
        :param list keywords: A set of keywords matched against the metafields of the submission.
        :param int startTimestamp: Start of time search period for submission creation date. (default 7 days before timestamp of request.)
        :param int endTimestamp: End of time search period for submission creation date. (default Timestamp of request.)
        :param bool includeAnonymousResults: Whether include anonymous results (default true)
        :param int limit: Set this value to set max number of results. (default 25)
        :param int offset: Set this value to skip the first (offset) objects. By default, return result from first object. (default 0)
        :raises AuthenticationFailedException: on 401
        :raises ValidationErrorException: on 412
        :raises AccessDeniedException: on 403
        :returns: {"offset": 241, "limit": 478, "responseCode": 200, "count": 274, "data": [{"id": 86, "sha256": "Ok TV catch pay world me way.", "createdTimestamp": 1223672081, "owner": "Because door argue include size.", "properties": {"additionalProperties": "Act bill section growth."}, "tlp": "WHITE"}], "metaData": {"additionalProperties": {}}, "messages": [{"message": "Establish including before factor animal front serve.", "messageTemplate": "Eight another chair day population eat example.", "field": "By public political model both decision.", "parameter": {}, "timestamp": 639679709}], "currentPage": 516, "size": 272}
        """
        from requests import post
        from argus_api.exceptions import http

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

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

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

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

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

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

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

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

        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=('sampledb','v1','submission','search'))
    def get_submission_by_id(id: int,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict:
        """Fetch submission info identified by id. (DEV)

        :param int id: Submission ID
        :raises AuthenticationFailedException: on 401
        :raises ValidationErrorException: on 412
        :raises AccessDeniedException: on 403
        :raises ObjectNotFoundException: on 404
        :returns: {"offset": 836, "limit": 574, "responseCode": 200, "count": 329, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Nation want listen key.", "messageTemplate": "Road popular pattern way check under item.", "field": "Compare difference outside usually trip describe base civil.", "parameter": {}, "timestamp": 854002430}], "currentPage": 998, "size": 386}
        """
        from requests import get
        from argus_api.exceptions import http

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