Skip to content

Commit 237f12c

Browse files
brandon-groundlightAuto-format Bot
and
Auto-format Bot
authored
Adds whoami function (#176)
* Adds whoami function * Automatically reformatting code --------- Co-authored-by: Auto-format Bot <[email protected]>
1 parent b782ecf commit 237f12c

File tree

20 files changed

+1819
-1140
lines changed

20 files changed

+1819
-1140
lines changed

generated/.openapi-generator/FILES

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,14 @@ docs/ImageQueryTypeEnum.md
1313
docs/PaginatedDetectorList.md
1414
docs/PaginatedImageQueryList.md
1515
docs/ResultTypeEnum.md
16+
docs/User.md
17+
docs/UserApi.md
1618
git_push.sh
1719
openapi_client/__init__.py
1820
openapi_client/api/__init__.py
1921
openapi_client/api/detectors_api.py
2022
openapi_client/api/image_queries_api.py
23+
openapi_client/api/user_api.py
2124
openapi_client/api_client.py
2225
openapi_client/apis/__init__.py
2326
openapi_client/configuration.py
@@ -32,6 +35,7 @@ openapi_client/model/image_query_type_enum.py
3235
openapi_client/model/paginated_detector_list.py
3336
openapi_client/model/paginated_image_query_list.py
3437
openapi_client/model/result_type_enum.py
38+
openapi_client/model/user.py
3539
openapi_client/model_utils.py
3640
openapi_client/models/__init__.py
3741
openapi_client/rest.py

generated/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ Class | Method | HTTP request | Description
103103
*ImageQueriesApi* | [**get_image_query**](docs/ImageQueriesApi.md#get_image_query) | **GET** /v1/image-queries/{id} |
104104
*ImageQueriesApi* | [**list_image_queries**](docs/ImageQueriesApi.md#list_image_queries) | **GET** /v1/image-queries |
105105
*ImageQueriesApi* | [**submit_image_query**](docs/ImageQueriesApi.md#submit_image_query) | **POST** /v1/image-queries |
106+
*UserApi* | [**who_am_i**](docs/UserApi.md#who_am_i) | **GET** /me |
106107

107108

108109
## Documentation For Models
@@ -116,6 +117,7 @@ Class | Method | HTTP request | Description
116117
- [PaginatedDetectorList](docs/PaginatedDetectorList.md)
117118
- [PaginatedImageQueryList](docs/PaginatedImageQueryList.md)
118119
- [ResultTypeEnum](docs/ResultTypeEnum.md)
120+
- [User](docs/User.md)
119121

120122

121123
## Documentation For Authorization

generated/docs/Detector.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Name | Type | Description | Notes
1212
**query** | **str** | A question about the image. | [readonly]
1313
**group_name** | **str** | Which group should this detector be part of? | [readonly]
1414
**confidence_threshold** | **float** | If the detector&#39;s prediction is below this confidence threshold, send the image query for human review. | [optional] if omitted the server will use the default value of 0.9
15-
**metadata** | **{str: (bool, date, datetime, dict, float, int, list, str, none_type)}, none_type** | A dictionary of custom key/value metadata to associate with the detector (limited to 1KB). | [optional]
15+
**metadata** | **{str: (bool, date, datetime, dict, float, int, list, str, none_type)}, none_type** | A dictionary of custom key/value metadata to associate with the detector (limited to 1KB). This is encoded as a URL-safe, base64-encoded JSON string. | [optional]
1616
**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]
1717

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

generated/docs/DetectorCreationInput.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Name | Type | Description | Notes
1010
**group_name** | **str** | Which group should this detector be part of? | [optional]
1111
**confidence_threshold** | **float** | If the detector&#39;s prediction is below this confidence threshold, send the image query for human review. | [optional] if omitted the server will use the default value of 0.9
1212
**pipeline_config** | **str, none_type** | (Advanced usage) Configuration to instantiate a specific prediction pipeline. | [optional]
13-
**metadata** | **str, none_type** | A dictionary of custom key/value metadata to associate with the detector (limited to 1KB). | [optional]
13+
**metadata** | **str, none_type** | A dictionary of custom key/value metadata to associate with the detector (limited to 1KB). This is encoded as a URL-safe, base64-encoded JSON string. | [optional]
1414
**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]
1515

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

generated/docs/User.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# User
2+
3+
Spec for serializing a user object in the public API
4+
5+
## Properties
6+
Name | Type | Description | Notes
7+
------------ | ------------- | ------------- | -------------
8+
**username** | **str** | The user&#39;s username. |
9+
**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]
10+
11+
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
12+
13+

generated/docs/UserApi.md

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
# openapi_client.UserApi
2+
3+
All URIs are relative to *https://api.groundlight.ai/device-api*
4+
5+
Method | HTTP request | Description
6+
------------- | ------------- | -------------
7+
[**who_am_i**](UserApi.md#who_am_i) | **GET** /me |
8+
9+
10+
# **who_am_i**
11+
> User who_am_i()
12+
13+
14+
15+
Retrieve the current user.
16+
17+
### Example
18+
19+
* Api Key Authentication (ApiToken):
20+
21+
```python
22+
import time
23+
import openapi_client
24+
from openapi_client.api import user_api
25+
from openapi_client.model.user import User
26+
from pprint import pprint
27+
# Defining the host is optional and defaults to https://api.groundlight.ai/device-api
28+
# See configuration.py for a list of all supported configuration parameters.
29+
configuration = openapi_client.Configuration(
30+
host = "https://api.groundlight.ai/device-api"
31+
)
32+
33+
# The client must configure the authentication and authorization parameters
34+
# in accordance with the API server security policy.
35+
# Examples for each auth method are provided below, use the example that
36+
# satisfies your auth use case.
37+
38+
# Configure API key authorization: ApiToken
39+
configuration.api_key['ApiToken'] = 'YOUR_API_KEY'
40+
41+
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
42+
# configuration.api_key_prefix['ApiToken'] = 'Bearer'
43+
44+
# Enter a context with an instance of the API client
45+
with openapi_client.ApiClient(configuration) as api_client:
46+
# Create an instance of the API class
47+
api_instance = user_api.UserApi(api_client)
48+
49+
# example, this endpoint has no required or optional parameters
50+
try:
51+
api_response = api_instance.who_am_i()
52+
pprint(api_response)
53+
except openapi_client.ApiException as e:
54+
print("Exception when calling UserApi->who_am_i: %s\n" % e)
55+
```
56+
57+
58+
### Parameters
59+
This endpoint does not need any parameter.
60+
61+
### Return type
62+
63+
[**User**](User.md)
64+
65+
### Authorization
66+
67+
[ApiToken](../README.md#ApiToken)
68+
69+
### HTTP request headers
70+
71+
- **Content-Type**: Not defined
72+
- **Accept**: application/json
73+
74+
75+
### HTTP response details
76+
77+
| Status code | Description | Response headers |
78+
|-------------|-------------|------------------|
79+
**200** | | - |
80+
81+
[[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)
82+

generated/model.py

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# generated by datamodel-codegen:
22
# filename: public-api.yaml
3-
# timestamp: 2024-01-16T18:09:48+00:00
3+
# timestamp: 2024-02-19T17:48:07+00:00
44

55
from __future__ import annotations
66

@@ -11,6 +11,10 @@
1111
from pydantic import AnyUrl, BaseModel, Field, confloat, constr
1212

1313

14+
class User(BaseModel):
15+
username: str = Field(..., description="The user's username.")
16+
17+
1418
class ClassificationResult(BaseModel):
1519
confidence: Optional[confloat(ge=0.0, le=1.0)] = Field(
1620
None, description="On a scale of 0 to 1, how confident are we in the predicted label?"
@@ -34,7 +38,11 @@ class DetectorCreationInput(BaseModel):
3438
None, description="(Advanced usage) Configuration to instantiate a specific prediction pipeline."
3539
)
3640
metadata: Optional[str] = Field(
37-
None, description="A dictionary of custom key/value metadata to associate with the detector (limited to 1KB)."
41+
None,
42+
description=(
43+
"A dictionary of custom key/value metadata to associate with the detector (limited to 1KB). This is encoded"
44+
" as a URL-safe, base64-encoded JSON string."
45+
),
3846
)
3947

4048

@@ -64,7 +72,11 @@ class Detector(BaseModel):
6472
),
6573
)
6674
metadata: Optional[Dict[str, Any]] = Field(
67-
None, description="A dictionary of custom key/value metadata to associate with the detector (limited to 1KB)."
75+
None,
76+
description=(
77+
"A dictionary of custom key/value metadata to associate with the detector (limited to 1KB). This is encoded"
78+
" as a URL-safe, base64-encoded JSON string."
79+
),
6880
)
6981

7082

Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
"""
2+
Groundlight API
3+
4+
Easy Computer Vision powered by Natural Language # noqa: E501
5+
6+
The version of the OpenAPI document: 0.6.0
7+
8+
Generated by: https://openapi-generator.tech
9+
"""
10+
11+
12+
import re # noqa: F401
13+
import sys # noqa: F401
14+
15+
from openapi_client.api_client import ApiClient, Endpoint as _Endpoint
16+
from openapi_client.model_utils import ( # noqa: F401
17+
check_allowed_values,
18+
check_validations,
19+
date,
20+
datetime,
21+
file_type,
22+
none_type,
23+
validate_and_convert_types,
24+
)
25+
from openapi_client.model.user import User
26+
27+
28+
class UserApi(object):
29+
"""NOTE: This class is auto generated by OpenAPI Generator
30+
Ref: https://openapi-generator.tech
31+
32+
Do not edit the class manually.
33+
"""
34+
35+
def __init__(self, api_client=None):
36+
if api_client is None:
37+
api_client = ApiClient()
38+
self.api_client = api_client
39+
self.who_am_i_endpoint = _Endpoint(
40+
settings={
41+
"response_type": (User,),
42+
"auth": ["ApiToken"],
43+
"endpoint_path": "/me",
44+
"operation_id": "who_am_i",
45+
"http_method": "GET",
46+
"servers": None,
47+
},
48+
params_map={"all": [], "required": [], "nullable": [], "enum": [], "validation": []},
49+
root_map={
50+
"validations": {},
51+
"allowed_values": {},
52+
"openapi_types": {},
53+
"attribute_map": {},
54+
"location_map": {},
55+
"collection_format_map": {},
56+
},
57+
headers_map={
58+
"accept": ["application/json"],
59+
"content_type": [],
60+
},
61+
api_client=api_client,
62+
)
63+
64+
def who_am_i(self, **kwargs):
65+
"""who_am_i # noqa: E501
66+
67+
Retrieve the current user. # noqa: E501
68+
This method makes a synchronous HTTP request by default. To make an
69+
asynchronous HTTP request, please pass async_req=True
70+
71+
>>> thread = api.who_am_i(async_req=True)
72+
>>> result = thread.get()
73+
74+
75+
Keyword Args:
76+
_return_http_data_only (bool): response data without head status
77+
code and headers. Default is True.
78+
_preload_content (bool): if False, the urllib3.HTTPResponse object
79+
will be returned without reading/decoding response data.
80+
Default is True.
81+
_request_timeout (int/float/tuple): timeout setting for this request. If
82+
one number provided, it will be total request timeout. It can also
83+
be a pair (tuple) of (connection, read) timeouts.
84+
Default is None.
85+
_check_input_type (bool): specifies if type checking
86+
should be done one the data sent to the server.
87+
Default is True.
88+
_check_return_type (bool): specifies if type checking
89+
should be done one the data received from the server.
90+
Default is True.
91+
_spec_property_naming (bool): True if the variable names in the input data
92+
are serialized names, as specified in the OpenAPI document.
93+
False if the variable names in the input data
94+
are pythonic names, e.g. snake case (default)
95+
_content_type (str/None): force body content-type.
96+
Default is None and content-type will be predicted by allowed
97+
content-types and body.
98+
_host_index (int/None): specifies the index of the server
99+
that we want to use.
100+
Default is read from the configuration.
101+
async_req (bool): execute request asynchronously
102+
103+
Returns:
104+
User
105+
If the method is called asynchronously, returns the request
106+
thread.
107+
"""
108+
kwargs["async_req"] = kwargs.get("async_req", False)
109+
kwargs["_return_http_data_only"] = kwargs.get("_return_http_data_only", True)
110+
kwargs["_preload_content"] = kwargs.get("_preload_content", True)
111+
kwargs["_request_timeout"] = kwargs.get("_request_timeout", None)
112+
kwargs["_check_input_type"] = kwargs.get("_check_input_type", True)
113+
kwargs["_check_return_type"] = kwargs.get("_check_return_type", True)
114+
kwargs["_spec_property_naming"] = kwargs.get("_spec_property_naming", False)
115+
kwargs["_content_type"] = kwargs.get("_content_type")
116+
kwargs["_host_index"] = kwargs.get("_host_index")
117+
return self.who_am_i_endpoint.call_with_http_info(**kwargs)

generated/openapi_client/apis/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,4 @@
1515
# Import APIs into API package:
1616
from openapi_client.api.detectors_api import DetectorsApi
1717
from openapi_client.api.image_queries_api import ImageQueriesApi
18+
from openapi_client.api.user_api import UserApi

generated/openapi_client/model/detector.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ def _from_openapi_data(cls, id, type, created_at, name, query, group_name, *args
198198
through its discriminator because we passed in
199199
_visited_composed_classes = (Animal,)
200200
confidence_threshold (float): If the detector's prediction is below this confidence threshold, send the image query for human review.. [optional] if omitted the server will use the default value of 0.9 # noqa: E501
201-
metadata ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}, none_type): A dictionary of custom key/value metadata to associate with the detector (limited to 1KB).. [optional] # noqa: E501
201+
metadata ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}, none_type): A dictionary of custom key/value metadata to associate with the detector (limited to 1KB). This is encoded as a URL-safe, base64-encoded JSON string.. [optional] # noqa: E501
202202
"""
203203

204204
_check_type = kwargs.pop("_check_type", True)
@@ -293,7 +293,7 @@ def __init__(self, name, *args, **kwargs): # noqa: E501
293293
through its discriminator because we passed in
294294
_visited_composed_classes = (Animal,)
295295
confidence_threshold (float): If the detector's prediction is below this confidence threshold, send the image query for human review.. [optional] if omitted the server will use the default value of 0.9 # noqa: E501
296-
metadata ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}, none_type): A dictionary of custom key/value metadata to associate with the detector (limited to 1KB).. [optional] # noqa: E501
296+
metadata ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}, none_type): A dictionary of custom key/value metadata to associate with the detector (limited to 1KB). This is encoded as a URL-safe, base64-encoded JSON string.. [optional] # noqa: E501
297297
"""
298298

