Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New api spec #208

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,17 @@ install-dev: ## Only install the dev dependencies
install-pre-commit: install ## Install pre-commit hooks
poetry run pre-commit install

install-generator: install ## Install dependencies for SDK code generator
install-generator: ## Install dependencies for SDK code generator
npm install --save remark-math@6 rehype-katex@7

generate: install-generator ## Generate the SDK from our public openapi spec
openapi_generate: install-generator
node_modules/.bin/openapi-generator-cli generate -i spec/public-api.yaml \
-g python \
-o ./generated \
--additional-properties=packageName=groundlight_openapi_client
poetry run datamodel-codegen --input spec/public-api.yaml --output generated/model.py

generate: openapi_generate install ## Generate the SDK from our public openapi spec
poetry run datamodel-codegen --input spec/public-api.yaml --output generated/model.py --strict-nullable
poetry run black .

PYTEST=poetry run pytest -v
Expand Down
40 changes: 24 additions & 16 deletions generated/.openapi-generator/FILES
Original file line number Diff line number Diff line change
Expand Up @@ -3,63 +3,71 @@
.travis.yml
README.md
docs/Action.md
docs/ClassificationResult.md
docs/ActionRequest.md
docs/ActionsApi.md
docs/AllNotes.md
docs/ChannelEnum.md
docs/Condition.md
docs/ConditionRequest.md
docs/Detector.md
docs/DetectorCreationInput.md
docs/DetectorCreationInputRequest.md
docs/DetectorTypeEnum.md
docs/DetectorsApi.md
docs/ImageQueriesApi.md
docs/ImageQuery.md
docs/ImageQueryTypeEnum.md
docs/ImagesApi.md
docs/InlineResponse200.md
docs/ModeEnum.md
docs/Note.md
docs/NoteCreationInput.md
docs/NoteRequest.md
docs/NotesApi.md
docs/PaginatedAllNotesList.md
docs/PaginatedDetectorList.md
docs/PaginatedImageQueryList.md
docs/PaginatedRuleList.md
docs/ResultTypeEnum.md
docs/Rule.md
docs/RuleBase.md
docs/RuleCreationInput.md
docs/RulesApi.md
docs/User.md
docs/RuleRequest.md
docs/SnoozeTimeUnitEnum.md
docs/UserApi.md
docs/VerbEnum.md
git_push.sh
groundlight_openapi_client/__init__.py
groundlight_openapi_client/api/__init__.py
groundlight_openapi_client/api/actions_api.py
groundlight_openapi_client/api/detectors_api.py
groundlight_openapi_client/api/image_queries_api.py
groundlight_openapi_client/api/images_api.py
groundlight_openapi_client/api/notes_api.py
groundlight_openapi_client/api/rules_api.py
groundlight_openapi_client/api/user_api.py
groundlight_openapi_client/api_client.py
groundlight_openapi_client/apis/__init__.py
groundlight_openapi_client/configuration.py
groundlight_openapi_client/exceptions.py
groundlight_openapi_client/model/__init__.py
groundlight_openapi_client/model/action.py
groundlight_openapi_client/model/classification_result.py
groundlight_openapi_client/model/action_request.py
groundlight_openapi_client/model/all_notes.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/detector.py
groundlight_openapi_client/model/detector_creation_input.py
groundlight_openapi_client/model/detector_creation_input_request.py
groundlight_openapi_client/model/detector_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/mode_enum.py
groundlight_openapi_client/model/note.py
groundlight_openapi_client/model/note_creation_input.py
groundlight_openapi_client/model/note_request.py
groundlight_openapi_client/model/paginated_all_notes_list.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/result_type_enum.py
groundlight_openapi_client/model/rule.py
groundlight_openapi_client/model/rule_base.py
groundlight_openapi_client/model/rule_creation_input.py
groundlight_openapi_client/model/user.py
groundlight_openapi_client/model/rule_request.py
groundlight_openapi_client/model/snooze_time_unit_enum.py
groundlight_openapi_client/model/verb_enum.py
groundlight_openapi_client/model_utils.py
groundlight_openapi_client/models/__init__.py
groundlight_openapi_client/rest.py
Expand Down
75 changes: 47 additions & 28 deletions generated/README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# groundlight-openapi-client
Easy Computer Vision powered by Natural Language
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.

