minikai 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of minikai might be problematic. Click here for more details.
- minikai-0.1.0/CHANGELOG.md +0 -0
- minikai-0.1.0/PKG-INFO +133 -0
- minikai-0.1.0/README.md +123 -0
- minikai-0.1.0/minikai/__init__.py +8 -0
- minikai-0.1.0/minikai/api/__init__.py +1 -0
- minikai-0.1.0/minikai/api/groups/__init__.py +1 -0
- minikai-0.1.0/minikai/api/groups/add_minis_to_group.py +176 -0
- minikai-0.1.0/minikai/api/groups/add_users_to_group.py +176 -0
- minikai-0.1.0/minikai/api/groups/create_group.py +160 -0
- minikai-0.1.0/minikai/api/groups/delete_group.py +95 -0
- minikai-0.1.0/minikai/api/groups/get_group.py +151 -0
- minikai-0.1.0/minikai/api/groups/get_group_minis.py +156 -0
- minikai-0.1.0/minikai/api/groups/get_group_users.py +156 -0
- minikai-0.1.0/minikai/api/groups/get_groups.py +128 -0
- minikai-0.1.0/minikai/api/groups/remove_minis_from_group.py +176 -0
- minikai-0.1.0/minikai/api/groups/remove_users_from_group.py +176 -0
- minikai-0.1.0/minikai/api/groups/update_group.py +177 -0
- minikai-0.1.0/minikai/api/minis/__init__.py +1 -0
- minikai-0.1.0/minikai/api/minis/create_mini.py +160 -0
- minikai-0.1.0/minikai/api/minis/delete_mini.py +95 -0
- minikai-0.1.0/minikai/api/minis/get_external_mini.py +164 -0
- minikai-0.1.0/minikai/api/minis/get_minis.py +128 -0
- minikai-0.1.0/minikai/api/minis/patch_mini.py +177 -0
- minikai-0.1.0/minikai/api/minis/update_mini.py +177 -0
- minikai-0.1.0/minikai/api/records/__init__.py +1 -0
- minikai-0.1.0/minikai/api/records/add_attachments.py +182 -0
- minikai-0.1.0/minikai/api/records/add_relations.py +187 -0
- minikai-0.1.0/minikai/api/records/create_record.py +162 -0
- minikai-0.1.0/minikai/api/records/delete_record.py +95 -0
- minikai-0.1.0/minikai/api/records/get_records_by_external.py +230 -0
- minikai-0.1.0/minikai/api/records/remove_attachments.py +110 -0
- minikai-0.1.0/minikai/api/records/remove_relations.py +110 -0
- minikai-0.1.0/minikai/api/records/update_attachments.py +182 -0
- minikai-0.1.0/minikai/api/records/update_record.py +179 -0
- minikai-0.1.0/minikai/api/records/update_relations.py +187 -0
- minikai-0.1.0/minikai/api/users/__init__.py +1 -0
- minikai-0.1.0/minikai/api/users/delete_api_users_minis.py +102 -0
- minikai-0.1.0/minikai/api/users/get_api_users_minis.py +156 -0
- minikai-0.1.0/minikai/api/users/get_users.py +128 -0
- minikai-0.1.0/minikai/api/users/post_api_users_minis.py +168 -0
- minikai-0.1.0/minikai/client.py +268 -0
- minikai-0.1.0/minikai/errors.py +16 -0
- minikai-0.1.0/minikai/models/__init__.py +89 -0
- minikai-0.1.0/minikai/models/add_attachments_body.py +98 -0
- minikai-0.1.0/minikai/models/create_group_command.py +102 -0
- minikai-0.1.0/minikai/models/create_mini_command.py +120 -0
- minikai-0.1.0/minikai/models/create_record_command.py +268 -0
- minikai-0.1.0/minikai/models/create_record_command_tags.py +44 -0
- minikai-0.1.0/minikai/models/document_file_dto.py +147 -0
- minikai-0.1.0/minikai/models/form_field.py +112 -0
- minikai-0.1.0/minikai/models/form_field_dto.py +149 -0
- minikai-0.1.0/minikai/models/form_field_type.py +16 -0
- minikai-0.1.0/minikai/models/group_dto.py +124 -0
- minikai-0.1.0/minikai/models/http_validation_problem_details.py +173 -0
- minikai-0.1.0/minikai/models/http_validation_problem_details_errors.py +51 -0
- minikai-0.1.0/minikai/models/json_node.py +119 -0
- minikai-0.1.0/minikai/models/json_node_options.py +42 -0
- minikai-0.1.0/minikai/models/mini_dto.py +189 -0
- minikai-0.1.0/minikai/models/mini_template_dto.py +135 -0
- minikai-0.1.0/minikai/models/paginated_list_of_record_dto.py +101 -0
- minikai-0.1.0/minikai/models/patch_mini_command.py +80 -0
- minikai-0.1.0/minikai/models/problem_details.py +151 -0
- minikai-0.1.0/minikai/models/record.py +379 -0
- minikai-0.1.0/minikai/models/record_attachment.py +236 -0
- minikai-0.1.0/minikai/models/record_attachment_dto.py +236 -0
- minikai-0.1.0/minikai/models/record_attachment_dto_metadata_type_0.py +44 -0
- minikai-0.1.0/minikai/models/record_attachment_metadata_type_0.py +44 -0
- minikai-0.1.0/minikai/models/record_authorization.py +75 -0
- minikai-0.1.0/minikai/models/record_authorization_dto.py +75 -0
- minikai-0.1.0/minikai/models/record_dto.py +377 -0
- minikai-0.1.0/minikai/models/record_dto_tags.py +44 -0
- minikai-0.1.0/minikai/models/record_relation.py +81 -0
- minikai-0.1.0/minikai/models/record_relation_dto.py +81 -0
- minikai-0.1.0/minikai/models/record_tags.py +44 -0
- minikai-0.1.0/minikai/models/slim_mini_dto.py +168 -0
- minikai-0.1.0/minikai/models/tool_dto.py +76 -0
- minikai-0.1.0/minikai/models/update_attachments_body.py +98 -0
- minikai-0.1.0/minikai/models/update_group_command.py +122 -0
- minikai-0.1.0/minikai/models/update_mini_command.py +129 -0
- minikai-0.1.0/minikai/models/update_mini_template_workspaces_command.py +51 -0
- minikai-0.1.0/minikai/models/update_record_command.py +266 -0
- minikai-0.1.0/minikai/models/update_record_command_tags.py +44 -0
- minikai-0.1.0/minikai/models/user_dto.py +182 -0
- minikai-0.1.0/minikai/models/user_to_mini_dto.py +78 -0
- minikai-0.1.0/minikai/models/workspace_dto.py +78 -0
- minikai-0.1.0/minikai/py.typed +1 -0
- minikai-0.1.0/minikai/types.py +54 -0
- minikai-0.1.0/pyproject.toml +29 -0
|
File without changes
|
minikai-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
|
+
Name: minikai
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A client library for accessing Minikai API
|
|
5
|
+
Requires-Dist: httpx>=0.23.0,<0.29.0
|
|
6
|
+
Requires-Dist: attrs>=22.2.0
|
|
7
|
+
Requires-Dist: python-dateutil>=2.8.0,<3
|
|
8
|
+
Requires-Python: >=3.11
|
|
9
|
+
Description-Content-Type: text/markdown
|
|
10
|
+
|
|
11
|
+
# minikai
|
|
12
|
+
A client library for accessing Minikai API
|
|
13
|
+
|
|
14
|
+
## Usage
|
|
15
|
+
First, create a client:
|
|
16
|
+
|
|
17
|
+
```python
|
|
18
|
+
from minikai import Client
|
|
19
|
+
|
|
20
|
+
client = Client(base_url="https://api.example.com")
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
If the endpoints you're going to hit require authentication, use `AuthenticatedClient` instead:
|
|
24
|
+
|
|
25
|
+
```python
|
|
26
|
+
from minikai import AuthenticatedClient
|
|
27
|
+
|
|
28
|
+
client = AuthenticatedClient(base_url="https://api.example.com", token="SuperSecretToken")
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Now call your endpoint and use your models:
|
|
32
|
+
|
|
33
|
+
```python
|
|
34
|
+
from minikai.models import MyDataModel
|
|
35
|
+
from minikai.api.my_tag import get_my_data_model
|
|
36
|
+
from minikai.types import Response
|
|
37
|
+
|
|
38
|
+
with client as client:
|
|
39
|
+
my_data: MyDataModel = get_my_data_model.sync(client=client)
|
|
40
|
+
# or if you need more info (e.g. status_code)
|
|
41
|
+
response: Response[MyDataModel] = get_my_data_model.sync_detailed(client=client)
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Or do the same thing with an async version:
|
|
45
|
+
|
|
46
|
+
```python
|
|
47
|
+
from minikai.models import MyDataModel
|
|
48
|
+
from minikai.api.my_tag import get_my_data_model
|
|
49
|
+
from minikai.types import Response
|
|
50
|
+
|
|
51
|
+
async with client as client:
|
|
52
|
+
my_data: MyDataModel = await get_my_data_model.asyncio(client=client)
|
|
53
|
+
response: Response[MyDataModel] = await get_my_data_model.asyncio_detailed(client=client)
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
By default, when you're calling an HTTPS API it will attempt to verify that SSL is working correctly. Using certificate verification is highly recommended most of the time, but sometimes you may need to authenticate to a server (especially an internal server) using a custom certificate bundle.
|
|
57
|
+
|
|
58
|
+
```python
|
|
59
|
+
client = AuthenticatedClient(
|
|
60
|
+
base_url="https://internal_api.example.com",
|
|
61
|
+
token="SuperSecretToken",
|
|
62
|
+
verify_ssl="/path/to/certificate_bundle.pem",
|
|
63
|
+
)
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
You can also disable certificate validation altogether, but beware that **this is a security risk**.
|
|
67
|
+
|
|
68
|
+
```python
|
|
69
|
+
client = AuthenticatedClient(
|
|
70
|
+
base_url="https://internal_api.example.com",
|
|
71
|
+
token="SuperSecretToken",
|
|
72
|
+
verify_ssl=False
|
|
73
|
+
)
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
Things to know:
|
|
77
|
+
1. Every path/method combo becomes a Python module with four functions:
|
|
78
|
+
1. `sync`: Blocking request that returns parsed data (if successful) or `None`
|
|
79
|
+
1. `sync_detailed`: Blocking request that always returns a `Request`, optionally with `parsed` set if the request was successful.
|
|
80
|
+
1. `asyncio`: Like `sync` but async instead of blocking
|
|
81
|
+
1. `asyncio_detailed`: Like `sync_detailed` but async instead of blocking
|
|
82
|
+
|
|
83
|
+
1. All path/query params, and bodies become method arguments.
|
|
84
|
+
1. If your endpoint had any tags on it, the first tag will be used as a module name for the function (my_tag above)
|
|
85
|
+
1. Any endpoint which did not have a tag will be in `minikai.api.default`
|
|
86
|
+
|
|
87
|
+
## Advanced customizations
|
|
88
|
+
|
|
89
|
+
There are more settings on the generated `Client` class which let you control more runtime behavior, check out the docstring on that class for more info. You can also customize the underlying `httpx.Client` or `httpx.AsyncClient` (depending on your use-case):
|
|
90
|
+
|
|
91
|
+
```python
|
|
92
|
+
from minikai import Client
|
|
93
|
+
|
|
94
|
+
def log_request(request):
|
|
95
|
+
print(f"Request event hook: {request.method} {request.url} - Waiting for response")
|
|
96
|
+
|
|
97
|
+
def log_response(response):
|
|
98
|
+
request = response.request
|
|
99
|
+
print(f"Response event hook: {request.method} {request.url} - Status {response.status_code}")
|
|
100
|
+
|
|
101
|
+
client = Client(
|
|
102
|
+
base_url="https://api.example.com",
|
|
103
|
+
httpx_args={"event_hooks": {"request": [log_request], "response": [log_response]}},
|
|
104
|
+
)
|
|
105
|
+
|
|
106
|
+
# Or get the underlying httpx client to modify directly with client.get_httpx_client() or client.get_async_httpx_client()
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
You can even set the httpx client directly, but beware that this will override any existing settings (e.g., base_url):
|
|
110
|
+
|
|
111
|
+
```python
|
|
112
|
+
import httpx
|
|
113
|
+
from minikai import Client
|
|
114
|
+
|
|
115
|
+
client = Client(
|
|
116
|
+
base_url="https://api.example.com",
|
|
117
|
+
)
|
|
118
|
+
# Note that base_url needs to be re-set, as would any shared cookies, headers, etc.
|
|
119
|
+
client.set_httpx_client(httpx.Client(base_url="https://api.example.com", proxies="http://localhost:8030"))
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
## Building / publishing this package
|
|
123
|
+
This project uses [uv](https://github.com/astral-sh/uv) to manage dependencies and packaging. Here are the basics:
|
|
124
|
+
1. Update the metadata in `pyproject.toml` (e.g. authors, version).
|
|
125
|
+
2. If you're using a private repository: https://docs.astral.sh/uv/guides/integration/alternative-indexes/
|
|
126
|
+
3. Build a distribution with `uv build`, builds `sdist` and `wheel` by default.
|
|
127
|
+
1. Publish the client with `uv publish`, see documentation for publishing to private indexes.
|
|
128
|
+
|
|
129
|
+
If you want to install this client into another project without publishing it (e.g. for development) then:
|
|
130
|
+
1. If that project **is using uv**, you can simply do `uv add <path-to-this-client>` from that project
|
|
131
|
+
1. If that project is not using uv:
|
|
132
|
+
1. Build a wheel with `uv build --wheel`.
|
|
133
|
+
1. Install that wheel from the other project `pip install <path-to-wheel>`.
|
minikai-0.1.0/README.md
ADDED
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
# minikai
|
|
2
|
+
A client library for accessing Minikai API
|
|
3
|
+
|
|
4
|
+
## Usage
|
|
5
|
+
First, create a client:
|
|
6
|
+
|
|
7
|
+
```python
|
|
8
|
+
from minikai import Client
|
|
9
|
+
|
|
10
|
+
client = Client(base_url="https://api.example.com")
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
If the endpoints you're going to hit require authentication, use `AuthenticatedClient` instead:
|
|
14
|
+
|
|
15
|
+
```python
|
|
16
|
+
from minikai import AuthenticatedClient
|
|
17
|
+
|
|
18
|
+
client = AuthenticatedClient(base_url="https://api.example.com", token="SuperSecretToken")
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Now call your endpoint and use your models:
|
|
22
|
+
|
|
23
|
+
```python
|
|
24
|
+
from minikai.models import MyDataModel
|
|
25
|
+
from minikai.api.my_tag import get_my_data_model
|
|
26
|
+
from minikai.types import Response
|
|
27
|
+
|
|
28
|
+
with client as client:
|
|
29
|
+
my_data: MyDataModel = get_my_data_model.sync(client=client)
|
|
30
|
+
# or if you need more info (e.g. status_code)
|
|
31
|
+
response: Response[MyDataModel] = get_my_data_model.sync_detailed(client=client)
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Or do the same thing with an async version:
|
|
35
|
+
|
|
36
|
+
```python
|
|
37
|
+
from minikai.models import MyDataModel
|
|
38
|
+
from minikai.api.my_tag import get_my_data_model
|
|
39
|
+
from minikai.types import Response
|
|
40
|
+
|
|
41
|
+
async with client as client:
|
|
42
|
+
my_data: MyDataModel = await get_my_data_model.asyncio(client=client)
|
|
43
|
+
response: Response[MyDataModel] = await get_my_data_model.asyncio_detailed(client=client)
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
By default, when you're calling an HTTPS API it will attempt to verify that SSL is working correctly. Using certificate verification is highly recommended most of the time, but sometimes you may need to authenticate to a server (especially an internal server) using a custom certificate bundle.
|
|
47
|
+
|
|
48
|
+
```python
|
|
49
|
+
client = AuthenticatedClient(
|
|
50
|
+
base_url="https://internal_api.example.com",
|
|
51
|
+
token="SuperSecretToken",
|
|
52
|
+
verify_ssl="/path/to/certificate_bundle.pem",
|
|
53
|
+
)
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
You can also disable certificate validation altogether, but beware that **this is a security risk**.
|
|
57
|
+
|
|
58
|
+
```python
|
|
59
|
+
client = AuthenticatedClient(
|
|
60
|
+
base_url="https://internal_api.example.com",
|
|
61
|
+
token="SuperSecretToken",
|
|
62
|
+
verify_ssl=False
|
|
63
|
+
)
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Things to know:
|
|
67
|
+
1. Every path/method combo becomes a Python module with four functions:
|
|
68
|
+
1. `sync`: Blocking request that returns parsed data (if successful) or `None`
|
|
69
|
+
1. `sync_detailed`: Blocking request that always returns a `Request`, optionally with `parsed` set if the request was successful.
|
|
70
|
+
1. `asyncio`: Like `sync` but async instead of blocking
|
|
71
|
+
1. `asyncio_detailed`: Like `sync_detailed` but async instead of blocking
|
|
72
|
+
|
|
73
|
+
1. All path/query params, and bodies become method arguments.
|
|
74
|
+
1. If your endpoint had any tags on it, the first tag will be used as a module name for the function (my_tag above)
|
|
75
|
+
1. Any endpoint which did not have a tag will be in `minikai.api.default`
|
|
76
|
+
|
|
77
|
+
## Advanced customizations
|
|
78
|
+
|
|
79
|
+
There are more settings on the generated `Client` class which let you control more runtime behavior, check out the docstring on that class for more info. You can also customize the underlying `httpx.Client` or `httpx.AsyncClient` (depending on your use-case):
|
|
80
|
+
|
|
81
|
+
```python
|
|
82
|
+
from minikai import Client
|
|
83
|
+
|
|
84
|
+
def log_request(request):
|
|
85
|
+
print(f"Request event hook: {request.method} {request.url} - Waiting for response")
|
|
86
|
+
|
|
87
|
+
def log_response(response):
|
|
88
|
+
request = response.request
|
|
89
|
+
print(f"Response event hook: {request.method} {request.url} - Status {response.status_code}")
|
|
90
|
+
|
|
91
|
+
client = Client(
|
|
92
|
+
base_url="https://api.example.com",
|
|
93
|
+
httpx_args={"event_hooks": {"request": [log_request], "response": [log_response]}},
|
|
94
|
+
)
|
|
95
|
+
|
|
96
|
+
# Or get the underlying httpx client to modify directly with client.get_httpx_client() or client.get_async_httpx_client()
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
You can even set the httpx client directly, but beware that this will override any existing settings (e.g., base_url):
|
|
100
|
+
|
|
101
|
+
```python
|
|
102
|
+
import httpx
|
|
103
|
+
from minikai import Client
|
|
104
|
+
|
|
105
|
+
client = Client(
|
|
106
|
+
base_url="https://api.example.com",
|
|
107
|
+
)
|
|
108
|
+
# Note that base_url needs to be re-set, as would any shared cookies, headers, etc.
|
|
109
|
+
client.set_httpx_client(httpx.Client(base_url="https://api.example.com", proxies="http://localhost:8030"))
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
## Building / publishing this package
|
|
113
|
+
This project uses [uv](https://github.com/astral-sh/uv) to manage dependencies and packaging. Here are the basics:
|
|
114
|
+
1. Update the metadata in `pyproject.toml` (e.g. authors, version).
|
|
115
|
+
2. If you're using a private repository: https://docs.astral.sh/uv/guides/integration/alternative-indexes/
|
|
116
|
+
3. Build a distribution with `uv build`, builds `sdist` and `wheel` by default.
|
|
117
|
+
1. Publish the client with `uv publish`, see documentation for publishing to private indexes.
|
|
118
|
+
|
|
119
|
+
If you want to install this client into another project without publishing it (e.g. for development) then:
|
|
120
|
+
1. If that project **is using uv**, you can simply do `uv add <path-to-this-client>` from that project
|
|
121
|
+
1. If that project is not using uv:
|
|
122
|
+
1. Build a wheel with `uv build --wheel`.
|
|
123
|
+
1. Install that wheel from the other project `pip install <path-to-wheel>`.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Contains methods for accessing the API"""
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Contains endpoint functions for accessing the API"""
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
from http import HTTPStatus
|
|
2
|
+
from typing import Any, Optional, Union, cast
|
|
3
|
+
|
|
4
|
+
import httpx
|
|
5
|
+
|
|
6
|
+
from ... import errors
|
|
7
|
+
from ...client import AuthenticatedClient, Client
|
|
8
|
+
from ...models.http_validation_problem_details import HttpValidationProblemDetails
|
|
9
|
+
from ...types import Response
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def _get_kwargs(
|
|
13
|
+
group_id: str,
|
|
14
|
+
*,
|
|
15
|
+
body: list[int],
|
|
16
|
+
) -> dict[str, Any]:
|
|
17
|
+
headers: dict[str, Any] = {}
|
|
18
|
+
|
|
19
|
+
_kwargs: dict[str, Any] = {
|
|
20
|
+
"method": "patch",
|
|
21
|
+
"url": f"/api/Groups/{group_id}/minis",
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
_kwargs["json"] = body
|
|
25
|
+
|
|
26
|
+
headers["Content-Type"] = "application/json"
|
|
27
|
+
|
|
28
|
+
_kwargs["headers"] = headers
|
|
29
|
+
return _kwargs
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def _parse_response(
|
|
33
|
+
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
|
34
|
+
) -> Optional[Union[Any, HttpValidationProblemDetails]]:
|
|
35
|
+
if response.status_code == 204:
|
|
36
|
+
response_204 = cast(Any, None)
|
|
37
|
+
return response_204
|
|
38
|
+
|
|
39
|
+
if response.status_code == 400:
|
|
40
|
+
response_400 = HttpValidationProblemDetails.from_dict(response.json())
|
|
41
|
+
|
|
42
|
+
return response_400
|
|
43
|
+
|
|
44
|
+
if response.status_code == 404:
|
|
45
|
+
response_404 = cast(Any, None)
|
|
46
|
+
return response_404
|
|
47
|
+
|
|
48
|
+
if client.raise_on_unexpected_status:
|
|
49
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
50
|
+
else:
|
|
51
|
+
return None
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
def _build_response(
|
|
55
|
+
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
|
56
|
+
) -> Response[Union[Any, HttpValidationProblemDetails]]:
|
|
57
|
+
return Response(
|
|
58
|
+
status_code=HTTPStatus(response.status_code),
|
|
59
|
+
content=response.content,
|
|
60
|
+
headers=response.headers,
|
|
61
|
+
parsed=_parse_response(client=client, response=response),
|
|
62
|
+
)
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
def sync_detailed(
|
|
66
|
+
group_id: str,
|
|
67
|
+
*,
|
|
68
|
+
client: Union[AuthenticatedClient, Client],
|
|
69
|
+
body: list[int],
|
|
70
|
+
) -> Response[Union[Any, HttpValidationProblemDetails]]:
|
|
71
|
+
"""
|
|
72
|
+
Args:
|
|
73
|
+
group_id (str):
|
|
74
|
+
body (list[int]):
|
|
75
|
+
|
|
76
|
+
Raises:
|
|
77
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
78
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
79
|
+
|
|
80
|
+
Returns:
|
|
81
|
+
Response[Union[Any, HttpValidationProblemDetails]]
|
|
82
|
+
"""
|
|
83
|
+
|
|
84
|
+
kwargs = _get_kwargs(
|
|
85
|
+
group_id=group_id,
|
|
86
|
+
body=body,
|
|
87
|
+
)
|
|
88
|
+
|
|
89
|
+
response = client.get_httpx_client().request(
|
|
90
|
+
**kwargs,
|
|
91
|
+
)
|
|
92
|
+
|
|
93
|
+
return _build_response(client=client, response=response)
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
def sync(
|
|
97
|
+
group_id: str,
|
|
98
|
+
*,
|
|
99
|
+
client: Union[AuthenticatedClient, Client],
|
|
100
|
+
body: list[int],
|
|
101
|
+
) -> Optional[Union[Any, HttpValidationProblemDetails]]:
|
|
102
|
+
"""
|
|
103
|
+
Args:
|
|
104
|
+
group_id (str):
|
|
105
|
+
body (list[int]):
|
|
106
|
+
|
|
107
|
+
Raises:
|
|
108
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
109
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
110
|
+
|
|
111
|
+
Returns:
|
|
112
|
+
Union[Any, HttpValidationProblemDetails]
|
|
113
|
+
"""
|
|
114
|
+
|
|
115
|
+
return sync_detailed(
|
|
116
|
+
group_id=group_id,
|
|
117
|
+
client=client,
|
|
118
|
+
body=body,
|
|
119
|
+
).parsed
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
async def asyncio_detailed(
|
|
123
|
+
group_id: str,
|
|
124
|
+
*,
|
|
125
|
+
client: Union[AuthenticatedClient, Client],
|
|
126
|
+
body: list[int],
|
|
127
|
+
) -> Response[Union[Any, HttpValidationProblemDetails]]:
|
|
128
|
+
"""
|
|
129
|
+
Args:
|
|
130
|
+
group_id (str):
|
|
131
|
+
body (list[int]):
|
|
132
|
+
|
|
133
|
+
Raises:
|
|
134
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
135
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
136
|
+
|
|
137
|
+
Returns:
|
|
138
|
+
Response[Union[Any, HttpValidationProblemDetails]]
|
|
139
|
+
"""
|
|
140
|
+
|
|
141
|
+
kwargs = _get_kwargs(
|
|
142
|
+
group_id=group_id,
|
|
143
|
+
body=body,
|
|
144
|
+
)
|
|
145
|
+
|
|
146
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
|
147
|
+
|
|
148
|
+
return _build_response(client=client, response=response)
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
async def asyncio(
|
|
152
|
+
group_id: str,
|
|
153
|
+
*,
|
|
154
|
+
client: Union[AuthenticatedClient, Client],
|
|
155
|
+
body: list[int],
|
|
156
|
+
) -> Optional[Union[Any, HttpValidationProblemDetails]]:
|
|
157
|
+
"""
|
|
158
|
+
Args:
|
|
159
|
+
group_id (str):
|
|
160
|
+
body (list[int]):
|
|
161
|
+
|
|
162
|
+
Raises:
|
|
163
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
164
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
165
|
+
|
|
166
|
+
Returns:
|
|
167
|
+
Union[Any, HttpValidationProblemDetails]
|
|
168
|
+
"""
|
|
169
|
+
|
|
170
|
+
return (
|
|
171
|
+
await asyncio_detailed(
|
|
172
|
+
group_id=group_id,
|
|
173
|
+
client=client,
|
|
174
|
+
body=body,
|
|
175
|
+
)
|
|
176
|
+
).parsed
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
from http import HTTPStatus
|
|
2
|
+
from typing import Any, Optional, Union, cast
|
|
3
|
+
|
|
4
|
+
import httpx
|
|
5
|
+
|
|
6
|
+
from ... import errors
|
|
7
|
+
from ...client import AuthenticatedClient, Client
|
|
8
|
+
from ...models.http_validation_problem_details import HttpValidationProblemDetails
|
|
9
|
+
from ...types import Response
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def _get_kwargs(
|
|
13
|
+
group_id: str,
|
|
14
|
+
*,
|
|
15
|
+
body: list[str],
|
|
16
|
+
) -> dict[str, Any]:
|
|
17
|
+
headers: dict[str, Any] = {}
|
|
18
|
+
|
|
19
|
+
_kwargs: dict[str, Any] = {
|
|
20
|
+
"method": "patch",
|
|
21
|
+
"url": f"/api/Groups/{group_id}/users",
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
_kwargs["json"] = body
|
|
25
|
+
|
|
26
|
+
headers["Content-Type"] = "application/json"
|
|
27
|
+
|
|
28
|
+
_kwargs["headers"] = headers
|
|
29
|
+
return _kwargs
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def _parse_response(
|
|
33
|
+
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
|
34
|
+
) -> Optional[Union[Any, HttpValidationProblemDetails]]:
|
|
35
|
+
if response.status_code == 204:
|
|
36
|
+
response_204 = cast(Any, None)
|
|
37
|
+
return response_204
|
|
38
|
+
|
|
39
|
+
if response.status_code == 400:
|
|
40
|
+
response_400 = HttpValidationProblemDetails.from_dict(response.json())
|
|
41
|
+
|
|
42
|
+
return response_400
|
|
43
|
+
|
|
44
|
+
if response.status_code == 404:
|
|
45
|
+
response_404 = cast(Any, None)
|
|
46
|
+
return response_404
|
|
47
|
+
|
|
48
|
+
if client.raise_on_unexpected_status:
|
|
49
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
50
|
+
else:
|
|
51
|
+
return None
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
def _build_response(
|
|
55
|
+
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
|
56
|
+
) -> Response[Union[Any, HttpValidationProblemDetails]]:
|
|
57
|
+
return Response(
|
|
58
|
+
status_code=HTTPStatus(response.status_code),
|
|
59
|
+
content=response.content,
|
|
60
|
+
headers=response.headers,
|
|
61
|
+
parsed=_parse_response(client=client, response=response),
|
|
62
|
+
)
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
def sync_detailed(
|
|
66
|
+
group_id: str,
|
|
67
|
+
*,
|
|
68
|
+
client: Union[AuthenticatedClient, Client],
|
|
69
|
+
body: list[str],
|
|
70
|
+
) -> Response[Union[Any, HttpValidationProblemDetails]]:
|
|
71
|
+
"""
|
|
72
|
+
Args:
|
|
73
|
+
group_id (str):
|
|
74
|
+
body (list[str]):
|
|
75
|
+
|
|
76
|
+
Raises:
|
|
77
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
78
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
79
|
+
|
|
80
|
+
Returns:
|
|
81
|
+
Response[Union[Any, HttpValidationProblemDetails]]
|
|
82
|
+
"""
|
|
83
|
+
|
|
84
|
+
kwargs = _get_kwargs(
|
|
85
|
+
group_id=group_id,
|
|
86
|
+
body=body,
|
|
87
|
+
)
|
|
88
|
+
|
|
89
|
+
response = client.get_httpx_client().request(
|
|
90
|
+
**kwargs,
|
|
91
|
+
)
|
|
92
|
+
|
|
93
|
+
return _build_response(client=client, response=response)
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
def sync(
|
|
97
|
+
group_id: str,
|
|
98
|
+
*,
|
|
99
|
+
client: Union[AuthenticatedClient, Client],
|
|
100
|
+
body: list[str],
|
|
101
|
+
) -> Optional[Union[Any, HttpValidationProblemDetails]]:
|
|
102
|
+
"""
|
|
103
|
+
Args:
|
|
104
|
+
group_id (str):
|
|
105
|
+
body (list[str]):
|
|
106
|
+
|
|
107
|
+
Raises:
|
|
108
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
109
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
110
|
+
|
|
111
|
+
Returns:
|
|
112
|
+
Union[Any, HttpValidationProblemDetails]
|
|
113
|
+
"""
|
|
114
|
+
|
|
115
|
+
return sync_detailed(
|
|
116
|
+
group_id=group_id,
|
|
117
|
+
client=client,
|
|
118
|
+
body=body,
|
|
119
|
+
).parsed
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
async def asyncio_detailed(
|
|
123
|
+
group_id: str,
|
|
124
|
+
*,
|
|
125
|
+
client: Union[AuthenticatedClient, Client],
|
|
126
|
+
body: list[str],
|
|
127
|
+
) -> Response[Union[Any, HttpValidationProblemDetails]]:
|
|
128
|
+
"""
|
|
129
|
+
Args:
|
|
130
|
+
group_id (str):
|
|
131
|
+
body (list[str]):
|
|
132
|
+
|
|
133
|
+
Raises:
|
|
134
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
135
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
136
|
+
|
|
137
|
+
Returns:
|
|
138
|
+
Response[Union[Any, HttpValidationProblemDetails]]
|
|
139
|
+
"""
|
|
140
|
+
|
|
141
|
+
kwargs = _get_kwargs(
|
|
142
|
+
group_id=group_id,
|
|
143
|
+
body=body,
|
|
144
|
+
)
|
|
145
|
+
|
|
146
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
|
147
|
+
|
|
148
|
+
return _build_response(client=client, response=response)
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
async def asyncio(
|
|
152
|
+
group_id: str,
|
|
153
|
+
*,
|
|
154
|
+
client: Union[AuthenticatedClient, Client],
|
|
155
|
+
body: list[str],
|
|
156
|
+
) -> Optional[Union[Any, HttpValidationProblemDetails]]:
|
|
157
|
+
"""
|
|
158
|
+
Args:
|
|
159
|
+
group_id (str):
|
|
160
|
+
body (list[str]):
|
|
161
|
+
|
|
162
|
+
Raises:
|
|
163
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
164
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
165
|
+
|
|
166
|
+
Returns:
|
|
167
|
+
Union[Any, HttpValidationProblemDetails]
|
|
168
|
+
"""
|
|
169
|
+
|
|
170
|
+
return (
|
|
171
|
+
await asyncio_detailed(
|
|
172
|
+
group_id=group_id,
|
|
173
|
+
client=client,
|
|
174
|
+
body=body,
|
|
175
|
+
)
|
|
176
|
+
).parsed
|