299299
_check_type = kwargs.pop("_check_type", True)

generated/openapi_client/model/detector_creation_input.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ def _from_openapi_data(cls, name, query, *args, **kwargs): # noqa: E501
180180
group_name (str): Which group should this detector be part of?. [optional] # noqa: E501
181181
confidence_threshold (float): If the detector's prediction is below this confidence threshold, send the image query for human review.. [optional] if omitted the server will use the default value of 0.9 # noqa: E501
182182
pipeline_config (str, none_type): (Advanced usage) Configuration to instantiate a specific prediction pipeline.. [optional] # noqa: E501
183-
metadata (str, none_type): A dictionary of custom key/value metadata to associate with the detector (limited to 1KB).. [optional] # noqa: E501
183+
metadata (str, none_type): A dictionary of custom key/value metadata to associate with the detector (limited to 1KB). This is encoded as a URL-safe, base64-encoded JSON string.. [optional] # noqa: E501
184184
"""
185185

186186
_check_type = kwargs.pop("_check_type", True)
@@ -276,7 +276,7 @@ def __init__(self, name, query, *args, **kwargs): # noqa: E501
276276
group_name (str): Which group should this detector be part of?. [optional] # noqa: E501
277277
confidence_threshold (float): If the detector's prediction is below this confidence threshold, send the image query for human review.. [optional] if omitted the server will use the default value of 0.9 # noqa: E501
278278
pipeline_config (str, none_type): (Advanced usage) Configuration to instantiate a specific prediction pipeline.. [optional] # noqa: E501
279-
metadata (str, none_type): A dictionary of custom key/value metadata to associate with the detector (limited to 1KB).. [optional] # noqa: E501
279+
metadata (str, none_type): A dictionary of custom key/value metadata to associate with the detector (limited to 1KB). This is encoded as a URL-safe, base64-encoded JSON string.. [optional] # noqa: E501
280280
"""
281281

282282
_check_type = kwargs.pop("_check_type", True)

0 commit comments

Comments
 (0)