diff --git a/generated/.github/workflows/python.yml b/generated/.github/workflows/python.yml new file mode 100644 index 00000000..776934c9 --- /dev/null +++ b/generated/.github/workflows/python.yml @@ -0,0 +1,34 @@ +# NOTE: This file is auto generated by OpenAPI Generator. +# URL: https://openapi-generator.tech +# +# ref: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python + +name: groundlight_openapi_client Python package + +on: [push, pull_request] + +permissions: + contents: read + +jobs: + build: + + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"] + + steps: + - uses: actions/checkout@v4 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -r requirements.txt + pip install -r test-requirements.txt + - name: Test with pytest + run: | + pytest --cov=groundlight_openapi_client diff --git a/generated/.gitignore b/generated/.gitignore index 43995bd4..65b06b95 100644 --- a/generated/.gitignore +++ b/generated/.gitignore @@ -62,5 +62,5 @@ docs/_build/ # PyBuilder target/ -#Ipython Notebook +# Ipython Notebook .ipynb_checkpoints diff --git a/generated/.openapi-generator/FILES b/generated/.openapi-generator/FILES index d8fdc5e5..39877377 100644 --- a/generated/.openapi-generator/FILES +++ b/generated/.openapi-generator/FILES @@ -1,8 +1,7 @@ +.github/workflows/python.yml .gitignore README.md -docs/AccountMonthToDateInfo.md docs/Action.md -docs/ActionList.md docs/ActionsApi.md docs/AllNotes.md docs/AnnotationsRequestedEnum.md @@ -18,8 +17,7 @@ docs/Condition.md docs/ConditionRequest.md docs/CountModeConfiguration.md docs/CountingResult.md -docs/Detector.md -docs/DetectorCreationInputRequest.md +docs/DetectorCreationInputRequestModeConfiguration.md docs/DetectorGroup.md docs/DetectorGroupRequest.md docs/DetectorGroupsApi.md @@ -29,15 +27,14 @@ docs/DetectorsApi.md docs/EdgeApi.md docs/EdgeModelInfo.md docs/EscalationTypeEnum.md +docs/GetDetectorEvaluation200Response.md +docs/GetDetectorEvaluation200ResponseEvaluationResults.md +docs/GetDetectorMetrics200Response.md +docs/GetDetectorMetrics200ResponseSummary.md +docs/GetDetectorMetrics200ResponseSummaryClassCounts.md docs/ImageQueriesApi.md -docs/ImageQuery.md +docs/ImageQueryResult.md docs/ImageQueryTypeEnum.md -docs/InlineResponse200.md -docs/InlineResponse2001.md -docs/InlineResponse2001EvaluationResults.md -docs/InlineResponse2002.md -docs/InlineResponse200Summary.md -docs/InlineResponse200SummaryClassCounts.md docs/Label.md docs/LabelValue.md docs/LabelValueRequest.md @@ -52,13 +49,13 @@ docs/NotesApi.md docs/PaginatedDetectorList.md docs/PaginatedImageQueryList.md docs/PaginatedRuleList.md -docs/PatchedDetectorRequest.md docs/PayloadTemplate.md docs/PayloadTemplateRequest.md docs/ROI.md docs/ROIRequest.md docs/ResultTypeEnum.md docs/Rule.md +docs/RuleAction.md docs/RuleRequest.md docs/SnoozeTimeUnitEnum.md docs/Source.md @@ -70,6 +67,7 @@ docs/UserApi.md docs/VerbEnum.md docs/WebhookAction.md docs/WebhookActionRequest.md +docs/WhoAmI200Response.md git_push.sh groundlight_openapi_client/__init__.py groundlight_openapi_client/api/__init__.py @@ -84,76 +82,82 @@ groundlight_openapi_client/api/month_to_date_account_info_api.py groundlight_openapi_client/api/notes_api.py groundlight_openapi_client/api/user_api.py groundlight_openapi_client/api_client.py -groundlight_openapi_client/apis/__init__.py +groundlight_openapi_client/api_response.py groundlight_openapi_client/configuration.py groundlight_openapi_client/exceptions.py -groundlight_openapi_client/model/__init__.py -groundlight_openapi_client/model/account_month_to_date_info.py -groundlight_openapi_client/model/action.py -groundlight_openapi_client/model/action_list.py -groundlight_openapi_client/model/all_notes.py -groundlight_openapi_client/model/annotations_requested_enum.py -groundlight_openapi_client/model/b_box_geometry.py -groundlight_openapi_client/model/b_box_geometry_request.py -groundlight_openapi_client/model/binary_classification_result.py -groundlight_openapi_client/model/blank_enum.py -groundlight_openapi_client/model/bounding_box_label_enum.py -groundlight_openapi_client/model/bounding_box_mode_configuration.py -groundlight_openapi_client/model/bounding_box_result.py -groundlight_openapi_client/model/channel_enum.py -groundlight_openapi_client/model/condition.py -groundlight_openapi_client/model/condition_request.py -groundlight_openapi_client/model/count_mode_configuration.py -groundlight_openapi_client/model/counting_result.py -groundlight_openapi_client/model/detector.py -groundlight_openapi_client/model/detector_creation_input_request.py -groundlight_openapi_client/model/detector_group.py -groundlight_openapi_client/model/detector_group_request.py -groundlight_openapi_client/model/detector_type_enum.py -groundlight_openapi_client/model/edge_model_info.py -groundlight_openapi_client/model/escalation_type_enum.py -groundlight_openapi_client/model/image_query.py -groundlight_openapi_client/model/image_query_type_enum.py -groundlight_openapi_client/model/inline_response200.py -groundlight_openapi_client/model/inline_response2001.py -groundlight_openapi_client/model/inline_response2001_evaluation_results.py -groundlight_openapi_client/model/inline_response2002.py -groundlight_openapi_client/model/inline_response200_summary.py -groundlight_openapi_client/model/inline_response200_summary_class_counts.py -groundlight_openapi_client/model/label.py -groundlight_openapi_client/model/label_value.py -groundlight_openapi_client/model/label_value_request.py -groundlight_openapi_client/model/mode_enum.py -groundlight_openapi_client/model/multi_class_mode_configuration.py -groundlight_openapi_client/model/multi_classification_result.py -groundlight_openapi_client/model/note.py -groundlight_openapi_client/model/note_request.py -groundlight_openapi_client/model/paginated_detector_list.py -groundlight_openapi_client/model/paginated_image_query_list.py -groundlight_openapi_client/model/paginated_rule_list.py -groundlight_openapi_client/model/patched_detector_request.py -groundlight_openapi_client/model/payload_template.py -groundlight_openapi_client/model/payload_template_request.py -groundlight_openapi_client/model/result_type_enum.py -groundlight_openapi_client/model/roi.py -groundlight_openapi_client/model/roi_request.py -groundlight_openapi_client/model/rule.py -groundlight_openapi_client/model/rule_request.py -groundlight_openapi_client/model/snooze_time_unit_enum.py -groundlight_openapi_client/model/source.py -groundlight_openapi_client/model/source_enum.py -groundlight_openapi_client/model/status_enum.py -groundlight_openapi_client/model/text_mode_configuration.py -groundlight_openapi_client/model/text_recognition_result.py -groundlight_openapi_client/model/verb_enum.py -groundlight_openapi_client/model/webhook_action.py -groundlight_openapi_client/model/webhook_action_request.py -groundlight_openapi_client/model_utils.py groundlight_openapi_client/models/__init__.py +groundlight_openapi_client/models/action.py +groundlight_openapi_client/models/all_notes.py +groundlight_openapi_client/models/annotations_requested_enum.py +groundlight_openapi_client/models/b_box_geometry.py +groundlight_openapi_client/models/b_box_geometry_request.py +groundlight_openapi_client/models/binary_classification_result.py +groundlight_openapi_client/models/blank_enum.py +groundlight_openapi_client/models/bounding_box_label_enum.py +groundlight_openapi_client/models/bounding_box_mode_configuration.py +groundlight_openapi_client/models/bounding_box_result.py +groundlight_openapi_client/models/channel_enum.py +groundlight_openapi_client/models/condition.py +groundlight_openapi_client/models/condition_request.py +groundlight_openapi_client/models/count_mode_configuration.py +groundlight_openapi_client/models/counting_result.py +groundlight_openapi_client/models/detector_creation_input_request_mode_configuration.py +groundlight_openapi_client/models/detector_group.py +groundlight_openapi_client/models/detector_group_request.py +groundlight_openapi_client/models/detector_type_enum.py +groundlight_openapi_client/models/edge_model_info.py +groundlight_openapi_client/models/escalation_type_enum.py +groundlight_openapi_client/models/get_detector_evaluation200_response.py +groundlight_openapi_client/models/get_detector_evaluation200_response_evaluation_results.py +groundlight_openapi_client/models/get_detector_metrics200_response.py +groundlight_openapi_client/models/get_detector_metrics200_response_summary.py +groundlight_openapi_client/models/get_detector_metrics200_response_summary_class_counts.py +groundlight_openapi_client/models/image_query_result.py +groundlight_openapi_client/models/image_query_type_enum.py +groundlight_openapi_client/models/label.py +groundlight_openapi_client/models/label_value.py +groundlight_openapi_client/models/label_value_request.py +groundlight_openapi_client/models/mode_enum.py +groundlight_openapi_client/models/multi_class_mode_configuration.py +groundlight_openapi_client/models/multi_classification_result.py +groundlight_openapi_client/models/note.py +groundlight_openapi_client/models/note_request.py +groundlight_openapi_client/models/paginated_detector_list.py +groundlight_openapi_client/models/paginated_image_query_list.py +groundlight_openapi_client/models/paginated_rule_list.py +groundlight_openapi_client/models/payload_template.py +groundlight_openapi_client/models/payload_template_request.py +groundlight_openapi_client/models/result_type_enum.py +groundlight_openapi_client/models/roi.py +groundlight_openapi_client/models/roi_request.py +groundlight_openapi_client/models/rule.py +groundlight_openapi_client/models/rule_action.py +groundlight_openapi_client/models/rule_request.py +groundlight_openapi_client/models/snooze_time_unit_enum.py +groundlight_openapi_client/models/source.py +groundlight_openapi_client/models/source_enum.py +groundlight_openapi_client/models/status_enum.py +groundlight_openapi_client/models/text_mode_configuration.py +groundlight_openapi_client/models/text_recognition_result.py +groundlight_openapi_client/models/verb_enum.py +groundlight_openapi_client/models/webhook_action.py +groundlight_openapi_client/models/webhook_action_request.py +groundlight_openapi_client/models/who_am_i200_response.py +groundlight_openapi_client/py.typed groundlight_openapi_client/rest.py +pyproject.toml requirements.txt setup.cfg setup.py test-requirements.txt test/__init__.py +test/test_detector_creation_input_request_mode_configuration.py +test/test_get_detector_evaluation200_response.py +test/test_get_detector_evaluation200_response_evaluation_results.py +test/test_get_detector_metrics200_response.py +test/test_get_detector_metrics200_response_summary.py +test/test_get_detector_metrics200_response_summary_class_counts.py +test/test_image_query_result.py +test/test_rule_action.py +test/test_who_am_i200_response.py tox.ini diff --git a/generated/.openapi-generator/VERSION b/generated/.openapi-generator/VERSION index 1e20ec35..1b2d969d 100644 --- a/generated/.openapi-generator/VERSION +++ b/generated/.openapi-generator/VERSION @@ -1 +1 @@ -5.4.0 \ No newline at end of file +7.18.0 diff --git a/generated/README.md b/generated/README.md index e21f5848..cb45c741 100644 --- a/generated/README.md +++ b/generated/README.md @@ -5,11 +5,12 @@ This Python package is automatically generated by the [OpenAPI Generator](https: - API version: 0.18.2 - Package version: 1.0.0 +- Generator version: 7.18.0 - Build package: org.openapitools.codegen.languages.PythonClientCodegen ## Requirements. -Python >=3.6 +Python 3.9+ ## Installation & Usage ### pip install @@ -40,19 +41,20 @@ Then import the package: import groundlight_openapi_client ``` +### Tests + +Execute `pytest` to run the tests. + ## Getting Started Please follow the [installation procedure](#installation--usage) and then run the following: ```python -import time import groundlight_openapi_client +from groundlight_openapi_client.rest import ApiException from pprint import pprint -from groundlight_openapi_client.api import actions_api -from groundlight_openapi_client.model.paginated_rule_list import PaginatedRuleList -from groundlight_openapi_client.model.rule import Rule -from groundlight_openapi_client.model.rule_request import RuleRequest + # Defining the host is optional and defaults to https://api.groundlight.ai/device-api # See configuration.py for a list of all supported configuration parameters. configuration = groundlight_openapi_client.Configuration( @@ -65,7 +67,7 @@ configuration = groundlight_openapi_client.Configuration( # satisfies your auth use case. # Configure API key authorization: ApiToken -configuration.api_key['ApiToken'] = 'YOUR_API_KEY' +configuration.api_key['ApiToken'] = os.environ["API_KEY"] # Uncomment below to setup prefix (e.g. Bearer) for API key, if needed # configuration.api_key_prefix['ApiToken'] = 'Bearer' @@ -74,39 +76,17 @@ configuration.api_key['ApiToken'] = 'YOUR_API_KEY' # Enter a context with an instance of the API client with groundlight_openapi_client.ApiClient(configuration) as api_client: # Create an instance of the API class - api_instance = actions_api.ActionsApi(api_client) - detector_id = "detector_id_example" # str | -rule_request = RuleRequest( - name="name_example", - enabled=True, - snooze_time_enabled=False, - snooze_time_value=0, - snooze_time_unit=None, - human_review_required=False, - condition=ConditionRequest( - verb="verb_example", - parameters={ - "key": None, - }, - ), - action=None, - webhook_action=[ - WebhookActionRequest( - url="url_example", - include_image=True, - payload_template=None, - last_message_failed=True, - last_failure_error="last_failure_error_example", - last_failed_at=dateutil_parser('1970-01-01T00:00:00.00Z'), - ), - ], - ) # RuleRequest | + api_instance = groundlight_openapi_client.ActionsApi(api_client) + detector_id = 'detector_id_example' # str | + rule_request = groundlight_openapi_client.RuleRequest() # RuleRequest | try: api_response = api_instance.create_rule(detector_id, rule_request) + print("The response of ActionsApi->create_rule:\n") pprint(api_response) - except groundlight_openapi_client.ApiException as e: + except ApiException as e: print("Exception when calling ActionsApi->create_rule: %s\n" % e) + ``` ## Documentation for API Endpoints @@ -145,9 +125,7 @@ Class | Method | HTTP request | Description ## Documentation For Models - - [AccountMonthToDateInfo](docs/AccountMonthToDateInfo.md) - [Action](docs/Action.md) - - [ActionList](docs/ActionList.md) - [AllNotes](docs/AllNotes.md) - [AnnotationsRequestedEnum](docs/AnnotationsRequestedEnum.md) - [BBoxGeometry](docs/BBoxGeometry.md) @@ -162,21 +140,19 @@ Class | Method | HTTP request | Description - [ConditionRequest](docs/ConditionRequest.md) - [CountModeConfiguration](docs/CountModeConfiguration.md) - [CountingResult](docs/CountingResult.md) - - [Detector](docs/Detector.md) - - [DetectorCreationInputRequest](docs/DetectorCreationInputRequest.md) + - [DetectorCreationInputRequestModeConfiguration](docs/DetectorCreationInputRequestModeConfiguration.md) - [DetectorGroup](docs/DetectorGroup.md) - [DetectorGroupRequest](docs/DetectorGroupRequest.md) - [DetectorTypeEnum](docs/DetectorTypeEnum.md) - [EdgeModelInfo](docs/EdgeModelInfo.md) - [EscalationTypeEnum](docs/EscalationTypeEnum.md) - - [ImageQuery](docs/ImageQuery.md) + - [GetDetectorEvaluation200Response](docs/GetDetectorEvaluation200Response.md) + - [GetDetectorEvaluation200ResponseEvaluationResults](docs/GetDetectorEvaluation200ResponseEvaluationResults.md) + - [GetDetectorMetrics200Response](docs/GetDetectorMetrics200Response.md) + - [GetDetectorMetrics200ResponseSummary](docs/GetDetectorMetrics200ResponseSummary.md) + - [GetDetectorMetrics200ResponseSummaryClassCounts](docs/GetDetectorMetrics200ResponseSummaryClassCounts.md) + - [ImageQueryResult](docs/ImageQueryResult.md) - [ImageQueryTypeEnum](docs/ImageQueryTypeEnum.md) - - [InlineResponse200](docs/InlineResponse200.md) - - [InlineResponse2001](docs/InlineResponse2001.md) - - [InlineResponse2001EvaluationResults](docs/InlineResponse2001EvaluationResults.md) - - [InlineResponse2002](docs/InlineResponse2002.md) - - [InlineResponse200Summary](docs/InlineResponse200Summary.md) - - [InlineResponse200SummaryClassCounts](docs/InlineResponse200SummaryClassCounts.md) - [Label](docs/Label.md) - [LabelValue](docs/LabelValue.md) - [LabelValueRequest](docs/LabelValueRequest.md) @@ -188,13 +164,13 @@ Class | Method | HTTP request | Description - [PaginatedDetectorList](docs/PaginatedDetectorList.md) - [PaginatedImageQueryList](docs/PaginatedImageQueryList.md) - [PaginatedRuleList](docs/PaginatedRuleList.md) - - [PatchedDetectorRequest](docs/PatchedDetectorRequest.md) - [PayloadTemplate](docs/PayloadTemplate.md) - [PayloadTemplateRequest](docs/PayloadTemplateRequest.md) - [ROI](docs/ROI.md) - [ROIRequest](docs/ROIRequest.md) - [ResultTypeEnum](docs/ResultTypeEnum.md) - [Rule](docs/Rule.md) + - [RuleAction](docs/RuleAction.md) - [RuleRequest](docs/RuleRequest.md) - [SnoozeTimeUnitEnum](docs/SnoozeTimeUnitEnum.md) - [Source](docs/Source.md) @@ -205,12 +181,16 @@ Class | Method | HTTP request | Description - [VerbEnum](docs/VerbEnum.md) - [WebhookAction](docs/WebhookAction.md) - [WebhookActionRequest](docs/WebhookActionRequest.md) + - [WhoAmI200Response](docs/WhoAmI200Response.md) + ## Documentation For Authorization -## ApiToken +Authentication schemes defined for the API: + +### ApiToken - **Type**: API key - **API key parameter name**: x-api-token @@ -222,22 +202,3 @@ Class | Method | HTTP request | Description support@groundlight.ai -## Notes for Large OpenAPI documents -If the OpenAPI document is large, imports in groundlight_openapi_client.apis and groundlight_openapi_client.models may fail with a -RecursionError indicating the maximum recursion limit has been exceeded. In that case, there are a couple of solutions: - -Solution 1: -Use specific imports for apis and models like: -- `from groundlight_openapi_client.api.default_api import DefaultApi` -- `from groundlight_openapi_client.model.pet import Pet` - -Solution 2: -Before importing the package, adjust the maximum recursion limit as shown below: -``` -import sys -sys.setrecursionlimit(1500) -import groundlight_openapi_client -from groundlight_openapi_client.apis import * -from groundlight_openapi_client.models import * -``` - diff --git a/generated/docs/Action.md b/generated/docs/Action.md index 0eee9350..6efbd5dd 100644 --- a/generated/docs/Action.md +++ b/generated/docs/Action.md @@ -2,13 +2,30 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **channel** | [**ChannelEnum**](ChannelEnum.md) | | **recipient** | **str** | | **include_image** | **bool** | | -**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional] +## Example + +```python +from groundlight_openapi_client.models.action import Action + +# TODO update the JSON string below +json = "{}" +# create an instance of Action from a JSON string +action_instance = Action.from_json(json) +# print the JSON string representation of the object +print(Action.to_json()) + +# convert the object into a dict +action_dict = action_instance.to_dict() +# create an instance of Action from a dict +action_from_dict = Action.from_dict(action_dict) +``` [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/generated/docs/ActionsApi.md b/generated/docs/ActionsApi.md index 26321950..ef4fa8fd 100644 --- a/generated/docs/ActionsApi.md +++ b/generated/docs/ActionsApi.md @@ -14,8 +14,6 @@ Method | HTTP request | Description # **create_rule** > Rule create_rule(detector_id, rule_request) - - Create a new rule for a detector ### Example @@ -23,12 +21,12 @@ Create a new rule for a detector * Api Key Authentication (ApiToken): ```python -import time import groundlight_openapi_client -from groundlight_openapi_client.api import actions_api -from groundlight_openapi_client.model.rule import Rule -from groundlight_openapi_client.model.rule_request import RuleRequest +from groundlight_openapi_client.models.rule import Rule +from groundlight_openapi_client.models.rule_request import RuleRequest +from groundlight_openapi_client.rest import ApiException from pprint import pprint + # Defining the host is optional and defaults to https://api.groundlight.ai/device-api # See configuration.py for a list of all supported configuration parameters. configuration = groundlight_openapi_client.Configuration( @@ -41,7 +39,7 @@ configuration = groundlight_openapi_client.Configuration( # satisfies your auth use case. # Configure API key authorization: ApiToken -configuration.api_key['ApiToken'] = 'YOUR_API_KEY' +configuration.api_key['ApiToken'] = os.environ["API_KEY"] # Uncomment below to setup prefix (e.g. Bearer) for API key, if needed # configuration.api_key_prefix['ApiToken'] = 'Bearer' @@ -49,49 +47,27 @@ configuration.api_key['ApiToken'] = 'YOUR_API_KEY' # Enter a context with an instance of the API client with groundlight_openapi_client.ApiClient(configuration) as api_client: # Create an instance of the API class - api_instance = actions_api.ActionsApi(api_client) - detector_id = "detector_id_example" # str | - rule_request = RuleRequest( - name="name_example", - enabled=True, - snooze_time_enabled=False, - snooze_time_value=0, - snooze_time_unit=None, - human_review_required=False, - condition=ConditionRequest( - verb="verb_example", - parameters={ - "key": None, - }, - ), - action=None, - webhook_action=[ - WebhookActionRequest( - url="url_example", - include_image=True, - payload_template=None, - last_message_failed=True, - last_failure_error="last_failure_error_example", - last_failed_at=dateutil_parser('1970-01-01T00:00:00.00Z'), - ), - ], - ) # RuleRequest | - - # example passing only required values which don't have defaults set + api_instance = groundlight_openapi_client.ActionsApi(api_client) + detector_id = 'detector_id_example' # str | + rule_request = groundlight_openapi_client.RuleRequest() # RuleRequest | + try: api_response = api_instance.create_rule(detector_id, rule_request) + print("The response of ActionsApi->create_rule:\n") pprint(api_response) - except groundlight_openapi_client.ApiException as e: + except Exception as e: print("Exception when calling ActionsApi->create_rule: %s\n" % e) ``` + ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **detector_id** | **str**| | - **rule_request** | [**RuleRequest**](RuleRequest.md)| | + **detector_id** | **str**| | + **rule_request** | [**RuleRequest**](RuleRequest.md)| | ### Return type @@ -106,7 +82,6 @@ Name | Type | Description | Notes - **Content-Type**: application/json, application/x-www-form-urlencoded, multipart/form-data - **Accept**: application/json - ### HTTP response details | Status code | Description | Response headers | @@ -118,8 +93,6 @@ Name | Type | Description | Notes # **delete_rule** > delete_rule(id) - - Delete a rule ### Example @@ -127,10 +100,10 @@ Delete a rule * Api Key Authentication (ApiToken): ```python -import time import groundlight_openapi_client -from groundlight_openapi_client.api import actions_api +from groundlight_openapi_client.rest import ApiException from pprint import pprint + # Defining the host is optional and defaults to https://api.groundlight.ai/device-api # See configuration.py for a list of all supported configuration parameters. configuration = groundlight_openapi_client.Configuration( @@ -143,7 +116,7 @@ configuration = groundlight_openapi_client.Configuration( # satisfies your auth use case. # Configure API key authorization: ApiToken -configuration.api_key['ApiToken'] = 'YOUR_API_KEY' +configuration.api_key['ApiToken'] = os.environ["API_KEY"] # Uncomment below to setup prefix (e.g. Bearer) for API key, if needed # configuration.api_key_prefix['ApiToken'] = 'Bearer' @@ -151,22 +124,23 @@ configuration.api_key['ApiToken'] = 'YOUR_API_KEY' # Enter a context with an instance of the API client with groundlight_openapi_client.ApiClient(configuration) as api_client: # Create an instance of the API class - api_instance = actions_api.ActionsApi(api_client) - id = 1 # int | + api_instance = groundlight_openapi_client.ActionsApi(api_client) + id = 56 # int | - # example passing only required values which don't have defaults set try: api_instance.delete_rule(id) - except groundlight_openapi_client.ApiException as e: + except Exception as e: print("Exception when calling ActionsApi->delete_rule: %s\n" % e) ``` + ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **id** | **int**| | + **id** | **int**| | ### Return type @@ -181,7 +155,6 @@ void (empty response body) - **Content-Type**: Not defined - **Accept**: Not defined - ### HTTP response details | Status code | Description | Response headers | @@ -193,8 +166,6 @@ void (empty response body) # **get_rule** > Rule get_rule(id) - - Retrieve a rule ### Example @@ -202,11 +173,11 @@ Retrieve a rule * Api Key Authentication (ApiToken): ```python -import time import groundlight_openapi_client -from groundlight_openapi_client.api import actions_api -from groundlight_openapi_client.model.rule import Rule +from groundlight_openapi_client.models.rule import Rule +from groundlight_openapi_client.rest import ApiException from pprint import pprint + # Defining the host is optional and defaults to https://api.groundlight.ai/device-api # See configuration.py for a list of all supported configuration parameters. configuration = groundlight_openapi_client.Configuration( @@ -219,7 +190,7 @@ configuration = groundlight_openapi_client.Configuration( # satisfies your auth use case. # Configure API key authorization: ApiToken -configuration.api_key['ApiToken'] = 'YOUR_API_KEY' +configuration.api_key['ApiToken'] = os.environ["API_KEY"] # Uncomment below to setup prefix (e.g. Bearer) for API key, if needed # configuration.api_key_prefix['ApiToken'] = 'Bearer' @@ -227,23 +198,25 @@ configuration.api_key['ApiToken'] = 'YOUR_API_KEY' # Enter a context with an instance of the API client with groundlight_openapi_client.ApiClient(configuration) as api_client: # Create an instance of the API class - api_instance = actions_api.ActionsApi(api_client) - id = 1 # int | + api_instance = groundlight_openapi_client.ActionsApi(api_client) + id = 56 # int | - # example passing only required values which don't have defaults set try: api_response = api_instance.get_rule(id) + print("The response of ActionsApi->get_rule:\n") pprint(api_response) - except groundlight_openapi_client.ApiException as e: + except Exception as e: print("Exception when calling ActionsApi->get_rule: %s\n" % e) ``` + ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **id** | **int**| | + **id** | **int**| | ### Return type @@ -258,7 +231,6 @@ Name | Type | Description | Notes - **Content-Type**: Not defined - **Accept**: application/json - ### HTTP response details | Status code | Description | Response headers | @@ -268,9 +240,7 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **list_detector_rules** -> PaginatedRuleList list_detector_rules(detector_id) - - +> PaginatedRuleList list_detector_rules(detector_id, page=page, page_size=page_size) List all rules for a detector @@ -279,11 +249,11 @@ List all rules for a detector * Api Key Authentication (ApiToken): ```python -import time import groundlight_openapi_client -from groundlight_openapi_client.api import actions_api -from groundlight_openapi_client.model.paginated_rule_list import PaginatedRuleList +from groundlight_openapi_client.models.paginated_rule_list import PaginatedRuleList +from groundlight_openapi_client.rest import ApiException from pprint import pprint + # Defining the host is optional and defaults to https://api.groundlight.ai/device-api # See configuration.py for a list of all supported configuration parameters. configuration = groundlight_openapi_client.Configuration( @@ -296,7 +266,7 @@ configuration = groundlight_openapi_client.Configuration( # satisfies your auth use case. # Configure API key authorization: ApiToken -configuration.api_key['ApiToken'] = 'YOUR_API_KEY' +configuration.api_key['ApiToken'] = os.environ["API_KEY"] # Uncomment below to setup prefix (e.g. Bearer) for API key, if needed # configuration.api_key_prefix['ApiToken'] = 'Bearer' @@ -304,35 +274,29 @@ configuration.api_key['ApiToken'] = 'YOUR_API_KEY' # Enter a context with an instance of the API client with groundlight_openapi_client.ApiClient(configuration) as api_client: # Create an instance of the API class - api_instance = actions_api.ActionsApi(api_client) - detector_id = "detector_id_example" # str | - page = 1 # int | A page number within the paginated result set. (optional) - page_size = 1 # int | Number of results to return per page. (optional) + api_instance = groundlight_openapi_client.ActionsApi(api_client) + detector_id = 'detector_id_example' # str | + page = 56 # int | A page number within the paginated result set. (optional) + page_size = 56 # int | Number of results to return per page. (optional) - # example passing only required values which don't have defaults set - try: - api_response = api_instance.list_detector_rules(detector_id) - pprint(api_response) - except groundlight_openapi_client.ApiException as e: - print("Exception when calling ActionsApi->list_detector_rules: %s\n" % e) - - # example passing only required values which don't have defaults set - # and optional values try: api_response = api_instance.list_detector_rules(detector_id, page=page, page_size=page_size) + print("The response of ActionsApi->list_detector_rules:\n") pprint(api_response) - except groundlight_openapi_client.ApiException as e: + except Exception as e: print("Exception when calling ActionsApi->list_detector_rules: %s\n" % e) ``` + ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **detector_id** | **str**| | - **page** | **int**| A page number within the paginated result set. | [optional] - **page_size** | **int**| Number of results to return per page. | [optional] + **detector_id** | **str**| | + **page** | **int**| A page number within the paginated result set. | [optional] + **page_size** | **int**| Number of results to return per page. | [optional] ### Return type @@ -347,7 +311,6 @@ Name | Type | Description | Notes - **Content-Type**: Not defined - **Accept**: application/json - ### HTTP response details | Status code | Description | Response headers | @@ -357,9 +320,7 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **list_rules** -> PaginatedRuleList list_rules() - - +> PaginatedRuleList list_rules(page=page, page_size=page_size, predictor_id=predictor_id) Lists all rules over all detectors owned by the requester. @@ -368,11 +329,11 @@ Lists all rules over all detectors owned by the requester. * Api Key Authentication (ApiToken): ```python -import time import groundlight_openapi_client -from groundlight_openapi_client.api import actions_api -from groundlight_openapi_client.model.paginated_rule_list import PaginatedRuleList +from groundlight_openapi_client.models.paginated_rule_list import PaginatedRuleList +from groundlight_openapi_client.rest import ApiException from pprint import pprint + # Defining the host is optional and defaults to https://api.groundlight.ai/device-api # See configuration.py for a list of all supported configuration parameters. configuration = groundlight_openapi_client.Configuration( @@ -385,7 +346,7 @@ configuration = groundlight_openapi_client.Configuration( # satisfies your auth use case. # Configure API key authorization: ApiToken -configuration.api_key['ApiToken'] = 'YOUR_API_KEY' +configuration.api_key['ApiToken'] = os.environ["API_KEY"] # Uncomment below to setup prefix (e.g. Bearer) for API key, if needed # configuration.api_key_prefix['ApiToken'] = 'Bearer' @@ -393,28 +354,29 @@ configuration.api_key['ApiToken'] = 'YOUR_API_KEY' # Enter a context with an instance of the API client with groundlight_openapi_client.ApiClient(configuration) as api_client: # Create an instance of the API class - api_instance = actions_api.ActionsApi(api_client) - page = 1 # int | A page number within the paginated result set. (optional) - page_size = 1 # int | Number of results to return per page. (optional) - predictor_id = "predictor_id_example" # str | Filter rules by predictor ID (optional) + api_instance = groundlight_openapi_client.ActionsApi(api_client) + page = 56 # int | A page number within the paginated result set. (optional) + page_size = 56 # int | Number of results to return per page. (optional) + predictor_id = 'predictor_id_example' # str | Filter rules by predictor ID (optional) - # example passing only required values which don't have defaults set - # and optional values try: api_response = api_instance.list_rules(page=page, page_size=page_size, predictor_id=predictor_id) + print("The response of ActionsApi->list_rules:\n") pprint(api_response) - except groundlight_openapi_client.ApiException as e: + except Exception as e: print("Exception when calling ActionsApi->list_rules: %s\n" % e) ``` + ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **page** | **int**| A page number within the paginated result set. | [optional] - **page_size** | **int**| Number of results to return per page. | [optional] - **predictor_id** | **str**| Filter rules by predictor ID | [optional] + **page** | **int**| A page number within the paginated result set. | [optional] + **page_size** | **int**| Number of results to return per page. | [optional] + **predictor_id** | **str**| Filter rules by predictor ID | [optional] ### Return type @@ -429,7 +391,6 @@ Name | Type | Description | Notes - **Content-Type**: Not defined - **Accept**: application/json - ### HTTP response details | Status code | Description | Response headers | diff --git a/generated/docs/AllNotes.md b/generated/docs/AllNotes.md index f14d4ea6..42b646a3 100644 --- a/generated/docs/AllNotes.md +++ b/generated/docs/AllNotes.md @@ -3,12 +3,29 @@ Serializes all notes for a given detector, grouped by type as listed in UserProfile.NoteCategoryChoices The fields must match whats in USERPROFILE.NoteCategoryChoices ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**customer** | [**[Note]**](Note.md) | | -**gl** | [**[Note]**](Note.md) | | -**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional] +**customer** | [**List[Note]**](Note.md) | | +**gl** | [**List[Note]**](Note.md) | | + +## Example + +```python +from groundlight_openapi_client.models.all_notes import AllNotes + +# TODO update the JSON string below +json = "{}" +# create an instance of AllNotes from a JSON string +all_notes_instance = AllNotes.from_json(json) +# print the JSON string representation of the object +print(AllNotes.to_json()) +# convert the object into a dict +all_notes_dict = all_notes_instance.to_dict() +# create an instance of AllNotes from a dict +all_notes_from_dict = AllNotes.from_dict(all_notes_dict) +``` [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/generated/docs/AnnotationsRequestedEnum.md b/generated/docs/AnnotationsRequestedEnum.md index 31b444e4..668a7a47 100644 --- a/generated/docs/AnnotationsRequestedEnum.md +++ b/generated/docs/AnnotationsRequestedEnum.md @@ -1,10 +1,11 @@ # AnnotationsRequestedEnum -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**value** | **str** | | must be one of ["BINARY_CLASSIFICATION", "BOUNDING_BOXES", ] +## Enum + +* `BINARY_CLASSIFICATION` (value: `'BINARY_CLASSIFICATION'`) + +* `BOUNDING_BOXES` (value: `'BOUNDING_BOXES'`) [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/generated/docs/BBoxGeometry.md b/generated/docs/BBoxGeometry.md index 432bb48c..b6ed370a 100644 --- a/generated/docs/BBoxGeometry.md +++ b/generated/docs/BBoxGeometry.md @@ -3,6 +3,7 @@ Mixin for serializers to handle data in the StrictBaseModel format ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **left** | **float** | | @@ -11,8 +12,24 @@ Name | Type | Description | Notes **bottom** | **float** | | **x** | **float** | | [readonly] **y** | **float** | | [readonly] -**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional] +## Example + +```python +from groundlight_openapi_client.models.b_box_geometry import BBoxGeometry + +# TODO update the JSON string below +json = "{}" +# create an instance of BBoxGeometry from a JSON string +b_box_geometry_instance = BBoxGeometry.from_json(json) +# print the JSON string representation of the object +print(BBoxGeometry.to_json()) + +# convert the object into a dict +b_box_geometry_dict = b_box_geometry_instance.to_dict() +# create an instance of BBoxGeometry from a dict +b_box_geometry_from_dict = BBoxGeometry.from_dict(b_box_geometry_dict) +``` [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/generated/docs/BBoxGeometryRequest.md b/generated/docs/BBoxGeometryRequest.md index 93432d84..33f9516e 100644 --- a/generated/docs/BBoxGeometryRequest.md +++ b/generated/docs/BBoxGeometryRequest.md @@ -3,14 +3,31 @@ Mixin for serializers to handle data in the StrictBaseModel format ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **left** | **float** | | **top** | **float** | | **right** | **float** | | **bottom** | **float** | | -**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional] +## Example + +```python +from groundlight_openapi_client.models.b_box_geometry_request import BBoxGeometryRequest + +# TODO update the JSON string below +json = "{}" +# create an instance of BBoxGeometryRequest from a JSON string +b_box_geometry_request_instance = BBoxGeometryRequest.from_json(json) +# print the JSON string representation of the object +print(BBoxGeometryRequest.to_json()) + +# convert the object into a dict +b_box_geometry_request_dict = b_box_geometry_request_instance.to_dict() +# create an instance of BBoxGeometryRequest from a dict +b_box_geometry_request_from_dict = BBoxGeometryRequest.from_dict(b_box_geometry_request_dict) +``` [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/generated/docs/BinaryClassificationResult.md b/generated/docs/BinaryClassificationResult.md index a98a3b70..a78ff1fb 100644 --- a/generated/docs/BinaryClassificationResult.md +++ b/generated/docs/BinaryClassificationResult.md @@ -2,15 +2,32 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**label** | **str** | | -**confidence** | **float, none_type** | | [optional] +**confidence** | **float** | | [optional] **source** | **str** | | [optional] -**result_type** | **str** | | [optional] if omitted the server will use the default value of "binary_classification" +**result_type** | **str** | | [optional] **from_edge** | **bool** | | [optional] -**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional] +**label** | **str** | | + +## Example + +```python +from groundlight_openapi_client.models.binary_classification_result import BinaryClassificationResult + +# TODO update the JSON string below +json = "{}" +# create an instance of BinaryClassificationResult from a JSON string +binary_classification_result_instance = BinaryClassificationResult.from_json(json) +# print the JSON string representation of the object +print(BinaryClassificationResult.to_json()) +# convert the object into a dict +binary_classification_result_dict = binary_classification_result_instance.to_dict() +# create an instance of BinaryClassificationResult from a dict +binary_classification_result_from_dict = BinaryClassificationResult.from_dict(binary_classification_result_dict) +``` [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/generated/docs/BlankEnum.md b/generated/docs/BlankEnum.md index 1531f56d..569c6616 100644 --- a/generated/docs/BlankEnum.md +++ b/generated/docs/BlankEnum.md @@ -1,10 +1,9 @@ # BlankEnum -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**value** | **str** | | defaults to "", must be one of ["", ] +## Enum + +* `EMPTY` (value: `''`) [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/generated/docs/BoundingBoxLabelEnum.md b/generated/docs/BoundingBoxLabelEnum.md index 1cbd7e80..7ac8ad92 100644 --- a/generated/docs/BoundingBoxLabelEnum.md +++ b/generated/docs/BoundingBoxLabelEnum.md @@ -1,10 +1,15 @@ # BoundingBoxLabelEnum -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**value** | **str** | | must be one of ["NO_OBJECTS", "BOUNDING_BOX", "GREATER_THAN_MAX", "UNCLEAR", ] +## Enum + +* `NO_OBJECTS` (value: `'NO_OBJECTS'`) + +* `BOUNDING_BOX` (value: `'BOUNDING_BOX'`) + +* `GREATER_THAN_MAX` (value: `'GREATER_THAN_MAX'`) + +* `UNCLEAR` (value: `'UNCLEAR'`) [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/generated/docs/BoundingBoxModeConfiguration.md b/generated/docs/BoundingBoxModeConfiguration.md index 5a27bed3..abcde52f 100644 --- a/generated/docs/BoundingBoxModeConfiguration.md +++ b/generated/docs/BoundingBoxModeConfiguration.md @@ -2,12 +2,29 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **class_name** | **str** | | **max_num_bboxes** | **int** | | [optional] -**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional] +## Example + +```python +from groundlight_openapi_client.models.bounding_box_mode_configuration import BoundingBoxModeConfiguration + +# TODO update the JSON string below +json = "{}" +# create an instance of BoundingBoxModeConfiguration from a JSON string +bounding_box_mode_configuration_instance = BoundingBoxModeConfiguration.from_json(json) +# print the JSON string representation of the object +print(BoundingBoxModeConfiguration.to_json()) + +# convert the object into a dict +bounding_box_mode_configuration_dict = bounding_box_mode_configuration_instance.to_dict() +# create an instance of BoundingBoxModeConfiguration from a dict +bounding_box_mode_configuration_from_dict = BoundingBoxModeConfiguration.from_dict(bounding_box_mode_configuration_dict) +``` [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/generated/docs/BoundingBoxResult.md b/generated/docs/BoundingBoxResult.md index 7a089d95..cb840ec1 100644 --- a/generated/docs/BoundingBoxResult.md +++ b/generated/docs/BoundingBoxResult.md @@ -2,15 +2,32 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**label** | **str** | | -**confidence** | **float, none_type** | | [optional] +**confidence** | **float** | | [optional] **source** | **str** | | [optional] -**result_type** | **str** | | [optional] if omitted the server will use the default value of "bounding_box" +**result_type** | **str** | | [optional] **from_edge** | **bool** | | [optional] -**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional] +**label** | **str** | | + +## Example + +```python +from groundlight_openapi_client.models.bounding_box_result import BoundingBoxResult + +# TODO update the JSON string below +json = "{}" +# create an instance of BoundingBoxResult from a JSON string +bounding_box_result_instance = BoundingBoxResult.from_json(json) +# print the JSON string representation of the object +print(BoundingBoxResult.to_json()) +# convert the object into a dict +bounding_box_result_dict = bounding_box_result_instance.to_dict() +# create an instance of BoundingBoxResult from a dict +bounding_box_result_from_dict = BoundingBoxResult.from_dict(bounding_box_result_dict) +``` [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/generated/docs/ChannelEnum.md b/generated/docs/ChannelEnum.md index f0dcfeaa..7b82d2a1 100644 --- a/generated/docs/ChannelEnum.md +++ b/generated/docs/ChannelEnum.md @@ -1,10 +1,11 @@ # ChannelEnum -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**value** | **str** | | must be one of ["TEXT", "EMAIL", ] +## Enum + +* `TEXT` (value: `'TEXT'`) + +* `EMAIL` (value: `'EMAIL'`) [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/generated/docs/Condition.md b/generated/docs/Condition.md index e54e1ad5..f4ef6c46 100644 --- a/generated/docs/Condition.md +++ b/generated/docs/Condition.md @@ -2,12 +2,29 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **verb** | **str** | | -**parameters** | **{str: (bool, date, datetime, dict, float, int, list, str, none_type)}** | | -**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional] +**parameters** | **Dict[str, object]** | | + +## Example + +```python +from groundlight_openapi_client.models.condition import Condition + +# TODO update the JSON string below +json = "{}" +# create an instance of Condition from a JSON string +condition_instance = Condition.from_json(json) +# print the JSON string representation of the object +print(Condition.to_json()) +# convert the object into a dict +condition_dict = condition_instance.to_dict() +# create an instance of Condition from a dict +condition_from_dict = Condition.from_dict(condition_dict) +``` [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/generated/docs/ConditionRequest.md b/generated/docs/ConditionRequest.md index 60a6d034..1c7c13f6 100644 --- a/generated/docs/ConditionRequest.md +++ b/generated/docs/ConditionRequest.md @@ -2,12 +2,29 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **verb** | **str** | | -**parameters** | **{str: (bool, date, datetime, dict, float, int, list, str, none_type)}** | | -**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional] +**parameters** | **Dict[str, object]** | | + +## Example + +```python +from groundlight_openapi_client.models.condition_request import ConditionRequest + +# TODO update the JSON string below +json = "{}" +# create an instance of ConditionRequest from a JSON string +condition_request_instance = ConditionRequest.from_json(json) +# print the JSON string representation of the object +print(ConditionRequest.to_json()) +# convert the object into a dict +condition_request_dict = condition_request_instance.to_dict() +# create an instance of ConditionRequest from a dict +condition_request_from_dict = ConditionRequest.from_dict(condition_request_dict) +``` [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/generated/docs/CountModeConfiguration.md b/generated/docs/CountModeConfiguration.md index 0262ae0a..24324873 100644 --- a/generated/docs/CountModeConfiguration.md +++ b/generated/docs/CountModeConfiguration.md @@ -2,12 +2,29 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**class_name** | **str** | | **max_count** | **int** | | [optional] -**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional] +**class_name** | **str** | | + +## Example + +```python +from groundlight_openapi_client.models.count_mode_configuration import CountModeConfiguration + +# TODO update the JSON string below +json = "{}" +# create an instance of CountModeConfiguration from a JSON string +count_mode_configuration_instance = CountModeConfiguration.from_json(json) +# print the JSON string representation of the object +print(CountModeConfiguration.to_json()) +# convert the object into a dict +count_mode_configuration_dict = count_mode_configuration_instance.to_dict() +# create an instance of CountModeConfiguration from a dict +count_mode_configuration_from_dict = CountModeConfiguration.from_dict(count_mode_configuration_dict) +``` [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/generated/docs/CountingResult.md b/generated/docs/CountingResult.md index f9db3d5d..ac061e14 100644 --- a/generated/docs/CountingResult.md +++ b/generated/docs/CountingResult.md @@ -2,16 +2,33 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**count** | **int, none_type** | | -**confidence** | **float, none_type** | | [optional] +**confidence** | **float** | | [optional] **source** | **str** | | [optional] -**result_type** | **str** | | [optional] if omitted the server will use the default value of "counting" +**result_type** | **str** | | [optional] **from_edge** | **bool** | | [optional] +**count** | **int** | | **greater_than_max** | **bool** | | [optional] -**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional] +## Example + +```python +from groundlight_openapi_client.models.counting_result import CountingResult + +# TODO update the JSON string below +json = "{}" +# create an instance of CountingResult from a JSON string +counting_result_instance = CountingResult.from_json(json) +# print the JSON string representation of the object +print(CountingResult.to_json()) + +# convert the object into a dict +counting_result_dict = counting_result_instance.to_dict() +# create an instance of CountingResult from a dict +counting_result_from_dict = CountingResult.from_dict(counting_result_dict) +``` [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/generated/docs/DetectorCreationInputRequestModeConfiguration.md b/generated/docs/DetectorCreationInputRequestModeConfiguration.md new file mode 100644 index 00000000..a1bbd7d7 --- /dev/null +++ b/generated/docs/DetectorCreationInputRequestModeConfiguration.md @@ -0,0 +1,34 @@ +# DetectorCreationInputRequestModeConfiguration + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**max_count** | **int** | | [optional] +**class_name** | **str** | | +**class_names** | **List[str]** | | +**num_classes** | **int** | | [optional] +**value_max_length** | **int** | | [optional] +**max_num_bboxes** | **int** | | [optional] + +## Example + +```python +from groundlight_openapi_client.models.detector_creation_input_request_mode_configuration import DetectorCreationInputRequestModeConfiguration + +# TODO update the JSON string below +json = "{}" +# create an instance of DetectorCreationInputRequestModeConfiguration from a JSON string +detector_creation_input_request_mode_configuration_instance = DetectorCreationInputRequestModeConfiguration.from_json(json) +# print the JSON string representation of the object +print(DetectorCreationInputRequestModeConfiguration.to_json()) + +# convert the object into a dict +detector_creation_input_request_mode_configuration_dict = detector_creation_input_request_mode_configuration_instance.to_dict() +# create an instance of DetectorCreationInputRequestModeConfiguration from a dict +detector_creation_input_request_mode_configuration_from_dict = DetectorCreationInputRequestModeConfiguration.from_dict(detector_creation_input_request_mode_configuration_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/generated/docs/DetectorGroup.md b/generated/docs/DetectorGroup.md index c1f764be..8fbc56ae 100644 --- a/generated/docs/DetectorGroup.md +++ b/generated/docs/DetectorGroup.md @@ -2,12 +2,29 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **id** | **str** | | [readonly] **name** | **str** | | -**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional] +## Example + +```python +from groundlight_openapi_client.models.detector_group import DetectorGroup + +# TODO update the JSON string below +json = "{}" +# create an instance of DetectorGroup from a JSON string +detector_group_instance = DetectorGroup.from_json(json) +# print the JSON string representation of the object +print(DetectorGroup.to_json()) + +# convert the object into a dict +detector_group_dict = detector_group_instance.to_dict() +# create an instance of DetectorGroup from a dict +detector_group_from_dict = DetectorGroup.from_dict(detector_group_dict) +``` [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/generated/docs/DetectorGroupRequest.md b/generated/docs/DetectorGroupRequest.md index 8de4ad8a..67441ab0 100644 --- a/generated/docs/DetectorGroupRequest.md +++ b/generated/docs/DetectorGroupRequest.md @@ -2,11 +2,28 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **name** | **str** | | -**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional] +## Example + +```python +from groundlight_openapi_client.models.detector_group_request import DetectorGroupRequest + +# TODO update the JSON string below +json = "{}" +# create an instance of DetectorGroupRequest from a JSON string +detector_group_request_instance = DetectorGroupRequest.from_json(json) +# print the JSON string representation of the object +print(DetectorGroupRequest.to_json()) + +# convert the object into a dict +detector_group_request_dict = detector_group_request_instance.to_dict() +# create an instance of DetectorGroupRequest from a dict +detector_group_request_from_dict = DetectorGroupRequest.from_dict(detector_group_request_dict) +``` [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/generated/docs/DetectorGroupsApi.md b/generated/docs/DetectorGroupsApi.md index 27212d12..cc027d3e 100644 --- a/generated/docs/DetectorGroupsApi.md +++ b/generated/docs/DetectorGroupsApi.md @@ -11,21 +11,23 @@ Method | HTTP request | Description # **create_detector_group** > DetectorGroup create_detector_group(detector_group_request) +Create a new detector group - -Create a new detector group POST data: Required: - name (str) - name of the predictor set +POST data: + Required: + - name (str) - name of the predictor set ### Example * Api Key Authentication (ApiToken): ```python -import time import groundlight_openapi_client -from groundlight_openapi_client.api import detector_groups_api -from groundlight_openapi_client.model.detector_group_request import DetectorGroupRequest -from groundlight_openapi_client.model.detector_group import DetectorGroup +from groundlight_openapi_client.models.detector_group import DetectorGroup +from groundlight_openapi_client.models.detector_group_request import DetectorGroupRequest +from groundlight_openapi_client.rest import ApiException from pprint import pprint + # Defining the host is optional and defaults to https://api.groundlight.ai/device-api # See configuration.py for a list of all supported configuration parameters. configuration = groundlight_openapi_client.Configuration( @@ -38,7 +40,7 @@ configuration = groundlight_openapi_client.Configuration( # satisfies your auth use case. # Configure API key authorization: ApiToken -configuration.api_key['ApiToken'] = 'YOUR_API_KEY' +configuration.api_key['ApiToken'] = os.environ["API_KEY"] # Uncomment below to setup prefix (e.g. Bearer) for API key, if needed # configuration.api_key_prefix['ApiToken'] = 'Bearer' @@ -46,25 +48,25 @@ configuration.api_key['ApiToken'] = 'YOUR_API_KEY' # Enter a context with an instance of the API client with groundlight_openapi_client.ApiClient(configuration) as api_client: # Create an instance of the API class - api_instance = detector_groups_api.DetectorGroupsApi(api_client) - detector_group_request = DetectorGroupRequest( - name="name_example", - ) # DetectorGroupRequest | + api_instance = groundlight_openapi_client.DetectorGroupsApi(api_client) + detector_group_request = groundlight_openapi_client.DetectorGroupRequest() # DetectorGroupRequest | - # example passing only required values which don't have defaults set try: api_response = api_instance.create_detector_group(detector_group_request) + print("The response of DetectorGroupsApi->create_detector_group:\n") pprint(api_response) - except groundlight_openapi_client.ApiException as e: + except Exception as e: print("Exception when calling DetectorGroupsApi->create_detector_group: %s\n" % e) ``` + ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **detector_group_request** | [**DetectorGroupRequest**](DetectorGroupRequest.md)| | + **detector_group_request** | [**DetectorGroupRequest**](DetectorGroupRequest.md)| | ### Return type @@ -79,7 +81,6 @@ Name | Type | Description | Notes - **Content-Type**: application/json, application/x-www-form-urlencoded, multipart/form-data - **Accept**: application/json - ### HTTP response details | Status code | Description | Response headers | @@ -89,9 +90,7 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **get_detector_groups** -> [DetectorGroup] get_detector_groups() - - +> List[DetectorGroup] get_detector_groups() List all detector groups @@ -100,11 +99,11 @@ List all detector groups * Api Key Authentication (ApiToken): ```python -import time import groundlight_openapi_client -from groundlight_openapi_client.api import detector_groups_api -from groundlight_openapi_client.model.detector_group import DetectorGroup +from groundlight_openapi_client.models.detector_group import DetectorGroup +from groundlight_openapi_client.rest import ApiException from pprint import pprint + # Defining the host is optional and defaults to https://api.groundlight.ai/device-api # See configuration.py for a list of all supported configuration parameters. configuration = groundlight_openapi_client.Configuration( @@ -117,7 +116,7 @@ configuration = groundlight_openapi_client.Configuration( # satisfies your auth use case. # Configure API key authorization: ApiToken -configuration.api_key['ApiToken'] = 'YOUR_API_KEY' +configuration.api_key['ApiToken'] = os.environ["API_KEY"] # Uncomment below to setup prefix (e.g. Bearer) for API key, if needed # configuration.api_key_prefix['ApiToken'] = 'Bearer' @@ -125,23 +124,25 @@ configuration.api_key['ApiToken'] = 'YOUR_API_KEY' # Enter a context with an instance of the API client with groundlight_openapi_client.ApiClient(configuration) as api_client: # Create an instance of the API class - api_instance = detector_groups_api.DetectorGroupsApi(api_client) + api_instance = groundlight_openapi_client.DetectorGroupsApi(api_client) - # example, this endpoint has no required or optional parameters try: api_response = api_instance.get_detector_groups() + print("The response of DetectorGroupsApi->get_detector_groups:\n") pprint(api_response) - except groundlight_openapi_client.ApiException as e: + except Exception as e: print("Exception when calling DetectorGroupsApi->get_detector_groups: %s\n" % e) ``` + ### Parameters + This endpoint does not need any parameter. ### Return type -[**[DetectorGroup]**](DetectorGroup.md) +[**List[DetectorGroup]**](DetectorGroup.md) ### Authorization @@ -152,7 +153,6 @@ This endpoint does not need any parameter. - **Content-Type**: Not defined - **Accept**: application/json - ### HTTP response details | Status code | Description | Response headers | diff --git a/generated/docs/DetectorResetApi.md b/generated/docs/DetectorResetApi.md index 087d781c..b360d81e 100644 --- a/generated/docs/DetectorResetApi.md +++ b/generated/docs/DetectorResetApi.md @@ -10,8 +10,6 @@ Method | HTTP request | Description # **reset_detector** > reset_detector(id) - - Deletes all image queries on the detector ### Example @@ -19,10 +17,10 @@ Deletes all image queries on the detector * Api Key Authentication (ApiToken): ```python -import time import groundlight_openapi_client -from groundlight_openapi_client.api import detector_reset_api +from groundlight_openapi_client.rest import ApiException from pprint import pprint + # Defining the host is optional and defaults to https://api.groundlight.ai/device-api # See configuration.py for a list of all supported configuration parameters. configuration = groundlight_openapi_client.Configuration( @@ -35,7 +33,7 @@ configuration = groundlight_openapi_client.Configuration( # satisfies your auth use case. # Configure API key authorization: ApiToken -configuration.api_key['ApiToken'] = 'YOUR_API_KEY' +configuration.api_key['ApiToken'] = os.environ["API_KEY"] # Uncomment below to setup prefix (e.g. Bearer) for API key, if needed # configuration.api_key_prefix['ApiToken'] = 'Bearer' @@ -43,22 +41,23 @@ configuration.api_key['ApiToken'] = 'YOUR_API_KEY' # Enter a context with an instance of the API client with groundlight_openapi_client.ApiClient(configuration) as api_client: # Create an instance of the API class - api_instance = detector_reset_api.DetectorResetApi(api_client) - id = "id_example" # str | + api_instance = groundlight_openapi_client.DetectorResetApi(api_client) + id = 'id_example' # str | - # example passing only required values which don't have defaults set try: api_instance.reset_detector(id) - except groundlight_openapi_client.ApiException as e: + except Exception as e: print("Exception when calling DetectorResetApi->reset_detector: %s\n" % e) ``` + ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **id** | **str**| | + **id** | **str**| | ### Return type @@ -73,7 +72,6 @@ void (empty response body) - **Content-Type**: Not defined - **Accept**: Not defined - ### HTTP response details | Status code | Description | Response headers | diff --git a/generated/docs/DetectorTypeEnum.md b/generated/docs/DetectorTypeEnum.md index 36a12ea5..4a2480d3 100644 --- a/generated/docs/DetectorTypeEnum.md +++ b/generated/docs/DetectorTypeEnum.md @@ -1,10 +1,9 @@ # DetectorTypeEnum -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**value** | **str** | | defaults to "detector", must be one of ["detector", ] +## Enum + +* `DETECTOR` (value: `'detector'`) [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/generated/docs/DetectorsApi.md b/generated/docs/DetectorsApi.md index 9f5355e5..a62c8a97 100644 --- a/generated/docs/DetectorsApi.md +++ b/generated/docs/DetectorsApi.md @@ -16,8 +16,6 @@ Method | HTTP request | Description # **create_detector** > Detector create_detector(detector_creation_input_request) - - Create a new detector. ### Example @@ -25,12 +23,12 @@ Create a new detector. * Api Key Authentication (ApiToken): ```python -import time import groundlight_openapi_client -from groundlight_openapi_client.api import detectors_api -from groundlight_openapi_client.model.detector_creation_input_request import DetectorCreationInputRequest -from groundlight_openapi_client.model.detector import Detector +from groundlight_openapi_client.models.detector import Detector +from groundlight_openapi_client.models.detector_creation_input_request import DetectorCreationInputRequest +from groundlight_openapi_client.rest import ApiException from pprint import pprint + # Defining the host is optional and defaults to https://api.groundlight.ai/device-api # See configuration.py for a list of all supported configuration parameters. configuration = groundlight_openapi_client.Configuration( @@ -43,7 +41,7 @@ configuration = groundlight_openapi_client.Configuration( # satisfies your auth use case. # Configure API key authorization: ApiToken -configuration.api_key['ApiToken'] = 'YOUR_API_KEY' +configuration.api_key['ApiToken'] = os.environ["API_KEY"] # Uncomment below to setup prefix (e.g. Bearer) for API key, if needed # configuration.api_key_prefix['ApiToken'] = 'Bearer' @@ -51,33 +49,25 @@ configuration.api_key['ApiToken'] = 'YOUR_API_KEY' # Enter a context with an instance of the API client with groundlight_openapi_client.ApiClient(configuration) as api_client: # Create an instance of the API class - api_instance = detectors_api.DetectorsApi(api_client) - detector_creation_input_request = DetectorCreationInputRequest( - name="name_example", - query="query_example", - group_name="group_name_example", - confidence_threshold=0.9, - patience_time=30.0, - pipeline_config="pipeline_config_example", - metadata="metadata_example", - mode=None, - mode_configuration=None, - ) # DetectorCreationInputRequest | - - # example passing only required values which don't have defaults set + api_instance = groundlight_openapi_client.DetectorsApi(api_client) + detector_creation_input_request = groundlight_openapi_client.DetectorCreationInputRequest() # DetectorCreationInputRequest | + try: api_response = api_instance.create_detector(detector_creation_input_request) + print("The response of DetectorsApi->create_detector:\n") pprint(api_response) - except groundlight_openapi_client.ApiException as e: + except Exception as e: print("Exception when calling DetectorsApi->create_detector: %s\n" % e) ``` + ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **detector_creation_input_request** | [**DetectorCreationInputRequest**](DetectorCreationInputRequest.md)| | + **detector_creation_input_request** | [**DetectorCreationInputRequest**](DetectorCreationInputRequest.md)| | ### Return type @@ -92,7 +82,6 @@ Name | Type | Description | Notes - **Content-Type**: application/json - **Accept**: application/json - ### HTTP response details | Status code | Description | Response headers | @@ -104,8 +93,6 @@ Name | Type | Description | Notes # **delete_detector** > delete_detector(id) - - Delete a detector by its ID. ### Example @@ -113,10 +100,10 @@ Delete a detector by its ID. * Api Key Authentication (ApiToken): ```python -import time import groundlight_openapi_client -from groundlight_openapi_client.api import detectors_api +from groundlight_openapi_client.rest import ApiException from pprint import pprint + # Defining the host is optional and defaults to https://api.groundlight.ai/device-api # See configuration.py for a list of all supported configuration parameters. configuration = groundlight_openapi_client.Configuration( @@ -129,7 +116,7 @@ configuration = groundlight_openapi_client.Configuration( # satisfies your auth use case. # Configure API key authorization: ApiToken -configuration.api_key['ApiToken'] = 'YOUR_API_KEY' +configuration.api_key['ApiToken'] = os.environ["API_KEY"] # Uncomment below to setup prefix (e.g. Bearer) for API key, if needed # configuration.api_key_prefix['ApiToken'] = 'Bearer' @@ -137,22 +124,23 @@ configuration.api_key['ApiToken'] = 'YOUR_API_KEY' # Enter a context with an instance of the API client with groundlight_openapi_client.ApiClient(configuration) as api_client: # Create an instance of the API class - api_instance = detectors_api.DetectorsApi(api_client) - id = "id_example" # str | Choose a detector by its ID. + api_instance = groundlight_openapi_client.DetectorsApi(api_client) + id = 'id_example' # str | Choose a detector by its ID. - # example passing only required values which don't have defaults set try: api_instance.delete_detector(id) - except groundlight_openapi_client.ApiException as e: + except Exception as e: print("Exception when calling DetectorsApi->delete_detector: %s\n" % e) ``` + ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **id** | **str**| Choose a detector by its ID. | + **id** | **str**| Choose a detector by its ID. | ### Return type @@ -167,7 +155,6 @@ void (empty response body) - **Content-Type**: Not defined - **Accept**: Not defined - ### HTTP response details | Status code | Description | Response headers | @@ -179,8 +166,6 @@ void (empty response body) # **get_detector** > Detector get_detector(id) - - Retrieve a detector by its ID. ### Example @@ -188,11 +173,11 @@ Retrieve a detector by its ID. * Api Key Authentication (ApiToken): ```python -import time import groundlight_openapi_client -from groundlight_openapi_client.api import detectors_api -from groundlight_openapi_client.model.detector import Detector +from groundlight_openapi_client.models.detector import Detector +from groundlight_openapi_client.rest import ApiException from pprint import pprint + # Defining the host is optional and defaults to https://api.groundlight.ai/device-api # See configuration.py for a list of all supported configuration parameters. configuration = groundlight_openapi_client.Configuration( @@ -205,7 +190,7 @@ configuration = groundlight_openapi_client.Configuration( # satisfies your auth use case. # Configure API key authorization: ApiToken -configuration.api_key['ApiToken'] = 'YOUR_API_KEY' +configuration.api_key['ApiToken'] = os.environ["API_KEY"] # Uncomment below to setup prefix (e.g. Bearer) for API key, if needed # configuration.api_key_prefix['ApiToken'] = 'Bearer' @@ -213,23 +198,25 @@ configuration.api_key['ApiToken'] = 'YOUR_API_KEY' # Enter a context with an instance of the API client with groundlight_openapi_client.ApiClient(configuration) as api_client: # Create an instance of the API class - api_instance = detectors_api.DetectorsApi(api_client) - id = "id_example" # str | Choose a detector by its ID. + api_instance = groundlight_openapi_client.DetectorsApi(api_client) + id = 'id_example' # str | Choose a detector by its ID. - # example passing only required values which don't have defaults set try: api_response = api_instance.get_detector(id) + print("The response of DetectorsApi->get_detector:\n") pprint(api_response) - except groundlight_openapi_client.ApiException as e: + except Exception as e: print("Exception when calling DetectorsApi->get_detector: %s\n" % e) ``` + ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **id** | **str**| Choose a detector by its ID. | + **id** | **str**| Choose a detector by its ID. | ### Return type @@ -244,7 +231,6 @@ Name | Type | Description | Notes - **Content-Type**: Not defined - **Accept**: application/json - ### HTTP response details | Status code | Description | Response headers | @@ -254,9 +240,7 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **get_detector_evaluation** -> InlineResponse2001 get_detector_evaluation(id) - - +> GetDetectorEvaluation200Response get_detector_evaluation(id) Get Detector evaluation results. The result is null if there isn't enough ground truth data to evaluate the detector. Returns the time of the evaulation, total ground truth labels, the ml based kfold accuracies, and the system accuracies at different confidence thresholds @@ -265,11 +249,11 @@ Get Detector evaluation results. The result is null if there isn't enough ground * Api Key Authentication (ApiToken): ```python -import time import groundlight_openapi_client -from groundlight_openapi_client.api import detectors_api -from groundlight_openapi_client.model.inline_response2001 import InlineResponse2001 +from groundlight_openapi_client.models.get_detector_evaluation200_response import GetDetectorEvaluation200Response +from groundlight_openapi_client.rest import ApiException from pprint import pprint + # Defining the host is optional and defaults to https://api.groundlight.ai/device-api # See configuration.py for a list of all supported configuration parameters. configuration = groundlight_openapi_client.Configuration( @@ -282,7 +266,7 @@ configuration = groundlight_openapi_client.Configuration( # satisfies your auth use case. # Configure API key authorization: ApiToken -configuration.api_key['ApiToken'] = 'YOUR_API_KEY' +configuration.api_key['ApiToken'] = os.environ["API_KEY"] # Uncomment below to setup prefix (e.g. Bearer) for API key, if needed # configuration.api_key_prefix['ApiToken'] = 'Bearer' @@ -290,27 +274,29 @@ configuration.api_key['ApiToken'] = 'YOUR_API_KEY' # Enter a context with an instance of the API client with groundlight_openapi_client.ApiClient(configuration) as api_client: # Create an instance of the API class - api_instance = detectors_api.DetectorsApi(api_client) - id = "id_example" # str | + api_instance = groundlight_openapi_client.DetectorsApi(api_client) + id = 'id_example' # str | - # example passing only required values which don't have defaults set try: api_response = api_instance.get_detector_evaluation(id) + print("The response of DetectorsApi->get_detector_evaluation:\n") pprint(api_response) - except groundlight_openapi_client.ApiException as e: + except Exception as e: print("Exception when calling DetectorsApi->get_detector_evaluation: %s\n" % e) ``` + ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **id** | **str**| | + **id** | **str**| | ### Return type -[**InlineResponse2001**](InlineResponse2001.md) +[**GetDetectorEvaluation200Response**](GetDetectorEvaluation200Response.md) ### Authorization @@ -321,7 +307,6 @@ Name | Type | Description | Notes - **Content-Type**: Not defined - **Accept**: application/json - ### HTTP response details | Status code | Description | Response headers | @@ -331,9 +316,7 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **get_detector_metrics** -> InlineResponse200 get_detector_metrics(detector_id) - - +> GetDetectorMetrics200Response get_detector_metrics(detector_id) Get Detector metrics, primarily the counts of different types of labels @@ -342,11 +325,11 @@ Get Detector metrics, primarily the counts of different types of labels * Api Key Authentication (ApiToken): ```python -import time import groundlight_openapi_client -from groundlight_openapi_client.api import detectors_api -from groundlight_openapi_client.model.inline_response200 import InlineResponse200 +from groundlight_openapi_client.models.get_detector_metrics200_response import GetDetectorMetrics200Response +from groundlight_openapi_client.rest import ApiException from pprint import pprint + # Defining the host is optional and defaults to https://api.groundlight.ai/device-api # See configuration.py for a list of all supported configuration parameters. configuration = groundlight_openapi_client.Configuration( @@ -359,7 +342,7 @@ configuration = groundlight_openapi_client.Configuration( # satisfies your auth use case. # Configure API key authorization: ApiToken -configuration.api_key['ApiToken'] = 'YOUR_API_KEY' +configuration.api_key['ApiToken'] = os.environ["API_KEY"] # Uncomment below to setup prefix (e.g. Bearer) for API key, if needed # configuration.api_key_prefix['ApiToken'] = 'Bearer' @@ -367,27 +350,29 @@ configuration.api_key['ApiToken'] = 'YOUR_API_KEY' # Enter a context with an instance of the API client with groundlight_openapi_client.ApiClient(configuration) as api_client: # Create an instance of the API class - api_instance = detectors_api.DetectorsApi(api_client) - detector_id = "detector_id_example" # str | + api_instance = groundlight_openapi_client.DetectorsApi(api_client) + detector_id = 'detector_id_example' # str | - # example passing only required values which don't have defaults set try: api_response = api_instance.get_detector_metrics(detector_id) + print("The response of DetectorsApi->get_detector_metrics:\n") pprint(api_response) - except groundlight_openapi_client.ApiException as e: + except Exception as e: print("Exception when calling DetectorsApi->get_detector_metrics: %s\n" % e) ``` + ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **detector_id** | **str**| | + **detector_id** | **str**| | ### Return type -[**InlineResponse200**](InlineResponse200.md) +[**GetDetectorMetrics200Response**](GetDetectorMetrics200Response.md) ### Authorization @@ -398,7 +383,6 @@ Name | Type | Description | Notes - **Content-Type**: Not defined - **Accept**: application/json - ### HTTP response details | Status code | Description | Response headers | @@ -408,9 +392,7 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **list_detectors** -> PaginatedDetectorList list_detectors() - - +> PaginatedDetectorList list_detectors(page=page, page_size=page_size) Retrieve a list of detectors. @@ -419,11 +401,11 @@ Retrieve a list of detectors. * Api Key Authentication (ApiToken): ```python -import time import groundlight_openapi_client -from groundlight_openapi_client.api import detectors_api -from groundlight_openapi_client.model.paginated_detector_list import PaginatedDetectorList +from groundlight_openapi_client.models.paginated_detector_list import PaginatedDetectorList +from groundlight_openapi_client.rest import ApiException from pprint import pprint + # Defining the host is optional and defaults to https://api.groundlight.ai/device-api # See configuration.py for a list of all supported configuration parameters. configuration = groundlight_openapi_client.Configuration( @@ -436,7 +418,7 @@ configuration = groundlight_openapi_client.Configuration( # satisfies your auth use case. # Configure API key authorization: ApiToken -configuration.api_key['ApiToken'] = 'YOUR_API_KEY' +configuration.api_key['ApiToken'] = os.environ["API_KEY"] # Uncomment below to setup prefix (e.g. Bearer) for API key, if needed # configuration.api_key_prefix['ApiToken'] = 'Bearer' @@ -444,26 +426,27 @@ configuration.api_key['ApiToken'] = 'YOUR_API_KEY' # Enter a context with an instance of the API client with groundlight_openapi_client.ApiClient(configuration) as api_client: # Create an instance of the API class - api_instance = detectors_api.DetectorsApi(api_client) - page = 1 # int | A page number within the paginated result set. (optional) - page_size = 1 # int | Number of items to return per page. (optional) + api_instance = groundlight_openapi_client.DetectorsApi(api_client) + page = 56 # int | A page number within the paginated result set. (optional) + page_size = 56 # int | Number of items to return per page. (optional) - # example passing only required values which don't have defaults set - # and optional values try: api_response = api_instance.list_detectors(page=page, page_size=page_size) + print("The response of DetectorsApi->list_detectors:\n") pprint(api_response) - except groundlight_openapi_client.ApiException as e: + except Exception as e: print("Exception when calling DetectorsApi->list_detectors: %s\n" % e) ``` + ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **page** | **int**| A page number within the paginated result set. | [optional] - **page_size** | **int**| Number of items to return per page. | [optional] + **page** | **int**| A page number within the paginated result set. | [optional] + **page_size** | **int**| Number of items to return per page. | [optional] ### Return type @@ -478,7 +461,6 @@ Name | Type | Description | Notes - **Content-Type**: Not defined - **Accept**: application/json - ### HTTP response details | Status code | Description | Response headers | @@ -488,9 +470,7 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **update_detector** -> Detector update_detector(id) - - +> Detector update_detector(id, patched_detector_request=patched_detector_request) Update a detector @@ -499,12 +479,12 @@ Update a detector * Api Key Authentication (ApiToken): ```python -import time import groundlight_openapi_client -from groundlight_openapi_client.api import detectors_api -from groundlight_openapi_client.model.detector import Detector -from groundlight_openapi_client.model.patched_detector_request import PatchedDetectorRequest +from groundlight_openapi_client.models.detector import Detector +from groundlight_openapi_client.models.patched_detector_request import PatchedDetectorRequest +from groundlight_openapi_client.rest import ApiException from pprint import pprint + # Defining the host is optional and defaults to https://api.groundlight.ai/device-api # See configuration.py for a list of all supported configuration parameters. configuration = groundlight_openapi_client.Configuration( @@ -517,7 +497,7 @@ configuration = groundlight_openapi_client.Configuration( # satisfies your auth use case. # Configure API key authorization: ApiToken -configuration.api_key['ApiToken'] = 'YOUR_API_KEY' +configuration.api_key['ApiToken'] = os.environ["API_KEY"] # Uncomment below to setup prefix (e.g. Bearer) for API key, if needed # configuration.api_key_prefix['ApiToken'] = 'Bearer' @@ -525,39 +505,27 @@ configuration.api_key['ApiToken'] = 'YOUR_API_KEY' # Enter a context with an instance of the API client with groundlight_openapi_client.ApiClient(configuration) as api_client: # Create an instance of the API class - api_instance = detectors_api.DetectorsApi(api_client) - id = "id_example" # str | - patched_detector_request = PatchedDetectorRequest( - name="name_example", - confidence_threshold=0.9, - patience_time=30.0, - status=None, - escalation_type="escalation_type_example", - ) # PatchedDetectorRequest | (optional) - - # example passing only required values which don't have defaults set - try: - api_response = api_instance.update_detector(id) - pprint(api_response) - except groundlight_openapi_client.ApiException as e: - print("Exception when calling DetectorsApi->update_detector: %s\n" % e) + api_instance = groundlight_openapi_client.DetectorsApi(api_client) + id = 'id_example' # str | + patched_detector_request = groundlight_openapi_client.PatchedDetectorRequest() # PatchedDetectorRequest | (optional) - # example passing only required values which don't have defaults set - # and optional values try: api_response = api_instance.update_detector(id, patched_detector_request=patched_detector_request) + print("The response of DetectorsApi->update_detector:\n") pprint(api_response) - except groundlight_openapi_client.ApiException as e: + except Exception as e: print("Exception when calling DetectorsApi->update_detector: %s\n" % e) ``` + ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **id** | **str**| | - **patched_detector_request** | [**PatchedDetectorRequest**](PatchedDetectorRequest.md)| | [optional] + **id** | **str**| | + **patched_detector_request** | [**PatchedDetectorRequest**](PatchedDetectorRequest.md)| | [optional] ### Return type @@ -572,7 +540,6 @@ Name | Type | Description | Notes - **Content-Type**: application/json, application/x-www-form-urlencoded, multipart/form-data - **Accept**: application/json - ### HTTP response details | Status code | Description | Response headers | diff --git a/generated/docs/EdgeApi.md b/generated/docs/EdgeApi.md index 04976261..68cae5c7 100644 --- a/generated/docs/EdgeApi.md +++ b/generated/docs/EdgeApi.md @@ -11,19 +11,19 @@ Method | HTTP request | Description # **edge_report_metrics_create** > edge_report_metrics_create() +Edge server periodically calls this to report metrics. - -Edge server periodically calls this to report metrics. POST body will have JSON data that we log. +POST body will have JSON data that we log. ### Example * Api Key Authentication (ApiToken): ```python -import time import groundlight_openapi_client -from groundlight_openapi_client.api import edge_api +from groundlight_openapi_client.rest import ApiException from pprint import pprint + # Defining the host is optional and defaults to https://api.groundlight.ai/device-api # See configuration.py for a list of all supported configuration parameters. configuration = groundlight_openapi_client.Configuration( @@ -36,7 +36,7 @@ configuration = groundlight_openapi_client.Configuration( # satisfies your auth use case. # Configure API key authorization: ApiToken -configuration.api_key['ApiToken'] = 'YOUR_API_KEY' +configuration.api_key['ApiToken'] = os.environ["API_KEY"] # Uncomment below to setup prefix (e.g. Bearer) for API key, if needed # configuration.api_key_prefix['ApiToken'] = 'Bearer' @@ -44,17 +44,18 @@ configuration.api_key['ApiToken'] = 'YOUR_API_KEY' # Enter a context with an instance of the API client with groundlight_openapi_client.ApiClient(configuration) as api_client: # Create an instance of the API class - api_instance = edge_api.EdgeApi(api_client) + api_instance = groundlight_openapi_client.EdgeApi(api_client) - # example, this endpoint has no required or optional parameters try: api_instance.edge_report_metrics_create() - except groundlight_openapi_client.ApiException as e: + except Exception as e: print("Exception when calling EdgeApi->edge_report_metrics_create: %s\n" % e) ``` + ### Parameters + This endpoint does not need any parameter. ### Return type @@ -70,7 +71,6 @@ void (empty response body) - **Content-Type**: Not defined - **Accept**: Not defined - ### HTTP response details | Status code | Description | Response headers | @@ -82,8 +82,6 @@ void (empty response body) # **get_model_urls** > EdgeModelInfo get_model_urls(detector_id) - - Gets time limited pre-authenticated URLs to download a detector's edge model and oodd model. ### Example @@ -91,11 +89,11 @@ Gets time limited pre-authenticated URLs to download a detector's edge model and * Api Key Authentication (ApiToken): ```python -import time import groundlight_openapi_client -from groundlight_openapi_client.api import edge_api -from groundlight_openapi_client.model.edge_model_info import EdgeModelInfo +from groundlight_openapi_client.models.edge_model_info import EdgeModelInfo +from groundlight_openapi_client.rest import ApiException from pprint import pprint + # Defining the host is optional and defaults to https://api.groundlight.ai/device-api # See configuration.py for a list of all supported configuration parameters. configuration = groundlight_openapi_client.Configuration( @@ -108,7 +106,7 @@ configuration = groundlight_openapi_client.Configuration( # satisfies your auth use case. # Configure API key authorization: ApiToken -configuration.api_key['ApiToken'] = 'YOUR_API_KEY' +configuration.api_key['ApiToken'] = os.environ["API_KEY"] # Uncomment below to setup prefix (e.g. Bearer) for API key, if needed # configuration.api_key_prefix['ApiToken'] = 'Bearer' @@ -116,23 +114,25 @@ configuration.api_key['ApiToken'] = 'YOUR_API_KEY' # Enter a context with an instance of the API client with groundlight_openapi_client.ApiClient(configuration) as api_client: # Create an instance of the API class - api_instance = edge_api.EdgeApi(api_client) - detector_id = "detector_id_example" # str | + api_instance = groundlight_openapi_client.EdgeApi(api_client) + detector_id = 'detector_id_example' # str | - # example passing only required values which don't have defaults set try: api_response = api_instance.get_model_urls(detector_id) + print("The response of EdgeApi->get_model_urls:\n") pprint(api_response) - except groundlight_openapi_client.ApiException as e: + except Exception as e: print("Exception when calling EdgeApi->get_model_urls: %s\n" % e) ``` + ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **detector_id** | **str**| | + **detector_id** | **str**| | ### Return type @@ -147,7 +147,6 @@ Name | Type | Description | Notes - **Content-Type**: Not defined - **Accept**: application/json - ### HTTP response details | Status code | Description | Response headers | diff --git a/generated/docs/EdgeModelInfo.md b/generated/docs/EdgeModelInfo.md index 3141373f..f6480350 100644 --- a/generated/docs/EdgeModelInfo.md +++ b/generated/docs/EdgeModelInfo.md @@ -3,17 +3,34 @@ Information for the model running on edge, including temporary presigned urls to the model binaries ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **model_binary_id** | **str** | | [optional] **model_binary_url** | **str** | | [optional] **oodd_model_binary_id** | **str** | | [optional] **oodd_model_binary_url** | **str** | | [optional] -**pipeline_config** | **bool, date, datetime, dict, float, int, list, str, none_type** | | [optional] -**oodd_pipeline_config** | **bool, date, datetime, dict, float, int, list, str, none_type** | | [optional] -**predictor_metadata** | **bool, date, datetime, dict, float, int, list, str, none_type** | | [optional] -**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional] +**pipeline_config** | **object** | | [optional] +**oodd_pipeline_config** | **object** | | [optional] +**predictor_metadata** | **object** | | [optional] + +## Example + +```python +from groundlight_openapi_client.models.edge_model_info import EdgeModelInfo + +# TODO update the JSON string below +json = "{}" +# create an instance of EdgeModelInfo from a JSON string +edge_model_info_instance = EdgeModelInfo.from_json(json) +# print the JSON string representation of the object +print(EdgeModelInfo.to_json()) +# convert the object into a dict +edge_model_info_dict = edge_model_info_instance.to_dict() +# create an instance of EdgeModelInfo from a dict +edge_model_info_from_dict = EdgeModelInfo.from_dict(edge_model_info_dict) +``` [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/generated/docs/EscalationTypeEnum.md b/generated/docs/EscalationTypeEnum.md index d7842681..3a3ce20a 100644 --- a/generated/docs/EscalationTypeEnum.md +++ b/generated/docs/EscalationTypeEnum.md @@ -1,10 +1,11 @@ # EscalationTypeEnum -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**value** | **str** | | must be one of ["STANDARD", "NO_HUMAN_LABELING", ] +## Enum + +* `STANDARD` (value: `'STANDARD'`) + +* `NO_HUMAN_LABELING` (value: `'NO_HUMAN_LABELING'`) [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/generated/docs/GetDetectorEvaluation200Response.md b/generated/docs/GetDetectorEvaluation200Response.md new file mode 100644 index 00000000..1bb5e631 --- /dev/null +++ b/generated/docs/GetDetectorEvaluation200Response.md @@ -0,0 +1,29 @@ +# GetDetectorEvaluation200Response + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**evaluation_results** | [**GetDetectorEvaluation200ResponseEvaluationResults**](GetDetectorEvaluation200ResponseEvaluationResults.md) | | [optional] + +## Example + +```python +from groundlight_openapi_client.models.get_detector_evaluation200_response import GetDetectorEvaluation200Response + +# TODO update the JSON string below +json = "{}" +# create an instance of GetDetectorEvaluation200Response from a JSON string +get_detector_evaluation200_response_instance = GetDetectorEvaluation200Response.from_json(json) +# print the JSON string representation of the object +print(GetDetectorEvaluation200Response.to_json()) + +# convert the object into a dict +get_detector_evaluation200_response_dict = get_detector_evaluation200_response_instance.to_dict() +# create an instance of GetDetectorEvaluation200Response from a dict +get_detector_evaluation200_response_from_dict = GetDetectorEvaluation200Response.from_dict(get_detector_evaluation200_response_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/generated/docs/GetDetectorEvaluation200ResponseEvaluationResults.md b/generated/docs/GetDetectorEvaluation200ResponseEvaluationResults.md new file mode 100644 index 00000000..ef8e44fa --- /dev/null +++ b/generated/docs/GetDetectorEvaluation200ResponseEvaluationResults.md @@ -0,0 +1,47 @@ +# GetDetectorEvaluation200ResponseEvaluationResults + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**eval_timestamp** | **datetime** | | [optional] +**total_ground_truth_examples** | **int** | | [optional] +**total_labeled_examples** | **int** | | [optional] +**kfold_pooled__balanced_accuracy** | **float** | | [optional] +**kfold_pooled__positive_accuracy** | **float** | | [optional] +**kfold_pooled__negative_accuracy** | **float** | | [optional] +**precision__mean** | **float** | | [optional] +**recall__mean** | **float** | | [optional] +**roc_auc__mean** | **float** | | [optional] +**balanced_system_accuracies** | **Dict[str, object]** | | [optional] +**positive_system_accuracies** | **Dict[str, object]** | | [optional] +**negative_system_accuracies** | **Dict[str, object]** | | [optional] +**mean_absolute_error__mean** | **float** | | [optional] +**objdet_precision__mean** | **float** | | [optional] +**objdet_recall__mean** | **float** | | [optional] +**objdet_f1_score__mean** | **float** | | [optional] +**class_accuracies** | **Dict[str, object]** | | [optional] +**confusion_dict** | **Dict[str, object]** | | [optional] +**num_examples_per_class** | **Dict[str, object]** | | [optional] + +## Example + +```python +from groundlight_openapi_client.models.get_detector_evaluation200_response_evaluation_results import GetDetectorEvaluation200ResponseEvaluationResults + +# TODO update the JSON string below +json = "{}" +# create an instance of GetDetectorEvaluation200ResponseEvaluationResults from a JSON string +get_detector_evaluation200_response_evaluation_results_instance = GetDetectorEvaluation200ResponseEvaluationResults.from_json(json) +# print the JSON string representation of the object +print(GetDetectorEvaluation200ResponseEvaluationResults.to_json()) + +# convert the object into a dict +get_detector_evaluation200_response_evaluation_results_dict = get_detector_evaluation200_response_evaluation_results_instance.to_dict() +# create an instance of GetDetectorEvaluation200ResponseEvaluationResults from a dict +get_detector_evaluation200_response_evaluation_results_from_dict = GetDetectorEvaluation200ResponseEvaluationResults.from_dict(get_detector_evaluation200_response_evaluation_results_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/generated/docs/GetDetectorMetrics200Response.md b/generated/docs/GetDetectorMetrics200Response.md new file mode 100644 index 00000000..ba06f53d --- /dev/null +++ b/generated/docs/GetDetectorMetrics200Response.md @@ -0,0 +1,29 @@ +# GetDetectorMetrics200Response + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**summary** | [**GetDetectorMetrics200ResponseSummary**](GetDetectorMetrics200ResponseSummary.md) | | [optional] + +## Example + +```python +from groundlight_openapi_client.models.get_detector_metrics200_response import GetDetectorMetrics200Response + +# TODO update the JSON string below +json = "{}" +# create an instance of GetDetectorMetrics200Response from a JSON string +get_detector_metrics200_response_instance = GetDetectorMetrics200Response.from_json(json) +# print the JSON string representation of the object +print(GetDetectorMetrics200Response.to_json()) + +# convert the object into a dict +get_detector_metrics200_response_dict = get_detector_metrics200_response_instance.to_dict() +# create an instance of GetDetectorMetrics200Response from a dict +get_detector_metrics200_response_from_dict = GetDetectorMetrics200Response.from_dict(get_detector_metrics200_response_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/generated/docs/GetDetectorMetrics200ResponseSummary.md b/generated/docs/GetDetectorMetrics200ResponseSummary.md new file mode 100644 index 00000000..fad8551b --- /dev/null +++ b/generated/docs/GetDetectorMetrics200ResponseSummary.md @@ -0,0 +1,33 @@ +# GetDetectorMetrics200ResponseSummary + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**num_ground_truth** | **int** | | [optional] +**num_current_source_human** | **int** | | [optional] +**class_counts** | [**GetDetectorMetrics200ResponseSummaryClassCounts**](GetDetectorMetrics200ResponseSummaryClassCounts.md) | | [optional] +**unconfident_counts** | **object** | | [optional] +**total_iqs** | **int** | | [optional] + +## Example + +```python +from groundlight_openapi_client.models.get_detector_metrics200_response_summary import GetDetectorMetrics200ResponseSummary + +# TODO update the JSON string below +json = "{}" +# create an instance of GetDetectorMetrics200ResponseSummary from a JSON string +get_detector_metrics200_response_summary_instance = GetDetectorMetrics200ResponseSummary.from_json(json) +# print the JSON string representation of the object +print(GetDetectorMetrics200ResponseSummary.to_json()) + +# convert the object into a dict +get_detector_metrics200_response_summary_dict = get_detector_metrics200_response_summary_instance.to_dict() +# create an instance of GetDetectorMetrics200ResponseSummary from a dict +get_detector_metrics200_response_summary_from_dict = GetDetectorMetrics200ResponseSummary.from_dict(get_detector_metrics200_response_summary_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/generated/docs/GetDetectorMetrics200ResponseSummaryClassCounts.md b/generated/docs/GetDetectorMetrics200ResponseSummaryClassCounts.md new file mode 100644 index 00000000..ef4ac10d --- /dev/null +++ b/generated/docs/GetDetectorMetrics200ResponseSummaryClassCounts.md @@ -0,0 +1,33 @@ +# GetDetectorMetrics200ResponseSummaryClassCounts + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**source_ml** | **object** | | [optional] +**source_human** | **object** | | [optional] +**cloud_labeler** | **object** | | [optional] +**cloud** | **object** | | [optional] +**total** | **object** | | [optional] + +## Example + +```python +from groundlight_openapi_client.models.get_detector_metrics200_response_summary_class_counts import GetDetectorMetrics200ResponseSummaryClassCounts + +# TODO update the JSON string below +json = "{}" +# create an instance of GetDetectorMetrics200ResponseSummaryClassCounts from a JSON string +get_detector_metrics200_response_summary_class_counts_instance = GetDetectorMetrics200ResponseSummaryClassCounts.from_json(json) +# print the JSON string representation of the object +print(GetDetectorMetrics200ResponseSummaryClassCounts.to_json()) + +# convert the object into a dict +get_detector_metrics200_response_summary_class_counts_dict = get_detector_metrics200_response_summary_class_counts_instance.to_dict() +# create an instance of GetDetectorMetrics200ResponseSummaryClassCounts from a dict +get_detector_metrics200_response_summary_class_counts_from_dict = GetDetectorMetrics200ResponseSummaryClassCounts.from_dict(get_detector_metrics200_response_summary_class_counts_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/generated/docs/ImageQueriesApi.md b/generated/docs/ImageQueriesApi.md index e3f91416..3430d287 100644 --- a/generated/docs/ImageQueriesApi.md +++ b/generated/docs/ImageQueriesApi.md @@ -11,9 +11,7 @@ Method | HTTP request | Description # **get_image** -> file_type get_image(id) - - +> bytearray get_image(id) Retrieve an image by its ID. @@ -22,10 +20,10 @@ Retrieve an image by its ID. * Api Key Authentication (ApiToken): ```python -import time import groundlight_openapi_client -from groundlight_openapi_client.api import image_queries_api +from groundlight_openapi_client.rest import ApiException from pprint import pprint + # Defining the host is optional and defaults to https://api.groundlight.ai/device-api # See configuration.py for a list of all supported configuration parameters. configuration = groundlight_openapi_client.Configuration( @@ -38,7 +36,7 @@ configuration = groundlight_openapi_client.Configuration( # satisfies your auth use case. # Configure API key authorization: ApiToken -configuration.api_key['ApiToken'] = 'YOUR_API_KEY' +configuration.api_key['ApiToken'] = os.environ["API_KEY"] # Uncomment below to setup prefix (e.g. Bearer) for API key, if needed # configuration.api_key_prefix['ApiToken'] = 'Bearer' @@ -46,27 +44,29 @@ configuration.api_key['ApiToken'] = 'YOUR_API_KEY' # Enter a context with an instance of the API client with groundlight_openapi_client.ApiClient(configuration) as api_client: # Create an instance of the API class - api_instance = image_queries_api.ImageQueriesApi(api_client) - id = "id_example" # str | Retrieve the image associated with the image query ID. + api_instance = groundlight_openapi_client.ImageQueriesApi(api_client) + id = 'id_example' # str | Retrieve the image associated with the image query ID. - # example passing only required values which don't have defaults set try: api_response = api_instance.get_image(id) + print("The response of ImageQueriesApi->get_image:\n") pprint(api_response) - except groundlight_openapi_client.ApiException as e: + except Exception as e: print("Exception when calling ImageQueriesApi->get_image: %s\n" % e) ``` + ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **id** | **str**| Retrieve the image associated with the image query ID. | + **id** | **str**| Retrieve the image associated with the image query ID. | ### Return type -**file_type** +**bytearray** ### Authorization @@ -77,7 +77,6 @@ Name | Type | Description | Notes - **Content-Type**: Not defined - **Accept**: image/jpeg - ### HTTP response details | Status code | Description | Response headers | @@ -89,8 +88,6 @@ Name | Type | Description | Notes # **get_image_query** > ImageQuery get_image_query(id) - - Retrieve an image-query by its ID. ### Example @@ -98,11 +95,11 @@ Retrieve an image-query by its ID. * Api Key Authentication (ApiToken): ```python -import time import groundlight_openapi_client -from groundlight_openapi_client.api import image_queries_api -from groundlight_openapi_client.model.image_query import ImageQuery +from groundlight_openapi_client.models.image_query import ImageQuery +from groundlight_openapi_client.rest import ApiException from pprint import pprint + # Defining the host is optional and defaults to https://api.groundlight.ai/device-api # See configuration.py for a list of all supported configuration parameters. configuration = groundlight_openapi_client.Configuration( @@ -115,7 +112,7 @@ configuration = groundlight_openapi_client.Configuration( # satisfies your auth use case. # Configure API key authorization: ApiToken -configuration.api_key['ApiToken'] = 'YOUR_API_KEY' +configuration.api_key['ApiToken'] = os.environ["API_KEY"] # Uncomment below to setup prefix (e.g. Bearer) for API key, if needed # configuration.api_key_prefix['ApiToken'] = 'Bearer' @@ -123,23 +120,25 @@ configuration.api_key['ApiToken'] = 'YOUR_API_KEY' # Enter a context with an instance of the API client with groundlight_openapi_client.ApiClient(configuration) as api_client: # Create an instance of the API class - api_instance = image_queries_api.ImageQueriesApi(api_client) - id = "id_example" # str | Choose an image query by its ID. + api_instance = groundlight_openapi_client.ImageQueriesApi(api_client) + id = 'id_example' # str | Choose an image query by its ID. - # example passing only required values which don't have defaults set try: api_response = api_instance.get_image_query(id) + print("The response of ImageQueriesApi->get_image_query:\n") pprint(api_response) - except groundlight_openapi_client.ApiException as e: + except Exception as e: print("Exception when calling ImageQueriesApi->get_image_query: %s\n" % e) ``` + ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **id** | **str**| Choose an image query by its ID. | + **id** | **str**| Choose an image query by its ID. | ### Return type @@ -154,7 +153,6 @@ Name | Type | Description | Notes - **Content-Type**: Not defined - **Accept**: application/json - ### HTTP response details | Status code | Description | Response headers | @@ -164,9 +162,7 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **list_image_queries** -> PaginatedImageQueryList list_image_queries() - - +> PaginatedImageQueryList list_image_queries(detector_id=detector_id, page=page, page_size=page_size) Retrieve a list of image-queries. @@ -175,11 +171,11 @@ Retrieve a list of image-queries. * Api Key Authentication (ApiToken): ```python -import time import groundlight_openapi_client -from groundlight_openapi_client.api import image_queries_api -from groundlight_openapi_client.model.paginated_image_query_list import PaginatedImageQueryList +from groundlight_openapi_client.models.paginated_image_query_list import PaginatedImageQueryList +from groundlight_openapi_client.rest import ApiException from pprint import pprint + # Defining the host is optional and defaults to https://api.groundlight.ai/device-api # See configuration.py for a list of all supported configuration parameters. configuration = groundlight_openapi_client.Configuration( @@ -192,7 +188,7 @@ configuration = groundlight_openapi_client.Configuration( # satisfies your auth use case. # Configure API key authorization: ApiToken -configuration.api_key['ApiToken'] = 'YOUR_API_KEY' +configuration.api_key['ApiToken'] = os.environ["API_KEY"] # Uncomment below to setup prefix (e.g. Bearer) for API key, if needed # configuration.api_key_prefix['ApiToken'] = 'Bearer' @@ -200,28 +196,29 @@ configuration.api_key['ApiToken'] = 'YOUR_API_KEY' # Enter a context with an instance of the API client with groundlight_openapi_client.ApiClient(configuration) as api_client: # Create an instance of the API class - api_instance = image_queries_api.ImageQueriesApi(api_client) - detector_id = "detector_id_example" # str | Optionally filter image queries by detector ID. (optional) - page = 1 # int | A page number within the paginated result set. (optional) - page_size = 1 # int | Number of items to return per page. (optional) + api_instance = groundlight_openapi_client.ImageQueriesApi(api_client) + detector_id = 'detector_id_example' # str | Optionally filter image queries by detector ID. (optional) + page = 56 # int | A page number within the paginated result set. (optional) + page_size = 56 # int | Number of items to return per page. (optional) - # example passing only required values which don't have defaults set - # and optional values try: api_response = api_instance.list_image_queries(detector_id=detector_id, page=page, page_size=page_size) + print("The response of ImageQueriesApi->list_image_queries:\n") pprint(api_response) - except groundlight_openapi_client.ApiException as e: + except Exception as e: print("Exception when calling ImageQueriesApi->list_image_queries: %s\n" % e) ``` + ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **detector_id** | **str**| Optionally filter image queries by detector ID. | [optional] - **page** | **int**| A page number within the paginated result set. | [optional] - **page_size** | **int**| Number of items to return per page. | [optional] + **detector_id** | **str**| Optionally filter image queries by detector ID. | [optional] + **page** | **int**| A page number within the paginated result set. | [optional] + **page_size** | **int**| Number of items to return per page. | [optional] ### Return type @@ -236,7 +233,6 @@ Name | Type | Description | Notes - **Content-Type**: Not defined - **Accept**: application/json - ### HTTP response details | Status code | Description | Response headers | @@ -246,22 +242,29 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **submit_image_query** -> ImageQuery submit_image_query(detector_id) +> ImageQuery submit_image_query(detector_id, confidence_threshold=confidence_threshold, human_review=human_review, image_query_id=image_query_id, inspection_id=inspection_id, metadata=metadata, patience_time=patience_time, want_async=want_async, body=body) +Submit an image query against a detector. + +You must use `"Content-Type: image/jpeg"` or similar (image/png, image/webp, etc) for the image data. For example: +```Bash +$ curl https://api.groundlight.ai/device-api/v1/image-queries?detector_id=det_abc123 \ + --header "Content-Type: image/jpeg" \ + --data-binary @path/to/filename.jpeg +``` - Submit an image query against a detector. You must use `\"Content-Type: image/jpeg\"` or similar (image/png, image/webp, etc) for the image data. For example: ```Bash $ curl https://api.groundlight.ai/device-api/v1/image-queries?detector_id=det_abc123 \\ --header \"Content-Type: image/jpeg\" \\ --data-binary @path/to/filename.jpeg ``` ### Example * Api Key Authentication (ApiToken): ```python -import time import groundlight_openapi_client -from groundlight_openapi_client.api import image_queries_api -from groundlight_openapi_client.model.image_query import ImageQuery +from groundlight_openapi_client.models.image_query import ImageQuery +from groundlight_openapi_client.rest import ApiException from pprint import pprint + # Defining the host is optional and defaults to https://api.groundlight.ai/device-api # See configuration.py for a list of all supported configuration parameters. configuration = groundlight_openapi_client.Configuration( @@ -274,7 +277,7 @@ configuration = groundlight_openapi_client.Configuration( # satisfies your auth use case. # Configure API key authorization: ApiToken -configuration.api_key['ApiToken'] = 'YOUR_API_KEY' +configuration.api_key['ApiToken'] = os.environ["API_KEY"] # Uncomment below to setup prefix (e.g. Bearer) for API key, if needed # configuration.api_key_prefix['ApiToken'] = 'Bearer' @@ -282,47 +285,41 @@ configuration.api_key['ApiToken'] = 'YOUR_API_KEY' # Enter a context with an instance of the API client with groundlight_openapi_client.ApiClient(configuration) as api_client: # Create an instance of the API class - api_instance = image_queries_api.ImageQueriesApi(api_client) - detector_id = "detector_id_example" # str | Choose a detector by its ID. - confidence_threshold = 0 # float | The confidence threshold for the image query. (optional) - human_review = "human_review_example" # str | If set to `DEFAULT`, use the regular escalation logic (i.e., send the image query for human review if the ML model is not confident). If set to `ALWAYS`, always send the image query for human review even if the ML model is confident. If set to `NEVER`, never send the image query for human review even if the ML model is not confident. (optional) - image_query_id = "image_query_id_example" # str | The ID to assign to the created image query. (optional) - inspection_id = "inspection_id_example" # str | Associate the image query with an inspection. (optional) - metadata = "metadata_example" # str | A dictionary of custom key/value metadata to associate with the image query (limited to 1KB). (optional) - patience_time = 3.14 # float | How long to wait for a confident response. (optional) - want_async = "want_async_example" # str | If \"true\" then submitting an image query returns immediately without a result. The result will be computed asynchronously and can be retrieved later. (optional) - body = open('/path/to/file', 'rb') # file_type | (optional) - - # example passing only required values which don't have defaults set - try: - api_response = api_instance.submit_image_query(detector_id) - pprint(api_response) - except groundlight_openapi_client.ApiException as e: - print("Exception when calling ImageQueriesApi->submit_image_query: %s\n" % e) + api_instance = groundlight_openapi_client.ImageQueriesApi(api_client) + detector_id = 'detector_id_example' # str | Choose a detector by its ID. + confidence_threshold = 3.4 # float | The confidence threshold for the image query. (optional) + human_review = 'human_review_example' # str | If set to `DEFAULT`, use the regular escalation logic (i.e., send the image query for human review if the ML model is not confident). If set to `ALWAYS`, always send the image query for human review even if the ML model is confident. If set to `NEVER`, never send the image query for human review even if the ML model is not confident. (optional) + image_query_id = 'image_query_id_example' # str | The ID to assign to the created image query. (optional) + inspection_id = 'inspection_id_example' # str | Associate the image query with an inspection. (optional) + metadata = 'metadata_example' # str | A dictionary of custom key/value metadata to associate with the image query (limited to 1KB). (optional) + patience_time = 3.4 # float | How long to wait for a confident response. (optional) + want_async = 'want_async_example' # str | If \"true\" then submitting an image query returns immediately without a result. The result will be computed asynchronously and can be retrieved later. (optional) + body = None # bytearray | (optional) - # example passing only required values which don't have defaults set - # and optional values try: api_response = api_instance.submit_image_query(detector_id, confidence_threshold=confidence_threshold, human_review=human_review, image_query_id=image_query_id, inspection_id=inspection_id, metadata=metadata, patience_time=patience_time, want_async=want_async, body=body) + print("The response of ImageQueriesApi->submit_image_query:\n") pprint(api_response) - except groundlight_openapi_client.ApiException as e: + except Exception as e: print("Exception when calling ImageQueriesApi->submit_image_query: %s\n" % e) ``` + ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **detector_id** | **str**| Choose a detector by its ID. | - **confidence_threshold** | **float**| The confidence threshold for the image query. | [optional] - **human_review** | **str**| If set to `DEFAULT`, use the regular escalation logic (i.e., send the image query for human review if the ML model is not confident). If set to `ALWAYS`, always send the image query for human review even if the ML model is confident. If set to `NEVER`, never send the image query for human review even if the ML model is not confident. | [optional] - **image_query_id** | **str**| The ID to assign to the created image query. | [optional] - **inspection_id** | **str**| Associate the image query with an inspection. | [optional] - **metadata** | **str**| A dictionary of custom key/value metadata to associate with the image query (limited to 1KB). | [optional] - **patience_time** | **float**| How long to wait for a confident response. | [optional] - **want_async** | **str**| If \"true\" then submitting an image query returns immediately without a result. The result will be computed asynchronously and can be retrieved later. | [optional] - **body** | **file_type**| | [optional] + **detector_id** | **str**| Choose a detector by its ID. | + **confidence_threshold** | **float**| The confidence threshold for the image query. | [optional] + **human_review** | **str**| If set to `DEFAULT`, use the regular escalation logic (i.e., send the image query for human review if the ML model is not confident). If set to `ALWAYS`, always send the image query for human review even if the ML model is confident. If set to `NEVER`, never send the image query for human review even if the ML model is not confident. | [optional] + **image_query_id** | **str**| The ID to assign to the created image query. | [optional] + **inspection_id** | **str**| Associate the image query with an inspection. | [optional] + **metadata** | **str**| A dictionary of custom key/value metadata to associate with the image query (limited to 1KB). | [optional] + **patience_time** | **float**| How long to wait for a confident response. | [optional] + **want_async** | **str**| If \"true\" then submitting an image query returns immediately without a result. The result will be computed asynchronously and can be retrieved later. | [optional] + **body** | **bytearray**| | [optional] ### Return type @@ -337,7 +334,6 @@ Name | Type | Description | Notes - **Content-Type**: image/jpeg, image/jpg, image/png, image/gif, image/webp, image/bmp, image/x-icon - **Accept**: application/json - ### HTTP response details | Status code | Description | Response headers | diff --git a/generated/docs/ImageQueryResult.md b/generated/docs/ImageQueryResult.md new file mode 100644 index 00000000..5f5b2e9a --- /dev/null +++ b/generated/docs/ImageQueryResult.md @@ -0,0 +1,37 @@ +# ImageQueryResult + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**confidence** | **float** | | [optional] +**source** | **str** | | [optional] +**result_type** | **str** | | [optional] +**from_edge** | **bool** | | [optional] +**label** | **str** | | +**count** | **int** | | +**greater_than_max** | **bool** | | [optional] +**text** | **str** | | +**truncated** | **bool** | | + +## Example + +```python +from groundlight_openapi_client.models.image_query_result import ImageQueryResult + +# TODO update the JSON string below +json = "{}" +# create an instance of ImageQueryResult from a JSON string +image_query_result_instance = ImageQueryResult.from_json(json) +# print the JSON string representation of the object +print(ImageQueryResult.to_json()) + +# convert the object into a dict +image_query_result_dict = image_query_result_instance.to_dict() +# create an instance of ImageQueryResult from a dict +image_query_result_from_dict = ImageQueryResult.from_dict(image_query_result_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/generated/docs/ImageQueryTypeEnum.md b/generated/docs/ImageQueryTypeEnum.md index 27a72eef..298ad42a 100644 --- a/generated/docs/ImageQueryTypeEnum.md +++ b/generated/docs/ImageQueryTypeEnum.md @@ -1,10 +1,9 @@ # ImageQueryTypeEnum -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**value** | **str** | | defaults to "image_query", must be one of ["image_query", ] +## Enum + +* `IMAGE_QUERY` (value: `'image_query'`) [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/generated/docs/Label.md b/generated/docs/Label.md index 8e75ee67..c541a004 100644 --- a/generated/docs/Label.md +++ b/generated/docs/Label.md @@ -1,10 +1,13 @@ # Label -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**value** | **str** | | must be one of ["YES", "NO", "UNCLEAR", ] +## Enum + +* `YES` (value: `'YES'`) + +* `NO` (value: `'NO'`) + +* `UNCLEAR` (value: `'UNCLEAR'`) [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/generated/docs/LabelValue.md b/generated/docs/LabelValue.md index da087687..83ea91db 100644 --- a/generated/docs/LabelValue.md +++ b/generated/docs/LabelValue.md @@ -2,18 +2,35 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**confidence** | **float, none_type** | | [readonly] -**class_name** | **str, none_type** | Return a human-readable class name for this label (e.g. YES/NO) | [readonly] -**annotations_requested** | **[str]** | | [readonly] +**confidence** | **float** | | [readonly] +**class_name** | **str** | Return a human-readable class name for this label (e.g. YES/NO) | [readonly] +**rois** | [**List[ROI]**](ROI.md) | | [optional] +**annotations_requested** | **List[str]** | | [readonly] **created_at** | **datetime** | | [readonly] -**detector_id** | **int, none_type** | | [readonly] +**detector_id** | **int** | | [readonly] **source** | **str** | | [readonly] -**text** | **str, none_type** | Text annotations | [readonly] -**rois** | [**[ROI], none_type**](ROI.md) | | [optional] -**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional] +**text** | **str** | Text annotations | [readonly] + +## Example + +```python +from groundlight_openapi_client.models.label_value import LabelValue + +# TODO update the JSON string below +json = "{}" +# create an instance of LabelValue from a JSON string +label_value_instance = LabelValue.from_json(json) +# print the JSON string representation of the object +print(LabelValue.to_json()) +# convert the object into a dict +label_value_dict = label_value_instance.to_dict() +# create an instance of LabelValue from a dict +label_value_from_dict = LabelValue.from_dict(label_value_dict) +``` [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/generated/docs/LabelValueRequest.md b/generated/docs/LabelValueRequest.md index baa15c2f..761381bd 100644 --- a/generated/docs/LabelValueRequest.md +++ b/generated/docs/LabelValueRequest.md @@ -2,13 +2,30 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**label** | **str, none_type** | | +**label** | **str** | | **image_query_id** | **str** | | -**rois** | [**[ROIRequest], none_type**](ROIRequest.md) | | [optional] -**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional] +**rois** | [**List[ROIRequest]**](ROIRequest.md) | | [optional] + +## Example + +```python +from groundlight_openapi_client.models.label_value_request import LabelValueRequest + +# TODO update the JSON string below +json = "{}" +# create an instance of LabelValueRequest from a JSON string +label_value_request_instance = LabelValueRequest.from_json(json) +# print the JSON string representation of the object +print(LabelValueRequest.to_json()) +# convert the object into a dict +label_value_request_dict = label_value_request_instance.to_dict() +# create an instance of LabelValueRequest from a dict +label_value_request_from_dict = LabelValueRequest.from_dict(label_value_request_dict) +``` [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/generated/docs/LabelsApi.md b/generated/docs/LabelsApi.md index 487e3fe4..22bb868e 100644 --- a/generated/docs/LabelsApi.md +++ b/generated/docs/LabelsApi.md @@ -10,21 +10,20 @@ Method | HTTP request | Description # **create_label** > LabelValue create_label(label_value_request) - - -Create a new LabelValue and attach it to an image query. This will trigger asynchronous fine-tuner model training. +Create a new LabelValue and attach it to an image query. This will trigger +asynchronous fine-tuner model training. ### Example * Api Key Authentication (ApiToken): ```python -import time import groundlight_openapi_client -from groundlight_openapi_client.api import labels_api -from groundlight_openapi_client.model.label_value import LabelValue -from groundlight_openapi_client.model.label_value_request import LabelValueRequest +from groundlight_openapi_client.models.label_value import LabelValue +from groundlight_openapi_client.models.label_value_request import LabelValueRequest +from groundlight_openapi_client.rest import ApiException from pprint import pprint + # Defining the host is optional and defaults to https://api.groundlight.ai/device-api # See configuration.py for a list of all supported configuration parameters. configuration = groundlight_openapi_client.Configuration( @@ -37,7 +36,7 @@ configuration = groundlight_openapi_client.Configuration( # satisfies your auth use case. # Configure API key authorization: ApiToken -configuration.api_key['ApiToken'] = 'YOUR_API_KEY' +configuration.api_key['ApiToken'] = os.environ["API_KEY"] # Uncomment below to setup prefix (e.g. Bearer) for API key, if needed # configuration.api_key_prefix['ApiToken'] = 'Bearer' @@ -45,37 +44,25 @@ configuration.api_key['ApiToken'] = 'YOUR_API_KEY' # Enter a context with an instance of the API client with groundlight_openapi_client.ApiClient(configuration) as api_client: # Create an instance of the API class - api_instance = labels_api.LabelsApi(api_client) - label_value_request = LabelValueRequest( - label="label_example", - image_query_id="image_query_id_example", - rois=[ - ROIRequest( - label="label_example", - geometry=BBoxGeometryRequest( - left=3.14, - top=3.14, - right=3.14, - bottom=3.14, - ), - ), - ], - ) # LabelValueRequest | - - # example passing only required values which don't have defaults set + api_instance = groundlight_openapi_client.LabelsApi(api_client) + label_value_request = groundlight_openapi_client.LabelValueRequest() # LabelValueRequest | + try: api_response = api_instance.create_label(label_value_request) + print("The response of LabelsApi->create_label:\n") pprint(api_response) - except groundlight_openapi_client.ApiException as e: + except Exception as e: print("Exception when calling LabelsApi->create_label: %s\n" % e) ``` + ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **label_value_request** | [**LabelValueRequest**](LabelValueRequest.md)| | + **label_value_request** | [**LabelValueRequest**](LabelValueRequest.md)| | ### Return type @@ -90,7 +77,6 @@ Name | Type | Description | Notes - **Content-Type**: application/json, application/x-www-form-urlencoded, multipart/form-data - **Accept**: application/json - ### HTTP response details | Status code | Description | Response headers | diff --git a/generated/docs/ModeEnum.md b/generated/docs/ModeEnum.md index 720ccf3e..774c5a0c 100644 --- a/generated/docs/ModeEnum.md +++ b/generated/docs/ModeEnum.md @@ -1,10 +1,17 @@ # ModeEnum -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**value** | **str** | | must be one of ["BINARY", "COUNT", "MULTI_CLASS", "TEXT", "BOUNDING_BOX", ] +## Enum + +* `BINARY` (value: `'BINARY'`) + +* `COUNT` (value: `'COUNT'`) + +* `MULTI_CLASS` (value: `'MULTI_CLASS'`) + +* `TEXT` (value: `'TEXT'`) + +* `BOUNDING_BOX` (value: `'BOUNDING_BOX'`) [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/generated/docs/MonthToDateAccountInfoApi.md b/generated/docs/MonthToDateAccountInfoApi.md index 83f5027f..f804edb4 100644 --- a/generated/docs/MonthToDateAccountInfoApi.md +++ b/generated/docs/MonthToDateAccountInfoApi.md @@ -10,8 +10,6 @@ Method | HTTP request | Description # **month_to_date_account_info** > AccountMonthToDateInfo month_to_date_account_info() - - Fetches and returns the account-specific metrics based on the current user's group. ### Example @@ -19,11 +17,11 @@ Fetches and returns the account-specific metrics based on the current user's gro * Api Key Authentication (ApiToken): ```python -import time import groundlight_openapi_client -from groundlight_openapi_client.api import month_to_date_account_info_api -from groundlight_openapi_client.model.account_month_to_date_info import AccountMonthToDateInfo +from groundlight_openapi_client.models.account_month_to_date_info import AccountMonthToDateInfo +from groundlight_openapi_client.rest import ApiException from pprint import pprint + # Defining the host is optional and defaults to https://api.groundlight.ai/device-api # See configuration.py for a list of all supported configuration parameters. configuration = groundlight_openapi_client.Configuration( @@ -36,7 +34,7 @@ configuration = groundlight_openapi_client.Configuration( # satisfies your auth use case. # Configure API key authorization: ApiToken -configuration.api_key['ApiToken'] = 'YOUR_API_KEY' +configuration.api_key['ApiToken'] = os.environ["API_KEY"] # Uncomment below to setup prefix (e.g. Bearer) for API key, if needed # configuration.api_key_prefix['ApiToken'] = 'Bearer' @@ -44,18 +42,20 @@ configuration.api_key['ApiToken'] = 'YOUR_API_KEY' # Enter a context with an instance of the API client with groundlight_openapi_client.ApiClient(configuration) as api_client: # Create an instance of the API class - api_instance = month_to_date_account_info_api.MonthToDateAccountInfoApi(api_client) + api_instance = groundlight_openapi_client.MonthToDateAccountInfoApi(api_client) - # example, this endpoint has no required or optional parameters try: api_response = api_instance.month_to_date_account_info() + print("The response of MonthToDateAccountInfoApi->month_to_date_account_info:\n") pprint(api_response) - except groundlight_openapi_client.ApiException as e: + except Exception as e: print("Exception when calling MonthToDateAccountInfoApi->month_to_date_account_info: %s\n" % e) ``` + ### Parameters + This endpoint does not need any parameter. ### Return type @@ -71,7 +71,6 @@ This endpoint does not need any parameter. - **Content-Type**: Not defined - **Accept**: application/json - ### HTTP response details | Status code | Description | Response headers | diff --git a/generated/docs/MultiClassModeConfiguration.md b/generated/docs/MultiClassModeConfiguration.md index 32570bcf..5401c841 100644 --- a/generated/docs/MultiClassModeConfiguration.md +++ b/generated/docs/MultiClassModeConfiguration.md @@ -2,12 +2,29 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**class_names** | **[str]** | | +**class_names** | **List[str]** | | **num_classes** | **int** | | [optional] -**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional] +## Example + +```python +from groundlight_openapi_client.models.multi_class_mode_configuration import MultiClassModeConfiguration + +# TODO update the JSON string below +json = "{}" +# create an instance of MultiClassModeConfiguration from a JSON string +multi_class_mode_configuration_instance = MultiClassModeConfiguration.from_json(json) +# print the JSON string representation of the object +print(MultiClassModeConfiguration.to_json()) + +# convert the object into a dict +multi_class_mode_configuration_dict = multi_class_mode_configuration_instance.to_dict() +# create an instance of MultiClassModeConfiguration from a dict +multi_class_mode_configuration_from_dict = MultiClassModeConfiguration.from_dict(multi_class_mode_configuration_dict) +``` [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/generated/docs/MultiClassificationResult.md b/generated/docs/MultiClassificationResult.md index d048a5da..b04e0e8d 100644 --- a/generated/docs/MultiClassificationResult.md +++ b/generated/docs/MultiClassificationResult.md @@ -2,15 +2,32 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**label** | **str** | | -**confidence** | **float, none_type** | | [optional] +**confidence** | **float** | | [optional] **source** | **str** | | [optional] -**result_type** | **str** | | [optional] if omitted the server will use the default value of "multi_classification" +**result_type** | **str** | | [optional] **from_edge** | **bool** | | [optional] -**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional] +**label** | **str** | | + +## Example + +```python +from groundlight_openapi_client.models.multi_classification_result import MultiClassificationResult + +# TODO update the JSON string below +json = "{}" +# create an instance of MultiClassificationResult from a JSON string +multi_classification_result_instance = MultiClassificationResult.from_json(json) +# print the JSON string representation of the object +print(MultiClassificationResult.to_json()) +# convert the object into a dict +multi_classification_result_dict = multi_classification_result_instance.to_dict() +# create an instance of MultiClassificationResult from a dict +multi_classification_result_from_dict = MultiClassificationResult.from_dict(multi_classification_result_dict) +``` [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/generated/docs/Note.md b/generated/docs/Note.md index a5e80378..8acd86f3 100644 --- a/generated/docs/Note.md +++ b/generated/docs/Note.md @@ -2,13 +2,30 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **detector_id** | **str** | | [readonly] -**content** | **str, none_type** | Text content of the note. | [optional] -**is_pinned** | **bool, none_type** | | [optional] -**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional] +**content** | **str** | Text content of the note. | [optional] +**is_pinned** | **bool** | | [optional] + +## Example + +```python +from groundlight_openapi_client.models.note import Note + +# TODO update the JSON string below +json = "{}" +# create an instance of Note from a JSON string +note_instance = Note.from_json(json) +# print the JSON string representation of the object +print(Note.to_json()) +# convert the object into a dict +note_dict = note_instance.to_dict() +# create an instance of Note from a dict +note_from_dict = Note.from_dict(note_dict) +``` [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/generated/docs/NoteRequest.md b/generated/docs/NoteRequest.md index 783cb431..24548481 100644 --- a/generated/docs/NoteRequest.md +++ b/generated/docs/NoteRequest.md @@ -2,13 +2,30 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**content** | **str, none_type** | Text content of the note. | [optional] -**is_pinned** | **bool, none_type** | | [optional] -**image** | **file_type, none_type** | | [optional] -**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional] +**content** | **str** | Text content of the note. | [optional] +**is_pinned** | **bool** | | [optional] +**image** | **bytearray** | | [optional] + +## Example + +```python +from groundlight_openapi_client.models.note_request import NoteRequest + +# TODO update the JSON string below +json = "{}" +# create an instance of NoteRequest from a JSON string +note_request_instance = NoteRequest.from_json(json) +# print the JSON string representation of the object +print(NoteRequest.to_json()) +# convert the object into a dict +note_request_dict = note_request_instance.to_dict() +# create an instance of NoteRequest from a dict +note_request_from_dict = NoteRequest.from_dict(note_request_dict) +``` [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/generated/docs/NotesApi.md b/generated/docs/NotesApi.md index f4e20739..60bdc0d8 100644 --- a/generated/docs/NotesApi.md +++ b/generated/docs/NotesApi.md @@ -9,9 +9,7 @@ Method | HTTP request | Description # **create_note** -> create_note(detector_id) - - +> create_note(detector_id, note_request=note_request) Creates a new note. @@ -20,11 +18,11 @@ Creates a new note. * Api Key Authentication (ApiToken): ```python -import time import groundlight_openapi_client -from groundlight_openapi_client.api import notes_api -from groundlight_openapi_client.model.note_request import NoteRequest +from groundlight_openapi_client.models.note_request import NoteRequest +from groundlight_openapi_client.rest import ApiException from pprint import pprint + # Defining the host is optional and defaults to https://api.groundlight.ai/device-api # See configuration.py for a list of all supported configuration parameters. configuration = groundlight_openapi_client.Configuration( @@ -37,7 +35,7 @@ configuration = groundlight_openapi_client.Configuration( # satisfies your auth use case. # Configure API key authorization: ApiToken -configuration.api_key['ApiToken'] = 'YOUR_API_KEY' +configuration.api_key['ApiToken'] = os.environ["API_KEY"] # Uncomment below to setup prefix (e.g. Bearer) for API key, if needed # configuration.api_key_prefix['ApiToken'] = 'Bearer' @@ -45,35 +43,25 @@ configuration.api_key['ApiToken'] = 'YOUR_API_KEY' # Enter a context with an instance of the API client with groundlight_openapi_client.ApiClient(configuration) as api_client: # Create an instance of the API class - api_instance = notes_api.NotesApi(api_client) - detector_id = "detector_id_example" # str | the detector to associate the new note with - note_request = NoteRequest( - content="content_example", - is_pinned=True, - image=open('/path/to/file', 'rb'), - ) # NoteRequest | (optional) - - # example passing only required values which don't have defaults set - try: - api_instance.create_note(detector_id) - except groundlight_openapi_client.ApiException as e: - print("Exception when calling NotesApi->create_note: %s\n" % e) + api_instance = groundlight_openapi_client.NotesApi(api_client) + detector_id = 'detector_id_example' # str | the detector to associate the new note with + note_request = groundlight_openapi_client.NoteRequest() # NoteRequest | (optional) - # example passing only required values which don't have defaults set - # and optional values try: api_instance.create_note(detector_id, note_request=note_request) - except groundlight_openapi_client.ApiException as e: + except Exception as e: print("Exception when calling NotesApi->create_note: %s\n" % e) ``` + ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **detector_id** | **str**| the detector to associate the new note with | - **note_request** | [**NoteRequest**](NoteRequest.md)| | [optional] + **detector_id** | **str**| the detector to associate the new note with | + **note_request** | [**NoteRequest**](NoteRequest.md)| | [optional] ### Return type @@ -88,7 +76,6 @@ void (empty response body) - **Content-Type**: application/json, application/x-www-form-urlencoded, multipart/form-data - **Accept**: Not defined - ### HTTP response details | Status code | Description | Response headers | @@ -100,8 +87,6 @@ void (empty response body) # **get_notes** > AllNotes get_notes(detector_id) - - Retrieves all notes from a given detector and returns them in lists, one for each note_category. ### Example @@ -109,11 +94,11 @@ Retrieves all notes from a given detector and returns them in lists, one for eac * Api Key Authentication (ApiToken): ```python -import time import groundlight_openapi_client -from groundlight_openapi_client.api import notes_api -from groundlight_openapi_client.model.all_notes import AllNotes +from groundlight_openapi_client.models.all_notes import AllNotes +from groundlight_openapi_client.rest import ApiException from pprint import pprint + # Defining the host is optional and defaults to https://api.groundlight.ai/device-api # See configuration.py for a list of all supported configuration parameters. configuration = groundlight_openapi_client.Configuration( @@ -126,7 +111,7 @@ configuration = groundlight_openapi_client.Configuration( # satisfies your auth use case. # Configure API key authorization: ApiToken -configuration.api_key['ApiToken'] = 'YOUR_API_KEY' +configuration.api_key['ApiToken'] = os.environ["API_KEY"] # Uncomment below to setup prefix (e.g. Bearer) for API key, if needed # configuration.api_key_prefix['ApiToken'] = 'Bearer' @@ -134,23 +119,25 @@ configuration.api_key['ApiToken'] = 'YOUR_API_KEY' # Enter a context with an instance of the API client with groundlight_openapi_client.ApiClient(configuration) as api_client: # Create an instance of the API class - api_instance = notes_api.NotesApi(api_client) - detector_id = "detector_id_example" # str | the detector whose notes to retrieve + api_instance = groundlight_openapi_client.NotesApi(api_client) + detector_id = 'detector_id_example' # str | the detector whose notes to retrieve - # example passing only required values which don't have defaults set try: api_response = api_instance.get_notes(detector_id) + print("The response of NotesApi->get_notes:\n") pprint(api_response) - except groundlight_openapi_client.ApiException as e: + except Exception as e: print("Exception when calling NotesApi->get_notes: %s\n" % e) ``` + ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **detector_id** | **str**| the detector whose notes to retrieve | + **detector_id** | **str**| the detector whose notes to retrieve | ### Return type @@ -165,7 +152,6 @@ Name | Type | Description | Notes - **Content-Type**: Not defined - **Accept**: application/json - ### HTTP response details | Status code | Description | Response headers | diff --git a/generated/docs/PaginatedDetectorList.md b/generated/docs/PaginatedDetectorList.md index 52c596a2..86b69aa7 100644 --- a/generated/docs/PaginatedDetectorList.md +++ b/generated/docs/PaginatedDetectorList.md @@ -2,14 +2,31 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **count** | **int** | | -**results** | [**[Detector]**](Detector.md) | | -**next** | **str, none_type** | | [optional] -**previous** | **str, none_type** | | [optional] -**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional] +**next** | **str** | | [optional] +**previous** | **str** | | [optional] +**results** | [**List[Detector]**](Detector.md) | | + +## Example + +```python +from groundlight_openapi_client.models.paginated_detector_list import PaginatedDetectorList + +# TODO update the JSON string below +json = "{}" +# create an instance of PaginatedDetectorList from a JSON string +paginated_detector_list_instance = PaginatedDetectorList.from_json(json) +# print the JSON string representation of the object +print(PaginatedDetectorList.to_json()) +# convert the object into a dict +paginated_detector_list_dict = paginated_detector_list_instance.to_dict() +# create an instance of PaginatedDetectorList from a dict +paginated_detector_list_from_dict = PaginatedDetectorList.from_dict(paginated_detector_list_dict) +``` [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/generated/docs/PaginatedImageQueryList.md b/generated/docs/PaginatedImageQueryList.md index f5711b9d..c9c64e8a 100644 --- a/generated/docs/PaginatedImageQueryList.md +++ b/generated/docs/PaginatedImageQueryList.md @@ -2,14 +2,31 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **count** | **int** | | -**results** | [**[ImageQuery]**](ImageQuery.md) | | -**next** | **str, none_type** | | [optional] -**previous** | **str, none_type** | | [optional] -**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional] +**next** | **str** | | [optional] +**previous** | **str** | | [optional] +**results** | [**List[ImageQuery]**](ImageQuery.md) | | + +## Example + +```python +from groundlight_openapi_client.models.paginated_image_query_list import PaginatedImageQueryList + +# TODO update the JSON string below +json = "{}" +# create an instance of PaginatedImageQueryList from a JSON string +paginated_image_query_list_instance = PaginatedImageQueryList.from_json(json) +# print the JSON string representation of the object +print(PaginatedImageQueryList.to_json()) +# convert the object into a dict +paginated_image_query_list_dict = paginated_image_query_list_instance.to_dict() +# create an instance of PaginatedImageQueryList from a dict +paginated_image_query_list_from_dict = PaginatedImageQueryList.from_dict(paginated_image_query_list_dict) +``` [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/generated/docs/PaginatedRuleList.md b/generated/docs/PaginatedRuleList.md index e0d1942b..452b1c8f 100644 --- a/generated/docs/PaginatedRuleList.md +++ b/generated/docs/PaginatedRuleList.md @@ -2,14 +2,31 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **count** | **int** | | -**results** | [**[Rule]**](Rule.md) | | -**next** | **str, none_type** | | [optional] -**previous** | **str, none_type** | | [optional] -**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional] +**next** | **str** | | [optional] +**previous** | **str** | | [optional] +**results** | [**List[Rule]**](Rule.md) | | + +## Example + +```python +from groundlight_openapi_client.models.paginated_rule_list import PaginatedRuleList + +# TODO update the JSON string below +json = "{}" +# create an instance of PaginatedRuleList from a JSON string +paginated_rule_list_instance = PaginatedRuleList.from_json(json) +# print the JSON string representation of the object +print(PaginatedRuleList.to_json()) +# convert the object into a dict +paginated_rule_list_dict = paginated_rule_list_instance.to_dict() +# create an instance of PaginatedRuleList from a dict +paginated_rule_list_from_dict = PaginatedRuleList.from_dict(paginated_rule_list_dict) +``` [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/generated/docs/PayloadTemplate.md b/generated/docs/PayloadTemplate.md index b2f39495..b3f05fa2 100644 --- a/generated/docs/PayloadTemplate.md +++ b/generated/docs/PayloadTemplate.md @@ -2,12 +2,29 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **template** | **str** | | -**headers** | **{str: (str,)}, none_type** | | [optional] -**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional] +**headers** | **Dict[str, str]** | | [optional] + +## Example + +```python +from groundlight_openapi_client.models.payload_template import PayloadTemplate + +# TODO update the JSON string below +json = "{}" +# create an instance of PayloadTemplate from a JSON string +payload_template_instance = PayloadTemplate.from_json(json) +# print the JSON string representation of the object +print(PayloadTemplate.to_json()) +# convert the object into a dict +payload_template_dict = payload_template_instance.to_dict() +# create an instance of PayloadTemplate from a dict +payload_template_from_dict = PayloadTemplate.from_dict(payload_template_dict) +``` [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/generated/docs/PayloadTemplateRequest.md b/generated/docs/PayloadTemplateRequest.md index 83e8c3c3..decc4077 100644 --- a/generated/docs/PayloadTemplateRequest.md +++ b/generated/docs/PayloadTemplateRequest.md @@ -2,12 +2,29 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **template** | **str** | | -**headers** | **{str: (str,)}, none_type** | | [optional] -**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional] +**headers** | **Dict[str, str]** | | [optional] + +## Example + +```python +from groundlight_openapi_client.models.payload_template_request import PayloadTemplateRequest + +# TODO update the JSON string below +json = "{}" +# create an instance of PayloadTemplateRequest from a JSON string +payload_template_request_instance = PayloadTemplateRequest.from_json(json) +# print the JSON string representation of the object +print(PayloadTemplateRequest.to_json()) +# convert the object into a dict +payload_template_request_dict = payload_template_request_instance.to_dict() +# create an instance of PayloadTemplateRequest from a dict +payload_template_request_from_dict = PayloadTemplateRequest.from_dict(payload_template_request_dict) +``` [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/generated/docs/ROI.md b/generated/docs/ROI.md index 60da87e6..1864def9 100644 --- a/generated/docs/ROI.md +++ b/generated/docs/ROI.md @@ -3,13 +3,30 @@ Mixin for serializers to handle data in the StrictBaseModel format ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **label** | **str** | The label of the bounding box. | **score** | **float** | The confidence of the bounding box. | [readonly] **geometry** | [**BBoxGeometry**](BBoxGeometry.md) | | -**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional] +## Example + +```python +from groundlight_openapi_client.models.roi import ROI + +# TODO update the JSON string below +json = "{}" +# create an instance of ROI from a JSON string +roi_instance = ROI.from_json(json) +# print the JSON string representation of the object +print(ROI.to_json()) + +# convert the object into a dict +roi_dict = roi_instance.to_dict() +# create an instance of ROI from a dict +roi_from_dict = ROI.from_dict(roi_dict) +``` [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/generated/docs/ROIRequest.md b/generated/docs/ROIRequest.md index 8d675ec3..b5be7eb4 100644 --- a/generated/docs/ROIRequest.md +++ b/generated/docs/ROIRequest.md @@ -3,12 +3,29 @@ Mixin for serializers to handle data in the StrictBaseModel format ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **label** | **str** | The label of the bounding box. | **geometry** | [**BBoxGeometryRequest**](BBoxGeometryRequest.md) | | -**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional] +## Example + +```python +from groundlight_openapi_client.models.roi_request import ROIRequest + +# TODO update the JSON string below +json = "{}" +# create an instance of ROIRequest from a JSON string +roi_request_instance = ROIRequest.from_json(json) +# print the JSON string representation of the object +print(ROIRequest.to_json()) + +# convert the object into a dict +roi_request_dict = roi_request_instance.to_dict() +# create an instance of ROIRequest from a dict +roi_request_from_dict = ROIRequest.from_dict(roi_request_dict) +``` [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/generated/docs/ResultTypeEnum.md b/generated/docs/ResultTypeEnum.md index 0146b794..c38a2c4b 100644 --- a/generated/docs/ResultTypeEnum.md +++ b/generated/docs/ResultTypeEnum.md @@ -1,10 +1,17 @@ # ResultTypeEnum -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**value** | **str** | | must be one of ["binary_classification", "counting", "multi_classification", "text_recognition", "bounding_box", ] +## Enum + +* `BINARY_CLASSIFICATION` (value: `'binary_classification'`) + +* `COUNTING` (value: `'counting'`) + +* `MULTI_CLASSIFICATION` (value: `'multi_classification'`) + +* `TEXT_RECOGNITION` (value: `'text_recognition'`) + +* `BOUNDING_BOX` (value: `'bounding_box'`) [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/generated/docs/Rule.md b/generated/docs/Rule.md index a3f0c9d5..26df6454 100644 --- a/generated/docs/Rule.md +++ b/generated/docs/Rule.md @@ -2,22 +2,39 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **id** | **int** | | [readonly] **detector_id** | **str** | | [readonly] **detector_name** | **str** | | [readonly] **name** | **str** | | +**enabled** | **bool** | | [optional] [default to True] +**snooze_time_enabled** | **bool** | | [optional] [default to False] +**snooze_time_value** | **int** | | [optional] [default to 0] +**snooze_time_unit** | [**SnoozeTimeUnitEnum**](SnoozeTimeUnitEnum.md) | | [optional] +**human_review_required** | **bool** | | [optional] [default to False] **condition** | [**Condition**](Condition.md) | | -**enabled** | **bool** | | [optional] if omitted the server will use the default value of True -**snooze_time_enabled** | **bool** | | [optional] if omitted the server will use the default value of False -**snooze_time_value** | **int** | | [optional] if omitted the server will use the default value of 0 -**snooze_time_unit** | **bool, date, datetime, dict, float, int, list, str, none_type** | | [optional] -**human_review_required** | **bool** | | [optional] if omitted the server will use the default value of False -**action** | **bool, date, datetime, dict, float, int, list, str, none_type** | | [optional] -**webhook_action** | [**[WebhookAction]**](WebhookAction.md) | | [optional] -**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional] +**action** | [**RuleAction**](RuleAction.md) | | [optional] +**webhook_action** | [**List[WebhookAction]**](WebhookAction.md) | | [optional] + +## Example + +```python +from groundlight_openapi_client.models.rule import Rule + +# TODO update the JSON string below +json = "{}" +# create an instance of Rule from a JSON string +rule_instance = Rule.from_json(json) +# print the JSON string representation of the object +print(Rule.to_json()) +# convert the object into a dict +rule_dict = rule_instance.to_dict() +# create an instance of Rule from a dict +rule_from_dict = Rule.from_dict(rule_dict) +``` [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/generated/docs/RuleAction.md b/generated/docs/RuleAction.md new file mode 100644 index 00000000..26dd6e83 --- /dev/null +++ b/generated/docs/RuleAction.md @@ -0,0 +1,31 @@ +# RuleAction + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**channel** | [**ChannelEnum**](ChannelEnum.md) | | +**recipient** | **str** | | +**include_image** | **bool** | | + +## Example + +```python +from groundlight_openapi_client.models.rule_action import RuleAction + +# TODO update the JSON string below +json = "{}" +# create an instance of RuleAction from a JSON string +rule_action_instance = RuleAction.from_json(json) +# print the JSON string representation of the object +print(RuleAction.to_json()) + +# convert the object into a dict +rule_action_dict = rule_action_instance.to_dict() +# create an instance of RuleAction from a dict +rule_action_from_dict = RuleAction.from_dict(rule_action_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/generated/docs/RuleRequest.md b/generated/docs/RuleRequest.md index 9e5b3294..f5cdc927 100644 --- a/generated/docs/RuleRequest.md +++ b/generated/docs/RuleRequest.md @@ -2,19 +2,36 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **name** | **str** | | +**enabled** | **bool** | | [optional] [default to True] +**snooze_time_enabled** | **bool** | | [optional] [default to False] +**snooze_time_value** | **int** | | [optional] [default to 0] +**snooze_time_unit** | [**SnoozeTimeUnitEnum**](SnoozeTimeUnitEnum.md) | | [optional] +**human_review_required** | **bool** | | [optional] [default to False] **condition** | [**ConditionRequest**](ConditionRequest.md) | | -**enabled** | **bool** | | [optional] if omitted the server will use the default value of True -**snooze_time_enabled** | **bool** | | [optional] if omitted the server will use the default value of False -**snooze_time_value** | **int** | | [optional] if omitted the server will use the default value of 0 -**snooze_time_unit** | **bool, date, datetime, dict, float, int, list, str, none_type** | | [optional] -**human_review_required** | **bool** | | [optional] if omitted the server will use the default value of False -**action** | **bool, date, datetime, dict, float, int, list, str, none_type** | | [optional] -**webhook_action** | [**[WebhookActionRequest]**](WebhookActionRequest.md) | | [optional] -**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional] +**action** | [**RuleAction**](RuleAction.md) | | [optional] +**webhook_action** | [**List[WebhookActionRequest]**](WebhookActionRequest.md) | | [optional] + +## Example + +```python +from groundlight_openapi_client.models.rule_request import RuleRequest + +# TODO update the JSON string below +json = "{}" +# create an instance of RuleRequest from a JSON string +rule_request_instance = RuleRequest.from_json(json) +# print the JSON string representation of the object +print(RuleRequest.to_json()) +# convert the object into a dict +rule_request_dict = rule_request_instance.to_dict() +# create an instance of RuleRequest from a dict +rule_request_from_dict = RuleRequest.from_dict(rule_request_dict) +``` [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/generated/docs/SnoozeTimeUnitEnum.md b/generated/docs/SnoozeTimeUnitEnum.md index 778f7062..74e3d6ee 100644 --- a/generated/docs/SnoozeTimeUnitEnum.md +++ b/generated/docs/SnoozeTimeUnitEnum.md @@ -2,10 +2,15 @@ * `DAYS` - DAYS * `HOURS` - HOURS * `MINUTES` - MINUTES * `SECONDS` - SECONDS -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**value** | **str** | * `DAYS` - DAYS * `HOURS` - HOURS * `MINUTES` - MINUTES * `SECONDS` - SECONDS | must be one of ["DAYS", "HOURS", "MINUTES", "SECONDS", ] +## Enum + +* `DAYS` (value: `'DAYS'`) + +* `HOURS` (value: `'HOURS'`) + +* `MINUTES` (value: `'MINUTES'`) + +* `SECONDS` (value: `'SECONDS'`) [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/generated/docs/Source.md b/generated/docs/Source.md index e7ddb56a..0ac6f4a9 100644 --- a/generated/docs/Source.md +++ b/generated/docs/Source.md @@ -1,10 +1,25 @@ # Source -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**value** | **str** | | must be one of ["STILL_PROCESSING", "CLOUD", "USER", "CLOUD_ENSEMBLE", "ALGORITHM", "AI_CLOUD", "AI_CLOUD_ENSEMBLE", "HUMAN_AI_CLOUD_ENSEMBLE", "EDGE", ] +## Enum + +* `STILL_PROCESSING` (value: `'STILL_PROCESSING'`) + +* `CLOUD` (value: `'CLOUD'`) + +* `USER` (value: `'USER'`) + +* `CLOUD_ENSEMBLE` (value: `'CLOUD_ENSEMBLE'`) + +* `ALGORITHM` (value: `'ALGORITHM'`) + +* `AI_CLOUD` (value: `'AI_CLOUD'`) + +* `AI_CLOUD_ENSEMBLE` (value: `'AI_CLOUD_ENSEMBLE'`) + +* `HUMAN_AI_CLOUD_ENSEMBLE` (value: `'HUMAN_AI_CLOUD_ENSEMBLE'`) + +* `EDGE` (value: `'EDGE'`) [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/generated/docs/SourceEnum.md b/generated/docs/SourceEnum.md index 81cbdb56..0d69273c 100644 --- a/generated/docs/SourceEnum.md +++ b/generated/docs/SourceEnum.md @@ -1,10 +1,29 @@ # SourceEnum -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**value** | **str** | | must be one of ["INITIAL_PLACEHOLDER", "CLOUD", "CUST", "HUMAN_CLOUD_ENSEMBLE", "AI_CLOUD", "AI_CLOUD_ENSEMBLE", "HUMAN_AI_CLOUD_ENSEMBLE", "ALG", "ALG_REC", "ALG_UNCLEAR", "EDGE", ] +## Enum + +* `INITIAL_PLACEHOLDER` (value: `'INITIAL_PLACEHOLDER'`) + +* `CLOUD` (value: `'CLOUD'`) + +* `CUST` (value: `'CUST'`) + +* `HUMAN_CLOUD_ENSEMBLE` (value: `'HUMAN_CLOUD_ENSEMBLE'`) + +* `AI_CLOUD` (value: `'AI_CLOUD'`) + +* `AI_CLOUD_ENSEMBLE` (value: `'AI_CLOUD_ENSEMBLE'`) + +* `HUMAN_AI_CLOUD_ENSEMBLE` (value: `'HUMAN_AI_CLOUD_ENSEMBLE'`) + +* `ALG` (value: `'ALG'`) + +* `ALG_REC` (value: `'ALG_REC'`) + +* `ALG_UNCLEAR` (value: `'ALG_UNCLEAR'`) + +* `EDGE` (value: `'EDGE'`) [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/generated/docs/StatusEnum.md b/generated/docs/StatusEnum.md index 6d4c3312..e158c9f1 100644 --- a/generated/docs/StatusEnum.md +++ b/generated/docs/StatusEnum.md @@ -2,10 +2,11 @@ * `ON` - ON * `OFF` - OFF -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**value** | **str** | * `ON` - ON * `OFF` - OFF | must be one of ["ON", "OFF", ] +## Enum + +* `ON` (value: `'ON'`) + +* `OFF` (value: `'OFF'`) [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/generated/docs/TextModeConfiguration.md b/generated/docs/TextModeConfiguration.md index 01bcfdf1..f2d55921 100644 --- a/generated/docs/TextModeConfiguration.md +++ b/generated/docs/TextModeConfiguration.md @@ -2,11 +2,28 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **value_max_length** | **int** | | [optional] -**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional] +## Example + +```python +from groundlight_openapi_client.models.text_mode_configuration import TextModeConfiguration + +# TODO update the JSON string below +json = "{}" +# create an instance of TextModeConfiguration from a JSON string +text_mode_configuration_instance = TextModeConfiguration.from_json(json) +# print the JSON string representation of the object +print(TextModeConfiguration.to_json()) + +# convert the object into a dict +text_mode_configuration_dict = text_mode_configuration_instance.to_dict() +# create an instance of TextModeConfiguration from a dict +text_mode_configuration_from_dict = TextModeConfiguration.from_dict(text_mode_configuration_dict) +``` [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/generated/docs/TextRecognitionResult.md b/generated/docs/TextRecognitionResult.md index f518a26b..ee4d58a7 100644 --- a/generated/docs/TextRecognitionResult.md +++ b/generated/docs/TextRecognitionResult.md @@ -2,16 +2,33 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**text** | **str, none_type** | | -**truncated** | **bool** | | -**confidence** | **float, none_type** | | [optional] +**confidence** | **float** | | [optional] **source** | **str** | | [optional] -**result_type** | **str** | | [optional] if omitted the server will use the default value of "text_recognition" +**result_type** | **str** | | [optional] **from_edge** | **bool** | | [optional] -**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional] +**text** | **str** | | +**truncated** | **bool** | | + +## Example + +```python +from groundlight_openapi_client.models.text_recognition_result import TextRecognitionResult + +# TODO update the JSON string below +json = "{}" +# create an instance of TextRecognitionResult from a JSON string +text_recognition_result_instance = TextRecognitionResult.from_json(json) +# print the JSON string representation of the object +print(TextRecognitionResult.to_json()) +# convert the object into a dict +text_recognition_result_dict = text_recognition_result_instance.to_dict() +# create an instance of TextRecognitionResult from a dict +text_recognition_result_from_dict = TextRecognitionResult.from_dict(text_recognition_result_dict) +``` [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/generated/docs/UserApi.md b/generated/docs/UserApi.md index b10f06bc..8e9ba7d3 100644 --- a/generated/docs/UserApi.md +++ b/generated/docs/UserApi.md @@ -8,9 +8,7 @@ Method | HTTP request | Description # **who_am_i** -> InlineResponse2002 who_am_i() - - +> WhoAmI200Response who_am_i() Retrieve the current user. @@ -19,11 +17,11 @@ Retrieve the current user. * Api Key Authentication (ApiToken): ```python -import time import groundlight_openapi_client -from groundlight_openapi_client.api import user_api -from groundlight_openapi_client.model.inline_response2002 import InlineResponse2002 +from groundlight_openapi_client.models.who_am_i200_response import WhoAmI200Response +from groundlight_openapi_client.rest import ApiException from pprint import pprint + # Defining the host is optional and defaults to https://api.groundlight.ai/device-api # See configuration.py for a list of all supported configuration parameters. configuration = groundlight_openapi_client.Configuration( @@ -36,7 +34,7 @@ configuration = groundlight_openapi_client.Configuration( # satisfies your auth use case. # Configure API key authorization: ApiToken -configuration.api_key['ApiToken'] = 'YOUR_API_KEY' +configuration.api_key['ApiToken'] = os.environ["API_KEY"] # Uncomment below to setup prefix (e.g. Bearer) for API key, if needed # configuration.api_key_prefix['ApiToken'] = 'Bearer' @@ -44,23 +42,25 @@ configuration.api_key['ApiToken'] = 'YOUR_API_KEY' # Enter a context with an instance of the API client with groundlight_openapi_client.ApiClient(configuration) as api_client: # Create an instance of the API class - api_instance = user_api.UserApi(api_client) + api_instance = groundlight_openapi_client.UserApi(api_client) - # example, this endpoint has no required or optional parameters try: api_response = api_instance.who_am_i() + print("The response of UserApi->who_am_i:\n") pprint(api_response) - except groundlight_openapi_client.ApiException as e: + except Exception as e: print("Exception when calling UserApi->who_am_i: %s\n" % e) ``` + ### Parameters + This endpoint does not need any parameter. ### Return type -[**InlineResponse2002**](InlineResponse2002.md) +[**WhoAmI200Response**](WhoAmI200Response.md) ### Authorization @@ -71,7 +71,6 @@ This endpoint does not need any parameter. - **Content-Type**: Not defined - **Accept**: application/json - ### HTTP response details | Status code | Description | Response headers | diff --git a/generated/docs/VerbEnum.md b/generated/docs/VerbEnum.md index 57a334c2..d010577d 100644 --- a/generated/docs/VerbEnum.md +++ b/generated/docs/VerbEnum.md @@ -1,10 +1,17 @@ # VerbEnum -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**value** | **str** | | must be one of ["ANSWERED_CONSECUTIVELY", "ANSWERED_WITHIN_TIME", "CHANGED_TO", "NO_CHANGE", "NO_QUERIES", ] +## Enum + +* `ANSWERED_CONSECUTIVELY` (value: `'ANSWERED_CONSECUTIVELY'`) + +* `ANSWERED_WITHIN_TIME` (value: `'ANSWERED_WITHIN_TIME'`) + +* `CHANGED_TO` (value: `'CHANGED_TO'`) + +* `NO_CHANGE` (value: `'NO_CHANGE'`) + +* `NO_QUERIES` (value: `'NO_QUERIES'`) [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/generated/docs/WebhookAction.md b/generated/docs/WebhookAction.md index 3635866d..31baa38d 100644 --- a/generated/docs/WebhookAction.md +++ b/generated/docs/WebhookAction.md @@ -2,16 +2,33 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **url** | **str** | | **include_image** | **bool** | | [optional] -**payload_template** | **bool, date, datetime, dict, float, int, list, str, none_type** | | [optional] +**payload_template** | [**PayloadTemplate**](PayloadTemplate.md) | | [optional] **last_message_failed** | **bool** | | [optional] -**last_failure_error** | **str, none_type** | | [optional] -**last_failed_at** | **datetime, none_type** | | [optional] -**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional] +**last_failure_error** | **str** | | [optional] +**last_failed_at** | **datetime** | | [optional] + +## Example + +```python +from groundlight_openapi_client.models.webhook_action import WebhookAction + +# TODO update the JSON string below +json = "{}" +# create an instance of WebhookAction from a JSON string +webhook_action_instance = WebhookAction.from_json(json) +# print the JSON string representation of the object +print(WebhookAction.to_json()) +# convert the object into a dict +webhook_action_dict = webhook_action_instance.to_dict() +# create an instance of WebhookAction from a dict +webhook_action_from_dict = WebhookAction.from_dict(webhook_action_dict) +``` [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/generated/docs/WebhookActionRequest.md b/generated/docs/WebhookActionRequest.md index 0910602a..a7d0ea1e 100644 --- a/generated/docs/WebhookActionRequest.md +++ b/generated/docs/WebhookActionRequest.md @@ -2,16 +2,33 @@ ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **url** | **str** | | **include_image** | **bool** | | [optional] -**payload_template** | **bool, date, datetime, dict, float, int, list, str, none_type** | | [optional] +**payload_template** | [**PayloadTemplateRequest**](PayloadTemplateRequest.md) | | [optional] **last_message_failed** | **bool** | | [optional] -**last_failure_error** | **str, none_type** | | [optional] -**last_failed_at** | **datetime, none_type** | | [optional] -**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional] +**last_failure_error** | **str** | | [optional] +**last_failed_at** | **datetime** | | [optional] + +## Example + +```python +from groundlight_openapi_client.models.webhook_action_request import WebhookActionRequest + +# TODO update the JSON string below +json = "{}" +# create an instance of WebhookActionRequest from a JSON string +webhook_action_request_instance = WebhookActionRequest.from_json(json) +# print the JSON string representation of the object +print(WebhookActionRequest.to_json()) +# convert the object into a dict +webhook_action_request_dict = webhook_action_request_instance.to_dict() +# create an instance of WebhookActionRequest from a dict +webhook_action_request_from_dict = WebhookActionRequest.from_dict(webhook_action_request_dict) +``` [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/generated/docs/WhoAmI200Response.md b/generated/docs/WhoAmI200Response.md new file mode 100644 index 00000000..6aab5f34 --- /dev/null +++ b/generated/docs/WhoAmI200Response.md @@ -0,0 +1,29 @@ +# WhoAmI200Response + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**username** | **str** | The user's username | [optional] + +## Example + +```python +from groundlight_openapi_client.models.who_am_i200_response import WhoAmI200Response + +# TODO update the JSON string below +json = "{}" +# create an instance of WhoAmI200Response from a JSON string +who_am_i200_response_instance = WhoAmI200Response.from_json(json) +# print the JSON string representation of the object +print(WhoAmI200Response.to_json()) + +# convert the object into a dict +who_am_i200_response_dict = who_am_i200_response_instance.to_dict() +# create an instance of WhoAmI200Response from a dict +who_am_i200_response_from_dict = WhoAmI200Response.from_dict(who_am_i200_response_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/generated/groundlight_openapi_client/__init__.py b/generated/groundlight_openapi_client/__init__.py index ff1e9a1d..95f69b59 100644 --- a/generated/groundlight_openapi_client/__init__.py +++ b/generated/groundlight_openapi_client/__init__.py @@ -1,28 +1,206 @@ +# coding: utf-8 + # flake8: noqa """ Groundlight API - Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. # noqa: E501 + Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. The version of the OpenAPI document: 0.18.2 Contact: support@groundlight.ai - Generated by: https://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 __version__ = "1.0.0" +# Define package exports +__all__ = [ + "ActionsApi", + "DetectorGroupsApi", + "DetectorResetApi", + "DetectorsApi", + "EdgeApi", + "ImageQueriesApi", + "LabelsApi", + "MonthToDateAccountInfoApi", + "NotesApi", + "UserApi", + "ApiResponse", + "ApiClient", + "Configuration", + "OpenApiException", + "ApiTypeError", + "ApiValueError", + "ApiKeyError", + "ApiAttributeError", + "ApiException", + "Action", + "AllNotes", + "AnnotationsRequestedEnum", + "BBoxGeometry", + "BBoxGeometryRequest", + "BinaryClassificationResult", + "BlankEnum", + "BoundingBoxLabelEnum", + "BoundingBoxModeConfiguration", + "BoundingBoxResult", + "ChannelEnum", + "Condition", + "ConditionRequest", + "CountModeConfiguration", + "CountingResult", + "DetectorCreationInputRequestModeConfiguration", + "DetectorGroup", + "DetectorGroupRequest", + "DetectorTypeEnum", + "EdgeModelInfo", + "EscalationTypeEnum", + "GetDetectorEvaluation200Response", + "GetDetectorEvaluation200ResponseEvaluationResults", + "GetDetectorMetrics200Response", + "GetDetectorMetrics200ResponseSummary", + "GetDetectorMetrics200ResponseSummaryClassCounts", + "ImageQueryResult", + "ImageQueryTypeEnum", + "Label", + "LabelValue", + "LabelValueRequest", + "ModeEnum", + "MultiClassModeConfiguration", + "MultiClassificationResult", + "Note", + "NoteRequest", + "PaginatedDetectorList", + "PaginatedImageQueryList", + "PaginatedRuleList", + "PayloadTemplate", + "PayloadTemplateRequest", + "ROI", + "ROIRequest", + "ResultTypeEnum", + "Rule", + "RuleAction", + "RuleRequest", + "SnoozeTimeUnitEnum", + "Source", + "SourceEnum", + "StatusEnum", + "TextModeConfiguration", + "TextRecognitionResult", + "VerbEnum", + "WebhookAction", + "WebhookActionRequest", + "WhoAmI200Response", +] + +# import apis into sdk package +from groundlight_openapi_client.api.actions_api import ActionsApi as ActionsApi +from groundlight_openapi_client.api.detector_groups_api import DetectorGroupsApi as DetectorGroupsApi +from groundlight_openapi_client.api.detector_reset_api import DetectorResetApi as DetectorResetApi +from groundlight_openapi_client.api.detectors_api import DetectorsApi as DetectorsApi +from groundlight_openapi_client.api.edge_api import EdgeApi as EdgeApi +from groundlight_openapi_client.api.image_queries_api import ImageQueriesApi as ImageQueriesApi +from groundlight_openapi_client.api.labels_api import LabelsApi as LabelsApi +from groundlight_openapi_client.api.month_to_date_account_info_api import ( + MonthToDateAccountInfoApi as MonthToDateAccountInfoApi, +) +from groundlight_openapi_client.api.notes_api import NotesApi as NotesApi +from groundlight_openapi_client.api.user_api import UserApi as UserApi + # import ApiClient -from groundlight_openapi_client.api_client import ApiClient - -# import Configuration -from groundlight_openapi_client.configuration import Configuration - -# import exceptions -from groundlight_openapi_client.exceptions import OpenApiException -from groundlight_openapi_client.exceptions import ApiAttributeError -from groundlight_openapi_client.exceptions import ApiTypeError -from groundlight_openapi_client.exceptions import ApiValueError -from groundlight_openapi_client.exceptions import ApiKeyError -from groundlight_openapi_client.exceptions import ApiException +from groundlight_openapi_client.api_response import ApiResponse as ApiResponse +from groundlight_openapi_client.api_client import ApiClient as ApiClient +from groundlight_openapi_client.configuration import Configuration as Configuration +from groundlight_openapi_client.exceptions import OpenApiException as OpenApiException +from groundlight_openapi_client.exceptions import ApiTypeError as ApiTypeError +from groundlight_openapi_client.exceptions import ApiValueError as ApiValueError +from groundlight_openapi_client.exceptions import ApiKeyError as ApiKeyError +from groundlight_openapi_client.exceptions import ApiAttributeError as ApiAttributeError +from groundlight_openapi_client.exceptions import ApiException as ApiException + +# import models into sdk package +from groundlight_openapi_client.models.action import Action as Action +from groundlight_openapi_client.models.all_notes import AllNotes as AllNotes +from groundlight_openapi_client.models.annotations_requested_enum import ( + AnnotationsRequestedEnum as AnnotationsRequestedEnum, +) +from groundlight_openapi_client.models.b_box_geometry import BBoxGeometry as BBoxGeometry +from groundlight_openapi_client.models.b_box_geometry_request import BBoxGeometryRequest as BBoxGeometryRequest +from groundlight_openapi_client.models.binary_classification_result import ( + BinaryClassificationResult as BinaryClassificationResult, +) +from groundlight_openapi_client.models.blank_enum import BlankEnum as BlankEnum +from groundlight_openapi_client.models.bounding_box_label_enum import BoundingBoxLabelEnum as BoundingBoxLabelEnum +from groundlight_openapi_client.models.bounding_box_mode_configuration import ( + BoundingBoxModeConfiguration as BoundingBoxModeConfiguration, +) +from groundlight_openapi_client.models.bounding_box_result import BoundingBoxResult as BoundingBoxResult +from groundlight_openapi_client.models.channel_enum import ChannelEnum as ChannelEnum +from groundlight_openapi_client.models.condition import Condition as Condition +from groundlight_openapi_client.models.condition_request import ConditionRequest as ConditionRequest +from groundlight_openapi_client.models.count_mode_configuration import CountModeConfiguration as CountModeConfiguration +from groundlight_openapi_client.models.counting_result import CountingResult as CountingResult +from groundlight_openapi_client.models.detector_creation_input_request_mode_configuration import ( + DetectorCreationInputRequestModeConfiguration as DetectorCreationInputRequestModeConfiguration, +) +from groundlight_openapi_client.models.detector_group import DetectorGroup as DetectorGroup +from groundlight_openapi_client.models.detector_group_request import DetectorGroupRequest as DetectorGroupRequest +from groundlight_openapi_client.models.detector_type_enum import DetectorTypeEnum as DetectorTypeEnum +from groundlight_openapi_client.models.edge_model_info import EdgeModelInfo as EdgeModelInfo +from groundlight_openapi_client.models.escalation_type_enum import EscalationTypeEnum as EscalationTypeEnum +from groundlight_openapi_client.models.get_detector_evaluation200_response import ( + GetDetectorEvaluation200Response as GetDetectorEvaluation200Response, +) +from groundlight_openapi_client.models.get_detector_evaluation200_response_evaluation_results import ( + GetDetectorEvaluation200ResponseEvaluationResults as GetDetectorEvaluation200ResponseEvaluationResults, +) +from groundlight_openapi_client.models.get_detector_metrics200_response import ( + GetDetectorMetrics200Response as GetDetectorMetrics200Response, +) +from groundlight_openapi_client.models.get_detector_metrics200_response_summary import ( + GetDetectorMetrics200ResponseSummary as GetDetectorMetrics200ResponseSummary, +) +from groundlight_openapi_client.models.get_detector_metrics200_response_summary_class_counts import ( + GetDetectorMetrics200ResponseSummaryClassCounts as GetDetectorMetrics200ResponseSummaryClassCounts, +) +from groundlight_openapi_client.models.image_query_result import ImageQueryResult as ImageQueryResult +from groundlight_openapi_client.models.image_query_type_enum import ImageQueryTypeEnum as ImageQueryTypeEnum +from groundlight_openapi_client.models.label import Label as Label +from groundlight_openapi_client.models.label_value import LabelValue as LabelValue +from groundlight_openapi_client.models.label_value_request import LabelValueRequest as LabelValueRequest +from groundlight_openapi_client.models.mode_enum import ModeEnum as ModeEnum +from groundlight_openapi_client.models.multi_class_mode_configuration import ( + MultiClassModeConfiguration as MultiClassModeConfiguration, +) +from groundlight_openapi_client.models.multi_classification_result import ( + MultiClassificationResult as MultiClassificationResult, +) +from groundlight_openapi_client.models.note import Note as Note +from groundlight_openapi_client.models.note_request import NoteRequest as NoteRequest +from groundlight_openapi_client.models.paginated_detector_list import PaginatedDetectorList as PaginatedDetectorList +from groundlight_openapi_client.models.paginated_image_query_list import ( + PaginatedImageQueryList as PaginatedImageQueryList, +) +from groundlight_openapi_client.models.paginated_rule_list import PaginatedRuleList as PaginatedRuleList +from groundlight_openapi_client.models.payload_template import PayloadTemplate as PayloadTemplate +from groundlight_openapi_client.models.payload_template_request import PayloadTemplateRequest as PayloadTemplateRequest +from groundlight_openapi_client.models.roi import ROI as ROI +from groundlight_openapi_client.models.roi_request import ROIRequest as ROIRequest +from groundlight_openapi_client.models.result_type_enum import ResultTypeEnum as ResultTypeEnum +from groundlight_openapi_client.models.rule import Rule as Rule +from groundlight_openapi_client.models.rule_action import RuleAction as RuleAction +from groundlight_openapi_client.models.rule_request import RuleRequest as RuleRequest +from groundlight_openapi_client.models.snooze_time_unit_enum import SnoozeTimeUnitEnum as SnoozeTimeUnitEnum +from groundlight_openapi_client.models.source import Source as Source +from groundlight_openapi_client.models.source_enum import SourceEnum as SourceEnum +from groundlight_openapi_client.models.status_enum import StatusEnum as StatusEnum +from groundlight_openapi_client.models.text_mode_configuration import TextModeConfiguration as TextModeConfiguration +from groundlight_openapi_client.models.text_recognition_result import TextRecognitionResult as TextRecognitionResult +from groundlight_openapi_client.models.verb_enum import VerbEnum as VerbEnum +from groundlight_openapi_client.models.webhook_action import WebhookAction as WebhookAction +from groundlight_openapi_client.models.webhook_action_request import WebhookActionRequest as WebhookActionRequest +from groundlight_openapi_client.models.who_am_i200_response import WhoAmI200Response as WhoAmI200Response diff --git a/generated/groundlight_openapi_client/api/__init__.py b/generated/groundlight_openapi_client/api/__init__.py index 895d519d..5b493285 100644 --- a/generated/groundlight_openapi_client/api/__init__.py +++ b/generated/groundlight_openapi_client/api/__init__.py @@ -1,3 +1,13 @@ -# do not import all apis into this module because that uses a lot of memory and stack frames -# if you need the ability to import all apis from one package, import them with -# from groundlight_openapi_client.apis import ActionsApi +# flake8: noqa + +# import apis into api package +from groundlight_openapi_client.api.actions_api import ActionsApi +from groundlight_openapi_client.api.detector_groups_api import DetectorGroupsApi +from groundlight_openapi_client.api.detector_reset_api import DetectorResetApi +from groundlight_openapi_client.api.detectors_api import DetectorsApi +from groundlight_openapi_client.api.edge_api import EdgeApi +from groundlight_openapi_client.api.image_queries_api import ImageQueriesApi +from groundlight_openapi_client.api.labels_api import LabelsApi +from groundlight_openapi_client.api.month_to_date_account_info_api import MonthToDateAccountInfoApi +from groundlight_openapi_client.api.notes_api import NotesApi +from groundlight_openapi_client.api.user_api import UserApi diff --git a/generated/groundlight_openapi_client/api/actions_api.py b/generated/groundlight_openapi_client/api/actions_api.py index b4d3ebd2..f952e2ce 100644 --- a/generated/groundlight_openapi_client/api/actions_api.py +++ b/generated/groundlight_openapi_client/api/actions_api.py @@ -1,551 +1,1251 @@ +# coding: utf-8 + """ Groundlight API - Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. # noqa: E501 + Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. The version of the OpenAPI document: 0.18.2 Contact: support@groundlight.ai - Generated by: https://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated -import re # noqa: F401 -import sys # noqa: F401 - -from groundlight_openapi_client.api_client import ApiClient, Endpoint as _Endpoint -from groundlight_openapi_client.model_utils import ( # noqa: F401 - check_allowed_values, - check_validations, - date, - datetime, - file_type, - none_type, - validate_and_convert_types, -) -from groundlight_openapi_client.model.paginated_rule_list import PaginatedRuleList -from groundlight_openapi_client.model.rule import Rule -from groundlight_openapi_client.model.rule_request import RuleRequest - - -class ActionsApi(object): +from pydantic import Field, StrictInt, StrictStr +from typing import Optional +from typing_extensions import Annotated +from groundlight_openapi_client.models.paginated_rule_list import PaginatedRuleList +from groundlight_openapi_client.models.rule import Rule +from groundlight_openapi_client.models.rule_request import RuleRequest + +from groundlight_openapi_client.api_client import ApiClient, RequestSerialized +from groundlight_openapi_client.api_response import ApiResponse +from groundlight_openapi_client.rest import RESTResponseType + + +class ActionsApi: """NOTE: This class is auto generated by OpenAPI Generator Ref: https://openapi-generator.tech Do not edit the class manually. """ - def __init__(self, api_client=None): + def __init__(self, api_client=None) -> None: if api_client is None: - api_client = ApiClient() + api_client = ApiClient.get_default() self.api_client = api_client - self.create_rule_endpoint = _Endpoint( - settings={ - "response_type": (Rule,), - "auth": ["ApiToken"], - "endpoint_path": "/v1/actions/detector/{detector_id}/rules", - "operation_id": "create_rule", - "http_method": "POST", - "servers": None, - }, - params_map={ - "all": [ - "detector_id", - "rule_request", - ], - "required": [ - "detector_id", - "rule_request", - ], - "nullable": [], - "enum": [], - "validation": [], - }, - root_map={ - "validations": {}, - "allowed_values": {}, - "openapi_types": { - "detector_id": (str,), - "rule_request": (RuleRequest,), - }, - "attribute_map": { - "detector_id": "detector_id", - }, - "location_map": { - "detector_id": "path", - "rule_request": "body", - }, - "collection_format_map": {}, - }, - headers_map={ - "accept": ["application/json"], - "content_type": ["application/json", "application/x-www-form-urlencoded", "multipart/form-data"], - }, - api_client=api_client, + + @validate_call + def create_rule( + self, + detector_id: StrictStr, + rule_request: RuleRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> Rule: + """create_rule + + Create a new rule for a detector + + :param detector_id: (required) + :type detector_id: str + :param rule_request: (required) + :type rule_request: RuleRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_rule_serialize( + detector_id=detector_id, + rule_request=rule_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "201": "Rule", + } + response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call + def create_rule_with_http_info( + self, + detector_id: StrictStr, + rule_request: RuleRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[Rule]: + """create_rule + + Create a new rule for a detector + + :param detector_id: (required) + :type detector_id: str + :param rule_request: (required) + :type rule_request: RuleRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_rule_serialize( + detector_id=detector_id, + rule_request=rule_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "201": "Rule", + } + response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + def create_rule_without_preload_content( + self, + detector_id: StrictStr, + rule_request: RuleRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """create_rule + + Create a new rule for a detector + + :param detector_id: (required) + :type detector_id: str + :param rule_request: (required) + :type rule_request: RuleRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_rule_serialize( + detector_id=detector_id, + rule_request=rule_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "201": "Rule", + } + response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + return response_data.response + + def _create_rule_serialize( + self, + detector_id, + rule_request, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if detector_id is not None: + _path_params["detector_id"] = detector_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if rule_request is not None: + _body_params = rule_request + + # set the HTTP header `Accept` + if "Accept" not in _header_params: + _header_params["Accept"] = self.api_client.select_header_accept(["application/json"]) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params["Content-Type"] = _content_type + else: + _default_content_type = self.api_client.select_header_content_type( + ["application/json", "application/x-www-form-urlencoded", "multipart/form-data"] + ) + if _default_content_type is not None: + _header_params["Content-Type"] = _default_content_type + + # authentication setting + _auth_settings: List[str] = ["ApiToken"] + + return self.api_client.param_serialize( + method="POST", + resource_path="/v1/actions/detector/{detector_id}/rules", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth, + ) + + @validate_call + def delete_rule( + self, + id: StrictInt, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """delete_rule + + Delete a rule + + :param id: (required) + :type id: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_rule_serialize( + id=id, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + "204": None, + } + response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call + def delete_rule_with_http_info( + self, + id: StrictInt, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """delete_rule + + Delete a rule + + :param id: (required) + :type id: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_rule_serialize( + id=id, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + "204": None, + } + response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + def delete_rule_without_preload_content( + self, + id: StrictInt, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """delete_rule + + Delete a rule + + :param id: (required) + :type id: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_rule_serialize( + id=id, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + "204": None, + } + response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + return response_data.response + + def _delete_rule_serialize( + self, + id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if id is not None: + _path_params["id"] = id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + # authentication setting + _auth_settings: List[str] = ["ApiToken"] + + return self.api_client.param_serialize( + method="DELETE", + resource_path="/v1/actions/rules/{id}", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth, + ) + + @validate_call + def get_rule( + self, + id: StrictInt, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> Rule: + """get_rule + + Retrieve a rule + + :param id: (required) + :type id: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_rule_serialize( + id=id, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "Rule", + } + response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call + def get_rule_with_http_info( + self, + id: StrictInt, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[Rule]: + """get_rule + + Retrieve a rule + + :param id: (required) + :type id: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_rule_serialize( + id=id, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "Rule", + } + response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, ) - self.delete_rule_endpoint = _Endpoint( - settings={ - "response_type": None, - "auth": ["ApiToken"], - "endpoint_path": "/v1/actions/rules/{id}", - "operation_id": "delete_rule", - "http_method": "DELETE", - "servers": None, - }, - params_map={ - "all": [ - "id", - ], - "required": [ - "id", - ], - "nullable": [], - "enum": [], - "validation": [], - }, - root_map={ - "validations": {}, - "allowed_values": {}, - "openapi_types": { - "id": (int,), - }, - "attribute_map": { - "id": "id", - }, - "location_map": { - "id": "path", - }, - "collection_format_map": {}, - }, - headers_map={ - "accept": [], - "content_type": [], - }, - api_client=api_client, + + @validate_call + def get_rule_without_preload_content( + self, + id: StrictInt, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """get_rule + + Retrieve a rule + + :param id: (required) + :type id: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_rule_serialize( + id=id, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "Rule", + } + response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + return response_data.response + + def _get_rule_serialize( + self, + id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if id is not None: + _path_params["id"] = id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + # set the HTTP header `Accept` + if "Accept" not in _header_params: + _header_params["Accept"] = self.api_client.select_header_accept(["application/json"]) + + # authentication setting + _auth_settings: List[str] = ["ApiToken"] + + return self.api_client.param_serialize( + method="GET", + resource_path="/v1/actions/rules/{id}", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth, + ) + + @validate_call + def list_detector_rules( + self, + detector_id: StrictStr, + page: Annotated[ + Optional[StrictInt], Field(description="A page number within the paginated result set.") + ] = None, + page_size: Annotated[Optional[StrictInt], Field(description="Number of results to return per page.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> PaginatedRuleList: + """list_detector_rules + + List all rules for a detector + + :param detector_id: (required) + :type detector_id: str + :param page: A page number within the paginated result set. + :type page: int + :param page_size: Number of results to return per page. + :type page_size: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_detector_rules_serialize( + detector_id=detector_id, + page=page, + page_size=page_size, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "PaginatedRuleList", + } + response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call + def list_detector_rules_with_http_info( + self, + detector_id: StrictStr, + page: Annotated[ + Optional[StrictInt], Field(description="A page number within the paginated result set.") + ] = None, + page_size: Annotated[Optional[StrictInt], Field(description="Number of results to return per page.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[PaginatedRuleList]: + """list_detector_rules + + List all rules for a detector + + :param detector_id: (required) + :type detector_id: str + :param page: A page number within the paginated result set. + :type page: int + :param page_size: Number of results to return per page. + :type page_size: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_detector_rules_serialize( + detector_id=detector_id, + page=page, + page_size=page_size, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "PaginatedRuleList", + } + response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + def list_detector_rules_without_preload_content( + self, + detector_id: StrictStr, + page: Annotated[ + Optional[StrictInt], Field(description="A page number within the paginated result set.") + ] = None, + page_size: Annotated[Optional[StrictInt], Field(description="Number of results to return per page.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """list_detector_rules + + List all rules for a detector + + :param detector_id: (required) + :type detector_id: str + :param page: A page number within the paginated result set. + :type page: int + :param page_size: Number of results to return per page. + :type page_size: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_detector_rules_serialize( + detector_id=detector_id, + page=page, + page_size=page_size, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "PaginatedRuleList", + } + response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + return response_data.response + + def _list_detector_rules_serialize( + self, + detector_id, + page, + page_size, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if detector_id is not None: + _path_params["detector_id"] = detector_id + # process the query parameters + if page is not None: + + _query_params.append(("page", page)) + + if page_size is not None: + + _query_params.append(("page_size", page_size)) + + # process the header parameters + # process the form parameters + # process the body parameter + + # set the HTTP header `Accept` + if "Accept" not in _header_params: + _header_params["Accept"] = self.api_client.select_header_accept(["application/json"]) + + # authentication setting + _auth_settings: List[str] = ["ApiToken"] + + return self.api_client.param_serialize( + method="GET", + resource_path="/v1/actions/detector/{detector_id}/rules", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth, ) - self.get_rule_endpoint = _Endpoint( - settings={ - "response_type": (Rule,), - "auth": ["ApiToken"], - "endpoint_path": "/v1/actions/rules/{id}", - "operation_id": "get_rule", - "http_method": "GET", - "servers": None, - }, - params_map={ - "all": [ - "id", - ], - "required": [ - "id", - ], - "nullable": [], - "enum": [], - "validation": [], - }, - root_map={ - "validations": {}, - "allowed_values": {}, - "openapi_types": { - "id": (int,), - }, - "attribute_map": { - "id": "id", - }, - "location_map": { - "id": "path", - }, - "collection_format_map": {}, - }, - headers_map={ - "accept": ["application/json"], - "content_type": [], - }, - api_client=api_client, + + @validate_call + def list_rules( + self, + page: Annotated[ + Optional[StrictInt], Field(description="A page number within the paginated result set.") + ] = None, + page_size: Annotated[Optional[StrictInt], Field(description="Number of results to return per page.")] = None, + predictor_id: Annotated[Optional[StrictStr], Field(description="Filter rules by predictor ID")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> PaginatedRuleList: + """list_rules + + Lists all rules over all detectors owned by the requester. + + :param page: A page number within the paginated result set. + :type page: int + :param page_size: Number of results to return per page. + :type page_size: int + :param predictor_id: Filter rules by predictor ID + :type predictor_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_rules_serialize( + page=page, + page_size=page_size, + predictor_id=predictor_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, ) - self.list_detector_rules_endpoint = _Endpoint( - settings={ - "response_type": (PaginatedRuleList,), - "auth": ["ApiToken"], - "endpoint_path": "/v1/actions/detector/{detector_id}/rules", - "operation_id": "list_detector_rules", - "http_method": "GET", - "servers": None, - }, - params_map={ - "all": [ - "detector_id", - "page", - "page_size", - ], - "required": [ - "detector_id", - ], - "nullable": [], - "enum": [], - "validation": [], - }, - root_map={ - "validations": {}, - "allowed_values": {}, - "openapi_types": { - "detector_id": (str,), - "page": (int,), - "page_size": (int,), - }, - "attribute_map": { - "detector_id": "detector_id", - "page": "page", - "page_size": "page_size", - }, - "location_map": { - "detector_id": "path", - "page": "query", - "page_size": "query", - }, - "collection_format_map": {}, - }, - headers_map={ - "accept": ["application/json"], - "content_type": [], - }, - api_client=api_client, + + _response_types_map: Dict[str, Optional[str]] = { + "200": "PaginatedRuleList", + } + response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call + def list_rules_with_http_info( + self, + page: Annotated[ + Optional[StrictInt], Field(description="A page number within the paginated result set.") + ] = None, + page_size: Annotated[Optional[StrictInt], Field(description="Number of results to return per page.")] = None, + predictor_id: Annotated[Optional[StrictStr], Field(description="Filter rules by predictor ID")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[PaginatedRuleList]: + """list_rules + + Lists all rules over all detectors owned by the requester. + + :param page: A page number within the paginated result set. + :type page: int + :param page_size: Number of results to return per page. + :type page_size: int + :param predictor_id: Filter rules by predictor ID + :type predictor_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_rules_serialize( + page=page, + page_size=page_size, + predictor_id=predictor_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "PaginatedRuleList", + } + response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, ) - self.list_rules_endpoint = _Endpoint( - settings={ - "response_type": (PaginatedRuleList,), - "auth": ["ApiToken"], - "endpoint_path": "/v1/actions/rules", - "operation_id": "list_rules", - "http_method": "GET", - "servers": None, - }, - params_map={ - "all": [ - "page", - "page_size", - "predictor_id", - ], - "required": [], - "nullable": [], - "enum": [], - "validation": [], - }, - root_map={ - "validations": {}, - "allowed_values": {}, - "openapi_types": { - "page": (int,), - "page_size": (int,), - "predictor_id": (str,), - }, - "attribute_map": { - "page": "page", - "page_size": "page_size", - "predictor_id": "predictor_id", - }, - "location_map": { - "page": "query", - "page_size": "query", - "predictor_id": "query", - }, - "collection_format_map": {}, - }, - headers_map={ - "accept": ["application/json"], - "content_type": [], - }, - api_client=api_client, + + @validate_call + def list_rules_without_preload_content( + self, + page: Annotated[ + Optional[StrictInt], Field(description="A page number within the paginated result set.") + ] = None, + page_size: Annotated[Optional[StrictInt], Field(description="Number of results to return per page.")] = None, + predictor_id: Annotated[Optional[StrictStr], Field(description="Filter rules by predictor ID")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """list_rules + + Lists all rules over all detectors owned by the requester. + + :param page: A page number within the paginated result set. + :type page: int + :param page_size: Number of results to return per page. + :type page_size: int + :param predictor_id: Filter rules by predictor ID + :type predictor_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_rules_serialize( + page=page, + page_size=page_size, + predictor_id=predictor_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, ) - def create_rule(self, detector_id, rule_request, **kwargs): - """create_rule # noqa: E501 - - Create a new rule for a detector # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.create_rule(detector_id, rule_request, async_req=True) - >>> result = thread.get() - - Args: - detector_id (str): - rule_request (RuleRequest): - - Keyword Args: - _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 - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - Rule - If the method is called asynchronously, returns the request - thread. - """ - kwargs["async_req"] = kwargs.get("async_req", False) - kwargs["_return_http_data_only"] = kwargs.get("_return_http_data_only", True) - kwargs["_preload_content"] = kwargs.get("_preload_content", True) - kwargs["_request_timeout"] = kwargs.get("_request_timeout", None) - kwargs["_check_input_type"] = kwargs.get("_check_input_type", True) - kwargs["_check_return_type"] = kwargs.get("_check_return_type", True) - kwargs["_spec_property_naming"] = kwargs.get("_spec_property_naming", False) - kwargs["_content_type"] = kwargs.get("_content_type") - kwargs["_host_index"] = kwargs.get("_host_index") - kwargs["detector_id"] = detector_id - kwargs["rule_request"] = rule_request - return self.create_rule_endpoint.call_with_http_info(**kwargs) - - def delete_rule(self, id, **kwargs): - """delete_rule # noqa: E501 - - Delete a rule # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.delete_rule(id, async_req=True) - >>> result = thread.get() - - Args: - id (int): - - Keyword Args: - _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 - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - None - If the method is called asynchronously, returns the request - thread. - """ - kwargs["async_req"] = kwargs.get("async_req", False) - kwargs["_return_http_data_only"] = kwargs.get("_return_http_data_only", True) - kwargs["_preload_content"] = kwargs.get("_preload_content", True) - kwargs["_request_timeout"] = kwargs.get("_request_timeout", None) - kwargs["_check_input_type"] = kwargs.get("_check_input_type", True) - kwargs["_check_return_type"] = kwargs.get("_check_return_type", True) - kwargs["_spec_property_naming"] = kwargs.get("_spec_property_naming", False) - kwargs["_content_type"] = kwargs.get("_content_type") - kwargs["_host_index"] = kwargs.get("_host_index") - kwargs["id"] = id - return self.delete_rule_endpoint.call_with_http_info(**kwargs) - - def get_rule(self, id, **kwargs): - """get_rule # noqa: E501 - - Retrieve a rule # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.get_rule(id, async_req=True) - >>> result = thread.get() - - Args: - id (int): - - Keyword Args: - _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 - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - Rule - If the method is called asynchronously, returns the request - thread. - """ - kwargs["async_req"] = kwargs.get("async_req", False) - kwargs["_return_http_data_only"] = kwargs.get("_return_http_data_only", True) - kwargs["_preload_content"] = kwargs.get("_preload_content", True) - kwargs["_request_timeout"] = kwargs.get("_request_timeout", None) - kwargs["_check_input_type"] = kwargs.get("_check_input_type", True) - kwargs["_check_return_type"] = kwargs.get("_check_return_type", True) - kwargs["_spec_property_naming"] = kwargs.get("_spec_property_naming", False) - kwargs["_content_type"] = kwargs.get("_content_type") - kwargs["_host_index"] = kwargs.get("_host_index") - kwargs["id"] = id - return self.get_rule_endpoint.call_with_http_info(**kwargs) - - def list_detector_rules(self, detector_id, **kwargs): - """list_detector_rules # noqa: E501 - - List all rules for a detector # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.list_detector_rules(detector_id, async_req=True) - >>> result = thread.get() - - Args: - detector_id (str): - - Keyword Args: - page (int): A page number within the paginated result set.. [optional] - page_size (int): Number of results to return per page.. [optional] - _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 - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - PaginatedRuleList - If the method is called asynchronously, returns the request - thread. - """ - kwargs["async_req"] = kwargs.get("async_req", False) - kwargs["_return_http_data_only"] = kwargs.get("_return_http_data_only", True) - kwargs["_preload_content"] = kwargs.get("_preload_content", True) - kwargs["_request_timeout"] = kwargs.get("_request_timeout", None) - kwargs["_check_input_type"] = kwargs.get("_check_input_type", True) - kwargs["_check_return_type"] = kwargs.get("_check_return_type", True) - kwargs["_spec_property_naming"] = kwargs.get("_spec_property_naming", False) - kwargs["_content_type"] = kwargs.get("_content_type") - kwargs["_host_index"] = kwargs.get("_host_index") - kwargs["detector_id"] = detector_id - return self.list_detector_rules_endpoint.call_with_http_info(**kwargs) - - def list_rules(self, **kwargs): - """list_rules # noqa: E501 - - Lists all rules over all detectors owned by the requester. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.list_rules(async_req=True) - >>> result = thread.get() - - - Keyword Args: - page (int): A page number within the paginated result set.. [optional] - page_size (int): Number of results to return per page.. [optional] - predictor_id (str): Filter rules by predictor ID. [optional] - _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 - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - PaginatedRuleList - If the method is called asynchronously, returns the request - thread. - """ - kwargs["async_req"] = kwargs.get("async_req", False) - kwargs["_return_http_data_only"] = kwargs.get("_return_http_data_only", True) - kwargs["_preload_content"] = kwargs.get("_preload_content", True) - kwargs["_request_timeout"] = kwargs.get("_request_timeout", None) - kwargs["_check_input_type"] = kwargs.get("_check_input_type", True) - kwargs["_check_return_type"] = kwargs.get("_check_return_type", True) - kwargs["_spec_property_naming"] = kwargs.get("_spec_property_naming", False) - kwargs["_content_type"] = kwargs.get("_content_type") - kwargs["_host_index"] = kwargs.get("_host_index") - return self.list_rules_endpoint.call_with_http_info(**kwargs) + _response_types_map: Dict[str, Optional[str]] = { + "200": "PaginatedRuleList", + } + response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + return response_data.response + + def _list_rules_serialize( + self, + page, + page_size, + predictor_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + if page is not None: + + _query_params.append(("page", page)) + + if page_size is not None: + + _query_params.append(("page_size", page_size)) + + if predictor_id is not None: + + _query_params.append(("predictor_id", predictor_id)) + + # process the header parameters + # process the form parameters + # process the body parameter + + # set the HTTP header `Accept` + if "Accept" not in _header_params: + _header_params["Accept"] = self.api_client.select_header_accept(["application/json"]) + + # authentication setting + _auth_settings: List[str] = ["ApiToken"] + + return self.api_client.param_serialize( + method="GET", + resource_path="/v1/actions/rules", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth, + ) diff --git a/generated/groundlight_openapi_client/api/detector_groups_api.py b/generated/groundlight_openapi_client/api/detector_groups_api.py index 83a2cb4f..b4f15510 100644 --- a/generated/groundlight_openapi_client/api/detector_groups_api.py +++ b/generated/groundlight_openapi_client/api/detector_groups_api.py @@ -1,213 +1,477 @@ +# coding: utf-8 + """ Groundlight API - Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. # noqa: E501 + Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. The version of the OpenAPI document: 0.18.2 Contact: support@groundlight.ai - Generated by: https://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 -import re # noqa: F401 -import sys # noqa: F401 +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated -from groundlight_openapi_client.api_client import ApiClient, Endpoint as _Endpoint -from groundlight_openapi_client.model_utils import ( # noqa: F401 - check_allowed_values, - check_validations, - date, - datetime, - file_type, - none_type, - validate_and_convert_types, -) -from groundlight_openapi_client.model.detector_group import DetectorGroup -from groundlight_openapi_client.model.detector_group_request import DetectorGroupRequest +from typing import List +from groundlight_openapi_client.models.detector_group import DetectorGroup +from groundlight_openapi_client.models.detector_group_request import DetectorGroupRequest +from groundlight_openapi_client.api_client import ApiClient, RequestSerialized +from groundlight_openapi_client.api_response import ApiResponse +from groundlight_openapi_client.rest import RESTResponseType -class DetectorGroupsApi(object): + +class DetectorGroupsApi: """NOTE: This class is auto generated by OpenAPI Generator Ref: https://openapi-generator.tech Do not edit the class manually. """ - def __init__(self, api_client=None): + def __init__(self, api_client=None) -> None: if api_client is None: - api_client = ApiClient() + api_client = ApiClient.get_default() self.api_client = api_client - self.create_detector_group_endpoint = _Endpoint( - settings={ - "response_type": (DetectorGroup,), - "auth": ["ApiToken"], - "endpoint_path": "/v1/detector-groups", - "operation_id": "create_detector_group", - "http_method": "POST", - "servers": None, - }, - params_map={ - "all": [ - "detector_group_request", - ], - "required": [ - "detector_group_request", - ], - "nullable": [], - "enum": [], - "validation": [], - }, - root_map={ - "validations": {}, - "allowed_values": {}, - "openapi_types": { - "detector_group_request": (DetectorGroupRequest,), - }, - "attribute_map": {}, - "location_map": { - "detector_group_request": "body", - }, - "collection_format_map": {}, - }, - headers_map={ - "accept": ["application/json"], - "content_type": ["application/json", "application/x-www-form-urlencoded", "multipart/form-data"], - }, - api_client=api_client, + + @validate_call + def create_detector_group( + self, + detector_group_request: DetectorGroupRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> DetectorGroup: + """create_detector_group + + Create a new detector group POST data: Required: - name (str) - name of the predictor set + + :param detector_group_request: (required) + :type detector_group_request: DetectorGroupRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_detector_group_serialize( + detector_group_request=detector_group_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "201": "DetectorGroup", + } + response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call + def create_detector_group_with_http_info( + self, + detector_group_request: DetectorGroupRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[DetectorGroup]: + """create_detector_group + + Create a new detector group POST data: Required: - name (str) - name of the predictor set + + :param detector_group_request: (required) + :type detector_group_request: DetectorGroupRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_detector_group_serialize( + detector_group_request=detector_group_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, ) - self.get_detector_groups_endpoint = _Endpoint( - settings={ - "response_type": ([DetectorGroup],), - "auth": ["ApiToken"], - "endpoint_path": "/v1/detector-groups", - "operation_id": "get_detector_groups", - "http_method": "GET", - "servers": None, - }, - params_map={"all": [], "required": [], "nullable": [], "enum": [], "validation": []}, - root_map={ - "validations": {}, - "allowed_values": {}, - "openapi_types": {}, - "attribute_map": {}, - "location_map": {}, - "collection_format_map": {}, - }, - headers_map={ - "accept": ["application/json"], - "content_type": [], - }, - api_client=api_client, + + _response_types_map: Dict[str, Optional[str]] = { + "201": "DetectorGroup", + } + response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + def create_detector_group_without_preload_content( + self, + detector_group_request: DetectorGroupRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """create_detector_group + + Create a new detector group POST data: Required: - name (str) - name of the predictor set + + :param detector_group_request: (required) + :type detector_group_request: DetectorGroupRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_detector_group_serialize( + detector_group_request=detector_group_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, ) - def create_detector_group(self, detector_group_request, **kwargs): - """create_detector_group # noqa: E501 - - Create a new detector group POST data: Required: - name (str) - name of the predictor set # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.create_detector_group(detector_group_request, async_req=True) - >>> result = thread.get() - - Args: - detector_group_request (DetectorGroupRequest): - - Keyword Args: - _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 - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - DetectorGroup - If the method is called asynchronously, returns the request - thread. - """ - kwargs["async_req"] = kwargs.get("async_req", False) - kwargs["_return_http_data_only"] = kwargs.get("_return_http_data_only", True) - kwargs["_preload_content"] = kwargs.get("_preload_content", True) - kwargs["_request_timeout"] = kwargs.get("_request_timeout", None) - kwargs["_check_input_type"] = kwargs.get("_check_input_type", True) - kwargs["_check_return_type"] = kwargs.get("_check_return_type", True) - kwargs["_spec_property_naming"] = kwargs.get("_spec_property_naming", False) - kwargs["_content_type"] = kwargs.get("_content_type") - kwargs["_host_index"] = kwargs.get("_host_index") - kwargs["detector_group_request"] = detector_group_request - return self.create_detector_group_endpoint.call_with_http_info(**kwargs) - - def get_detector_groups(self, **kwargs): - """get_detector_groups # noqa: E501 - - List all detector groups # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.get_detector_groups(async_req=True) - >>> result = thread.get() - - - Keyword Args: - _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 - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - [DetectorGroup] - If the method is called asynchronously, returns the request - thread. - """ - kwargs["async_req"] = kwargs.get("async_req", False) - kwargs["_return_http_data_only"] = kwargs.get("_return_http_data_only", True) - kwargs["_preload_content"] = kwargs.get("_preload_content", True) - kwargs["_request_timeout"] = kwargs.get("_request_timeout", None) - kwargs["_check_input_type"] = kwargs.get("_check_input_type", True) - kwargs["_check_return_type"] = kwargs.get("_check_return_type", True) - kwargs["_spec_property_naming"] = kwargs.get("_spec_property_naming", False) - kwargs["_content_type"] = kwargs.get("_content_type") - kwargs["_host_index"] = kwargs.get("_host_index") - return self.get_detector_groups_endpoint.call_with_http_info(**kwargs) + _response_types_map: Dict[str, Optional[str]] = { + "201": "DetectorGroup", + } + response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + return response_data.response + + def _create_detector_group_serialize( + self, + detector_group_request, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if detector_group_request is not None: + _body_params = detector_group_request + + # set the HTTP header `Accept` + if "Accept" not in _header_params: + _header_params["Accept"] = self.api_client.select_header_accept(["application/json"]) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params["Content-Type"] = _content_type + else: + _default_content_type = self.api_client.select_header_content_type( + ["application/json", "application/x-www-form-urlencoded", "multipart/form-data"] + ) + if _default_content_type is not None: + _header_params["Content-Type"] = _default_content_type + + # authentication setting + _auth_settings: List[str] = ["ApiToken"] + + return self.api_client.param_serialize( + method="POST", + resource_path="/v1/detector-groups", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth, + ) + + @validate_call + def get_detector_groups( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> List[DetectorGroup]: + """get_detector_groups + + List all detector groups + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_detector_groups_serialize( + _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "List[DetectorGroup]", + } + response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call + def get_detector_groups_with_http_info( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[List[DetectorGroup]]: + """get_detector_groups + + List all detector groups + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_detector_groups_serialize( + _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "List[DetectorGroup]", + } + response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + def get_detector_groups_without_preload_content( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """get_detector_groups + + List all detector groups + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_detector_groups_serialize( + _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "List[DetectorGroup]", + } + response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + return response_data.response + + def _get_detector_groups_serialize( + self, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + # set the HTTP header `Accept` + if "Accept" not in _header_params: + _header_params["Accept"] = self.api_client.select_header_accept(["application/json"]) + + # authentication setting + _auth_settings: List[str] = ["ApiToken"] + + return self.api_client.param_serialize( + method="GET", + resource_path="/v1/detector-groups", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth, + ) diff --git a/generated/groundlight_openapi_client/api/detector_reset_api.py b/generated/groundlight_openapi_client/api/detector_reset_api.py index c50532f8..aa58a24c 100644 --- a/generated/groundlight_openapi_client/api/detector_reset_api.py +++ b/generated/groundlight_openapi_client/api/detector_reset_api.py @@ -1,134 +1,247 @@ +# coding: utf-8 + """ Groundlight API - Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. # noqa: E501 + Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. The version of the OpenAPI document: 0.18.2 Contact: support@groundlight.ai - Generated by: https://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 -import re # noqa: F401 -import sys # noqa: F401 +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated -from groundlight_openapi_client.api_client import ApiClient, Endpoint as _Endpoint -from groundlight_openapi_client.model_utils import ( # noqa: F401 - check_allowed_values, - check_validations, - date, - datetime, - file_type, - none_type, - validate_and_convert_types, -) +from pydantic import StrictStr +from groundlight_openapi_client.api_client import ApiClient, RequestSerialized +from groundlight_openapi_client.api_response import ApiResponse +from groundlight_openapi_client.rest import RESTResponseType -class DetectorResetApi(object): + +class DetectorResetApi: """NOTE: This class is auto generated by OpenAPI Generator Ref: https://openapi-generator.tech Do not edit the class manually. """ - def __init__(self, api_client=None): + def __init__(self, api_client=None) -> None: if api_client is None: - api_client = ApiClient() + api_client = ApiClient.get_default() self.api_client = api_client - self.reset_detector_endpoint = _Endpoint( - settings={ - "response_type": None, - "auth": ["ApiToken"], - "endpoint_path": "/v1/detector-reset/{id}", - "operation_id": "reset_detector", - "http_method": "DELETE", - "servers": None, - }, - params_map={ - "all": [ - "id", - ], - "required": [ - "id", - ], - "nullable": [], - "enum": [], - "validation": [], - }, - root_map={ - "validations": {}, - "allowed_values": {}, - "openapi_types": { - "id": (str,), - }, - "attribute_map": { - "id": "id", - }, - "location_map": { - "id": "path", - }, - "collection_format_map": {}, - }, - headers_map={ - "accept": [], - "content_type": [], - }, - api_client=api_client, + + @validate_call + def reset_detector( + self, + id: StrictStr, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """reset_detector + + Deletes all image queries on the detector + + :param id: (required) + :type id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._reset_detector_serialize( + id=id, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + "204": None, + } + response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call + def reset_detector_with_http_info( + self, + id: StrictStr, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """reset_detector + + Deletes all image queries on the detector + + :param id: (required) + :type id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._reset_detector_serialize( + id=id, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, _host_index=_host_index ) - def reset_detector(self, id, **kwargs): - """reset_detector # noqa: E501 - - Deletes all image queries on the detector # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.reset_detector(id, async_req=True) - >>> result = thread.get() - - Args: - id (str): - - Keyword Args: - _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 - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - None - If the method is called asynchronously, returns the request - thread. - """ - kwargs["async_req"] = kwargs.get("async_req", False) - kwargs["_return_http_data_only"] = kwargs.get("_return_http_data_only", True) - kwargs["_preload_content"] = kwargs.get("_preload_content", True) - kwargs["_request_timeout"] = kwargs.get("_request_timeout", None) - kwargs["_check_input_type"] = kwargs.get("_check_input_type", True) - kwargs["_check_return_type"] = kwargs.get("_check_return_type", True) - kwargs["_spec_property_naming"] = kwargs.get("_spec_property_naming", False) - kwargs["_content_type"] = kwargs.get("_content_type") - kwargs["_host_index"] = kwargs.get("_host_index") - kwargs["id"] = id - return self.reset_detector_endpoint.call_with_http_info(**kwargs) + _response_types_map: Dict[str, Optional[str]] = { + "204": None, + } + response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + def reset_detector_without_preload_content( + self, + id: StrictStr, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """reset_detector + + Deletes all image queries on the detector + + :param id: (required) + :type id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._reset_detector_serialize( + id=id, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + "204": None, + } + response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + return response_data.response + + def _reset_detector_serialize( + self, + id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if id is not None: + _path_params["id"] = id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + # authentication setting + _auth_settings: List[str] = ["ApiToken"] + + return self.api_client.param_serialize( + method="DELETE", + resource_path="/v1/detector-reset/{id}", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth, + ) diff --git a/generated/groundlight_openapi_client/api/detectors_api.py b/generated/groundlight_openapi_client/api/detectors_api.py index eca18f45..617ea594 100644 --- a/generated/groundlight_openapi_client/api/detectors_api.py +++ b/generated/groundlight_openapi_client/api/detectors_api.py @@ -1,728 +1,1645 @@ +# coding: utf-8 + """ Groundlight API - Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. # noqa: E501 + Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. The version of the OpenAPI document: 0.18.2 Contact: support@groundlight.ai - Generated by: https://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated + +from pydantic import Field, StrictInt, StrictStr +from typing import Optional +from typing_extensions import Annotated +from groundlight_openapi_client.models.detector import Detector +from groundlight_openapi_client.models.detector_creation_input_request import DetectorCreationInputRequest +from groundlight_openapi_client.models.get_detector_evaluation200_response import GetDetectorEvaluation200Response +from groundlight_openapi_client.models.get_detector_metrics200_response import GetDetectorMetrics200Response +from groundlight_openapi_client.models.paginated_detector_list import PaginatedDetectorList +from groundlight_openapi_client.models.patched_detector_request import PatchedDetectorRequest + +from groundlight_openapi_client.api_client import ApiClient, RequestSerialized +from groundlight_openapi_client.api_response import ApiResponse +from groundlight_openapi_client.rest import RESTResponseType -import re # noqa: F401 -import sys # noqa: F401 - -from groundlight_openapi_client.api_client import ApiClient, Endpoint as _Endpoint -from groundlight_openapi_client.model_utils import ( # noqa: F401 - check_allowed_values, - check_validations, - date, - datetime, - file_type, - none_type, - validate_and_convert_types, -) -from groundlight_openapi_client.model.detector import Detector -from groundlight_openapi_client.model.detector_creation_input_request import DetectorCreationInputRequest -from groundlight_openapi_client.model.inline_response200 import InlineResponse200 -from groundlight_openapi_client.model.inline_response2001 import InlineResponse2001 -from groundlight_openapi_client.model.paginated_detector_list import PaginatedDetectorList -from groundlight_openapi_client.model.patched_detector_request import PatchedDetectorRequest - - -class DetectorsApi(object): + +class DetectorsApi: """NOTE: This class is auto generated by OpenAPI Generator Ref: https://openapi-generator.tech Do not edit the class manually. """ - def __init__(self, api_client=None): + def __init__(self, api_client=None) -> None: if api_client is None: - api_client = ApiClient() + api_client = ApiClient.get_default() self.api_client = api_client - self.create_detector_endpoint = _Endpoint( - settings={ - "response_type": (Detector,), - "auth": ["ApiToken"], - "endpoint_path": "/v1/detectors", - "operation_id": "create_detector", - "http_method": "POST", - "servers": None, - }, - params_map={ - "all": [ - "detector_creation_input_request", - ], - "required": [ - "detector_creation_input_request", - ], - "nullable": [], - "enum": [], - "validation": [], - }, - root_map={ - "validations": {}, - "allowed_values": {}, - "openapi_types": { - "detector_creation_input_request": (DetectorCreationInputRequest,), - }, - "attribute_map": {}, - "location_map": { - "detector_creation_input_request": "body", - }, - "collection_format_map": {}, - }, - headers_map={"accept": ["application/json"], "content_type": ["application/json"]}, - api_client=api_client, - ) - self.delete_detector_endpoint = _Endpoint( - settings={ - "response_type": None, - "auth": ["ApiToken"], - "endpoint_path": "/v1/detectors/{id}", - "operation_id": "delete_detector", - "http_method": "DELETE", - "servers": None, - }, - params_map={ - "all": [ - "id", - ], - "required": [ - "id", - ], - "nullable": [], - "enum": [], - "validation": [], - }, - root_map={ - "validations": {}, - "allowed_values": {}, - "openapi_types": { - "id": (str,), - }, - "attribute_map": { - "id": "id", - }, - "location_map": { - "id": "path", - }, - "collection_format_map": {}, - }, - headers_map={ - "accept": [], - "content_type": [], - }, - api_client=api_client, - ) - self.get_detector_endpoint = _Endpoint( - settings={ - "response_type": (Detector,), - "auth": ["ApiToken"], - "endpoint_path": "/v1/detectors/{id}", - "operation_id": "get_detector", - "http_method": "GET", - "servers": None, - }, - params_map={ - "all": [ - "id", - ], - "required": [ - "id", - ], - "nullable": [], - "enum": [], - "validation": [], - }, - root_map={ - "validations": {}, - "allowed_values": {}, - "openapi_types": { - "id": (str,), - }, - "attribute_map": { - "id": "id", - }, - "location_map": { - "id": "path", - }, - "collection_format_map": {}, - }, - headers_map={ - "accept": ["application/json"], - "content_type": [], - }, - api_client=api_client, - ) - self.get_detector_evaluation_endpoint = _Endpoint( - settings={ - "response_type": (InlineResponse2001,), - "auth": ["ApiToken"], - "endpoint_path": "/v1/detectors/{id}/evaluation", - "operation_id": "get_detector_evaluation", - "http_method": "GET", - "servers": None, - }, - params_map={ - "all": [ - "id", - ], - "required": [ - "id", - ], - "nullable": [], - "enum": [], - "validation": [], - }, - root_map={ - "validations": {}, - "allowed_values": {}, - "openapi_types": { - "id": (str,), - }, - "attribute_map": { - "id": "id", - }, - "location_map": { - "id": "path", - }, - "collection_format_map": {}, - }, - headers_map={ - "accept": ["application/json"], - "content_type": [], - }, - api_client=api_client, - ) - self.get_detector_metrics_endpoint = _Endpoint( - settings={ - "response_type": (InlineResponse200,), - "auth": ["ApiToken"], - "endpoint_path": "/v1/detectors/{detector_id}/metrics", - "operation_id": "get_detector_metrics", - "http_method": "GET", - "servers": None, - }, - params_map={ - "all": [ - "detector_id", - ], - "required": [ - "detector_id", - ], - "nullable": [], - "enum": [], - "validation": [], - }, - root_map={ - "validations": {}, - "allowed_values": {}, - "openapi_types": { - "detector_id": (str,), - }, - "attribute_map": { - "detector_id": "detector_id", - }, - "location_map": { - "detector_id": "path", - }, - "collection_format_map": {}, - }, - headers_map={ - "accept": ["application/json"], - "content_type": [], - }, - api_client=api_client, - ) - self.list_detectors_endpoint = _Endpoint( - settings={ - "response_type": (PaginatedDetectorList,), - "auth": ["ApiToken"], - "endpoint_path": "/v1/detectors", - "operation_id": "list_detectors", - "http_method": "GET", - "servers": None, - }, - params_map={ - "all": [ - "page", - "page_size", - ], - "required": [], - "nullable": [], - "enum": [], - "validation": [], - }, - root_map={ - "validations": {}, - "allowed_values": {}, - "openapi_types": { - "page": (int,), - "page_size": (int,), - }, - "attribute_map": { - "page": "page", - "page_size": "page_size", - }, - "location_map": { - "page": "query", - "page_size": "query", - }, - "collection_format_map": {}, - }, - headers_map={ - "accept": ["application/json"], - "content_type": [], - }, - api_client=api_client, - ) - self.update_detector_endpoint = _Endpoint( - settings={ - "response_type": (Detector,), - "auth": ["ApiToken"], - "endpoint_path": "/v1/detectors/{id}", - "operation_id": "update_detector", - "http_method": "PATCH", - "servers": None, - }, - params_map={ - "all": [ - "id", - "patched_detector_request", - ], - "required": [ - "id", - ], - "nullable": [], - "enum": [], - "validation": [], - }, - root_map={ - "validations": {}, - "allowed_values": {}, - "openapi_types": { - "id": (str,), - "patched_detector_request": (PatchedDetectorRequest,), - }, - "attribute_map": { - "id": "id", - }, - "location_map": { - "id": "path", - "patched_detector_request": "body", - }, - "collection_format_map": {}, - }, - headers_map={ - "accept": ["application/json"], - "content_type": ["application/json", "application/x-www-form-urlencoded", "multipart/form-data"], - }, - api_client=api_client, - ) - - def create_detector(self, detector_creation_input_request, **kwargs): - """create_detector # noqa: E501 - - Create a new detector. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.create_detector(detector_creation_input_request, async_req=True) - >>> result = thread.get() - - Args: - detector_creation_input_request (DetectorCreationInputRequest): - - Keyword Args: - _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 - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - Detector - If the method is called asynchronously, returns the request - thread. - """ - kwargs["async_req"] = kwargs.get("async_req", False) - kwargs["_return_http_data_only"] = kwargs.get("_return_http_data_only", True) - kwargs["_preload_content"] = kwargs.get("_preload_content", True) - kwargs["_request_timeout"] = kwargs.get("_request_timeout", None) - kwargs["_check_input_type"] = kwargs.get("_check_input_type", True) - kwargs["_check_return_type"] = kwargs.get("_check_return_type", True) - kwargs["_spec_property_naming"] = kwargs.get("_spec_property_naming", False) - kwargs["_content_type"] = kwargs.get("_content_type") - kwargs["_host_index"] = kwargs.get("_host_index") - kwargs["detector_creation_input_request"] = detector_creation_input_request - return self.create_detector_endpoint.call_with_http_info(**kwargs) - - def delete_detector(self, id, **kwargs): - """delete_detector # noqa: E501 - - Delete a detector by its ID. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.delete_detector(id, async_req=True) - >>> result = thread.get() - - Args: - id (str): Choose a detector by its ID. - - Keyword Args: - _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 - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - None - If the method is called asynchronously, returns the request - thread. - """ - kwargs["async_req"] = kwargs.get("async_req", False) - kwargs["_return_http_data_only"] = kwargs.get("_return_http_data_only", True) - kwargs["_preload_content"] = kwargs.get("_preload_content", True) - kwargs["_request_timeout"] = kwargs.get("_request_timeout", None) - kwargs["_check_input_type"] = kwargs.get("_check_input_type", True) - kwargs["_check_return_type"] = kwargs.get("_check_return_type", True) - kwargs["_spec_property_naming"] = kwargs.get("_spec_property_naming", False) - kwargs["_content_type"] = kwargs.get("_content_type") - kwargs["_host_index"] = kwargs.get("_host_index") - kwargs["id"] = id - return self.delete_detector_endpoint.call_with_http_info(**kwargs) - - def get_detector(self, id, **kwargs): - """get_detector # noqa: E501 - - Retrieve a detector by its ID. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.get_detector(id, async_req=True) - >>> result = thread.get() - - Args: - id (str): Choose a detector by its ID. - - Keyword Args: - _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 - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - Detector - If the method is called asynchronously, returns the request - thread. - """ - kwargs["async_req"] = kwargs.get("async_req", False) - kwargs["_return_http_data_only"] = kwargs.get("_return_http_data_only", True) - kwargs["_preload_content"] = kwargs.get("_preload_content", True) - kwargs["_request_timeout"] = kwargs.get("_request_timeout", None) - kwargs["_check_input_type"] = kwargs.get("_check_input_type", True) - kwargs["_check_return_type"] = kwargs.get("_check_return_type", True) - kwargs["_spec_property_naming"] = kwargs.get("_spec_property_naming", False) - kwargs["_content_type"] = kwargs.get("_content_type") - kwargs["_host_index"] = kwargs.get("_host_index") - kwargs["id"] = id - return self.get_detector_endpoint.call_with_http_info(**kwargs) - - def get_detector_evaluation(self, id, **kwargs): - """get_detector_evaluation # noqa: E501 - - Get Detector evaluation results. The result is null if there isn't enough ground truth data to evaluate the detector. Returns the time of the evaulation, total ground truth labels, the ml based kfold accuracies, and the system accuracies at different confidence thresholds # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.get_detector_evaluation(id, async_req=True) - >>> result = thread.get() - - Args: - id (str): - - Keyword Args: - _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 - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - InlineResponse2001 - If the method is called asynchronously, returns the request - thread. - """ - kwargs["async_req"] = kwargs.get("async_req", False) - kwargs["_return_http_data_only"] = kwargs.get("_return_http_data_only", True) - kwargs["_preload_content"] = kwargs.get("_preload_content", True) - kwargs["_request_timeout"] = kwargs.get("_request_timeout", None) - kwargs["_check_input_type"] = kwargs.get("_check_input_type", True) - kwargs["_check_return_type"] = kwargs.get("_check_return_type", True) - kwargs["_spec_property_naming"] = kwargs.get("_spec_property_naming", False) - kwargs["_content_type"] = kwargs.get("_content_type") - kwargs["_host_index"] = kwargs.get("_host_index") - kwargs["id"] = id - return self.get_detector_evaluation_endpoint.call_with_http_info(**kwargs) - - def get_detector_metrics(self, detector_id, **kwargs): - """get_detector_metrics # noqa: E501 - - Get Detector metrics, primarily the counts of different types of labels # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.get_detector_metrics(detector_id, async_req=True) - >>> result = thread.get() - - Args: - detector_id (str): - - Keyword Args: - _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 - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - InlineResponse200 - If the method is called asynchronously, returns the request - thread. - """ - kwargs["async_req"] = kwargs.get("async_req", False) - kwargs["_return_http_data_only"] = kwargs.get("_return_http_data_only", True) - kwargs["_preload_content"] = kwargs.get("_preload_content", True) - kwargs["_request_timeout"] = kwargs.get("_request_timeout", None) - kwargs["_check_input_type"] = kwargs.get("_check_input_type", True) - kwargs["_check_return_type"] = kwargs.get("_check_return_type", True) - kwargs["_spec_property_naming"] = kwargs.get("_spec_property_naming", False) - kwargs["_content_type"] = kwargs.get("_content_type") - kwargs["_host_index"] = kwargs.get("_host_index") - kwargs["detector_id"] = detector_id - return self.get_detector_metrics_endpoint.call_with_http_info(**kwargs) - - def list_detectors(self, **kwargs): - """list_detectors # noqa: E501 - - Retrieve a list of detectors. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.list_detectors(async_req=True) - >>> result = thread.get() - - - Keyword Args: - page (int): A page number within the paginated result set.. [optional] - page_size (int): Number of items to return per page.. [optional] - _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 - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - PaginatedDetectorList - If the method is called asynchronously, returns the request - thread. - """ - kwargs["async_req"] = kwargs.get("async_req", False) - kwargs["_return_http_data_only"] = kwargs.get("_return_http_data_only", True) - kwargs["_preload_content"] = kwargs.get("_preload_content", True) - kwargs["_request_timeout"] = kwargs.get("_request_timeout", None) - kwargs["_check_input_type"] = kwargs.get("_check_input_type", True) - kwargs["_check_return_type"] = kwargs.get("_check_return_type", True) - kwargs["_spec_property_naming"] = kwargs.get("_spec_property_naming", False) - kwargs["_content_type"] = kwargs.get("_content_type") - kwargs["_host_index"] = kwargs.get("_host_index") - return self.list_detectors_endpoint.call_with_http_info(**kwargs) - - def update_detector(self, id, **kwargs): - """update_detector # noqa: E501 - - Update a detector # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.update_detector(id, async_req=True) - >>> result = thread.get() - - Args: - id (str): - - Keyword Args: - patched_detector_request (PatchedDetectorRequest): [optional] - _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 - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - Detector - If the method is called asynchronously, returns the request - thread. - """ - kwargs["async_req"] = kwargs.get("async_req", False) - kwargs["_return_http_data_only"] = kwargs.get("_return_http_data_only", True) - kwargs["_preload_content"] = kwargs.get("_preload_content", True) - kwargs["_request_timeout"] = kwargs.get("_request_timeout", None) - kwargs["_check_input_type"] = kwargs.get("_check_input_type", True) - kwargs["_check_return_type"] = kwargs.get("_check_return_type", True) - kwargs["_spec_property_naming"] = kwargs.get("_spec_property_naming", False) - kwargs["_content_type"] = kwargs.get("_content_type") - kwargs["_host_index"] = kwargs.get("_host_index") - kwargs["id"] = id - return self.update_detector_endpoint.call_with_http_info(**kwargs) + + @validate_call + def create_detector( + self, + detector_creation_input_request: DetectorCreationInputRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> Detector: + """create_detector + + Create a new detector. + + :param detector_creation_input_request: (required) + :type detector_creation_input_request: DetectorCreationInputRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_detector_serialize( + detector_creation_input_request=detector_creation_input_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "201": "Detector", + } + response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call + def create_detector_with_http_info( + self, + detector_creation_input_request: DetectorCreationInputRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[Detector]: + """create_detector + + Create a new detector. + + :param detector_creation_input_request: (required) + :type detector_creation_input_request: DetectorCreationInputRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_detector_serialize( + detector_creation_input_request=detector_creation_input_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "201": "Detector", + } + response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + def create_detector_without_preload_content( + self, + detector_creation_input_request: DetectorCreationInputRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """create_detector + + Create a new detector. + + :param detector_creation_input_request: (required) + :type detector_creation_input_request: DetectorCreationInputRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_detector_serialize( + detector_creation_input_request=detector_creation_input_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "201": "Detector", + } + response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + return response_data.response + + def _create_detector_serialize( + self, + detector_creation_input_request, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if detector_creation_input_request is not None: + _body_params = detector_creation_input_request + + # set the HTTP header `Accept` + if "Accept" not in _header_params: + _header_params["Accept"] = self.api_client.select_header_accept(["application/json"]) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params["Content-Type"] = _content_type + else: + _default_content_type = self.api_client.select_header_content_type(["application/json"]) + if _default_content_type is not None: + _header_params["Content-Type"] = _default_content_type + + # authentication setting + _auth_settings: List[str] = ["ApiToken"] + + return self.api_client.param_serialize( + method="POST", + resource_path="/v1/detectors", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth, + ) + + @validate_call + def delete_detector( + self, + id: Annotated[StrictStr, Field(description="Choose a detector by its ID.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """delete_detector + + Delete a detector by its ID. + + :param id: Choose a detector by its ID. (required) + :type id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_detector_serialize( + id=id, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + "204": None, + } + response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call + def delete_detector_with_http_info( + self, + id: Annotated[StrictStr, Field(description="Choose a detector by its ID.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """delete_detector + + Delete a detector by its ID. + + :param id: Choose a detector by its ID. (required) + :type id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_detector_serialize( + id=id, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + "204": None, + } + response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + def delete_detector_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Choose a detector by its ID.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """delete_detector + + Delete a detector by its ID. + + :param id: Choose a detector by its ID. (required) + :type id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_detector_serialize( + id=id, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + "204": None, + } + response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + return response_data.response + + def _delete_detector_serialize( + self, + id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if id is not None: + _path_params["id"] = id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + # authentication setting + _auth_settings: List[str] = ["ApiToken"] + + return self.api_client.param_serialize( + method="DELETE", + resource_path="/v1/detectors/{id}", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth, + ) + + @validate_call + def get_detector( + self, + id: Annotated[StrictStr, Field(description="Choose a detector by its ID.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> Detector: + """get_detector + + Retrieve a detector by its ID. + + :param id: Choose a detector by its ID. (required) + :type id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_detector_serialize( + id=id, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "Detector", + } + response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call + def get_detector_with_http_info( + self, + id: Annotated[StrictStr, Field(description="Choose a detector by its ID.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[Detector]: + """get_detector + + Retrieve a detector by its ID. + + :param id: Choose a detector by its ID. (required) + :type id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_detector_serialize( + id=id, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "Detector", + } + response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + def get_detector_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Choose a detector by its ID.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """get_detector + + Retrieve a detector by its ID. + + :param id: Choose a detector by its ID. (required) + :type id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_detector_serialize( + id=id, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "Detector", + } + response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + return response_data.response + + def _get_detector_serialize( + self, + id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if id is not None: + _path_params["id"] = id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + # set the HTTP header `Accept` + if "Accept" not in _header_params: + _header_params["Accept"] = self.api_client.select_header_accept(["application/json"]) + + # authentication setting + _auth_settings: List[str] = ["ApiToken"] + + return self.api_client.param_serialize( + method="GET", + resource_path="/v1/detectors/{id}", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth, + ) + + @validate_call + def get_detector_evaluation( + self, + id: StrictStr, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> GetDetectorEvaluation200Response: + """get_detector_evaluation + + Get Detector evaluation results. The result is null if there isn't enough ground truth data to evaluate the detector. Returns the time of the evaulation, total ground truth labels, the ml based kfold accuracies, and the system accuracies at different confidence thresholds + + :param id: (required) + :type id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_detector_evaluation_serialize( + id=id, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "GetDetectorEvaluation200Response", + } + response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call + def get_detector_evaluation_with_http_info( + self, + id: StrictStr, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[GetDetectorEvaluation200Response]: + """get_detector_evaluation + + Get Detector evaluation results. The result is null if there isn't enough ground truth data to evaluate the detector. Returns the time of the evaulation, total ground truth labels, the ml based kfold accuracies, and the system accuracies at different confidence thresholds + + :param id: (required) + :type id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_detector_evaluation_serialize( + id=id, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "GetDetectorEvaluation200Response", + } + response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + def get_detector_evaluation_without_preload_content( + self, + id: StrictStr, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """get_detector_evaluation + + Get Detector evaluation results. The result is null if there isn't enough ground truth data to evaluate the detector. Returns the time of the evaulation, total ground truth labels, the ml based kfold accuracies, and the system accuracies at different confidence thresholds + + :param id: (required) + :type id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_detector_evaluation_serialize( + id=id, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "GetDetectorEvaluation200Response", + } + response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + return response_data.response + + def _get_detector_evaluation_serialize( + self, + id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if id is not None: + _path_params["id"] = id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + # set the HTTP header `Accept` + if "Accept" not in _header_params: + _header_params["Accept"] = self.api_client.select_header_accept(["application/json"]) + + # authentication setting + _auth_settings: List[str] = ["ApiToken"] + + return self.api_client.param_serialize( + method="GET", + resource_path="/v1/detectors/{id}/evaluation", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth, + ) + + @validate_call + def get_detector_metrics( + self, + detector_id: StrictStr, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> GetDetectorMetrics200Response: + """get_detector_metrics + + Get Detector metrics, primarily the counts of different types of labels + + :param detector_id: (required) + :type detector_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_detector_metrics_serialize( + detector_id=detector_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "GetDetectorMetrics200Response", + } + response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call + def get_detector_metrics_with_http_info( + self, + detector_id: StrictStr, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[GetDetectorMetrics200Response]: + """get_detector_metrics + + Get Detector metrics, primarily the counts of different types of labels + + :param detector_id: (required) + :type detector_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_detector_metrics_serialize( + detector_id=detector_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "GetDetectorMetrics200Response", + } + response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + def get_detector_metrics_without_preload_content( + self, + detector_id: StrictStr, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """get_detector_metrics + + Get Detector metrics, primarily the counts of different types of labels + + :param detector_id: (required) + :type detector_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_detector_metrics_serialize( + detector_id=detector_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "GetDetectorMetrics200Response", + } + response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + return response_data.response + + def _get_detector_metrics_serialize( + self, + detector_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if detector_id is not None: + _path_params["detector_id"] = detector_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + # set the HTTP header `Accept` + if "Accept" not in _header_params: + _header_params["Accept"] = self.api_client.select_header_accept(["application/json"]) + + # authentication setting + _auth_settings: List[str] = ["ApiToken"] + + return self.api_client.param_serialize( + method="GET", + resource_path="/v1/detectors/{detector_id}/metrics", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth, + ) + + @validate_call + def list_detectors( + self, + page: Annotated[ + Optional[StrictInt], Field(description="A page number within the paginated result set.") + ] = None, + page_size: Annotated[Optional[StrictInt], Field(description="Number of items to return per page.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> PaginatedDetectorList: + """list_detectors + + Retrieve a list of detectors. + + :param page: A page number within the paginated result set. + :type page: int + :param page_size: Number of items to return per page. + :type page_size: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_detectors_serialize( + page=page, + page_size=page_size, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "PaginatedDetectorList", + } + response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call + def list_detectors_with_http_info( + self, + page: Annotated[ + Optional[StrictInt], Field(description="A page number within the paginated result set.") + ] = None, + page_size: Annotated[Optional[StrictInt], Field(description="Number of items to return per page.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[PaginatedDetectorList]: + """list_detectors + + Retrieve a list of detectors. + + :param page: A page number within the paginated result set. + :type page: int + :param page_size: Number of items to return per page. + :type page_size: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_detectors_serialize( + page=page, + page_size=page_size, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "PaginatedDetectorList", + } + response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + def list_detectors_without_preload_content( + self, + page: Annotated[ + Optional[StrictInt], Field(description="A page number within the paginated result set.") + ] = None, + page_size: Annotated[Optional[StrictInt], Field(description="Number of items to return per page.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """list_detectors + + Retrieve a list of detectors. + + :param page: A page number within the paginated result set. + :type page: int + :param page_size: Number of items to return per page. + :type page_size: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_detectors_serialize( + page=page, + page_size=page_size, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "PaginatedDetectorList", + } + response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + return response_data.response + + def _list_detectors_serialize( + self, + page, + page_size, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + if page is not None: + + _query_params.append(("page", page)) + + if page_size is not None: + + _query_params.append(("page_size", page_size)) + + # process the header parameters + # process the form parameters + # process the body parameter + + # set the HTTP header `Accept` + if "Accept" not in _header_params: + _header_params["Accept"] = self.api_client.select_header_accept(["application/json"]) + + # authentication setting + _auth_settings: List[str] = ["ApiToken"] + + return self.api_client.param_serialize( + method="GET", + resource_path="/v1/detectors", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth, + ) + + @validate_call + def update_detector( + self, + id: StrictStr, + patched_detector_request: Optional[PatchedDetectorRequest] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> Detector: + """update_detector + + Update a detector + + :param id: (required) + :type id: str + :param patched_detector_request: + :type patched_detector_request: PatchedDetectorRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_detector_serialize( + id=id, + patched_detector_request=patched_detector_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "Detector", + } + response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call + def update_detector_with_http_info( + self, + id: StrictStr, + patched_detector_request: Optional[PatchedDetectorRequest] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[Detector]: + """update_detector + + Update a detector + + :param id: (required) + :type id: str + :param patched_detector_request: + :type patched_detector_request: PatchedDetectorRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_detector_serialize( + id=id, + patched_detector_request=patched_detector_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "Detector", + } + response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + def update_detector_without_preload_content( + self, + id: StrictStr, + patched_detector_request: Optional[PatchedDetectorRequest] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """update_detector + + Update a detector + + :param id: (required) + :type id: str + :param patched_detector_request: + :type patched_detector_request: PatchedDetectorRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_detector_serialize( + id=id, + patched_detector_request=patched_detector_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "Detector", + } + response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + return response_data.response + + def _update_detector_serialize( + self, + id, + patched_detector_request, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if id is not None: + _path_params["id"] = id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if patched_detector_request is not None: + _body_params = patched_detector_request + + # set the HTTP header `Accept` + if "Accept" not in _header_params: + _header_params["Accept"] = self.api_client.select_header_accept(["application/json"]) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params["Content-Type"] = _content_type + else: + _default_content_type = self.api_client.select_header_content_type( + ["application/json", "application/x-www-form-urlencoded", "multipart/form-data"] + ) + if _default_content_type is not None: + _header_params["Content-Type"] = _default_content_type + + # authentication setting + _auth_settings: List[str] = ["ApiToken"] + + return self.api_client.param_serialize( + method="PATCH", + resource_path="/v1/detectors/{id}", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth, + ) diff --git a/generated/groundlight_openapi_client/api/edge_api.py b/generated/groundlight_openapi_client/api/edge_api.py index a0b3187d..c9c13d45 100644 --- a/generated/groundlight_openapi_client/api/edge_api.py +++ b/generated/groundlight_openapi_client/api/edge_api.py @@ -1,214 +1,462 @@ +# coding: utf-8 + """ Groundlight API - Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. # noqa: E501 + Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. The version of the OpenAPI document: 0.18.2 Contact: support@groundlight.ai - Generated by: https://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 -import re # noqa: F401 -import sys # noqa: F401 +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated -from groundlight_openapi_client.api_client import ApiClient, Endpoint as _Endpoint -from groundlight_openapi_client.model_utils import ( # noqa: F401 - check_allowed_values, - check_validations, - date, - datetime, - file_type, - none_type, - validate_and_convert_types, -) -from groundlight_openapi_client.model.edge_model_info import EdgeModelInfo +from pydantic import StrictStr +from groundlight_openapi_client.models.edge_model_info import EdgeModelInfo +from groundlight_openapi_client.api_client import ApiClient, RequestSerialized +from groundlight_openapi_client.api_response import ApiResponse +from groundlight_openapi_client.rest import RESTResponseType -class EdgeApi(object): + +class EdgeApi: """NOTE: This class is auto generated by OpenAPI Generator Ref: https://openapi-generator.tech Do not edit the class manually. """ - def __init__(self, api_client=None): + def __init__(self, api_client=None) -> None: if api_client is None: - api_client = ApiClient() + api_client = ApiClient.get_default() self.api_client = api_client - self.edge_report_metrics_create_endpoint = _Endpoint( - settings={ - "response_type": None, - "auth": ["ApiToken"], - "endpoint_path": "/v1/edge/report-metrics", - "operation_id": "edge_report_metrics_create", - "http_method": "POST", - "servers": None, - }, - params_map={"all": [], "required": [], "nullable": [], "enum": [], "validation": []}, - root_map={ - "validations": {}, - "allowed_values": {}, - "openapi_types": {}, - "attribute_map": {}, - "location_map": {}, - "collection_format_map": {}, - }, - headers_map={ - "accept": [], - "content_type": [], - }, - api_client=api_client, + + @validate_call + def edge_report_metrics_create( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """edge_report_metrics_create + + Edge server periodically calls this to report metrics. POST body will have JSON data that we log. + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._edge_report_metrics_create_serialize( + _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, _host_index=_host_index ) - self.get_model_urls_endpoint = _Endpoint( - settings={ - "response_type": (EdgeModelInfo,), - "auth": ["ApiToken"], - "endpoint_path": "/v1/edge/fetch-model-urls/{detector_id}/", - "operation_id": "get_model_urls", - "http_method": "GET", - "servers": None, - }, - params_map={ - "all": [ - "detector_id", - ], - "required": [ - "detector_id", - ], - "nullable": [], - "enum": [], - "validation": [], - }, - root_map={ - "validations": {}, - "allowed_values": {}, - "openapi_types": { - "detector_id": (str,), - }, - "attribute_map": { - "detector_id": "detector_id", - }, - "location_map": { - "detector_id": "path", - }, - "collection_format_map": {}, - }, - headers_map={ - "accept": ["application/json"], - "content_type": [], - }, - api_client=api_client, + + _response_types_map: Dict[str, Optional[str]] = { + "200": None, + } + response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call + def edge_report_metrics_create_with_http_info( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """edge_report_metrics_create + + Edge server periodically calls this to report metrics. POST body will have JSON data that we log. + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._edge_report_metrics_create_serialize( + _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, _host_index=_host_index ) - def edge_report_metrics_create(self, **kwargs): - """edge_report_metrics_create # noqa: E501 - - Edge server periodically calls this to report metrics. POST body will have JSON data that we log. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.edge_report_metrics_create(async_req=True) - >>> result = thread.get() - - - Keyword Args: - _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 - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - None - If the method is called asynchronously, returns the request - thread. - """ - kwargs["async_req"] = kwargs.get("async_req", False) - kwargs["_return_http_data_only"] = kwargs.get("_return_http_data_only", True) - kwargs["_preload_content"] = kwargs.get("_preload_content", True) - kwargs["_request_timeout"] = kwargs.get("_request_timeout", None) - kwargs["_check_input_type"] = kwargs.get("_check_input_type", True) - kwargs["_check_return_type"] = kwargs.get("_check_return_type", True) - kwargs["_spec_property_naming"] = kwargs.get("_spec_property_naming", False) - kwargs["_content_type"] = kwargs.get("_content_type") - kwargs["_host_index"] = kwargs.get("_host_index") - return self.edge_report_metrics_create_endpoint.call_with_http_info(**kwargs) - - def get_model_urls(self, detector_id, **kwargs): - """get_model_urls # noqa: E501 - - Gets time limited pre-authenticated URLs to download a detector's edge model and oodd model. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.get_model_urls(detector_id, async_req=True) - >>> result = thread.get() - - Args: - detector_id (str): - - Keyword Args: - _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 - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - EdgeModelInfo - If the method is called asynchronously, returns the request - thread. - """ - kwargs["async_req"] = kwargs.get("async_req", False) - kwargs["_return_http_data_only"] = kwargs.get("_return_http_data_only", True) - kwargs["_preload_content"] = kwargs.get("_preload_content", True) - kwargs["_request_timeout"] = kwargs.get("_request_timeout", None) - kwargs["_check_input_type"] = kwargs.get("_check_input_type", True) - kwargs["_check_return_type"] = kwargs.get("_check_return_type", True) - kwargs["_spec_property_naming"] = kwargs.get("_spec_property_naming", False) - kwargs["_content_type"] = kwargs.get("_content_type") - kwargs["_host_index"] = kwargs.get("_host_index") - kwargs["detector_id"] = detector_id - return self.get_model_urls_endpoint.call_with_http_info(**kwargs) + _response_types_map: Dict[str, Optional[str]] = { + "200": None, + } + response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + def edge_report_metrics_create_without_preload_content( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """edge_report_metrics_create + + Edge server periodically calls this to report metrics. POST body will have JSON data that we log. + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._edge_report_metrics_create_serialize( + _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": None, + } + response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + return response_data.response + + def _edge_report_metrics_create_serialize( + self, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + # authentication setting + _auth_settings: List[str] = ["ApiToken"] + + return self.api_client.param_serialize( + method="POST", + resource_path="/v1/edge/report-metrics", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth, + ) + + @validate_call + def get_model_urls( + self, + detector_id: StrictStr, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> EdgeModelInfo: + """get_model_urls + + Gets time limited pre-authenticated URLs to download a detector's edge model and oodd model. + + :param detector_id: (required) + :type detector_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_model_urls_serialize( + detector_id=detector_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "EdgeModelInfo", + } + response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call + def get_model_urls_with_http_info( + self, + detector_id: StrictStr, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[EdgeModelInfo]: + """get_model_urls + + Gets time limited pre-authenticated URLs to download a detector's edge model and oodd model. + + :param detector_id: (required) + :type detector_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_model_urls_serialize( + detector_id=detector_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "EdgeModelInfo", + } + response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + def get_model_urls_without_preload_content( + self, + detector_id: StrictStr, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """get_model_urls + + Gets time limited pre-authenticated URLs to download a detector's edge model and oodd model. + + :param detector_id: (required) + :type detector_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_model_urls_serialize( + detector_id=detector_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "EdgeModelInfo", + } + response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + return response_data.response + + def _get_model_urls_serialize( + self, + detector_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if detector_id is not None: + _path_params["detector_id"] = detector_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + # set the HTTP header `Accept` + if "Accept" not in _header_params: + _header_params["Accept"] = self.api_client.select_header_accept(["application/json"]) + + # authentication setting + _auth_settings: List[str] = ["ApiToken"] + + return self.api_client.param_serialize( + method="GET", + resource_path="/v1/edge/fetch-model-urls/{detector_id}/", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth, + ) diff --git a/generated/groundlight_openapi_client/api/image_queries_api.py b/generated/groundlight_openapi_client/api/image_queries_api.py index 03ad2600..4bff86b2 100644 --- a/generated/groundlight_openapi_client/api/image_queries_api.py +++ b/generated/groundlight_openapi_client/api/image_queries_api.py @@ -1,490 +1,1231 @@ +# coding: utf-8 + """ Groundlight API - Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. # noqa: E501 + Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. The version of the OpenAPI document: 0.18.2 Contact: support@groundlight.ai - Generated by: https://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated -import re # noqa: F401 -import sys # noqa: F401 +from pydantic import Field, StrictBytes, StrictFloat, StrictInt, StrictStr +from typing import Optional, Tuple, Union +from typing_extensions import Annotated +from groundlight_openapi_client.models.image_query import ImageQuery +from groundlight_openapi_client.models.paginated_image_query_list import PaginatedImageQueryList -from groundlight_openapi_client.api_client import ApiClient, Endpoint as _Endpoint -from groundlight_openapi_client.model_utils import ( # noqa: F401 - check_allowed_values, - check_validations, - date, - datetime, - file_type, - none_type, - validate_and_convert_types, -) -from groundlight_openapi_client.model.image_query import ImageQuery -from groundlight_openapi_client.model.paginated_image_query_list import PaginatedImageQueryList +from groundlight_openapi_client.api_client import ApiClient, RequestSerialized +from groundlight_openapi_client.api_response import ApiResponse +from groundlight_openapi_client.rest import RESTResponseType -class ImageQueriesApi(object): +class ImageQueriesApi: """NOTE: This class is auto generated by OpenAPI Generator Ref: https://openapi-generator.tech Do not edit the class manually. """ - def __init__(self, api_client=None): + def __init__(self, api_client=None) -> None: if api_client is None: - api_client = ApiClient() + api_client = ApiClient.get_default() self.api_client = api_client - self.get_image_endpoint = _Endpoint( - settings={ - "response_type": (file_type,), - "auth": ["ApiToken"], - "endpoint_path": "/v1/image-queries/{id}/image", - "operation_id": "get_image", - "http_method": "GET", - "servers": None, - }, - params_map={ - "all": [ - "id", - ], - "required": [ - "id", - ], - "nullable": [], - "enum": [], - "validation": [], - }, - root_map={ - "validations": {}, - "allowed_values": {}, - "openapi_types": { - "id": (str,), - }, - "attribute_map": { - "id": "id", - }, - "location_map": { - "id": "path", - }, - "collection_format_map": {}, - }, - headers_map={ - "accept": ["image/jpeg"], - "content_type": [], - }, - api_client=api_client, + + @validate_call + def get_image( + self, + id: Annotated[StrictStr, Field(description="Retrieve the image associated with the image query ID.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> bytearray: + """get_image + + Retrieve an image by its ID. + + :param id: Retrieve the image associated with the image query ID. (required) + :type id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_image_serialize( + id=id, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "bytearray", + } + response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call + def get_image_with_http_info( + self, + id: Annotated[StrictStr, Field(description="Retrieve the image associated with the image query ID.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[bytearray]: + """get_image + + Retrieve an image by its ID. + + :param id: Retrieve the image associated with the image query ID. (required) + :type id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_image_serialize( + id=id, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "bytearray", + } + response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + def get_image_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Retrieve the image associated with the image query ID.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """get_image + + Retrieve an image by its ID. + + :param id: Retrieve the image associated with the image query ID. (required) + :type id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_image_serialize( + id=id, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "bytearray", + } + response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + return response_data.response + + def _get_image_serialize( + self, + id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if id is not None: + _path_params["id"] = id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + # set the HTTP header `Accept` + if "Accept" not in _header_params: + _header_params["Accept"] = self.api_client.select_header_accept(["image/jpeg"]) + + # authentication setting + _auth_settings: List[str] = ["ApiToken"] + + return self.api_client.param_serialize( + method="GET", + resource_path="/v1/image-queries/{id}/image", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth, + ) + + @validate_call + def get_image_query( + self, + id: Annotated[StrictStr, Field(description="Choose an image query by its ID.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ImageQuery: + """get_image_query + + Retrieve an image-query by its ID. + + :param id: Choose an image query by its ID. (required) + :type id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_image_query_serialize( + id=id, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "ImageQuery", + } + response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call + def get_image_query_with_http_info( + self, + id: Annotated[StrictStr, Field(description="Choose an image query by its ID.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[ImageQuery]: + """get_image_query + + Retrieve an image-query by its ID. + + :param id: Choose an image query by its ID. (required) + :type id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_image_query_serialize( + id=id, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, _host_index=_host_index ) - self.get_image_query_endpoint = _Endpoint( - settings={ - "response_type": (ImageQuery,), - "auth": ["ApiToken"], - "endpoint_path": "/v1/image-queries/{id}", - "operation_id": "get_image_query", - "http_method": "GET", - "servers": None, - }, - params_map={ - "all": [ - "id", - ], - "required": [ - "id", - ], - "nullable": [], - "enum": [], - "validation": [], - }, - root_map={ - "validations": {}, - "allowed_values": {}, - "openapi_types": { - "id": (str,), - }, - "attribute_map": { - "id": "id", - }, - "location_map": { - "id": "path", - }, - "collection_format_map": {}, - }, - headers_map={ - "accept": ["application/json"], - "content_type": [], - }, - api_client=api_client, + + _response_types_map: Dict[str, Optional[str]] = { + "200": "ImageQuery", + } + response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + def get_image_query_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Choose an image query by its ID.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """get_image_query + + Retrieve an image-query by its ID. + + :param id: Choose an image query by its ID. (required) + :type id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_image_query_serialize( + id=id, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "ImageQuery", + } + response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + return response_data.response + + def _get_image_query_serialize( + self, + id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if id is not None: + _path_params["id"] = id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + # set the HTTP header `Accept` + if "Accept" not in _header_params: + _header_params["Accept"] = self.api_client.select_header_accept(["application/json"]) + + # authentication setting + _auth_settings: List[str] = ["ApiToken"] + + return self.api_client.param_serialize( + method="GET", + resource_path="/v1/image-queries/{id}", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth, ) - self.list_image_queries_endpoint = _Endpoint( - settings={ - "response_type": (PaginatedImageQueryList,), - "auth": ["ApiToken"], - "endpoint_path": "/v1/image-queries", - "operation_id": "list_image_queries", - "http_method": "GET", - "servers": None, - }, - params_map={ - "all": [ - "detector_id", - "page", - "page_size", - ], - "required": [], - "nullable": [], - "enum": [], - "validation": [], - }, - root_map={ - "validations": {}, - "allowed_values": {}, - "openapi_types": { - "detector_id": (str,), - "page": (int,), - "page_size": (int,), - }, - "attribute_map": { - "detector_id": "detector_id", - "page": "page", - "page_size": "page_size", - }, - "location_map": { - "detector_id": "query", - "page": "query", - "page_size": "query", - }, - "collection_format_map": {}, - }, - headers_map={ - "accept": ["application/json"], - "content_type": [], - }, - api_client=api_client, + + @validate_call + def list_image_queries( + self, + detector_id: Annotated[ + Optional[StrictStr], Field(description="Optionally filter image queries by detector ID.") + ] = None, + page: Annotated[ + Optional[StrictInt], Field(description="A page number within the paginated result set.") + ] = None, + page_size: Annotated[Optional[StrictInt], Field(description="Number of items to return per page.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> PaginatedImageQueryList: + """list_image_queries + + Retrieve a list of image-queries. + + :param detector_id: Optionally filter image queries by detector ID. + :type detector_id: str + :param page: A page number within the paginated result set. + :type page: int + :param page_size: Number of items to return per page. + :type page_size: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_image_queries_serialize( + detector_id=detector_id, + page=page, + page_size=page_size, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, ) - self.submit_image_query_endpoint = _Endpoint( - settings={ - "response_type": (ImageQuery,), - "auth": ["ApiToken"], - "endpoint_path": "/v1/image-queries", - "operation_id": "submit_image_query", - "http_method": "POST", - "servers": None, - }, - params_map={ - "all": [ - "detector_id", - "confidence_threshold", - "human_review", - "image_query_id", - "inspection_id", - "metadata", - "patience_time", - "want_async", - "body", - ], - "required": [ - "detector_id", - ], - "nullable": [], - "enum": [], - "validation": [ - "confidence_threshold", - ], - }, - root_map={ - "validations": { - ("confidence_threshold",): { - "inclusive_maximum": 1, - "inclusive_minimum": 0, - }, - }, - "allowed_values": {}, - "openapi_types": { - "detector_id": (str,), - "confidence_threshold": (float,), - "human_review": (str,), - "image_query_id": (str,), - "inspection_id": (str,), - "metadata": (str,), - "patience_time": (float,), - "want_async": (str,), - "body": (file_type,), - }, - "attribute_map": { - "detector_id": "detector_id", - "confidence_threshold": "confidence_threshold", - "human_review": "human_review", - "image_query_id": "image_query_id", - "inspection_id": "inspection_id", - "metadata": "metadata", - "patience_time": "patience_time", - "want_async": "want_async", - }, - "location_map": { - "detector_id": "query", - "confidence_threshold": "query", - "human_review": "query", - "image_query_id": "query", - "inspection_id": "query", - "metadata": "query", - "patience_time": "query", - "want_async": "query", - "body": "body", - }, - "collection_format_map": {}, - }, - headers_map={ - "accept": ["application/json"], - "content_type": [ - "image/jpeg", - "image/jpg", - "image/png", - "image/gif", - "image/webp", - "image/bmp", - "image/x-icon", - ], - }, - api_client=api_client, + + _response_types_map: Dict[str, Optional[str]] = { + "200": "PaginatedImageQueryList", + } + response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call + def list_image_queries_with_http_info( + self, + detector_id: Annotated[ + Optional[StrictStr], Field(description="Optionally filter image queries by detector ID.") + ] = None, + page: Annotated[ + Optional[StrictInt], Field(description="A page number within the paginated result set.") + ] = None, + page_size: Annotated[Optional[StrictInt], Field(description="Number of items to return per page.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[PaginatedImageQueryList]: + """list_image_queries + + Retrieve a list of image-queries. + + :param detector_id: Optionally filter image queries by detector ID. + :type detector_id: str + :param page: A page number within the paginated result set. + :type page: int + :param page_size: Number of items to return per page. + :type page_size: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_image_queries_serialize( + detector_id=detector_id, + page=page, + page_size=page_size, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, ) - def get_image(self, id, **kwargs): - """get_image # noqa: E501 - - Retrieve an image by its ID. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.get_image(id, async_req=True) - >>> result = thread.get() - - Args: - id (str): Retrieve the image associated with the image query ID. - - Keyword Args: - _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 - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - file_type - If the method is called asynchronously, returns the request - thread. - """ - kwargs["async_req"] = kwargs.get("async_req", False) - kwargs["_return_http_data_only"] = kwargs.get("_return_http_data_only", True) - kwargs["_preload_content"] = kwargs.get("_preload_content", True) - kwargs["_request_timeout"] = kwargs.get("_request_timeout", None) - kwargs["_check_input_type"] = kwargs.get("_check_input_type", True) - kwargs["_check_return_type"] = kwargs.get("_check_return_type", True) - kwargs["_spec_property_naming"] = kwargs.get("_spec_property_naming", False) - kwargs["_content_type"] = kwargs.get("_content_type") - kwargs["_host_index"] = kwargs.get("_host_index") - kwargs["id"] = id - return self.get_image_endpoint.call_with_http_info(**kwargs) - - def get_image_query(self, id, **kwargs): - """get_image_query # noqa: E501 - - Retrieve an image-query by its ID. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.get_image_query(id, async_req=True) - >>> result = thread.get() - - Args: - id (str): Choose an image query by its ID. - - Keyword Args: - _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 - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - ImageQuery - If the method is called asynchronously, returns the request - thread. - """ - kwargs["async_req"] = kwargs.get("async_req", False) - kwargs["_return_http_data_only"] = kwargs.get("_return_http_data_only", True) - kwargs["_preload_content"] = kwargs.get("_preload_content", True) - kwargs["_request_timeout"] = kwargs.get("_request_timeout", None) - kwargs["_check_input_type"] = kwargs.get("_check_input_type", True) - kwargs["_check_return_type"] = kwargs.get("_check_return_type", True) - kwargs["_spec_property_naming"] = kwargs.get("_spec_property_naming", False) - kwargs["_content_type"] = kwargs.get("_content_type") - kwargs["_host_index"] = kwargs.get("_host_index") - kwargs["id"] = id - return self.get_image_query_endpoint.call_with_http_info(**kwargs) - - def list_image_queries(self, **kwargs): - """list_image_queries # noqa: E501 - - Retrieve a list of image-queries. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.list_image_queries(async_req=True) - >>> result = thread.get() - - - Keyword Args: - detector_id (str): Optionally filter image queries by detector ID.. [optional] - page (int): A page number within the paginated result set.. [optional] - page_size (int): Number of items to return per page.. [optional] - _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 - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - PaginatedImageQueryList - If the method is called asynchronously, returns the request - thread. - """ - kwargs["async_req"] = kwargs.get("async_req", False) - kwargs["_return_http_data_only"] = kwargs.get("_return_http_data_only", True) - kwargs["_preload_content"] = kwargs.get("_preload_content", True) - kwargs["_request_timeout"] = kwargs.get("_request_timeout", None) - kwargs["_check_input_type"] = kwargs.get("_check_input_type", True) - kwargs["_check_return_type"] = kwargs.get("_check_return_type", True) - kwargs["_spec_property_naming"] = kwargs.get("_spec_property_naming", False) - kwargs["_content_type"] = kwargs.get("_content_type") - kwargs["_host_index"] = kwargs.get("_host_index") - return self.list_image_queries_endpoint.call_with_http_info(**kwargs) - - def submit_image_query(self, detector_id, **kwargs): - """submit_image_query # noqa: E501 - - Submit an image query against a detector. You must use `\"Content-Type: image/jpeg\"` or similar (image/png, image/webp, etc) for the image data. For example: ```Bash $ curl https://api.groundlight.ai/device-api/v1/image-queries?detector_id=det_abc123 \\ --header \"Content-Type: image/jpeg\" \\ --data-binary @path/to/filename.jpeg ``` # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.submit_image_query(detector_id, async_req=True) - >>> result = thread.get() - - Args: - detector_id (str): Choose a detector by its ID. - - Keyword Args: - confidence_threshold (float): The confidence threshold for the image query.. [optional] - human_review (str): If set to `DEFAULT`, use the regular escalation logic (i.e., send the image query for human review if the ML model is not confident). If set to `ALWAYS`, always send the image query for human review even if the ML model is confident. If set to `NEVER`, never send the image query for human review even if the ML model is not confident.. [optional] - image_query_id (str): The ID to assign to the created image query.. [optional] - inspection_id (str): Associate the image query with an inspection.. [optional] - metadata (str): A dictionary of custom key/value metadata to associate with the image query (limited to 1KB).. [optional] - patience_time (float): How long to wait for a confident response.. [optional] - want_async (str): If \"true\" then submitting an image query returns immediately without a result. The result will be computed asynchronously and can be retrieved later.. [optional] - body (file_type): [optional] - _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 - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - ImageQuery - If the method is called asynchronously, returns the request - thread. - """ - kwargs["async_req"] = kwargs.get("async_req", False) - kwargs["_return_http_data_only"] = kwargs.get("_return_http_data_only", True) - kwargs["_preload_content"] = kwargs.get("_preload_content", True) - kwargs["_request_timeout"] = kwargs.get("_request_timeout", None) - kwargs["_check_input_type"] = kwargs.get("_check_input_type", True) - kwargs["_check_return_type"] = kwargs.get("_check_return_type", True) - kwargs["_spec_property_naming"] = kwargs.get("_spec_property_naming", False) - kwargs["_content_type"] = kwargs.get("_content_type") - kwargs["_host_index"] = kwargs.get("_host_index") - kwargs["detector_id"] = detector_id - return self.submit_image_query_endpoint.call_with_http_info(**kwargs) + _response_types_map: Dict[str, Optional[str]] = { + "200": "PaginatedImageQueryList", + } + response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + def list_image_queries_without_preload_content( + self, + detector_id: Annotated[ + Optional[StrictStr], Field(description="Optionally filter image queries by detector ID.") + ] = None, + page: Annotated[ + Optional[StrictInt], Field(description="A page number within the paginated result set.") + ] = None, + page_size: Annotated[Optional[StrictInt], Field(description="Number of items to return per page.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """list_image_queries + + Retrieve a list of image-queries. + + :param detector_id: Optionally filter image queries by detector ID. + :type detector_id: str + :param page: A page number within the paginated result set. + :type page: int + :param page_size: Number of items to return per page. + :type page_size: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_image_queries_serialize( + detector_id=detector_id, + page=page, + page_size=page_size, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "PaginatedImageQueryList", + } + response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + return response_data.response + + def _list_image_queries_serialize( + self, + detector_id, + page, + page_size, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + if detector_id is not None: + + _query_params.append(("detector_id", detector_id)) + + if page is not None: + + _query_params.append(("page", page)) + + if page_size is not None: + + _query_params.append(("page_size", page_size)) + + # process the header parameters + # process the form parameters + # process the body parameter + + # set the HTTP header `Accept` + if "Accept" not in _header_params: + _header_params["Accept"] = self.api_client.select_header_accept(["application/json"]) + + # authentication setting + _auth_settings: List[str] = ["ApiToken"] + + return self.api_client.param_serialize( + method="GET", + resource_path="/v1/image-queries", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth, + ) + + @validate_call + def submit_image_query( + self, + detector_id: Annotated[StrictStr, Field(description="Choose a detector by its ID.")], + confidence_threshold: Annotated[ + Optional[ + Union[Annotated[float, Field(le=1, strict=True, ge=0)], Annotated[int, Field(le=1, strict=True, ge=0)]] + ], + Field(description="The confidence threshold for the image query."), + ] = None, + human_review: Annotated[ + Optional[StrictStr], + Field( + description=( + "If set to `DEFAULT`, use the regular escalation logic (i.e., send the image query for human review" + " if the ML model is not confident). If set to `ALWAYS`, always send the image query for human" + " review even if the ML model is confident. If set to `NEVER`, never send the image query for human" + " review even if the ML model is not confident." + ) + ), + ] = None, + image_query_id: Annotated[ + Optional[StrictStr], Field(description="The ID to assign to the created image query.") + ] = None, + inspection_id: Annotated[ + Optional[StrictStr], Field(description="Associate the image query with an inspection.") + ] = None, + metadata: Annotated[ + Optional[StrictStr], + Field( + description=( + "A dictionary of custom key/value metadata to associate with the image query (limited to 1KB)." + ) + ), + ] = None, + patience_time: Annotated[ + Optional[Union[StrictFloat, StrictInt]], Field(description="How long to wait for a confident response.") + ] = None, + want_async: Annotated[ + Optional[StrictStr], + Field( + description=( + 'If "true" then submitting an image query returns immediately without a result. The result will be' + " computed asynchronously and can be retrieved later." + ) + ), + ] = None, + body: Optional[Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]]] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ImageQuery: + """submit_image_query + + Submit an image query against a detector. You must use `\"Content-Type: image/jpeg\"` or similar (image/png, image/webp, etc) for the image data. For example: ```Bash $ curl https://api.groundlight.ai/device-api/v1/image-queries?detector_id=det_abc123 \\ --header \"Content-Type: image/jpeg\" \\ --data-binary @path/to/filename.jpeg ``` + + :param detector_id: Choose a detector by its ID. (required) + :type detector_id: str + :param confidence_threshold: The confidence threshold for the image query. + :type confidence_threshold: float + :param human_review: If set to `DEFAULT`, use the regular escalation logic (i.e., send the image query for human review if the ML model is not confident). If set to `ALWAYS`, always send the image query for human review even if the ML model is confident. If set to `NEVER`, never send the image query for human review even if the ML model is not confident. + :type human_review: str + :param image_query_id: The ID to assign to the created image query. + :type image_query_id: str + :param inspection_id: Associate the image query with an inspection. + :type inspection_id: str + :param metadata: A dictionary of custom key/value metadata to associate with the image query (limited to 1KB). + :type metadata: str + :param patience_time: How long to wait for a confident response. + :type patience_time: float + :param want_async: If \"true\" then submitting an image query returns immediately without a result. The result will be computed asynchronously and can be retrieved later. + :type want_async: str + :param body: + :type body: bytearray + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._submit_image_query_serialize( + detector_id=detector_id, + confidence_threshold=confidence_threshold, + human_review=human_review, + image_query_id=image_query_id, + inspection_id=inspection_id, + metadata=metadata, + patience_time=patience_time, + want_async=want_async, + body=body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "201": "ImageQuery", + } + response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call + def submit_image_query_with_http_info( + self, + detector_id: Annotated[StrictStr, Field(description="Choose a detector by its ID.")], + confidence_threshold: Annotated[ + Optional[ + Union[Annotated[float, Field(le=1, strict=True, ge=0)], Annotated[int, Field(le=1, strict=True, ge=0)]] + ], + Field(description="The confidence threshold for the image query."), + ] = None, + human_review: Annotated[ + Optional[StrictStr], + Field( + description=( + "If set to `DEFAULT`, use the regular escalation logic (i.e., send the image query for human review" + " if the ML model is not confident). If set to `ALWAYS`, always send the image query for human" + " review even if the ML model is confident. If set to `NEVER`, never send the image query for human" + " review even if the ML model is not confident." + ) + ), + ] = None, + image_query_id: Annotated[ + Optional[StrictStr], Field(description="The ID to assign to the created image query.") + ] = None, + inspection_id: Annotated[ + Optional[StrictStr], Field(description="Associate the image query with an inspection.") + ] = None, + metadata: Annotated[ + Optional[StrictStr], + Field( + description=( + "A dictionary of custom key/value metadata to associate with the image query (limited to 1KB)." + ) + ), + ] = None, + patience_time: Annotated[ + Optional[Union[StrictFloat, StrictInt]], Field(description="How long to wait for a confident response.") + ] = None, + want_async: Annotated[ + Optional[StrictStr], + Field( + description=( + 'If "true" then submitting an image query returns immediately without a result. The result will be' + " computed asynchronously and can be retrieved later." + ) + ), + ] = None, + body: Optional[Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]]] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[ImageQuery]: + """submit_image_query + + Submit an image query against a detector. You must use `\"Content-Type: image/jpeg\"` or similar (image/png, image/webp, etc) for the image data. For example: ```Bash $ curl https://api.groundlight.ai/device-api/v1/image-queries?detector_id=det_abc123 \\ --header \"Content-Type: image/jpeg\" \\ --data-binary @path/to/filename.jpeg ``` + + :param detector_id: Choose a detector by its ID. (required) + :type detector_id: str + :param confidence_threshold: The confidence threshold for the image query. + :type confidence_threshold: float + :param human_review: If set to `DEFAULT`, use the regular escalation logic (i.e., send the image query for human review if the ML model is not confident). If set to `ALWAYS`, always send the image query for human review even if the ML model is confident. If set to `NEVER`, never send the image query for human review even if the ML model is not confident. + :type human_review: str + :param image_query_id: The ID to assign to the created image query. + :type image_query_id: str + :param inspection_id: Associate the image query with an inspection. + :type inspection_id: str + :param metadata: A dictionary of custom key/value metadata to associate with the image query (limited to 1KB). + :type metadata: str + :param patience_time: How long to wait for a confident response. + :type patience_time: float + :param want_async: If \"true\" then submitting an image query returns immediately without a result. The result will be computed asynchronously and can be retrieved later. + :type want_async: str + :param body: + :type body: bytearray + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._submit_image_query_serialize( + detector_id=detector_id, + confidence_threshold=confidence_threshold, + human_review=human_review, + image_query_id=image_query_id, + inspection_id=inspection_id, + metadata=metadata, + patience_time=patience_time, + want_async=want_async, + body=body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "201": "ImageQuery", + } + response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + def submit_image_query_without_preload_content( + self, + detector_id: Annotated[StrictStr, Field(description="Choose a detector by its ID.")], + confidence_threshold: Annotated[ + Optional[ + Union[Annotated[float, Field(le=1, strict=True, ge=0)], Annotated[int, Field(le=1, strict=True, ge=0)]] + ], + Field(description="The confidence threshold for the image query."), + ] = None, + human_review: Annotated[ + Optional[StrictStr], + Field( + description=( + "If set to `DEFAULT`, use the regular escalation logic (i.e., send the image query for human review" + " if the ML model is not confident). If set to `ALWAYS`, always send the image query for human" + " review even if the ML model is confident. If set to `NEVER`, never send the image query for human" + " review even if the ML model is not confident." + ) + ), + ] = None, + image_query_id: Annotated[ + Optional[StrictStr], Field(description="The ID to assign to the created image query.") + ] = None, + inspection_id: Annotated[ + Optional[StrictStr], Field(description="Associate the image query with an inspection.") + ] = None, + metadata: Annotated[ + Optional[StrictStr], + Field( + description=( + "A dictionary of custom key/value metadata to associate with the image query (limited to 1KB)." + ) + ), + ] = None, + patience_time: Annotated[ + Optional[Union[StrictFloat, StrictInt]], Field(description="How long to wait for a confident response.") + ] = None, + want_async: Annotated[ + Optional[StrictStr], + Field( + description=( + 'If "true" then submitting an image query returns immediately without a result. The result will be' + " computed asynchronously and can be retrieved later." + ) + ), + ] = None, + body: Optional[Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]]] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """submit_image_query + + Submit an image query against a detector. You must use `\"Content-Type: image/jpeg\"` or similar (image/png, image/webp, etc) for the image data. For example: ```Bash $ curl https://api.groundlight.ai/device-api/v1/image-queries?detector_id=det_abc123 \\ --header \"Content-Type: image/jpeg\" \\ --data-binary @path/to/filename.jpeg ``` + + :param detector_id: Choose a detector by its ID. (required) + :type detector_id: str + :param confidence_threshold: The confidence threshold for the image query. + :type confidence_threshold: float + :param human_review: If set to `DEFAULT`, use the regular escalation logic (i.e., send the image query for human review if the ML model is not confident). If set to `ALWAYS`, always send the image query for human review even if the ML model is confident. If set to `NEVER`, never send the image query for human review even if the ML model is not confident. + :type human_review: str + :param image_query_id: The ID to assign to the created image query. + :type image_query_id: str + :param inspection_id: Associate the image query with an inspection. + :type inspection_id: str + :param metadata: A dictionary of custom key/value metadata to associate with the image query (limited to 1KB). + :type metadata: str + :param patience_time: How long to wait for a confident response. + :type patience_time: float + :param want_async: If \"true\" then submitting an image query returns immediately without a result. The result will be computed asynchronously and can be retrieved later. + :type want_async: str + :param body: + :type body: bytearray + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._submit_image_query_serialize( + detector_id=detector_id, + confidence_threshold=confidence_threshold, + human_review=human_review, + image_query_id=image_query_id, + inspection_id=inspection_id, + metadata=metadata, + patience_time=patience_time, + want_async=want_async, + body=body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "201": "ImageQuery", + } + response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + return response_data.response + + def _submit_image_query_serialize( + self, + detector_id, + confidence_threshold, + human_review, + image_query_id, + inspection_id, + metadata, + patience_time, + want_async, + body, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + if confidence_threshold is not None: + + _query_params.append(("confidence_threshold", confidence_threshold)) + + if detector_id is not None: + + _query_params.append(("detector_id", detector_id)) + + if human_review is not None: + + _query_params.append(("human_review", human_review)) + + if image_query_id is not None: + + _query_params.append(("image_query_id", image_query_id)) + + if inspection_id is not None: + + _query_params.append(("inspection_id", inspection_id)) + + if metadata is not None: + + _query_params.append(("metadata", metadata)) + + if patience_time is not None: + + _query_params.append(("patience_time", patience_time)) + + if want_async is not None: + + _query_params.append(("want_async", want_async)) + + # process the header parameters + # process the form parameters + # process the body parameter + if body is not None: + # convert to byte array if the input is a file name (str) + if isinstance(body, str): + with open(body, "rb") as _fp: + _body_params = _fp.read() + elif isinstance(body, tuple): + # drop the filename from the tuple + _body_params = body[1] + else: + _body_params = body + + # set the HTTP header `Accept` + if "Accept" not in _header_params: + _header_params["Accept"] = self.api_client.select_header_accept(["application/json"]) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params["Content-Type"] = _content_type + else: + _default_content_type = self.api_client.select_header_content_type( + ["image/jpeg", "image/jpg", "image/png", "image/gif", "image/webp", "image/bmp", "image/x-icon"] + ) + if _default_content_type is not None: + _header_params["Content-Type"] = _default_content_type + + # authentication setting + _auth_settings: List[str] = ["ApiToken"] + + return self.api_client.param_serialize( + method="POST", + resource_path="/v1/image-queries", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth, + ) diff --git a/generated/groundlight_openapi_client/api/labels_api.py b/generated/groundlight_openapi_client/api/labels_api.py index fd948a9f..490115fd 100644 --- a/generated/groundlight_openapi_client/api/labels_api.py +++ b/generated/groundlight_openapi_client/api/labels_api.py @@ -1,134 +1,274 @@ +# coding: utf-8 + """ Groundlight API - Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. # noqa: E501 + Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. The version of the OpenAPI document: 0.18.2 Contact: support@groundlight.ai - Generated by: https://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 -import re # noqa: F401 -import sys # noqa: F401 +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated -from groundlight_openapi_client.api_client import ApiClient, Endpoint as _Endpoint -from groundlight_openapi_client.model_utils import ( # noqa: F401 - check_allowed_values, - check_validations, - date, - datetime, - file_type, - none_type, - validate_and_convert_types, -) -from groundlight_openapi_client.model.label_value import LabelValue -from groundlight_openapi_client.model.label_value_request import LabelValueRequest +from groundlight_openapi_client.models.label_value import LabelValue +from groundlight_openapi_client.models.label_value_request import LabelValueRequest +from groundlight_openapi_client.api_client import ApiClient, RequestSerialized +from groundlight_openapi_client.api_response import ApiResponse +from groundlight_openapi_client.rest import RESTResponseType -class LabelsApi(object): + +class LabelsApi: """NOTE: This class is auto generated by OpenAPI Generator Ref: https://openapi-generator.tech Do not edit the class manually. """ - def __init__(self, api_client=None): + def __init__(self, api_client=None) -> None: if api_client is None: - api_client = ApiClient() + api_client = ApiClient.get_default() self.api_client = api_client - self.create_label_endpoint = _Endpoint( - settings={ - "response_type": (LabelValue,), - "auth": ["ApiToken"], - "endpoint_path": "/v1/labels", - "operation_id": "create_label", - "http_method": "POST", - "servers": None, - }, - params_map={ - "all": [ - "label_value_request", - ], - "required": [ - "label_value_request", - ], - "nullable": [], - "enum": [], - "validation": [], - }, - root_map={ - "validations": {}, - "allowed_values": {}, - "openapi_types": { - "label_value_request": (LabelValueRequest,), - }, - "attribute_map": {}, - "location_map": { - "label_value_request": "body", - }, - "collection_format_map": {}, - }, - headers_map={ - "accept": ["application/json"], - "content_type": ["application/json", "application/x-www-form-urlencoded", "multipart/form-data"], - }, - api_client=api_client, + + @validate_call + def create_label( + self, + label_value_request: LabelValueRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> LabelValue: + """create_label + + Create a new LabelValue and attach it to an image query. This will trigger asynchronous fine-tuner model training. + + :param label_value_request: (required) + :type label_value_request: LabelValueRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_label_serialize( + label_value_request=label_value_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "201": "LabelValue", + } + response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call + def create_label_with_http_info( + self, + label_value_request: LabelValueRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[LabelValue]: + """create_label + + Create a new LabelValue and attach it to an image query. This will trigger asynchronous fine-tuner model training. + + :param label_value_request: (required) + :type label_value_request: LabelValueRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_label_serialize( + label_value_request=label_value_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "201": "LabelValue", + } + response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + def create_label_without_preload_content( + self, + label_value_request: LabelValueRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """create_label + + Create a new LabelValue and attach it to an image query. This will trigger asynchronous fine-tuner model training. + + :param label_value_request: (required) + :type label_value_request: LabelValueRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_label_serialize( + label_value_request=label_value_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, ) - def create_label(self, label_value_request, **kwargs): - """create_label # noqa: E501 - - Create a new LabelValue and attach it to an image query. This will trigger asynchronous fine-tuner model training. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.create_label(label_value_request, async_req=True) - >>> result = thread.get() - - Args: - label_value_request (LabelValueRequest): - - Keyword Args: - _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 - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - LabelValue - If the method is called asynchronously, returns the request - thread. - """ - kwargs["async_req"] = kwargs.get("async_req", False) - kwargs["_return_http_data_only"] = kwargs.get("_return_http_data_only", True) - kwargs["_preload_content"] = kwargs.get("_preload_content", True) - kwargs["_request_timeout"] = kwargs.get("_request_timeout", None) - kwargs["_check_input_type"] = kwargs.get("_check_input_type", True) - kwargs["_check_return_type"] = kwargs.get("_check_return_type", True) - kwargs["_spec_property_naming"] = kwargs.get("_spec_property_naming", False) - kwargs["_content_type"] = kwargs.get("_content_type") - kwargs["_host_index"] = kwargs.get("_host_index") - kwargs["label_value_request"] = label_value_request - return self.create_label_endpoint.call_with_http_info(**kwargs) + _response_types_map: Dict[str, Optional[str]] = { + "201": "LabelValue", + } + response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + return response_data.response + + def _create_label_serialize( + self, + label_value_request, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if label_value_request is not None: + _body_params = label_value_request + + # set the HTTP header `Accept` + if "Accept" not in _header_params: + _header_params["Accept"] = self.api_client.select_header_accept(["application/json"]) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params["Content-Type"] = _content_type + else: + _default_content_type = self.api_client.select_header_content_type( + ["application/json", "application/x-www-form-urlencoded", "multipart/form-data"] + ) + if _default_content_type is not None: + _header_params["Content-Type"] = _default_content_type + + # authentication setting + _auth_settings: List[str] = ["ApiToken"] + + return self.api_client.param_serialize( + method="POST", + resource_path="/v1/labels", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth, + ) diff --git a/generated/groundlight_openapi_client/api/month_to_date_account_info_api.py b/generated/groundlight_openapi_client/api/month_to_date_account_info_api.py index ed467035..782c7d8e 100644 --- a/generated/groundlight_openapi_client/api/month_to_date_account_info_api.py +++ b/generated/groundlight_openapi_client/api/month_to_date_account_info_api.py @@ -1,116 +1,239 @@ +# coding: utf-8 + """ Groundlight API - Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. # noqa: E501 + Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. The version of the OpenAPI document: 0.18.2 Contact: support@groundlight.ai - Generated by: https://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 -import re # noqa: F401 -import sys # noqa: F401 +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated -from groundlight_openapi_client.api_client import ApiClient, Endpoint as _Endpoint -from groundlight_openapi_client.model_utils import ( # noqa: F401 - check_allowed_values, - check_validations, - date, - datetime, - file_type, - none_type, - validate_and_convert_types, -) -from groundlight_openapi_client.model.account_month_to_date_info import AccountMonthToDateInfo +from groundlight_openapi_client.models.account_month_to_date_info import AccountMonthToDateInfo +from groundlight_openapi_client.api_client import ApiClient, RequestSerialized +from groundlight_openapi_client.api_response import ApiResponse +from groundlight_openapi_client.rest import RESTResponseType -class MonthToDateAccountInfoApi(object): + +class MonthToDateAccountInfoApi: """NOTE: This class is auto generated by OpenAPI Generator Ref: https://openapi-generator.tech Do not edit the class manually. """ - def __init__(self, api_client=None): + def __init__(self, api_client=None) -> None: if api_client is None: - api_client = ApiClient() + api_client = ApiClient.get_default() self.api_client = api_client - self.month_to_date_account_info_endpoint = _Endpoint( - settings={ - "response_type": (AccountMonthToDateInfo,), - "auth": ["ApiToken"], - "endpoint_path": "/v1/month-to-date-account-info", - "operation_id": "month_to_date_account_info", - "http_method": "GET", - "servers": None, - }, - params_map={"all": [], "required": [], "nullable": [], "enum": [], "validation": []}, - root_map={ - "validations": {}, - "allowed_values": {}, - "openapi_types": {}, - "attribute_map": {}, - "location_map": {}, - "collection_format_map": {}, - }, - headers_map={ - "accept": ["application/json"], - "content_type": [], - }, - api_client=api_client, + + @validate_call + def month_to_date_account_info( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> AccountMonthToDateInfo: + """month_to_date_account_info + + Fetches and returns the account-specific metrics based on the current user's group. + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._month_to_date_account_info_serialize( + _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "AccountMonthToDateInfo", + } + response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call + def month_to_date_account_info_with_http_info( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[AccountMonthToDateInfo]: + """month_to_date_account_info + + Fetches and returns the account-specific metrics based on the current user's group. + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._month_to_date_account_info_serialize( + _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, _host_index=_host_index ) - def month_to_date_account_info(self, **kwargs): - """month_to_date_account_info # noqa: E501 - - Fetches and returns the account-specific metrics based on the current user's group. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.month_to_date_account_info(async_req=True) - >>> result = thread.get() - - - Keyword Args: - _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 - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - AccountMonthToDateInfo - If the method is called asynchronously, returns the request - thread. - """ - kwargs["async_req"] = kwargs.get("async_req", False) - kwargs["_return_http_data_only"] = kwargs.get("_return_http_data_only", True) - kwargs["_preload_content"] = kwargs.get("_preload_content", True) - kwargs["_request_timeout"] = kwargs.get("_request_timeout", None) - kwargs["_check_input_type"] = kwargs.get("_check_input_type", True) - kwargs["_check_return_type"] = kwargs.get("_check_return_type", True) - kwargs["_spec_property_naming"] = kwargs.get("_spec_property_naming", False) - kwargs["_content_type"] = kwargs.get("_content_type") - kwargs["_host_index"] = kwargs.get("_host_index") - return self.month_to_date_account_info_endpoint.call_with_http_info(**kwargs) + _response_types_map: Dict[str, Optional[str]] = { + "200": "AccountMonthToDateInfo", + } + response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + def month_to_date_account_info_without_preload_content( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """month_to_date_account_info + + Fetches and returns the account-specific metrics based on the current user's group. + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._month_to_date_account_info_serialize( + _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "AccountMonthToDateInfo", + } + response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + return response_data.response + + def _month_to_date_account_info_serialize( + self, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + # set the HTTP header `Accept` + if "Accept" not in _header_params: + _header_params["Accept"] = self.api_client.select_header_accept(["application/json"]) + + # authentication setting + _auth_settings: List[str] = ["ApiToken"] + + return self.api_client.param_serialize( + method="GET", + resource_path="/v1/month-to-date-account-info", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth, + ) diff --git a/generated/groundlight_openapi_client/api/notes_api.py b/generated/groundlight_openapi_client/api/notes_api.py index f1af2cb5..59276acd 100644 --- a/generated/groundlight_openapi_client/api/notes_api.py +++ b/generated/groundlight_openapi_client/api/notes_api.py @@ -1,238 +1,518 @@ +# coding: utf-8 + """ Groundlight API - Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. # noqa: E501 + Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. The version of the OpenAPI document: 0.18.2 Contact: support@groundlight.ai - Generated by: https://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 -import re # noqa: F401 -import sys # noqa: F401 +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated -from groundlight_openapi_client.api_client import ApiClient, Endpoint as _Endpoint -from groundlight_openapi_client.model_utils import ( # noqa: F401 - check_allowed_values, - check_validations, - date, - datetime, - file_type, - none_type, - validate_and_convert_types, -) -from groundlight_openapi_client.model.all_notes import AllNotes -from groundlight_openapi_client.model.note_request import NoteRequest +from pydantic import Field, StrictStr +from typing import Optional +from typing_extensions import Annotated +from groundlight_openapi_client.models.all_notes import AllNotes +from groundlight_openapi_client.models.note_request import NoteRequest +from groundlight_openapi_client.api_client import ApiClient, RequestSerialized +from groundlight_openapi_client.api_response import ApiResponse +from groundlight_openapi_client.rest import RESTResponseType -class NotesApi(object): + +class NotesApi: """NOTE: This class is auto generated by OpenAPI Generator Ref: https://openapi-generator.tech Do not edit the class manually. """ - def __init__(self, api_client=None): + def __init__(self, api_client=None) -> None: if api_client is None: - api_client = ApiClient() + api_client = ApiClient.get_default() self.api_client = api_client - self.create_note_endpoint = _Endpoint( - settings={ - "response_type": None, - "auth": ["ApiToken"], - "endpoint_path": "/v1/notes", - "operation_id": "create_note", - "http_method": "POST", - "servers": None, - }, - params_map={ - "all": [ - "detector_id", - "note_request", - ], - "required": [ - "detector_id", - ], - "nullable": [], - "enum": [], - "validation": [], - }, - root_map={ - "validations": {}, - "allowed_values": {}, - "openapi_types": { - "detector_id": (str,), - "note_request": (NoteRequest,), - }, - "attribute_map": { - "detector_id": "detector_id", - }, - "location_map": { - "detector_id": "query", - "note_request": "body", - }, - "collection_format_map": {}, - }, - headers_map={ - "accept": [], - "content_type": ["application/json", "application/x-www-form-urlencoded", "multipart/form-data"], - }, - api_client=api_client, + + @validate_call + def create_note( + self, + detector_id: Annotated[StrictStr, Field(description="the detector to associate the new note with")], + note_request: Optional[NoteRequest] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """create_note + + Creates a new note. + + :param detector_id: the detector to associate the new note with (required) + :type detector_id: str + :param note_request: + :type note_request: NoteRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_note_serialize( + detector_id=detector_id, + note_request=note_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "204": None, + } + response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call + def create_note_with_http_info( + self, + detector_id: Annotated[StrictStr, Field(description="the detector to associate the new note with")], + note_request: Optional[NoteRequest] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """create_note + + Creates a new note. + + :param detector_id: the detector to associate the new note with (required) + :type detector_id: str + :param note_request: + :type note_request: NoteRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_note_serialize( + detector_id=detector_id, + note_request=note_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "204": None, + } + response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + def create_note_without_preload_content( + self, + detector_id: Annotated[StrictStr, Field(description="the detector to associate the new note with")], + note_request: Optional[NoteRequest] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """create_note + + Creates a new note. + + :param detector_id: the detector to associate the new note with (required) + :type detector_id: str + :param note_request: + :type note_request: NoteRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_note_serialize( + detector_id=detector_id, + note_request=note_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "204": None, + } + response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + return response_data.response + + def _create_note_serialize( + self, + detector_id, + note_request, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + if detector_id is not None: + + _query_params.append(("detector_id", detector_id)) + + # process the header parameters + # process the form parameters + # process the body parameter + if note_request is not None: + _body_params = note_request + + # set the HTTP header `Content-Type` + if _content_type: + _header_params["Content-Type"] = _content_type + else: + _default_content_type = self.api_client.select_header_content_type( + ["application/json", "application/x-www-form-urlencoded", "multipart/form-data"] + ) + if _default_content_type is not None: + _header_params["Content-Type"] = _default_content_type + + # authentication setting + _auth_settings: List[str] = ["ApiToken"] + + return self.api_client.param_serialize( + method="POST", + resource_path="/v1/notes", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth, + ) + + @validate_call + def get_notes( + self, + detector_id: Annotated[StrictStr, Field(description="the detector whose notes to retrieve")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> AllNotes: + """get_notes + + Retrieves all notes from a given detector and returns them in lists, one for each note_category. + + :param detector_id: the detector whose notes to retrieve (required) + :type detector_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_notes_serialize( + detector_id=detector_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, ) - self.get_notes_endpoint = _Endpoint( - settings={ - "response_type": (AllNotes,), - "auth": ["ApiToken"], - "endpoint_path": "/v1/notes", - "operation_id": "get_notes", - "http_method": "GET", - "servers": None, - }, - params_map={ - "all": [ - "detector_id", - ], - "required": [ - "detector_id", - ], - "nullable": [], - "enum": [], - "validation": [], - }, - root_map={ - "validations": {}, - "allowed_values": {}, - "openapi_types": { - "detector_id": (str,), - }, - "attribute_map": { - "detector_id": "detector_id", - }, - "location_map": { - "detector_id": "query", - }, - "collection_format_map": {}, - }, - headers_map={ - "accept": ["application/json"], - "content_type": [], - }, - api_client=api_client, + + _response_types_map: Dict[str, Optional[str]] = { + "200": "AllNotes", + } + response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call + def get_notes_with_http_info( + self, + detector_id: Annotated[StrictStr, Field(description="the detector whose notes to retrieve")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[AllNotes]: + """get_notes + + Retrieves all notes from a given detector and returns them in lists, one for each note_category. + + :param detector_id: the detector whose notes to retrieve (required) + :type detector_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_notes_serialize( + detector_id=detector_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "AllNotes", + } + response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, ) - def create_note(self, detector_id, **kwargs): - """create_note # noqa: E501 - - Creates a new note. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.create_note(detector_id, async_req=True) - >>> result = thread.get() - - Args: - detector_id (str): the detector to associate the new note with - - Keyword Args: - note_request (NoteRequest): [optional] - _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 - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - None - If the method is called asynchronously, returns the request - thread. - """ - kwargs["async_req"] = kwargs.get("async_req", False) - kwargs["_return_http_data_only"] = kwargs.get("_return_http_data_only", True) - kwargs["_preload_content"] = kwargs.get("_preload_content", True) - kwargs["_request_timeout"] = kwargs.get("_request_timeout", None) - kwargs["_check_input_type"] = kwargs.get("_check_input_type", True) - kwargs["_check_return_type"] = kwargs.get("_check_return_type", True) - kwargs["_spec_property_naming"] = kwargs.get("_spec_property_naming", False) - kwargs["_content_type"] = kwargs.get("_content_type") - kwargs["_host_index"] = kwargs.get("_host_index") - kwargs["detector_id"] = detector_id - return self.create_note_endpoint.call_with_http_info(**kwargs) - - def get_notes(self, detector_id, **kwargs): - """get_notes # noqa: E501 - - Retrieves all notes from a given detector and returns them in lists, one for each note_category. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.get_notes(detector_id, async_req=True) - >>> result = thread.get() - - Args: - detector_id (str): the detector whose notes to retrieve - - Keyword Args: - _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 - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - AllNotes - If the method is called asynchronously, returns the request - thread. - """ - kwargs["async_req"] = kwargs.get("async_req", False) - kwargs["_return_http_data_only"] = kwargs.get("_return_http_data_only", True) - kwargs["_preload_content"] = kwargs.get("_preload_content", True) - kwargs["_request_timeout"] = kwargs.get("_request_timeout", None) - kwargs["_check_input_type"] = kwargs.get("_check_input_type", True) - kwargs["_check_return_type"] = kwargs.get("_check_return_type", True) - kwargs["_spec_property_naming"] = kwargs.get("_spec_property_naming", False) - kwargs["_content_type"] = kwargs.get("_content_type") - kwargs["_host_index"] = kwargs.get("_host_index") - kwargs["detector_id"] = detector_id - return self.get_notes_endpoint.call_with_http_info(**kwargs) + @validate_call + def get_notes_without_preload_content( + self, + detector_id: Annotated[StrictStr, Field(description="the detector whose notes to retrieve")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """get_notes + + Retrieves all notes from a given detector and returns them in lists, one for each note_category. + + :param detector_id: the detector whose notes to retrieve (required) + :type detector_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_notes_serialize( + detector_id=detector_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "AllNotes", + } + response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + return response_data.response + + def _get_notes_serialize( + self, + detector_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + if detector_id is not None: + + _query_params.append(("detector_id", detector_id)) + + # process the header parameters + # process the form parameters + # process the body parameter + + # set the HTTP header `Accept` + if "Accept" not in _header_params: + _header_params["Accept"] = self.api_client.select_header_accept(["application/json"]) + + # authentication setting + _auth_settings: List[str] = ["ApiToken"] + + return self.api_client.param_serialize( + method="GET", + resource_path="/v1/notes", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth, + ) diff --git a/generated/groundlight_openapi_client/api/user_api.py b/generated/groundlight_openapi_client/api/user_api.py index a14200f2..0c447457 100644 --- a/generated/groundlight_openapi_client/api/user_api.py +++ b/generated/groundlight_openapi_client/api/user_api.py @@ -1,116 +1,239 @@ +# coding: utf-8 + """ Groundlight API - Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. # noqa: E501 + Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. The version of the OpenAPI document: 0.18.2 Contact: support@groundlight.ai - Generated by: https://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 -import re # noqa: F401 -import sys # noqa: F401 +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated -from groundlight_openapi_client.api_client import ApiClient, Endpoint as _Endpoint -from groundlight_openapi_client.model_utils import ( # noqa: F401 - check_allowed_values, - check_validations, - date, - datetime, - file_type, - none_type, - validate_and_convert_types, -) -from groundlight_openapi_client.model.inline_response2002 import InlineResponse2002 +from groundlight_openapi_client.models.who_am_i200_response import WhoAmI200Response +from groundlight_openapi_client.api_client import ApiClient, RequestSerialized +from groundlight_openapi_client.api_response import ApiResponse +from groundlight_openapi_client.rest import RESTResponseType -class UserApi(object): + +class UserApi: """NOTE: This class is auto generated by OpenAPI Generator Ref: https://openapi-generator.tech Do not edit the class manually. """ - def __init__(self, api_client=None): + def __init__(self, api_client=None) -> None: if api_client is None: - api_client = ApiClient() + api_client = ApiClient.get_default() self.api_client = api_client - self.who_am_i_endpoint = _Endpoint( - settings={ - "response_type": (InlineResponse2002,), - "auth": ["ApiToken"], - "endpoint_path": "/v1/me", - "operation_id": "who_am_i", - "http_method": "GET", - "servers": None, - }, - params_map={"all": [], "required": [], "nullable": [], "enum": [], "validation": []}, - root_map={ - "validations": {}, - "allowed_values": {}, - "openapi_types": {}, - "attribute_map": {}, - "location_map": {}, - "collection_format_map": {}, - }, - headers_map={ - "accept": ["application/json"], - "content_type": [], - }, - api_client=api_client, + + @validate_call + def who_am_i( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> WhoAmI200Response: + """who_am_i + + Retrieve the current user. + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._who_am_i_serialize( + _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "WhoAmI200Response", + } + response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call + def who_am_i_with_http_info( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[WhoAmI200Response]: + """who_am_i + + Retrieve the current user. + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._who_am_i_serialize( + _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, _host_index=_host_index ) - def who_am_i(self, **kwargs): - """who_am_i # noqa: E501 - - Retrieve the current user. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.who_am_i(async_req=True) - >>> result = thread.get() - - - Keyword Args: - _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 - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - InlineResponse2002 - If the method is called asynchronously, returns the request - thread. - """ - kwargs["async_req"] = kwargs.get("async_req", False) - kwargs["_return_http_data_only"] = kwargs.get("_return_http_data_only", True) - kwargs["_preload_content"] = kwargs.get("_preload_content", True) - kwargs["_request_timeout"] = kwargs.get("_request_timeout", None) - kwargs["_check_input_type"] = kwargs.get("_check_input_type", True) - kwargs["_check_return_type"] = kwargs.get("_check_return_type", True) - kwargs["_spec_property_naming"] = kwargs.get("_spec_property_naming", False) - kwargs["_content_type"] = kwargs.get("_content_type") - kwargs["_host_index"] = kwargs.get("_host_index") - return self.who_am_i_endpoint.call_with_http_info(**kwargs) + _response_types_map: Dict[str, Optional[str]] = { + "200": "WhoAmI200Response", + } + response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + def who_am_i_without_preload_content( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """who_am_i + + Retrieve the current user. + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._who_am_i_serialize( + _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "WhoAmI200Response", + } + response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + return response_data.response + + def _who_am_i_serialize( + self, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + # set the HTTP header `Accept` + if "Accept" not in _header_params: + _header_params["Accept"] = self.api_client.select_header_accept(["application/json"]) + + # authentication setting + _auth_settings: List[str] = ["ApiToken"] + + return self.api_client.param_serialize( + method="GET", + resource_path="/v1/me", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth, + ) diff --git a/generated/groundlight_openapi_client/api_client.py b/generated/groundlight_openapi_client/api_client.py index da2e348a..33f355a0 100644 --- a/generated/groundlight_openapi_client/api_client.py +++ b/generated/groundlight_openapi_client/api_client.py @@ -1,45 +1,51 @@ +# coding: utf-8 + """ Groundlight API - Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. # noqa: E501 + Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. The version of the OpenAPI document: 0.18.2 Contact: support@groundlight.ai - Generated by: https://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + +import datetime +from dateutil.parser import parse +from enum import Enum +import decimal import json -import atexit import mimetypes -from multiprocessing.pool import ThreadPool -import io import os import re -import typing -from urllib.parse import quote -from urllib3.fields import RequestField +import tempfile +import uuid +from urllib.parse import quote +from typing import Tuple, Optional, List, Dict, Union +from pydantic import SecretStr -from groundlight_openapi_client import rest from groundlight_openapi_client.configuration import Configuration -from groundlight_openapi_client.exceptions import ApiTypeError, ApiValueError, ApiException -from groundlight_openapi_client.model_utils import ( - ModelNormal, - ModelSimple, - ModelComposed, - check_allowed_values, - check_validations, - date, - datetime, - deserialize_file, - file_type, - model_to_dict, - none_type, - validate_and_convert_types, +from groundlight_openapi_client.api_response import ApiResponse, T as ApiResponseT +import groundlight_openapi_client.models +from groundlight_openapi_client import rest +from groundlight_openapi_client.exceptions import ( + ApiValueError, + ApiException, + BadRequestException, + UnauthorizedException, + ForbiddenException, + NotFoundException, + ServiceException, ) +RequestSerialized = Tuple[str, str, Dict[str, str], Optional[str], List[str]] + -class ApiClient(object): +class ApiClient: """Generic API client for OpenAPI client library builds. OpenAPI generic API client. This client handles the client- @@ -47,27 +53,33 @@ class ApiClient(object): the methods and models for each application are generated from the OpenAPI templates. - NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - Do not edit the class manually. - :param configuration: .Configuration object for this client :param header_name: a header to pass when making calls to the API. :param header_value: a header value to pass when making calls to the API. :param cookie: a cookie to include in the header when making calls to the API - :param pool_threads: The number of threads to use for async requests - to the API. More threads means more concurrent API requests. """ + PRIMITIVE_TYPES = (float, bool, bytes, str, int) + NATIVE_TYPES_MAPPING = { + "int": int, + "long": int, # TODO remove as only py3 is supported? + "float": float, + "str": str, + "bool": bool, + "date": datetime.date, + "datetime": datetime.datetime, + "decimal": decimal.Decimal, + "object": object, + } _pool = None - def __init__(self, configuration=None, header_name=None, header_value=None, cookie=None, pool_threads=1): + def __init__(self, configuration=None, header_name=None, header_value=None, cookie=None) -> None: + # use default configuration if none is provided if configuration is None: - configuration = Configuration.get_default_copy() + configuration = Configuration.get_default() self.configuration = configuration - self.pool_threads = pool_threads self.rest_client = rest.RESTClientObject(configuration) self.default_headers = {} @@ -76,30 +88,13 @@ def __init__(self, configuration=None, header_name=None, header_value=None, cook self.cookie = cookie # Set default User-Agent. self.user_agent = "OpenAPI-Generator/1.0.0/python" + self.client_side_validation = configuration.client_side_validation def __enter__(self): return self def __exit__(self, exc_type, exc_value, traceback): - self.close() - - def close(self): - if self._pool: - self._pool.close() - self._pool.join() - self._pool = None - if hasattr(atexit, "unregister"): - atexit.unregister(self.close) - - @property - def pool(self): - """Create thread pool on first request - avoids instantiating unused threadpool for blocking clients. - """ - if self._pool is None: - atexit.register(self.close) - self._pool = ThreadPool(self.pool_threads) - return self._pool + pass @property def user_agent(self): @@ -113,26 +108,68 @@ def user_agent(self, value): def set_default_header(self, header_name, header_value): self.default_headers[header_name] = header_value - def __call_api( + _default = None + + @classmethod + def get_default(cls): + """Return new instance of ApiClient. + + This method returns newly created, based on default constructor, + object of ApiClient class or returns a copy of default + ApiClient. + + :return: The ApiClient object. + """ + if cls._default is None: + cls._default = ApiClient() + return cls._default + + @classmethod + def set_default(cls, default): + """Set default instance of ApiClient. + + It stores default ApiClient. + + :param default: object of ApiClient. + """ + cls._default = default + + def param_serialize( self, - resource_path: str, - method: str, - path_params: typing.Optional[typing.Dict[str, typing.Any]] = None, - query_params: typing.Optional[typing.List[typing.Tuple[str, typing.Any]]] = None, - header_params: typing.Optional[typing.Dict[str, typing.Any]] = None, - body: typing.Optional[typing.Any] = None, - post_params: typing.Optional[typing.List[typing.Tuple[str, typing.Any]]] = None, - files: typing.Optional[typing.Dict[str, typing.List[io.IOBase]]] = None, - response_type: typing.Optional[typing.Tuple[typing.Any]] = None, - auth_settings: typing.Optional[typing.List[str]] = None, - _return_http_data_only: typing.Optional[bool] = None, - collection_formats: typing.Optional[typing.Dict[str, str]] = None, - _preload_content: bool = True, - _request_timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - _host: typing.Optional[str] = None, - _check_type: typing.Optional[bool] = None, - _content_type: typing.Optional[str] = None, - ): + method, + resource_path, + path_params=None, + query_params=None, + header_params=None, + body=None, + post_params=None, + files=None, + auth_settings=None, + collection_formats=None, + _host=None, + _request_auth=None, + ) -> RequestSerialized: + """Builds the HTTP request params needed by the request. + :param method: Method to call. + :param resource_path: Path to method endpoint. + :param path_params: Path parameters in the url. + :param query_params: Query parameters in the url. + :param header_params: Header parameters to be + placed in the request header. + :param body: Request body. + :param post_params dict: Request post form parameters, + for `application/x-www-form-urlencoded`, `multipart/form-data`. + :param auth_settings list: Auth Settings names for the request. + :param files dict: key -> filename, value -> filepath, + for `multipart/form-data`. + :param collection_formats: dict of collection formats for path, query, + header, and post parameters. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :return: tuple of form (path, http_method, query_params, header_params, + body, post_params, files) + """ config = self.configuration @@ -153,361 +190,244 @@ def __call_api( # specified safe chars, encode everything resource_path = resource_path.replace("{%s}" % k, quote(str(v), safe=config.safe_chars_for_path_param)) - # query parameters - if query_params: - query_params = self.sanitize_for_serialization(query_params) - query_params = self.parameters_to_tuples(query_params, collection_formats) - # post parameters if post_params or files: post_params = post_params if post_params else [] post_params = self.sanitize_for_serialization(post_params) post_params = self.parameters_to_tuples(post_params, collection_formats) - post_params.extend(self.files_parameters(files)) - if header_params["Content-Type"].startswith("multipart"): - post_params = self.parameters_to_multipart(post_params, (dict)) + if files: + post_params.extend(self.files_parameters(files)) + + # auth setting + self.update_params_for_auth( + header_params, query_params, auth_settings, resource_path, method, body, request_auth=_request_auth + ) # body if body: body = self.sanitize_for_serialization(body) - # auth setting - self.update_params_for_auth(header_params, query_params, auth_settings, resource_path, method, body) - # request url - if _host is None: + if _host is None or self.configuration.ignore_operation_servers: url = self.configuration.host + resource_path else: # use server/host defined in path or operation instead url = _host + resource_path + # query parameters + if query_params: + query_params = self.sanitize_for_serialization(query_params) + url_query = self.parameters_to_url_query(query_params, collection_formats) + url += "?" + url_query + + return method, url, header_params, body, post_params + + def call_api( + self, method, url, header_params=None, body=None, post_params=None, _request_timeout=None + ) -> rest.RESTResponse: + """Makes the HTTP request (synchronous) + :param method: Method to call. + :param url: Path to method endpoint. + :param header_params: Header parameters to be + placed in the request header. + :param body: Request body. + :param post_params dict: Request post form parameters, + for `application/x-www-form-urlencoded`, `multipart/form-data`. + :param _request_timeout: timeout setting for this request. + :return: RESTResponse + """ + try: # perform request and return response - response_data = self.request( + response_data = self.rest_client.request( method, url, - query_params=query_params, headers=header_params, - post_params=post_params, body=body, - _preload_content=_preload_content, + post_params=post_params, _request_timeout=_request_timeout, ) + except ApiException as e: - e.body = e.body.decode("utf-8") raise e - self.last_response = response_data + return response_data - return_data = response_data + def response_deserialize( + self, response_data: rest.RESTResponse, response_types_map: Optional[Dict[str, ApiResponseT]] = None + ) -> ApiResponse[ApiResponseT]: + """Deserializes response into an object. + :param response_data: RESTResponse object to be deserialized. + :param response_types_map: dict of response types. + :return: ApiResponse + """ + + msg = "RESTResponse.read() must be called before passing it to response_deserialize()" + assert response_data.data is not None, msg - if not _preload_content: - return return_data - return return_data + response_type = response_types_map.get(str(response_data.status), None) + if not response_type and isinstance(response_data.status, int) and 100 <= response_data.status <= 599: + # if not found, look for '1XX', '2XX', etc. + response_type = response_types_map.get(str(response_data.status)[0] + "XX", None) # deserialize response data - if response_type: - if response_type != (file_type,): - encoding = "utf-8" - content_type = response_data.getheader("content-type") + response_text = None + return_data = None + try: + if response_type == "bytearray": + return_data = response_data.data + elif response_type == "file": + return_data = self.__deserialize_file(response_data) + elif response_type is not None: + match = None + content_type = response_data.headers.get("content-type") if content_type is not None: - match = re.search(r"charset=([a-zA-Z\-\d]+)[\s\;]?", content_type) - if match: - encoding = match.group(1) - response_data.data = response_data.data.decode(encoding) - - return_data = self.deserialize(response_data, response_type, _check_type) - else: - return_data = None - - if _return_http_data_only: - return return_data - else: - return (return_data, response_data.status, response_data.getheaders()) + match = re.search(r"charset=([a-zA-Z\-\d]+)[\s;]?", content_type) + encoding = match.group(1) if match else "utf-8" + response_text = response_data.data.decode(encoding) + return_data = self.deserialize(response_text, response_type, content_type) + finally: + if not 200 <= response_data.status <= 299: + raise ApiException.from_response( + http_resp=response_data, + body=response_text, + data=return_data, + ) - def parameters_to_multipart(self, params, collection_types): - """Get parameters as list of tuples, formatting as json if value is collection_types + return ApiResponse( + status_code=response_data.status, + data=return_data, + headers=response_data.headers, + raw_data=response_data.data, + ) - :param params: Parameters as list of two-tuples - :param dict collection_types: Parameter collection types - :return: Parameters as list of tuple or urllib3.fields.RequestField - """ - new_params = [] - if collection_types is None: - collection_types = dict - for k, v in params.items() if isinstance(params, dict) else params: # noqa: E501 - if isinstance(v, collection_types): # v is instance of collection_type, formatting as application/json - v = json.dumps(v, ensure_ascii=False).encode("utf-8") - field = RequestField(k, v) - field.make_multipart(content_type="application/json; charset=utf-8") - new_params.append(field) - else: - new_params.append((k, v)) - return new_params + def sanitize_for_serialization(self, obj): + """Builds a JSON POST object. - @classmethod - def sanitize_for_serialization(cls, obj): - """Prepares data for transmission before it is sent with the rest client If obj is None, return None. + If obj is SecretStr, return obj.get_secret_value() If obj is str, int, long, float, bool, return directly. If obj is datetime.datetime, datetime.date convert to string in iso8601 format. + If obj is decimal.Decimal return string representation. If obj is list, sanitize each element in the list. If obj is dict, return the dict. If obj is OpenAPI model, return the properties dict. - If obj is io.IOBase, return the bytes + :param obj: The data to serialize. :return: The serialized form of data. """ - if isinstance(obj, (ModelNormal, ModelComposed)): - return {key: cls.sanitize_for_serialization(val) for key, val in model_to_dict(obj, serialize=True).items()} - elif isinstance(obj, io.IOBase): - return cls.get_file_data_and_close_file(obj) - elif isinstance(obj, (str, int, float, none_type, bool)): + if obj is None: + return None + elif isinstance(obj, Enum): + return obj.value + elif isinstance(obj, SecretStr): + return obj.get_secret_value() + elif isinstance(obj, self.PRIMITIVE_TYPES): return obj - elif isinstance(obj, (datetime, date)): + elif isinstance(obj, uuid.UUID): + return str(obj) + elif isinstance(obj, list): + return [self.sanitize_for_serialization(sub_obj) for sub_obj in obj] + elif isinstance(obj, tuple): + return tuple(self.sanitize_for_serialization(sub_obj) for sub_obj in obj) + elif isinstance(obj, (datetime.datetime, datetime.date)): return obj.isoformat() - elif isinstance(obj, ModelSimple): - return cls.sanitize_for_serialization(obj.value) - elif isinstance(obj, (list, tuple)): - return [cls.sanitize_for_serialization(item) for item in obj] - if isinstance(obj, dict): - return {key: cls.sanitize_for_serialization(val) for key, val in obj.items()} - raise ApiValueError("Unable to prepare type {} for serialization".format(obj.__class__.__name__)) - - def deserialize(self, response, response_type, _check_type): + elif isinstance(obj, decimal.Decimal): + return str(obj) + + elif isinstance(obj, dict): + obj_dict = obj + else: + # Convert model obj to dict except + # attributes `openapi_types`, `attribute_map` + # and attributes which value is not None. + # Convert attribute name to json key in + # model definition for request. + if hasattr(obj, "to_dict") and callable(getattr(obj, "to_dict")): + obj_dict = obj.to_dict() + else: + obj_dict = obj.__dict__ + + if isinstance(obj_dict, list): + # here we handle instances that can either be a list or something else, and only became a real list by calling to_dict() + return self.sanitize_for_serialization(obj_dict) + + return {key: self.sanitize_for_serialization(val) for key, val in obj_dict.items()} + + def deserialize(self, response_text: str, response_type: str, content_type: Optional[str]): """Deserializes response into an object. :param response: RESTResponse object to be deserialized. - :param response_type: For the response, a tuple containing: - valid classes - a list containing valid classes (for list schemas) - a dict containing a tuple of valid classes as the value - Example values: - (str,) - (Pet,) - (float, none_type) - ([int, none_type],) - ({str: (bool, str, int, float, date, datetime, str, none_type)},) - :param _check_type: boolean, whether to check the types of the data - received from the server - :type _check_type: bool + :param response_type: class literal for + deserialized object, or string of class name. + :param content_type: content type of response. :return: deserialized object. """ - # handle file downloading - # save response body into a tmp file and return the instance - if response_type == (file_type,): - content_disposition = response.getheader("Content-Disposition") - return deserialize_file(response.data, self.configuration, content_disposition=content_disposition) # fetch data from response object - try: - received_data = json.loads(response.data) - except ValueError: - received_data = response.data + if content_type is None: + try: + data = json.loads(response_text) + except ValueError: + data = response_text + elif re.match(r"^application/(json|[\w!#$&.+\-^_]+\+json)\s*(;|$)", content_type, re.IGNORECASE): + if response_text == "": + data = "" + else: + data = json.loads(response_text) + elif re.match(r"^text\/[a-z.+-]+\s*(;|$)", content_type, re.IGNORECASE): + data = response_text + else: + raise ApiException(status=0, reason="Unsupported content type: {0}".format(content_type)) - # store our data under the key of 'received_data' so users have some - # context if they are deserializing a string and the data type is wrong - deserialized_data = validate_and_convert_types( - received_data, response_type, ["received_data"], True, _check_type, configuration=self.configuration - ) - return deserialized_data + return self.__deserialize(data, response_type) - def call_api( - self, - resource_path: str, - method: str, - path_params: typing.Optional[typing.Dict[str, typing.Any]] = None, - query_params: typing.Optional[typing.List[typing.Tuple[str, typing.Any]]] = None, - header_params: typing.Optional[typing.Dict[str, typing.Any]] = None, - body: typing.Optional[typing.Any] = None, - post_params: typing.Optional[typing.List[typing.Tuple[str, typing.Any]]] = None, - files: typing.Optional[typing.Dict[str, typing.List[io.IOBase]]] = None, - response_type: typing.Optional[typing.Tuple[typing.Any]] = None, - auth_settings: typing.Optional[typing.List[str]] = None, - async_req: typing.Optional[bool] = None, - _return_http_data_only: typing.Optional[bool] = None, - collection_formats: typing.Optional[typing.Dict[str, str]] = None, - _preload_content: bool = True, - _request_timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - _host: typing.Optional[str] = None, - _check_type: typing.Optional[bool] = None, - ): - """Makes the HTTP request (synchronous) and returns deserialized data. + def __deserialize(self, data, klass): + """Deserializes dict, list, str into an object. - To make an async_req request, set the async_req parameter. + :param data: dict, list or str. + :param klass: class literal, or string of class name. - :param resource_path: Path to method endpoint. - :param method: Method to call. - :param path_params: Path parameters in the url. - :param query_params: Query parameters in the url. - :param header_params: Header parameters to be - placed in the request header. - :param body: Request body. - :param post_params dict: Request post form parameters, - for `application/x-www-form-urlencoded`, `multipart/form-data`. - :param auth_settings list: Auth Settings names for the request. - :param response_type: For the response, a tuple containing: - valid classes - a list containing valid classes (for list schemas) - a dict containing a tuple of valid classes as the value - Example values: - (str,) - (Pet,) - (float, none_type) - ([int, none_type],) - ({str: (bool, str, int, float, date, datetime, str, none_type)},) - :param files: key -> field name, value -> a list of open file - objects for `multipart/form-data`. - :type files: dict - :param async_req bool: execute request asynchronously - :type async_req: bool, optional - :param _return_http_data_only: response data without head status code - and headers - :type _return_http_data_only: bool, optional - :param collection_formats: dict of collection formats for path, query, - header, and post parameters. - :type collection_formats: dict, optional - :param _preload_content: if False, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is True. - :type _preload_content: bool, optional - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :param _check_type: boolean describing if the data back from the server - should have its type checked. - :type _check_type: bool, optional - :return: - If async_req parameter is True, - the request will be called asynchronously. - The method will return the request thread. - If parameter async_req is False or missing, - then the method will return the response directly. + :return: object. """ - if not async_req: - return self.__call_api( - resource_path, - method, - path_params, - query_params, - header_params, - body, - post_params, - files, - response_type, - auth_settings, - _return_http_data_only, - collection_formats, - _preload_content, - _request_timeout, - _host, - _check_type, - ) - - return self.pool.apply_async( - self.__call_api, - ( - resource_path, - method, - path_params, - query_params, - header_params, - body, - post_params, - files, - response_type, - auth_settings, - _return_http_data_only, - collection_formats, - _preload_content, - _request_timeout, - _host, - _check_type, - ), - ) - - def request( - self, - method, - url, - query_params=None, - headers=None, - post_params=None, - body=None, - _preload_content=True, - _request_timeout=None, - ): - """Makes the HTTP request using RESTClient.""" - if method == "GET": - return self.rest_client.GET( - url, - query_params=query_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - headers=headers, - ) - elif method == "HEAD": - return self.rest_client.HEAD( - url, - query_params=query_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - headers=headers, - ) - elif method == "OPTIONS": - return self.rest_client.OPTIONS( - url, - query_params=query_params, - headers=headers, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body, - ) - elif method == "POST": - return self.rest_client.POST( - url, - query_params=query_params, - headers=headers, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body, - ) - elif method == "PUT": - return self.rest_client.PUT( - url, - query_params=query_params, - headers=headers, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body, - ) - elif method == "PATCH": - return self.rest_client.PATCH( - url, - query_params=query_params, - headers=headers, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body, - ) - elif method == "DELETE": - return self.rest_client.DELETE( - url, - query_params=query_params, - headers=headers, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body, - ) + if data is None: + return None + + if isinstance(klass, str): + if klass.startswith("List["): + m = re.match(r"List\[(.*)]", klass) + assert m is not None, "Malformed List type definition" + sub_kls = m.group(1) + return [self.__deserialize(sub_data, sub_kls) for sub_data in data] + + if klass.startswith("Dict["): + m = re.match(r"Dict\[([^,]*), (.*)]", klass) + assert m is not None, "Malformed Dict type definition" + sub_kls = m.group(2) + return {k: self.__deserialize(v, sub_kls) for k, v in data.items()} + + # convert str to class + if klass in self.NATIVE_TYPES_MAPPING: + klass = self.NATIVE_TYPES_MAPPING[klass] + else: + klass = getattr(groundlight_openapi_client.models, klass) + + if klass in self.PRIMITIVE_TYPES: + return self.__deserialize_primitive(data, klass) + elif klass is object: + return self.__deserialize_object(data) + elif klass is datetime.date: + return self.__deserialize_date(data) + elif klass is datetime.datetime: + return self.__deserialize_datetime(data) + elif klass is decimal.Decimal: + return decimal.Decimal(data) + elif issubclass(klass, Enum): + return self.__deserialize_enum(data, klass) else: - raise ApiValueError("http method must be `GET`, `HEAD`, `OPTIONS`, `POST`, `PATCH`, `PUT` or `DELETE`.") + return self.__deserialize_model(data, klass) def parameters_to_tuples(self, params, collection_formats): """Get parameters as list of tuples, formatting collections. @@ -516,10 +436,10 @@ def parameters_to_tuples(self, params, collection_formats): :param dict collection_formats: Parameter collection formats :return: Parameters as list of tuples, collections formatted """ - new_params = [] + new_params: List[Tuple[str, str]] = [] if collection_formats is None: collection_formats = {} - for k, v in params.items() if isinstance(params, dict) else params: # noqa: E501 + for k, v in params.items() if isinstance(params, dict) else params: if k in collection_formats: collection_format = collection_formats[k] if collection_format == "multi": @@ -538,320 +458,246 @@ def parameters_to_tuples(self, params, collection_formats): new_params.append((k, v)) return new_params - @staticmethod - def get_file_data_and_close_file(file_instance: io.IOBase) -> bytes: - file_data = file_instance.read() - file_instance.close() - return file_data + def parameters_to_url_query(self, params, collection_formats): + """Get parameters as list of tuples, formatting collections. + + :param params: Parameters as dict or list of two-tuples + :param dict collection_formats: Parameter collection formats + :return: URL query string (e.g. a=Hello%20World&b=123) + """ + new_params: List[Tuple[str, str]] = [] + if collection_formats is None: + collection_formats = {} + for k, v in params.items() if isinstance(params, dict) else params: + if isinstance(v, bool): + v = str(v).lower() + if isinstance(v, (int, float)): + v = str(v) + if isinstance(v, dict): + v = json.dumps(v) - def files_parameters(self, files: typing.Optional[typing.Dict[str, typing.List[io.IOBase]]] = None): + if k in collection_formats: + collection_format = collection_formats[k] + if collection_format == "multi": + new_params.extend((k, quote(str(value))) for value in v) + else: + if collection_format == "ssv": + delimiter = " " + elif collection_format == "tsv": + delimiter = "\t" + elif collection_format == "pipes": + delimiter = "|" + else: # csv is the default + delimiter = "," + new_params.append((k, delimiter.join(quote(str(value)) for value in v))) + else: + new_params.append((k, quote(str(v)))) + + return "&".join(["=".join(map(str, item)) for item in new_params]) + + def files_parameters( + self, + files: Dict[str, Union[str, bytes, List[str], List[bytes], Tuple[str, bytes]]], + ): """Builds form parameters. - :param files: None or a dict with key=param_name and - value is a list of open file objects - :return: List of tuples of form parameters with file data + :param files: File parameters. + :return: Form parameters with files. """ - if files is None: - return [] - params = [] - for param_name, file_instances in files.items(): - if file_instances is None: - # if the file field is nullable, skip None values + for k, v in files.items(): + if isinstance(v, str): + with open(v, "rb") as f: + filename = os.path.basename(f.name) + filedata = f.read() + elif isinstance(v, bytes): + filename = k + filedata = v + elif isinstance(v, tuple): + filename, filedata = v + elif isinstance(v, list): + for file_param in v: + params.extend(self.files_parameters({k: file_param})) continue - for file_instance in file_instances: - if file_instance is None: - # if the file field is nullable, skip None values - continue - if file_instance.closed is True: - raise ApiValueError( - "Cannot read a closed file. The passed in file_type for %s must be open." % param_name - ) - filename = os.path.basename(file_instance.name) - filedata = self.get_file_data_and_close_file(file_instance) - mimetype = mimetypes.guess_type(filename)[0] or "application/octet-stream" - params.append(tuple([param_name, tuple([filename, filedata, mimetype])])) - + else: + raise ValueError("Unsupported file value") + mimetype = mimetypes.guess_type(filename)[0] or "application/octet-stream" + params.append(tuple([k, tuple([filename, filedata, mimetype])])) return params - def select_header_accept(self, accepts): + def select_header_accept(self, accepts: List[str]) -> Optional[str]: """Returns `Accept` based on an array of accepts provided. :param accepts: List of headers. :return: Accept (e.g. application/json). """ if not accepts: - return + return None - accepts = [x.lower() for x in accepts] + for accept in accepts: + if re.search("json", accept, re.IGNORECASE): + return accept - if "application/json" in accepts: - return "application/json" - else: - return ", ".join(accepts) + return accepts[0] - def select_header_content_type(self, content_types, method=None, body=None): + def select_header_content_type(self, content_types): """Returns `Content-Type` based on an array of content_types provided. :param content_types: List of content-types. - :param method: http method (e.g. POST, PATCH). - :param body: http body to send. :return: Content-Type (e.g. application/json). """ if not content_types: - return "application/json" + return None - content_types = [x.lower() for x in content_types] + for content_type in content_types: + if re.search("json", content_type, re.IGNORECASE): + return content_type - if method == "PATCH" and "application/json-patch+json" in content_types and isinstance(body, list): - return "application/json-patch+json" + return content_types[0] - if "application/json" in content_types or "*/*" in content_types: - return "application/json" - else: - return content_types[0] - - def update_params_for_auth(self, headers, queries, auth_settings, resource_path, method, body): + def update_params_for_auth( + self, headers, queries, auth_settings, resource_path, method, body, request_auth=None + ) -> None: """Updates header and query params based on authentication setting. :param headers: Header parameters dict to be updated. :param queries: Query parameters tuple list to be updated. :param auth_settings: Authentication setting identifiers list. - :param resource_path: A string representation of the HTTP request resource path. - :param method: A string representation of the HTTP request method. - :param body: A object representing the body of the HTTP request. - The object type is the return value of _encoder.default(). + :resource_path: A string representation of the HTTP request resource path. + :method: A string representation of the HTTP request method. + :body: A object representing the body of the HTTP request. + The object type is the return value of sanitize_for_serialization(). + :param request_auth: if set, the provided settings will + override the token in the configuration. """ if not auth_settings: return - for auth in auth_settings: - auth_setting = self.configuration.auth_settings().get(auth) - if auth_setting: - if auth_setting["in"] == "cookie": - headers["Cookie"] = auth_setting["value"] - elif auth_setting["in"] == "header": - if auth_setting["type"] != "http-signature": - headers[auth_setting["key"]] = auth_setting["value"] - elif auth_setting["in"] == "query": - queries.append((auth_setting["key"], auth_setting["value"])) - else: - raise ApiValueError("Authentication token must be in `query` or `header`") - - -class Endpoint(object): - def __init__(self, settings=None, params_map=None, root_map=None, headers_map=None, api_client=None, callable=None): - """Creates an endpoint - - Args: - settings (dict): see below key value pairs - 'response_type' (tuple/None): response type - 'auth' (list): a list of auth type keys - 'endpoint_path' (str): the endpoint path - 'operation_id' (str): endpoint string identifier - 'http_method' (str): POST/PUT/PATCH/GET etc - 'servers' (list): list of str servers that this endpoint is at - params_map (dict): see below key value pairs - 'all' (list): list of str endpoint parameter names - 'required' (list): list of required parameter names - 'nullable' (list): list of nullable parameter names - 'enum' (list): list of parameters with enum values - 'validation' (list): list of parameters with validations - root_map - 'validations' (dict): the dict mapping endpoint parameter tuple - paths to their validation dictionaries - 'allowed_values' (dict): the dict mapping endpoint parameter - tuple paths to their allowed_values (enum) dictionaries - 'openapi_types' (dict): param_name to openapi type - 'attribute_map' (dict): param_name to camelCase name - 'location_map' (dict): param_name to 'body', 'file', 'form', - 'header', 'path', 'query' - collection_format_map (dict): param_name to `csv` etc. - headers_map (dict): see below key value pairs - 'accept' (list): list of Accept header strings - 'content_type' (list): list of Content-Type header strings - api_client (ApiClient) api client instance - callable (function): the function which is invoked when the - Endpoint is called + if request_auth: + self._apply_auth_params(headers, queries, resource_path, method, body, request_auth) + else: + for auth in auth_settings: + auth_setting = self.configuration.auth_settings().get(auth) + if auth_setting: + self._apply_auth_params(headers, queries, resource_path, method, body, auth_setting) + + def _apply_auth_params(self, headers, queries, resource_path, method, body, auth_setting) -> None: + """Updates the request parameters based on a single auth_setting + + :param headers: Header parameters dict to be updated. + :param queries: Query parameters tuple list to be updated. + :resource_path: A string representation of the HTTP request resource path. + :method: A string representation of the HTTP request method. + :body: A object representing the body of the HTTP request. + The object type is the return value of sanitize_for_serialization(). + :param auth_setting: auth settings for the endpoint """ - self.settings = settings - self.params_map = params_map - self.params_map["all"].extend([ - "async_req", - "_host_index", - "_preload_content", - "_request_timeout", - "_return_http_data_only", - "_check_input_type", - "_check_return_type", - "_content_type", - "_spec_property_naming", - ]) - self.params_map["nullable"].extend(["_request_timeout"]) - self.validations = root_map["validations"] - self.allowed_values = root_map["allowed_values"] - self.openapi_types = root_map["openapi_types"] - extra_types = { - "async_req": (bool,), - "_host_index": (none_type, int), - "_preload_content": (bool,), - "_request_timeout": (none_type, float, (float,), [float], int, (int,), [int]), - "_return_http_data_only": (bool,), - "_check_input_type": (bool,), - "_check_return_type": (bool,), - "_spec_property_naming": (bool,), - "_content_type": (none_type, str), - } - self.openapi_types.update(extra_types) - self.attribute_map = root_map["attribute_map"] - self.location_map = root_map["location_map"] - self.collection_format_map = root_map["collection_format_map"] - self.headers_map = headers_map - self.api_client = api_client - self.callable = callable - - def __validate_inputs(self, kwargs): - for param in self.params_map["enum"]: - if param in kwargs: - check_allowed_values(self.allowed_values, (param,), kwargs[param]) - - for param in self.params_map["validation"]: - if param in kwargs: - check_validations( - self.validations, (param,), kwargs[param], configuration=self.api_client.configuration - ) + if auth_setting["in"] == "cookie": + headers["Cookie"] = auth_setting["value"] + elif auth_setting["in"] == "header": + if auth_setting["type"] != "http-signature": + headers[auth_setting["key"]] = auth_setting["value"] + elif auth_setting["in"] == "query": + queries.append((auth_setting["key"], auth_setting["value"])) + else: + raise ApiValueError("Authentication token must be in `query` or `header`") - if kwargs["_check_input_type"] is False: - return + def __deserialize_file(self, response): + """Deserializes body to file - for key, value in kwargs.items(): - fixed_val = validate_and_convert_types( - value, - self.openapi_types[key], - [key], - kwargs["_spec_property_naming"], - kwargs["_check_input_type"], - configuration=self.api_client.configuration, - ) - kwargs[key] = fixed_val + Saves response body into a file in a temporary folder, + using the filename from the `Content-Disposition` header if provided. - def __gather_params(self, kwargs): - params = {"body": None, "collection_format": {}, "file": {}, "form": [], "header": {}, "path": {}, "query": []} + handle file downloading + save response body into a tmp file and return the instance - for param_name, param_value in kwargs.items(): - param_location = self.location_map.get(param_name) - if param_location is None: - continue - if param_location: - if param_location == "body": - params["body"] = param_value - continue - base_name = self.attribute_map[param_name] - if param_location == "form" and self.openapi_types[param_name] == (file_type,): - params["file"][base_name] = [param_value] - elif param_location == "form" and self.openapi_types[param_name] == ([file_type],): - # param_value is already a list - params["file"][base_name] = param_value - elif param_location in {"form", "query"}: - param_value_full = (base_name, param_value) - params[param_location].append(param_value_full) - if param_location not in {"form", "query"}: - params[param_location][base_name] = param_value - collection_format = self.collection_format_map.get(param_name) - if collection_format: - params["collection_format"][base_name] = collection_format + :param response: RESTResponse. + :return: file path. + """ + fd, path = tempfile.mkstemp(dir=self.configuration.temp_folder_path) + os.close(fd) + os.remove(path) - return params + content_disposition = response.headers.get("Content-Disposition") + if content_disposition: + m = re.search(r'filename=[\'"]?([^\'"\s]+)[\'"]?', content_disposition) + assert m is not None, "Unexpected 'content-disposition' header value" + filename = m.group(1) + path = os.path.join(os.path.dirname(path), filename) + + with open(path, "wb") as f: + f.write(response.data) + + return path + + def __deserialize_primitive(self, data, klass): + """Deserializes string to primitive type. - def __call__(self, *args, **kwargs): - """This method is invoked when endpoints are called - Example: + :param data: str. + :param klass: class literal. + + :return: int, long, float, str, bool. + """ + try: + return klass(data) + except UnicodeEncodeError: + return str(data) + except TypeError: + return data - api_instance = ActionsApi() - api_instance.create_rule # this is an instance of the class Endpoint - api_instance.create_rule() # this invokes api_instance.create_rule.__call__() - which then invokes the callable functions stored in that endpoint at - api_instance.create_rule.callable or self.callable in this class + def __deserialize_object(self, value): + """Return an original value. + :return: object. """ - return self.callable(self, *args, **kwargs) + return value - def call_with_http_info(self, **kwargs): + def __deserialize_date(self, string): + """Deserializes string to date. + :param string: str. + :return: date. + """ try: - index = ( - self.api_client.configuration.server_operation_index.get( - self.settings["operation_id"], self.api_client.configuration.server_index - ) - if kwargs["_host_index"] is None - else kwargs["_host_index"] - ) - server_variables = self.api_client.configuration.server_operation_variables.get( - self.settings["operation_id"], self.api_client.configuration.server_variables - ) - _host = self.api_client.configuration.get_host_from_settings( - index, variables=server_variables, servers=self.settings["servers"] - ) - except IndexError: - if self.settings["servers"]: - raise ApiValueError("Invalid host index. Must be 0 <= index < %s" % len(self.settings["servers"])) - _host = None - - for key, value in kwargs.items(): - if key not in self.params_map["all"]: - raise ApiTypeError( - "Got an unexpected parameter '%s' to method `%s`" % (key, self.settings["operation_id"]) - ) - # only throw this nullable ApiValueError if _check_input_type - # is False, if _check_input_type==True we catch this case - # in self.__validate_inputs - if key not in self.params_map["nullable"] and value is None and kwargs["_check_input_type"] is False: - raise ApiValueError( - "Value may not be None for non-nullable parameter `%s` when calling `%s`" - % (key, self.settings["operation_id"]) - ) + return parse(string).date() + except ImportError: + return string + except ValueError: + raise rest.ApiException(status=0, reason="Failed to parse `{0}` as date object".format(string)) - for key in self.params_map["required"]: - if key not in kwargs.keys(): - raise ApiValueError( - "Missing the required parameter `%s` when calling `%s`" % (key, self.settings["operation_id"]) - ) + def __deserialize_datetime(self, string): + """Deserializes string to datetime. - self.__validate_inputs(kwargs) + The string should be in iso8601 datetime format. - params = self.__gather_params(kwargs) + :param string: str. + :return: datetime. + """ + try: + return parse(string) + except ImportError: + return string + except ValueError: + raise rest.ApiException(status=0, reason="Failed to parse `{0}` as datetime object".format(string)) - accept_headers_list = self.headers_map["accept"] - if accept_headers_list: - params["header"]["Accept"] = self.api_client.select_header_accept(accept_headers_list) + def __deserialize_enum(self, data, klass): + """Deserializes primitive type to enum. - if kwargs.get("_content_type"): - params["header"]["Content-Type"] = kwargs["_content_type"] - else: - content_type_headers_list = self.headers_map["content_type"] - if content_type_headers_list: - if params["body"] != "": - header_list = self.api_client.select_header_content_type( - content_type_headers_list, self.settings["http_method"], params["body"] - ) - params["header"]["Content-Type"] = header_list - - return self.api_client.call_api( - self.settings["endpoint_path"], - self.settings["http_method"], - params["path"], - params["query"], - params["header"], - body=params["body"], - post_params=params["form"], - files=params["file"], - response_type=self.settings["response_type"], - auth_settings=self.settings["auth"], - async_req=kwargs["async_req"], - _check_type=kwargs["_check_return_type"], - _return_http_data_only=kwargs["_return_http_data_only"], - _preload_content=kwargs["_preload_content"], - _request_timeout=kwargs["_request_timeout"], - _host=_host, - collection_formats=params["collection_format"], - ) + :param data: primitive type. + :param klass: class literal. + :return: enum value. + """ + try: + return klass(data) + except ValueError: + raise rest.ApiException(status=0, reason="Failed to parse `{0}` as `{1}`".format(data, klass)) + + def __deserialize_model(self, data, klass): + """Deserializes list or dict to model. + + :param data: dict, list. + :param klass: class literal. + :return: model object. + """ + + return klass.from_dict(data) diff --git a/generated/groundlight_openapi_client/api_response.py b/generated/groundlight_openapi_client/api_response.py new file mode 100644 index 00000000..1ce13729 --- /dev/null +++ b/generated/groundlight_openapi_client/api_response.py @@ -0,0 +1,20 @@ +"""API response object.""" + +from __future__ import annotations +from typing import Optional, Generic, Mapping, TypeVar +from pydantic import Field, StrictInt, StrictBytes, BaseModel + +T = TypeVar("T") + + +class ApiResponse(BaseModel, Generic[T]): + """ + API response object + """ + + status_code: StrictInt = Field(description="HTTP status code") + headers: Optional[Mapping[str, str]] = Field(None, description="HTTP headers") + data: T = Field(description="Deserialized data given the data type") + raw_data: StrictBytes = Field(description="Raw data (HTTP response body)") + + model_config = {"arbitrary_types_allowed": True} diff --git a/generated/groundlight_openapi_client/configuration.py b/generated/groundlight_openapi_client/configuration.py index 654b832f..021551b2 100644 --- a/generated/groundlight_openapi_client/configuration.py +++ b/generated/groundlight_openapi_client/configuration.py @@ -1,21 +1,28 @@ +# coding: utf-8 + """ Groundlight API - Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. # noqa: E501 + Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. The version of the OpenAPI document: 0.18.2 Contact: support@groundlight.ai - Generated by: https://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + import copy +import http.client as httplib import logging +from logging import FileHandler import multiprocessing import sys -import urllib3 +from typing import Any, ClassVar, Dict, List, Literal, Optional, TypedDict, Union +from typing_extensions import NotRequired, Self -from http import client as http_client -from groundlight_openapi_client.exceptions import ApiValueError +import urllib3 JSON_SCHEMA_VALIDATION_KEYWORDS = { @@ -31,47 +38,124 @@ "minItems", } - -class Configuration(object): - """NOTE: This class is auto generated by OpenAPI Generator - - Ref: https://openapi-generator.tech - Do not edit the class manually. - - :param host: Base url +ServerVariablesT = Dict[str, str] + +GenericAuthSetting = TypedDict( + "GenericAuthSetting", + { + "type": str, + "in": str, + "key": str, + "value": str, + }, +) + + +OAuth2AuthSetting = TypedDict( + "OAuth2AuthSetting", + { + "type": Literal["oauth2"], + "in": Literal["header"], + "key": Literal["Authorization"], + "value": str, + }, +) + + +APIKeyAuthSetting = TypedDict( + "APIKeyAuthSetting", + { + "type": Literal["api_key"], + "in": str, + "key": str, + "value": Optional[str], + }, +) + + +BasicAuthSetting = TypedDict( + "BasicAuthSetting", + { + "type": Literal["basic"], + "in": Literal["header"], + "key": Literal["Authorization"], + "value": Optional[str], + }, +) + + +BearerFormatAuthSetting = TypedDict( + "BearerFormatAuthSetting", + { + "type": Literal["bearer"], + "in": Literal["header"], + "format": Literal["JWT"], + "key": Literal["Authorization"], + "value": str, + }, +) + + +BearerAuthSetting = TypedDict( + "BearerAuthSetting", + { + "type": Literal["bearer"], + "in": Literal["header"], + "key": Literal["Authorization"], + "value": str, + }, +) + + +HTTPSignatureAuthSetting = TypedDict( + "HTTPSignatureAuthSetting", + { + "type": Literal["http-signature"], + "in": Literal["header"], + "key": Literal["Authorization"], + "value": None, + }, +) + + +AuthSettings = TypedDict( + "AuthSettings", + { + "ApiToken": APIKeyAuthSetting, + }, + total=False, +) + + +class HostSettingVariable(TypedDict): + description: str + default_value: str + enum_values: List[str] + + +class HostSetting(TypedDict): + url: str + description: str + variables: NotRequired[Dict[str, HostSettingVariable]] + + +class Configuration: + """This class contains various settings of the API client. + + :param host: Base url. + :param ignore_operation_servers + Boolean to ignore operation servers for the API client. + Config will use `host` as the base url regardless of the operation servers. :param api_key: Dict to store API key(s). Each entry in the dict specifies an API key. The dict key is the name of the security scheme in the OAS specification. The dict value is the API key secret. - :param api_key_prefix: Dict to store API prefix (e.g. Bearer) + :param api_key_prefix: Dict to store API prefix (e.g. Bearer). The dict key is the name of the security scheme in the OAS specification. The dict value is an API key prefix when generating the auth data. - :param username: Username for HTTP basic authentication - :param password: Password for HTTP basic authentication - :param discard_unknown_keys: Boolean value indicating whether to discard - unknown properties. A server may send a response that includes additional - properties that are not known by the client in the following scenarios: - 1. The OpenAPI document is incomplete, i.e. it does not match the server - implementation. - 2. The client was generated using an older version of the OpenAPI document - and the server has been upgraded since then. - If a schema in the OpenAPI document defines the additionalProperties attribute, - then all undeclared properties received by the server are injected into the - additional properties map. In that case, there are undeclared properties, and - nothing to discard. - :param disabled_client_side_validations (string): Comma-separated list of - JSON schema validation keywords to disable JSON schema structural validation - rules. The following keywords may be specified: multipleOf, maximum, - exclusiveMaximum, minimum, exclusiveMinimum, maxLength, minLength, pattern, - maxItems, minItems. - By default, the validation is performed for data generated locally by the client - and data received from the server, independent of any validation performed by - the server side. If the input data does not satisfy the JSON schema validation - rules specified in the OpenAPI document, an exception is raised. - If disabled_client_side_validations is set, structural validation is - disabled. This can be useful to troubleshoot data validation problem, such as - when the OpenAPI document validation rules do not match the actual API data - received by the server. + :param username: Username for HTTP basic authentication. + :param password: Password for HTTP basic authentication. + :param access_token: Access token. :param server_index: Index to servers configuration. :param server_variables: Mapping with string values to replace variables in templated server configuration. The validation of enums is performed for @@ -80,9 +164,15 @@ class Configuration(object): configuration. :param server_operation_variables: Mapping from operation ID to a mapping with string values to replace variables in templated server configuration. - The validation of enums is performed for variables with defined enum values before. + The validation of enums is performed for variables with defined enum + values before. :param ssl_ca_cert: str - the path to a file of concatenated CA certificates - in PEM format + in PEM format. + :param retries: Number of retries for API requests. + :param ca_cert_data: verify the peer using concatenated CA certificate data + in PEM (str) or DER (bytes) format. + :param cert_file: the path to a client certificate file, for mTLS. + :param key_file: the path to a client key file, for mTLS. :Example: @@ -106,24 +196,29 @@ class Configuration(object): Cookie: JSESSIONID abc123 """ - _default = None + _default: ClassVar[Optional[Self]] = None def __init__( self, - host=None, - api_key=None, - api_key_prefix=None, - access_token=None, - username=None, - password=None, - discard_unknown_keys=False, - disabled_client_side_validations="", - server_index=None, - server_variables=None, - server_operation_index=None, - server_operation_variables=None, - ssl_ca_cert=None, - ): + host: Optional[str] = None, + api_key: Optional[Dict[str, str]] = None, + api_key_prefix: Optional[Dict[str, str]] = None, + username: Optional[str] = None, + password: Optional[str] = None, + access_token: Optional[str] = None, + server_index: Optional[int] = None, + server_variables: Optional[ServerVariablesT] = None, + server_operation_index: Optional[Dict[int, int]] = None, + server_operation_variables: Optional[Dict[int, ServerVariablesT]] = None, + ignore_operation_servers: bool = False, + ssl_ca_cert: Optional[str] = None, + retries: Optional[int] = None, + ca_cert_data: Optional[Union[str, bytes]] = None, + cert_file: Optional[str] = None, + key_file: Optional[str] = None, + *, + debug: Optional[bool] = None, + ) -> None: """Constructor""" self._base_path = "https://api.groundlight.ai/device-api" if host is None else host """Default Base url @@ -136,11 +231,13 @@ def __init__( self.server_operation_variables = server_operation_variables or {} """Default server variables """ + self.ignore_operation_servers = ignore_operation_servers + """Ignore operation servers + """ self.temp_folder_path = None """Temp file folder for downloading files """ # Authentication Settings - self.access_token = access_token self.api_key = {} if api_key: self.api_key = api_key @@ -160,8 +257,9 @@ def __init__( self.password = password """Password for HTTP basic authentication """ - self.discard_unknown_keys = discard_unknown_keys - self.disabled_client_side_validations = disabled_client_side_validations + self.access_token = access_token + """Access token + """ self.logger = {} """Logging Settings """ @@ -173,13 +271,16 @@ def __init__( self.logger_stream_handler = None """Log stream handler """ - self.logger_file_handler = None + self.logger_file_handler: Optional[FileHandler] = None """Log file handler """ self.logger_file = None """Debug file location """ - self.debug = False + if debug is not None: + self.debug = debug + else: + self.__debug = False """Debug switch """ @@ -191,15 +292,23 @@ def __init__( self.ssl_ca_cert = ssl_ca_cert """Set this to customize the certificate file to verify the peer. """ - self.cert_file = None + self.ca_cert_data = ca_cert_data + """Set this to verify the peer using PEM (str) or DER (bytes) + certificate data. + """ + self.cert_file = cert_file """client certificate file """ - self.key_file = None + self.key_file = key_file """client key file """ self.assert_hostname = None """Set this to True/False to enable/disable SSL hostname verification. """ + self.tls_server_name = None + """SSL/TLS Server Name Indication (SNI) + Set this to the SNI value expected by the server. + """ self.connection_pool_maxsize = multiprocessing.cpu_count() * 5 """urllib3 connection pool's maximum number of connections saved @@ -209,28 +318,34 @@ def __init__( cpu_count * 5 is used as default value to increase performance. """ - self.proxy = None + self.proxy: Optional[str] = None """Proxy URL """ - self.no_proxy = None - """bypass proxy for host in the no_proxy list. - """ self.proxy_headers = None """Proxy headers """ self.safe_chars_for_path_param = "" """Safe chars for path_param """ - self.retries = None + self.retries = retries """Adding retries to override urllib3 default value 3 """ # Enable client side validation self.client_side_validation = True - # Options to pass down to the underlying urllib3 socket self.socket_options = None + """Options to pass down to the underlying urllib3 socket + """ + + self.datetime_format = "%Y-%m-%dT%H:%M:%S.%f%z" + """datetime format + """ - def __deepcopy__(self, memo): + self.date_format = "%Y-%m-%d" + """date format + """ + + def __deepcopy__(self, memo: Dict[int, Any]) -> Self: cls = self.__class__ result = cls.__new__(cls) memo[id(self)] = result @@ -244,17 +359,11 @@ def __deepcopy__(self, memo): result.debug = self.debug return result - def __setattr__(self, name, value): + def __setattr__(self, name: str, value: Any) -> None: object.__setattr__(self, name, value) - if name == "disabled_client_side_validations": - s = set(filter(None, value.split(","))) - for v in s: - if v not in JSON_SCHEMA_VALIDATION_KEYWORDS: - raise ApiValueError("Invalid keyword: '{0}''".format(v)) - self._disabled_client_side_validations = s @classmethod - def set_default(cls, default): + def set_default(cls, default: Optional[Self]) -> None: """Set default instance of configuration. It stores default configuration, which can be @@ -262,24 +371,34 @@ def set_default(cls, default): :param default: object of Configuration """ - cls._default = copy.deepcopy(default) + cls._default = default @classmethod - def get_default_copy(cls): - """Return new instance of configuration. + def get_default_copy(cls) -> Self: + """Deprecated. Please use `get_default` instead. + + Deprecated. Please use `get_default` instead. + + :return: The configuration object. + """ + return cls.get_default() + + @classmethod + def get_default(cls) -> Self: + """Return the default configuration. This method returns newly created, based on default constructor, object of Configuration class or returns a copy of default - configuration passed by the set_default method. + configuration. :return: The configuration object. """ - if cls._default is not None: - return copy.deepcopy(cls._default) - return Configuration() + if cls._default is None: + cls._default = cls() + return cls._default @property - def logger_file(self): + def logger_file(self) -> Optional[str]: """The logger file. If the logger_file is None, then add stream handler and remove file @@ -291,7 +410,7 @@ def logger_file(self): return self.__logger_file @logger_file.setter - def logger_file(self, value): + def logger_file(self, value: Optional[str]) -> None: """The logger file. If the logger_file is None, then add stream handler and remove file @@ -310,7 +429,7 @@ def logger_file(self, value): logger.addHandler(self.logger_file_handler) @property - def debug(self): + def debug(self) -> bool: """Debug status :param value: The debug status, True or False. @@ -319,7 +438,7 @@ def debug(self): return self.__debug @debug.setter - def debug(self, value): + def debug(self, value: bool) -> None: """Debug status :param value: The debug status, True or False. @@ -330,18 +449,18 @@ def debug(self, value): # if debug status is True, turn on debug logging for _, logger in self.logger.items(): logger.setLevel(logging.DEBUG) - # turn on http_client debug - http_client.HTTPConnection.debuglevel = 1 + # turn on httplib debug + httplib.HTTPConnection.debuglevel = 1 else: # if debug status is False, turn off debug logging, # setting log level to default `logging.WARNING` for _, logger in self.logger.items(): logger.setLevel(logging.WARNING) - # turn off http_client debug - http_client.HTTPConnection.debuglevel = 0 + # turn off httplib debug + httplib.HTTPConnection.debuglevel = 0 @property - def logger_format(self): + def logger_format(self) -> str: """The logger format. The logger_formatter will be updated when sets logger_format. @@ -352,7 +471,7 @@ def logger_format(self): return self.__logger_format @logger_format.setter - def logger_format(self, value): + def logger_format(self, value: str) -> None: """The logger format. The logger_formatter will be updated when sets logger_format. @@ -363,7 +482,7 @@ def logger_format(self, value): self.__logger_format = value self.logger_formatter = logging.Formatter(self.__logger_format) - def get_api_key_with_prefix(self, identifier, alias=None): + def get_api_key_with_prefix(self, identifier: str, alias: Optional[str] = None) -> Optional[str]: """Gets API key (with prefix if set). :param identifier: The identifier of apiKey. @@ -380,7 +499,9 @@ def get_api_key_with_prefix(self, identifier, alias=None): else: return key - def get_basic_auth_token(self): + return None + + def get_basic_auth_token(self) -> Optional[str]: """Gets HTTP basic authentication header (string). :return: The token for basic HTTP authentication. @@ -391,14 +512,15 @@ def get_basic_auth_token(self): password = "" if self.password is not None: password = self.password + return urllib3.util.make_headers(basic_auth=username + ":" + password).get("authorization") - def auth_settings(self): + def auth_settings(self) -> AuthSettings: """Gets Auth Settings dict for api client. :return: The Auth Settings information dict. """ - auth = {} + auth: AuthSettings = {} if "ApiToken" in self.api_key: auth["ApiToken"] = { "type": "api_key", @@ -410,7 +532,7 @@ def auth_settings(self): } return auth - def to_debug_report(self): + def to_debug_report(self) -> str: """Gets the essential information for debugging. :return: The report for debugging. @@ -423,7 +545,7 @@ def to_debug_report(self): "SDK Package Version: 1.0.0".format(env=sys.platform, pyversion=sys.version) ) - def get_host_settings(self): + def get_host_settings(self) -> List[HostSetting]: """Gets an array of host settings :return: An array of host settings @@ -447,7 +569,12 @@ def get_host_settings(self): }, ] - def get_host_from_settings(self, index, variables=None, servers=None): + def get_host_from_settings( + self, + index: Optional[int], + variables: Optional[ServerVariablesT] = None, + servers: Optional[List[HostSetting]] = None, + ) -> str: """Gets host URL based on the index and variables :param index: array index of the host settings :param variables: hash of variable and the corresponding value @@ -473,7 +600,7 @@ def get_host_from_settings(self, index, variables=None, servers=None): for variable_name, variable in server.get("variables", {}).items(): used_value = variables.get(variable_name, variable["default_value"]) - if "enum_values" in variable and used_value not in variable["enum_values"]: + if "enum_values" in variable and variable["enum_values"] and used_value not in variable["enum_values"]: raise ValueError( "The variable `{0}` in the host URL has invalid value {1}. Must be {2}.".format( variable_name, variables[variable_name], variable["enum_values"] @@ -485,12 +612,12 @@ def get_host_from_settings(self, index, variables=None, servers=None): return url @property - def host(self): + def host(self) -> str: """Return generated host.""" return self.get_host_from_settings(self.server_index, variables=self.server_variables) @host.setter - def host(self, value): + def host(self, value: str) -> None: """Fix base path.""" self._base_path = value self.server_index = None diff --git a/generated/groundlight_openapi_client/exceptions.py b/generated/groundlight_openapi_client/exceptions.py index 393dbba8..97ccff90 100644 --- a/generated/groundlight_openapi_client/exceptions.py +++ b/generated/groundlight_openapi_client/exceptions.py @@ -1,12 +1,19 @@ +# coding: utf-8 + """ Groundlight API - Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. # noqa: E501 + Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. The version of the OpenAPI document: 0.18.2 Contact: support@groundlight.ai - Generated by: https://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + +from typing import Any, Optional +from typing_extensions import Self class OpenApiException(Exception): @@ -14,7 +21,7 @@ class OpenApiException(Exception): class ApiTypeError(OpenApiException, TypeError): - def __init__(self, msg, path_to_item=None, valid_classes=None, key_type=None): + def __init__(self, msg, path_to_item=None, valid_classes=None, key_type=None) -> None: """Raises an exception for TypeErrors Args: @@ -42,7 +49,7 @@ def __init__(self, msg, path_to_item=None, valid_classes=None, key_type=None): class ApiValueError(OpenApiException, ValueError): - def __init__(self, msg, path_to_item=None): + def __init__(self, msg, path_to_item=None) -> None: """ Args: msg (str): the exception message @@ -60,7 +67,7 @@ def __init__(self, msg, path_to_item=None): class ApiAttributeError(OpenApiException, AttributeError): - def __init__(self, msg, path_to_item=None): + def __init__(self, msg, path_to_item=None) -> None: """ Raised when an attribute reference or assignment fails. @@ -79,7 +86,7 @@ def __init__(self, msg, path_to_item=None): class ApiKeyError(OpenApiException, KeyError): - def __init__(self, msg, path_to_item=None): + def __init__(self, msg, path_to_item=None) -> None: """ Args: msg (str): the exception message @@ -96,17 +103,63 @@ def __init__(self, msg, path_to_item=None): class ApiException(OpenApiException): - def __init__(self, status=None, reason=None, http_resp=None): + def __init__( + self, + status=None, + reason=None, + http_resp=None, + *, + body: Optional[str] = None, + data: Optional[Any] = None, + ) -> None: + self.status = status + self.reason = reason + self.body = body + self.data = data + self.headers = None + if http_resp: - self.status = http_resp.status - self.reason = http_resp.reason - self.body = http_resp.data - self.headers = http_resp.getheaders() - else: - self.status = status - self.reason = reason - self.body = None - self.headers = None + if self.status is None: + self.status = http_resp.status + if self.reason is None: + self.reason = http_resp.reason + if self.body is None: + try: + self.body = http_resp.data.decode("utf-8") + except Exception: + pass + self.headers = http_resp.headers + + @classmethod + def from_response( + cls, + *, + http_resp, + body: Optional[str], + data: Optional[Any], + ) -> Self: + if http_resp.status == 400: + raise BadRequestException(http_resp=http_resp, body=body, data=data) + + if http_resp.status == 401: + raise UnauthorizedException(http_resp=http_resp, body=body, data=data) + + if http_resp.status == 403: + raise ForbiddenException(http_resp=http_resp, body=body, data=data) + + if http_resp.status == 404: + raise NotFoundException(http_resp=http_resp, body=body, data=data) + + # Added new conditions for 409 and 422 + if http_resp.status == 409: + raise ConflictException(http_resp=http_resp, body=body, data=data) + + if http_resp.status == 422: + raise UnprocessableEntityException(http_resp=http_resp, body=body, data=data) + + if 500 <= http_resp.status <= 599: + raise ServiceException(http_resp=http_resp, body=body, data=data) + raise ApiException(http_resp=http_resp, body=body, data=data) def __str__(self): """Custom error messages for exception""" @@ -117,27 +170,42 @@ def __str__(self): if self.body: error_message += "HTTP response body: {0}\n".format(self.body) + if self.data: + error_message += "HTTP response data: {0}\n".format(self.data) + return error_message +class BadRequestException(ApiException): + pass + + class NotFoundException(ApiException): - def __init__(self, status=None, reason=None, http_resp=None): - super(NotFoundException, self).__init__(status, reason, http_resp) + pass class UnauthorizedException(ApiException): - def __init__(self, status=None, reason=None, http_resp=None): - super(UnauthorizedException, self).__init__(status, reason, http_resp) + pass class ForbiddenException(ApiException): - def __init__(self, status=None, reason=None, http_resp=None): - super(ForbiddenException, self).__init__(status, reason, http_resp) + pass class ServiceException(ApiException): - def __init__(self, status=None, reason=None, http_resp=None): - super(ServiceException, self).__init__(status, reason, http_resp) + pass + + +class ConflictException(ApiException): + """Exception for HTTP 409 Conflict.""" + + pass + + +class UnprocessableEntityException(ApiException): + """Exception for HTTP 422 Unprocessable Entity.""" + + pass def render_path(path_to_item): diff --git a/generated/groundlight_openapi_client/models/__init__.py b/generated/groundlight_openapi_client/models/__init__.py index a7877c28..70579a33 100644 --- a/generated/groundlight_openapi_client/models/__init__.py +++ b/generated/groundlight_openapi_client/models/__init__.py @@ -1,71 +1,81 @@ +# coding: utf-8 + # flake8: noqa +""" + Groundlight API + + Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. + + The version of the OpenAPI document: 0.18.2 + Contact: support@groundlight.ai + Generated by OpenAPI Generator (https://openapi-generator.tech) -# import all models into this package -# if you have many models here with many references from one model to another this may -# raise a RecursionError -# to avoid this, import only the models that you directly need like: -# from from groundlight_openapi_client.model.pet import Pet -# or import this package, but before doing it, use: -# import sys -# sys.setrecursionlimit(n) + Do not edit the class manually. +""" # noqa: E501 -from groundlight_openapi_client.model.account_month_to_date_info import AccountMonthToDateInfo -from groundlight_openapi_client.model.action import Action -from groundlight_openapi_client.model.action_list import ActionList -from groundlight_openapi_client.model.all_notes import AllNotes -from groundlight_openapi_client.model.annotations_requested_enum import AnnotationsRequestedEnum -from groundlight_openapi_client.model.b_box_geometry import BBoxGeometry -from groundlight_openapi_client.model.b_box_geometry_request import BBoxGeometryRequest -from groundlight_openapi_client.model.binary_classification_result import BinaryClassificationResult -from groundlight_openapi_client.model.blank_enum import BlankEnum -from groundlight_openapi_client.model.bounding_box_label_enum import BoundingBoxLabelEnum -from groundlight_openapi_client.model.bounding_box_mode_configuration import BoundingBoxModeConfiguration -from groundlight_openapi_client.model.bounding_box_result import BoundingBoxResult -from groundlight_openapi_client.model.channel_enum import ChannelEnum -from groundlight_openapi_client.model.condition import Condition -from groundlight_openapi_client.model.condition_request import ConditionRequest -from groundlight_openapi_client.model.count_mode_configuration import CountModeConfiguration -from groundlight_openapi_client.model.counting_result import CountingResult -from groundlight_openapi_client.model.detector import Detector -from groundlight_openapi_client.model.detector_creation_input_request import DetectorCreationInputRequest -from groundlight_openapi_client.model.detector_group import DetectorGroup -from groundlight_openapi_client.model.detector_group_request import DetectorGroupRequest -from groundlight_openapi_client.model.detector_type_enum import DetectorTypeEnum -from groundlight_openapi_client.model.edge_model_info import EdgeModelInfo -from groundlight_openapi_client.model.escalation_type_enum import EscalationTypeEnum -from groundlight_openapi_client.model.image_query import ImageQuery -from groundlight_openapi_client.model.image_query_type_enum import ImageQueryTypeEnum -from groundlight_openapi_client.model.inline_response200 import InlineResponse200 -from groundlight_openapi_client.model.inline_response2001 import InlineResponse2001 -from groundlight_openapi_client.model.inline_response2001_evaluation_results import InlineResponse2001EvaluationResults -from groundlight_openapi_client.model.inline_response2002 import InlineResponse2002 -from groundlight_openapi_client.model.inline_response200_summary import InlineResponse200Summary -from groundlight_openapi_client.model.inline_response200_summary_class_counts import InlineResponse200SummaryClassCounts -from groundlight_openapi_client.model.label import Label -from groundlight_openapi_client.model.label_value import LabelValue -from groundlight_openapi_client.model.label_value_request import LabelValueRequest -from groundlight_openapi_client.model.mode_enum import ModeEnum -from groundlight_openapi_client.model.multi_class_mode_configuration import MultiClassModeConfiguration -from groundlight_openapi_client.model.multi_classification_result import MultiClassificationResult -from groundlight_openapi_client.model.note import Note -from groundlight_openapi_client.model.note_request import NoteRequest -from groundlight_openapi_client.model.paginated_detector_list import PaginatedDetectorList -from groundlight_openapi_client.model.paginated_image_query_list import PaginatedImageQueryList -from groundlight_openapi_client.model.paginated_rule_list import PaginatedRuleList -from groundlight_openapi_client.model.patched_detector_request import PatchedDetectorRequest -from groundlight_openapi_client.model.payload_template import PayloadTemplate -from groundlight_openapi_client.model.payload_template_request import PayloadTemplateRequest -from groundlight_openapi_client.model.roi import ROI -from groundlight_openapi_client.model.roi_request import ROIRequest -from groundlight_openapi_client.model.result_type_enum import ResultTypeEnum -from groundlight_openapi_client.model.rule import Rule -from groundlight_openapi_client.model.rule_request import RuleRequest -from groundlight_openapi_client.model.snooze_time_unit_enum import SnoozeTimeUnitEnum -from groundlight_openapi_client.model.source import Source -from groundlight_openapi_client.model.source_enum import SourceEnum -from groundlight_openapi_client.model.status_enum import StatusEnum -from groundlight_openapi_client.model.text_mode_configuration import TextModeConfiguration -from groundlight_openapi_client.model.text_recognition_result import TextRecognitionResult -from groundlight_openapi_client.model.verb_enum import VerbEnum -from groundlight_openapi_client.model.webhook_action import WebhookAction -from groundlight_openapi_client.model.webhook_action_request import WebhookActionRequest +# import models into model package +from groundlight_openapi_client.models.action import Action +from groundlight_openapi_client.models.all_notes import AllNotes +from groundlight_openapi_client.models.annotations_requested_enum import AnnotationsRequestedEnum +from groundlight_openapi_client.models.b_box_geometry import BBoxGeometry +from groundlight_openapi_client.models.b_box_geometry_request import BBoxGeometryRequest +from groundlight_openapi_client.models.binary_classification_result import BinaryClassificationResult +from groundlight_openapi_client.models.blank_enum import BlankEnum +from groundlight_openapi_client.models.bounding_box_label_enum import BoundingBoxLabelEnum +from groundlight_openapi_client.models.bounding_box_mode_configuration import BoundingBoxModeConfiguration +from groundlight_openapi_client.models.bounding_box_result import BoundingBoxResult +from groundlight_openapi_client.models.channel_enum import ChannelEnum +from groundlight_openapi_client.models.condition import Condition +from groundlight_openapi_client.models.condition_request import ConditionRequest +from groundlight_openapi_client.models.count_mode_configuration import CountModeConfiguration +from groundlight_openapi_client.models.counting_result import CountingResult +from groundlight_openapi_client.models.detector_creation_input_request_mode_configuration import ( + DetectorCreationInputRequestModeConfiguration, +) +from groundlight_openapi_client.models.detector_group import DetectorGroup +from groundlight_openapi_client.models.detector_group_request import DetectorGroupRequest +from groundlight_openapi_client.models.detector_type_enum import DetectorTypeEnum +from groundlight_openapi_client.models.edge_model_info import EdgeModelInfo +from groundlight_openapi_client.models.escalation_type_enum import EscalationTypeEnum +from groundlight_openapi_client.models.get_detector_evaluation200_response import GetDetectorEvaluation200Response +from groundlight_openapi_client.models.get_detector_evaluation200_response_evaluation_results import ( + GetDetectorEvaluation200ResponseEvaluationResults, +) +from groundlight_openapi_client.models.get_detector_metrics200_response import GetDetectorMetrics200Response +from groundlight_openapi_client.models.get_detector_metrics200_response_summary import ( + GetDetectorMetrics200ResponseSummary, +) +from groundlight_openapi_client.models.get_detector_metrics200_response_summary_class_counts import ( + GetDetectorMetrics200ResponseSummaryClassCounts, +) +from groundlight_openapi_client.models.image_query_result import ImageQueryResult +from groundlight_openapi_client.models.image_query_type_enum import ImageQueryTypeEnum +from groundlight_openapi_client.models.label import Label +from groundlight_openapi_client.models.label_value import LabelValue +from groundlight_openapi_client.models.label_value_request import LabelValueRequest +from groundlight_openapi_client.models.mode_enum import ModeEnum +from groundlight_openapi_client.models.multi_class_mode_configuration import MultiClassModeConfiguration +from groundlight_openapi_client.models.multi_classification_result import MultiClassificationResult +from groundlight_openapi_client.models.note import Note +from groundlight_openapi_client.models.note_request import NoteRequest +from groundlight_openapi_client.models.paginated_detector_list import PaginatedDetectorList +from groundlight_openapi_client.models.paginated_image_query_list import PaginatedImageQueryList +from groundlight_openapi_client.models.paginated_rule_list import PaginatedRuleList +from groundlight_openapi_client.models.payload_template import PayloadTemplate +from groundlight_openapi_client.models.payload_template_request import PayloadTemplateRequest +from groundlight_openapi_client.models.roi import ROI +from groundlight_openapi_client.models.roi_request import ROIRequest +from groundlight_openapi_client.models.result_type_enum import ResultTypeEnum +from groundlight_openapi_client.models.rule import Rule +from groundlight_openapi_client.models.rule_action import RuleAction +from groundlight_openapi_client.models.rule_request import RuleRequest +from groundlight_openapi_client.models.snooze_time_unit_enum import SnoozeTimeUnitEnum +from groundlight_openapi_client.models.source import Source +from groundlight_openapi_client.models.source_enum import SourceEnum +from groundlight_openapi_client.models.status_enum import StatusEnum +from groundlight_openapi_client.models.text_mode_configuration import TextModeConfiguration +from groundlight_openapi_client.models.text_recognition_result import TextRecognitionResult +from groundlight_openapi_client.models.verb_enum import VerbEnum +from groundlight_openapi_client.models.webhook_action import WebhookAction +from groundlight_openapi_client.models.webhook_action_request import WebhookActionRequest +from groundlight_openapi_client.models.who_am_i200_response import WhoAmI200Response diff --git a/generated/groundlight_openapi_client/models/action.py b/generated/groundlight_openapi_client/models/action.py new file mode 100644 index 00000000..31bc0306 --- /dev/null +++ b/generated/groundlight_openapi_client/models/action.py @@ -0,0 +1,91 @@ +# coding: utf-8 + +""" + Groundlight API + + Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. + + The version of the OpenAPI document: 0.18.2 + Contact: support@groundlight.ai + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictBool, StrictStr +from typing import Any, ClassVar, Dict, List +from groundlight_openapi_client.models.channel_enum import ChannelEnum +from typing import Optional, Set +from typing_extensions import Self + + +class Action(BaseModel): + """ + Action + """ # noqa: E501 + + channel: ChannelEnum + recipient: StrictStr + include_image: StrictBool + __properties: ClassVar[List[str]] = ["channel", "recipient", "include_image"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of Action from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of Action from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "channel": obj.get("channel"), + "recipient": obj.get("recipient"), + "include_image": obj.get("include_image"), + }) + return _obj diff --git a/generated/groundlight_openapi_client/models/all_notes.py b/generated/groundlight_openapi_client/models/all_notes.py new file mode 100644 index 00000000..39802694 --- /dev/null +++ b/generated/groundlight_openapi_client/models/all_notes.py @@ -0,0 +1,105 @@ +# coding: utf-8 + +""" + Groundlight API + + Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. + + The version of the OpenAPI document: 0.18.2 + Contact: support@groundlight.ai + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List +from groundlight_openapi_client.models.note import Note +from typing import Optional, Set +from typing_extensions import Self + + +class AllNotes(BaseModel): + """ + Serializes all notes for a given detector, grouped by type as listed in UserProfile.NoteCategoryChoices The fields must match whats in USERPROFILE.NoteCategoryChoices + """ # noqa: E501 + + customer: List[Note] = Field(alias="CUSTOMER") + gl: List[Note] = Field(alias="GL") + __properties: ClassVar[List[str]] = ["CUSTOMER", "GL"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of AllNotes from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in customer (list) + _items = [] + if self.customer: + for _item_customer in self.customer: + if _item_customer: + _items.append(_item_customer.to_dict()) + _dict["CUSTOMER"] = _items + # override the default output from pydantic by calling `to_dict()` of each item in gl (list) + _items = [] + if self.gl: + for _item_gl in self.gl: + if _item_gl: + _items.append(_item_gl.to_dict()) + _dict["GL"] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of AllNotes from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "CUSTOMER": ( + [Note.from_dict(_item) for _item in obj["CUSTOMER"]] if obj.get("CUSTOMER") is not None else None + ), + "GL": [Note.from_dict(_item) for _item in obj["GL"]] if obj.get("GL") is not None else None, + }) + return _obj diff --git a/generated/groundlight_openapi_client/models/annotations_requested_enum.py b/generated/groundlight_openapi_client/models/annotations_requested_enum.py new file mode 100644 index 00000000..12135124 --- /dev/null +++ b/generated/groundlight_openapi_client/models/annotations_requested_enum.py @@ -0,0 +1,36 @@ +# coding: utf-8 + +""" + Groundlight API + + Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. + + The version of the OpenAPI document: 0.18.2 + Contact: support@groundlight.ai + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class AnnotationsRequestedEnum(str, Enum): + """ + AnnotationsRequestedEnum + """ + + """ + allowed enum values + """ + BINARY_CLASSIFICATION = "BINARY_CLASSIFICATION" + BOUNDING_BOXES = "BOUNDING_BOXES" + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of AnnotationsRequestedEnum from a JSON string""" + return cls(json.loads(json_str)) diff --git a/generated/groundlight_openapi_client/models/b_box_geometry.py b/generated/groundlight_openapi_client/models/b_box_geometry.py new file mode 100644 index 00000000..1dcceae2 --- /dev/null +++ b/generated/groundlight_openapi_client/models/b_box_geometry.py @@ -0,0 +1,101 @@ +# coding: utf-8 + +""" + Groundlight API + + Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. + + The version of the OpenAPI document: 0.18.2 + Contact: support@groundlight.ai + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictFloat, StrictInt +from typing import Any, ClassVar, Dict, List, Union +from typing import Optional, Set +from typing_extensions import Self + + +class BBoxGeometry(BaseModel): + """ + Mixin for serializers to handle data in the StrictBaseModel format + """ # noqa: E501 + + left: Union[StrictFloat, StrictInt] + top: Union[StrictFloat, StrictInt] + right: Union[StrictFloat, StrictInt] + bottom: Union[StrictFloat, StrictInt] + x: Union[StrictFloat, StrictInt] + y: Union[StrictFloat, StrictInt] + __properties: ClassVar[List[str]] = ["left", "top", "right", "bottom", "x", "y"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of BBoxGeometry from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * OpenAPI `readOnly` fields are excluded. + * OpenAPI `readOnly` fields are excluded. + """ + excluded_fields: Set[str] = set([ + "x", + "y", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of BBoxGeometry from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "left": obj.get("left"), + "top": obj.get("top"), + "right": obj.get("right"), + "bottom": obj.get("bottom"), + "x": obj.get("x"), + "y": obj.get("y"), + }) + return _obj diff --git a/generated/groundlight_openapi_client/models/b_box_geometry_request.py b/generated/groundlight_openapi_client/models/b_box_geometry_request.py new file mode 100644 index 00000000..d5f69036 --- /dev/null +++ b/generated/groundlight_openapi_client/models/b_box_geometry_request.py @@ -0,0 +1,89 @@ +# coding: utf-8 + +""" + Groundlight API + + Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. + + The version of the OpenAPI document: 0.18.2 + Contact: support@groundlight.ai + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictFloat, StrictInt +from typing import Any, ClassVar, Dict, List, Union +from typing import Optional, Set +from typing_extensions import Self + + +class BBoxGeometryRequest(BaseModel): + """ + Mixin for serializers to handle data in the StrictBaseModel format + """ # noqa: E501 + + left: Union[StrictFloat, StrictInt] + top: Union[StrictFloat, StrictInt] + right: Union[StrictFloat, StrictInt] + bottom: Union[StrictFloat, StrictInt] + __properties: ClassVar[List[str]] = ["left", "top", "right", "bottom"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of BBoxGeometryRequest from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of BBoxGeometryRequest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate( + {"left": obj.get("left"), "top": obj.get("top"), "right": obj.get("right"), "bottom": obj.get("bottom")} + ) + return _obj diff --git a/generated/groundlight_openapi_client/models/binary_classification_result.py b/generated/groundlight_openapi_client/models/binary_classification_result.py new file mode 100644 index 00000000..6d84454d --- /dev/null +++ b/generated/groundlight_openapi_client/models/binary_classification_result.py @@ -0,0 +1,112 @@ +# coding: utf-8 + +""" + Groundlight API + + Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. + + The version of the OpenAPI document: 0.18.2 + Contact: support@groundlight.ai + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional, Union +from typing_extensions import Annotated +from typing import Optional, Set +from typing_extensions import Self + + +class BinaryClassificationResult(BaseModel): + """ + BinaryClassificationResult + """ # noqa: E501 + + confidence: Optional[ + Union[Annotated[float, Field(le=1.0, strict=True, ge=0.0)], Annotated[int, Field(le=1, strict=True, ge=0)]] + ] = None + source: Optional[StrictStr] = None + result_type: Optional[StrictStr] = None + from_edge: Optional[StrictBool] = None + label: StrictStr + __properties: ClassVar[List[str]] = ["confidence", "source", "result_type", "from_edge", "label"] + + @field_validator("result_type") + def result_type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(["binary_classification"]): + raise ValueError("must be one of enum values ('binary_classification')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of BinaryClassificationResult from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # set to None if confidence (nullable) is None + # and model_fields_set contains the field + if self.confidence is None and "confidence" in self.model_fields_set: + _dict["confidence"] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of BinaryClassificationResult from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "confidence": obj.get("confidence"), + "source": obj.get("source"), + "result_type": obj.get("result_type"), + "from_edge": obj.get("from_edge"), + "label": obj.get("label"), + }) + return _obj diff --git a/generated/groundlight_openapi_client/models/blank_enum.py b/generated/groundlight_openapi_client/models/blank_enum.py new file mode 100644 index 00000000..b3d14e1e --- /dev/null +++ b/generated/groundlight_openapi_client/models/blank_enum.py @@ -0,0 +1,35 @@ +# coding: utf-8 + +""" + Groundlight API + + Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. + + The version of the OpenAPI document: 0.18.2 + Contact: support@groundlight.ai + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class BlankEnum(str, Enum): + """ + BlankEnum + """ + + """ + allowed enum values + """ + EMPTY = "" + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of BlankEnum from a JSON string""" + return cls(json.loads(json_str)) diff --git a/generated/groundlight_openapi_client/models/bounding_box_label_enum.py b/generated/groundlight_openapi_client/models/bounding_box_label_enum.py new file mode 100644 index 00000000..127bbb3d --- /dev/null +++ b/generated/groundlight_openapi_client/models/bounding_box_label_enum.py @@ -0,0 +1,38 @@ +# coding: utf-8 + +""" + Groundlight API + + Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. + + The version of the OpenAPI document: 0.18.2 + Contact: support@groundlight.ai + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class BoundingBoxLabelEnum(str, Enum): + """ + BoundingBoxLabelEnum + """ + + """ + allowed enum values + """ + NO_OBJECTS = "NO_OBJECTS" + BOUNDING_BOX = "BOUNDING_BOX" + GREATER_THAN_MAX = "GREATER_THAN_MAX" + UNCLEAR = "UNCLEAR" + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of BoundingBoxLabelEnum from a JSON string""" + return cls(json.loads(json_str)) diff --git a/generated/groundlight_openapi_client/models/bounding_box_mode_configuration.py b/generated/groundlight_openapi_client/models/bounding_box_mode_configuration.py new file mode 100644 index 00000000..0c402f90 --- /dev/null +++ b/generated/groundlight_openapi_client/models/bounding_box_mode_configuration.py @@ -0,0 +1,86 @@ +# coding: utf-8 + +""" + Groundlight API + + Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. + + The version of the OpenAPI document: 0.18.2 + Contact: support@groundlight.ai + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from typing import Optional, Set +from typing_extensions import Self + + +class BoundingBoxModeConfiguration(BaseModel): + """ + BoundingBoxModeConfiguration + """ # noqa: E501 + + class_name: StrictStr + max_num_bboxes: Optional[Annotated[int, Field(le=50, strict=True, ge=1)]] = None + __properties: ClassVar[List[str]] = ["class_name", "max_num_bboxes"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of BoundingBoxModeConfiguration from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of BoundingBoxModeConfiguration from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({"class_name": obj.get("class_name"), "max_num_bboxes": obj.get("max_num_bboxes")}) + return _obj diff --git a/generated/groundlight_openapi_client/models/bounding_box_result.py b/generated/groundlight_openapi_client/models/bounding_box_result.py new file mode 100644 index 00000000..ab8222d3 --- /dev/null +++ b/generated/groundlight_openapi_client/models/bounding_box_result.py @@ -0,0 +1,112 @@ +# coding: utf-8 + +""" + Groundlight API + + Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. + + The version of the OpenAPI document: 0.18.2 + Contact: support@groundlight.ai + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional, Union +from typing_extensions import Annotated +from typing import Optional, Set +from typing_extensions import Self + + +class BoundingBoxResult(BaseModel): + """ + BoundingBoxResult + """ # noqa: E501 + + confidence: Optional[ + Union[Annotated[float, Field(le=1.0, strict=True, ge=0.0)], Annotated[int, Field(le=1, strict=True, ge=0)]] + ] = None + source: Optional[StrictStr] = None + result_type: Optional[StrictStr] = None + from_edge: Optional[StrictBool] = None + label: StrictStr + __properties: ClassVar[List[str]] = ["confidence", "source", "result_type", "from_edge", "label"] + + @field_validator("result_type") + def result_type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(["bounding_box"]): + raise ValueError("must be one of enum values ('bounding_box')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of BoundingBoxResult from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # set to None if confidence (nullable) is None + # and model_fields_set contains the field + if self.confidence is None and "confidence" in self.model_fields_set: + _dict["confidence"] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of BoundingBoxResult from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "confidence": obj.get("confidence"), + "source": obj.get("source"), + "result_type": obj.get("result_type"), + "from_edge": obj.get("from_edge"), + "label": obj.get("label"), + }) + return _obj diff --git a/generated/groundlight_openapi_client/models/channel_enum.py b/generated/groundlight_openapi_client/models/channel_enum.py new file mode 100644 index 00000000..1828d4b0 --- /dev/null +++ b/generated/groundlight_openapi_client/models/channel_enum.py @@ -0,0 +1,36 @@ +# coding: utf-8 + +""" + Groundlight API + + Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. + + The version of the OpenAPI document: 0.18.2 + Contact: support@groundlight.ai + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class ChannelEnum(str, Enum): + """ + ChannelEnum + """ + + """ + allowed enum values + """ + TEXT = "TEXT" + EMAIL = "EMAIL" + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of ChannelEnum from a JSON string""" + return cls(json.loads(json_str)) diff --git a/generated/groundlight_openapi_client/models/condition.py b/generated/groundlight_openapi_client/models/condition.py new file mode 100644 index 00000000..8c1d13a4 --- /dev/null +++ b/generated/groundlight_openapi_client/models/condition.py @@ -0,0 +1,85 @@ +# coding: utf-8 + +""" + Groundlight API + + Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. + + The version of the OpenAPI document: 0.18.2 + Contact: support@groundlight.ai + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self + + +class Condition(BaseModel): + """ + Condition + """ # noqa: E501 + + verb: StrictStr + parameters: Dict[str, Any] + __properties: ClassVar[List[str]] = ["verb", "parameters"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of Condition from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of Condition from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({"verb": obj.get("verb"), "parameters": obj.get("parameters")}) + return _obj diff --git a/generated/groundlight_openapi_client/models/condition_request.py b/generated/groundlight_openapi_client/models/condition_request.py new file mode 100644 index 00000000..2032a5f0 --- /dev/null +++ b/generated/groundlight_openapi_client/models/condition_request.py @@ -0,0 +1,85 @@ +# coding: utf-8 + +""" + Groundlight API + + Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. + + The version of the OpenAPI document: 0.18.2 + Contact: support@groundlight.ai + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self + + +class ConditionRequest(BaseModel): + """ + ConditionRequest + """ # noqa: E501 + + verb: StrictStr + parameters: Dict[str, Any] + __properties: ClassVar[List[str]] = ["verb", "parameters"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ConditionRequest from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ConditionRequest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({"verb": obj.get("verb"), "parameters": obj.get("parameters")}) + return _obj diff --git a/generated/groundlight_openapi_client/models/count_mode_configuration.py b/generated/groundlight_openapi_client/models/count_mode_configuration.py new file mode 100644 index 00000000..2bc838d3 --- /dev/null +++ b/generated/groundlight_openapi_client/models/count_mode_configuration.py @@ -0,0 +1,86 @@ +# coding: utf-8 + +""" + Groundlight API + + Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. + + The version of the OpenAPI document: 0.18.2 + Contact: support@groundlight.ai + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from typing import Optional, Set +from typing_extensions import Self + + +class CountModeConfiguration(BaseModel): + """ + CountModeConfiguration + """ # noqa: E501 + + max_count: Optional[Annotated[int, Field(le=50, strict=True, ge=1)]] = None + class_name: StrictStr + __properties: ClassVar[List[str]] = ["max_count", "class_name"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CountModeConfiguration from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CountModeConfiguration from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({"max_count": obj.get("max_count"), "class_name": obj.get("class_name")}) + return _obj diff --git a/generated/groundlight_openapi_client/models/counting_result.py b/generated/groundlight_openapi_client/models/counting_result.py new file mode 100644 index 00000000..67f249af --- /dev/null +++ b/generated/groundlight_openapi_client/models/counting_result.py @@ -0,0 +1,126 @@ +# coding: utf-8 + +""" + Groundlight API + + Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. + + The version of the OpenAPI document: 0.18.2 + Contact: support@groundlight.ai + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional, Union +from typing_extensions import Annotated +from typing import Optional, Set +from typing_extensions import Self + + +class CountingResult(BaseModel): + """ + CountingResult + """ # noqa: E501 + + confidence: Optional[ + Union[Annotated[float, Field(le=1.0, strict=True, ge=0.0)], Annotated[int, Field(le=1, strict=True, ge=0)]] + ] = None + source: Optional[StrictStr] = None + result_type: Optional[StrictStr] = None + from_edge: Optional[StrictBool] = None + count: Optional[Annotated[int, Field(strict=True, ge=0)]] + greater_than_max: Optional[StrictBool] = None + __properties: ClassVar[List[str]] = [ + "confidence", + "source", + "result_type", + "from_edge", + "count", + "greater_than_max", + ] + + @field_validator("result_type") + def result_type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(["counting"]): + raise ValueError("must be one of enum values ('counting')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CountingResult from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # set to None if confidence (nullable) is None + # and model_fields_set contains the field + if self.confidence is None and "confidence" in self.model_fields_set: + _dict["confidence"] = None + + # set to None if count (nullable) is None + # and model_fields_set contains the field + if self.count is None and "count" in self.model_fields_set: + _dict["count"] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CountingResult from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "confidence": obj.get("confidence"), + "source": obj.get("source"), + "result_type": obj.get("result_type"), + "from_edge": obj.get("from_edge"), + "count": obj.get("count"), + "greater_than_max": obj.get("greater_than_max"), + }) + return _obj diff --git a/generated/groundlight_openapi_client/models/detector_creation_input_request_mode_configuration.py b/generated/groundlight_openapi_client/models/detector_creation_input_request_mode_configuration.py new file mode 100644 index 00000000..1044422b --- /dev/null +++ b/generated/groundlight_openapi_client/models/detector_creation_input_request_mode_configuration.py @@ -0,0 +1,213 @@ +# coding: utf-8 + +""" + Groundlight API + + Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. + + The version of the OpenAPI document: 0.18.2 + Contact: support@groundlight.ai + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +import pprint +from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator +from typing import Any, List, Optional +from groundlight_openapi_client.models.bounding_box_mode_configuration import BoundingBoxModeConfiguration +from groundlight_openapi_client.models.count_mode_configuration import CountModeConfiguration +from groundlight_openapi_client.models.multi_class_mode_configuration import MultiClassModeConfiguration +from groundlight_openapi_client.models.text_mode_configuration import TextModeConfiguration +from pydantic import StrictStr, Field +from typing import Union, List, Set, Optional, Dict +from typing_extensions import Literal, Self + +DETECTORCREATIONINPUTREQUESTMODECONFIGURATION_ONE_OF_SCHEMAS = [ + "BoundingBoxModeConfiguration", + "CountModeConfiguration", + "MultiClassModeConfiguration", + "TextModeConfiguration", +] + + +class DetectorCreationInputRequestModeConfiguration(BaseModel): + """ + DetectorCreationInputRequestModeConfiguration + """ + + # data type: CountModeConfiguration + oneof_schema_1_validator: Optional[CountModeConfiguration] = None + # data type: MultiClassModeConfiguration + oneof_schema_2_validator: Optional[MultiClassModeConfiguration] = None + # data type: TextModeConfiguration + oneof_schema_3_validator: Optional[TextModeConfiguration] = None + # data type: BoundingBoxModeConfiguration + oneof_schema_4_validator: Optional[BoundingBoxModeConfiguration] = None + actual_instance: Optional[ + Union[BoundingBoxModeConfiguration, CountModeConfiguration, MultiClassModeConfiguration, TextModeConfiguration] + ] = None + one_of_schemas: Set[str] = { + "BoundingBoxModeConfiguration", + "CountModeConfiguration", + "MultiClassModeConfiguration", + "TextModeConfiguration", + } + + model_config = ConfigDict( + validate_assignment=True, + protected_namespaces=(), + ) + + def __init__(self, *args, **kwargs) -> None: + if args: + if len(args) > 1: + raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") + if kwargs: + raise ValueError("If a position argument is used, keyword arguments cannot be used.") + super().__init__(actual_instance=args[0]) + else: + super().__init__(**kwargs) + + @field_validator("actual_instance") + def actual_instance_must_validate_oneof(cls, v): + if v is None: + return v + + instance = DetectorCreationInputRequestModeConfiguration.model_construct() + error_messages = [] + match = 0 + # validate data type: CountModeConfiguration + if not isinstance(v, CountModeConfiguration): + error_messages.append(f"Error! Input type `{type(v)}` is not `CountModeConfiguration`") + else: + match += 1 + # validate data type: MultiClassModeConfiguration + if not isinstance(v, MultiClassModeConfiguration): + error_messages.append(f"Error! Input type `{type(v)}` is not `MultiClassModeConfiguration`") + else: + match += 1 + # validate data type: TextModeConfiguration + if not isinstance(v, TextModeConfiguration): + error_messages.append(f"Error! Input type `{type(v)}` is not `TextModeConfiguration`") + else: + match += 1 + # validate data type: BoundingBoxModeConfiguration + if not isinstance(v, BoundingBoxModeConfiguration): + error_messages.append(f"Error! Input type `{type(v)}` is not `BoundingBoxModeConfiguration`") + else: + match += 1 + if match > 1: + # more than 1 match + raise ValueError( + "Multiple matches found when setting `actual_instance` in DetectorCreationInputRequestModeConfiguration" + " with oneOf schemas: BoundingBoxModeConfiguration, CountModeConfiguration," + " MultiClassModeConfiguration, TextModeConfiguration. Details: " + + ", ".join(error_messages) + ) + elif match == 0: + # no match + raise ValueError( + "No match found when setting `actual_instance` in DetectorCreationInputRequestModeConfiguration with" + " oneOf schemas: BoundingBoxModeConfiguration, CountModeConfiguration, MultiClassModeConfiguration," + " TextModeConfiguration. Details: " + + ", ".join(error_messages) + ) + else: + return v + + @classmethod + def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self: + return cls.from_json(json.dumps(obj)) + + @classmethod + def from_json(cls, json_str: Optional[str]) -> Self: + """Returns the object represented by the json string""" + instance = cls.model_construct() + if json_str is None: + return instance + + error_messages = [] + match = 0 + + # deserialize data into CountModeConfiguration + try: + instance.actual_instance = CountModeConfiguration.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into MultiClassModeConfiguration + try: + instance.actual_instance = MultiClassModeConfiguration.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into TextModeConfiguration + try: + instance.actual_instance = TextModeConfiguration.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into BoundingBoxModeConfiguration + try: + instance.actual_instance = BoundingBoxModeConfiguration.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + + if match > 1: + # more than 1 match + raise ValueError( + "Multiple matches found when deserializing the JSON string into" + " DetectorCreationInputRequestModeConfiguration with oneOf schemas: BoundingBoxModeConfiguration," + " CountModeConfiguration, MultiClassModeConfiguration, TextModeConfiguration. Details: " + + ", ".join(error_messages) + ) + elif match == 0: + # no match + raise ValueError( + "No match found when deserializing the JSON string into DetectorCreationInputRequestModeConfiguration" + " with oneOf schemas: BoundingBoxModeConfiguration, CountModeConfiguration," + " MultiClassModeConfiguration, TextModeConfiguration. Details: " + + ", ".join(error_messages) + ) + else: + return instance + + def to_json(self) -> str: + """Returns the JSON representation of the actual instance""" + if self.actual_instance is None: + return "null" + + if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): + return self.actual_instance.to_json() + else: + return json.dumps(self.actual_instance) + + def to_dict( + self, + ) -> Optional[ + Union[ + Dict[str, Any], + BoundingBoxModeConfiguration, + CountModeConfiguration, + MultiClassModeConfiguration, + TextModeConfiguration, + ] + ]: + """Returns the dict representation of the actual instance""" + if self.actual_instance is None: + return None + + if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): + return self.actual_instance.to_dict() + else: + # primitive type + return self.actual_instance + + def to_str(self) -> str: + """Returns the string representation of the actual instance""" + return pprint.pformat(self.model_dump()) diff --git a/generated/groundlight_openapi_client/models/detector_group.py b/generated/groundlight_openapi_client/models/detector_group.py new file mode 100644 index 00000000..90f21a07 --- /dev/null +++ b/generated/groundlight_openapi_client/models/detector_group.py @@ -0,0 +1,89 @@ +# coding: utf-8 + +""" + Groundlight API + + Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. + + The version of the OpenAPI document: 0.18.2 + Contact: support@groundlight.ai + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List +from typing_extensions import Annotated +from typing import Optional, Set +from typing_extensions import Self + + +class DetectorGroup(BaseModel): + """ + DetectorGroup + """ # noqa: E501 + + id: StrictStr + name: Annotated[str, Field(strict=True, max_length=100)] + __properties: ClassVar[List[str]] = ["id", "name"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of DetectorGroup from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * OpenAPI `readOnly` fields are excluded. + """ + excluded_fields: Set[str] = set([ + "id", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of DetectorGroup from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({"id": obj.get("id"), "name": obj.get("name")}) + return _obj diff --git a/generated/groundlight_openapi_client/models/detector_group_request.py b/generated/groundlight_openapi_client/models/detector_group_request.py new file mode 100644 index 00000000..aeb71432 --- /dev/null +++ b/generated/groundlight_openapi_client/models/detector_group_request.py @@ -0,0 +1,85 @@ +# coding: utf-8 + +""" + Groundlight API + + Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. + + The version of the OpenAPI document: 0.18.2 + Contact: support@groundlight.ai + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List +from typing_extensions import Annotated +from typing import Optional, Set +from typing_extensions import Self + + +class DetectorGroupRequest(BaseModel): + """ + DetectorGroupRequest + """ # noqa: E501 + + name: Annotated[str, Field(min_length=1, strict=True, max_length=100)] + __properties: ClassVar[List[str]] = ["name"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of DetectorGroupRequest from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of DetectorGroupRequest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({"name": obj.get("name")}) + return _obj diff --git a/generated/groundlight_openapi_client/models/detector_type_enum.py b/generated/groundlight_openapi_client/models/detector_type_enum.py new file mode 100644 index 00000000..9a4cbbf7 --- /dev/null +++ b/generated/groundlight_openapi_client/models/detector_type_enum.py @@ -0,0 +1,35 @@ +# coding: utf-8 + +""" + Groundlight API + + Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. + + The version of the OpenAPI document: 0.18.2 + Contact: support@groundlight.ai + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class DetectorTypeEnum(str, Enum): + """ + DetectorTypeEnum + """ + + """ + allowed enum values + """ + DETECTOR = "detector" + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of DetectorTypeEnum from a JSON string""" + return cls(json.loads(json_str)) diff --git a/generated/groundlight_openapi_client/models/edge_model_info.py b/generated/groundlight_openapi_client/models/edge_model_info.py new file mode 100644 index 00000000..d8d29127 --- /dev/null +++ b/generated/groundlight_openapi_client/models/edge_model_info.py @@ -0,0 +1,121 @@ +# coding: utf-8 + +""" + Groundlight API + + Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. + + The version of the OpenAPI document: 0.18.2 + Contact: support@groundlight.ai + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + + +class EdgeModelInfo(BaseModel): + """ + Information for the model running on edge, including temporary presigned urls to the model binaries + """ # noqa: E501 + + model_binary_id: Optional[StrictStr] = None + model_binary_url: Optional[StrictStr] = None + oodd_model_binary_id: Optional[StrictStr] = None + oodd_model_binary_url: Optional[StrictStr] = None + pipeline_config: Optional[Any] = None + oodd_pipeline_config: Optional[Any] = None + predictor_metadata: Optional[Any] = None + __properties: ClassVar[List[str]] = [ + "model_binary_id", + "model_binary_url", + "oodd_model_binary_id", + "oodd_model_binary_url", + "pipeline_config", + "oodd_pipeline_config", + "predictor_metadata", + ] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of EdgeModelInfo from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # set to None if pipeline_config (nullable) is None + # and model_fields_set contains the field + if self.pipeline_config is None and "pipeline_config" in self.model_fields_set: + _dict["pipeline_config"] = None + + # set to None if oodd_pipeline_config (nullable) is None + # and model_fields_set contains the field + if self.oodd_pipeline_config is None and "oodd_pipeline_config" in self.model_fields_set: + _dict["oodd_pipeline_config"] = None + + # set to None if predictor_metadata (nullable) is None + # and model_fields_set contains the field + if self.predictor_metadata is None and "predictor_metadata" in self.model_fields_set: + _dict["predictor_metadata"] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of EdgeModelInfo from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "model_binary_id": obj.get("model_binary_id"), + "model_binary_url": obj.get("model_binary_url"), + "oodd_model_binary_id": obj.get("oodd_model_binary_id"), + "oodd_model_binary_url": obj.get("oodd_model_binary_url"), + "pipeline_config": obj.get("pipeline_config"), + "oodd_pipeline_config": obj.get("oodd_pipeline_config"), + "predictor_metadata": obj.get("predictor_metadata"), + }) + return _obj diff --git a/generated/groundlight_openapi_client/models/escalation_type_enum.py b/generated/groundlight_openapi_client/models/escalation_type_enum.py new file mode 100644 index 00000000..1aa6a7a7 --- /dev/null +++ b/generated/groundlight_openapi_client/models/escalation_type_enum.py @@ -0,0 +1,36 @@ +# coding: utf-8 + +""" + Groundlight API + + Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. + + The version of the OpenAPI document: 0.18.2 + Contact: support@groundlight.ai + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class EscalationTypeEnum(str, Enum): + """ + EscalationTypeEnum + """ + + """ + allowed enum values + """ + STANDARD = "STANDARD" + NO_HUMAN_LABELING = "NO_HUMAN_LABELING" + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of EscalationTypeEnum from a JSON string""" + return cls(json.loads(json_str)) diff --git a/generated/groundlight_openapi_client/models/get_detector_evaluation200_response.py b/generated/groundlight_openapi_client/models/get_detector_evaluation200_response.py new file mode 100644 index 00000000..b3e1fef9 --- /dev/null +++ b/generated/groundlight_openapi_client/models/get_detector_evaluation200_response.py @@ -0,0 +1,101 @@ +# coding: utf-8 + +""" + Groundlight API + + Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. + + The version of the OpenAPI document: 0.18.2 + Contact: support@groundlight.ai + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict +from typing import Any, ClassVar, Dict, List, Optional +from groundlight_openapi_client.models.get_detector_evaluation200_response_evaluation_results import ( + GetDetectorEvaluation200ResponseEvaluationResults, +) +from typing import Optional, Set +from typing_extensions import Self + + +class GetDetectorEvaluation200Response(BaseModel): + """ + GetDetectorEvaluation200Response + """ # noqa: E501 + + evaluation_results: Optional[GetDetectorEvaluation200ResponseEvaluationResults] = None + __properties: ClassVar[List[str]] = ["evaluation_results"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of GetDetectorEvaluation200Response from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of evaluation_results + if self.evaluation_results: + _dict["evaluation_results"] = self.evaluation_results.to_dict() + # set to None if evaluation_results (nullable) is None + # and model_fields_set contains the field + if self.evaluation_results is None and "evaluation_results" in self.model_fields_set: + _dict["evaluation_results"] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of GetDetectorEvaluation200Response from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "evaluation_results": ( + GetDetectorEvaluation200ResponseEvaluationResults.from_dict(obj["evaluation_results"]) + if obj.get("evaluation_results") is not None + else None + ) + }) + return _obj diff --git a/generated/groundlight_openapi_client/models/get_detector_evaluation200_response_evaluation_results.py b/generated/groundlight_openapi_client/models/get_detector_evaluation200_response_evaluation_results.py new file mode 100644 index 00000000..f7d6b152 --- /dev/null +++ b/generated/groundlight_openapi_client/models/get_detector_evaluation200_response_evaluation_results.py @@ -0,0 +1,233 @@ +# coding: utf-8 + +""" + Groundlight API + + Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. + + The version of the OpenAPI document: 0.18.2 + Contact: support@groundlight.ai + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from datetime import datetime +from pydantic import BaseModel, ConfigDict, StrictFloat, StrictInt +from typing import Any, ClassVar, Dict, List, Optional, Union +from typing import Optional, Set +from typing_extensions import Self + + +class GetDetectorEvaluation200ResponseEvaluationResults(BaseModel): + """ + GetDetectorEvaluation200ResponseEvaluationResults + """ # noqa: E501 + + eval_timestamp: Optional[datetime] = None + total_ground_truth_examples: Optional[StrictInt] = None + total_labeled_examples: Optional[StrictInt] = None + kfold_pooled__balanced_accuracy: Optional[Union[StrictFloat, StrictInt]] = None + kfold_pooled__positive_accuracy: Optional[Union[StrictFloat, StrictInt]] = None + kfold_pooled__negative_accuracy: Optional[Union[StrictFloat, StrictInt]] = None + precision__mean: Optional[Union[StrictFloat, StrictInt]] = None + recall__mean: Optional[Union[StrictFloat, StrictInt]] = None + roc_auc__mean: Optional[Union[StrictFloat, StrictInt]] = None + balanced_system_accuracies: Optional[Dict[str, Any]] = None + positive_system_accuracies: Optional[Dict[str, Any]] = None + negative_system_accuracies: Optional[Dict[str, Any]] = None + mean_absolute_error__mean: Optional[Union[StrictFloat, StrictInt]] = None + objdet_precision__mean: Optional[Union[StrictFloat, StrictInt]] = None + objdet_recall__mean: Optional[Union[StrictFloat, StrictInt]] = None + objdet_f1_score__mean: Optional[Union[StrictFloat, StrictInt]] = None + class_accuracies: Optional[Dict[str, Any]] = None + confusion_dict: Optional[Dict[str, Any]] = None + num_examples_per_class: Optional[Dict[str, Any]] = None + __properties: ClassVar[List[str]] = [ + "eval_timestamp", + "total_ground_truth_examples", + "total_labeled_examples", + "kfold_pooled__balanced_accuracy", + "kfold_pooled__positive_accuracy", + "kfold_pooled__negative_accuracy", + "precision__mean", + "recall__mean", + "roc_auc__mean", + "balanced_system_accuracies", + "positive_system_accuracies", + "negative_system_accuracies", + "mean_absolute_error__mean", + "objdet_precision__mean", + "objdet_recall__mean", + "objdet_f1_score__mean", + "class_accuracies", + "confusion_dict", + "num_examples_per_class", + ] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of GetDetectorEvaluation200ResponseEvaluationResults from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # set to None if total_ground_truth_examples (nullable) is None + # and model_fields_set contains the field + if self.total_ground_truth_examples is None and "total_ground_truth_examples" in self.model_fields_set: + _dict["total_ground_truth_examples"] = None + + # set to None if total_labeled_examples (nullable) is None + # and model_fields_set contains the field + if self.total_labeled_examples is None and "total_labeled_examples" in self.model_fields_set: + _dict["total_labeled_examples"] = None + + # set to None if kfold_pooled__balanced_accuracy (nullable) is None + # and model_fields_set contains the field + if self.kfold_pooled__balanced_accuracy is None and "kfold_pooled__balanced_accuracy" in self.model_fields_set: + _dict["kfold_pooled__balanced_accuracy"] = None + + # set to None if kfold_pooled__positive_accuracy (nullable) is None + # and model_fields_set contains the field + if self.kfold_pooled__positive_accuracy is None and "kfold_pooled__positive_accuracy" in self.model_fields_set: + _dict["kfold_pooled__positive_accuracy"] = None + + # set to None if kfold_pooled__negative_accuracy (nullable) is None + # and model_fields_set contains the field + if self.kfold_pooled__negative_accuracy is None and "kfold_pooled__negative_accuracy" in self.model_fields_set: + _dict["kfold_pooled__negative_accuracy"] = None + + # set to None if precision__mean (nullable) is None + # and model_fields_set contains the field + if self.precision__mean is None and "precision__mean" in self.model_fields_set: + _dict["precision__mean"] = None + + # set to None if recall__mean (nullable) is None + # and model_fields_set contains the field + if self.recall__mean is None and "recall__mean" in self.model_fields_set: + _dict["recall__mean"] = None + + # set to None if roc_auc__mean (nullable) is None + # and model_fields_set contains the field + if self.roc_auc__mean is None and "roc_auc__mean" in self.model_fields_set: + _dict["roc_auc__mean"] = None + + # set to None if balanced_system_accuracies (nullable) is None + # and model_fields_set contains the field + if self.balanced_system_accuracies is None and "balanced_system_accuracies" in self.model_fields_set: + _dict["balanced_system_accuracies"] = None + + # set to None if positive_system_accuracies (nullable) is None + # and model_fields_set contains the field + if self.positive_system_accuracies is None and "positive_system_accuracies" in self.model_fields_set: + _dict["positive_system_accuracies"] = None + + # set to None if negative_system_accuracies (nullable) is None + # and model_fields_set contains the field + if self.negative_system_accuracies is None and "negative_system_accuracies" in self.model_fields_set: + _dict["negative_system_accuracies"] = None + + # set to None if mean_absolute_error__mean (nullable) is None + # and model_fields_set contains the field + if self.mean_absolute_error__mean is None and "mean_absolute_error__mean" in self.model_fields_set: + _dict["mean_absolute_error__mean"] = None + + # set to None if objdet_precision__mean (nullable) is None + # and model_fields_set contains the field + if self.objdet_precision__mean is None and "objdet_precision__mean" in self.model_fields_set: + _dict["objdet_precision__mean"] = None + + # set to None if objdet_recall__mean (nullable) is None + # and model_fields_set contains the field + if self.objdet_recall__mean is None and "objdet_recall__mean" in self.model_fields_set: + _dict["objdet_recall__mean"] = None + + # set to None if objdet_f1_score__mean (nullable) is None + # and model_fields_set contains the field + if self.objdet_f1_score__mean is None and "objdet_f1_score__mean" in self.model_fields_set: + _dict["objdet_f1_score__mean"] = None + + # set to None if class_accuracies (nullable) is None + # and model_fields_set contains the field + if self.class_accuracies is None and "class_accuracies" in self.model_fields_set: + _dict["class_accuracies"] = None + + # set to None if confusion_dict (nullable) is None + # and model_fields_set contains the field + if self.confusion_dict is None and "confusion_dict" in self.model_fields_set: + _dict["confusion_dict"] = None + + # set to None if num_examples_per_class (nullable) is None + # and model_fields_set contains the field + if self.num_examples_per_class is None and "num_examples_per_class" in self.model_fields_set: + _dict["num_examples_per_class"] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of GetDetectorEvaluation200ResponseEvaluationResults from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "eval_timestamp": obj.get("eval_timestamp"), + "total_ground_truth_examples": obj.get("total_ground_truth_examples"), + "total_labeled_examples": obj.get("total_labeled_examples"), + "kfold_pooled__balanced_accuracy": obj.get("kfold_pooled__balanced_accuracy"), + "kfold_pooled__positive_accuracy": obj.get("kfold_pooled__positive_accuracy"), + "kfold_pooled__negative_accuracy": obj.get("kfold_pooled__negative_accuracy"), + "precision__mean": obj.get("precision__mean"), + "recall__mean": obj.get("recall__mean"), + "roc_auc__mean": obj.get("roc_auc__mean"), + "balanced_system_accuracies": obj.get("balanced_system_accuracies"), + "positive_system_accuracies": obj.get("positive_system_accuracies"), + "negative_system_accuracies": obj.get("negative_system_accuracies"), + "mean_absolute_error__mean": obj.get("mean_absolute_error__mean"), + "objdet_precision__mean": obj.get("objdet_precision__mean"), + "objdet_recall__mean": obj.get("objdet_recall__mean"), + "objdet_f1_score__mean": obj.get("objdet_f1_score__mean"), + "class_accuracies": obj.get("class_accuracies"), + "confusion_dict": obj.get("confusion_dict"), + "num_examples_per_class": obj.get("num_examples_per_class"), + }) + return _obj diff --git a/generated/groundlight_openapi_client/models/get_detector_metrics200_response.py b/generated/groundlight_openapi_client/models/get_detector_metrics200_response.py new file mode 100644 index 00000000..37087141 --- /dev/null +++ b/generated/groundlight_openapi_client/models/get_detector_metrics200_response.py @@ -0,0 +1,101 @@ +# coding: utf-8 + +""" + Groundlight API + + Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. + + The version of the OpenAPI document: 0.18.2 + Contact: support@groundlight.ai + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict +from typing import Any, ClassVar, Dict, List, Optional +from groundlight_openapi_client.models.get_detector_metrics200_response_summary import ( + GetDetectorMetrics200ResponseSummary, +) +from typing import Optional, Set +from typing_extensions import Self + + +class GetDetectorMetrics200Response(BaseModel): + """ + GetDetectorMetrics200Response + """ # noqa: E501 + + summary: Optional[GetDetectorMetrics200ResponseSummary] = None + __properties: ClassVar[List[str]] = ["summary"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of GetDetectorMetrics200Response from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of summary + if self.summary: + _dict["summary"] = self.summary.to_dict() + # set to None if summary (nullable) is None + # and model_fields_set contains the field + if self.summary is None and "summary" in self.model_fields_set: + _dict["summary"] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of GetDetectorMetrics200Response from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "summary": ( + GetDetectorMetrics200ResponseSummary.from_dict(obj["summary"]) + if obj.get("summary") is not None + else None + ) + }) + return _obj diff --git a/generated/groundlight_openapi_client/models/get_detector_metrics200_response_summary.py b/generated/groundlight_openapi_client/models/get_detector_metrics200_response_summary.py new file mode 100644 index 00000000..3f3fe177 --- /dev/null +++ b/generated/groundlight_openapi_client/models/get_detector_metrics200_response_summary.py @@ -0,0 +1,110 @@ +# coding: utf-8 + +""" + Groundlight API + + Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. + + The version of the OpenAPI document: 0.18.2 + Contact: support@groundlight.ai + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictInt +from typing import Any, ClassVar, Dict, List, Optional +from groundlight_openapi_client.models.get_detector_metrics200_response_summary_class_counts import ( + GetDetectorMetrics200ResponseSummaryClassCounts, +) +from typing import Optional, Set +from typing_extensions import Self + + +class GetDetectorMetrics200ResponseSummary(BaseModel): + """ + GetDetectorMetrics200ResponseSummary + """ # noqa: E501 + + num_ground_truth: Optional[StrictInt] = None + num_current_source_human: Optional[StrictInt] = None + class_counts: Optional[GetDetectorMetrics200ResponseSummaryClassCounts] = None + unconfident_counts: Optional[Dict[str, Any]] = None + total_iqs: Optional[StrictInt] = None + __properties: ClassVar[List[str]] = [ + "num_ground_truth", + "num_current_source_human", + "class_counts", + "unconfident_counts", + "total_iqs", + ] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of GetDetectorMetrics200ResponseSummary from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of class_counts + if self.class_counts: + _dict["class_counts"] = self.class_counts.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of GetDetectorMetrics200ResponseSummary from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "num_ground_truth": obj.get("num_ground_truth"), + "num_current_source_human": obj.get("num_current_source_human"), + "class_counts": ( + GetDetectorMetrics200ResponseSummaryClassCounts.from_dict(obj["class_counts"]) + if obj.get("class_counts") is not None + else None + ), + "unconfident_counts": obj.get("unconfident_counts"), + "total_iqs": obj.get("total_iqs"), + }) + return _obj diff --git a/generated/groundlight_openapi_client/models/get_detector_metrics200_response_summary_class_counts.py b/generated/groundlight_openapi_client/models/get_detector_metrics200_response_summary_class_counts.py new file mode 100644 index 00000000..6b324716 --- /dev/null +++ b/generated/groundlight_openapi_client/models/get_detector_metrics200_response_summary_class_counts.py @@ -0,0 +1,94 @@ +# coding: utf-8 + +""" + Groundlight API + + Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. + + The version of the OpenAPI document: 0.18.2 + Contact: support@groundlight.ai + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + + +class GetDetectorMetrics200ResponseSummaryClassCounts(BaseModel): + """ + GetDetectorMetrics200ResponseSummaryClassCounts + """ # noqa: E501 + + source_ml: Optional[Dict[str, Any]] = None + source_human: Optional[Dict[str, Any]] = None + cloud_labeler: Optional[Dict[str, Any]] = None + cloud: Optional[Dict[str, Any]] = None + total: Optional[Dict[str, Any]] = None + __properties: ClassVar[List[str]] = ["source_ml", "source_human", "cloud_labeler", "cloud", "total"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of GetDetectorMetrics200ResponseSummaryClassCounts from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of GetDetectorMetrics200ResponseSummaryClassCounts from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "source_ml": obj.get("source_ml"), + "source_human": obj.get("source_human"), + "cloud_labeler": obj.get("cloud_labeler"), + "cloud": obj.get("cloud"), + "total": obj.get("total"), + }) + return _obj diff --git a/generated/groundlight_openapi_client/models/image_query_result.py b/generated/groundlight_openapi_client/models/image_query_result.py new file mode 100644 index 00000000..e5df1f58 --- /dev/null +++ b/generated/groundlight_openapi_client/models/image_query_result.py @@ -0,0 +1,236 @@ +# coding: utf-8 + +""" + Groundlight API + + Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. + + The version of the OpenAPI document: 0.18.2 + Contact: support@groundlight.ai + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +import pprint +from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator +from typing import Any, List, Optional +from groundlight_openapi_client.models.binary_classification_result import BinaryClassificationResult +from groundlight_openapi_client.models.bounding_box_result import BoundingBoxResult +from groundlight_openapi_client.models.counting_result import CountingResult +from groundlight_openapi_client.models.multi_classification_result import MultiClassificationResult +from groundlight_openapi_client.models.text_recognition_result import TextRecognitionResult +from pydantic import StrictStr, Field +from typing import Union, List, Set, Optional, Dict +from typing_extensions import Literal, Self + +IMAGEQUERYRESULT_ONE_OF_SCHEMAS = [ + "BinaryClassificationResult", + "BoundingBoxResult", + "CountingResult", + "MultiClassificationResult", + "TextRecognitionResult", +] + + +class ImageQueryResult(BaseModel): + """ + ImageQueryResult + """ + + # data type: BinaryClassificationResult + oneof_schema_1_validator: Optional[BinaryClassificationResult] = None + # data type: CountingResult + oneof_schema_2_validator: Optional[CountingResult] = None + # data type: MultiClassificationResult + oneof_schema_3_validator: Optional[MultiClassificationResult] = None + # data type: TextRecognitionResult + oneof_schema_4_validator: Optional[TextRecognitionResult] = None + # data type: BoundingBoxResult + oneof_schema_5_validator: Optional[BoundingBoxResult] = None + actual_instance: Optional[ + Union[ + BinaryClassificationResult, + BoundingBoxResult, + CountingResult, + MultiClassificationResult, + TextRecognitionResult, + ] + ] = None + one_of_schemas: Set[str] = { + "BinaryClassificationResult", + "BoundingBoxResult", + "CountingResult", + "MultiClassificationResult", + "TextRecognitionResult", + } + + model_config = ConfigDict( + validate_assignment=True, + protected_namespaces=(), + ) + + def __init__(self, *args, **kwargs) -> None: + if args: + if len(args) > 1: + raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") + if kwargs: + raise ValueError("If a position argument is used, keyword arguments cannot be used.") + super().__init__(actual_instance=args[0]) + else: + super().__init__(**kwargs) + + @field_validator("actual_instance") + def actual_instance_must_validate_oneof(cls, v): + if v is None: + return v + + instance = ImageQueryResult.model_construct() + error_messages = [] + match = 0 + # validate data type: BinaryClassificationResult + if not isinstance(v, BinaryClassificationResult): + error_messages.append(f"Error! Input type `{type(v)}` is not `BinaryClassificationResult`") + else: + match += 1 + # validate data type: CountingResult + if not isinstance(v, CountingResult): + error_messages.append(f"Error! Input type `{type(v)}` is not `CountingResult`") + else: + match += 1 + # validate data type: MultiClassificationResult + if not isinstance(v, MultiClassificationResult): + error_messages.append(f"Error! Input type `{type(v)}` is not `MultiClassificationResult`") + else: + match += 1 + # validate data type: TextRecognitionResult + if not isinstance(v, TextRecognitionResult): + error_messages.append(f"Error! Input type `{type(v)}` is not `TextRecognitionResult`") + else: + match += 1 + # validate data type: BoundingBoxResult + if not isinstance(v, BoundingBoxResult): + error_messages.append(f"Error! Input type `{type(v)}` is not `BoundingBoxResult`") + else: + match += 1 + if match > 1: + # more than 1 match + raise ValueError( + "Multiple matches found when setting `actual_instance` in ImageQueryResult with oneOf schemas:" + " BinaryClassificationResult, BoundingBoxResult, CountingResult, MultiClassificationResult," + " TextRecognitionResult. Details: " + + ", ".join(error_messages) + ) + elif match == 0: + # no match + raise ValueError( + "No match found when setting `actual_instance` in ImageQueryResult with oneOf schemas:" + " BinaryClassificationResult, BoundingBoxResult, CountingResult, MultiClassificationResult," + " TextRecognitionResult. Details: " + + ", ".join(error_messages) + ) + else: + return v + + @classmethod + def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self: + return cls.from_json(json.dumps(obj)) + + @classmethod + def from_json(cls, json_str: Optional[str]) -> Self: + """Returns the object represented by the json string""" + instance = cls.model_construct() + if json_str is None: + return instance + + error_messages = [] + match = 0 + + # deserialize data into BinaryClassificationResult + try: + instance.actual_instance = BinaryClassificationResult.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into CountingResult + try: + instance.actual_instance = CountingResult.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into MultiClassificationResult + try: + instance.actual_instance = MultiClassificationResult.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into TextRecognitionResult + try: + instance.actual_instance = TextRecognitionResult.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into BoundingBoxResult + try: + instance.actual_instance = BoundingBoxResult.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + + if match > 1: + # more than 1 match + raise ValueError( + "Multiple matches found when deserializing the JSON string into ImageQueryResult with oneOf schemas:" + " BinaryClassificationResult, BoundingBoxResult, CountingResult, MultiClassificationResult," + " TextRecognitionResult. Details: " + + ", ".join(error_messages) + ) + elif match == 0: + # no match + raise ValueError( + "No match found when deserializing the JSON string into ImageQueryResult with oneOf schemas:" + " BinaryClassificationResult, BoundingBoxResult, CountingResult, MultiClassificationResult," + " TextRecognitionResult. Details: " + + ", ".join(error_messages) + ) + else: + return instance + + def to_json(self) -> str: + """Returns the JSON representation of the actual instance""" + if self.actual_instance is None: + return "null" + + if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): + return self.actual_instance.to_json() + else: + return json.dumps(self.actual_instance) + + def to_dict( + self, + ) -> Optional[ + Union[ + Dict[str, Any], + BinaryClassificationResult, + BoundingBoxResult, + CountingResult, + MultiClassificationResult, + TextRecognitionResult, + ] + ]: + """Returns the dict representation of the actual instance""" + if self.actual_instance is None: + return None + + if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): + return self.actual_instance.to_dict() + else: + # primitive type + return self.actual_instance + + def to_str(self) -> str: + """Returns the string representation of the actual instance""" + return pprint.pformat(self.model_dump()) diff --git a/generated/groundlight_openapi_client/models/image_query_type_enum.py b/generated/groundlight_openapi_client/models/image_query_type_enum.py new file mode 100644 index 00000000..2b39037a --- /dev/null +++ b/generated/groundlight_openapi_client/models/image_query_type_enum.py @@ -0,0 +1,35 @@ +# coding: utf-8 + +""" + Groundlight API + + Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. + + The version of the OpenAPI document: 0.18.2 + Contact: support@groundlight.ai + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class ImageQueryTypeEnum(str, Enum): + """ + ImageQueryTypeEnum + """ + + """ + allowed enum values + """ + IMAGE_QUERY = "image_query" + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of ImageQueryTypeEnum from a JSON string""" + return cls(json.loads(json_str)) diff --git a/generated/groundlight_openapi_client/models/label.py b/generated/groundlight_openapi_client/models/label.py new file mode 100644 index 00000000..96023077 --- /dev/null +++ b/generated/groundlight_openapi_client/models/label.py @@ -0,0 +1,37 @@ +# coding: utf-8 + +""" + Groundlight API + + Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. + + The version of the OpenAPI document: 0.18.2 + Contact: support@groundlight.ai + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class Label(str, Enum): + """ + Label + """ + + """ + allowed enum values + """ + YES = "YES" + NO = "NO" + UNCLEAR = "UNCLEAR" + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of Label from a JSON string""" + return cls(json.loads(json_str)) diff --git a/generated/groundlight_openapi_client/models/label_value.py b/generated/groundlight_openapi_client/models/label_value.py new file mode 100644 index 00000000..5a95e8b6 --- /dev/null +++ b/generated/groundlight_openapi_client/models/label_value.py @@ -0,0 +1,160 @@ +# coding: utf-8 + +""" + Groundlight API + + Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. + + The version of the OpenAPI document: 0.18.2 + Contact: support@groundlight.ai + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from datetime import datetime +from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional, Union +from groundlight_openapi_client.models.roi import ROI +from typing import Optional, Set +from typing_extensions import Self + + +class LabelValue(BaseModel): + """ + LabelValue + """ # noqa: E501 + + confidence: Optional[Union[StrictFloat, StrictInt]] + class_name: Optional[StrictStr] = Field( + description="Return a human-readable class name for this label (e.g. YES/NO)" + ) + rois: Optional[List[ROI]] = None + annotations_requested: List[StrictStr] + created_at: datetime + detector_id: Optional[StrictInt] + source: StrictStr + text: Optional[StrictStr] = Field(description="Text annotations") + __properties: ClassVar[List[str]] = [ + "confidence", + "class_name", + "rois", + "annotations_requested", + "created_at", + "detector_id", + "source", + "text", + ] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LabelValue from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * OpenAPI `readOnly` fields are excluded. + * OpenAPI `readOnly` fields are excluded. + * OpenAPI `readOnly` fields are excluded. + * OpenAPI `readOnly` fields are excluded. + * OpenAPI `readOnly` fields are excluded. + * OpenAPI `readOnly` fields are excluded. + * OpenAPI `readOnly` fields are excluded. + """ + excluded_fields: Set[str] = set([ + "confidence", + "class_name", + "annotations_requested", + "created_at", + "detector_id", + "source", + "text", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in rois (list) + _items = [] + if self.rois: + for _item_rois in self.rois: + if _item_rois: + _items.append(_item_rois.to_dict()) + _dict["rois"] = _items + # set to None if confidence (nullable) is None + # and model_fields_set contains the field + if self.confidence is None and "confidence" in self.model_fields_set: + _dict["confidence"] = None + + # set to None if class_name (nullable) is None + # and model_fields_set contains the field + if self.class_name is None and "class_name" in self.model_fields_set: + _dict["class_name"] = None + + # set to None if rois (nullable) is None + # and model_fields_set contains the field + if self.rois is None and "rois" in self.model_fields_set: + _dict["rois"] = None + + # set to None if detector_id (nullable) is None + # and model_fields_set contains the field + if self.detector_id is None and "detector_id" in self.model_fields_set: + _dict["detector_id"] = None + + # set to None if text (nullable) is None + # and model_fields_set contains the field + if self.text is None and "text" in self.model_fields_set: + _dict["text"] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LabelValue from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "confidence": obj.get("confidence"), + "class_name": obj.get("class_name"), + "rois": [ROI.from_dict(_item) for _item in obj["rois"]] if obj.get("rois") is not None else None, + "annotations_requested": obj.get("annotations_requested"), + "created_at": obj.get("created_at"), + "detector_id": obj.get("detector_id"), + "source": obj.get("source"), + "text": obj.get("text"), + }) + return _obj diff --git a/generated/groundlight_openapi_client/models/label_value_request.py b/generated/groundlight_openapi_client/models/label_value_request.py new file mode 100644 index 00000000..d369862a --- /dev/null +++ b/generated/groundlight_openapi_client/models/label_value_request.py @@ -0,0 +1,109 @@ +# coding: utf-8 + +""" + Groundlight API + + Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. + + The version of the OpenAPI document: 0.18.2 + Contact: support@groundlight.ai + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from groundlight_openapi_client.models.roi_request import ROIRequest +from typing import Optional, Set +from typing_extensions import Self + + +class LabelValueRequest(BaseModel): + """ + LabelValueRequest + """ # noqa: E501 + + label: Optional[StrictStr] + image_query_id: Annotated[str, Field(min_length=1, strict=True)] + rois: Optional[List[ROIRequest]] = None + __properties: ClassVar[List[str]] = ["label", "image_query_id", "rois"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LabelValueRequest from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in rois (list) + _items = [] + if self.rois: + for _item_rois in self.rois: + if _item_rois: + _items.append(_item_rois.to_dict()) + _dict["rois"] = _items + # set to None if label (nullable) is None + # and model_fields_set contains the field + if self.label is None and "label" in self.model_fields_set: + _dict["label"] = None + + # set to None if rois (nullable) is None + # and model_fields_set contains the field + if self.rois is None and "rois" in self.model_fields_set: + _dict["rois"] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LabelValueRequest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "label": obj.get("label"), + "image_query_id": obj.get("image_query_id"), + "rois": [ROIRequest.from_dict(_item) for _item in obj["rois"]] if obj.get("rois") is not None else None, + }) + return _obj diff --git a/generated/groundlight_openapi_client/models/mode_enum.py b/generated/groundlight_openapi_client/models/mode_enum.py new file mode 100644 index 00000000..c34b0b91 --- /dev/null +++ b/generated/groundlight_openapi_client/models/mode_enum.py @@ -0,0 +1,39 @@ +# coding: utf-8 + +""" + Groundlight API + + Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. + + The version of the OpenAPI document: 0.18.2 + Contact: support@groundlight.ai + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class ModeEnum(str, Enum): + """ + ModeEnum + """ + + """ + allowed enum values + """ + BINARY = "BINARY" + COUNT = "COUNT" + MULTI_CLASS = "MULTI_CLASS" + TEXT = "TEXT" + BOUNDING_BOX = "BOUNDING_BOX" + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of ModeEnum from a JSON string""" + return cls(json.loads(json_str)) diff --git a/generated/groundlight_openapi_client/models/multi_class_mode_configuration.py b/generated/groundlight_openapi_client/models/multi_class_mode_configuration.py new file mode 100644 index 00000000..9c40470a --- /dev/null +++ b/generated/groundlight_openapi_client/models/multi_class_mode_configuration.py @@ -0,0 +1,85 @@ +# coding: utf-8 + +""" + Groundlight API + + Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. + + The version of the OpenAPI document: 0.18.2 + Contact: support@groundlight.ai + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + + +class MultiClassModeConfiguration(BaseModel): + """ + MultiClassModeConfiguration + """ # noqa: E501 + + class_names: List[StrictStr] + num_classes: Optional[StrictInt] = None + __properties: ClassVar[List[str]] = ["class_names", "num_classes"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of MultiClassModeConfiguration from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of MultiClassModeConfiguration from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({"class_names": obj.get("class_names"), "num_classes": obj.get("num_classes")}) + return _obj diff --git a/generated/groundlight_openapi_client/models/multi_classification_result.py b/generated/groundlight_openapi_client/models/multi_classification_result.py new file mode 100644 index 00000000..0a2a170c --- /dev/null +++ b/generated/groundlight_openapi_client/models/multi_classification_result.py @@ -0,0 +1,112 @@ +# coding: utf-8 + +""" + Groundlight API + + Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. + + The version of the OpenAPI document: 0.18.2 + Contact: support@groundlight.ai + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional, Union +from typing_extensions import Annotated +from typing import Optional, Set +from typing_extensions import Self + + +class MultiClassificationResult(BaseModel): + """ + MultiClassificationResult + """ # noqa: E501 + + confidence: Optional[ + Union[Annotated[float, Field(le=1.0, strict=True, ge=0.0)], Annotated[int, Field(le=1, strict=True, ge=0)]] + ] = None + source: Optional[StrictStr] = None + result_type: Optional[StrictStr] = None + from_edge: Optional[StrictBool] = None + label: StrictStr + __properties: ClassVar[List[str]] = ["confidence", "source", "result_type", "from_edge", "label"] + + @field_validator("result_type") + def result_type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(["multi_classification"]): + raise ValueError("must be one of enum values ('multi_classification')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of MultiClassificationResult from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # set to None if confidence (nullable) is None + # and model_fields_set contains the field + if self.confidence is None and "confidence" in self.model_fields_set: + _dict["confidence"] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of MultiClassificationResult from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "confidence": obj.get("confidence"), + "source": obj.get("source"), + "result_type": obj.get("result_type"), + "from_edge": obj.get("from_edge"), + "label": obj.get("label"), + }) + return _obj diff --git a/generated/groundlight_openapi_client/models/note.py b/generated/groundlight_openapi_client/models/note.py new file mode 100644 index 00000000..bdedcd20 --- /dev/null +++ b/generated/groundlight_openapi_client/models/note.py @@ -0,0 +1,101 @@ +# coding: utf-8 + +""" + Groundlight API + + Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. + + The version of the OpenAPI document: 0.18.2 + Contact: support@groundlight.ai + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + + +class Note(BaseModel): + """ + Note + """ # noqa: E501 + + detector_id: StrictStr + content: Optional[StrictStr] = Field(default=None, description="Text content of the note.") + is_pinned: Optional[StrictBool] = None + __properties: ClassVar[List[str]] = ["detector_id", "content", "is_pinned"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of Note from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * OpenAPI `readOnly` fields are excluded. + """ + excluded_fields: Set[str] = set([ + "detector_id", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # set to None if content (nullable) is None + # and model_fields_set contains the field + if self.content is None and "content" in self.model_fields_set: + _dict["content"] = None + + # set to None if is_pinned (nullable) is None + # and model_fields_set contains the field + if self.is_pinned is None and "is_pinned" in self.model_fields_set: + _dict["is_pinned"] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of Note from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate( + {"detector_id": obj.get("detector_id"), "content": obj.get("content"), "is_pinned": obj.get("is_pinned")} + ) + return _obj diff --git a/generated/groundlight_openapi_client/models/note_request.py b/generated/groundlight_openapi_client/models/note_request.py new file mode 100644 index 00000000..c411af96 --- /dev/null +++ b/generated/groundlight_openapi_client/models/note_request.py @@ -0,0 +1,103 @@ +# coding: utf-8 + +""" + Groundlight API + + Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. + + The version of the OpenAPI document: 0.18.2 + Contact: support@groundlight.ai + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictBytes, StrictStr +from typing import Any, ClassVar, Dict, List, Optional, Tuple, Union +from typing import Optional, Set +from typing_extensions import Self + + +class NoteRequest(BaseModel): + """ + NoteRequest + """ # noqa: E501 + + content: Optional[StrictStr] = Field(default=None, description="Text content of the note.") + is_pinned: Optional[StrictBool] = None + image: Optional[Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]]] = None + __properties: ClassVar[List[str]] = ["content", "is_pinned", "image"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of NoteRequest from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # set to None if content (nullable) is None + # and model_fields_set contains the field + if self.content is None and "content" in self.model_fields_set: + _dict["content"] = None + + # set to None if is_pinned (nullable) is None + # and model_fields_set contains the field + if self.is_pinned is None and "is_pinned" in self.model_fields_set: + _dict["is_pinned"] = None + + # set to None if image (nullable) is None + # and model_fields_set contains the field + if self.image is None and "image" in self.model_fields_set: + _dict["image"] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of NoteRequest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate( + {"content": obj.get("content"), "is_pinned": obj.get("is_pinned"), "image": obj.get("image")} + ) + return _obj diff --git a/generated/groundlight_openapi_client/models/paginated_detector_list.py b/generated/groundlight_openapi_client/models/paginated_detector_list.py new file mode 100644 index 00000000..a140ef5d --- /dev/null +++ b/generated/groundlight_openapi_client/models/paginated_detector_list.py @@ -0,0 +1,111 @@ +# coding: utf-8 + +""" + Groundlight API + + Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. + + The version of the OpenAPI document: 0.18.2 + Contact: support@groundlight.ai + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + + +class PaginatedDetectorList(BaseModel): + """ + PaginatedDetectorList + """ # noqa: E501 + + count: StrictInt + next: Optional[StrictStr] = None + previous: Optional[StrictStr] = None + results: List[Detector] + __properties: ClassVar[List[str]] = ["count", "next", "previous", "results"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PaginatedDetectorList from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in results (list) + _items = [] + if self.results: + for _item_results in self.results: + if _item_results: + _items.append(_item_results.to_dict()) + _dict["results"] = _items + # set to None if next (nullable) is None + # and model_fields_set contains the field + if self.next is None and "next" in self.model_fields_set: + _dict["next"] = None + + # set to None if previous (nullable) is None + # and model_fields_set contains the field + if self.previous is None and "previous" in self.model_fields_set: + _dict["previous"] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PaginatedDetectorList from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "count": obj.get("count"), + "next": obj.get("next"), + "previous": obj.get("previous"), + "results": ( + [Detector.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None + ), + }) + return _obj diff --git a/generated/groundlight_openapi_client/models/paginated_image_query_list.py b/generated/groundlight_openapi_client/models/paginated_image_query_list.py new file mode 100644 index 00000000..312865eb --- /dev/null +++ b/generated/groundlight_openapi_client/models/paginated_image_query_list.py @@ -0,0 +1,111 @@ +# coding: utf-8 + +""" + Groundlight API + + Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. + + The version of the OpenAPI document: 0.18.2 + Contact: support@groundlight.ai + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + + +class PaginatedImageQueryList(BaseModel): + """ + PaginatedImageQueryList + """ # noqa: E501 + + count: StrictInt + next: Optional[StrictStr] = None + previous: Optional[StrictStr] = None + results: List[ImageQuery] + __properties: ClassVar[List[str]] = ["count", "next", "previous", "results"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PaginatedImageQueryList from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in results (list) + _items = [] + if self.results: + for _item_results in self.results: + if _item_results: + _items.append(_item_results.to_dict()) + _dict["results"] = _items + # set to None if next (nullable) is None + # and model_fields_set contains the field + if self.next is None and "next" in self.model_fields_set: + _dict["next"] = None + + # set to None if previous (nullable) is None + # and model_fields_set contains the field + if self.previous is None and "previous" in self.model_fields_set: + _dict["previous"] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PaginatedImageQueryList from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "count": obj.get("count"), + "next": obj.get("next"), + "previous": obj.get("previous"), + "results": ( + [ImageQuery.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None + ), + }) + return _obj diff --git a/generated/groundlight_openapi_client/models/paginated_rule_list.py b/generated/groundlight_openapi_client/models/paginated_rule_list.py new file mode 100644 index 00000000..59e66e30 --- /dev/null +++ b/generated/groundlight_openapi_client/models/paginated_rule_list.py @@ -0,0 +1,110 @@ +# coding: utf-8 + +""" + Groundlight API + + Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. + + The version of the OpenAPI document: 0.18.2 + Contact: support@groundlight.ai + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from groundlight_openapi_client.models.rule import Rule +from typing import Optional, Set +from typing_extensions import Self + + +class PaginatedRuleList(BaseModel): + """ + PaginatedRuleList + """ # noqa: E501 + + count: StrictInt + next: Optional[StrictStr] = None + previous: Optional[StrictStr] = None + results: List[Rule] + __properties: ClassVar[List[str]] = ["count", "next", "previous", "results"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PaginatedRuleList from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in results (list) + _items = [] + if self.results: + for _item_results in self.results: + if _item_results: + _items.append(_item_results.to_dict()) + _dict["results"] = _items + # set to None if next (nullable) is None + # and model_fields_set contains the field + if self.next is None and "next" in self.model_fields_set: + _dict["next"] = None + + # set to None if previous (nullable) is None + # and model_fields_set contains the field + if self.previous is None and "previous" in self.model_fields_set: + _dict["previous"] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PaginatedRuleList from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "count": obj.get("count"), + "next": obj.get("next"), + "previous": obj.get("previous"), + "results": [Rule.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None, + }) + return _obj diff --git a/generated/groundlight_openapi_client/models/payload_template.py b/generated/groundlight_openapi_client/models/payload_template.py new file mode 100644 index 00000000..6e7ee480 --- /dev/null +++ b/generated/groundlight_openapi_client/models/payload_template.py @@ -0,0 +1,90 @@ +# coding: utf-8 + +""" + Groundlight API + + Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. + + The version of the OpenAPI document: 0.18.2 + Contact: support@groundlight.ai + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + + +class PayloadTemplate(BaseModel): + """ + PayloadTemplate + """ # noqa: E501 + + template: StrictStr + headers: Optional[Dict[str, StrictStr]] = None + __properties: ClassVar[List[str]] = ["template", "headers"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PayloadTemplate from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # set to None if headers (nullable) is None + # and model_fields_set contains the field + if self.headers is None and "headers" in self.model_fields_set: + _dict["headers"] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PayloadTemplate from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({"template": obj.get("template"), "headers": obj.get("headers")}) + return _obj diff --git a/generated/groundlight_openapi_client/models/payload_template_request.py b/generated/groundlight_openapi_client/models/payload_template_request.py new file mode 100644 index 00000000..7c26d916 --- /dev/null +++ b/generated/groundlight_openapi_client/models/payload_template_request.py @@ -0,0 +1,91 @@ +# coding: utf-8 + +""" + Groundlight API + + Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. + + The version of the OpenAPI document: 0.18.2 + Contact: support@groundlight.ai + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from typing import Optional, Set +from typing_extensions import Self + + +class PayloadTemplateRequest(BaseModel): + """ + PayloadTemplateRequest + """ # noqa: E501 + + template: Annotated[str, Field(min_length=1, strict=True)] + headers: Optional[Dict[str, Annotated[str, Field(min_length=1, strict=True)]]] = None + __properties: ClassVar[List[str]] = ["template", "headers"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PayloadTemplateRequest from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # set to None if headers (nullable) is None + # and model_fields_set contains the field + if self.headers is None and "headers" in self.model_fields_set: + _dict["headers"] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PayloadTemplateRequest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({"template": obj.get("template"), "headers": obj.get("headers")}) + return _obj diff --git a/generated/groundlight_openapi_client/models/result_type_enum.py b/generated/groundlight_openapi_client/models/result_type_enum.py new file mode 100644 index 00000000..ecffabe9 --- /dev/null +++ b/generated/groundlight_openapi_client/models/result_type_enum.py @@ -0,0 +1,39 @@ +# coding: utf-8 + +""" + Groundlight API + + Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. + + The version of the OpenAPI document: 0.18.2 + Contact: support@groundlight.ai + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class ResultTypeEnum(str, Enum): + """ + ResultTypeEnum + """ + + """ + allowed enum values + """ + BINARY_CLASSIFICATION = "binary_classification" + COUNTING = "counting" + MULTI_CLASSIFICATION = "multi_classification" + TEXT_RECOGNITION = "text_recognition" + BOUNDING_BOX = "bounding_box" + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of ResultTypeEnum from a JSON string""" + return cls(json.loads(json_str)) diff --git a/generated/groundlight_openapi_client/models/roi.py b/generated/groundlight_openapi_client/models/roi.py new file mode 100644 index 00000000..cac56b95 --- /dev/null +++ b/generated/groundlight_openapi_client/models/roi.py @@ -0,0 +1,97 @@ +# coding: utf-8 + +""" + Groundlight API + + Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. + + The version of the OpenAPI document: 0.18.2 + Contact: support@groundlight.ai + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Union +from groundlight_openapi_client.models.b_box_geometry import BBoxGeometry +from typing import Optional, Set +from typing_extensions import Self + + +class ROI(BaseModel): + """ + Mixin for serializers to handle data in the StrictBaseModel format + """ # noqa: E501 + + label: StrictStr = Field(description="The label of the bounding box.") + score: Union[StrictFloat, StrictInt] = Field(description="The confidence of the bounding box.") + geometry: BBoxGeometry + __properties: ClassVar[List[str]] = ["label", "score", "geometry"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ROI from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * OpenAPI `readOnly` fields are excluded. + """ + excluded_fields: Set[str] = set([ + "score", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of geometry + if self.geometry: + _dict["geometry"] = self.geometry.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ROI from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "label": obj.get("label"), + "score": obj.get("score"), + "geometry": BBoxGeometry.from_dict(obj["geometry"]) if obj.get("geometry") is not None else None, + }) + return _obj diff --git a/generated/groundlight_openapi_client/models/roi_request.py b/generated/groundlight_openapi_client/models/roi_request.py new file mode 100644 index 00000000..55667576 --- /dev/null +++ b/generated/groundlight_openapi_client/models/roi_request.py @@ -0,0 +1,93 @@ +# coding: utf-8 + +""" + Groundlight API + + Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. + + The version of the OpenAPI document: 0.18.2 + Contact: support@groundlight.ai + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List +from typing_extensions import Annotated +from groundlight_openapi_client.models.b_box_geometry_request import BBoxGeometryRequest +from typing import Optional, Set +from typing_extensions import Self + + +class ROIRequest(BaseModel): + """ + Mixin for serializers to handle data in the StrictBaseModel format + """ # noqa: E501 + + label: Annotated[str, Field(min_length=1, strict=True)] = Field(description="The label of the bounding box.") + geometry: BBoxGeometryRequest + __properties: ClassVar[List[str]] = ["label", "geometry"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ROIRequest from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of geometry + if self.geometry: + _dict["geometry"] = self.geometry.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ROIRequest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "label": obj.get("label"), + "geometry": BBoxGeometryRequest.from_dict(obj["geometry"]) if obj.get("geometry") is not None else None, + }) + return _obj diff --git a/generated/groundlight_openapi_client/models/rule.py b/generated/groundlight_openapi_client/models/rule.py new file mode 100644 index 00000000..fcd89f48 --- /dev/null +++ b/generated/groundlight_openapi_client/models/rule.py @@ -0,0 +1,154 @@ +# coding: utf-8 + +""" + Groundlight API + + Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. + + The version of the OpenAPI document: 0.18.2 + Contact: support@groundlight.ai + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from groundlight_openapi_client.models.condition import Condition +from groundlight_openapi_client.models.rule_action import RuleAction +from groundlight_openapi_client.models.snooze_time_unit_enum import SnoozeTimeUnitEnum +from groundlight_openapi_client.models.webhook_action import WebhookAction +from typing import Optional, Set +from typing_extensions import Self + + +class Rule(BaseModel): + """ + Rule + """ # noqa: E501 + + id: StrictInt + detector_id: StrictStr + detector_name: StrictStr + name: Annotated[str, Field(strict=True, max_length=44)] + enabled: Optional[StrictBool] = True + snooze_time_enabled: Optional[StrictBool] = False + snooze_time_value: Optional[Annotated[int, Field(strict=True, ge=0)]] = 0 + snooze_time_unit: Optional[SnoozeTimeUnitEnum] = None + human_review_required: Optional[StrictBool] = False + condition: Condition + action: Optional[RuleAction] = None + webhook_action: Optional[List[WebhookAction]] = None + __properties: ClassVar[List[str]] = [ + "id", + "detector_id", + "detector_name", + "name", + "enabled", + "snooze_time_enabled", + "snooze_time_value", + "snooze_time_unit", + "human_review_required", + "condition", + "action", + "webhook_action", + ] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of Rule from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * OpenAPI `readOnly` fields are excluded. + * OpenAPI `readOnly` fields are excluded. + * OpenAPI `readOnly` fields are excluded. + """ + excluded_fields: Set[str] = set([ + "id", + "detector_id", + "detector_name", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of condition + if self.condition: + _dict["condition"] = self.condition.to_dict() + # override the default output from pydantic by calling `to_dict()` of action + if self.action: + _dict["action"] = self.action.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in webhook_action (list) + _items = [] + if self.webhook_action: + for _item_webhook_action in self.webhook_action: + if _item_webhook_action: + _items.append(_item_webhook_action.to_dict()) + _dict["webhook_action"] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of Rule from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "detector_id": obj.get("detector_id"), + "detector_name": obj.get("detector_name"), + "name": obj.get("name"), + "enabled": obj.get("enabled") if obj.get("enabled") is not None else True, + "snooze_time_enabled": ( + obj.get("snooze_time_enabled") if obj.get("snooze_time_enabled") is not None else False + ), + "snooze_time_value": obj.get("snooze_time_value") if obj.get("snooze_time_value") is not None else 0, + "snooze_time_unit": obj.get("snooze_time_unit"), + "human_review_required": ( + obj.get("human_review_required") if obj.get("human_review_required") is not None else False + ), + "condition": Condition.from_dict(obj["condition"]) if obj.get("condition") is not None else None, + "action": RuleAction.from_dict(obj["action"]) if obj.get("action") is not None else None, + "webhook_action": ( + [WebhookAction.from_dict(_item) for _item in obj["webhook_action"]] + if obj.get("webhook_action") is not None + else None + ), + }) + return _obj diff --git a/generated/groundlight_openapi_client/models/rule_action.py b/generated/groundlight_openapi_client/models/rule_action.py new file mode 100644 index 00000000..bcc38e7e --- /dev/null +++ b/generated/groundlight_openapi_client/models/rule_action.py @@ -0,0 +1,156 @@ +# coding: utf-8 + +""" + Groundlight API + + Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. + + The version of the OpenAPI document: 0.18.2 + Contact: support@groundlight.ai + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +import pprint +from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator +from typing import Any, List, Optional +from groundlight_openapi_client.models.action import Action +from pydantic import StrictStr, Field +from typing import Union, List, Set, Optional, Dict +from typing_extensions import Literal, Self + +RULEACTION_ONE_OF_SCHEMAS = ["Action", "List[Action]"] + + +class RuleAction(BaseModel): + """ + RuleAction + """ + + # data type: Action + oneof_schema_1_validator: Optional[Action] = None + # data type: List[Action] + oneof_schema_2_validator: Optional[List[Action]] = None + actual_instance: Optional[Union[Action, List[Action]]] = None + one_of_schemas: Set[str] = {"Action", "List[Action]"} + + model_config = ConfigDict( + validate_assignment=True, + protected_namespaces=(), + ) + + def __init__(self, *args, **kwargs) -> None: + if args: + if len(args) > 1: + raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") + if kwargs: + raise ValueError("If a position argument is used, keyword arguments cannot be used.") + super().__init__(actual_instance=args[0]) + else: + super().__init__(**kwargs) + + @field_validator("actual_instance") + def actual_instance_must_validate_oneof(cls, v): + instance = RuleAction.model_construct() + error_messages = [] + match = 0 + # validate data type: Action + if not isinstance(v, Action): + error_messages.append(f"Error! Input type `{type(v)}` is not `Action`") + else: + match += 1 + # validate data type: List[Action] + try: + instance.oneof_schema_2_validator = v + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + if match > 1: + # more than 1 match + raise ValueError( + "Multiple matches found when setting `actual_instance` in RuleAction with oneOf schemas: Action," + " List[Action]. Details: " + + ", ".join(error_messages) + ) + elif match == 0: + # no match + raise ValueError( + "No match found when setting `actual_instance` in RuleAction with oneOf schemas: Action, List[Action]." + " Details: " + + ", ".join(error_messages) + ) + else: + return v + + @classmethod + def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self: + return cls.from_json(json.dumps(obj)) + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Returns the object represented by the json string""" + instance = cls.model_construct() + error_messages = [] + match = 0 + + # deserialize data into Action + try: + instance.actual_instance = Action.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into List[Action] + try: + # validation + instance.oneof_schema_2_validator = json.loads(json_str) + # assign value to actual_instance + instance.actual_instance = instance.oneof_schema_2_validator + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + + if match > 1: + # more than 1 match + raise ValueError( + "Multiple matches found when deserializing the JSON string into RuleAction with oneOf schemas: Action," + " List[Action]. Details: " + + ", ".join(error_messages) + ) + elif match == 0: + # no match + raise ValueError( + "No match found when deserializing the JSON string into RuleAction with oneOf schemas: Action," + " List[Action]. Details: " + + ", ".join(error_messages) + ) + else: + return instance + + def to_json(self) -> str: + """Returns the JSON representation of the actual instance""" + if self.actual_instance is None: + return "null" + + if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): + return self.actual_instance.to_json() + else: + return json.dumps(self.actual_instance) + + def to_dict(self) -> Optional[Union[Dict[str, Any], Action, List[Action]]]: + """Returns the dict representation of the actual instance""" + if self.actual_instance is None: + return None + + if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): + return self.actual_instance.to_dict() + else: + # primitive type + return self.actual_instance + + def to_str(self) -> str: + """Returns the string representation of the actual instance""" + return pprint.pformat(self.model_dump()) diff --git a/generated/groundlight_openapi_client/models/rule_request.py b/generated/groundlight_openapi_client/models/rule_request.py new file mode 100644 index 00000000..f26b578b --- /dev/null +++ b/generated/groundlight_openapi_client/models/rule_request.py @@ -0,0 +1,138 @@ +# coding: utf-8 + +""" + Groundlight API + + Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. + + The version of the OpenAPI document: 0.18.2 + Contact: support@groundlight.ai + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBool +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from groundlight_openapi_client.models.condition_request import ConditionRequest +from groundlight_openapi_client.models.rule_action import RuleAction +from groundlight_openapi_client.models.snooze_time_unit_enum import SnoozeTimeUnitEnum +from groundlight_openapi_client.models.webhook_action_request import WebhookActionRequest +from typing import Optional, Set +from typing_extensions import Self + + +class RuleRequest(BaseModel): + """ + RuleRequest + """ # noqa: E501 + + name: Annotated[str, Field(min_length=1, strict=True, max_length=44)] + enabled: Optional[StrictBool] = True + snooze_time_enabled: Optional[StrictBool] = False + snooze_time_value: Optional[Annotated[int, Field(strict=True, ge=0)]] = 0 + snooze_time_unit: Optional[SnoozeTimeUnitEnum] = None + human_review_required: Optional[StrictBool] = False + condition: ConditionRequest + action: Optional[RuleAction] = None + webhook_action: Optional[List[WebhookActionRequest]] = None + __properties: ClassVar[List[str]] = [ + "name", + "enabled", + "snooze_time_enabled", + "snooze_time_value", + "snooze_time_unit", + "human_review_required", + "condition", + "action", + "webhook_action", + ] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RuleRequest from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of condition + if self.condition: + _dict["condition"] = self.condition.to_dict() + # override the default output from pydantic by calling `to_dict()` of action + if self.action: + _dict["action"] = self.action.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in webhook_action (list) + _items = [] + if self.webhook_action: + for _item_webhook_action in self.webhook_action: + if _item_webhook_action: + _items.append(_item_webhook_action.to_dict()) + _dict["webhook_action"] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RuleRequest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "name": obj.get("name"), + "enabled": obj.get("enabled") if obj.get("enabled") is not None else True, + "snooze_time_enabled": ( + obj.get("snooze_time_enabled") if obj.get("snooze_time_enabled") is not None else False + ), + "snooze_time_value": obj.get("snooze_time_value") if obj.get("snooze_time_value") is not None else 0, + "snooze_time_unit": obj.get("snooze_time_unit"), + "human_review_required": ( + obj.get("human_review_required") if obj.get("human_review_required") is not None else False + ), + "condition": ConditionRequest.from_dict(obj["condition"]) if obj.get("condition") is not None else None, + "action": RuleAction.from_dict(obj["action"]) if obj.get("action") is not None else None, + "webhook_action": ( + [WebhookActionRequest.from_dict(_item) for _item in obj["webhook_action"]] + if obj.get("webhook_action") is not None + else None + ), + }) + return _obj diff --git a/generated/groundlight_openapi_client/models/snooze_time_unit_enum.py b/generated/groundlight_openapi_client/models/snooze_time_unit_enum.py new file mode 100644 index 00000000..43862b38 --- /dev/null +++ b/generated/groundlight_openapi_client/models/snooze_time_unit_enum.py @@ -0,0 +1,38 @@ +# coding: utf-8 + +""" + Groundlight API + + Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. + + The version of the OpenAPI document: 0.18.2 + Contact: support@groundlight.ai + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class SnoozeTimeUnitEnum(str, Enum): + """ + * `DAYS` - DAYS * `HOURS` - HOURS * `MINUTES` - MINUTES * `SECONDS` - SECONDS + """ + + """ + allowed enum values + """ + DAYS = "DAYS" + HOURS = "HOURS" + MINUTES = "MINUTES" + SECONDS = "SECONDS" + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of SnoozeTimeUnitEnum from a JSON string""" + return cls(json.loads(json_str)) diff --git a/generated/groundlight_openapi_client/models/source.py b/generated/groundlight_openapi_client/models/source.py new file mode 100644 index 00000000..04dd4019 --- /dev/null +++ b/generated/groundlight_openapi_client/models/source.py @@ -0,0 +1,43 @@ +# coding: utf-8 + +""" + Groundlight API + + Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. + + The version of the OpenAPI document: 0.18.2 + Contact: support@groundlight.ai + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class Source(str, Enum): + """ + Source + """ + + """ + allowed enum values + """ + STILL_PROCESSING = "STILL_PROCESSING" + CLOUD = "CLOUD" + USER = "USER" + CLOUD_ENSEMBLE = "CLOUD_ENSEMBLE" + ALGORITHM = "ALGORITHM" + AI_CLOUD = "AI_CLOUD" + AI_CLOUD_ENSEMBLE = "AI_CLOUD_ENSEMBLE" + HUMAN_AI_CLOUD_ENSEMBLE = "HUMAN_AI_CLOUD_ENSEMBLE" + EDGE = "EDGE" + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of Source from a JSON string""" + return cls(json.loads(json_str)) diff --git a/generated/groundlight_openapi_client/models/source_enum.py b/generated/groundlight_openapi_client/models/source_enum.py new file mode 100644 index 00000000..b4776ad6 --- /dev/null +++ b/generated/groundlight_openapi_client/models/source_enum.py @@ -0,0 +1,45 @@ +# coding: utf-8 + +""" + Groundlight API + + Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. + + The version of the OpenAPI document: 0.18.2 + Contact: support@groundlight.ai + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class SourceEnum(str, Enum): + """ + SourceEnum + """ + + """ + allowed enum values + """ + INITIAL_PLACEHOLDER = "INITIAL_PLACEHOLDER" + CLOUD = "CLOUD" + CUST = "CUST" + HUMAN_CLOUD_ENSEMBLE = "HUMAN_CLOUD_ENSEMBLE" + AI_CLOUD = "AI_CLOUD" + AI_CLOUD_ENSEMBLE = "AI_CLOUD_ENSEMBLE" + HUMAN_AI_CLOUD_ENSEMBLE = "HUMAN_AI_CLOUD_ENSEMBLE" + ALG = "ALG" + ALG_REC = "ALG_REC" + ALG_UNCLEAR = "ALG_UNCLEAR" + EDGE = "EDGE" + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of SourceEnum from a JSON string""" + return cls(json.loads(json_str)) diff --git a/generated/groundlight_openapi_client/models/status_enum.py b/generated/groundlight_openapi_client/models/status_enum.py new file mode 100644 index 00000000..0d836fd9 --- /dev/null +++ b/generated/groundlight_openapi_client/models/status_enum.py @@ -0,0 +1,36 @@ +# coding: utf-8 + +""" + Groundlight API + + Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. + + The version of the OpenAPI document: 0.18.2 + Contact: support@groundlight.ai + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class StatusEnum(str, Enum): + """ + * `ON` - ON * `OFF` - OFF + """ + + """ + allowed enum values + """ + ON = "ON" + OFF = "OFF" + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of StatusEnum from a JSON string""" + return cls(json.loads(json_str)) diff --git a/generated/groundlight_openapi_client/models/text_mode_configuration.py b/generated/groundlight_openapi_client/models/text_mode_configuration.py new file mode 100644 index 00000000..cad167ff --- /dev/null +++ b/generated/groundlight_openapi_client/models/text_mode_configuration.py @@ -0,0 +1,85 @@ +# coding: utf-8 + +""" + Groundlight API + + Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. + + The version of the OpenAPI document: 0.18.2 + Contact: support@groundlight.ai + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from typing import Optional, Set +from typing_extensions import Self + + +class TextModeConfiguration(BaseModel): + """ + TextModeConfiguration + """ # noqa: E501 + + value_max_length: Optional[Annotated[int, Field(le=250, strict=True, ge=1)]] = None + __properties: ClassVar[List[str]] = ["value_max_length"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of TextModeConfiguration from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of TextModeConfiguration from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({"value_max_length": obj.get("value_max_length")}) + return _obj diff --git a/generated/groundlight_openapi_client/models/text_recognition_result.py b/generated/groundlight_openapi_client/models/text_recognition_result.py new file mode 100644 index 00000000..1b737e92 --- /dev/null +++ b/generated/groundlight_openapi_client/models/text_recognition_result.py @@ -0,0 +1,119 @@ +# coding: utf-8 + +""" + Groundlight API + + Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. + + The version of the OpenAPI document: 0.18.2 + Contact: support@groundlight.ai + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional, Union +from typing_extensions import Annotated +from typing import Optional, Set +from typing_extensions import Self + + +class TextRecognitionResult(BaseModel): + """ + TextRecognitionResult + """ # noqa: E501 + + confidence: Optional[ + Union[Annotated[float, Field(le=1.0, strict=True, ge=0.0)], Annotated[int, Field(le=1, strict=True, ge=0)]] + ] = None + source: Optional[StrictStr] = None + result_type: Optional[StrictStr] = None + from_edge: Optional[StrictBool] = None + text: Optional[StrictStr] + truncated: StrictBool + __properties: ClassVar[List[str]] = ["confidence", "source", "result_type", "from_edge", "text", "truncated"] + + @field_validator("result_type") + def result_type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(["text_recognition"]): + raise ValueError("must be one of enum values ('text_recognition')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of TextRecognitionResult from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # set to None if confidence (nullable) is None + # and model_fields_set contains the field + if self.confidence is None and "confidence" in self.model_fields_set: + _dict["confidence"] = None + + # set to None if text (nullable) is None + # and model_fields_set contains the field + if self.text is None and "text" in self.model_fields_set: + _dict["text"] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of TextRecognitionResult from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "confidence": obj.get("confidence"), + "source": obj.get("source"), + "result_type": obj.get("result_type"), + "from_edge": obj.get("from_edge"), + "text": obj.get("text"), + "truncated": obj.get("truncated"), + }) + return _obj diff --git a/generated/groundlight_openapi_client/models/verb_enum.py b/generated/groundlight_openapi_client/models/verb_enum.py new file mode 100644 index 00000000..8a80a21d --- /dev/null +++ b/generated/groundlight_openapi_client/models/verb_enum.py @@ -0,0 +1,39 @@ +# coding: utf-8 + +""" + Groundlight API + + Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. + + The version of the OpenAPI document: 0.18.2 + Contact: support@groundlight.ai + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class VerbEnum(str, Enum): + """ + VerbEnum + """ + + """ + allowed enum values + """ + ANSWERED_CONSECUTIVELY = "ANSWERED_CONSECUTIVELY" + ANSWERED_WITHIN_TIME = "ANSWERED_WITHIN_TIME" + CHANGED_TO = "CHANGED_TO" + NO_CHANGE = "NO_CHANGE" + NO_QUERIES = "NO_QUERIES" + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of VerbEnum from a JSON string""" + return cls(json.loads(json_str)) diff --git a/generated/groundlight_openapi_client/models/webhook_action.py b/generated/groundlight_openapi_client/models/webhook_action.py new file mode 100644 index 00000000..da8dc229 --- /dev/null +++ b/generated/groundlight_openapi_client/models/webhook_action.py @@ -0,0 +1,126 @@ +# coding: utf-8 + +""" + Groundlight API + + Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. + + The version of the OpenAPI document: 0.18.2 + Contact: support@groundlight.ai + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from datetime import datetime +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from groundlight_openapi_client.models.payload_template import PayloadTemplate +from typing import Optional, Set +from typing_extensions import Self + + +class WebhookAction(BaseModel): + """ + WebhookAction + """ # noqa: E501 + + url: Annotated[str, Field(strict=True, max_length=200)] + include_image: Optional[StrictBool] = None + payload_template: Optional[PayloadTemplate] = None + last_message_failed: Optional[StrictBool] = None + last_failure_error: Optional[StrictStr] = None + last_failed_at: Optional[datetime] = None + __properties: ClassVar[List[str]] = [ + "url", + "include_image", + "payload_template", + "last_message_failed", + "last_failure_error", + "last_failed_at", + ] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of WebhookAction from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of payload_template + if self.payload_template: + _dict["payload_template"] = self.payload_template.to_dict() + # set to None if payload_template (nullable) is None + # and model_fields_set contains the field + if self.payload_template is None and "payload_template" in self.model_fields_set: + _dict["payload_template"] = None + + # set to None if last_failure_error (nullable) is None + # and model_fields_set contains the field + if self.last_failure_error is None and "last_failure_error" in self.model_fields_set: + _dict["last_failure_error"] = None + + # set to None if last_failed_at (nullable) is None + # and model_fields_set contains the field + if self.last_failed_at is None and "last_failed_at" in self.model_fields_set: + _dict["last_failed_at"] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of WebhookAction from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "url": obj.get("url"), + "include_image": obj.get("include_image"), + "payload_template": ( + PayloadTemplate.from_dict(obj["payload_template"]) if obj.get("payload_template") is not None else None + ), + "last_message_failed": obj.get("last_message_failed"), + "last_failure_error": obj.get("last_failure_error"), + "last_failed_at": obj.get("last_failed_at"), + }) + return _obj diff --git a/generated/groundlight_openapi_client/models/webhook_action_request.py b/generated/groundlight_openapi_client/models/webhook_action_request.py new file mode 100644 index 00000000..2feb906d --- /dev/null +++ b/generated/groundlight_openapi_client/models/webhook_action_request.py @@ -0,0 +1,128 @@ +# coding: utf-8 + +""" + Groundlight API + + Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. + + The version of the OpenAPI document: 0.18.2 + Contact: support@groundlight.ai + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from datetime import datetime +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from groundlight_openapi_client.models.payload_template_request import PayloadTemplateRequest +from typing import Optional, Set +from typing_extensions import Self + + +class WebhookActionRequest(BaseModel): + """ + WebhookActionRequest + """ # noqa: E501 + + url: Annotated[str, Field(min_length=1, strict=True, max_length=200)] + include_image: Optional[StrictBool] = None + payload_template: Optional[PayloadTemplateRequest] = None + last_message_failed: Optional[StrictBool] = None + last_failure_error: Optional[StrictStr] = None + last_failed_at: Optional[datetime] = None + __properties: ClassVar[List[str]] = [ + "url", + "include_image", + "payload_template", + "last_message_failed", + "last_failure_error", + "last_failed_at", + ] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of WebhookActionRequest from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of payload_template + if self.payload_template: + _dict["payload_template"] = self.payload_template.to_dict() + # set to None if payload_template (nullable) is None + # and model_fields_set contains the field + if self.payload_template is None and "payload_template" in self.model_fields_set: + _dict["payload_template"] = None + + # set to None if last_failure_error (nullable) is None + # and model_fields_set contains the field + if self.last_failure_error is None and "last_failure_error" in self.model_fields_set: + _dict["last_failure_error"] = None + + # set to None if last_failed_at (nullable) is None + # and model_fields_set contains the field + if self.last_failed_at is None and "last_failed_at" in self.model_fields_set: + _dict["last_failed_at"] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of WebhookActionRequest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "url": obj.get("url"), + "include_image": obj.get("include_image"), + "payload_template": ( + PayloadTemplateRequest.from_dict(obj["payload_template"]) + if obj.get("payload_template") is not None + else None + ), + "last_message_failed": obj.get("last_message_failed"), + "last_failure_error": obj.get("last_failure_error"), + "last_failed_at": obj.get("last_failed_at"), + }) + return _obj diff --git a/generated/groundlight_openapi_client/models/who_am_i200_response.py b/generated/groundlight_openapi_client/models/who_am_i200_response.py new file mode 100644 index 00000000..983b1efc --- /dev/null +++ b/generated/groundlight_openapi_client/models/who_am_i200_response.py @@ -0,0 +1,84 @@ +# coding: utf-8 + +""" + Groundlight API + + Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. + + The version of the OpenAPI document: 0.18.2 + Contact: support@groundlight.ai + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + + +class WhoAmI200Response(BaseModel): + """ + WhoAmI200Response + """ # noqa: E501 + + username: Optional[StrictStr] = Field(default=None, description="The user's username") + __properties: ClassVar[List[str]] = ["username"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of WhoAmI200Response from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of WhoAmI200Response from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({"username": obj.get("username")}) + return _obj diff --git a/generated/groundlight_openapi_client/py.typed b/generated/groundlight_openapi_client/py.typed new file mode 100644 index 00000000..e69de29b diff --git a/generated/groundlight_openapi_client/rest.py b/generated/groundlight_openapi_client/rest.py index 16d8ca86..01c1ab42 100644 --- a/generated/groundlight_openapi_client/rest.py +++ b/generated/groundlight_openapi_client/rest.py @@ -1,59 +1,72 @@ +# coding: utf-8 + """ Groundlight API - Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. # noqa: E501 + Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. The version of the OpenAPI document: 0.18.2 Contact: support@groundlight.ai - Generated by: https://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + import io import json -import logging import re import ssl -from urllib.parse import urlencode -from urllib.parse import urlparse -from urllib.request import proxy_bypass_environment + import urllib3 -import ipaddress -from groundlight_openapi_client.exceptions import ( - ApiException, - UnauthorizedException, - ForbiddenException, - NotFoundException, - ServiceException, - ApiValueError, -) +from groundlight_openapi_client.exceptions import ApiException, ApiValueError +SUPPORTED_SOCKS_PROXIES = {"socks5", "socks5h", "socks4", "socks4a"} +RESTResponseType = urllib3.HTTPResponse -logger = logging.getLogger(__name__) + +def is_socks_proxy_url(url): + if url is None: + return False + split_section = url.split("://") + if len(split_section) < 2: + return False + else: + return split_section[0].lower() in SUPPORTED_SOCKS_PROXIES class RESTResponse(io.IOBase): - def __init__(self, resp): - self.urllib3_response = resp + def __init__(self, resp) -> None: + self.response = resp self.status = resp.status self.reason = resp.reason - self.data = resp.data + self.data = None + + def read(self): + if self.data is None: + self.data = self.response.data + return self.data + + @property + def headers(self): + """Returns a dictionary of response headers.""" + return self.response.headers def getheaders(self): - """Returns a dictionary of the response headers.""" - return self.urllib3_response.getheaders() + """Returns a dictionary of the response headers; use ``headers`` instead.""" + return self.response.headers def getheader(self, name, default=None): - """Returns a given response header.""" - return self.urllib3_response.getheader(name, default) + """Returns a given response header; use ``headers.get()`` instead.""" + return self.response.headers.get(name, default) -class RESTClientObject(object): - def __init__(self, configuration, pools_size=4, maxsize=None): +class RESTClientObject: + def __init__(self, configuration) -> None: # urllib3.PoolManager will pass all kw parameters to connectionpool # https://github.com/shazow/urllib3/blob/f9409436f83aeb79fbaf090181cd81b784f1b8ce/urllib3/poolmanager.py#L75 # noqa: E501 # https://github.com/shazow/urllib3/blob/f9409436f83aeb79fbaf090181cd81b784f1b8ce/urllib3/connectionpool.py#L680 # noqa: E501 - # maxsize is the number of requests to host that are allowed in parallel # noqa: E501 # Custom SSL certificates and client certificates: http://urllib3.readthedocs.io/en/latest/advanced-usage.html # noqa: E501 # cert_reqs @@ -62,70 +75,55 @@ def __init__(self, configuration, pools_size=4, maxsize=None): else: cert_reqs = ssl.CERT_NONE - addition_pool_args = {} + pool_args = { + "cert_reqs": cert_reqs, + "ca_certs": configuration.ssl_ca_cert, + "cert_file": configuration.cert_file, + "key_file": configuration.key_file, + "ca_cert_data": configuration.ca_cert_data, + } if configuration.assert_hostname is not None: - addition_pool_args["assert_hostname"] = configuration.assert_hostname # noqa: E501 + pool_args["assert_hostname"] = configuration.assert_hostname if configuration.retries is not None: - addition_pool_args["retries"] = configuration.retries + pool_args["retries"] = configuration.retries + + if configuration.tls_server_name: + pool_args["server_hostname"] = configuration.tls_server_name if configuration.socket_options is not None: - addition_pool_args["socket_options"] = configuration.socket_options + pool_args["socket_options"] = configuration.socket_options - if maxsize is None: - if configuration.connection_pool_maxsize is not None: - maxsize = configuration.connection_pool_maxsize - else: - maxsize = 4 + if configuration.connection_pool_maxsize is not None: + pool_args["maxsize"] = configuration.connection_pool_maxsize # https pool manager - if configuration.proxy and not should_bypass_proxies(configuration.host, no_proxy=configuration.no_proxy or ""): - self.pool_manager = urllib3.ProxyManager( - num_pools=pools_size, - maxsize=maxsize, - cert_reqs=cert_reqs, - ca_certs=configuration.ssl_ca_cert, - cert_file=configuration.cert_file, - key_file=configuration.key_file, - proxy_url=configuration.proxy, - proxy_headers=configuration.proxy_headers, - **addition_pool_args, - ) + self.pool_manager: urllib3.PoolManager + + if configuration.proxy: + if is_socks_proxy_url(configuration.proxy): + from urllib3.contrib.socks import SOCKSProxyManager + + pool_args["proxy_url"] = configuration.proxy + pool_args["headers"] = configuration.proxy_headers + self.pool_manager = SOCKSProxyManager(**pool_args) + else: + pool_args["proxy_url"] = configuration.proxy + pool_args["proxy_headers"] = configuration.proxy_headers + self.pool_manager = urllib3.ProxyManager(**pool_args) else: - self.pool_manager = urllib3.PoolManager( - num_pools=pools_size, - maxsize=maxsize, - cert_reqs=cert_reqs, - ca_certs=configuration.ssl_ca_cert, - cert_file=configuration.cert_file, - key_file=configuration.key_file, - **addition_pool_args, - ) - - def request( - self, - method, - url, - query_params=None, - headers=None, - body=None, - post_params=None, - _preload_content=True, - _request_timeout=None, - ): + self.pool_manager = urllib3.PoolManager(**pool_args) + + def request(self, method, url, headers=None, body=None, post_params=None, _request_timeout=None): """Perform requests. :param method: http request method :param url: http request url - :param query_params: query parameters in the url :param headers: http request headers :param body: request json body, for `application/json` :param post_params: request post parameters, `application/x-www-form-urlencoded` and `multipart/form-data` - :param _preload_content: if False, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -142,7 +140,7 @@ def request( timeout = None if _request_timeout: - if isinstance(_request_timeout, (int, float)): # noqa: E501,F821 + if isinstance(_request_timeout, (int, float)): timeout = urllib3.Timeout(total=_request_timeout) elif isinstance(_request_timeout, tuple) and len(_request_timeout) == 2: timeout = urllib3.Timeout(connect=_request_timeout[0], read=_request_timeout[1]) @@ -150,59 +148,53 @@ def request( try: # For `POST`, `PUT`, `PATCH`, `OPTIONS`, `DELETE` if method in ["POST", "PUT", "PATCH", "OPTIONS", "DELETE"]: - # Only set a default Content-Type for POST, PUT, PATCH and OPTIONS requests - if (method != "DELETE") and ("Content-Type" not in headers): - headers["Content-Type"] = "application/json" - if query_params: - url += "?" + urlencode(query_params) - if ("Content-Type" not in headers) or (re.search("json", headers["Content-Type"], re.IGNORECASE)): + + # no content type provided or payload is json + content_type = headers.get("Content-Type") + if not content_type or re.search("json", content_type, re.IGNORECASE): request_body = None if body is not None: request_body = json.dumps(body) r = self.pool_manager.request( - method, - url, - body=request_body, - preload_content=_preload_content, - timeout=timeout, - headers=headers, + method, url, body=request_body, timeout=timeout, headers=headers, preload_content=False ) - elif headers["Content-Type"] == "application/x-www-form-urlencoded": # noqa: E501 + elif content_type == "application/x-www-form-urlencoded": r = self.pool_manager.request( method, url, fields=post_params, encode_multipart=False, - preload_content=_preload_content, timeout=timeout, headers=headers, + preload_content=False, ) - elif headers["Content-Type"] == "multipart/form-data": + elif content_type == "multipart/form-data": # must del headers['Content-Type'], or the correct # Content-Type which generated by urllib3 will be # overwritten. del headers["Content-Type"] + # Ensures that dict objects are serialized + post_params = [(a, json.dumps(b)) if isinstance(b, dict) else (a, b) for a, b in post_params] r = self.pool_manager.request( method, url, fields=post_params, encode_multipart=True, - preload_content=_preload_content, timeout=timeout, headers=headers, + preload_content=False, ) # Pass a `string` parameter directly in the body to support - # other content types than Json when `body` argument is - # provided in serialized form + # other content types than JSON when `body` argument is + # provided in serialized form. elif isinstance(body, str) or isinstance(body, bytes): - request_body = body r = self.pool_manager.request( - method, - url, - body=request_body, - preload_content=_preload_content, - timeout=timeout, - headers=headers, + method, url, body=body, timeout=timeout, headers=headers, preload_content=False + ) + elif headers["Content-Type"].startswith("text/") and isinstance(body, bool): + request_body = "true" if body else "false" + r = self.pool_manager.request( + method, url, body=request_body, preload_content=False, timeout=timeout, headers=headers ) else: # Cannot generate the request from given parameters @@ -213,197 +205,10 @@ def request( # For `GET`, `HEAD` else: r = self.pool_manager.request( - method, url, fields=query_params, preload_content=_preload_content, timeout=timeout, headers=headers + method, url, fields={}, timeout=timeout, headers=headers, preload_content=False ) except urllib3.exceptions.SSLError as e: - msg = "{0}\n{1}".format(type(e).__name__, str(e)) + msg = "\n".join([type(e).__name__, str(e)]) raise ApiException(status=0, reason=msg) - if _preload_content: - r = RESTResponse(r) - - # log response body - logger.debug("response body: %s", r.data) - - if not 200 <= r.status <= 299: - if r.status == 401: - raise UnauthorizedException(http_resp=r) - - if r.status == 403: - raise ForbiddenException(http_resp=r) - - if r.status == 404: - raise NotFoundException(http_resp=r) - - if 500 <= r.status <= 599: - raise ServiceException(http_resp=r) - - raise ApiException(http_resp=r) - - return r - - def GET(self, url, headers=None, query_params=None, _preload_content=True, _request_timeout=None): - return self.request( - "GET", - url, - headers=headers, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - query_params=query_params, - ) - - def HEAD(self, url, headers=None, query_params=None, _preload_content=True, _request_timeout=None): - return self.request( - "HEAD", - url, - headers=headers, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - query_params=query_params, - ) - - def OPTIONS( - self, - url, - headers=None, - query_params=None, - post_params=None, - body=None, - _preload_content=True, - _request_timeout=None, - ): - return self.request( - "OPTIONS", - url, - headers=headers, - query_params=query_params, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body, - ) - - def DELETE(self, url, headers=None, query_params=None, body=None, _preload_content=True, _request_timeout=None): - return self.request( - "DELETE", - url, - headers=headers, - query_params=query_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body, - ) - - def POST( - self, - url, - headers=None, - query_params=None, - post_params=None, - body=None, - _preload_content=True, - _request_timeout=None, - ): - return self.request( - "POST", - url, - headers=headers, - query_params=query_params, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body, - ) - - def PUT( - self, - url, - headers=None, - query_params=None, - post_params=None, - body=None, - _preload_content=True, - _request_timeout=None, - ): - return self.request( - "PUT", - url, - headers=headers, - query_params=query_params, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body, - ) - - def PATCH( - self, - url, - headers=None, - query_params=None, - post_params=None, - body=None, - _preload_content=True, - _request_timeout=None, - ): - return self.request( - "PATCH", - url, - headers=headers, - query_params=query_params, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body, - ) - - -# end of class RESTClientObject -def is_ipv4(target): - """Test if IPv4 address or not""" - try: - chk = ipaddress.IPv4Address(target) - return True - except ipaddress.AddressValueError: - return False - - -def in_ipv4net(target, net): - """Test if target belongs to given IPv4 network""" - try: - nw = ipaddress.IPv4Network(net) - ip = ipaddress.IPv4Address(target) - if ip in nw: - return True - return False - except ipaddress.AddressValueError: - return False - except ipaddress.NetmaskValueError: - return False - - -def should_bypass_proxies(url, no_proxy=None): - """Yet another requests.should_bypass_proxies - Test if proxies should not be used for a particular url. - """ - - parsed = urlparse(url) - - # special cases - if parsed.hostname in [None, ""]: - return True - - # special cases - if no_proxy in [None, ""]: - return False - if no_proxy == "*": - return True - - no_proxy = no_proxy.lower().replace(" ", "") - entries = (host for host in no_proxy.split(",") if host) - - if is_ipv4(parsed.hostname): - for item in entries: - if in_ipv4net(parsed.hostname, item): - return True - return proxy_bypass_environment(parsed.hostname, {"no": no_proxy}) + return RESTResponse(r) diff --git a/generated/model.py b/generated/model.py index 7b3636f5..37f0e732 100644 --- a/generated/model.py +++ b/generated/model.py @@ -1,6 +1,6 @@ # generated by datamodel-codegen: # filename: public-api.yaml -# timestamp: 2026-01-13T18:34:24+00:00 +# timestamp: 2026-02-05T01:25:08+00:00 from __future__ import annotations @@ -19,12 +19,16 @@ class AccountMonthToDateInfo(BaseModel): iqs: int = Field(..., description="The number of image queries in the current month.") escalations: int = Field(..., description="The number of escalations in the current month.") active_detectors: int = Field(..., description="The number of active detectors in the current month.") - iqs_limit: Optional[int] = Field(..., description="The limit on the number of image queries in the current month.") + iqs_limit: Optional[int] = Field( + ..., + description="The limit on the number of image queries in the current month.", + ) escalations_limit: Optional[int] = Field( ..., description="The limit on the number of escalations in the current month." ) active_detectors_limit: Optional[int] = Field( - ..., description="The limit on the number of active detectors in the current month." + ..., + description="The limit on the number of active detectors in the current month.", ) @@ -381,7 +385,8 @@ class Detector(BaseModel): ), ) patience_time: confloat(ge=0.0, le=3600.0) = Field( - 30.0, description="How long Groundlight will attempt to generate a confident prediction" + 30.0, + description="How long Groundlight will attempt to generate a confident prediction", ) metadata: Optional[Dict[str, Any]] = Field(..., description="Metadata about the detector.") mode: str @@ -407,10 +412,12 @@ class DetectorCreationInputRequest(BaseModel): ), ) patience_time: confloat(ge=0.0, le=3600.0) = Field( - 30.0, description="How long Groundlight will attempt to generate a confident prediction" + 30.0, + description="How long Groundlight will attempt to generate a confident prediction", ) pipeline_config: Optional[constr(max_length=100)] = Field( - None, description="(Advanced usage) Configuration needed to instantiate a prediction pipeline." + None, + description="(Advanced usage) Configuration needed to instantiate a prediction pipeline.", ) metadata: Optional[constr(min_length=1, max_length=1362)] = Field( None, @@ -427,7 +434,12 @@ class DetectorCreationInputRequest(BaseModel): ), ) mode_configuration: Optional[ - Union[CountModeConfiguration, MultiClassModeConfiguration, TextModeConfiguration, BoundingBoxModeConfiguration] + Union[ + CountModeConfiguration, + MultiClassModeConfiguration, + TextModeConfiguration, + BoundingBoxModeConfiguration, + ] ] = None @@ -454,10 +466,12 @@ class ImageQuery(BaseModel): ] = Field(...) patience_time: float = Field(..., description="How long to wait for a confident response.") confidence_threshold: float = Field( - ..., description="Min confidence needed to accept the response of the image query." + ..., + description="Min confidence needed to accept the response of the image query.", ) rois: Optional[List[ROI]] = Field( - ..., description="An array of regions of interest (bounding boxes) collected on image" + ..., + description="An array of regions of interest (bounding boxes) collected on image", ) text: Optional[str] = Field(..., description="A text field on image query.") done_processing: bool = Field( @@ -469,7 +483,8 @@ class ImageQuery(BaseModel): class LabelValue(BaseModel): confidence: Optional[float] = Field(...) class_name: Optional[str] = Field( - ..., description="Return a human-readable class name for this label (e.g. YES/NO)" + ..., + description="Return a human-readable class name for this label (e.g. YES/NO)", ) rois: Optional[List[ROI]] = None annotations_requested: List[str] @@ -518,7 +533,8 @@ class PatchedDetectorRequest(BaseModel): ), ) patience_time: confloat(ge=0.0, le=3600.0) = Field( - 30.0, description="How long Groundlight will attempt to generate a confident prediction" + 30.0, + description="How long Groundlight will attempt to generate a confident prediction", ) status: Optional[Union[StatusEnum, BlankEnum]] = None escalation_type: Optional[constr(min_length=1)] = None diff --git a/generated/pyproject.toml b/generated/pyproject.toml new file mode 100644 index 00000000..c8839de5 --- /dev/null +++ b/generated/pyproject.toml @@ -0,0 +1,94 @@ +[project] +name = "groundlight_openapi_client" +version = "1.0.0" +description = "Groundlight API" +authors = [ + {name = "support@groundlight.ai",email = "support@groundlight.ai"}, +] +readme = "README.md" +keywords = ["OpenAPI", "OpenAPI-Generator", "Groundlight API"] +requires-python = ">=3.9" + +dependencies = [ + "urllib3 (>=2.1.0,<3.0.0)", + "python-dateutil (>=2.8.2)", + "pydantic (>=2)", + "typing-extensions (>=4.7.1)", +] + +[project.urls] +Repository = "https://github.com/GIT_USER_ID/GIT_REPO_ID" + +[tool.poetry] +requires-poetry = ">=2.0" + +[tool.poetry.group.dev.dependencies] +pytest = ">= 7.2.1" +pytest-cov = ">= 2.8.1" +tox = ">= 3.9.0" +flake8 = ">= 4.0.0" +types-python-dateutil = ">= 2.8.19.14" +mypy = ">= 1.5" + + +[build-system] +requires = ["setuptools"] +build-backend = "setuptools.build_meta" + +[tool.pylint.'MESSAGES CONTROL'] +extension-pkg-whitelist = "pydantic" + +[tool.mypy] +files = [ + "groundlight_openapi_client", + #"test", # auto-generated tests + "tests", # hand-written tests +] +# TODO: enable "strict" once all these individual checks are passing +# strict = true + +# List from: https://mypy.readthedocs.io/en/stable/existing_code.html#introduce-stricter-options +warn_unused_configs = true +warn_redundant_casts = true +warn_unused_ignores = true + +## Getting these passing should be easy +strict_equality = true +extra_checks = true + +## Strongly recommend enabling this one as soon as you can +check_untyped_defs = true + +## These shouldn't be too much additional work, but may be tricky to +## get passing if you use a lot of untyped libraries +disallow_subclassing_any = true +disallow_untyped_decorators = true +disallow_any_generics = true + +### These next few are various gradations of forcing use of type annotations +#disallow_untyped_calls = true +#disallow_incomplete_defs = true +#disallow_untyped_defs = true +# +### This one isn't too hard to get passing, but return on investment is lower +#no_implicit_reexport = true +# +### This one can be tricky to get passing if you use a lot of untyped libraries +#warn_return_any = true + +[[tool.mypy.overrides]] +module = [ + "groundlight_openapi_client.configuration", +] +warn_unused_ignores = true +strict_equality = true +extra_checks = true +check_untyped_defs = true +disallow_subclassing_any = true +disallow_untyped_decorators = true +disallow_any_generics = true +disallow_untyped_calls = true +disallow_incomplete_defs = true +disallow_untyped_defs = true +no_implicit_reexport = true +warn_return_any = true diff --git a/generated/requirements.txt b/generated/requirements.txt index 96947f60..6cbb2b98 100644 --- a/generated/requirements.txt +++ b/generated/requirements.txt @@ -1,3 +1,4 @@ -python_dateutil >= 2.5.3 -setuptools >= 21.0.0 -urllib3 >= 1.25.3 +urllib3 >= 2.1.0, < 3.0.0 +python_dateutil >= 2.8.2 +pydantic >= 2 +typing-extensions >= 4.7.1 diff --git a/generated/setup.py b/generated/setup.py index 9c4bb572..bd91e90e 100644 --- a/generated/setup.py +++ b/generated/setup.py @@ -1,27 +1,34 @@ +# coding: utf-8 + """ Groundlight API - Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. # noqa: E501 + Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. The version of the OpenAPI document: 0.18.2 Contact: support@groundlight.ai - Generated by: https://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + from setuptools import setup, find_packages # noqa: H301 -NAME = "groundlight-openapi-client" -VERSION = "1.0.0" # To install the library, run the following # # python setup.py install # # prerequisite: setuptools # http://pypi.python.org/pypi/setuptools - +NAME = "groundlight-openapi-client" +VERSION = "1.0.0" +PYTHON_REQUIRES = ">= 3.9" REQUIRES = [ - "urllib3 >= 1.25.3", - "python-dateutil", + "urllib3 >= 2.1.0, < 3.0.0", + "python-dateutil >= 2.8.2", + "pydantic >= 2", + "typing-extensions >= 4.7.1", ] setup( @@ -32,11 +39,12 @@ author_email="support@groundlight.ai", url="", keywords=["OpenAPI", "OpenAPI-Generator", "Groundlight API"], - python_requires=">=3.6", install_requires=REQUIRES, packages=find_packages(exclude=["test", "tests"]), include_package_data=True, + long_description_content_type="text/markdown", long_description="""\ - Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. # noqa: E501 - """, + Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. + """, # noqa: E501 + package_data={"groundlight_openapi_client": ["py.typed"]}, ) diff --git a/generated/test-requirements.txt b/generated/test-requirements.txt index bb4f22bb..e98555c1 100644 --- a/generated/test-requirements.txt +++ b/generated/test-requirements.txt @@ -1 +1,6 @@ -pytest-cov>=2.8.1 +pytest >= 7.2.1 +pytest-cov >= 2.8.1 +tox >= 3.9.0 +flake8 >= 4.0.0 +types-python-dateutil >= 2.8.19.14 +mypy >= 1.5 diff --git a/generated/test/test_detector_creation_input_request_mode_configuration.py b/generated/test/test_detector_creation_input_request_mode_configuration.py new file mode 100644 index 00000000..e666db4c --- /dev/null +++ b/generated/test/test_detector_creation_input_request_mode_configuration.py @@ -0,0 +1,67 @@ +# coding: utf-8 + +""" + Groundlight API + + Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. + + The version of the OpenAPI document: 0.18.2 + Contact: support@groundlight.ai + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from groundlight_openapi_client.models.detector_creation_input_request_mode_configuration import ( + DetectorCreationInputRequestModeConfiguration, +) + + +class TestDetectorCreationInputRequestModeConfiguration(unittest.TestCase): + """DetectorCreationInputRequestModeConfiguration unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> DetectorCreationInputRequestModeConfiguration: + """Test DetectorCreationInputRequestModeConfiguration + include_optional is a boolean, when False only required + params are included, when True both required and + optional params are included""" + # uncomment below to create an instance of `DetectorCreationInputRequestModeConfiguration` + """ + model = DetectorCreationInputRequestModeConfiguration() + if include_optional: + return DetectorCreationInputRequestModeConfiguration( + max_count = 1, + class_name = '', + class_names = [ + '' + ], + num_classes = 56, + value_max_length = 1, + max_num_bboxes = 1 + ) + else: + return DetectorCreationInputRequestModeConfiguration( + class_name = '', + class_names = [ + '' + ], + ) + """ + + def testDetectorCreationInputRequestModeConfiguration(self): + """Test DetectorCreationInputRequestModeConfiguration""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + + +if __name__ == "__main__": + unittest.main() diff --git a/generated/test/test_get_detector_evaluation200_response.py b/generated/test/test_get_detector_evaluation200_response.py new file mode 100644 index 00000000..4f7345f8 --- /dev/null +++ b/generated/test/test_get_detector_evaluation200_response.py @@ -0,0 +1,73 @@ +# coding: utf-8 + +""" + Groundlight API + + Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. + + The version of the OpenAPI document: 0.18.2 + Contact: support@groundlight.ai + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from groundlight_openapi_client.models.get_detector_evaluation200_response import GetDetectorEvaluation200Response + + +class TestGetDetectorEvaluation200Response(unittest.TestCase): + """GetDetectorEvaluation200Response unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> GetDetectorEvaluation200Response: + """Test GetDetectorEvaluation200Response + include_optional is a boolean, when False only required + params are included, when True both required and + optional params are included""" + # uncomment below to create an instance of `GetDetectorEvaluation200Response` + """ + model = GetDetectorEvaluation200Response() + if include_optional: + return GetDetectorEvaluation200Response( + evaluation_results = groundlight_openapi_client.models.get_detector_evaluation_200_response_evaluation_results.get_detector_evaluation_200_response_evaluation_results( + eval_timestamp = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + total_ground_truth_examples = 56, + total_labeled_examples = 56, + kfold_pooled__balanced_accuracy = 1.337, + kfold_pooled__positive_accuracy = 1.337, + kfold_pooled__negative_accuracy = 1.337, + precision__mean = 1.337, + recall__mean = 1.337, + roc_auc__mean = 1.337, + balanced_system_accuracies = { }, + positive_system_accuracies = { }, + negative_system_accuracies = { }, + mean_absolute_error__mean = 1.337, + objdet_precision__mean = 1.337, + objdet_recall__mean = 1.337, + objdet_f1_score__mean = 1.337, + class_accuracies = { }, + confusion_dict = { }, + num_examples_per_class = { }, ) + ) + else: + return GetDetectorEvaluation200Response( + ) + """ + + def testGetDetectorEvaluation200Response(self): + """Test GetDetectorEvaluation200Response""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + + +if __name__ == "__main__": + unittest.main() diff --git a/generated/test/test_get_detector_evaluation200_response_evaluation_results.py b/generated/test/test_get_detector_evaluation200_response_evaluation_results.py new file mode 100644 index 00000000..c5d5a52e --- /dev/null +++ b/generated/test/test_get_detector_evaluation200_response_evaluation_results.py @@ -0,0 +1,74 @@ +# coding: utf-8 + +""" + Groundlight API + + Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. + + The version of the OpenAPI document: 0.18.2 + Contact: support@groundlight.ai + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from groundlight_openapi_client.models.get_detector_evaluation200_response_evaluation_results import ( + GetDetectorEvaluation200ResponseEvaluationResults, +) + + +class TestGetDetectorEvaluation200ResponseEvaluationResults(unittest.TestCase): + """GetDetectorEvaluation200ResponseEvaluationResults unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> GetDetectorEvaluation200ResponseEvaluationResults: + """Test GetDetectorEvaluation200ResponseEvaluationResults + include_optional is a boolean, when False only required + params are included, when True both required and + optional params are included""" + # uncomment below to create an instance of `GetDetectorEvaluation200ResponseEvaluationResults` + """ + model = GetDetectorEvaluation200ResponseEvaluationResults() + if include_optional: + return GetDetectorEvaluation200ResponseEvaluationResults( + eval_timestamp = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + total_ground_truth_examples = 56, + total_labeled_examples = 56, + kfold_pooled__balanced_accuracy = 1.337, + kfold_pooled__positive_accuracy = 1.337, + kfold_pooled__negative_accuracy = 1.337, + precision__mean = 1.337, + recall__mean = 1.337, + roc_auc__mean = 1.337, + balanced_system_accuracies = { }, + positive_system_accuracies = { }, + negative_system_accuracies = { }, + mean_absolute_error__mean = 1.337, + objdet_precision__mean = 1.337, + objdet_recall__mean = 1.337, + objdet_f1_score__mean = 1.337, + class_accuracies = { }, + confusion_dict = { }, + num_examples_per_class = { } + ) + else: + return GetDetectorEvaluation200ResponseEvaluationResults( + ) + """ + + def testGetDetectorEvaluation200ResponseEvaluationResults(self): + """Test GetDetectorEvaluation200ResponseEvaluationResults""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + + +if __name__ == "__main__": + unittest.main() diff --git a/generated/test/test_get_detector_metrics200_response.py b/generated/test/test_get_detector_metrics200_response.py new file mode 100644 index 00000000..e02e93e3 --- /dev/null +++ b/generated/test/test_get_detector_metrics200_response.py @@ -0,0 +1,64 @@ +# coding: utf-8 + +""" + Groundlight API + + Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. + + The version of the OpenAPI document: 0.18.2 + Contact: support@groundlight.ai + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from groundlight_openapi_client.models.get_detector_metrics200_response import GetDetectorMetrics200Response + + +class TestGetDetectorMetrics200Response(unittest.TestCase): + """GetDetectorMetrics200Response unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> GetDetectorMetrics200Response: + """Test GetDetectorMetrics200Response + include_optional is a boolean, when False only required + params are included, when True both required and + optional params are included""" + # uncomment below to create an instance of `GetDetectorMetrics200Response` + """ + model = GetDetectorMetrics200Response() + if include_optional: + return GetDetectorMetrics200Response( + summary = groundlight_openapi_client.models.get_detector_metrics_200_response_summary.get_detector_metrics_200_response_summary( + num_ground_truth = 56, + num_current_source_human = 56, + class_counts = groundlight_openapi_client.models.get_detector_metrics_200_response_summary_class_counts.get_detector_metrics_200_response_summary_class_counts( + source_ml = groundlight_openapi_client.models.source_ml.source_ml(), + source_human = groundlight_openapi_client.models.source_human.source_human(), + cloud_labeler = groundlight_openapi_client.models.cloud_labeler.cloud_labeler(), + cloud = groundlight_openapi_client.models.cloud.cloud(), + total = groundlight_openapi_client.models.total.total(), ), + unconfident_counts = groundlight_openapi_client.models.unconfident_counts.unconfident_counts(), + total_iqs = 56, ) + ) + else: + return GetDetectorMetrics200Response( + ) + """ + + def testGetDetectorMetrics200Response(self): + """Test GetDetectorMetrics200Response""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + + +if __name__ == "__main__": + unittest.main() diff --git a/generated/test/test_get_detector_metrics200_response_summary.py b/generated/test/test_get_detector_metrics200_response_summary.py new file mode 100644 index 00000000..683ac405 --- /dev/null +++ b/generated/test/test_get_detector_metrics200_response_summary.py @@ -0,0 +1,65 @@ +# coding: utf-8 + +""" + Groundlight API + + Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. + + The version of the OpenAPI document: 0.18.2 + Contact: support@groundlight.ai + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from groundlight_openapi_client.models.get_detector_metrics200_response_summary import ( + GetDetectorMetrics200ResponseSummary, +) + + +class TestGetDetectorMetrics200ResponseSummary(unittest.TestCase): + """GetDetectorMetrics200ResponseSummary unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> GetDetectorMetrics200ResponseSummary: + """Test GetDetectorMetrics200ResponseSummary + include_optional is a boolean, when False only required + params are included, when True both required and + optional params are included""" + # uncomment below to create an instance of `GetDetectorMetrics200ResponseSummary` + """ + model = GetDetectorMetrics200ResponseSummary() + if include_optional: + return GetDetectorMetrics200ResponseSummary( + num_ground_truth = 56, + num_current_source_human = 56, + class_counts = groundlight_openapi_client.models.get_detector_metrics_200_response_summary_class_counts.get_detector_metrics_200_response_summary_class_counts( + source_ml = groundlight_openapi_client.models.source_ml.source_ml(), + source_human = groundlight_openapi_client.models.source_human.source_human(), + cloud_labeler = groundlight_openapi_client.models.cloud_labeler.cloud_labeler(), + cloud = groundlight_openapi_client.models.cloud.cloud(), + total = groundlight_openapi_client.models.total.total(), ), + unconfident_counts = None, + total_iqs = 56 + ) + else: + return GetDetectorMetrics200ResponseSummary( + ) + """ + + def testGetDetectorMetrics200ResponseSummary(self): + """Test GetDetectorMetrics200ResponseSummary""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + + +if __name__ == "__main__": + unittest.main() diff --git a/generated/test/test_get_detector_metrics200_response_summary_class_counts.py b/generated/test/test_get_detector_metrics200_response_summary_class_counts.py new file mode 100644 index 00000000..96f27976 --- /dev/null +++ b/generated/test/test_get_detector_metrics200_response_summary_class_counts.py @@ -0,0 +1,60 @@ +# coding: utf-8 + +""" + Groundlight API + + Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. + + The version of the OpenAPI document: 0.18.2 + Contact: support@groundlight.ai + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from groundlight_openapi_client.models.get_detector_metrics200_response_summary_class_counts import ( + GetDetectorMetrics200ResponseSummaryClassCounts, +) + + +class TestGetDetectorMetrics200ResponseSummaryClassCounts(unittest.TestCase): + """GetDetectorMetrics200ResponseSummaryClassCounts unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> GetDetectorMetrics200ResponseSummaryClassCounts: + """Test GetDetectorMetrics200ResponseSummaryClassCounts + include_optional is a boolean, when False only required + params are included, when True both required and + optional params are included""" + # uncomment below to create an instance of `GetDetectorMetrics200ResponseSummaryClassCounts` + """ + model = GetDetectorMetrics200ResponseSummaryClassCounts() + if include_optional: + return GetDetectorMetrics200ResponseSummaryClassCounts( + source_ml = None, + source_human = None, + cloud_labeler = None, + cloud = None, + total = None + ) + else: + return GetDetectorMetrics200ResponseSummaryClassCounts( + ) + """ + + def testGetDetectorMetrics200ResponseSummaryClassCounts(self): + """Test GetDetectorMetrics200ResponseSummaryClassCounts""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + + +if __name__ == "__main__": + unittest.main() diff --git a/generated/test/test_image_query_result.py b/generated/test/test_image_query_result.py new file mode 100644 index 00000000..bded808f --- /dev/null +++ b/generated/test/test_image_query_result.py @@ -0,0 +1,66 @@ +# coding: utf-8 + +""" + Groundlight API + + Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. + + The version of the OpenAPI document: 0.18.2 + Contact: support@groundlight.ai + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from groundlight_openapi_client.models.image_query_result import ImageQueryResult + + +class TestImageQueryResult(unittest.TestCase): + """ImageQueryResult unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> ImageQueryResult: + """Test ImageQueryResult + include_optional is a boolean, when False only required + params are included, when True both required and + optional params are included""" + # uncomment below to create an instance of `ImageQueryResult` + """ + model = ImageQueryResult() + if include_optional: + return ImageQueryResult( + confidence = 0.0, + source = '', + result_type = 'bounding_box', + from_edge = True, + label = '', + count = 0, + greater_than_max = True, + text = '', + truncated = True + ) + else: + return ImageQueryResult( + label = '', + count = 0, + text = '', + truncated = True, + ) + """ + + def testImageQueryResult(self): + """Test ImageQueryResult""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + + +if __name__ == "__main__": + unittest.main() diff --git a/generated/test/test_rule_action.py b/generated/test/test_rule_action.py new file mode 100644 index 00000000..30484058 --- /dev/null +++ b/generated/test/test_rule_action.py @@ -0,0 +1,59 @@ +# coding: utf-8 + +""" + Groundlight API + + Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. + + The version of the OpenAPI document: 0.18.2 + Contact: support@groundlight.ai + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from groundlight_openapi_client.models.rule_action import RuleAction + + +class TestRuleAction(unittest.TestCase): + """RuleAction unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> RuleAction: + """Test RuleAction + include_optional is a boolean, when False only required + params are included, when True both required and + optional params are included""" + # uncomment below to create an instance of `RuleAction` + """ + model = RuleAction() + if include_optional: + return RuleAction( + channel = 'TEXT', + recipient = '', + include_image = True + ) + else: + return RuleAction( + channel = 'TEXT', + recipient = '', + include_image = True, + ) + """ + + def testRuleAction(self): + """Test RuleAction""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + + +if __name__ == "__main__": + unittest.main() diff --git a/generated/test/test_who_am_i200_response.py b/generated/test/test_who_am_i200_response.py new file mode 100644 index 00000000..3ac7b6e7 --- /dev/null +++ b/generated/test/test_who_am_i200_response.py @@ -0,0 +1,54 @@ +# coding: utf-8 + +""" + Groundlight API + + Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language. + + The version of the OpenAPI document: 0.18.2 + Contact: support@groundlight.ai + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from groundlight_openapi_client.models.who_am_i200_response import WhoAmI200Response + + +class TestWhoAmI200Response(unittest.TestCase): + """WhoAmI200Response unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> WhoAmI200Response: + """Test WhoAmI200Response + include_optional is a boolean, when False only required + params are included, when True both required and + optional params are included""" + # uncomment below to create an instance of `WhoAmI200Response` + """ + model = WhoAmI200Response() + if include_optional: + return WhoAmI200Response( + username = '' + ) + else: + return WhoAmI200Response( + ) + """ + + def testWhoAmI200Response(self): + """Test WhoAmI200Response""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + + +if __name__ == "__main__": + unittest.main() diff --git a/openapitools.json b/openapitools.json index 9cbc6d5d..bd8d09d6 100644 --- a/openapitools.json +++ b/openapitools.json @@ -2,6 +2,6 @@ "$schema": "./node_modules/@openapitools/openapi-generator-cli/config.schema.json", "spaces": 2, "generator-cli": { - "version": "5.4.0" + "version": "7.18.0" } }