This Python package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:

- API version: 0.6.0
- API version: 0.15.1
- Package version: 1.0.0
- Build package: org.openapitools.codegen.languages.PythonClientCodegen

Expand Down Expand Up @@ -49,10 +49,10 @@ Please follow the [installation procedure](#installation--usage) and then run th
import time
import groundlight_openapi_client
from pprint import pprint
from groundlight_openapi_client.api import detectors_api
from groundlight_openapi_client.model.detector import Detector
from groundlight_openapi_client.model.detector_creation_input import DetectorCreationInput
from groundlight_openapi_client.model.paginated_detector_list import PaginatedDetectorList
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(
Expand All @@ -74,21 +74,33 @@ 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 = DetectorCreationInput(
api_instance = actions_api.ActionsApi(api_client)
detector_id = "detector_id_example" # str |
rule_request = RuleRequest(
name="name_example",
query="query_example",
group_name="group_name_example",
confidence_threshold=0.9,
pipeline_config="pipeline_config_example",
metadata="metadata_example",
) # DetectorCreationInput |
enabled=True,
snooze_time_enabled=False,
snooze_time_value=0,
snooze_time_unit=None,
human_review_required=False,
condition=ConditionRequest(
verb=VerbEnum("ANSWERED_CONSECUTIVELY"),
parameters={
"key": None,
},
),
action=ActionRequest(
channel=ChannelEnum("EMAIL"),
recipient="recipient_example",
include_image=True,
),
) # RuleRequest |

try:
api_response = api_instance.create_detector(detector_creation_input)
api_response = api_instance.create_rule(detector_id, rule_request)
pprint(api_response)
except groundlight_openapi_client.ApiException as e:
print("Exception when calling DetectorsApi->create_detector: %s\n" % e)
print("Exception when calling ActionsApi->create_rule: %s\n" % e)
```

## Documentation for API Endpoints
Expand All @@ -97,43 +109,50 @@ All URIs are relative to *https://api.groundlight.ai/device-api*

Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
*ActionsApi* | [**create_rule**](docs/ActionsApi.md#create_rule) | **POST** /v1/actions/detector/{detector_id}/rules |
*ActionsApi* | [**delete_rule**](docs/ActionsApi.md#delete_rule) | **DELETE** /v1/actions/rules/{id} |
*ActionsApi* | [**get_rule**](docs/ActionsApi.md#get_rule) | **GET** /v1/actions/rules/{id} |
*ActionsApi* | [**list_detector_rules**](docs/ActionsApi.md#list_detector_rules) | **GET** /v1/actions/detector/{detector_id}/rules |
*ActionsApi* | [**list_rules**](docs/ActionsApi.md#list_rules) | **GET** /v1/actions/rules |
*DetectorsApi* | [**create_detector**](docs/DetectorsApi.md#create_detector) | **POST** /v1/detectors |
*DetectorsApi* | [**delete_detector**](docs/DetectorsApi.md#delete_detector) | **DELETE** /v1/detectors/{id} |
*DetectorsApi* | [**get_detector**](docs/DetectorsApi.md#get_detector) | **GET** /v1/detectors/{id} |
*DetectorsApi* | [**list_detectors**](docs/DetectorsApi.md#list_detectors) | **GET** /v1/detectors |
*ImageQueriesApi* | [**get_image**](docs/ImageQueriesApi.md#get_image) | **GET** /v1/image-queries/{id}/image |
*ImageQueriesApi* | [**get_image_query**](docs/ImageQueriesApi.md#get_image_query) | **GET** /v1/image-queries/{id} |
*ImageQueriesApi* | [**list_image_queries**](docs/ImageQueriesApi.md#list_image_queries) | **GET** /v1/image-queries |
*ImageQueriesApi* | [**submit_image_query**](docs/ImageQueriesApi.md#submit_image_query) | **POST** /v1/image-queries |
*ImagesApi* | [**get_image**](docs/ImagesApi.md#get_image) | **GET** /v1/image-queries/{id}/image |
*NotesApi* | [**create_note**](docs/NotesApi.md#create_note) | **POST** /v1/notes |
*NotesApi* | [**get_notes**](docs/NotesApi.md#get_notes) | **GET** /v1/notes |
*RulesApi* | [**create_rule**](docs/RulesApi.md#create_rule) | **POST** /v1/actions/detector/{detector_id}/rules |
*RulesApi* | [**delete_rule**](docs/RulesApi.md#delete_rule) | **DELETE** /v1/actions/rules/{id} |
*RulesApi* | [**get_rule**](docs/RulesApi.md#get_rule) | **GET** /v1/actions/rules/{id} |
*RulesApi* | [**list_rules**](docs/RulesApi.md#list_rules) | **GET** /v1/actions/rules |
*UserApi* | [**who_am_i**](docs/UserApi.md#who_am_i) | **GET** /me |
*UserApi* | [**who_am_i**](docs/UserApi.md#who_am_i) | **GET** /v1/me |


## Documentation For Models

- [Action](docs/Action.md)
- [ClassificationResult](docs/ClassificationResult.md)
- [ActionRequest](docs/ActionRequest.md)
- [AllNotes](docs/AllNotes.md)
- [ChannelEnum](docs/ChannelEnum.md)
- [Condition](docs/Condition.md)
- [ConditionRequest](docs/ConditionRequest.md)
- [Detector](docs/Detector.md)
- [DetectorCreationInput](docs/DetectorCreationInput.md)
- [DetectorCreationInputRequest](docs/DetectorCreationInputRequest.md)
- [DetectorTypeEnum](docs/DetectorTypeEnum.md)
- [ImageQuery](docs/ImageQuery.md)
- [ImageQueryTypeEnum](docs/ImageQueryTypeEnum.md)
- [InlineResponse200](docs/InlineResponse200.md)
- [ModeEnum](docs/ModeEnum.md)
- [Note](docs/Note.md)
- [NoteCreationInput](docs/NoteCreationInput.md)
- [NoteRequest](docs/NoteRequest.md)
- [PaginatedAllNotesList](docs/PaginatedAllNotesList.md)
- [PaginatedDetectorList](docs/PaginatedDetectorList.md)
- [PaginatedImageQueryList](docs/PaginatedImageQueryList.md)
- [PaginatedRuleList](docs/PaginatedRuleList.md)
- [ResultTypeEnum](docs/ResultTypeEnum.md)
- [Rule](docs/Rule.md)
- [RuleBase](docs/RuleBase.md)
- [RuleCreationInput](docs/RuleCreationInput.md)
- [User](docs/User.md)
- [RuleRequest](docs/RuleRequest.md)
- [SnoozeTimeUnitEnum](docs/SnoozeTimeUnitEnum.md)
- [VerbEnum](docs/VerbEnum.md)


## Documentation For Authorization
Expand Down
7 changes: 3 additions & 4 deletions generated/docs/Action.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
# Action

What action should be taken when the rule is triggered?

## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**channel** | **str** | The channel to send the action to. | [optional]
**include_image** | **bool** | Should the image be included in the action? | [optional]
**recipient** | **str** | The recipient of the action. | [optional]
**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]

[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
Expand Down
7 changes: 4 additions & 3 deletions generated/docs/User.md → generated/docs/ActionRequest.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
# User
# ActionRequest

Spec for serializing a user object in the public API

## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**username** | **str** | The user's username. |
**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]

[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
Expand Down
Loading