diff --git a/.codegen.json b/.codegen.json index 4c1fbbdf..827c862a 100644 --- a/.codegen.json +++ b/.codegen.json @@ -1 +1 @@ -{ "engineHash": "0a79fc3", "specHash": "90cf4e4", "version": "1.6.0" } +{ "engineHash": "4d95546", "specHash": "9d452cf", "version": "1.6.0" } diff --git a/box_sdk_gen/managers/search.py b/box_sdk_gen/managers/search.py index d85b1b59..4a40794c 100644 --- a/box_sdk_gen/managers/search.py +++ b/box_sdk_gen/managers/search.py @@ -134,7 +134,7 @@ def search_by_metadata_query( ancestor_folder_id: str, *, query: Optional[str] = None, - query_params: Optional[Dict[str, str]] = None, + query_params: Optional[Dict] = None, order_by: Optional[List[SearchByMetadataQueryOrderBy]] = None, limit: Optional[int] = None, marker: Optional[str] = None, @@ -176,7 +176,7 @@ def search_by_metadata_query( :param query_params: Set of arguments corresponding to the parameters specified in the `query`. The type of each parameter used in the `query_params` must match the type of the corresponding metadata template field., defaults to None - :type query_params: Optional[Dict[str, str]], optional + :type query_params: Optional[Dict], optional :param order_by: A list of template fields and directions to sort the metadata query results by. diff --git a/box_sdk_gen/schemas/metadata_query.py b/box_sdk_gen/schemas/metadata_query.py index d6e4bb05..92fe3a7c 100644 --- a/box_sdk_gen/schemas/metadata_query.py +++ b/box_sdk_gen/schemas/metadata_query.py @@ -55,7 +55,7 @@ def __init__( ancestor_folder_id: str, *, query: Optional[str] = None, - query_params: Optional[Dict[str, str]] = None, + query_params: Optional[Dict] = None, order_by: Optional[List[MetadataQueryOrderByField]] = None, limit: Optional[int] = None, marker: Optional[str] = None, @@ -84,7 +84,7 @@ def __init__( :param query_params: Set of arguments corresponding to the parameters specified in the `query`. The type of each parameter used in the `query_params` must match the type of the corresponding metadata template field., defaults to None - :type query_params: Optional[Dict[str, str]], optional + :type query_params: Optional[Dict], optional :param order_by: A list of template fields and directions to sort the metadata query results by. diff --git a/docs/search.md b/docs/search.md index 7a76214c..31cc9d6b 100644 --- a/docs/search.md +++ b/docs/search.md @@ -21,7 +21,10 @@ See the endpoint docs at ```python client.search.search_by_metadata_query( - search_from, "0", query="testName >= :value", query_params={"value": "0.0"} + search_from, + "0", + query="testColor = :value", + query_params={"value": ["red", "blue"]}, ) ``` @@ -31,7 +34,7 @@ client.search.search_by_metadata_query( - Specifies the template used in the query. Must be in the form `scope.templateKey`. Not all templates can be used in this field, most notably the built-in, Box-provided classification templates can not be used in a query. - query `Optional[str]` - The query to perform. A query is a logical expression that is very similar to a SQL `SELECT` statement. Values in the search query can be turned into parameters specified in the `query_param` arguments list to prevent having to manually insert search values into the query string. For example, a value of `:amount` would represent the `amount` value in `query_params` object. -- query_params `Optional[Dict[str, str]]` +- query_params `Optional[Dict]` - Set of arguments corresponding to the parameters specified in the `query`. The type of each parameter used in the `query_params` must match the type of the corresponding metadata template field. - ancestor_folder_id `str` - The ID of the folder that you are restricting the query to. A value of zero will return results from all folders you have access to. A non-zero value will only return results found in the folder corresponding to the ID or in any of its subfolders. diff --git a/test/search.py b/test/search.py index ff388eff..d635844e 100644 --- a/test/search.py +++ b/test/search.py @@ -12,6 +12,10 @@ CreateMetadataTemplateFieldsTypeField, ) +from box_sdk_gen.managers.metadata_templates import ( + CreateMetadataTemplateFieldsOptionsField, +) + from box_sdk_gen.schemas.files import Files from box_sdk_gen.managers.uploads import UploadFileAttributes @@ -36,10 +40,6 @@ from box_sdk_gen.managers.search import SearchForContentTrashContent -from box_sdk_gen.managers.metadata_templates import ( - CreateMetadataTemplateFieldsOptionsField, -) - from box_sdk_gen.schemas.metadata_filter import MetadataFilter from box_sdk_gen.schemas.metadata_filter import MetadataFilterScopeField @@ -71,9 +71,14 @@ def testCreateMetaDataQueryExecuteRead(): template_key=template_key, fields=[ CreateMetadataTemplateFields( - type=CreateMetadataTemplateFieldsTypeField.FLOAT.value, - key='testName', - display_name='testName', + type=CreateMetadataTemplateFieldsTypeField.MULTISELECT.value, + key='testColor', + display_name='testColor', + options=[ + CreateMetadataTemplateFieldsOptionsField(key='red'), + CreateMetadataTemplateFieldsOptionsField(key='green'), + CreateMetadataTemplateFieldsOptionsField(key='blue'), + ], ) ], ) @@ -89,13 +94,16 @@ def testCreateMetaDataQueryExecuteRead(): file.id, CreateFileMetadataByIdScope.ENTERPRISE.value, template_key, - {'testName': 1}, + {'testColor': ['red', 'blue']}, ) assert metadata.template == template_key assert metadata.scope == template.scope search_from: str = ''.join([template.scope, '.', template.template_key]) query: MetadataQueryResults = client.search.search_by_metadata_query( - search_from, '0', query='testName >= :value', query_params={'value': '0.0'} + search_from, + '0', + query='testColor = :value', + query_params={'value': ['red', 'blue']}, ) assert len(query.entries) >= 0 client.metadata_templates.delete_metadata_template(