diff --git a/clients/python/docs/GeneralApi.md b/clients/python/docs/GeneralApi.md index de9a67ff..3efadc41 100644 --- a/clients/python/docs/GeneralApi.md +++ b/clients/python/docs/GeneralApi.md @@ -115,6 +115,7 @@ with graphsense.ApiClient(configuration) as api_client: q = "foo" # str | It can be (the beginning of) an address, a transaction or a label currency = "btc" # str | The cryptocurrency (e.g., btc) (optional) limit = 10 # int | Maximum number of search results (optional) if omitted the server will use the default value of 10 + include_sub_tx_identifiers = True # bool | Whether to include sub-transaction identifiers (optional) if omitted the server will use the default value of False # example passing only required values which don't have defaults set try: @@ -128,7 +129,7 @@ with graphsense.ApiClient(configuration) as api_client: # and optional values try: # Returns matching addresses, transactions and labels - api_response = api_instance.search(q, currency=currency, limit=limit) + api_response = api_instance.search(q, currency=currency, limit=limit, include_sub_tx_identifiers=include_sub_tx_identifiers) pprint(api_response) except graphsense.ApiException as e: print("Exception when calling GeneralApi->search: %s\n" % e) @@ -142,6 +143,7 @@ Name | Type | Description | Notes **q** | **str**| It can be (the beginning of) an address, a transaction or a label | **currency** | **str**| The cryptocurrency (e.g., btc) | [optional] **limit** | **int**| Maximum number of search results | [optional] if omitted the server will use the default value of 10 + **include_sub_tx_identifiers** | **bool**| Whether to include sub-transaction identifiers | [optional] if omitted the server will use the default value of False **_preload_content** | **bool** | If False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. | [optional] default is True. **async_req** | **bool** | Execute request asynchronously | [optional] default is False. diff --git a/clients/python/graphsense/api/general_api.py b/clients/python/graphsense/api/general_api.py index 7e8f1efa..199e7e42 100644 --- a/clients/python/graphsense/api/general_api.py +++ b/clients/python/graphsense/api/general_api.py @@ -160,6 +160,7 @@ def __search( Keyword Args: currency (str): The cryptocurrency (e.g., btc). [optional] limit (int): Maximum number of search results. [optional] if omitted the server will use the default value of 10 + include_sub_tx_identifiers (bool): Whether to include sub-transaction identifiers. [optional] if omitted the server will use the default value of False _return_http_data_only (bool): response data without head status code and headers. Default is True. _preload_content (bool): if False, the urllib3.HTTPResponse object @@ -224,6 +225,7 @@ def __search( 'q', 'currency', 'limit', + 'include_sub_tx_identifiers', ], 'required': [ 'q', @@ -257,16 +259,20 @@ def __search( (str,), 'limit': (int,), + 'include_sub_tx_identifiers': + (bool,), }, 'attribute_map': { 'q': 'q', 'currency': 'currency', 'limit': 'limit', + 'include_sub_tx_identifiers': 'include_sub_tx_identifiers', }, 'location_map': { 'q': 'query', 'currency': 'query', 'limit': 'query', + 'include_sub_tx_identifiers': 'query', }, 'collection_format_map': { } diff --git a/gsrest/service/general_service.py b/gsrest/service/general_service.py index affad6e7..9539c10d 100644 --- a/gsrest/service/general_service.py +++ b/gsrest/service/general_service.py @@ -26,12 +26,16 @@ async def search_by_currency(request, currency, q, limit=10): return pydantic_search_result_by_currency_to_openapi(pydantic_result) -async def search(request, q, currency=None, limit=10): +async def search(request, q, currency=None, limit=10, include_sub_tx_identifiers=False): services = get_service_container(request) tagstore_groups = get_tagstore_access_groups(request) pydantic_result = await services.general_service.search( - q, tagstore_groups, currency, limit, include_sub_tx_identifiers=False + q, + tagstore_groups, + currency, + limit, + include_sub_tx_identifiers=include_sub_tx_identifiers, ) return pydantic_search_result_to_openapi(pydantic_result) diff --git a/openapi_server/controllers/general_controller.py b/openapi_server/controllers/general_controller.py index cbe4f3f9..d4c355fb 100644 --- a/openapi_server/controllers/general_controller.py +++ b/openapi_server/controllers/general_controller.py @@ -92,7 +92,7 @@ async def get_statistics(request: web.Request, ) -> web.Response: raise web.HTTPInternalServerError() -async def search(request: web.Request, q, currency=None, limit=None) -> web.Response: +async def search(request: web.Request, q, currency=None, limit=None, include_sub_tx_identifiers=None) -> web.Response: """Returns matching addresses, transactions and labels @@ -103,6 +103,8 @@ async def search(request: web.Request, q, currency=None, limit=None) -> web.Resp :type currency: str :param limit: Maximum number of search results :type limit: int + :param include_sub_tx_identifiers: Whether to include sub-transaction identifiers + :type include_sub_tx_identifiers: bool """ @@ -127,11 +129,11 @@ async def search(request: web.Request, q, currency=None, limit=None) -> web.Resp request.app['request_config']['show_private_tags'] = show_private_tags try: - if 'currency' in ['','q','currency','limit']: + if 'currency' in ['','q','currency','limit','include_sub_tx_identifiers']: if currency is not None: currency = currency.lower() result = service.search(request - ,q=q,currency=currency,limit=limit) + ,q=q,currency=currency,limit=limit,include_sub_tx_identifiers=include_sub_tx_identifiers) result = await result for plugin in request.app['plugins']: diff --git a/openapi_server/openapi/openapi.yaml b/openapi_server/openapi/openapi.yaml index 8368ba95..e6f36e10 100644 --- a/openapi_server/openapi/openapi.yaml +++ b/openapi_server/openapi/openapi.yaml @@ -45,6 +45,16 @@ paths: maximum: 100 type: integer style: form + - description: Whether to include sub-transaction identifiers + example: true + explode: true + in: query + name: include_sub_tx_identifiers + required: false + schema: + default: false + type: boolean + style: form responses: "200": content: @@ -3167,6 +3177,17 @@ components: maximum: 100 type: integer style: form + include_sub_tx_identifiers: + description: Whether to include sub-transaction identifiers + example: true + explode: true + in: query + name: include_sub_tx_identifiers + required: false + schema: + default: false + type: boolean + style: form operation: description: The operation to execute in bulk example: get_block diff --git a/openapi_spec/graphsense.yaml b/openapi_spec/graphsense.yaml index d082dcb8..6ade78a3 100644 --- a/openapi_spec/graphsense.yaml +++ b/openapi_spec/graphsense.yaml @@ -29,6 +29,7 @@ paths: - $ref: '#/components/parameters/currency_query' - $ref: '#/components/parameters/search_query' - $ref: '#/components/parameters/limit' + - $ref: '#/components/parameters/include_sub_tx_identifiers' responses: "200": description: OK @@ -1205,6 +1206,15 @@ components: maximum: 100 description: Maximum number of search results example: 10 + include_sub_tx_identifiers: + in: query + name: include_sub_tx_identifiers + required: false + schema: + type: boolean + default: false + description: Whether to include sub-transaction identifiers + example: true operation: in: path name: operation