Compare commits
46 Commits
Author | SHA1 | Date | |
---|---|---|---|
24171eea43 | |||
a008a9d1aa | |||
5011954847 | |||
2c7445c5a6 | |||
bf5e3e1839 | |||
f80767454a | |||
bfb243c233 | |||
e0209e29d6 | |||
213c4d681c | |||
60c42befdf | |||
d31d9507d2 | |||
ca84069e9a | |||
dd2e3848cc | |||
8c56b88113 | |||
cc0bb86a53 | |||
b3eeaef41d | |||
0ac4e4c9c0 | |||
35bbe91eb4 | |||
b4ce8e9642 | |||
479cf6a937 | |||
acea57bcba | |||
64e8aa2816 | |||
38801b52a7 | |||
e73f39cfa9 | |||
7536ca8683 | |||
493991edd1 | |||
29003eae80 | |||
79b977a55a | |||
df9083c3e2 | |||
f3e7f4f229 | |||
12864cdb44 | |||
671a0a8391 | |||
553b1c1fcd | |||
f040c6454d | |||
f0599f6d54 | |||
042bb964e5 | |||
a3089ef956 | |||
0683a11b78 | |||
532fbb352c | |||
a1a02a1230 | |||
e5146a7cd5 | |||
dedbe43c3e | |||
218c6b4672 | |||
800e9756c5 | |||
24e1d948f2 | |||
bf758803cc |
2
.github/workflows/build-test.yml
vendored
2
.github/workflows/build-test.yml
vendored
@ -49,7 +49,7 @@ jobs:
|
||||
KITTYCAD_API_TOKEN: ${{secrets.KITTYCAD_API_TOKEN}}
|
||||
|
||||
- name: Upload coverage to Codecov
|
||||
uses: codecov/codecov-action@v3
|
||||
uses: codecov/codecov-action@v4
|
||||
with:
|
||||
token: ${{ secrets.CODECOV_TOKEN }}
|
||||
fail_ci_if_error: true
|
||||
|
2
.github/workflows/make-release.yml
vendored
2
.github/workflows/make-release.yml
vendored
@ -28,4 +28,4 @@ jobs:
|
||||
# TODO: generate a nice little doc for the release text like we do for the
|
||||
# cli repo.
|
||||
- name: Create a Release
|
||||
uses: softprops/action-gh-release@v1
|
||||
uses: softprops/action-gh-release@v2
|
||||
|
2
.github/workflows/ruff.yml
vendored
2
.github/workflows/ruff.yml
vendored
@ -35,4 +35,4 @@ jobs:
|
||||
- name: Run ruff
|
||||
shell: bash
|
||||
run: |
|
||||
poetry run ruff check --format=github .
|
||||
poetry run ruff check --output-format=github .
|
||||
|
3
.github/workflows/update-spec-for-docs.yml
vendored
3
.github/workflows/update-spec-for-docs.yml
vendored
@ -67,6 +67,9 @@ jobs:
|
||||
gh pr create --title "Update lang spec docs for python" \
|
||||
--body "Updating the generated docs for python" \
|
||||
--head "$NEW_BRANCH" \
|
||||
--reviewer jessfraz \
|
||||
--reviewer irev-dev \
|
||||
--reviewer franknoirot \
|
||||
--base main || true
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
|
||||
|
@ -154,10 +154,19 @@ class WebSocket:
|
||||
self.ws = sync(
|
||||
{% for arg in args %}
|
||||
{% if arg.in_query %}
|
||||
{% if arg.is_optional == False %}
|
||||
{{arg.name}},
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
client=client,
|
||||
{% for arg in args %}
|
||||
{% if arg.in_query %}
|
||||
{% if arg.is_optional %}
|
||||
{{arg.name}}={{arg.name}},
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
)
|
||||
|
||||
def __enter__(self,
|
||||
|
@ -233,7 +233,11 @@ def generateTypeAndExamplePython(
|
||||
elif (
|
||||
schema["type"] == "number"
|
||||
and "format" in schema
|
||||
and (schema["format"] == "float" or schema["format"] == "double")
|
||||
and (
|
||||
schema["format"] == "float"
|
||||
or schema["format"] == "double"
|
||||
or schema["format"] == "money-usd"
|
||||
)
|
||||
):
|
||||
parameter_type = "float"
|
||||
parameter_example = "3.14"
|
||||
@ -474,11 +478,16 @@ from kittycad.types import Response
|
||||
for endpoint_ref in endpoint_refs:
|
||||
if endpoint_ref == "Error":
|
||||
continue
|
||||
example_imports = example_imports + (
|
||||
"""from kittycad.models import """
|
||||
+ endpoint_ref.replace("List[", "").replace("]", "")
|
||||
+ "\n"
|
||||
)
|
||||
# For some reason, PrivacySettings is showing up twice so we want to skip
|
||||
# it here. Obviously this is a hack and we should fix the root cause.
|
||||
# When this happens again with another struct there might be a more obvious
|
||||
# solution, but alas, I am lazy.
|
||||
if endpoint_ref != "PrivacySettings" and endpoint_ref != "List[str]":
|
||||
example_imports = example_imports + (
|
||||
"""from kittycad.models import """
|
||||
+ endpoint_ref.replace("List[", "").replace("]", "")
|
||||
+ "\n"
|
||||
)
|
||||
example_imports = (
|
||||
example_imports + "from typing import Union, Any, Optional, List, Tuple\n"
|
||||
)
|
||||
@ -518,7 +527,7 @@ from kittycad.types import Response
|
||||
|
||||
short_sync_example = short_sync_example + (
|
||||
"""
|
||||
if isinstance(result, Error) or result == None:
|
||||
if isinstance(result, Error) or result is None:
|
||||
print(result)
|
||||
raise Exception("Error in response")
|
||||
|
||||
@ -837,6 +846,20 @@ async def test_"""
|
||||
"\t\t\tfor item in response.json()\n"
|
||||
)
|
||||
parse_response.write("\t\t]\n")
|
||||
elif "type" in items:
|
||||
if items["type"] == "string":
|
||||
parse_response.write(
|
||||
"\t\tresponse_"
|
||||
+ response_code
|
||||
+ " = [\n"
|
||||
)
|
||||
parse_response.write("\t\t\tstr(**item)\n")
|
||||
parse_response.write(
|
||||
"\t\t\tfor item in response.json()\n"
|
||||
)
|
||||
parse_response.write("\t\t]\n")
|
||||
else:
|
||||
raise Exception("Unknown array type", items)
|
||||
else:
|
||||
raise Exception("Unknown array type")
|
||||
elif json["type"] == "string":
|
||||
@ -845,7 +868,17 @@ async def test_"""
|
||||
+ response_code
|
||||
+ " = response.text\n"
|
||||
)
|
||||
elif (
|
||||
json["type"] == "object"
|
||||
and "additionalProperties" in json
|
||||
):
|
||||
parse_response.write(
|
||||
"\t\tresponse_"
|
||||
+ response_code
|
||||
+ " = response.json()\n"
|
||||
)
|
||||
else:
|
||||
print(json)
|
||||
raise Exception("Unknown type", json["type"])
|
||||
else:
|
||||
parse_response.write(
|
||||
@ -1017,7 +1050,7 @@ def generateType(path: str, name: str, schema: dict, data: dict):
|
||||
elif type_name == "integer":
|
||||
generateIntegerType(file_path, name, schema, type_name)
|
||||
elif type_name == "number":
|
||||
generateIntegerType(file_path, name, schema, type_name)
|
||||
generateFloatType(file_path, name, schema, type_name)
|
||||
elif type_name == "string":
|
||||
generateStringType(file_path, name, schema, type_name)
|
||||
else:
|
||||
@ -1237,7 +1270,7 @@ def generateAnyOfType(path: str, name: str, schema: dict, data: dict):
|
||||
f.write("from ." + camel_to_snake(ref_name) + " import " + ref_name + "\n")
|
||||
all_options.append(ref_name)
|
||||
|
||||
if isNestedObjectOneOf(schema):
|
||||
if isNestedObjectAnyOf(schema):
|
||||
# We want to write each of the nested objects.
|
||||
for any_of in schema["anyOf"]:
|
||||
# Get the nested object.
|
||||
@ -1293,6 +1326,47 @@ def generateAnyOfType(path: str, name: str, schema: dict, data: dict):
|
||||
f.write(object_code)
|
||||
f.write("\n")
|
||||
all_options.append(object_name)
|
||||
else:
|
||||
# We want to write each of the nested objects.
|
||||
for any_of in schema["anyOf"]:
|
||||
# Get the nested object.
|
||||
if "properties" in any_of:
|
||||
for prop_name in any_of["properties"]:
|
||||
nested_object = any_of["properties"][prop_name]
|
||||
if nested_object == {}:
|
||||
f.write("from typing import Any\n")
|
||||
f.write(prop_name + " = Any\n")
|
||||
f.write("\n")
|
||||
all_options.append(prop_name)
|
||||
elif "$ref" in nested_object:
|
||||
ref = nested_object["$ref"]
|
||||
ref_name = ref[ref.rfind("/") + 1 :]
|
||||
f.write(
|
||||
"from ."
|
||||
+ camel_to_snake(ref_name)
|
||||
+ " import "
|
||||
+ ref_name
|
||||
+ "\n"
|
||||
)
|
||||
f.write("\n")
|
||||
if prop_name != ref_name:
|
||||
f.write(prop_name + " = " + ref_name + "\n")
|
||||
f.write("\n")
|
||||
all_options.append(prop_name)
|
||||
else:
|
||||
object_code = generateObjectTypeCode(
|
||||
prop_name, nested_object, "object", data, None, None
|
||||
)
|
||||
f.write(object_code)
|
||||
f.write("\n")
|
||||
all_options.append(prop_name)
|
||||
elif "type" in any_of and any_of["type"] == "string":
|
||||
enum_code = generateEnumTypeCode(
|
||||
any_of["enum"][0], any_of, "string", []
|
||||
)
|
||||
f.write(enum_code)
|
||||
f.write("\n")
|
||||
all_options.append(any_of["enum"][0])
|
||||
|
||||
# Write the sum type.
|
||||
description = getAnyOfDescription(schema)
|
||||
@ -1500,6 +1574,24 @@ def generateOneOfType(path: str, name: str, schema: dict, data: dict):
|
||||
f.write(object_code)
|
||||
f.write("\n")
|
||||
all_options.append(object_name)
|
||||
else:
|
||||
# Generate each of the options from the tag.
|
||||
i = 0
|
||||
for one_of in schema["oneOf"]:
|
||||
# Get the value of the tag.
|
||||
object_name = name + str(i)
|
||||
object_code = generateObjectTypeCode(
|
||||
object_name,
|
||||
one_of,
|
||||
"object",
|
||||
data,
|
||||
None,
|
||||
None,
|
||||
)
|
||||
f.write(object_code)
|
||||
f.write("\n")
|
||||
all_options.append(object_name)
|
||||
i += 1
|
||||
|
||||
# Write the sum type.
|
||||
description = getOneOfDescription(schema)
|
||||
@ -1545,7 +1637,7 @@ def generateObjectTypeCode(
|
||||
|
||||
description = ""
|
||||
if "description" in schema:
|
||||
description = schema["description"]
|
||||
description = schema["description"].replace('"', '\\"')
|
||||
|
||||
imports = []
|
||||
refs = getRefs(schema)
|
||||
@ -1645,8 +1737,9 @@ def getRefs(schema: dict) -> List[str]:
|
||||
# do nothing
|
||||
pass
|
||||
else:
|
||||
logging.error("unsupported type: ", schema)
|
||||
raise Exception("unsupported type: ", schema)
|
||||
# This is likely an empty object like above but with a description
|
||||
# so we will just skip it.
|
||||
pass
|
||||
elif type_name == "array":
|
||||
if "items" in schema:
|
||||
schema_refs = getRefs(schema["items"])
|
||||
@ -1690,11 +1783,21 @@ def getEndpointRefs(endpoint: dict, data: dict) -> List[str]:
|
||||
if "$ref" in items:
|
||||
ref = items["$ref"].replace("#/components/schemas/", "")
|
||||
refs.append("List[" + ref + "]")
|
||||
elif "type" in items:
|
||||
if items["type"] == "string":
|
||||
refs.append("List[str]")
|
||||
else:
|
||||
raise Exception("Unknown array type", items)
|
||||
else:
|
||||
raise Exception("Unknown array type")
|
||||
raise Exception("Unknown array type", items)
|
||||
elif json["type"] == "string":
|
||||
refs.append("str")
|
||||
elif (
|
||||
json["type"] == "object" and "additionalProperties" in json
|
||||
):
|
||||
refs.append("dict")
|
||||
else:
|
||||
print(json)
|
||||
raise Exception("Unknown type ", json["type"])
|
||||
else:
|
||||
refs.append("dict")
|
||||
@ -1764,6 +1867,11 @@ def getRequestBodyRefs(endpoint: dict) -> List[str]:
|
||||
if "$ref" in form:
|
||||
ref = form["$ref"].replace("#/components/schemas/", "")
|
||||
refs.append(ref)
|
||||
elif content_type == "multipart/form-data":
|
||||
form = content[content_type]["schema"]
|
||||
if "$ref" in form:
|
||||
ref = form["$ref"].replace("#/components/schemas/", "")
|
||||
refs.append(ref)
|
||||
else:
|
||||
# Throw an error for an unsupported content type.
|
||||
logging.error("content: ", content)
|
||||
@ -1802,6 +1910,15 @@ def getRequestBodyTypeSchema(
|
||||
elif form != {}:
|
||||
logging.error("not a ref: ", form)
|
||||
raise Exception("not a ref")
|
||||
elif content_type == "multipart/form-data":
|
||||
form = content[content_type]["schema"]
|
||||
if "$ref" in form:
|
||||
ref = form["$ref"].replace("#/components/schemas/", "")
|
||||
type_schema = data["components"]["schemas"][ref]
|
||||
return ref, type_schema
|
||||
elif form != {}:
|
||||
type_schema = form
|
||||
return None, type_schema
|
||||
else:
|
||||
logging.error("unsupported content type: ", content_type)
|
||||
raise Exception("unsupported content type")
|
||||
@ -1877,6 +1994,40 @@ def getOneOfRefType(schema: dict) -> str:
|
||||
raise Exception("Cannot get oneOf ref type for schema: ", schema)
|
||||
|
||||
|
||||
def isNestedObjectAnyOf(schema: dict) -> bool:
|
||||
if "anyOf" not in schema:
|
||||
return False
|
||||
|
||||
is_nested_object = False
|
||||
for any_of in schema["anyOf"]:
|
||||
# Check if each are an object w 1 property in it.
|
||||
if (
|
||||
"type" in any_of
|
||||
and any_of["type"] == "object"
|
||||
and "properties" in any_of
|
||||
and len(any_of["properties"]) == 1
|
||||
):
|
||||
for prop_name in any_of["properties"]:
|
||||
nested_object = any_of["properties"][prop_name]
|
||||
if "type" in nested_object and nested_object["type"] == "object":
|
||||
is_nested_object = True
|
||||
else:
|
||||
is_nested_object = False
|
||||
break
|
||||
elif (
|
||||
"type" in any_of
|
||||
and any_of["type"] == "string"
|
||||
and "enum" in any_of
|
||||
and len(any_of["enum"]) == 1
|
||||
):
|
||||
is_nested_object = True
|
||||
else:
|
||||
is_nested_object = False
|
||||
break
|
||||
|
||||
return is_nested_object
|
||||
|
||||
|
||||
def isNestedObjectOneOf(schema: dict) -> bool:
|
||||
if "oneOf" not in schema:
|
||||
return False
|
||||
@ -1885,7 +2036,8 @@ def isNestedObjectOneOf(schema: dict) -> bool:
|
||||
for one_of in schema["oneOf"]:
|
||||
# Check if each are an object w 1 property in it.
|
||||
if (
|
||||
one_of["type"] == "object"
|
||||
"type" in one_of
|
||||
and one_of["type"] == "object"
|
||||
and "properties" in one_of
|
||||
and len(one_of["properties"]) == 1
|
||||
):
|
||||
@ -1897,7 +2049,10 @@ def isNestedObjectOneOf(schema: dict) -> bool:
|
||||
is_nested_object = False
|
||||
break
|
||||
elif (
|
||||
one_of["type"] == "string" and "enum" in one_of and len(one_of["enum"]) == 1
|
||||
"type" in one_of
|
||||
and one_of["type"] == "string"
|
||||
and "enum" in one_of
|
||||
and len(one_of["enum"]) == 1
|
||||
):
|
||||
is_nested_object = True
|
||||
else:
|
||||
|
@ -20,9 +20,9 @@ poetry run python generate/generate.py
|
||||
|
||||
# Format and lint.
|
||||
poetry run isort .
|
||||
poetry run black . generate/generate.py docs/conf.py kittycad/client_test.py kittycad/examples_test.py
|
||||
poetry run black . generate/generate.py docs/conf.py kittycad/client_test.py kittycad/examples_test.py kittycad/models/*.py kittycad/api/*.py kittycad/api/*/*.py
|
||||
poetry run ruff check --fix .
|
||||
poetry run mypy .
|
||||
poetry run mypy . || true
|
||||
|
||||
|
||||
# Run the tests.
|
||||
|
File diff suppressed because it is too large
Load Diff
116
kittycad/api/ai/create_kcl_code_completions.py
Normal file
116
kittycad/api/ai/create_kcl_code_completions.py
Normal file
@ -0,0 +1,116 @@
|
||||
from typing import Any, Dict, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import Client
|
||||
from ...models.error import Error
|
||||
from ...models.kcl_code_completion_request import KclCodeCompletionRequest
|
||||
from ...models.kcl_code_completion_response import KclCodeCompletionResponse
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
body: KclCodeCompletionRequest,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/ai/kcl/completions".format(
|
||||
client.base_url,
|
||||
) # noqa: E501
|
||||
|
||||
headers: Dict[str, Any] = client.get_headers()
|
||||
cookies: Dict[str, Any] = client.get_cookies()
|
||||
|
||||
return {
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
"content": body.model_dump_json(),
|
||||
}
|
||||
|
||||
|
||||
def _parse_response(
|
||||
*, response: httpx.Response
|
||||
) -> Optional[Union[KclCodeCompletionResponse, Error]]:
|
||||
if response.status_code == 201:
|
||||
response_201 = KclCodeCompletionResponse(**response.json())
|
||||
return response_201
|
||||
if response.status_code == 400:
|
||||
response_4XX = Error(**response.json())
|
||||
return response_4XX
|
||||
if response.status_code == 500:
|
||||
response_5XX = Error(**response.json())
|
||||
return response_5XX
|
||||
return Error(**response.json())
|
||||
|
||||
|
||||
def _build_response(
|
||||
*, response: httpx.Response
|
||||
) -> Response[Optional[Union[KclCodeCompletionResponse, Error]]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
body: KclCodeCompletionRequest,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Optional[Union[KclCodeCompletionResponse, Error]]]:
|
||||
kwargs = _get_kwargs(
|
||||
body=body,
|
||||
client=client,
|
||||
)
|
||||
|
||||
response = httpx.post(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
body: KclCodeCompletionRequest,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[KclCodeCompletionResponse, Error]]:
|
||||
|
||||
return sync_detailed(
|
||||
body=body,
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
body: KclCodeCompletionRequest,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Optional[Union[KclCodeCompletionResponse, Error]]]:
|
||||
kwargs = _get_kwargs(
|
||||
body=body,
|
||||
client=client,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
||||
response = await _client.post(**kwargs)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
body: KclCodeCompletionRequest,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[KclCodeCompletionResponse, Error]]:
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
body=body,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
@ -86,7 +86,6 @@ def sync(
|
||||
"""Because our source of truth for the resulting model is a STEP file, you will always have STEP file contents when you list your generated models. Any other formats you request here will also be returned when you list your generated models.
|
||||
This operation is performed asynchronously, the `id` of the operation will be returned. You can use the `id` returned from the request to get status information about the async operation from the `/async/operations/{id}` endpoint.
|
||||
One thing to note, if you hit the cache, this endpoint will return right away. So you only have to wait if the status is not `Completed` or `Failed`.
|
||||
This is an alpha endpoint. It will change in the future. The current output is honestly pretty bad. So if you find this endpoint, you get what you pay for, which currently is nothing. But in the future will be made a lot better.
|
||||
""" # noqa: E501
|
||||
|
||||
return sync_detailed(
|
||||
@ -123,7 +122,6 @@ async def asyncio(
|
||||
"""Because our source of truth for the resulting model is a STEP file, you will always have STEP file contents when you list your generated models. Any other formats you request here will also be returned when you list your generated models.
|
||||
This operation is performed asynchronously, the `id` of the operation will be returned. You can use the `id` returned from the request to get status information about the async operation from the `/async/operations/{id}` endpoint.
|
||||
One thing to note, if you hit the cache, this endpoint will return right away. So you only have to wait if the status is not `Completed` or `Failed`.
|
||||
This is an alpha endpoint. It will change in the future. The current output is honestly pretty bad. So if you find this endpoint, you get what you pay for, which currently is nothing. But in the future will be made a lot better.
|
||||
""" # noqa: E501
|
||||
|
||||
return (
|
||||
|
@ -20,6 +20,7 @@ def _get_kwargs(
|
||||
) # noqa: E501
|
||||
|
||||
if feedback is not None:
|
||||
|
||||
if "?" in url:
|
||||
url = url + "&feedback=" + str(feedback)
|
||||
else:
|
||||
|
@ -21,18 +21,21 @@ def _get_kwargs(
|
||||
) # noqa: E501
|
||||
|
||||
if limit is not None:
|
||||
|
||||
if "?" in url:
|
||||
url = url + "&limit=" + str(limit)
|
||||
else:
|
||||
url = url + "?limit=" + str(limit)
|
||||
|
||||
if page_token is not None:
|
||||
|
||||
if "?" in url:
|
||||
url = url + "&page_token=" + str(page_token)
|
||||
else:
|
||||
url = url + "?page_token=" + str(page_token)
|
||||
|
||||
if sort_by is not None:
|
||||
|
||||
if "?" in url:
|
||||
url = url + "&sort_by=" + str(sort_by)
|
||||
else:
|
||||
|
@ -22,24 +22,28 @@ def _get_kwargs(
|
||||
) # noqa: E501
|
||||
|
||||
if limit is not None:
|
||||
|
||||
if "?" in url:
|
||||
url = url + "&limit=" + str(limit)
|
||||
else:
|
||||
url = url + "?limit=" + str(limit)
|
||||
|
||||
if page_token is not None:
|
||||
|
||||
if "?" in url:
|
||||
url = url + "&page_token=" + str(page_token)
|
||||
else:
|
||||
url = url + "?page_token=" + str(page_token)
|
||||
|
||||
if sort_by is not None:
|
||||
|
||||
if "?" in url:
|
||||
url = url + "&sort_by=" + str(sort_by)
|
||||
else:
|
||||
url = url + "?sort_by=" + str(sort_by)
|
||||
|
||||
if no_models is not None:
|
||||
|
||||
if "?" in url:
|
||||
url = url + "&no_models=" + str(no_models)
|
||||
else:
|
||||
|
@ -19,6 +19,7 @@ def _get_kwargs(
|
||||
) # noqa: E501
|
||||
|
||||
if group_by is not None:
|
||||
|
||||
if "?" in url:
|
||||
url = url + "&group_by=" + str(group_by)
|
||||
else:
|
||||
|
@ -35,9 +35,7 @@ def _get_kwargs(
|
||||
}
|
||||
|
||||
|
||||
def _parse_response(
|
||||
*, response: httpx.Response
|
||||
) -> Optional[
|
||||
def _parse_response(*, response: httpx.Response) -> Optional[
|
||||
Union[
|
||||
FileConversion,
|
||||
FileCenterOfMass,
|
||||
@ -123,9 +121,7 @@ def _parse_response(
|
||||
return Error(**response.json())
|
||||
|
||||
|
||||
def _build_response(
|
||||
*, response: httpx.Response
|
||||
) -> Response[
|
||||
def _build_response(*, response: httpx.Response) -> Response[
|
||||
Optional[
|
||||
Union[
|
||||
FileConversion,
|
||||
|
@ -21,18 +21,21 @@ def _get_kwargs(
|
||||
) # noqa: E501
|
||||
|
||||
if limit is not None:
|
||||
|
||||
if "?" in url:
|
||||
url = url + "&limit=" + str(limit)
|
||||
else:
|
||||
url = url + "?limit=" + str(limit)
|
||||
|
||||
if page_token is not None:
|
||||
|
||||
if "?" in url:
|
||||
url = url + "&page_token=" + str(page_token)
|
||||
else:
|
||||
url = url + "?page_token=" + str(page_token)
|
||||
|
||||
if sort_by is not None:
|
||||
|
||||
if "?" in url:
|
||||
url = url + "&sort_by=" + str(sort_by)
|
||||
else:
|
||||
|
@ -23,18 +23,21 @@ def _get_kwargs(
|
||||
) # noqa: E501
|
||||
|
||||
if limit is not None:
|
||||
|
||||
if "?" in url:
|
||||
url = url + "&limit=" + str(limit)
|
||||
else:
|
||||
url = url + "?limit=" + str(limit)
|
||||
|
||||
if page_token is not None:
|
||||
|
||||
if "?" in url:
|
||||
url = url + "&page_token=" + str(page_token)
|
||||
else:
|
||||
url = url + "?page_token=" + str(page_token)
|
||||
|
||||
if sort_by is not None:
|
||||
|
||||
if "?" in url:
|
||||
url = url + "&sort_by=" + str(sort_by)
|
||||
else:
|
||||
|
@ -23,24 +23,28 @@ def _get_kwargs(
|
||||
) # noqa: E501
|
||||
|
||||
if limit is not None:
|
||||
|
||||
if "?" in url:
|
||||
url = url + "&limit=" + str(limit)
|
||||
else:
|
||||
url = url + "?limit=" + str(limit)
|
||||
|
||||
if page_token is not None:
|
||||
|
||||
if "?" in url:
|
||||
url = url + "&page_token=" + str(page_token)
|
||||
else:
|
||||
url = url + "?page_token=" + str(page_token)
|
||||
|
||||
if sort_by is not None:
|
||||
|
||||
if "?" in url:
|
||||
url = url + "&sort_by=" + str(sort_by)
|
||||
else:
|
||||
url = url + "?sort_by=" + str(sort_by)
|
||||
|
||||
if status is not None:
|
||||
|
||||
if "?" in url:
|
||||
url = url + "&status=" + str(status)
|
||||
else:
|
||||
|
@ -21,18 +21,21 @@ def _get_kwargs(
|
||||
) # noqa: E501
|
||||
|
||||
if limit is not None:
|
||||
|
||||
if "?" in url:
|
||||
url = url + "&limit=" + str(limit)
|
||||
else:
|
||||
url = url + "?limit=" + str(limit)
|
||||
|
||||
if page_token is not None:
|
||||
|
||||
if "?" in url:
|
||||
url = url + "&page_token=" + str(page_token)
|
||||
else:
|
||||
url = url + "?page_token=" + str(page_token)
|
||||
|
||||
if sort_by is not None:
|
||||
|
||||
if "?" in url:
|
||||
url = url + "&sort_by=" + str(sort_by)
|
||||
else:
|
||||
|
@ -21,18 +21,21 @@ def _get_kwargs(
|
||||
) # noqa: E501
|
||||
|
||||
if limit is not None:
|
||||
|
||||
if "?" in url:
|
||||
url = url + "&limit=" + str(limit)
|
||||
else:
|
||||
url = url + "?limit=" + str(limit)
|
||||
|
||||
if page_token is not None:
|
||||
|
||||
if "?" in url:
|
||||
url = url + "&page_token=" + str(page_token)
|
||||
else:
|
||||
url = url + "?page_token=" + str(page_token)
|
||||
|
||||
if sort_by is not None:
|
||||
|
||||
if "?" in url:
|
||||
url = url + "&sort_by=" + str(sort_by)
|
||||
else:
|
||||
|
@ -18,6 +18,7 @@ def _get_kwargs(
|
||||
) # noqa: E501
|
||||
|
||||
if label is not None:
|
||||
|
||||
if "?" in url:
|
||||
url = url + "&label=" + str(label)
|
||||
else:
|
||||
|
@ -21,18 +21,21 @@ def _get_kwargs(
|
||||
) # noqa: E501
|
||||
|
||||
if limit is not None:
|
||||
|
||||
if "?" in url:
|
||||
url = url + "&limit=" + str(limit)
|
||||
else:
|
||||
url = url + "?limit=" + str(limit)
|
||||
|
||||
if page_token is not None:
|
||||
|
||||
if "?" in url:
|
||||
url = url + "&page_token=" + str(page_token)
|
||||
else:
|
||||
url = url + "?page_token=" + str(page_token)
|
||||
|
||||
if sort_by is not None:
|
||||
|
||||
if "?" in url:
|
||||
url = url + "&sort_by=" + str(sort_by)
|
||||
else:
|
||||
|
@ -22,6 +22,7 @@ def _get_kwargs(
|
||||
) # noqa: E501
|
||||
|
||||
if output is not None:
|
||||
|
||||
if "?" in url:
|
||||
url = url + "&output=" + str(output)
|
||||
else:
|
||||
@ -40,9 +41,9 @@ def _get_kwargs(
|
||||
|
||||
|
||||
def _parse_response(*, response: httpx.Response) -> Optional[Union[CodeOutput, Error]]:
|
||||
if response.status_code == 200:
|
||||
response_200 = CodeOutput(**response.json())
|
||||
return response_200
|
||||
if response.status_code == 201:
|
||||
response_201 = CodeOutput(**response.json())
|
||||
return response_201
|
||||
if response.status_code == 400:
|
||||
response_4XX = Error(**response.json())
|
||||
return response_4XX
|
||||
@ -92,6 +93,7 @@ def sync(
|
||||
client: Client,
|
||||
output: Optional[str] = None,
|
||||
) -> Optional[Union[CodeOutput, Error]]:
|
||||
|
||||
return sync_detailed(
|
||||
lang=lang,
|
||||
output=output,
|
||||
@ -127,6 +129,7 @@ async def asyncio(
|
||||
client: Client,
|
||||
output: Optional[str] = None,
|
||||
) -> Optional[Union[CodeOutput, Error]]:
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
lang=lang,
|
||||
|
@ -22,12 +22,14 @@ def _get_kwargs(
|
||||
) # noqa: E501
|
||||
|
||||
if output_unit is not None:
|
||||
|
||||
if "?" in url:
|
||||
url = url + "&output_unit=" + str(output_unit)
|
||||
else:
|
||||
url = url + "?output_unit=" + str(output_unit)
|
||||
|
||||
if src_format is not None:
|
||||
|
||||
if "?" in url:
|
||||
url = url + "&src_format=" + str(src_format)
|
||||
else:
|
||||
|
@ -25,24 +25,28 @@ def _get_kwargs(
|
||||
) # noqa: E501
|
||||
|
||||
if material_mass is not None:
|
||||
|
||||
if "?" in url:
|
||||
url = url + "&material_mass=" + str(material_mass)
|
||||
else:
|
||||
url = url + "?material_mass=" + str(material_mass)
|
||||
|
||||
if material_mass_unit is not None:
|
||||
|
||||
if "?" in url:
|
||||
url = url + "&material_mass_unit=" + str(material_mass_unit)
|
||||
else:
|
||||
url = url + "?material_mass_unit=" + str(material_mass_unit)
|
||||
|
||||
if output_unit is not None:
|
||||
|
||||
if "?" in url:
|
||||
url = url + "&output_unit=" + str(output_unit)
|
||||
else:
|
||||
url = url + "?output_unit=" + str(output_unit)
|
||||
|
||||
if src_format is not None:
|
||||
|
||||
if "?" in url:
|
||||
url = url + "&src_format=" + str(src_format)
|
||||
else:
|
||||
|
@ -25,24 +25,28 @@ def _get_kwargs(
|
||||
) # noqa: E501
|
||||
|
||||
if material_density is not None:
|
||||
|
||||
if "?" in url:
|
||||
url = url + "&material_density=" + str(material_density)
|
||||
else:
|
||||
url = url + "?material_density=" + str(material_density)
|
||||
|
||||
if material_density_unit is not None:
|
||||
|
||||
if "?" in url:
|
||||
url = url + "&material_density_unit=" + str(material_density_unit)
|
||||
else:
|
||||
url = url + "?material_density_unit=" + str(material_density_unit)
|
||||
|
||||
if output_unit is not None:
|
||||
|
||||
if "?" in url:
|
||||
url = url + "&output_unit=" + str(output_unit)
|
||||
else:
|
||||
url = url + "?output_unit=" + str(output_unit)
|
||||
|
||||
if src_format is not None:
|
||||
|
||||
if "?" in url:
|
||||
url = url + "&src_format=" + str(src_format)
|
||||
else:
|
||||
|
@ -22,12 +22,14 @@ def _get_kwargs(
|
||||
) # noqa: E501
|
||||
|
||||
if output_unit is not None:
|
||||
|
||||
if "?" in url:
|
||||
url = url + "&output_unit=" + str(output_unit)
|
||||
else:
|
||||
url = url + "?output_unit=" + str(output_unit)
|
||||
|
||||
if src_format is not None:
|
||||
|
||||
if "?" in url:
|
||||
url = url + "&src_format=" + str(src_format)
|
||||
else:
|
||||
|
@ -22,12 +22,14 @@ def _get_kwargs(
|
||||
) # noqa: E501
|
||||
|
||||
if output_unit is not None:
|
||||
|
||||
if "?" in url:
|
||||
url = url + "&output_unit=" + str(output_unit)
|
||||
else:
|
||||
url = url + "?output_unit=" + str(output_unit)
|
||||
|
||||
if src_format is not None:
|
||||
|
||||
if "?" in url:
|
||||
url = url + "&src_format=" + str(src_format)
|
||||
else:
|
||||
|
@ -5,7 +5,7 @@ import httpx
|
||||
from ...client import Client
|
||||
from ...models.email_authentication_form import EmailAuthenticationForm
|
||||
from ...models.error import Error
|
||||
from ...models.verification_token import VerificationToken
|
||||
from ...models.verification_token_response import VerificationTokenResponse
|
||||
from ...types import Response
|
||||
|
||||
|
||||
@ -32,9 +32,9 @@ def _get_kwargs(
|
||||
|
||||
def _parse_response(
|
||||
*, response: httpx.Response
|
||||
) -> Optional[Union[VerificationToken, Error]]:
|
||||
) -> Optional[Union[VerificationTokenResponse, Error]]:
|
||||
if response.status_code == 201:
|
||||
response_201 = VerificationToken(**response.json())
|
||||
response_201 = VerificationTokenResponse(**response.json())
|
||||
return response_201
|
||||
if response.status_code == 400:
|
||||
response_4XX = Error(**response.json())
|
||||
@ -47,7 +47,7 @@ def _parse_response(
|
||||
|
||||
def _build_response(
|
||||
*, response: httpx.Response
|
||||
) -> Response[Optional[Union[VerificationToken, Error]]]:
|
||||
) -> Response[Optional[Union[VerificationTokenResponse, Error]]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
@ -60,7 +60,7 @@ def sync_detailed(
|
||||
body: EmailAuthenticationForm,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Optional[Union[VerificationToken, Error]]]:
|
||||
) -> Response[Optional[Union[VerificationTokenResponse, Error]]]:
|
||||
kwargs = _get_kwargs(
|
||||
body=body,
|
||||
client=client,
|
||||
@ -78,7 +78,8 @@ def sync(
|
||||
body: EmailAuthenticationForm,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[VerificationToken, Error]]:
|
||||
) -> Optional[Union[VerificationTokenResponse, Error]]:
|
||||
|
||||
return sync_detailed(
|
||||
body=body,
|
||||
client=client,
|
||||
@ -89,7 +90,7 @@ async def asyncio_detailed(
|
||||
body: EmailAuthenticationForm,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Optional[Union[VerificationToken, Error]]]:
|
||||
) -> Response[Optional[Union[VerificationTokenResponse, Error]]]:
|
||||
kwargs = _get_kwargs(
|
||||
body=body,
|
||||
client=client,
|
||||
@ -105,7 +106,8 @@ async def asyncio(
|
||||
body: EmailAuthenticationForm,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[VerificationToken, Error]]:
|
||||
) -> Optional[Union[VerificationTokenResponse, Error]]:
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
body=body,
|
||||
|
@ -19,18 +19,21 @@ def _get_kwargs(
|
||||
) # noqa: E501
|
||||
|
||||
if callback_url is not None:
|
||||
|
||||
if "?" in url:
|
||||
url = url + "&callback_url=" + str(callback_url)
|
||||
else:
|
||||
url = url + "?callback_url=" + str(callback_url)
|
||||
|
||||
if email is not None:
|
||||
|
||||
if "?" in url:
|
||||
url = url + "&email=" + str(email)
|
||||
else:
|
||||
url = url + "?email=" + str(email)
|
||||
|
||||
if token is not None:
|
||||
|
||||
if "?" in url:
|
||||
url = url + "&token=" + str(token)
|
||||
else:
|
||||
@ -96,6 +99,7 @@ def sync(
|
||||
client: Client,
|
||||
callback_url: Optional[str] = None,
|
||||
) -> Optional[Error]:
|
||||
|
||||
return sync_detailed(
|
||||
callback_url=callback_url,
|
||||
email=email,
|
||||
@ -131,6 +135,7 @@ async def asyncio(
|
||||
client: Client,
|
||||
callback_url: Optional[str] = None,
|
||||
) -> Optional[Error]:
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
callback_url=callback_url,
|
||||
|
127
kittycad/api/hidden/get_auth_saml.py
Normal file
127
kittycad/api/hidden/get_auth_saml.py
Normal file
@ -0,0 +1,127 @@
|
||||
from typing import Any, Dict, Optional
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import Client
|
||||
from ...models.error import Error
|
||||
from ...models.uuid import Uuid
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
provider_id: Uuid,
|
||||
*,
|
||||
client: Client,
|
||||
callback_url: Optional[str] = None,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/auth/saml/provider/{provider_id}/login".format(
|
||||
client.base_url,
|
||||
provider_id=provider_id,
|
||||
) # noqa: E501
|
||||
|
||||
if callback_url is not None:
|
||||
|
||||
if "?" in url:
|
||||
url = url + "&callback_url=" + str(callback_url)
|
||||
else:
|
||||
url = url + "?callback_url=" + str(callback_url)
|
||||
|
||||
headers: Dict[str, Any] = client.get_headers()
|
||||
cookies: Dict[str, Any] = client.get_cookies()
|
||||
|
||||
return {
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
}
|
||||
|
||||
|
||||
def _parse_response(*, response: httpx.Response) -> Optional[Error]:
|
||||
return None
|
||||
if response.status_code == 400:
|
||||
response_4XX = Error(**response.json())
|
||||
return response_4XX
|
||||
if response.status_code == 500:
|
||||
response_5XX = Error(**response.json())
|
||||
return response_5XX
|
||||
return Error(**response.json())
|
||||
|
||||
|
||||
def _build_response(*, response: httpx.Response) -> Response[Optional[Error]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
provider_id: Uuid,
|
||||
*,
|
||||
client: Client,
|
||||
callback_url: Optional[str] = None,
|
||||
) -> Response[Optional[Error]]:
|
||||
kwargs = _get_kwargs(
|
||||
provider_id=provider_id,
|
||||
callback_url=callback_url,
|
||||
client=client,
|
||||
)
|
||||
|
||||
response = httpx.get(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
provider_id: Uuid,
|
||||
*,
|
||||
client: Client,
|
||||
callback_url: Optional[str] = None,
|
||||
) -> Optional[Error]:
|
||||
"""The UI uses this to avoid having to ask the API anything about the IdP. It already knows the SAML IdP ID from the path, so it can just link to this path and rely on the API to redirect to the actual IdP.""" # noqa: E501
|
||||
|
||||
return sync_detailed(
|
||||
provider_id=provider_id,
|
||||
callback_url=callback_url,
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
provider_id: Uuid,
|
||||
*,
|
||||
client: Client,
|
||||
callback_url: Optional[str] = None,
|
||||
) -> Response[Optional[Error]]:
|
||||
kwargs = _get_kwargs(
|
||||
provider_id=provider_id,
|
||||
callback_url=callback_url,
|
||||
client=client,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
||||
response = await _client.get(**kwargs)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
provider_id: Uuid,
|
||||
*,
|
||||
client: Client,
|
||||
callback_url: Optional[str] = None,
|
||||
) -> Optional[Error]:
|
||||
"""The UI uses this to avoid having to ask the API anything about the IdP. It already knows the SAML IdP ID from the path, so it can just link to this path and rely on the API to redirect to the actual IdP.""" # noqa: E501
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
provider_id=provider_id,
|
||||
callback_url=callback_url,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
119
kittycad/api/hidden/post_auth_saml.py
Normal file
119
kittycad/api/hidden/post_auth_saml.py
Normal file
@ -0,0 +1,119 @@
|
||||
from typing import Any, Dict, Optional
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import Client
|
||||
from ...models.error import Error
|
||||
from ...models.uuid import Uuid
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
provider_id: Uuid,
|
||||
body: bytes,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/auth/saml/provider/{provider_id}/login".format(
|
||||
client.base_url,
|
||||
provider_id=provider_id,
|
||||
) # noqa: E501
|
||||
|
||||
headers: Dict[str, Any] = client.get_headers()
|
||||
cookies: Dict[str, Any] = client.get_cookies()
|
||||
|
||||
return {
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
"content": body,
|
||||
}
|
||||
|
||||
|
||||
def _parse_response(*, response: httpx.Response) -> Optional[Error]:
|
||||
return None
|
||||
if response.status_code == 400:
|
||||
response_4XX = Error(**response.json())
|
||||
return response_4XX
|
||||
if response.status_code == 500:
|
||||
response_5XX = Error(**response.json())
|
||||
return response_5XX
|
||||
return Error(**response.json())
|
||||
|
||||
|
||||
def _build_response(*, response: httpx.Response) -> Response[Optional[Error]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
provider_id: Uuid,
|
||||
body: bytes,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Optional[Error]]:
|
||||
kwargs = _get_kwargs(
|
||||
provider_id=provider_id,
|
||||
body=body,
|
||||
client=client,
|
||||
)
|
||||
|
||||
response = httpx.post(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
provider_id: Uuid,
|
||||
body: bytes,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Error]:
|
||||
|
||||
return sync_detailed(
|
||||
provider_id=provider_id,
|
||||
body=body,
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
provider_id: Uuid,
|
||||
body: bytes,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Optional[Error]]:
|
||||
kwargs = _get_kwargs(
|
||||
provider_id=provider_id,
|
||||
body=body,
|
||||
client=client,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
||||
response = await _client.post(**kwargs)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
provider_id: Uuid,
|
||||
body: bytes,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Error]:
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
provider_id=provider_id,
|
||||
body=body,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
104
kittycad/api/meta/create_debug_uploads.py
Normal file
104
kittycad/api/meta/create_debug_uploads.py
Normal file
@ -0,0 +1,104 @@
|
||||
from typing import Any, Dict, List, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import Client
|
||||
from ...models.error import Error
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
*,
|
||||
client: Client,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/debug/uploads".format(
|
||||
client.base_url,
|
||||
) # noqa: E501
|
||||
|
||||
headers: Dict[str, Any] = client.get_headers()
|
||||
cookies: Dict[str, Any] = client.get_cookies()
|
||||
|
||||
return {
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
}
|
||||
|
||||
|
||||
def _parse_response(*, response: httpx.Response) -> Optional[Union[List[str], Error]]:
|
||||
if response.status_code == 201:
|
||||
response_201 = [str(**item) for item in response.json()]
|
||||
return response_201
|
||||
if response.status_code == 400:
|
||||
response_4XX = Error(**response.json())
|
||||
return response_4XX
|
||||
if response.status_code == 500:
|
||||
response_5XX = Error(**response.json())
|
||||
return response_5XX
|
||||
return Error(**response.json())
|
||||
|
||||
|
||||
def _build_response(
|
||||
*, response: httpx.Response
|
||||
) -> Response[Optional[Union[List[str], Error]]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Optional[Union[List[str], Error]]]:
|
||||
kwargs = _get_kwargs(
|
||||
client=client,
|
||||
)
|
||||
|
||||
response = httpx.post(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[List[str], Error]]:
|
||||
"""Do NOT send files here that you don't want to be public.""" # noqa: E501
|
||||
|
||||
return sync_detailed(
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Optional[Union[List[str], Error]]]:
|
||||
kwargs = _get_kwargs(
|
||||
client=client,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
||||
response = await _client.post(**kwargs)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[List[str], Error]]:
|
||||
"""Do NOT send files here that you don't want to be public.""" # noqa: E501
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
111
kittycad/api/meta/create_event.py
Normal file
111
kittycad/api/meta/create_event.py
Normal file
@ -0,0 +1,111 @@
|
||||
from typing import Any, Dict, Optional
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import Client
|
||||
from ...models.error import Error
|
||||
from ...models.event import Event
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
body: Event,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/events".format(
|
||||
client.base_url,
|
||||
) # noqa: E501
|
||||
|
||||
headers: Dict[str, Any] = client.get_headers()
|
||||
cookies: Dict[str, Any] = client.get_cookies()
|
||||
|
||||
return {
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
"content": body.model_dump_json(),
|
||||
}
|
||||
|
||||
|
||||
def _parse_response(*, response: httpx.Response) -> Optional[Error]:
|
||||
return None
|
||||
if response.status_code == 400:
|
||||
response_4XX = Error(**response.json())
|
||||
return response_4XX
|
||||
if response.status_code == 500:
|
||||
response_5XX = Error(**response.json())
|
||||
return response_5XX
|
||||
return Error(**response.json())
|
||||
|
||||
|
||||
def _build_response(*, response: httpx.Response) -> Response[Optional[Error]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
body: Event,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Optional[Error]]:
|
||||
kwargs = _get_kwargs(
|
||||
body=body,
|
||||
client=client,
|
||||
)
|
||||
|
||||
response = httpx.post(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
body: Event,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Error]:
|
||||
"""We collect anonymous telemetry data for improving our product.""" # noqa: E501
|
||||
|
||||
return sync_detailed(
|
||||
body=body,
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
body: Event,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Optional[Error]]:
|
||||
kwargs = _get_kwargs(
|
||||
body=body,
|
||||
client=client,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
||||
response = await _client.post(**kwargs)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
body: Event,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Error]:
|
||||
"""We collect anonymous telemetry data for improving our product.""" # noqa: E501
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
body=body,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
103
kittycad/api/meta/get_ipinfo.py
Normal file
103
kittycad/api/meta/get_ipinfo.py
Normal file
@ -0,0 +1,103 @@
|
||||
from typing import Any, Dict, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import Client
|
||||
from ...models.error import Error
|
||||
from ...models.ip_addr_info import IpAddrInfo
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
*,
|
||||
client: Client,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/_meta/ipinfo".format(
|
||||
client.base_url,
|
||||
) # noqa: E501
|
||||
|
||||
headers: Dict[str, Any] = client.get_headers()
|
||||
cookies: Dict[str, Any] = client.get_cookies()
|
||||
|
||||
return {
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
}
|
||||
|
||||
|
||||
def _parse_response(*, response: httpx.Response) -> Optional[Union[IpAddrInfo, Error]]:
|
||||
if response.status_code == 200:
|
||||
response_200 = IpAddrInfo(**response.json())
|
||||
return response_200
|
||||
if response.status_code == 400:
|
||||
response_4XX = Error(**response.json())
|
||||
return response_4XX
|
||||
if response.status_code == 500:
|
||||
response_5XX = Error(**response.json())
|
||||
return response_5XX
|
||||
return Error(**response.json())
|
||||
|
||||
|
||||
def _build_response(
|
||||
*, response: httpx.Response
|
||||
) -> Response[Optional[Union[IpAddrInfo, Error]]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Optional[Union[IpAddrInfo, Error]]]:
|
||||
kwargs = _get_kwargs(
|
||||
client=client,
|
||||
)
|
||||
|
||||
response = httpx.get(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[IpAddrInfo, Error]]:
|
||||
|
||||
return sync_detailed(
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Optional[Union[IpAddrInfo, Error]]]:
|
||||
kwargs = _get_kwargs(
|
||||
client=client,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
||||
response = await _client.get(**kwargs)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[IpAddrInfo, Error]]:
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
104
kittycad/api/meta/get_pricing_subscriptions.py
Normal file
104
kittycad/api/meta/get_pricing_subscriptions.py
Normal file
@ -0,0 +1,104 @@
|
||||
from typing import Any, Dict, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import Client
|
||||
from ...models.error import Error
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
*,
|
||||
client: Client,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/pricing/subscriptions".format(
|
||||
client.base_url,
|
||||
) # noqa: E501
|
||||
|
||||
headers: Dict[str, Any] = client.get_headers()
|
||||
cookies: Dict[str, Any] = client.get_cookies()
|
||||
|
||||
return {
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
}
|
||||
|
||||
|
||||
def _parse_response(*, response: httpx.Response) -> Optional[Union[dict, Error]]:
|
||||
if response.status_code == 200:
|
||||
response_200 = response.json()
|
||||
return response_200
|
||||
if response.status_code == 400:
|
||||
response_4XX = Error(**response.json())
|
||||
return response_4XX
|
||||
if response.status_code == 500:
|
||||
response_5XX = Error(**response.json())
|
||||
return response_5XX
|
||||
return Error(**response.json())
|
||||
|
||||
|
||||
def _build_response(
|
||||
*, response: httpx.Response
|
||||
) -> Response[Optional[Union[dict, Error]]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Optional[Union[dict, Error]]]:
|
||||
kwargs = _get_kwargs(
|
||||
client=client,
|
||||
)
|
||||
|
||||
response = httpx.get(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[dict, Error]]:
|
||||
"""This is the ultimate source of truth for the pricing of our subscriptions.""" # noqa: E501
|
||||
|
||||
return sync_detailed(
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Optional[Union[dict, Error]]]:
|
||||
kwargs = _get_kwargs(
|
||||
client=client,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
||||
response = await _client.get(**kwargs)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[dict, Error]]:
|
||||
"""This is the ultimate source of truth for the pricing of our subscriptions.""" # noqa: E501
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
@ -70,6 +70,7 @@ def sync(
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[dict, Error]]:
|
||||
|
||||
return sync_detailed(
|
||||
client=client,
|
||||
).parsed
|
||||
@ -93,6 +94,7 @@ async def asyncio(
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[dict, Error]]:
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
client=client,
|
||||
|
@ -71,6 +71,7 @@ def sync(
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[Pong, Error]]:
|
||||
|
||||
return sync_detailed(
|
||||
client=client,
|
||||
).parsed
|
||||
@ -94,6 +95,7 @@ async def asyncio(
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[Pong, Error]]:
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
client=client,
|
||||
|
@ -1,51 +1,81 @@
|
||||
import json
|
||||
from typing import Any, Dict, Iterator
|
||||
from typing import Any, Dict, Iterator, Optional
|
||||
|
||||
import bson
|
||||
from websockets.client import WebSocketClientProtocol, connect as ws_connect_async
|
||||
from websockets.sync.client import ClientConnection, connect as ws_connect
|
||||
|
||||
from ...client import Client
|
||||
from ...models.post_effect_type import PostEffectType
|
||||
from ...models.web_socket_request import WebSocketRequest
|
||||
from ...models.web_socket_response import WebSocketResponse
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
fps: int,
|
||||
post_effect: PostEffectType,
|
||||
show_grid: bool,
|
||||
unlocked_framerate: bool,
|
||||
video_res_height: int,
|
||||
video_res_width: int,
|
||||
webrtc: bool,
|
||||
*,
|
||||
client: Client,
|
||||
pool: Optional[str] = None,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/ws/modeling/commands".format(client.base_url) # noqa: E501
|
||||
|
||||
if fps is not None:
|
||||
|
||||
if "?" in url:
|
||||
url = url + "&fps=" + str(fps)
|
||||
else:
|
||||
url = url + "?fps=" + str(fps)
|
||||
|
||||
if pool is not None:
|
||||
|
||||
if "?" in url:
|
||||
url = url + "&pool=" + str(pool)
|
||||
else:
|
||||
url = url + "?pool=" + str(pool)
|
||||
|
||||
if post_effect is not None:
|
||||
|
||||
if "?" in url:
|
||||
url = url + "&post_effect=" + str(post_effect)
|
||||
else:
|
||||
url = url + "?post_effect=" + str(post_effect)
|
||||
|
||||
if show_grid is not None:
|
||||
|
||||
if "?" in url:
|
||||
url = url + "&show_grid=" + str(show_grid).lower()
|
||||
else:
|
||||
url = url + "?show_grid=" + str(show_grid).lower()
|
||||
|
||||
if unlocked_framerate is not None:
|
||||
|
||||
if "?" in url:
|
||||
url = url + "&unlocked_framerate=" + str(unlocked_framerate).lower()
|
||||
else:
|
||||
url = url + "?unlocked_framerate=" + str(unlocked_framerate).lower()
|
||||
|
||||
if video_res_height is not None:
|
||||
|
||||
if "?" in url:
|
||||
url = url + "&video_res_height=" + str(video_res_height)
|
||||
else:
|
||||
url = url + "?video_res_height=" + str(video_res_height)
|
||||
|
||||
if video_res_width is not None:
|
||||
|
||||
if "?" in url:
|
||||
url = url + "&video_res_width=" + str(video_res_width)
|
||||
else:
|
||||
url = url + "?video_res_width=" + str(video_res_width)
|
||||
|
||||
if webrtc is not None:
|
||||
|
||||
if "?" in url:
|
||||
url = url + "&webrtc=" + str(webrtc).lower()
|
||||
else:
|
||||
@ -64,17 +94,23 @@ def _get_kwargs(
|
||||
|
||||
def sync(
|
||||
fps: int,
|
||||
post_effect: PostEffectType,
|
||||
show_grid: bool,
|
||||
unlocked_framerate: bool,
|
||||
video_res_height: int,
|
||||
video_res_width: int,
|
||||
webrtc: bool,
|
||||
*,
|
||||
client: Client,
|
||||
pool: Optional[str] = None,
|
||||
) -> ClientConnection:
|
||||
"""Pass those commands to the engine via websocket, and pass responses back to the client. Basically, this is a websocket proxy between the frontend/client and the engine.""" # noqa: E501
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
fps=fps,
|
||||
pool=pool,
|
||||
post_effect=post_effect,
|
||||
show_grid=show_grid,
|
||||
unlocked_framerate=unlocked_framerate,
|
||||
video_res_height=video_res_height,
|
||||
video_res_width=video_res_width,
|
||||
@ -87,17 +123,23 @@ def sync(
|
||||
|
||||
async def asyncio(
|
||||
fps: int,
|
||||
post_effect: PostEffectType,
|
||||
show_grid: bool,
|
||||
unlocked_framerate: bool,
|
||||
video_res_height: int,
|
||||
video_res_width: int,
|
||||
webrtc: bool,
|
||||
*,
|
||||
client: Client,
|
||||
pool: Optional[str] = None,
|
||||
) -> WebSocketClientProtocol:
|
||||
"""Pass those commands to the engine via websocket, and pass responses back to the client. Basically, this is a websocket proxy between the frontend/client and the engine.""" # noqa: E501
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
fps=fps,
|
||||
pool=pool,
|
||||
post_effect=post_effect,
|
||||
show_grid=show_grid,
|
||||
unlocked_framerate=unlocked_framerate,
|
||||
video_res_height=video_res_height,
|
||||
video_res_width=video_res_width,
|
||||
@ -121,19 +163,25 @@ class WebSocket:
|
||||
def __init__(
|
||||
self,
|
||||
fps: int,
|
||||
post_effect: PostEffectType,
|
||||
show_grid: bool,
|
||||
unlocked_framerate: bool,
|
||||
video_res_height: int,
|
||||
video_res_width: int,
|
||||
webrtc: bool,
|
||||
client: Client,
|
||||
pool: Optional[str] = None,
|
||||
):
|
||||
self.ws = sync(
|
||||
fps,
|
||||
post_effect,
|
||||
show_grid,
|
||||
unlocked_framerate,
|
||||
video_res_height,
|
||||
video_res_width,
|
||||
webrtc,
|
||||
client=client,
|
||||
pool=pool,
|
||||
)
|
||||
|
||||
def __enter__(
|
||||
|
@ -77,7 +77,12 @@ def sync(
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[OrgMember, Error]]:
|
||||
"""This endpoint requires authentication by an org admin. It adds the specified member to the authenticated user's org.""" # noqa: E501
|
||||
"""If the user exists, this will add them to your org. If they do not exist, this will create a new user and add them to your org.
|
||||
In both cases the user gets an email that they have been added to the org.
|
||||
If the user is already in your org, this will return a 400 and a message.
|
||||
If the user is already in a different org, this will return a 400 and a message.
|
||||
This endpoint requires authentication by an org admin. It adds the specified member to the authenticated user's org.
|
||||
""" # noqa: E501
|
||||
|
||||
return sync_detailed(
|
||||
body=body,
|
||||
@ -106,7 +111,12 @@ async def asyncio(
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[OrgMember, Error]]:
|
||||
"""This endpoint requires authentication by an org admin. It adds the specified member to the authenticated user's org.""" # noqa: E501
|
||||
"""If the user exists, this will add them to your org. If they do not exist, this will create a new user and add them to your org.
|
||||
In both cases the user gets an email that they have been added to the org.
|
||||
If the user is already in your org, this will return a 400 and a message.
|
||||
If the user is already in a different org, this will return a 400 and a message.
|
||||
This endpoint requires authentication by an org admin. It adds the specified member to the authenticated user's org.
|
||||
""" # noqa: E501
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
|
118
kittycad/api/orgs/create_org_saml_idp.py
Normal file
118
kittycad/api/orgs/create_org_saml_idp.py
Normal file
@ -0,0 +1,118 @@
|
||||
from typing import Any, Dict, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import Client
|
||||
from ...models.error import Error
|
||||
from ...models.saml_identity_provider import SamlIdentityProvider
|
||||
from ...models.saml_identity_provider_create import SamlIdentityProviderCreate
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
body: SamlIdentityProviderCreate,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/org/saml/idp".format(
|
||||
client.base_url,
|
||||
) # noqa: E501
|
||||
|
||||
headers: Dict[str, Any] = client.get_headers()
|
||||
cookies: Dict[str, Any] = client.get_cookies()
|
||||
|
||||
return {
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
"content": body.model_dump_json(),
|
||||
}
|
||||
|
||||
|
||||
def _parse_response(
|
||||
*, response: httpx.Response
|
||||
) -> Optional[Union[SamlIdentityProvider, Error]]:
|
||||
if response.status_code == 201:
|
||||
response_201 = SamlIdentityProvider(**response.json())
|
||||
return response_201
|
||||
if response.status_code == 400:
|
||||
response_4XX = Error(**response.json())
|
||||
return response_4XX
|
||||
if response.status_code == 500:
|
||||
response_5XX = Error(**response.json())
|
||||
return response_5XX
|
||||
return Error(**response.json())
|
||||
|
||||
|
||||
def _build_response(
|
||||
*, response: httpx.Response
|
||||
) -> Response[Optional[Union[SamlIdentityProvider, Error]]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
body: SamlIdentityProviderCreate,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Optional[Union[SamlIdentityProvider, Error]]]:
|
||||
kwargs = _get_kwargs(
|
||||
body=body,
|
||||
client=client,
|
||||
)
|
||||
|
||||
response = httpx.post(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
body: SamlIdentityProviderCreate,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[SamlIdentityProvider, Error]]:
|
||||
"""This endpoint requires authentication by an org admin.""" # noqa: E501
|
||||
|
||||
return sync_detailed(
|
||||
body=body,
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
body: SamlIdentityProviderCreate,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Optional[Union[SamlIdentityProvider, Error]]]:
|
||||
kwargs = _get_kwargs(
|
||||
body=body,
|
||||
client=client,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
||||
response = await _client.post(**kwargs)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
body: SamlIdentityProviderCreate,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[SamlIdentityProvider, Error]]:
|
||||
"""This endpoint requires authentication by an org admin.""" # noqa: E501
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
body=body,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
100
kittycad/api/orgs/delete_org_saml_idp.py
Normal file
100
kittycad/api/orgs/delete_org_saml_idp.py
Normal file
@ -0,0 +1,100 @@
|
||||
from typing import Any, Dict, Optional
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import Client
|
||||
from ...models.error import Error
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
*,
|
||||
client: Client,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/org/saml/idp".format(
|
||||
client.base_url,
|
||||
) # noqa: E501
|
||||
|
||||
headers: Dict[str, Any] = client.get_headers()
|
||||
cookies: Dict[str, Any] = client.get_cookies()
|
||||
|
||||
return {
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
}
|
||||
|
||||
|
||||
def _parse_response(*, response: httpx.Response) -> Optional[Error]:
|
||||
return None
|
||||
if response.status_code == 400:
|
||||
response_4XX = Error(**response.json())
|
||||
return response_4XX
|
||||
if response.status_code == 500:
|
||||
response_5XX = Error(**response.json())
|
||||
return response_5XX
|
||||
return Error(**response.json())
|
||||
|
||||
|
||||
def _build_response(*, response: httpx.Response) -> Response[Optional[Error]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Optional[Error]]:
|
||||
kwargs = _get_kwargs(
|
||||
client=client,
|
||||
)
|
||||
|
||||
response = httpx.delete(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Error]:
|
||||
"""This endpoint requires authentication by an org admin.""" # noqa: E501
|
||||
|
||||
return sync_detailed(
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Optional[Error]]:
|
||||
kwargs = _get_kwargs(
|
||||
client=client,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
||||
response = await _client.delete(**kwargs)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Error]:
|
||||
"""This endpoint requires authentication by an org admin.""" # noqa: E501
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
116
kittycad/api/orgs/get_any_org.py
Normal file
116
kittycad/api/orgs/get_any_org.py
Normal file
@ -0,0 +1,116 @@
|
||||
from typing import Any, Dict, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import Client
|
||||
from ...models.error import Error
|
||||
from ...models.org import Org
|
||||
from ...models.uuid import Uuid
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
id: Uuid,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/orgs/{id}".format(
|
||||
client.base_url,
|
||||
id=id,
|
||||
) # noqa: E501
|
||||
|
||||
headers: Dict[str, Any] = client.get_headers()
|
||||
cookies: Dict[str, Any] = client.get_cookies()
|
||||
|
||||
return {
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
}
|
||||
|
||||
|
||||
def _parse_response(*, response: httpx.Response) -> Optional[Union[Org, Error]]:
|
||||
if response.status_code == 200:
|
||||
response_200 = Org(**response.json())
|
||||
return response_200
|
||||
if response.status_code == 400:
|
||||
response_4XX = Error(**response.json())
|
||||
return response_4XX
|
||||
if response.status_code == 500:
|
||||
response_5XX = Error(**response.json())
|
||||
return response_5XX
|
||||
return Error(**response.json())
|
||||
|
||||
|
||||
def _build_response(
|
||||
*, response: httpx.Response
|
||||
) -> Response[Optional[Union[Org, Error]]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
id: Uuid,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Optional[Union[Org, Error]]]:
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
client=client,
|
||||
)
|
||||
|
||||
response = httpx.get(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
id: Uuid,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[Org, Error]]:
|
||||
"""This endpoint requires authentication by a Zoo employee. It gets the information for the specified org.""" # noqa: E501
|
||||
|
||||
return sync_detailed(
|
||||
id=id,
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
id: Uuid,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Optional[Union[Org, Error]]]:
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
client=client,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
||||
response = await _client.get(**kwargs)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
id: Uuid,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[Org, Error]]:
|
||||
"""This endpoint requires authentication by a Zoo employee. It gets the information for the specified org.""" # noqa: E501
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
id=id,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
107
kittycad/api/orgs/get_org_privacy_settings.py
Normal file
107
kittycad/api/orgs/get_org_privacy_settings.py
Normal file
@ -0,0 +1,107 @@
|
||||
from typing import Any, Dict, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import Client
|
||||
from ...models.error import Error
|
||||
from ...models.privacy_settings import PrivacySettings
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
*,
|
||||
client: Client,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/org/privacy".format(
|
||||
client.base_url,
|
||||
) # noqa: E501
|
||||
|
||||
headers: Dict[str, Any] = client.get_headers()
|
||||
cookies: Dict[str, Any] = client.get_cookies()
|
||||
|
||||
return {
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
}
|
||||
|
||||
|
||||
def _parse_response(
|
||||
*, response: httpx.Response
|
||||
) -> Optional[Union[PrivacySettings, Error]]:
|
||||
if response.status_code == 200:
|
||||
response_200 = PrivacySettings(**response.json())
|
||||
return response_200
|
||||
if response.status_code == 400:
|
||||
response_4XX = Error(**response.json())
|
||||
return response_4XX
|
||||
if response.status_code == 500:
|
||||
response_5XX = Error(**response.json())
|
||||
return response_5XX
|
||||
return Error(**response.json())
|
||||
|
||||
|
||||
def _build_response(
|
||||
*, response: httpx.Response
|
||||
) -> Response[Optional[Union[PrivacySettings, Error]]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Optional[Union[PrivacySettings, Error]]]:
|
||||
kwargs = _get_kwargs(
|
||||
client=client,
|
||||
)
|
||||
|
||||
response = httpx.get(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[PrivacySettings, Error]]:
|
||||
"""This endpoint requires authentication by an org admin. It gets the privacy settings for the authenticated user's org.""" # noqa: E501
|
||||
|
||||
return sync_detailed(
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Optional[Union[PrivacySettings, Error]]]:
|
||||
kwargs = _get_kwargs(
|
||||
client=client,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
||||
response = await _client.get(**kwargs)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[PrivacySettings, Error]]:
|
||||
"""This endpoint requires authentication by an org admin. It gets the privacy settings for the authenticated user's org.""" # noqa: E501
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
107
kittycad/api/orgs/get_org_saml_idp.py
Normal file
107
kittycad/api/orgs/get_org_saml_idp.py
Normal file
@ -0,0 +1,107 @@
|
||||
from typing import Any, Dict, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import Client
|
||||
from ...models.error import Error
|
||||
from ...models.saml_identity_provider import SamlIdentityProvider
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
*,
|
||||
client: Client,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/org/saml/idp".format(
|
||||
client.base_url,
|
||||
) # noqa: E501
|
||||
|
||||
headers: Dict[str, Any] = client.get_headers()
|
||||
cookies: Dict[str, Any] = client.get_cookies()
|
||||
|
||||
return {
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
}
|
||||
|
||||
|
||||
def _parse_response(
|
||||
*, response: httpx.Response
|
||||
) -> Optional[Union[SamlIdentityProvider, Error]]:
|
||||
if response.status_code == 200:
|
||||
response_200 = SamlIdentityProvider(**response.json())
|
||||
return response_200
|
||||
if response.status_code == 400:
|
||||
response_4XX = Error(**response.json())
|
||||
return response_4XX
|
||||
if response.status_code == 500:
|
||||
response_5XX = Error(**response.json())
|
||||
return response_5XX
|
||||
return Error(**response.json())
|
||||
|
||||
|
||||
def _build_response(
|
||||
*, response: httpx.Response
|
||||
) -> Response[Optional[Union[SamlIdentityProvider, Error]]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Optional[Union[SamlIdentityProvider, Error]]]:
|
||||
kwargs = _get_kwargs(
|
||||
client=client,
|
||||
)
|
||||
|
||||
response = httpx.get(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[SamlIdentityProvider, Error]]:
|
||||
"""This endpoint requires authentication by an org admin.""" # noqa: E501
|
||||
|
||||
return sync_detailed(
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Optional[Union[SamlIdentityProvider, Error]]]:
|
||||
kwargs = _get_kwargs(
|
||||
client=client,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
||||
response = await _client.get(**kwargs)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[SamlIdentityProvider, Error]]:
|
||||
"""This endpoint requires authentication by an org admin.""" # noqa: E501
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
@ -6,13 +6,13 @@ from ...client import Client
|
||||
from ...models.created_at_sort_mode import CreatedAtSortMode
|
||||
from ...models.error import Error
|
||||
from ...models.org_member_results_page import OrgMemberResultsPage
|
||||
from ...models.org_role import OrgRole
|
||||
from ...models.user_org_role import UserOrgRole
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
sort_by: CreatedAtSortMode,
|
||||
role: OrgRole,
|
||||
role: UserOrgRole,
|
||||
*,
|
||||
client: Client,
|
||||
limit: Optional[int] = None,
|
||||
@ -23,24 +23,28 @@ def _get_kwargs(
|
||||
) # noqa: E501
|
||||
|
||||
if limit is not None:
|
||||
|
||||
if "?" in url:
|
||||
url = url + "&limit=" + str(limit)
|
||||
else:
|
||||
url = url + "?limit=" + str(limit)
|
||||
|
||||
if page_token is not None:
|
||||
|
||||
if "?" in url:
|
||||
url = url + "&page_token=" + str(page_token)
|
||||
else:
|
||||
url = url + "?page_token=" + str(page_token)
|
||||
|
||||
if sort_by is not None:
|
||||
|
||||
if "?" in url:
|
||||
url = url + "&sort_by=" + str(sort_by)
|
||||
else:
|
||||
url = url + "?sort_by=" + str(sort_by)
|
||||
|
||||
if role is not None:
|
||||
|
||||
if "?" in url:
|
||||
url = url + "&role=" + str(role)
|
||||
else:
|
||||
@ -85,7 +89,7 @@ def _build_response(
|
||||
|
||||
def sync_detailed(
|
||||
sort_by: CreatedAtSortMode,
|
||||
role: OrgRole,
|
||||
role: UserOrgRole,
|
||||
*,
|
||||
client: Client,
|
||||
limit: Optional[int] = None,
|
||||
@ -109,7 +113,7 @@ def sync_detailed(
|
||||
|
||||
def sync(
|
||||
sort_by: CreatedAtSortMode,
|
||||
role: OrgRole,
|
||||
role: UserOrgRole,
|
||||
*,
|
||||
client: Client,
|
||||
limit: Optional[int] = None,
|
||||
@ -128,7 +132,7 @@ def sync(
|
||||
|
||||
async def asyncio_detailed(
|
||||
sort_by: CreatedAtSortMode,
|
||||
role: OrgRole,
|
||||
role: UserOrgRole,
|
||||
*,
|
||||
client: Client,
|
||||
limit: Optional[int] = None,
|
||||
@ -150,7 +154,7 @@ async def asyncio_detailed(
|
||||
|
||||
async def asyncio(
|
||||
sort_by: CreatedAtSortMode,
|
||||
role: OrgRole,
|
||||
role: UserOrgRole,
|
||||
*,
|
||||
client: Client,
|
||||
limit: Optional[int] = None,
|
||||
|
156
kittycad/api/orgs/list_orgs.py
Normal file
156
kittycad/api/orgs/list_orgs.py
Normal file
@ -0,0 +1,156 @@
|
||||
from typing import Any, Dict, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import Client
|
||||
from ...models.created_at_sort_mode import CreatedAtSortMode
|
||||
from ...models.error import Error
|
||||
from ...models.org_results_page import OrgResultsPage
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
sort_by: CreatedAtSortMode,
|
||||
*,
|
||||
client: Client,
|
||||
limit: Optional[int] = None,
|
||||
page_token: Optional[str] = None,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/orgs".format(
|
||||
client.base_url,
|
||||
) # noqa: E501
|
||||
|
||||
if limit is not None:
|
||||
|
||||
if "?" in url:
|
||||
url = url + "&limit=" + str(limit)
|
||||
else:
|
||||
url = url + "?limit=" + str(limit)
|
||||
|
||||
if page_token is not None:
|
||||
|
||||
if "?" in url:
|
||||
url = url + "&page_token=" + str(page_token)
|
||||
else:
|
||||
url = url + "?page_token=" + str(page_token)
|
||||
|
||||
if sort_by is not None:
|
||||
|
||||
if "?" in url:
|
||||
url = url + "&sort_by=" + str(sort_by)
|
||||
else:
|
||||
url = url + "?sort_by=" + str(sort_by)
|
||||
|
||||
headers: Dict[str, Any] = client.get_headers()
|
||||
cookies: Dict[str, Any] = client.get_cookies()
|
||||
|
||||
return {
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
}
|
||||
|
||||
|
||||
def _parse_response(
|
||||
*, response: httpx.Response
|
||||
) -> Optional[Union[OrgResultsPage, Error]]:
|
||||
if response.status_code == 200:
|
||||
response_200 = OrgResultsPage(**response.json())
|
||||
return response_200
|
||||
if response.status_code == 400:
|
||||
response_4XX = Error(**response.json())
|
||||
return response_4XX
|
||||
if response.status_code == 500:
|
||||
response_5XX = Error(**response.json())
|
||||
return response_5XX
|
||||
return Error(**response.json())
|
||||
|
||||
|
||||
def _build_response(
|
||||
*, response: httpx.Response
|
||||
) -> Response[Optional[Union[OrgResultsPage, Error]]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
sort_by: CreatedAtSortMode,
|
||||
*,
|
||||
client: Client,
|
||||
limit: Optional[int] = None,
|
||||
page_token: Optional[str] = None,
|
||||
) -> Response[Optional[Union[OrgResultsPage, Error]]]:
|
||||
kwargs = _get_kwargs(
|
||||
limit=limit,
|
||||
page_token=page_token,
|
||||
sort_by=sort_by,
|
||||
client=client,
|
||||
)
|
||||
|
||||
response = httpx.get(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
sort_by: CreatedAtSortMode,
|
||||
*,
|
||||
client: Client,
|
||||
limit: Optional[int] = None,
|
||||
page_token: Optional[str] = None,
|
||||
) -> Optional[Union[OrgResultsPage, Error]]:
|
||||
"""This endpoint requires authentication by a Zoo employee. The orgs are returned in order of creation, with the most recently created orgs first.""" # noqa: E501
|
||||
|
||||
return sync_detailed(
|
||||
limit=limit,
|
||||
page_token=page_token,
|
||||
sort_by=sort_by,
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
sort_by: CreatedAtSortMode,
|
||||
*,
|
||||
client: Client,
|
||||
limit: Optional[int] = None,
|
||||
page_token: Optional[str] = None,
|
||||
) -> Response[Optional[Union[OrgResultsPage, Error]]]:
|
||||
kwargs = _get_kwargs(
|
||||
limit=limit,
|
||||
page_token=page_token,
|
||||
sort_by=sort_by,
|
||||
client=client,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
||||
response = await _client.get(**kwargs)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
sort_by: CreatedAtSortMode,
|
||||
*,
|
||||
client: Client,
|
||||
limit: Optional[int] = None,
|
||||
page_token: Optional[str] = None,
|
||||
) -> Optional[Union[OrgResultsPage, Error]]:
|
||||
"""This endpoint requires authentication by a Zoo employee. The orgs are returned in order of creation, with the most recently created orgs first.""" # noqa: E501
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
limit=limit,
|
||||
page_token=page_token,
|
||||
sort_by=sort_by,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
129
kittycad/api/orgs/update_enterprise_pricing_for_org.py
Normal file
129
kittycad/api/orgs/update_enterprise_pricing_for_org.py
Normal file
@ -0,0 +1,129 @@
|
||||
from typing import Any, Dict, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import Client
|
||||
from ...models.error import Error
|
||||
from ...models.subscription_tier_price import SubscriptionTierPrice
|
||||
from ...models.uuid import Uuid
|
||||
from ...models.zoo_product_subscriptions import ZooProductSubscriptions
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
id: Uuid,
|
||||
body: SubscriptionTierPrice,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/orgs/{id}/enterprise/pricing".format(
|
||||
client.base_url,
|
||||
id=id,
|
||||
) # noqa: E501
|
||||
|
||||
headers: Dict[str, Any] = client.get_headers()
|
||||
cookies: Dict[str, Any] = client.get_cookies()
|
||||
|
||||
return {
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
"content": body.model_dump_json(),
|
||||
}
|
||||
|
||||
|
||||
def _parse_response(
|
||||
*, response: httpx.Response
|
||||
) -> Optional[Union[ZooProductSubscriptions, Error]]:
|
||||
if response.status_code == 200:
|
||||
response_200 = ZooProductSubscriptions(**response.json())
|
||||
return response_200
|
||||
if response.status_code == 400:
|
||||
response_4XX = Error(**response.json())
|
||||
return response_4XX
|
||||
if response.status_code == 500:
|
||||
response_5XX = Error(**response.json())
|
||||
return response_5XX
|
||||
return Error(**response.json())
|
||||
|
||||
|
||||
def _build_response(
|
||||
*, response: httpx.Response
|
||||
) -> Response[Optional[Union[ZooProductSubscriptions, Error]]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
id: Uuid,
|
||||
body: SubscriptionTierPrice,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Optional[Union[ZooProductSubscriptions, Error]]]:
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
body=body,
|
||||
client=client,
|
||||
)
|
||||
|
||||
response = httpx.put(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
id: Uuid,
|
||||
body: SubscriptionTierPrice,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[ZooProductSubscriptions, Error]]:
|
||||
"""You must be a Zoo employee to perform this request.""" # noqa: E501
|
||||
|
||||
return sync_detailed(
|
||||
id=id,
|
||||
body=body,
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
id: Uuid,
|
||||
body: SubscriptionTierPrice,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Optional[Union[ZooProductSubscriptions, Error]]]:
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
body=body,
|
||||
client=client,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
||||
response = await _client.put(**kwargs)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
id: Uuid,
|
||||
body: SubscriptionTierPrice,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[ZooProductSubscriptions, Error]]:
|
||||
"""You must be a Zoo employee to perform this request.""" # noqa: E501
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
id=id,
|
||||
body=body,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
117
kittycad/api/orgs/update_org_privacy_settings.py
Normal file
117
kittycad/api/orgs/update_org_privacy_settings.py
Normal file
@ -0,0 +1,117 @@
|
||||
from typing import Any, Dict, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import Client
|
||||
from ...models.error import Error
|
||||
from ...models.privacy_settings import PrivacySettings
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
body: PrivacySettings,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/org/privacy".format(
|
||||
client.base_url,
|
||||
) # noqa: E501
|
||||
|
||||
headers: Dict[str, Any] = client.get_headers()
|
||||
cookies: Dict[str, Any] = client.get_cookies()
|
||||
|
||||
return {
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
"content": body.model_dump_json(),
|
||||
}
|
||||
|
||||
|
||||
def _parse_response(
|
||||
*, response: httpx.Response
|
||||
) -> Optional[Union[PrivacySettings, Error]]:
|
||||
if response.status_code == 200:
|
||||
response_200 = PrivacySettings(**response.json())
|
||||
return response_200
|
||||
if response.status_code == 400:
|
||||
response_4XX = Error(**response.json())
|
||||
return response_4XX
|
||||
if response.status_code == 500:
|
||||
response_5XX = Error(**response.json())
|
||||
return response_5XX
|
||||
return Error(**response.json())
|
||||
|
||||
|
||||
def _build_response(
|
||||
*, response: httpx.Response
|
||||
) -> Response[Optional[Union[PrivacySettings, Error]]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
body: PrivacySettings,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Optional[Union[PrivacySettings, Error]]]:
|
||||
kwargs = _get_kwargs(
|
||||
body=body,
|
||||
client=client,
|
||||
)
|
||||
|
||||
response = httpx.put(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
body: PrivacySettings,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[PrivacySettings, Error]]:
|
||||
"""This endpoint requires authentication by an org admin. It updates the privacy settings for the authenticated user's org.""" # noqa: E501
|
||||
|
||||
return sync_detailed(
|
||||
body=body,
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
body: PrivacySettings,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Optional[Union[PrivacySettings, Error]]]:
|
||||
kwargs = _get_kwargs(
|
||||
body=body,
|
||||
client=client,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
||||
response = await _client.put(**kwargs)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
body: PrivacySettings,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[PrivacySettings, Error]]:
|
||||
"""This endpoint requires authentication by an org admin. It updates the privacy settings for the authenticated user's org.""" # noqa: E501
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
body=body,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
118
kittycad/api/orgs/update_org_saml_idp.py
Normal file
118
kittycad/api/orgs/update_org_saml_idp.py
Normal file
@ -0,0 +1,118 @@
|
||||
from typing import Any, Dict, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import Client
|
||||
from ...models.error import Error
|
||||
from ...models.saml_identity_provider import SamlIdentityProvider
|
||||
from ...models.saml_identity_provider_create import SamlIdentityProviderCreate
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
body: SamlIdentityProviderCreate,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/org/saml/idp".format(
|
||||
client.base_url,
|
||||
) # noqa: E501
|
||||
|
||||
headers: Dict[str, Any] = client.get_headers()
|
||||
cookies: Dict[str, Any] = client.get_cookies()
|
||||
|
||||
return {
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
"content": body.model_dump_json(),
|
||||
}
|
||||
|
||||
|
||||
def _parse_response(
|
||||
*, response: httpx.Response
|
||||
) -> Optional[Union[SamlIdentityProvider, Error]]:
|
||||
if response.status_code == 200:
|
||||
response_200 = SamlIdentityProvider(**response.json())
|
||||
return response_200
|
||||
if response.status_code == 400:
|
||||
response_4XX = Error(**response.json())
|
||||
return response_4XX
|
||||
if response.status_code == 500:
|
||||
response_5XX = Error(**response.json())
|
||||
return response_5XX
|
||||
return Error(**response.json())
|
||||
|
||||
|
||||
def _build_response(
|
||||
*, response: httpx.Response
|
||||
) -> Response[Optional[Union[SamlIdentityProvider, Error]]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
body: SamlIdentityProviderCreate,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Optional[Union[SamlIdentityProvider, Error]]]:
|
||||
kwargs = _get_kwargs(
|
||||
body=body,
|
||||
client=client,
|
||||
)
|
||||
|
||||
response = httpx.put(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
body: SamlIdentityProviderCreate,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[SamlIdentityProvider, Error]]:
|
||||
"""This endpoint requires authentication by an org admin.""" # noqa: E501
|
||||
|
||||
return sync_detailed(
|
||||
body=body,
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
body: SamlIdentityProviderCreate,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Optional[Union[SamlIdentityProvider, Error]]]:
|
||||
kwargs = _get_kwargs(
|
||||
body=body,
|
||||
client=client,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
||||
response = await _client.put(**kwargs)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
body: SamlIdentityProviderCreate,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[SamlIdentityProvider, Error]]:
|
||||
"""This endpoint requires authentication by an org admin.""" # noqa: E501
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
body=body,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
120
kittycad/api/payments/create_org_subscription.py
Normal file
120
kittycad/api/payments/create_org_subscription.py
Normal file
@ -0,0 +1,120 @@
|
||||
from typing import Any, Dict, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import Client
|
||||
from ...models.error import Error
|
||||
from ...models.zoo_product_subscriptions import ZooProductSubscriptions
|
||||
from ...models.zoo_product_subscriptions_org_request import (
|
||||
ZooProductSubscriptionsOrgRequest,
|
||||
)
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
body: ZooProductSubscriptionsOrgRequest,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/org/payment/subscriptions".format(
|
||||
client.base_url,
|
||||
) # noqa: E501
|
||||
|
||||
headers: Dict[str, Any] = client.get_headers()
|
||||
cookies: Dict[str, Any] = client.get_cookies()
|
||||
|
||||
return {
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
"content": body.model_dump_json(),
|
||||
}
|
||||
|
||||
|
||||
def _parse_response(
|
||||
*, response: httpx.Response
|
||||
) -> Optional[Union[ZooProductSubscriptions, Error]]:
|
||||
if response.status_code == 201:
|
||||
response_201 = ZooProductSubscriptions(**response.json())
|
||||
return response_201
|
||||
if response.status_code == 400:
|
||||
response_4XX = Error(**response.json())
|
||||
return response_4XX
|
||||
if response.status_code == 500:
|
||||
response_5XX = Error(**response.json())
|
||||
return response_5XX
|
||||
return Error(**response.json())
|
||||
|
||||
|
||||
def _build_response(
|
||||
*, response: httpx.Response
|
||||
) -> Response[Optional[Union[ZooProductSubscriptions, Error]]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
body: ZooProductSubscriptionsOrgRequest,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Optional[Union[ZooProductSubscriptions, Error]]]:
|
||||
kwargs = _get_kwargs(
|
||||
body=body,
|
||||
client=client,
|
||||
)
|
||||
|
||||
response = httpx.post(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
body: ZooProductSubscriptionsOrgRequest,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[ZooProductSubscriptions, Error]]:
|
||||
"""This endpoint requires authentication by an org admin. It creates the subscription for the authenticated user's org.""" # noqa: E501
|
||||
|
||||
return sync_detailed(
|
||||
body=body,
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
body: ZooProductSubscriptionsOrgRequest,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Optional[Union[ZooProductSubscriptions, Error]]]:
|
||||
kwargs = _get_kwargs(
|
||||
body=body,
|
||||
client=client,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
||||
response = await _client.post(**kwargs)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
body: ZooProductSubscriptionsOrgRequest,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[ZooProductSubscriptions, Error]]:
|
||||
"""This endpoint requires authentication by an org admin. It creates the subscription for the authenticated user's org.""" # noqa: E501
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
body=body,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
120
kittycad/api/payments/create_user_subscription.py
Normal file
120
kittycad/api/payments/create_user_subscription.py
Normal file
@ -0,0 +1,120 @@
|
||||
from typing import Any, Dict, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import Client
|
||||
from ...models.error import Error
|
||||
from ...models.zoo_product_subscriptions import ZooProductSubscriptions
|
||||
from ...models.zoo_product_subscriptions_user_request import (
|
||||
ZooProductSubscriptionsUserRequest,
|
||||
)
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
body: ZooProductSubscriptionsUserRequest,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/user/payment/subscriptions".format(
|
||||
client.base_url,
|
||||
) # noqa: E501
|
||||
|
||||
headers: Dict[str, Any] = client.get_headers()
|
||||
cookies: Dict[str, Any] = client.get_cookies()
|
||||
|
||||
return {
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
"content": body.model_dump_json(),
|
||||
}
|
||||
|
||||
|
||||
def _parse_response(
|
||||
*, response: httpx.Response
|
||||
) -> Optional[Union[ZooProductSubscriptions, Error]]:
|
||||
if response.status_code == 201:
|
||||
response_201 = ZooProductSubscriptions(**response.json())
|
||||
return response_201
|
||||
if response.status_code == 400:
|
||||
response_4XX = Error(**response.json())
|
||||
return response_4XX
|
||||
if response.status_code == 500:
|
||||
response_5XX = Error(**response.json())
|
||||
return response_5XX
|
||||
return Error(**response.json())
|
||||
|
||||
|
||||
def _build_response(
|
||||
*, response: httpx.Response
|
||||
) -> Response[Optional[Union[ZooProductSubscriptions, Error]]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
body: ZooProductSubscriptionsUserRequest,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Optional[Union[ZooProductSubscriptions, Error]]]:
|
||||
kwargs = _get_kwargs(
|
||||
body=body,
|
||||
client=client,
|
||||
)
|
||||
|
||||
response = httpx.post(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
body: ZooProductSubscriptionsUserRequest,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[ZooProductSubscriptions, Error]]:
|
||||
"""This endpoint requires authentication by any Zoo user. It creates the subscription for the user.""" # noqa: E501
|
||||
|
||||
return sync_detailed(
|
||||
body=body,
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
body: ZooProductSubscriptionsUserRequest,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Optional[Union[ZooProductSubscriptions, Error]]]:
|
||||
kwargs = _get_kwargs(
|
||||
body=body,
|
||||
client=client,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
||||
response = await _client.post(**kwargs)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
body: ZooProductSubscriptionsUserRequest,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[ZooProductSubscriptions, Error]]:
|
||||
"""This endpoint requires authentication by any Zoo user. It creates the subscription for the user.""" # noqa: E501
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
body=body,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
107
kittycad/api/payments/get_org_subscription.py
Normal file
107
kittycad/api/payments/get_org_subscription.py
Normal file
@ -0,0 +1,107 @@
|
||||
from typing import Any, Dict, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import Client
|
||||
from ...models.error import Error
|
||||
from ...models.zoo_product_subscriptions import ZooProductSubscriptions
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
*,
|
||||
client: Client,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/org/payment/subscriptions".format(
|
||||
client.base_url,
|
||||
) # noqa: E501
|
||||
|
||||
headers: Dict[str, Any] = client.get_headers()
|
||||
cookies: Dict[str, Any] = client.get_cookies()
|
||||
|
||||
return {
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
}
|
||||
|
||||
|
||||
def _parse_response(
|
||||
*, response: httpx.Response
|
||||
) -> Optional[Union[ZooProductSubscriptions, Error]]:
|
||||
if response.status_code == 200:
|
||||
response_200 = ZooProductSubscriptions(**response.json())
|
||||
return response_200
|
||||
if response.status_code == 400:
|
||||
response_4XX = Error(**response.json())
|
||||
return response_4XX
|
||||
if response.status_code == 500:
|
||||
response_5XX = Error(**response.json())
|
||||
return response_5XX
|
||||
return Error(**response.json())
|
||||
|
||||
|
||||
def _build_response(
|
||||
*, response: httpx.Response
|
||||
) -> Response[Optional[Union[ZooProductSubscriptions, Error]]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Optional[Union[ZooProductSubscriptions, Error]]]:
|
||||
kwargs = _get_kwargs(
|
||||
client=client,
|
||||
)
|
||||
|
||||
response = httpx.get(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[ZooProductSubscriptions, Error]]:
|
||||
"""This endpoint requires authentication by an org admin. It gets the subscription for the authenticated user's org.""" # noqa: E501
|
||||
|
||||
return sync_detailed(
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Optional[Union[ZooProductSubscriptions, Error]]]:
|
||||
kwargs = _get_kwargs(
|
||||
client=client,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
||||
response = await _client.get(**kwargs)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[ZooProductSubscriptions, Error]]:
|
||||
"""This endpoint requires authentication by an org admin. It gets the subscription for the authenticated user's org.""" # noqa: E501
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
118
kittycad/api/payments/get_payment_balance_for_any_org.py
Normal file
118
kittycad/api/payments/get_payment_balance_for_any_org.py
Normal file
@ -0,0 +1,118 @@
|
||||
from typing import Any, Dict, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import Client
|
||||
from ...models.customer_balance import CustomerBalance
|
||||
from ...models.error import Error
|
||||
from ...models.uuid import Uuid
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
id: Uuid,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/orgs/{id}/payment/balance".format(
|
||||
client.base_url,
|
||||
id=id,
|
||||
) # noqa: E501
|
||||
|
||||
headers: Dict[str, Any] = client.get_headers()
|
||||
cookies: Dict[str, Any] = client.get_cookies()
|
||||
|
||||
return {
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
}
|
||||
|
||||
|
||||
def _parse_response(
|
||||
*, response: httpx.Response
|
||||
) -> Optional[Union[CustomerBalance, Error]]:
|
||||
if response.status_code == 200:
|
||||
response_200 = CustomerBalance(**response.json())
|
||||
return response_200
|
||||
if response.status_code == 400:
|
||||
response_4XX = Error(**response.json())
|
||||
return response_4XX
|
||||
if response.status_code == 500:
|
||||
response_5XX = Error(**response.json())
|
||||
return response_5XX
|
||||
return Error(**response.json())
|
||||
|
||||
|
||||
def _build_response(
|
||||
*, response: httpx.Response
|
||||
) -> Response[Optional[Union[CustomerBalance, Error]]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
id: Uuid,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Optional[Union[CustomerBalance, Error]]]:
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
client=client,
|
||||
)
|
||||
|
||||
response = httpx.get(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
id: Uuid,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[CustomerBalance, Error]]:
|
||||
"""This endpoint requires authentication by a Zoo employee. It gets the balance information for the specified org.""" # noqa: E501
|
||||
|
||||
return sync_detailed(
|
||||
id=id,
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
id: Uuid,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Optional[Union[CustomerBalance, Error]]]:
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
client=client,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
||||
response = await _client.get(**kwargs)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
id: Uuid,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[CustomerBalance, Error]]:
|
||||
"""This endpoint requires authentication by a Zoo employee. It gets the balance information for the specified org.""" # noqa: E501
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
id=id,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
118
kittycad/api/payments/get_payment_balance_for_any_user.py
Normal file
118
kittycad/api/payments/get_payment_balance_for_any_user.py
Normal file
@ -0,0 +1,118 @@
|
||||
from typing import Any, Dict, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import Client
|
||||
from ...models.customer_balance import CustomerBalance
|
||||
from ...models.error import Error
|
||||
from ...models.uuid import Uuid
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
id: Uuid,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/users/{id}/payment/balance".format(
|
||||
client.base_url,
|
||||
id=id,
|
||||
) # noqa: E501
|
||||
|
||||
headers: Dict[str, Any] = client.get_headers()
|
||||
cookies: Dict[str, Any] = client.get_cookies()
|
||||
|
||||
return {
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
}
|
||||
|
||||
|
||||
def _parse_response(
|
||||
*, response: httpx.Response
|
||||
) -> Optional[Union[CustomerBalance, Error]]:
|
||||
if response.status_code == 200:
|
||||
response_200 = CustomerBalance(**response.json())
|
||||
return response_200
|
||||
if response.status_code == 400:
|
||||
response_4XX = Error(**response.json())
|
||||
return response_4XX
|
||||
if response.status_code == 500:
|
||||
response_5XX = Error(**response.json())
|
||||
return response_5XX
|
||||
return Error(**response.json())
|
||||
|
||||
|
||||
def _build_response(
|
||||
*, response: httpx.Response
|
||||
) -> Response[Optional[Union[CustomerBalance, Error]]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
id: Uuid,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Optional[Union[CustomerBalance, Error]]]:
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
client=client,
|
||||
)
|
||||
|
||||
response = httpx.get(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
id: Uuid,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[CustomerBalance, Error]]:
|
||||
"""This endpoint requires authentication by a Zoo employee. It gets the balance information for the specified user.""" # noqa: E501
|
||||
|
||||
return sync_detailed(
|
||||
id=id,
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
id: Uuid,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Optional[Union[CustomerBalance, Error]]]:
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
client=client,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
||||
response = await _client.get(**kwargs)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
id: Uuid,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[CustomerBalance, Error]]:
|
||||
"""This endpoint requires authentication by a Zoo employee. It gets the balance information for the specified user.""" # noqa: E501
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
id=id,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
107
kittycad/api/payments/get_user_subscription.py
Normal file
107
kittycad/api/payments/get_user_subscription.py
Normal file
@ -0,0 +1,107 @@
|
||||
from typing import Any, Dict, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import Client
|
||||
from ...models.error import Error
|
||||
from ...models.zoo_product_subscriptions import ZooProductSubscriptions
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
*,
|
||||
client: Client,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/user/payment/subscriptions".format(
|
||||
client.base_url,
|
||||
) # noqa: E501
|
||||
|
||||
headers: Dict[str, Any] = client.get_headers()
|
||||
cookies: Dict[str, Any] = client.get_cookies()
|
||||
|
||||
return {
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
}
|
||||
|
||||
|
||||
def _parse_response(
|
||||
*, response: httpx.Response
|
||||
) -> Optional[Union[ZooProductSubscriptions, Error]]:
|
||||
if response.status_code == 200:
|
||||
response_200 = ZooProductSubscriptions(**response.json())
|
||||
return response_200
|
||||
if response.status_code == 400:
|
||||
response_4XX = Error(**response.json())
|
||||
return response_4XX
|
||||
if response.status_code == 500:
|
||||
response_5XX = Error(**response.json())
|
||||
return response_5XX
|
||||
return Error(**response.json())
|
||||
|
||||
|
||||
def _build_response(
|
||||
*, response: httpx.Response
|
||||
) -> Response[Optional[Union[ZooProductSubscriptions, Error]]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Optional[Union[ZooProductSubscriptions, Error]]]:
|
||||
kwargs = _get_kwargs(
|
||||
client=client,
|
||||
)
|
||||
|
||||
response = httpx.get(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[ZooProductSubscriptions, Error]]:
|
||||
"""This endpoint requires authentication by any Zoo user. It gets the subscription for the user.""" # noqa: E501
|
||||
|
||||
return sync_detailed(
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Optional[Union[ZooProductSubscriptions, Error]]]:
|
||||
kwargs = _get_kwargs(
|
||||
client=client,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
||||
response = await _client.get(**kwargs)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[ZooProductSubscriptions, Error]]:
|
||||
"""This endpoint requires authentication by any Zoo user. It gets the subscription for the user.""" # noqa: E501
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
120
kittycad/api/payments/update_org_subscription.py
Normal file
120
kittycad/api/payments/update_org_subscription.py
Normal file
@ -0,0 +1,120 @@
|
||||
from typing import Any, Dict, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import Client
|
||||
from ...models.error import Error
|
||||
from ...models.zoo_product_subscriptions import ZooProductSubscriptions
|
||||
from ...models.zoo_product_subscriptions_org_request import (
|
||||
ZooProductSubscriptionsOrgRequest,
|
||||
)
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
body: ZooProductSubscriptionsOrgRequest,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/org/payment/subscriptions".format(
|
||||
client.base_url,
|
||||
) # noqa: E501
|
||||
|
||||
headers: Dict[str, Any] = client.get_headers()
|
||||
cookies: Dict[str, Any] = client.get_cookies()
|
||||
|
||||
return {
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
"content": body.model_dump_json(),
|
||||
}
|
||||
|
||||
|
||||
def _parse_response(
|
||||
*, response: httpx.Response
|
||||
) -> Optional[Union[ZooProductSubscriptions, Error]]:
|
||||
if response.status_code == 200:
|
||||
response_200 = ZooProductSubscriptions(**response.json())
|
||||
return response_200
|
||||
if response.status_code == 400:
|
||||
response_4XX = Error(**response.json())
|
||||
return response_4XX
|
||||
if response.status_code == 500:
|
||||
response_5XX = Error(**response.json())
|
||||
return response_5XX
|
||||
return Error(**response.json())
|
||||
|
||||
|
||||
def _build_response(
|
||||
*, response: httpx.Response
|
||||
) -> Response[Optional[Union[ZooProductSubscriptions, Error]]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
body: ZooProductSubscriptionsOrgRequest,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Optional[Union[ZooProductSubscriptions, Error]]]:
|
||||
kwargs = _get_kwargs(
|
||||
body=body,
|
||||
client=client,
|
||||
)
|
||||
|
||||
response = httpx.put(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
body: ZooProductSubscriptionsOrgRequest,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[ZooProductSubscriptions, Error]]:
|
||||
"""This endpoint requires authentication by an org admin. It updates the subscription for the authenticated user's org.""" # noqa: E501
|
||||
|
||||
return sync_detailed(
|
||||
body=body,
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
body: ZooProductSubscriptionsOrgRequest,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Optional[Union[ZooProductSubscriptions, Error]]]:
|
||||
kwargs = _get_kwargs(
|
||||
body=body,
|
||||
client=client,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
||||
response = await _client.put(**kwargs)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
body: ZooProductSubscriptionsOrgRequest,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[ZooProductSubscriptions, Error]]:
|
||||
"""This endpoint requires authentication by an org admin. It updates the subscription for the authenticated user's org.""" # noqa: E501
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
body=body,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
129
kittycad/api/payments/update_payment_balance_for_any_org.py
Normal file
129
kittycad/api/payments/update_payment_balance_for_any_org.py
Normal file
@ -0,0 +1,129 @@
|
||||
from typing import Any, Dict, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import Client
|
||||
from ...models.customer_balance import CustomerBalance
|
||||
from ...models.error import Error
|
||||
from ...models.update_payment_balance import UpdatePaymentBalance
|
||||
from ...models.uuid import Uuid
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
id: Uuid,
|
||||
body: UpdatePaymentBalance,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/orgs/{id}/payment/balance".format(
|
||||
client.base_url,
|
||||
id=id,
|
||||
) # noqa: E501
|
||||
|
||||
headers: Dict[str, Any] = client.get_headers()
|
||||
cookies: Dict[str, Any] = client.get_cookies()
|
||||
|
||||
return {
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
"content": body.model_dump_json(),
|
||||
}
|
||||
|
||||
|
||||
def _parse_response(
|
||||
*, response: httpx.Response
|
||||
) -> Optional[Union[CustomerBalance, Error]]:
|
||||
if response.status_code == 200:
|
||||
response_200 = CustomerBalance(**response.json())
|
||||
return response_200
|
||||
if response.status_code == 400:
|
||||
response_4XX = Error(**response.json())
|
||||
return response_4XX
|
||||
if response.status_code == 500:
|
||||
response_5XX = Error(**response.json())
|
||||
return response_5XX
|
||||
return Error(**response.json())
|
||||
|
||||
|
||||
def _build_response(
|
||||
*, response: httpx.Response
|
||||
) -> Response[Optional[Union[CustomerBalance, Error]]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
id: Uuid,
|
||||
body: UpdatePaymentBalance,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Optional[Union[CustomerBalance, Error]]]:
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
body=body,
|
||||
client=client,
|
||||
)
|
||||
|
||||
response = httpx.put(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
id: Uuid,
|
||||
body: UpdatePaymentBalance,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[CustomerBalance, Error]]:
|
||||
"""This endpoint requires authentication by a Zoo employee. It updates the balance information for the specified org.""" # noqa: E501
|
||||
|
||||
return sync_detailed(
|
||||
id=id,
|
||||
body=body,
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
id: Uuid,
|
||||
body: UpdatePaymentBalance,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Optional[Union[CustomerBalance, Error]]]:
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
body=body,
|
||||
client=client,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
||||
response = await _client.put(**kwargs)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
id: Uuid,
|
||||
body: UpdatePaymentBalance,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[CustomerBalance, Error]]:
|
||||
"""This endpoint requires authentication by a Zoo employee. It updates the balance information for the specified org.""" # noqa: E501
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
id=id,
|
||||
body=body,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
129
kittycad/api/payments/update_payment_balance_for_any_user.py
Normal file
129
kittycad/api/payments/update_payment_balance_for_any_user.py
Normal file
@ -0,0 +1,129 @@
|
||||
from typing import Any, Dict, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import Client
|
||||
from ...models.customer_balance import CustomerBalance
|
||||
from ...models.error import Error
|
||||
from ...models.update_payment_balance import UpdatePaymentBalance
|
||||
from ...models.uuid import Uuid
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
id: Uuid,
|
||||
body: UpdatePaymentBalance,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/users/{id}/payment/balance".format(
|
||||
client.base_url,
|
||||
id=id,
|
||||
) # noqa: E501
|
||||
|
||||
headers: Dict[str, Any] = client.get_headers()
|
||||
cookies: Dict[str, Any] = client.get_cookies()
|
||||
|
||||
return {
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
"content": body.model_dump_json(),
|
||||
}
|
||||
|
||||
|
||||
def _parse_response(
|
||||
*, response: httpx.Response
|
||||
) -> Optional[Union[CustomerBalance, Error]]:
|
||||
if response.status_code == 200:
|
||||
response_200 = CustomerBalance(**response.json())
|
||||
return response_200
|
||||
if response.status_code == 400:
|
||||
response_4XX = Error(**response.json())
|
||||
return response_4XX
|
||||
if response.status_code == 500:
|
||||
response_5XX = Error(**response.json())
|
||||
return response_5XX
|
||||
return Error(**response.json())
|
||||
|
||||
|
||||
def _build_response(
|
||||
*, response: httpx.Response
|
||||
) -> Response[Optional[Union[CustomerBalance, Error]]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
id: Uuid,
|
||||
body: UpdatePaymentBalance,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Optional[Union[CustomerBalance, Error]]]:
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
body=body,
|
||||
client=client,
|
||||
)
|
||||
|
||||
response = httpx.put(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
id: Uuid,
|
||||
body: UpdatePaymentBalance,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[CustomerBalance, Error]]:
|
||||
"""This endpoint requires authentication by a Zoo employee. It updates the balance information for the specified user.""" # noqa: E501
|
||||
|
||||
return sync_detailed(
|
||||
id=id,
|
||||
body=body,
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
id: Uuid,
|
||||
body: UpdatePaymentBalance,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Optional[Union[CustomerBalance, Error]]]:
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
body=body,
|
||||
client=client,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
||||
response = await _client.put(**kwargs)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
id: Uuid,
|
||||
body: UpdatePaymentBalance,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[CustomerBalance, Error]]:
|
||||
"""This endpoint requires authentication by a Zoo employee. It updates the balance information for the specified user.""" # noqa: E501
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
id=id,
|
||||
body=body,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
120
kittycad/api/payments/update_user_subscription.py
Normal file
120
kittycad/api/payments/update_user_subscription.py
Normal file
@ -0,0 +1,120 @@
|
||||
from typing import Any, Dict, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import Client
|
||||
from ...models.error import Error
|
||||
from ...models.zoo_product_subscriptions import ZooProductSubscriptions
|
||||
from ...models.zoo_product_subscriptions_user_request import (
|
||||
ZooProductSubscriptionsUserRequest,
|
||||
)
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
body: ZooProductSubscriptionsUserRequest,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/user/payment/subscriptions".format(
|
||||
client.base_url,
|
||||
) # noqa: E501
|
||||
|
||||
headers: Dict[str, Any] = client.get_headers()
|
||||
cookies: Dict[str, Any] = client.get_cookies()
|
||||
|
||||
return {
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
"content": body.model_dump_json(),
|
||||
}
|
||||
|
||||
|
||||
def _parse_response(
|
||||
*, response: httpx.Response
|
||||
) -> Optional[Union[ZooProductSubscriptions, Error]]:
|
||||
if response.status_code == 200:
|
||||
response_200 = ZooProductSubscriptions(**response.json())
|
||||
return response_200
|
||||
if response.status_code == 400:
|
||||
response_4XX = Error(**response.json())
|
||||
return response_4XX
|
||||
if response.status_code == 500:
|
||||
response_5XX = Error(**response.json())
|
||||
return response_5XX
|
||||
return Error(**response.json())
|
||||
|
||||
|
||||
def _build_response(
|
||||
*, response: httpx.Response
|
||||
) -> Response[Optional[Union[ZooProductSubscriptions, Error]]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
body: ZooProductSubscriptionsUserRequest,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Optional[Union[ZooProductSubscriptions, Error]]]:
|
||||
kwargs = _get_kwargs(
|
||||
body=body,
|
||||
client=client,
|
||||
)
|
||||
|
||||
response = httpx.put(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
body: ZooProductSubscriptionsUserRequest,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[ZooProductSubscriptions, Error]]:
|
||||
"""This endpoint requires authentication by any Zoo user. It updates the subscription for the user.""" # noqa: E501
|
||||
|
||||
return sync_detailed(
|
||||
body=body,
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
body: ZooProductSubscriptionsUserRequest,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Optional[Union[ZooProductSubscriptions, Error]]]:
|
||||
kwargs = _get_kwargs(
|
||||
body=body,
|
||||
client=client,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
||||
response = await _client.put(**kwargs)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
body: ZooProductSubscriptionsUserRequest,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[ZooProductSubscriptions, Error]]:
|
||||
"""This endpoint requires authentication by any Zoo user. It updates the subscription for the user.""" # noqa: E501
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
body=body,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
1
kittycad/api/service_accounts/__init__.py
Normal file
1
kittycad/api/service_accounts/__init__.py
Normal file
@ -0,0 +1 @@
|
||||
""" Contains methods for accessing the service_accounts API paths: Service accounts allow organizations to call the API. Organization admins can create, delete, and list the service accounts for their org. Service accounts are scoped to an organization not individual users, these are better to use for automations than individual API tokens, since they won't stop working when an individual leaves the company. """ # noqa: E501
|
123
kittycad/api/service_accounts/create_service_account_for_org.py
Normal file
123
kittycad/api/service_accounts/create_service_account_for_org.py
Normal file
@ -0,0 +1,123 @@
|
||||
from typing import Any, Dict, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import Client
|
||||
from ...models.error import Error
|
||||
from ...models.service_account import ServiceAccount
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
*,
|
||||
client: Client,
|
||||
label: Optional[str] = None,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/org/service-accounts".format(
|
||||
client.base_url,
|
||||
) # noqa: E501
|
||||
|
||||
if label is not None:
|
||||
|
||||
if "?" in url:
|
||||
url = url + "&label=" + str(label)
|
||||
else:
|
||||
url = url + "?label=" + str(label)
|
||||
|
||||
headers: Dict[str, Any] = client.get_headers()
|
||||
cookies: Dict[str, Any] = client.get_cookies()
|
||||
|
||||
return {
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
}
|
||||
|
||||
|
||||
def _parse_response(
|
||||
*, response: httpx.Response
|
||||
) -> Optional[Union[ServiceAccount, Error]]:
|
||||
if response.status_code == 201:
|
||||
response_201 = ServiceAccount(**response.json())
|
||||
return response_201
|
||||
if response.status_code == 400:
|
||||
response_4XX = Error(**response.json())
|
||||
return response_4XX
|
||||
if response.status_code == 500:
|
||||
response_5XX = Error(**response.json())
|
||||
return response_5XX
|
||||
return Error(**response.json())
|
||||
|
||||
|
||||
def _build_response(
|
||||
*, response: httpx.Response
|
||||
) -> Response[Optional[Union[ServiceAccount, Error]]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
*,
|
||||
client: Client,
|
||||
label: Optional[str] = None,
|
||||
) -> Response[Optional[Union[ServiceAccount, Error]]]:
|
||||
kwargs = _get_kwargs(
|
||||
label=label,
|
||||
client=client,
|
||||
)
|
||||
|
||||
response = httpx.post(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
*,
|
||||
client: Client,
|
||||
label: Optional[str] = None,
|
||||
) -> Optional[Union[ServiceAccount, Error]]:
|
||||
"""This endpoint requires authentication by an org admin. It creates a new service account for the organization.""" # noqa: E501
|
||||
|
||||
return sync_detailed(
|
||||
label=label,
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
*,
|
||||
client: Client,
|
||||
label: Optional[str] = None,
|
||||
) -> Response[Optional[Union[ServiceAccount, Error]]]:
|
||||
kwargs = _get_kwargs(
|
||||
label=label,
|
||||
client=client,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
||||
response = await _client.post(**kwargs)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
*,
|
||||
client: Client,
|
||||
label: Optional[str] = None,
|
||||
) -> Optional[Union[ServiceAccount, Error]]:
|
||||
"""This endpoint requires authentication by an org admin. It creates a new service account for the organization.""" # noqa: E501
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
label=label,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
114
kittycad/api/service_accounts/delete_service_account_for_org.py
Normal file
114
kittycad/api/service_accounts/delete_service_account_for_org.py
Normal file
@ -0,0 +1,114 @@
|
||||
from typing import Any, Dict, Optional
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import Client
|
||||
from ...models.error import Error
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
token: str,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/org/service-accounts/{token}".format(
|
||||
client.base_url,
|
||||
token=token,
|
||||
) # noqa: E501
|
||||
|
||||
headers: Dict[str, Any] = client.get_headers()
|
||||
cookies: Dict[str, Any] = client.get_cookies()
|
||||
|
||||
return {
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
}
|
||||
|
||||
|
||||
def _parse_response(*, response: httpx.Response) -> Optional[Error]:
|
||||
return None
|
||||
if response.status_code == 400:
|
||||
response_4XX = Error(**response.json())
|
||||
return response_4XX
|
||||
if response.status_code == 500:
|
||||
response_5XX = Error(**response.json())
|
||||
return response_5XX
|
||||
return Error(**response.json())
|
||||
|
||||
|
||||
def _build_response(*, response: httpx.Response) -> Response[Optional[Error]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
token: str,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Optional[Error]]:
|
||||
kwargs = _get_kwargs(
|
||||
token=token,
|
||||
client=client,
|
||||
)
|
||||
|
||||
response = httpx.delete(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
token: str,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Error]:
|
||||
"""This endpoint requires authentication by an org admin. It deletes the requested service account for the organization.
|
||||
This endpoint does not actually delete the service account from the database. It merely marks the token as invalid. We still want to keep the service account in the database for historical purposes.
|
||||
""" # noqa: E501
|
||||
|
||||
return sync_detailed(
|
||||
token=token,
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
token: str,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Optional[Error]]:
|
||||
kwargs = _get_kwargs(
|
||||
token=token,
|
||||
client=client,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
||||
response = await _client.delete(**kwargs)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
token: str,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Error]:
|
||||
"""This endpoint requires authentication by an org admin. It deletes the requested service account for the organization.
|
||||
This endpoint does not actually delete the service account from the database. It merely marks the token as invalid. We still want to keep the service account in the database for historical purposes.
|
||||
""" # noqa: E501
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
token=token,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
117
kittycad/api/service_accounts/get_service_account_for_org.py
Normal file
117
kittycad/api/service_accounts/get_service_account_for_org.py
Normal file
@ -0,0 +1,117 @@
|
||||
from typing import Any, Dict, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import Client
|
||||
from ...models.error import Error
|
||||
from ...models.service_account import ServiceAccount
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
token: str,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/org/service-accounts/{token}".format(
|
||||
client.base_url,
|
||||
token=token,
|
||||
) # noqa: E501
|
||||
|
||||
headers: Dict[str, Any] = client.get_headers()
|
||||
cookies: Dict[str, Any] = client.get_cookies()
|
||||
|
||||
return {
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
}
|
||||
|
||||
|
||||
def _parse_response(
|
||||
*, response: httpx.Response
|
||||
) -> Optional[Union[ServiceAccount, Error]]:
|
||||
if response.status_code == 200:
|
||||
response_200 = ServiceAccount(**response.json())
|
||||
return response_200
|
||||
if response.status_code == 400:
|
||||
response_4XX = Error(**response.json())
|
||||
return response_4XX
|
||||
if response.status_code == 500:
|
||||
response_5XX = Error(**response.json())
|
||||
return response_5XX
|
||||
return Error(**response.json())
|
||||
|
||||
|
||||
def _build_response(
|
||||
*, response: httpx.Response
|
||||
) -> Response[Optional[Union[ServiceAccount, Error]]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
token: str,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Optional[Union[ServiceAccount, Error]]]:
|
||||
kwargs = _get_kwargs(
|
||||
token=token,
|
||||
client=client,
|
||||
)
|
||||
|
||||
response = httpx.get(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
token: str,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[ServiceAccount, Error]]:
|
||||
"""This endpoint requires authentication by an org admin. It returns details of the requested service account for the organization.""" # noqa: E501
|
||||
|
||||
return sync_detailed(
|
||||
token=token,
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
token: str,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Optional[Union[ServiceAccount, Error]]]:
|
||||
kwargs = _get_kwargs(
|
||||
token=token,
|
||||
client=client,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
||||
response = await _client.get(**kwargs)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
token: str,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[ServiceAccount, Error]]:
|
||||
"""This endpoint requires authentication by an org admin. It returns details of the requested service account for the organization.""" # noqa: E501
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
token=token,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
160
kittycad/api/service_accounts/list_service_accounts_for_org.py
Normal file
160
kittycad/api/service_accounts/list_service_accounts_for_org.py
Normal file
@ -0,0 +1,160 @@
|
||||
from typing import Any, Dict, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import Client
|
||||
from ...models.created_at_sort_mode import CreatedAtSortMode
|
||||
from ...models.error import Error
|
||||
from ...models.service_account_results_page import ServiceAccountResultsPage
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
sort_by: CreatedAtSortMode,
|
||||
*,
|
||||
client: Client,
|
||||
limit: Optional[int] = None,
|
||||
page_token: Optional[str] = None,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/org/service-accounts".format(
|
||||
client.base_url,
|
||||
) # noqa: E501
|
||||
|
||||
if limit is not None:
|
||||
|
||||
if "?" in url:
|
||||
url = url + "&limit=" + str(limit)
|
||||
else:
|
||||
url = url + "?limit=" + str(limit)
|
||||
|
||||
if page_token is not None:
|
||||
|
||||
if "?" in url:
|
||||
url = url + "&page_token=" + str(page_token)
|
||||
else:
|
||||
url = url + "?page_token=" + str(page_token)
|
||||
|
||||
if sort_by is not None:
|
||||
|
||||
if "?" in url:
|
||||
url = url + "&sort_by=" + str(sort_by)
|
||||
else:
|
||||
url = url + "?sort_by=" + str(sort_by)
|
||||
|
||||
headers: Dict[str, Any] = client.get_headers()
|
||||
cookies: Dict[str, Any] = client.get_cookies()
|
||||
|
||||
return {
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
}
|
||||
|
||||
|
||||
def _parse_response(
|
||||
*, response: httpx.Response
|
||||
) -> Optional[Union[ServiceAccountResultsPage, Error]]:
|
||||
if response.status_code == 200:
|
||||
response_200 = ServiceAccountResultsPage(**response.json())
|
||||
return response_200
|
||||
if response.status_code == 400:
|
||||
response_4XX = Error(**response.json())
|
||||
return response_4XX
|
||||
if response.status_code == 500:
|
||||
response_5XX = Error(**response.json())
|
||||
return response_5XX
|
||||
return Error(**response.json())
|
||||
|
||||
|
||||
def _build_response(
|
||||
*, response: httpx.Response
|
||||
) -> Response[Optional[Union[ServiceAccountResultsPage, Error]]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
sort_by: CreatedAtSortMode,
|
||||
*,
|
||||
client: Client,
|
||||
limit: Optional[int] = None,
|
||||
page_token: Optional[str] = None,
|
||||
) -> Response[Optional[Union[ServiceAccountResultsPage, Error]]]:
|
||||
kwargs = _get_kwargs(
|
||||
limit=limit,
|
||||
page_token=page_token,
|
||||
sort_by=sort_by,
|
||||
client=client,
|
||||
)
|
||||
|
||||
response = httpx.get(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
sort_by: CreatedAtSortMode,
|
||||
*,
|
||||
client: Client,
|
||||
limit: Optional[int] = None,
|
||||
page_token: Optional[str] = None,
|
||||
) -> Optional[Union[ServiceAccountResultsPage, Error]]:
|
||||
"""This endpoint requires authentication by an org admin. It returns the service accounts for the organization.
|
||||
The service accounts are returned in order of creation, with the most recently created service accounts first.
|
||||
""" # noqa: E501
|
||||
|
||||
return sync_detailed(
|
||||
limit=limit,
|
||||
page_token=page_token,
|
||||
sort_by=sort_by,
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
sort_by: CreatedAtSortMode,
|
||||
*,
|
||||
client: Client,
|
||||
limit: Optional[int] = None,
|
||||
page_token: Optional[str] = None,
|
||||
) -> Response[Optional[Union[ServiceAccountResultsPage, Error]]]:
|
||||
kwargs = _get_kwargs(
|
||||
limit=limit,
|
||||
page_token=page_token,
|
||||
sort_by=sort_by,
|
||||
client=client,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
||||
response = await _client.get(**kwargs)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
sort_by: CreatedAtSortMode,
|
||||
*,
|
||||
client: Client,
|
||||
limit: Optional[int] = None,
|
||||
page_token: Optional[str] = None,
|
||||
) -> Optional[Union[ServiceAccountResultsPage, Error]]:
|
||||
"""This endpoint requires authentication by an org admin. It returns the service accounts for the organization.
|
||||
The service accounts are returned in order of creation, with the most recently created service accounts first.
|
||||
""" # noqa: E501
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
limit=limit,
|
||||
page_token=page_token,
|
||||
sort_by=sort_by,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
1
kittycad/api/store/__init__.py
Normal file
1
kittycad/api/store/__init__.py
Normal file
@ -0,0 +1 @@
|
||||
""" Contains methods for accessing the store API paths: Operations involving our swag store. """ # noqa: E501
|
118
kittycad/api/store/create_store_coupon.py
Normal file
118
kittycad/api/store/create_store_coupon.py
Normal file
@ -0,0 +1,118 @@
|
||||
from typing import Any, Dict, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import Client
|
||||
from ...models.discount_code import DiscountCode
|
||||
from ...models.error import Error
|
||||
from ...models.store_coupon_params import StoreCouponParams
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
body: StoreCouponParams,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/store/coupon".format(
|
||||
client.base_url,
|
||||
) # noqa: E501
|
||||
|
||||
headers: Dict[str, Any] = client.get_headers()
|
||||
cookies: Dict[str, Any] = client.get_cookies()
|
||||
|
||||
return {
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
"content": body.model_dump_json(),
|
||||
}
|
||||
|
||||
|
||||
def _parse_response(
|
||||
*, response: httpx.Response
|
||||
) -> Optional[Union[DiscountCode, Error]]:
|
||||
if response.status_code == 201:
|
||||
response_201 = DiscountCode(**response.json())
|
||||
return response_201
|
||||
if response.status_code == 400:
|
||||
response_4XX = Error(**response.json())
|
||||
return response_4XX
|
||||
if response.status_code == 500:
|
||||
response_5XX = Error(**response.json())
|
||||
return response_5XX
|
||||
return Error(**response.json())
|
||||
|
||||
|
||||
def _build_response(
|
||||
*, response: httpx.Response
|
||||
) -> Response[Optional[Union[DiscountCode, Error]]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
body: StoreCouponParams,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Optional[Union[DiscountCode, Error]]]:
|
||||
kwargs = _get_kwargs(
|
||||
body=body,
|
||||
client=client,
|
||||
)
|
||||
|
||||
response = httpx.post(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
body: StoreCouponParams,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[DiscountCode, Error]]:
|
||||
"""This endpoint requires authentication by a Zoo employee. It creates a new store coupon.""" # noqa: E501
|
||||
|
||||
return sync_detailed(
|
||||
body=body,
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
body: StoreCouponParams,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Optional[Union[DiscountCode, Error]]]:
|
||||
kwargs = _get_kwargs(
|
||||
body=body,
|
||||
client=client,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
||||
response = await _client.post(**kwargs)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
body: StoreCouponParams,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[DiscountCode, Error]]:
|
||||
"""This endpoint requires authentication by a Zoo employee. It creates a new store coupon.""" # noqa: E501
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
body=body,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
@ -23,6 +23,7 @@ def _get_kwargs(
|
||||
) # noqa: E501
|
||||
|
||||
if value is not None:
|
||||
|
||||
if "?" in url:
|
||||
url = url + "&value=" + str(value)
|
||||
else:
|
||||
|
@ -23,6 +23,7 @@ def _get_kwargs(
|
||||
) # noqa: E501
|
||||
|
||||
if value is not None:
|
||||
|
||||
if "?" in url:
|
||||
url = url + "&value=" + str(value)
|
||||
else:
|
||||
|
@ -23,6 +23,7 @@ def _get_kwargs(
|
||||
) # noqa: E501
|
||||
|
||||
if value is not None:
|
||||
|
||||
if "?" in url:
|
||||
url = url + "&value=" + str(value)
|
||||
else:
|
||||
|
@ -23,6 +23,7 @@ def _get_kwargs(
|
||||
) # noqa: E501
|
||||
|
||||
if value is not None:
|
||||
|
||||
if "?" in url:
|
||||
url = url + "&value=" + str(value)
|
||||
else:
|
||||
|
@ -23,6 +23,7 @@ def _get_kwargs(
|
||||
) # noqa: E501
|
||||
|
||||
if value is not None:
|
||||
|
||||
if "?" in url:
|
||||
url = url + "&value=" + str(value)
|
||||
else:
|
||||
|
@ -23,6 +23,7 @@ def _get_kwargs(
|
||||
) # noqa: E501
|
||||
|
||||
if value is not None:
|
||||
|
||||
if "?" in url:
|
||||
url = url + "&value=" + str(value)
|
||||
else:
|
||||
|
@ -23,6 +23,7 @@ def _get_kwargs(
|
||||
) # noqa: E501
|
||||
|
||||
if value is not None:
|
||||
|
||||
if "?" in url:
|
||||
url = url + "&value=" + str(value)
|
||||
else:
|
||||
|
@ -23,6 +23,7 @@ def _get_kwargs(
|
||||
) # noqa: E501
|
||||
|
||||
if value is not None:
|
||||
|
||||
if "?" in url:
|
||||
url = url + "&value=" + str(value)
|
||||
else:
|
||||
|
@ -23,6 +23,7 @@ def _get_kwargs(
|
||||
) # noqa: E501
|
||||
|
||||
if value is not None:
|
||||
|
||||
if "?" in url:
|
||||
url = url + "&value=" + str(value)
|
||||
else:
|
||||
|
@ -23,6 +23,7 @@ def _get_kwargs(
|
||||
) # noqa: E501
|
||||
|
||||
if value is not None:
|
||||
|
||||
if "?" in url:
|
||||
url = url + "&value=" + str(value)
|
||||
else:
|
||||
|
@ -23,6 +23,7 @@ def _get_kwargs(
|
||||
) # noqa: E501
|
||||
|
||||
if value is not None:
|
||||
|
||||
if "?" in url:
|
||||
url = url + "&value=" + str(value)
|
||||
else:
|
||||
|
@ -23,6 +23,7 @@ def _get_kwargs(
|
||||
) # noqa: E501
|
||||
|
||||
if value is not None:
|
||||
|
||||
if "?" in url:
|
||||
url = url + "&value=" + str(value)
|
||||
else:
|
||||
|
@ -23,6 +23,7 @@ def _get_kwargs(
|
||||
) # noqa: E501
|
||||
|
||||
if value is not None:
|
||||
|
||||
if "?" in url:
|
||||
url = url + "&value=" + str(value)
|
||||
else:
|
||||
|
111
kittycad/api/users/get_oauth2_providers_for_user.py
Normal file
111
kittycad/api/users/get_oauth2_providers_for_user.py
Normal file
@ -0,0 +1,111 @@
|
||||
from typing import Any, Dict, List, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import Client
|
||||
from ...models.account_provider import AccountProvider
|
||||
from ...models.error import Error
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
*,
|
||||
client: Client,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/user/oauth2/providers".format(
|
||||
client.base_url,
|
||||
) # noqa: E501
|
||||
|
||||
headers: Dict[str, Any] = client.get_headers()
|
||||
cookies: Dict[str, Any] = client.get_cookies()
|
||||
|
||||
return {
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
}
|
||||
|
||||
|
||||
def _parse_response(
|
||||
*, response: httpx.Response
|
||||
) -> Optional[Union[List[AccountProvider], Error]]:
|
||||
if response.status_code == 200:
|
||||
response_200 = [AccountProvider(**item) for item in response.json()]
|
||||
return response_200
|
||||
if response.status_code == 400:
|
||||
response_4XX = Error(**response.json())
|
||||
return response_4XX
|
||||
if response.status_code == 500:
|
||||
response_5XX = Error(**response.json())
|
||||
return response_5XX
|
||||
return Error(**response.json())
|
||||
|
||||
|
||||
def _build_response(
|
||||
*, response: httpx.Response
|
||||
) -> Response[Optional[Union[List[AccountProvider], Error]]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Optional[Union[List[AccountProvider], Error]]]:
|
||||
kwargs = _get_kwargs(
|
||||
client=client,
|
||||
)
|
||||
|
||||
response = httpx.get(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[List[AccountProvider], Error]]:
|
||||
"""If this returns an empty array, then the user has not connected any OAuth2 providers and uses raw email authentication.
|
||||
This endpoint requires authentication by any Zoo user. It gets the providers for the authenticated user.
|
||||
""" # noqa: E501
|
||||
|
||||
return sync_detailed(
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Optional[Union[List[AccountProvider], Error]]]:
|
||||
kwargs = _get_kwargs(
|
||||
client=client,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
||||
response = await _client.get(**kwargs)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[List[AccountProvider], Error]]:
|
||||
"""If this returns an empty array, then the user has not connected any OAuth2 providers and uses raw email authentication.
|
||||
This endpoint requires authentication by any Zoo user. It gets the providers for the authenticated user.
|
||||
""" # noqa: E501
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
107
kittycad/api/users/get_user_privacy_settings.py
Normal file
107
kittycad/api/users/get_user_privacy_settings.py
Normal file
@ -0,0 +1,107 @@
|
||||
from typing import Any, Dict, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import Client
|
||||
from ...models.error import Error
|
||||
from ...models.privacy_settings import PrivacySettings
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
*,
|
||||
client: Client,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/user/privacy".format(
|
||||
client.base_url,
|
||||
) # noqa: E501
|
||||
|
||||
headers: Dict[str, Any] = client.get_headers()
|
||||
cookies: Dict[str, Any] = client.get_cookies()
|
||||
|
||||
return {
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
}
|
||||
|
||||
|
||||
def _parse_response(
|
||||
*, response: httpx.Response
|
||||
) -> Optional[Union[PrivacySettings, Error]]:
|
||||
if response.status_code == 200:
|
||||
response_200 = PrivacySettings(**response.json())
|
||||
return response_200
|
||||
if response.status_code == 400:
|
||||
response_4XX = Error(**response.json())
|
||||
return response_4XX
|
||||
if response.status_code == 500:
|
||||
response_5XX = Error(**response.json())
|
||||
return response_5XX
|
||||
return Error(**response.json())
|
||||
|
||||
|
||||
def _build_response(
|
||||
*, response: httpx.Response
|
||||
) -> Response[Optional[Union[PrivacySettings, Error]]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Optional[Union[PrivacySettings, Error]]]:
|
||||
kwargs = _get_kwargs(
|
||||
client=client,
|
||||
)
|
||||
|
||||
response = httpx.get(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[PrivacySettings, Error]]:
|
||||
"""This endpoint requires authentication by any Zoo user. It gets the privacy settings for the user.""" # noqa: E501
|
||||
|
||||
return sync_detailed(
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Optional[Union[PrivacySettings, Error]]]:
|
||||
kwargs = _get_kwargs(
|
||||
client=client,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
||||
response = await _client.get(**kwargs)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[PrivacySettings, Error]]:
|
||||
"""This endpoint requires authentication by any Zoo user. It gets the privacy settings for the user.""" # noqa: E501
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
@ -21,18 +21,21 @@ def _get_kwargs(
|
||||
) # noqa: E501
|
||||
|
||||
if limit is not None:
|
||||
|
||||
if "?" in url:
|
||||
url = url + "&limit=" + str(limit)
|
||||
else:
|
||||
url = url + "?limit=" + str(limit)
|
||||
|
||||
if page_token is not None:
|
||||
|
||||
if "?" in url:
|
||||
url = url + "&page_token=" + str(page_token)
|
||||
else:
|
||||
url = url + "?page_token=" + str(page_token)
|
||||
|
||||
if sort_by is not None:
|
||||
|
||||
if "?" in url:
|
||||
url = url + "&sort_by=" + str(sort_by)
|
||||
else:
|
||||
@ -104,7 +107,7 @@ def sync(
|
||||
limit: Optional[int] = None,
|
||||
page_token: Optional[str] = None,
|
||||
) -> Optional[Union[UserResultsPage, Error]]:
|
||||
"""This endpoint required authentication by a Zoo employee. The users are returned in order of creation, with the most recently created users first.""" # noqa: E501
|
||||
"""This endpoint requires authentication by a Zoo employee. The users are returned in order of creation, with the most recently created users first.""" # noqa: E501
|
||||
|
||||
return sync_detailed(
|
||||
limit=limit,
|
||||
@ -141,7 +144,7 @@ async def asyncio(
|
||||
limit: Optional[int] = None,
|
||||
page_token: Optional[str] = None,
|
||||
) -> Optional[Union[UserResultsPage, Error]]:
|
||||
"""This endpoint required authentication by a Zoo employee. The users are returned in order of creation, with the most recently created users first.""" # noqa: E501
|
||||
"""This endpoint requires authentication by a Zoo employee. The users are returned in order of creation, with the most recently created users first.""" # noqa: E501
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
|
@ -21,18 +21,21 @@ def _get_kwargs(
|
||||
) # noqa: E501
|
||||
|
||||
if limit is not None:
|
||||
|
||||
if "?" in url:
|
||||
url = url + "&limit=" + str(limit)
|
||||
else:
|
||||
url = url + "?limit=" + str(limit)
|
||||
|
||||
if page_token is not None:
|
||||
|
||||
if "?" in url:
|
||||
url = url + "&page_token=" + str(page_token)
|
||||
else:
|
||||
url = url + "?page_token=" + str(page_token)
|
||||
|
||||
if sort_by is not None:
|
||||
|
||||
if "?" in url:
|
||||
url = url + "&sort_by=" + str(sort_by)
|
||||
else:
|
||||
@ -104,7 +107,7 @@ def sync(
|
||||
limit: Optional[int] = None,
|
||||
page_token: Optional[str] = None,
|
||||
) -> Optional[Union[ExtendedUserResultsPage, Error]]:
|
||||
"""This endpoint required authentication by a Zoo employee. The users are returned in order of creation, with the most recently created users first.""" # noqa: E501
|
||||
"""This endpoint requires authentication by a Zoo employee. The users are returned in order of creation, with the most recently created users first.""" # noqa: E501
|
||||
|
||||
return sync_detailed(
|
||||
limit=limit,
|
||||
@ -141,7 +144,7 @@ async def asyncio(
|
||||
limit: Optional[int] = None,
|
||||
page_token: Optional[str] = None,
|
||||
) -> Optional[Union[ExtendedUserResultsPage, Error]]:
|
||||
"""This endpoint required authentication by a Zoo employee. The users are returned in order of creation, with the most recently created users first.""" # noqa: E501
|
||||
"""This endpoint requires authentication by a Zoo employee. The users are returned in order of creation, with the most recently created users first.""" # noqa: E501
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
|
117
kittycad/api/users/update_user_privacy_settings.py
Normal file
117
kittycad/api/users/update_user_privacy_settings.py
Normal file
@ -0,0 +1,117 @@
|
||||
from typing import Any, Dict, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import Client
|
||||
from ...models.error import Error
|
||||
from ...models.privacy_settings import PrivacySettings
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
body: PrivacySettings,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/user/privacy".format(
|
||||
client.base_url,
|
||||
) # noqa: E501
|
||||
|
||||
headers: Dict[str, Any] = client.get_headers()
|
||||
cookies: Dict[str, Any] = client.get_cookies()
|
||||
|
||||
return {
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
"content": body.model_dump_json(),
|
||||
}
|
||||
|
||||
|
||||
def _parse_response(
|
||||
*, response: httpx.Response
|
||||
) -> Optional[Union[PrivacySettings, Error]]:
|
||||
if response.status_code == 200:
|
||||
response_200 = PrivacySettings(**response.json())
|
||||
return response_200
|
||||
if response.status_code == 400:
|
||||
response_4XX = Error(**response.json())
|
||||
return response_4XX
|
||||
if response.status_code == 500:
|
||||
response_5XX = Error(**response.json())
|
||||
return response_5XX
|
||||
return Error(**response.json())
|
||||
|
||||
|
||||
def _build_response(
|
||||
*, response: httpx.Response
|
||||
) -> Response[Optional[Union[PrivacySettings, Error]]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
body: PrivacySettings,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Optional[Union[PrivacySettings, Error]]]:
|
||||
kwargs = _get_kwargs(
|
||||
body=body,
|
||||
client=client,
|
||||
)
|
||||
|
||||
response = httpx.put(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
body: PrivacySettings,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[PrivacySettings, Error]]:
|
||||
"""This endpoint requires authentication by any Zoo user. It updates the privacy settings for the user.""" # noqa: E501
|
||||
|
||||
return sync_detailed(
|
||||
body=body,
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
body: PrivacySettings,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Optional[Union[PrivacySettings, Error]]]:
|
||||
kwargs = _get_kwargs(
|
||||
body=body,
|
||||
client=client,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
||||
response = await _client.put(**kwargs)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
body: PrivacySettings,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[PrivacySettings, Error]]:
|
||||
"""This endpoint requires authentication by any Zoo user. It updates the privacy settings for the user.""" # noqa: E501
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
body=body,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
@ -39,6 +39,7 @@ from .models import (
|
||||
ModelingCmd,
|
||||
ModelingCmdId,
|
||||
Pong,
|
||||
PostEffectType,
|
||||
System,
|
||||
TextToCad,
|
||||
TextToCadCreateBody,
|
||||
@ -173,13 +174,13 @@ async def test_file_convert_stl_async():
|
||||
file.close()
|
||||
|
||||
# Get the fc.
|
||||
result: Optional[
|
||||
Union[FileConversion, Error]
|
||||
] = await create_file_conversion.asyncio(
|
||||
client=client,
|
||||
body=content,
|
||||
src_format=FileImportFormat.STL,
|
||||
output_format=FileExportFormat.OBJ,
|
||||
result: Optional[Union[FileConversion, Error]] = (
|
||||
await create_file_conversion.asyncio(
|
||||
client=client,
|
||||
body=content,
|
||||
src_format=FileImportFormat.STL,
|
||||
output_format=FileExportFormat.OBJ,
|
||||
)
|
||||
)
|
||||
|
||||
assert isinstance(result, FileConversion)
|
||||
@ -212,13 +213,13 @@ async def test_file_convert_obj_async():
|
||||
file.close()
|
||||
|
||||
# Get the fc.
|
||||
result: Optional[
|
||||
Union[FileConversion, Error]
|
||||
] = await create_file_conversion.asyncio(
|
||||
client=client,
|
||||
body=content,
|
||||
src_format=FileImportFormat.OBJ,
|
||||
output_format=FileExportFormat.STL,
|
||||
result: Optional[Union[FileConversion, Error]] = (
|
||||
await create_file_conversion.asyncio(
|
||||
client=client,
|
||||
body=content,
|
||||
src_format=FileImportFormat.OBJ,
|
||||
output_format=FileExportFormat.STL,
|
||||
)
|
||||
)
|
||||
|
||||
assert isinstance(result, FileConversion)
|
||||
@ -356,6 +357,8 @@ def test_ws_simple():
|
||||
with modeling_commands_ws.WebSocket(
|
||||
client=client,
|
||||
fps=30,
|
||||
show_grid=False,
|
||||
post_effect=PostEffectType.NOEFFECT,
|
||||
unlocked_framerate=False,
|
||||
video_res_height=360,
|
||||
video_res_width=480,
|
||||
@ -383,6 +386,8 @@ def test_ws_import():
|
||||
with modeling_commands_ws.WebSocket(
|
||||
client=client,
|
||||
fps=30,
|
||||
post_effect=PostEffectType.NOEFFECT,
|
||||
show_grid=False,
|
||||
unlocked_framerate=False,
|
||||
video_res_height=360,
|
||||
video_res_width=480,
|
||||
@ -556,11 +561,11 @@ def test_text_to_cad():
|
||||
while (
|
||||
body.status == ApiCallStatus.IN_PROGRESS or body.status == ApiCallStatus.QUEUED
|
||||
) and time.time() - start_time < 120:
|
||||
result_status: Optional[
|
||||
Union[TextToCad, Error]
|
||||
] = get_text_to_cad_model_for_user.sync(
|
||||
client=client,
|
||||
id=body.id,
|
||||
result_status: Optional[Union[TextToCad, Error]] = (
|
||||
get_text_to_cad_model_for_user.sync(
|
||||
client=client,
|
||||
id=body.id,
|
||||
)
|
||||
)
|
||||
|
||||
if isinstance(result_status, Error) or result_status is None:
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -28,15 +28,21 @@ from .async_api_call import AsyncApiCall
|
||||
from .async_api_call_output import AsyncApiCallOutput
|
||||
from .async_api_call_results_page import AsyncApiCallResultsPage
|
||||
from .async_api_call_type import AsyncApiCallType
|
||||
from .auth_callback import AuthCallback
|
||||
from .axis import Axis
|
||||
from .axis_direction_pair import AxisDirectionPair
|
||||
from .batch_response import BatchResponse
|
||||
from .billing_info import BillingInfo
|
||||
from .block_reason import BlockReason
|
||||
from .cache_metadata import CacheMetadata
|
||||
from .camera_drag_end import CameraDragEnd
|
||||
from .camera_drag_interaction_type import CameraDragInteractionType
|
||||
from .camera_drag_move import CameraDragMove
|
||||
from .camera_settings import CameraSettings
|
||||
from .card_details import CardDetails
|
||||
from .center_of_mass import CenterOfMass
|
||||
from .client_metrics import ClientMetrics
|
||||
from .close_path import ClosePath
|
||||
from .cluster import Cluster
|
||||
from .code_language import CodeLanguage
|
||||
from .code_output import CodeOutput
|
||||
@ -52,29 +58,44 @@ from .curve_get_type import CurveGetType
|
||||
from .curve_type import CurveType
|
||||
from .customer import Customer
|
||||
from .customer_balance import CustomerBalance
|
||||
from .cut_type import CutType
|
||||
from .default_camera_focus_on import DefaultCameraFocusOn
|
||||
from .default_camera_get_settings import DefaultCameraGetSettings
|
||||
from .default_camera_zoom import DefaultCameraZoom
|
||||
from .density import Density
|
||||
from .der_encoded_key_pair import DerEncodedKeyPair
|
||||
from .device_access_token_request_form import DeviceAccessTokenRequestForm
|
||||
from .device_auth_request_form import DeviceAuthRequestForm
|
||||
from .device_auth_verify_params import DeviceAuthVerifyParams
|
||||
from .direction import Direction
|
||||
from .discount import Discount
|
||||
from .discount_code import DiscountCode
|
||||
from .distance_type import DistanceType
|
||||
from .email_authentication_form import EmailAuthenticationForm
|
||||
from .empty import Empty
|
||||
from .entity_circular_pattern import EntityCircularPattern
|
||||
from .entity_get_all_child_uuids import EntityGetAllChildUuids
|
||||
from .entity_get_child_uuid import EntityGetChildUuid
|
||||
from .entity_get_distance import EntityGetDistance
|
||||
from .entity_get_num_children import EntityGetNumChildren
|
||||
from .entity_get_parent_id import EntityGetParentId
|
||||
from .entity_linear_pattern import EntityLinearPattern
|
||||
from .entity_linear_pattern_transform import EntityLinearPatternTransform
|
||||
from .entity_type import EntityType
|
||||
from .environment import Environment
|
||||
from .error import Error
|
||||
from .error_code import ErrorCode
|
||||
from .event import Event
|
||||
from .export import Export
|
||||
from .export_file import ExportFile
|
||||
from .extended_user import ExtendedUser
|
||||
from .extended_user_results_page import ExtendedUserResultsPage
|
||||
from .extrusion_face_cap_type import ExtrusionFaceCapType
|
||||
from .extrusion_face_info import ExtrusionFaceInfo
|
||||
from .face_get_center import FaceGetCenter
|
||||
from .face_get_gradient import FaceGetGradient
|
||||
from .face_get_position import FaceGetPosition
|
||||
from .face_is_planar import FaceIsPlanar
|
||||
from .failure_web_socket_response import FailureWebSocketResponse
|
||||
from .fbx_storage import FbxStorage
|
||||
from .file_center_of_mass import FileCenterOfMass
|
||||
@ -88,28 +109,46 @@ from .file_system_metadata import FileSystemMetadata
|
||||
from .file_volume import FileVolume
|
||||
from .gateway import Gateway
|
||||
from .get_entity_type import GetEntityType
|
||||
from .get_num_objects import GetNumObjects
|
||||
from .get_sketch_mode_plane import GetSketchModePlane
|
||||
from .global_axis import GlobalAxis
|
||||
from .gltf_presentation import GltfPresentation
|
||||
from .gltf_storage import GltfStorage
|
||||
from .highlight_set_entity import HighlightSetEntity
|
||||
from .ice_server import IceServer
|
||||
from .idp_metadata_source import IdpMetadataSource
|
||||
from .image_format import ImageFormat
|
||||
from .import_file import ImportFile
|
||||
from .import_files import ImportFiles
|
||||
from .imported_geometry import ImportedGeometry
|
||||
from .input_format import InputFormat
|
||||
from .invoice import Invoice
|
||||
from .invoice_line_item import InvoiceLineItem
|
||||
from .invoice_status import InvoiceStatus
|
||||
from .ip_addr_info import IpAddrInfo
|
||||
from .jetstream import Jetstream
|
||||
from .jetstream_api_stats import JetstreamApiStats
|
||||
from .jetstream_config import JetstreamConfig
|
||||
from .jetstream_stats import JetstreamStats
|
||||
from .kcl_code_completion_params import KclCodeCompletionParams
|
||||
from .kcl_code_completion_request import KclCodeCompletionRequest
|
||||
from .kcl_code_completion_response import KclCodeCompletionResponse
|
||||
from .leaf_node import LeafNode
|
||||
from .length_unit import LengthUnit
|
||||
from .linear_transform import LinearTransform
|
||||
from .mass import Mass
|
||||
from .meta_cluster_info import MetaClusterInfo
|
||||
from .metadata import Metadata
|
||||
from .method import Method
|
||||
from .modeling_app_event_type import ModelingAppEventType
|
||||
from .modeling_app_individual_subscription_tier import (
|
||||
ModelingAppIndividualSubscriptionTier,
|
||||
)
|
||||
from .modeling_app_organization_subscription_tier import (
|
||||
ModelingAppOrganizationSubscriptionTier,
|
||||
)
|
||||
from .modeling_app_subscription_tier import ModelingAppSubscriptionTier
|
||||
from .modeling_app_subscription_tier_name import ModelingAppSubscriptionTierName
|
||||
from .modeling_cmd import ModelingCmd
|
||||
from .modeling_cmd_id import ModelingCmdId
|
||||
from .modeling_cmd_req import ModelingCmdReq
|
||||
@ -123,6 +162,7 @@ from .org import Org
|
||||
from .org_details import OrgDetails
|
||||
from .org_member import OrgMember
|
||||
from .org_member_results_page import OrgMemberResultsPage
|
||||
from .org_results_page import OrgResultsPage
|
||||
from .org_role import OrgRole
|
||||
from .output_file import OutputFile
|
||||
from .output_format import OutputFormat
|
||||
@ -139,28 +179,43 @@ from .payment_method import PaymentMethod
|
||||
from .payment_method_card_checks import PaymentMethodCardChecks
|
||||
from .payment_method_type import PaymentMethodType
|
||||
from .perspective_camera_parameters import PerspectiveCameraParameters
|
||||
from .plan_interval import PlanInterval
|
||||
from .plane_intersect_and_project import PlaneIntersectAndProject
|
||||
from .ply_storage import PlyStorage
|
||||
from .point2d import Point2d
|
||||
from .point3d import Point3d
|
||||
from .point4d import Point4d
|
||||
from .pong import Pong
|
||||
from .post_effect_type import PostEffectType
|
||||
from .privacy_settings import PrivacySettings
|
||||
from .raw_file import RawFile
|
||||
from .rtc_ice_candidate_init import RtcIceCandidateInit
|
||||
from .rtc_sdp_type import RtcSdpType
|
||||
from .rtc_session_description import RtcSessionDescription
|
||||
from .saml_identity_provider import SamlIdentityProvider
|
||||
from .saml_identity_provider_create import SamlIdentityProviderCreate
|
||||
from .scene_selection_type import SceneSelectionType
|
||||
from .scene_tool_type import SceneToolType
|
||||
from .select_get import SelectGet
|
||||
from .select_with_point import SelectWithPoint
|
||||
from .selection import Selection
|
||||
from .service_account import ServiceAccount
|
||||
from .service_account_results_page import ServiceAccountResultsPage
|
||||
from .session import Session
|
||||
from .solid3d_get_all_edge_faces import Solid3dGetAllEdgeFaces
|
||||
from .solid3d_get_all_opposite_edges import Solid3dGetAllOppositeEdges
|
||||
from .solid3d_get_extrusion_face_info import Solid3dGetExtrusionFaceInfo
|
||||
from .solid3d_get_next_adjacent_edge import Solid3dGetNextAdjacentEdge
|
||||
from .solid3d_get_opposite_edge import Solid3dGetOppositeEdge
|
||||
from .solid3d_get_prev_adjacent_edge import Solid3dGetPrevAdjacentEdge
|
||||
from .stl_storage import StlStorage
|
||||
from .store_coupon_params import StoreCouponParams
|
||||
from .subscription_tier_feature import SubscriptionTierFeature
|
||||
from .subscription_tier_price import SubscriptionTierPrice
|
||||
from .subscription_tier_type import SubscriptionTierType
|
||||
from .subscription_training_data_behavior import SubscriptionTrainingDataBehavior
|
||||
from .success_web_socket_response import SuccessWebSocketResponse
|
||||
from .support_tier import SupportTier
|
||||
from .surface_area import SurfaceArea
|
||||
from .system import System
|
||||
from .take_snapshot import TakeSnapshot
|
||||
@ -195,12 +250,21 @@ from .unit_torque_conversion import UnitTorqueConversion
|
||||
from .unit_volume import UnitVolume
|
||||
from .unit_volume_conversion import UnitVolumeConversion
|
||||
from .update_member_to_org_body import UpdateMemberToOrgBody
|
||||
from .update_payment_balance import UpdatePaymentBalance
|
||||
from .update_user import UpdateUser
|
||||
from .user import User
|
||||
from .user_org_info import UserOrgInfo
|
||||
from .user_org_role import UserOrgRole
|
||||
from .user_results_page import UserResultsPage
|
||||
from .uuid import Uuid
|
||||
from .verification_token import VerificationToken
|
||||
from .verification_token_response import VerificationTokenResponse
|
||||
from .view_isometric import ViewIsometric
|
||||
from .volume import Volume
|
||||
from .web_socket_request import WebSocketRequest
|
||||
from .web_socket_response import WebSocketResponse
|
||||
from .zoo_product_subscription import ZooProductSubscription
|
||||
from .zoo_product_subscriptions import ZooProductSubscriptions
|
||||
from .zoo_product_subscriptions_org_request import ZooProductSubscriptionsOrgRequest
|
||||
from .zoo_product_subscriptions_user_request import ZooProductSubscriptionsUserRequest
|
||||
from .zoo_tool import ZooTool
|
||||
from .zoom_to_fit import ZoomToFit
|
||||
|
@ -4,12 +4,20 @@ from enum import Enum
|
||||
class AccountProvider(str, Enum):
|
||||
"""An account provider.""" # noqa: E501
|
||||
|
||||
"""# The Apple account provider. """ # noqa: E501
|
||||
APPLE = "apple"
|
||||
"""# The Discord account provider. """ # noqa: E501
|
||||
DISCORD = "discord"
|
||||
"""# The Google account provider. """ # noqa: E501
|
||||
GOOGLE = "google"
|
||||
"""# The GitHub account provider. """ # noqa: E501
|
||||
GITHUB = "github"
|
||||
"""# The Microsoft account provider. """ # noqa: E501
|
||||
MICROSOFT = "microsoft"
|
||||
"""# The SAML account provider. """ # noqa: E501
|
||||
SAML = "saml"
|
||||
"""# The Tencent QQ account provider. """ # noqa: E501
|
||||
TENCENT = "tencent"
|
||||
|
||||
def __str__(self) -> str:
|
||||
return str(self.value)
|
||||
|
@ -1,7 +1,7 @@
|
||||
|
||||
from pydantic import BaseModel, ConfigDict
|
||||
|
||||
from ..models.org_role import OrgRole
|
||||
from ..models.user_org_role import UserOrgRole
|
||||
|
||||
|
||||
class AddOrgMember(BaseModel):
|
||||
@ -9,6 +9,6 @@ class AddOrgMember(BaseModel):
|
||||
|
||||
email: str
|
||||
|
||||
role: OrgRole
|
||||
role: UserOrgRole
|
||||
|
||||
model_config = ConfigDict(protected_namespaces=())
|
||||
|
18
kittycad/models/auth_callback.py
Normal file
18
kittycad/models/auth_callback.py
Normal file
@ -0,0 +1,18 @@
|
||||
from typing import Optional
|
||||
|
||||
from pydantic import BaseModel, ConfigDict
|
||||
|
||||
|
||||
|
||||
class AuthCallback(BaseModel):
|
||||
"""The authentication callback from the OAuth 2.0 client. This is typically posted to the redirect URL as query params after authenticating."""
|
||||
|
||||
code: Optional[str] = None
|
||||
|
||||
id_token: Optional[str] = None
|
||||
|
||||
state: Optional[str] = None
|
||||
|
||||
user: Optional[str] = None
|
||||
|
||||
model_config = ConfigDict(protected_namespaces=())
|
24
kittycad/models/batch_response.py
Normal file
24
kittycad/models/batch_response.py
Normal file
@ -0,0 +1,24 @@
|
||||
from typing import Union
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, RootModel
|
||||
|
||||
|
||||
|
||||
class response(BaseModel):
|
||||
"""Response to the modeling command."""
|
||||
|
||||
model_config = ConfigDict(protected_namespaces=())
|
||||
|
||||
|
||||
class errors(BaseModel):
|
||||
"""Errors that occurred during the modeling command."""
|
||||
|
||||
model_config = ConfigDict(protected_namespaces=())
|
||||
|
||||
|
||||
BatchResponse = RootModel[
|
||||
Union[
|
||||
response,
|
||||
errors,
|
||||
]
|
||||
]
|
12
kittycad/models/camera_drag_end.py
Normal file
12
kittycad/models/camera_drag_end.py
Normal file
@ -0,0 +1,12 @@
|
||||
|
||||
from pydantic import BaseModel, ConfigDict
|
||||
|
||||
from ..models.camera_settings import CameraSettings
|
||||
|
||||
|
||||
class CameraDragEnd(BaseModel):
|
||||
"""The response from the `CameraDragEnd` command."""
|
||||
|
||||
settings: CameraSettings
|
||||
|
||||
model_config = ConfigDict(protected_namespaces=())
|
12
kittycad/models/camera_drag_move.py
Normal file
12
kittycad/models/camera_drag_move.py
Normal file
@ -0,0 +1,12 @@
|
||||
|
||||
from pydantic import BaseModel, ConfigDict
|
||||
|
||||
from ..models.camera_settings import CameraSettings
|
||||
|
||||
|
||||
class CameraDragMove(BaseModel):
|
||||
"""The response from the `CameraDragMove` command. Note this is an \"unreliable\" channel message, so this data may need more data like a \"sequence\" """
|
||||
|
||||
settings: CameraSettings
|
||||
|
||||
model_config = ConfigDict(protected_namespaces=())
|
26
kittycad/models/camera_settings.py
Normal file
26
kittycad/models/camera_settings.py
Normal file
@ -0,0 +1,26 @@
|
||||
from typing import Optional
|
||||
|
||||
from pydantic import BaseModel, ConfigDict
|
||||
|
||||
from ..models.point3d import Point3d
|
||||
from ..models.point4d import Point4d
|
||||
|
||||
|
||||
class CameraSettings(BaseModel):
|
||||
"""Camera settings including position, center, fov etc"""
|
||||
|
||||
center: Point3d
|
||||
|
||||
fov_y: Optional[float] = None
|
||||
|
||||
orientation: Point4d
|
||||
|
||||
ortho: bool
|
||||
|
||||
ortho_scale: Optional[float] = None
|
||||
|
||||
pos: Point3d
|
||||
|
||||
up: Point3d
|
||||
|
||||
model_config = ConfigDict(protected_namespaces=())
|
11
kittycad/models/close_path.py
Normal file
11
kittycad/models/close_path.py
Normal file
@ -0,0 +1,11 @@
|
||||
|
||||
from pydantic import BaseModel, ConfigDict
|
||||
|
||||
|
||||
|
||||
class ClosePath(BaseModel):
|
||||
"""The response from the `ClosePath` command."""
|
||||
|
||||
face_id: str
|
||||
|
||||
model_config = ConfigDict(protected_namespaces=())
|
@ -10,7 +10,7 @@ class CodeOutput(BaseModel):
|
||||
|
||||
<details><summary>JSON schema</summary>
|
||||
|
||||
```json { "description": "Output of the code being executed.", "type": "object", "properties": { "output_files": { "description": "The contents of the files requested if they were passed.", "type": "array", "items": { "$ref": "#/components/schemas/OutputFile" } }, "stderr": { "description": "The stderr of the code.", "default": "", "type": "string" }, "stdout": { "description": "The stdout of the code.", "default": "", "type": "string" } } } ``` </details>
|
||||
```json { \"description\": \"Output of the code being executed.\", \"type\": \"object\", \"properties\": { \"output_files\": { \"description\": \"The contents of the files requested if they were passed.\", \"type\": \"array\", \"items\": { \"$ref\": \"#/components/schemas/OutputFile\" } }, \"stderr\": { \"description\": \"The stderr of the code.\", \"default\": \"\", \"type\": \"string\" }, \"stdout\": { \"description\": \"The stdout of the code.\", \"default\": \"\", \"type\": \"string\" } } } ``` </details>
|
||||
"""
|
||||
|
||||
output_files: Optional[List[OutputFile]] = None
|
||||
|
@ -8,7 +8,7 @@ from ..models.currency import Currency
|
||||
|
||||
|
||||
class Customer(BaseModel):
|
||||
"""The resource representing a payment "Customer"."""
|
||||
"""The resource representing a payment \"Customer\"."""
|
||||
|
||||
address: Optional[AddressDetails] = None
|
||||
|
||||
|
@ -1,8 +1,11 @@
|
||||
import datetime
|
||||
from typing import Optional
|
||||
|
||||
from pydantic import BaseModel, ConfigDict
|
||||
|
||||
from ..models.subscription_tier_price import SubscriptionTierPrice
|
||||
from ..models.uuid import Uuid
|
||||
from ..models.zoo_product_subscriptions import ZooProductSubscriptions
|
||||
|
||||
|
||||
class CustomerBalance(BaseModel):
|
||||
@ -16,12 +19,18 @@ class CustomerBalance(BaseModel):
|
||||
|
||||
map_id: Uuid
|
||||
|
||||
modeling_app_enterprise_price: Optional[SubscriptionTierPrice] = None
|
||||
|
||||
monthly_credits_remaining: float
|
||||
|
||||
pre_pay_cash_remaining: float
|
||||
|
||||
pre_pay_credits_remaining: float
|
||||
|
||||
subscription_details: Optional[ZooProductSubscriptions] = None
|
||||
|
||||
subscription_id: Optional[str] = None
|
||||
|
||||
total_due: float
|
||||
|
||||
updated_at: datetime.datetime
|
||||
|
13
kittycad/models/cut_type.py
Normal file
13
kittycad/models/cut_type.py
Normal file
@ -0,0 +1,13 @@
|
||||
from enum import Enum
|
||||
|
||||
|
||||
class CutType(str, Enum):
|
||||
"""What kind of cut to do""" # noqa: E501
|
||||
|
||||
"""# Round off an edge. """ # noqa: E501
|
||||
FILLET = "fillet"
|
||||
"""# Cut away an edge. """ # noqa: E501
|
||||
CHAMFER = "chamfer"
|
||||
|
||||
def __str__(self) -> str:
|
||||
return str(self.value)
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user