* fix hyphens

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* fix hyphens

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* add a test as well

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* fix;

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* fixes

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* I have generated the latest API!

* updates

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* fix

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* I have generated the latest API!

---------

Signed-off-by: Jess Frazelle <github@jessfraz.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
This commit is contained in:
Jess Frazelle
2023-01-27 16:22:14 -08:00
committed by GitHub
parent 95f22c849d
commit 0403eddfd7
22 changed files with 242 additions and 119 deletions

View File

@ -67,7 +67,7 @@ def generatePaths(cwd: str, parser: dict) -> dict:
# Generate the directory/__init__.py for each of the tags. # Generate the directory/__init__.py for each of the tags.
tags = parser['tags'] tags = parser['tags']
for tag in tags: for tag in tags:
tag_name = tag['name'] tag_name = tag['name'].replace('-', '_')
tag_description = tag['description'] tag_description = tag['description']
tag_path = os.path.join(path, tag_name) tag_path = os.path.join(path, tag_name)
# Esnure the directory exists. # Esnure the directory exists.
@ -116,7 +116,7 @@ def generatePath(
tag_name = '' tag_name = ''
# Add the tag to the path if it exists. # Add the tag to the path if it exists.
if 'tags' in endpoint: if 'tags' in endpoint:
tag_name = endpoint['tags'][0] tag_name = endpoint['tags'][0].replace('-', '_')
path = os.path.join(path, tag_name) path = os.path.join(path, tag_name)
file_path = os.path.join(path, file_name) file_path = os.path.join(path, file_name)
print("generating type: ", name, " at: ", file_path) print("generating type: ", name, " at: ", file_path)
@ -139,6 +139,7 @@ def generatePath(
params_str = '' params_str = ''
if 'parameters' in endpoint: if 'parameters' in endpoint:
parameters = endpoint['parameters'] parameters = endpoint['parameters']
optional_args = []
for parameter in parameters: for parameter in parameters:
parameter_name = parameter['name'] parameter_name = parameter['name']
parameter_type = '' parameter_type = ''
@ -154,8 +155,20 @@ def generatePath(
else: else:
print(" parameter: ", parameter) print(" parameter: ", parameter)
raise Exception("Unknown parameter type") raise Exception("Unknown parameter type")
params_str += ', ' + \ if 'nullable' in parameter['schema']:
camel_to_snake(parameter_name) + '=' + parameter_type if parameter['schema']['nullable']:
parameter_type = 'Optional[' + parameter_type + ']'
optional_args.append(
', ' + camel_to_snake(parameter_name) + '=' + parameter_type)
else:
params_str += ', ' + \
camel_to_snake(parameter_name) + '=' + parameter_type
else:
params_str += ', ' + \
camel_to_snake(parameter_name) + '=' + parameter_type
for optional_arg in optional_args:
params_str += optional_arg
if request_body_type: if request_body_type:
params_str += ', body=' + request_body_type params_str += ', body=' + request_body_type
@ -217,6 +230,7 @@ response: Response[""" + success_type + """] = await """ + fn_name + """.asyncio
# Define the method. # Define the method.
f.write("def _get_kwargs(\n") f.write("def _get_kwargs(\n")
# Iterate over the parameters. # Iterate over the parameters.
optional_args = []
if 'parameters' in endpoint: if 'parameters' in endpoint:
parameters = endpoint['parameters'] parameters = endpoint['parameters']
for parameter in parameters: for parameter in parameters:
@ -232,12 +246,28 @@ response: Response[""" + success_type + """] = await """ + fn_name + """.asyncio
else: else:
print(" parameter: ", parameter) print(" parameter: ", parameter)
raise Exception("Unknown parameter type") raise Exception("Unknown parameter type")
f.write( if 'nullable' in parameter['schema']:
"\t" + if parameter['schema']['nullable']:
camel_to_snake(parameter_name) + parameter_type = 'Optional[' + parameter_type + '] = None'
": " + optional_args.append("\t" +
parameter_type + camel_to_snake(parameter_name) +
",\n") ": " +
parameter_type +
",\n")
else:
f.write(
"\t" +
camel_to_snake(parameter_name) +
": " +
parameter_type +
",\n")
else:
f.write(
"\t" +
camel_to_snake(parameter_name) +
": " +
parameter_type +
",\n")
if request_body_type: if request_body_type:
f.write( f.write(
"\tbody: " + "\tbody: " +
@ -245,6 +275,8 @@ response: Response[""" + success_type + """] = await """ + fn_name + """.asyncio
",\n") ",\n")
f.write("\t*,\n") f.write("\t*,\n")
f.write("\tclient: Client,\n") f.write("\tclient: Client,\n")
for optional_arg in optional_args:
f.write(optional_arg)
f.write(") -> Dict[str, Any]:\n") f.write(") -> Dict[str, Any]:\n")
templateUrl = "{}" + name templateUrl = "{}" + name
formatTemplate = ".format(client.base_url" formatTemplate = ".format(client.base_url"
@ -426,6 +458,7 @@ response: Response[""" + success_type + """] = await """ + fn_name + """.asyncio
f.write("\n") f.write("\n")
f.write( f.write(
"def sync_detailed(\n") "def sync_detailed(\n")
optional_args = []
# Iterate over the parameters. # Iterate over the parameters.
if 'parameters' in endpoint: if 'parameters' in endpoint:
parameters = endpoint['parameters'] parameters = endpoint['parameters']
@ -442,12 +475,28 @@ response: Response[""" + success_type + """] = await """ + fn_name + """.asyncio
else: else:
print(" parameter: ", parameter) print(" parameter: ", parameter)
raise Exception("Unknown parameter type") raise Exception("Unknown parameter type")
f.write( if 'nullable' in parameter['schema']:
"\t" + if parameter['schema']['nullable']:
camel_to_snake(parameter_name) + parameter_type = 'Optional[' + parameter_type + '] = None'
": " + optional_args.append("\t" +
parameter_type + camel_to_snake(parameter_name) +
",\n") ": " +
parameter_type +
",\n")
else:
f.write(
"\t" +
camel_to_snake(parameter_name) +
": " +
parameter_type +
",\n")
else:
f.write(
"\t" +
camel_to_snake(parameter_name) +
": " +
parameter_type +
",\n")
if request_body_type: if request_body_type:
f.write( f.write(
"\tbody: " + "\tbody: " +
@ -455,6 +504,8 @@ response: Response[""" + success_type + """] = await """ + fn_name + """.asyncio
",\n") ",\n")
f.write("\t*,\n") f.write("\t*,\n")
f.write("\tclient: Client,\n") f.write("\tclient: Client,\n")
for optional_arg in optional_args:
f.write(optional_arg)
f.write(") -> Response[Union[Any, " + f.write(") -> Response[Union[Any, " +
", ".join(endpoint_refs) + ", ".join(endpoint_refs) +
"]]:\n") "]]:\n")
@ -478,6 +529,7 @@ response: Response[""" + success_type + """] = await """ + fn_name + """.asyncio
f.write("\n") f.write("\n")
f.write( f.write(
"def sync(\n") "def sync(\n")
optional_args = []
# Iterate over the parameters. # Iterate over the parameters.
if 'parameters' in endpoint: if 'parameters' in endpoint:
parameters = endpoint['parameters'] parameters = endpoint['parameters']
@ -494,12 +546,28 @@ response: Response[""" + success_type + """] = await """ + fn_name + """.asyncio
else: else:
print(" parameter: ", parameter) print(" parameter: ", parameter)
raise Exception("Unknown parameter type") raise Exception("Unknown parameter type")
f.write( if 'nullable' in parameter['schema']:
"\t" + if parameter['schema']['nullable']:
camel_to_snake(parameter_name) + parameter_type = 'Optional[' + parameter_type + '] = None'
": " + optional_args.append("\t" +
parameter_type + camel_to_snake(parameter_name) +
",\n") ": " +
parameter_type +
",\n")
else:
f.write(
"\t" +
camel_to_snake(parameter_name) +
": " +
parameter_type +
",\n")
else:
f.write(
"\t" +
camel_to_snake(parameter_name) +
": " +
parameter_type +
",\n")
if request_body_type: if request_body_type:
f.write( f.write(
"\tbody: " + "\tbody: " +
@ -507,6 +575,8 @@ response: Response[""" + success_type + """] = await """ + fn_name + """.asyncio
",\n") ",\n")
f.write("\t*,\n") f.write("\t*,\n")
f.write("\tclient: Client,\n") f.write("\tclient: Client,\n")
for optional_arg in optional_args:
f.write(optional_arg)
f.write(") -> Optional[Union[Any, " + f.write(") -> Optional[Union[Any, " +
", ".join(endpoint_refs) + ", ".join(endpoint_refs) +
"]]:\n") "]]:\n")
@ -526,6 +596,7 @@ response: Response[""" + success_type + """] = await """ + fn_name + """.asyncio
f.write("\n") f.write("\n")
f.write( f.write(
"async def asyncio_detailed(\n") "async def asyncio_detailed(\n")
optional_args = []
# Iterate over the parameters. # Iterate over the parameters.
if 'parameters' in endpoint: if 'parameters' in endpoint:
parameters = endpoint['parameters'] parameters = endpoint['parameters']
@ -542,12 +613,28 @@ response: Response[""" + success_type + """] = await """ + fn_name + """.asyncio
else: else:
print(" parameter: ", parameter) print(" parameter: ", parameter)
raise Exception("Unknown parameter type") raise Exception("Unknown parameter type")
f.write( if 'nullable' in parameter['schema']:
"\t" + if parameter['schema']['nullable']:
camel_to_snake(parameter_name) + parameter_type = 'Optional[' + parameter_type + '] = None'
": " + optional_args.append("\t" +
parameter_type + camel_to_snake(parameter_name) +
",\n") ": " +
parameter_type +
",\n")
else:
f.write(
"\t" +
camel_to_snake(parameter_name) +
": " +
parameter_type +
",\n")
else:
f.write(
"\t" +
camel_to_snake(parameter_name) +
": " +
parameter_type +
",\n")
if request_body_type: if request_body_type:
f.write( f.write(
"\tbody: " + "\tbody: " +
@ -555,6 +642,8 @@ response: Response[""" + success_type + """] = await """ + fn_name + """.asyncio
",\n") ",\n")
f.write("\t*,\n") f.write("\t*,\n")
f.write("\tclient: Client,\n") f.write("\tclient: Client,\n")
for optional_arg in optional_args:
f.write(optional_arg)
f.write(") -> Response[Union[Any, " + f.write(") -> Response[Union[Any, " +
", ".join(endpoint_refs) + ", ".join(endpoint_refs) +
"]]:\n") "]]:\n")
@ -576,6 +665,7 @@ response: Response[""" + success_type + """] = await """ + fn_name + """.asyncio
f.write("\n") f.write("\n")
f.write( f.write(
"async def asyncio(\n") "async def asyncio(\n")
optional_args = []
# Iterate over the parameters. # Iterate over the parameters.
if 'parameters' in endpoint: if 'parameters' in endpoint:
parameters = endpoint['parameters'] parameters = endpoint['parameters']
@ -592,12 +682,28 @@ response: Response[""" + success_type + """] = await """ + fn_name + """.asyncio
else: else:
print(" parameter: ", parameter) print(" parameter: ", parameter)
raise Exception("Unknown parameter type") raise Exception("Unknown parameter type")
f.write( if 'nullable' in parameter['schema']:
"\t" + if parameter['schema']['nullable']:
camel_to_snake(parameter_name) + parameter_type = 'Optional[' + parameter_type + '] = None'
": " + optional_args.append("\t" +
parameter_type + camel_to_snake(parameter_name) +
",\n") ": " +
parameter_type +
",\n")
else:
f.write(
"\t" +
camel_to_snake(parameter_name) +
": " +
parameter_type +
",\n")
else:
f.write(
"\t" +
camel_to_snake(parameter_name) +
": " +
parameter_type +
",\n")
if request_body_type: if request_body_type:
f.write( f.write(
"\tbody: " + "\tbody: " +
@ -605,6 +711,8 @@ response: Response[""" + success_type + """] = await """ + fn_name + """.asyncio
",\n") ",\n")
f.write("\t*,\n") f.write("\t*,\n")
f.write("\tclient: Client,\n") f.write("\tclient: Client,\n")
for optional_arg in optional_args:
f.write(optional_arg)
f.write(") -> Optional[Union[Any, " + f.write(") -> Optional[Union[Any, " +
", ".join(endpoint_refs) + ", ".join(endpoint_refs) +
"]]:\n") "]]:\n")

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
""" Contains methods for accessing the api-calls API paths: API calls that have been performed by users can be queried by the API. This is helpful for debugging as well as billing. """ """ Contains methods for accessing the api_calls API paths: API calls that have been performed by users can be queried by the API. This is helpful for debugging as well as billing. """

View File

@ -9,11 +9,11 @@ from ...models.created_at_sort_mode import CreatedAtSortMode
from ...types import Response from ...types import Response
def _get_kwargs( def _get_kwargs(
limit: int,
page_token: str,
sort_by: CreatedAtSortMode, sort_by: CreatedAtSortMode,
*, *,
client: Client, client: Client,
limit: Optional[int] = None,
page_token: Optional[str] = None,
) -> Dict[str, Any]: ) -> Dict[str, Any]:
url = "{}/api-calls?limit={limit}&page_token={page_token}&sort_by={sort_by}".format(client.base_url, limit=limit, page_token=page_token, sort_by=sort_by) url = "{}/api-calls?limit={limit}&page_token={page_token}&sort_by={sort_by}".format(client.base_url, limit=limit, page_token=page_token, sort_by=sort_by)
@ -51,11 +51,11 @@ def _build_response(*, response: httpx.Response) -> Response[Union[Any, ApiCallW
def sync_detailed( def sync_detailed(
limit: int,
page_token: str,
sort_by: CreatedAtSortMode, sort_by: CreatedAtSortMode,
*, *,
client: Client, client: Client,
limit: Optional[int] = None,
page_token: Optional[str] = None,
) -> Response[Union[Any, ApiCallWithPriceResultsPage, Error]]: ) -> Response[Union[Any, ApiCallWithPriceResultsPage, Error]]:
kwargs = _get_kwargs( kwargs = _get_kwargs(
limit=limit, limit=limit,
@ -73,11 +73,11 @@ def sync_detailed(
def sync( def sync(
limit: int,
page_token: str,
sort_by: CreatedAtSortMode, sort_by: CreatedAtSortMode,
*, *,
client: Client, client: Client,
limit: Optional[int] = None,
page_token: Optional[str] = None,
) -> Optional[Union[Any, ApiCallWithPriceResultsPage, Error]]: ) -> Optional[Union[Any, ApiCallWithPriceResultsPage, Error]]:
""" This endpoint requires authentication by a KittyCAD employee. The API calls are returned in order of creation, with the most recently created API calls first. """ """ This endpoint requires authentication by a KittyCAD employee. The API calls are returned in order of creation, with the most recently created API calls first. """
@ -90,11 +90,11 @@ def sync(
async def asyncio_detailed( async def asyncio_detailed(
limit: int,
page_token: str,
sort_by: CreatedAtSortMode, sort_by: CreatedAtSortMode,
*, *,
client: Client, client: Client,
limit: Optional[int] = None,
page_token: Optional[str] = None,
) -> Response[Union[Any, ApiCallWithPriceResultsPage, Error]]: ) -> Response[Union[Any, ApiCallWithPriceResultsPage, Error]]:
kwargs = _get_kwargs( kwargs = _get_kwargs(
limit=limit, limit=limit,
@ -110,11 +110,11 @@ async def asyncio_detailed(
async def asyncio( async def asyncio(
limit: int,
page_token: str,
sort_by: CreatedAtSortMode, sort_by: CreatedAtSortMode,
*, *,
client: Client, client: Client,
limit: Optional[int] = None,
page_token: Optional[str] = None,
) -> Optional[Union[Any, ApiCallWithPriceResultsPage, Error]]: ) -> Optional[Union[Any, ApiCallWithPriceResultsPage, Error]]:
""" This endpoint requires authentication by a KittyCAD employee. The API calls are returned in order of creation, with the most recently created API calls first. """ """ This endpoint requires authentication by a KittyCAD employee. The API calls are returned in order of creation, with the most recently created API calls first. """

View File

@ -10,11 +10,11 @@ from ...types import Response
def _get_kwargs( def _get_kwargs(
id: str, id: str,
limit: int,
page_token: str,
sort_by: CreatedAtSortMode, sort_by: CreatedAtSortMode,
*, *,
client: Client, client: Client,
limit: Optional[int] = None,
page_token: Optional[str] = None,
) -> Dict[str, Any]: ) -> Dict[str, Any]:
url = "{}/users/{id}/api-calls?limit={limit}&page_token={page_token}&sort_by={sort_by}".format(client.base_url, id=id, limit=limit, page_token=page_token, sort_by=sort_by) url = "{}/users/{id}/api-calls?limit={limit}&page_token={page_token}&sort_by={sort_by}".format(client.base_url, id=id, limit=limit, page_token=page_token, sort_by=sort_by)
@ -53,11 +53,11 @@ def _build_response(*, response: httpx.Response) -> Response[Union[Any, ApiCallW
def sync_detailed( def sync_detailed(
id: str, id: str,
limit: int,
page_token: str,
sort_by: CreatedAtSortMode, sort_by: CreatedAtSortMode,
*, *,
client: Client, client: Client,
limit: Optional[int] = None,
page_token: Optional[str] = None,
) -> Response[Union[Any, ApiCallWithPriceResultsPage, Error]]: ) -> Response[Union[Any, ApiCallWithPriceResultsPage, Error]]:
kwargs = _get_kwargs( kwargs = _get_kwargs(
id=id, id=id,
@ -77,11 +77,11 @@ def sync_detailed(
def sync( def sync(
id: str, id: str,
limit: int,
page_token: str,
sort_by: CreatedAtSortMode, sort_by: CreatedAtSortMode,
*, *,
client: Client, client: Client,
limit: Optional[int] = None,
page_token: Optional[str] = None,
) -> Optional[Union[Any, ApiCallWithPriceResultsPage, Error]]: ) -> Optional[Union[Any, ApiCallWithPriceResultsPage, Error]]:
""" This endpoint requires authentication by any KittyCAD user. It returns the API calls for the authenticated user if "me" is passed as the user id. """ This endpoint requires authentication by any KittyCAD user. It returns the API calls for the authenticated user if "me" is passed as the user id.
Alternatively, you can use the `/user/api-calls` endpoint to get the API calls for your user. Alternatively, you can use the `/user/api-calls` endpoint to get the API calls for your user.
@ -99,11 +99,11 @@ The API calls are returned in order of creation, with the most recently created
async def asyncio_detailed( async def asyncio_detailed(
id: str, id: str,
limit: int,
page_token: str,
sort_by: CreatedAtSortMode, sort_by: CreatedAtSortMode,
*, *,
client: Client, client: Client,
limit: Optional[int] = None,
page_token: Optional[str] = None,
) -> Response[Union[Any, ApiCallWithPriceResultsPage, Error]]: ) -> Response[Union[Any, ApiCallWithPriceResultsPage, Error]]:
kwargs = _get_kwargs( kwargs = _get_kwargs(
id=id, id=id,
@ -121,11 +121,11 @@ async def asyncio_detailed(
async def asyncio( async def asyncio(
id: str, id: str,
limit: int,
page_token: str,
sort_by: CreatedAtSortMode, sort_by: CreatedAtSortMode,
*, *,
client: Client, client: Client,
limit: Optional[int] = None,
page_token: Optional[str] = None,
) -> Optional[Union[Any, ApiCallWithPriceResultsPage, Error]]: ) -> Optional[Union[Any, ApiCallWithPriceResultsPage, Error]]:
""" This endpoint requires authentication by any KittyCAD user. It returns the API calls for the authenticated user if "me" is passed as the user id. """ This endpoint requires authentication by any KittyCAD user. It returns the API calls for the authenticated user if "me" is passed as the user id.
Alternatively, you can use the `/user/api-calls` endpoint to get the API calls for your user. Alternatively, you can use the `/user/api-calls` endpoint to get the API calls for your user.

View File

@ -10,12 +10,12 @@ from ...models.api_call_status import ApiCallStatus
from ...types import Response from ...types import Response
def _get_kwargs( def _get_kwargs(
limit: int,
page_token: str,
sort_by: CreatedAtSortMode, sort_by: CreatedAtSortMode,
status: ApiCallStatus, status: ApiCallStatus,
*, *,
client: Client, client: Client,
limit: Optional[int] = None,
page_token: Optional[str] = None,
) -> Dict[str, Any]: ) -> Dict[str, Any]:
url = "{}/async/operations?limit={limit}&page_token={page_token}&sort_by={sort_by}&status={status}".format(client.base_url, limit=limit, page_token=page_token, sort_by=sort_by, status=status) url = "{}/async/operations?limit={limit}&page_token={page_token}&sort_by={sort_by}&status={status}".format(client.base_url, limit=limit, page_token=page_token, sort_by=sort_by, status=status)
@ -53,12 +53,12 @@ def _build_response(*, response: httpx.Response) -> Response[Union[Any, AsyncApi
def sync_detailed( def sync_detailed(
limit: int,
page_token: str,
sort_by: CreatedAtSortMode, sort_by: CreatedAtSortMode,
status: ApiCallStatus, status: ApiCallStatus,
*, *,
client: Client, client: Client,
limit: Optional[int] = None,
page_token: Optional[str] = None,
) -> Response[Union[Any, AsyncApiCallResultsPage, Error]]: ) -> Response[Union[Any, AsyncApiCallResultsPage, Error]]:
kwargs = _get_kwargs( kwargs = _get_kwargs(
limit=limit, limit=limit,
@ -77,12 +77,12 @@ def sync_detailed(
def sync( def sync(
limit: int,
page_token: str,
sort_by: CreatedAtSortMode, sort_by: CreatedAtSortMode,
status: ApiCallStatus, status: ApiCallStatus,
*, *,
client: Client, client: Client,
limit: Optional[int] = None,
page_token: Optional[str] = None,
) -> Optional[Union[Any, AsyncApiCallResultsPage, Error]]: ) -> Optional[Union[Any, AsyncApiCallResultsPage, Error]]:
""" For async file conversion operations, this endpoint does not return the contents of converted files (`output`). To get the contents use the `/async/operations/{id}` endpoint. """ For async file conversion operations, this endpoint does not return the contents of converted files (`output`). To get the contents use the `/async/operations/{id}` endpoint.
This endpoint requires authentication by a KittyCAD employee. """ This endpoint requires authentication by a KittyCAD employee. """
@ -97,12 +97,12 @@ This endpoint requires authentication by a KittyCAD employee. """
async def asyncio_detailed( async def asyncio_detailed(
limit: int,
page_token: str,
sort_by: CreatedAtSortMode, sort_by: CreatedAtSortMode,
status: ApiCallStatus, status: ApiCallStatus,
*, *,
client: Client, client: Client,
limit: Optional[int] = None,
page_token: Optional[str] = None,
) -> Response[Union[Any, AsyncApiCallResultsPage, Error]]: ) -> Response[Union[Any, AsyncApiCallResultsPage, Error]]:
kwargs = _get_kwargs( kwargs = _get_kwargs(
limit=limit, limit=limit,
@ -119,12 +119,12 @@ async def asyncio_detailed(
async def asyncio( async def asyncio(
limit: int,
page_token: str,
sort_by: CreatedAtSortMode, sort_by: CreatedAtSortMode,
status: ApiCallStatus, status: ApiCallStatus,
*, *,
client: Client, client: Client,
limit: Optional[int] = None,
page_token: Optional[str] = None,
) -> Optional[Union[Any, AsyncApiCallResultsPage, Error]]: ) -> Optional[Union[Any, AsyncApiCallResultsPage, Error]]:
""" For async file conversion operations, this endpoint does not return the contents of converted files (`output`). To get the contents use the `/async/operations/{id}` endpoint. """ For async file conversion operations, this endpoint does not return the contents of converted files (`output`). To get the contents use the `/async/operations/{id}` endpoint.
This endpoint requires authentication by a KittyCAD employee. """ This endpoint requires authentication by a KittyCAD employee. """

View File

@ -9,11 +9,11 @@ from ...models.created_at_sort_mode import CreatedAtSortMode
from ...types import Response from ...types import Response
def _get_kwargs( def _get_kwargs(
limit: int,
page_token: str,
sort_by: CreatedAtSortMode, sort_by: CreatedAtSortMode,
*, *,
client: Client, client: Client,
limit: Optional[int] = None,
page_token: Optional[str] = None,
) -> Dict[str, Any]: ) -> Dict[str, Any]:
url = "{}/user/api-calls?limit={limit}&page_token={page_token}&sort_by={sort_by}".format(client.base_url, limit=limit, page_token=page_token, sort_by=sort_by) url = "{}/user/api-calls?limit={limit}&page_token={page_token}&sort_by={sort_by}".format(client.base_url, limit=limit, page_token=page_token, sort_by=sort_by)
@ -51,11 +51,11 @@ def _build_response(*, response: httpx.Response) -> Response[Union[Any, ApiCallW
def sync_detailed( def sync_detailed(
limit: int,
page_token: str,
sort_by: CreatedAtSortMode, sort_by: CreatedAtSortMode,
*, *,
client: Client, client: Client,
limit: Optional[int] = None,
page_token: Optional[str] = None,
) -> Response[Union[Any, ApiCallWithPriceResultsPage, Error]]: ) -> Response[Union[Any, ApiCallWithPriceResultsPage, Error]]:
kwargs = _get_kwargs( kwargs = _get_kwargs(
limit=limit, limit=limit,
@ -73,11 +73,11 @@ def sync_detailed(
def sync( def sync(
limit: int,
page_token: str,
sort_by: CreatedAtSortMode, sort_by: CreatedAtSortMode,
*, *,
client: Client, client: Client,
limit: Optional[int] = None,
page_token: Optional[str] = None,
) -> Optional[Union[Any, ApiCallWithPriceResultsPage, Error]]: ) -> Optional[Union[Any, ApiCallWithPriceResultsPage, Error]]:
""" This endpoint requires authentication by any KittyCAD user. It returns the API calls for the authenticated user. """ This endpoint requires authentication by any KittyCAD user. It returns the API calls for the authenticated user.
The API calls are returned in order of creation, with the most recently created API calls first. """ The API calls are returned in order of creation, with the most recently created API calls first. """
@ -91,11 +91,11 @@ The API calls are returned in order of creation, with the most recently created
async def asyncio_detailed( async def asyncio_detailed(
limit: int,
page_token: str,
sort_by: CreatedAtSortMode, sort_by: CreatedAtSortMode,
*, *,
client: Client, client: Client,
limit: Optional[int] = None,
page_token: Optional[str] = None,
) -> Response[Union[Any, ApiCallWithPriceResultsPage, Error]]: ) -> Response[Union[Any, ApiCallWithPriceResultsPage, Error]]:
kwargs = _get_kwargs( kwargs = _get_kwargs(
limit=limit, limit=limit,
@ -111,11 +111,11 @@ async def asyncio_detailed(
async def asyncio( async def asyncio(
limit: int,
page_token: str,
sort_by: CreatedAtSortMode, sort_by: CreatedAtSortMode,
*, *,
client: Client, client: Client,
limit: Optional[int] = None,
page_token: Optional[str] = None,
) -> Optional[Union[Any, ApiCallWithPriceResultsPage, Error]]: ) -> Optional[Union[Any, ApiCallWithPriceResultsPage, Error]]:
""" This endpoint requires authentication by any KittyCAD user. It returns the API calls for the authenticated user. """ This endpoint requires authentication by any KittyCAD user. It returns the API calls for the authenticated user.
The API calls are returned in order of creation, with the most recently created API calls first. """ The API calls are returned in order of creation, with the most recently created API calls first. """

View File

@ -1 +1 @@
""" Contains methods for accessing the api-tokens API paths: API tokens allow users to call the API outside of their session token that is used as a cookie in the user interface. Users can create, delete, and list their API tokens. But, of course, you need an API token to do this, so first be sure to generate one in the account UI. """ """ Contains methods for accessing the api_tokens API paths: API tokens allow users to call the API outside of their session token that is used as a cookie in the user interface. Users can create, delete, and list their API tokens. But, of course, you need an API token to do this, so first be sure to generate one in the account UI. """

View File

@ -9,11 +9,11 @@ from ...models.created_at_sort_mode import CreatedAtSortMode
from ...types import Response from ...types import Response
def _get_kwargs( def _get_kwargs(
limit: int,
page_token: str,
sort_by: CreatedAtSortMode, sort_by: CreatedAtSortMode,
*, *,
client: Client, client: Client,
limit: Optional[int] = None,
page_token: Optional[str] = None,
) -> Dict[str, Any]: ) -> Dict[str, Any]:
url = "{}/user/api-tokens?limit={limit}&page_token={page_token}&sort_by={sort_by}".format(client.base_url, limit=limit, page_token=page_token, sort_by=sort_by) url = "{}/user/api-tokens?limit={limit}&page_token={page_token}&sort_by={sort_by}".format(client.base_url, limit=limit, page_token=page_token, sort_by=sort_by)
@ -51,11 +51,11 @@ def _build_response(*, response: httpx.Response) -> Response[Union[Any, ApiToken
def sync_detailed( def sync_detailed(
limit: int,
page_token: str,
sort_by: CreatedAtSortMode, sort_by: CreatedAtSortMode,
*, *,
client: Client, client: Client,
limit: Optional[int] = None,
page_token: Optional[str] = None,
) -> Response[Union[Any, ApiTokenResultsPage, Error]]: ) -> Response[Union[Any, ApiTokenResultsPage, Error]]:
kwargs = _get_kwargs( kwargs = _get_kwargs(
limit=limit, limit=limit,
@ -73,11 +73,11 @@ def sync_detailed(
def sync( def sync(
limit: int,
page_token: str,
sort_by: CreatedAtSortMode, sort_by: CreatedAtSortMode,
*, *,
client: Client, client: Client,
limit: Optional[int] = None,
page_token: Optional[str] = None,
) -> Optional[Union[Any, ApiTokenResultsPage, Error]]: ) -> Optional[Union[Any, ApiTokenResultsPage, Error]]:
""" This endpoint requires authentication by any KittyCAD user. It returns the API tokens for the authenticated user. """ This endpoint requires authentication by any KittyCAD user. It returns the API tokens for the authenticated user.
The API tokens are returned in order of creation, with the most recently created API tokens first. """ The API tokens are returned in order of creation, with the most recently created API tokens first. """
@ -91,11 +91,11 @@ The API tokens are returned in order of creation, with the most recently created
async def asyncio_detailed( async def asyncio_detailed(
limit: int,
page_token: str,
sort_by: CreatedAtSortMode, sort_by: CreatedAtSortMode,
*, *,
client: Client, client: Client,
limit: Optional[int] = None,
page_token: Optional[str] = None,
) -> Response[Union[Any, ApiTokenResultsPage, Error]]: ) -> Response[Union[Any, ApiTokenResultsPage, Error]]:
kwargs = _get_kwargs( kwargs = _get_kwargs(
limit=limit, limit=limit,
@ -111,11 +111,11 @@ async def asyncio_detailed(
async def asyncio( async def asyncio(
limit: int,
page_token: str,
sort_by: CreatedAtSortMode, sort_by: CreatedAtSortMode,
*, *,
client: Client, client: Client,
limit: Optional[int] = None,
page_token: Optional[str] = None,
) -> Optional[Union[Any, ApiTokenResultsPage, Error]]: ) -> Optional[Union[Any, ApiTokenResultsPage, Error]]:
""" This endpoint requires authentication by any KittyCAD user. It returns the API tokens for the authenticated user. """ This endpoint requires authentication by any KittyCAD user. It returns the API tokens for the authenticated user.
The API tokens are returned in order of creation, with the most recently created API tokens first. """ The API tokens are returned in order of creation, with the most recently created API tokens first. """

View File

@ -10,10 +10,10 @@ from ...types import Response
def _get_kwargs( def _get_kwargs(
lang: CodeLanguage, lang: CodeLanguage,
output: str,
body: bytes, body: bytes,
*, *,
client: Client, client: Client,
output: Optional[str] = None,
) -> Dict[str, Any]: ) -> Dict[str, Any]:
url = "{}/file/execute/{lang}?output={output}".format(client.base_url, lang=lang, output=output) url = "{}/file/execute/{lang}?output={output}".format(client.base_url, lang=lang, output=output)
@ -53,10 +53,10 @@ def _build_response(*, response: httpx.Response) -> Response[Union[Any, CodeOutp
def sync_detailed( def sync_detailed(
lang: CodeLanguage, lang: CodeLanguage,
output: str,
body: bytes, body: bytes,
*, *,
client: Client, client: Client,
output: Optional[str] = None,
) -> Response[Union[Any, CodeOutput, Error]]: ) -> Response[Union[Any, CodeOutput, Error]]:
kwargs = _get_kwargs( kwargs = _get_kwargs(
lang=lang, lang=lang,
@ -75,10 +75,10 @@ def sync_detailed(
def sync( def sync(
lang: CodeLanguage, lang: CodeLanguage,
output: str,
body: bytes, body: bytes,
*, *,
client: Client, client: Client,
output: Optional[str] = None,
) -> Optional[Union[Any, CodeOutput, Error]]: ) -> Optional[Union[Any, CodeOutput, Error]]:
return sync_detailed( return sync_detailed(
@ -91,10 +91,10 @@ def sync(
async def asyncio_detailed( async def asyncio_detailed(
lang: CodeLanguage, lang: CodeLanguage,
output: str,
body: bytes, body: bytes,
*, *,
client: Client, client: Client,
output: Optional[str] = None,
) -> Response[Union[Any, CodeOutput, Error]]: ) -> Response[Union[Any, CodeOutput, Error]]:
kwargs = _get_kwargs( kwargs = _get_kwargs(
lang=lang, lang=lang,
@ -111,10 +111,10 @@ async def asyncio_detailed(
async def asyncio( async def asyncio(
lang: CodeLanguage, lang: CodeLanguage,
output: str,
body: bytes, body: bytes,
*, *,
client: Client, client: Client,
output: Optional[str] = None,
) -> Optional[Union[Any, CodeOutput, Error]]: ) -> Optional[Union[Any, CodeOutput, Error]]:
return ( return (

View File

@ -7,11 +7,11 @@ from ...models.error import Error
from ...types import Response from ...types import Response
def _get_kwargs( def _get_kwargs(
callback_url: str,
email: str, email: str,
token: str, token: str,
*, *,
client: Client, client: Client,
callback_url: Optional[str] = None,
) -> Dict[str, Any]: ) -> Dict[str, Any]:
url = "{}/auth/email/callback?callback_url={callback_url}&email={email}&token={token}".format(client.base_url, callback_url=callback_url, email=email, token=token) url = "{}/auth/email/callback?callback_url={callback_url}&email={email}&token={token}".format(client.base_url, callback_url=callback_url, email=email, token=token)
@ -49,11 +49,11 @@ def _build_response(*, response: httpx.Response) -> Response[Union[Any, Error]]:
def sync_detailed( def sync_detailed(
callback_url: str,
email: str, email: str,
token: str, token: str,
*, *,
client: Client, client: Client,
callback_url: Optional[str] = None,
) -> Response[Union[Any, Error]]: ) -> Response[Union[Any, Error]]:
kwargs = _get_kwargs( kwargs = _get_kwargs(
callback_url=callback_url, callback_url=callback_url,
@ -71,11 +71,11 @@ def sync_detailed(
def sync( def sync(
callback_url: str,
email: str, email: str,
token: str, token: str,
*, *,
client: Client, client: Client,
callback_url: Optional[str] = None,
) -> Optional[Union[Any, Error]]: ) -> Optional[Union[Any, Error]]:
return sync_detailed( return sync_detailed(
@ -87,11 +87,11 @@ def sync(
async def asyncio_detailed( async def asyncio_detailed(
callback_url: str,
email: str, email: str,
token: str, token: str,
*, *,
client: Client, client: Client,
callback_url: Optional[str] = None,
) -> Response[Union[Any, Error]]: ) -> Response[Union[Any, Error]]:
kwargs = _get_kwargs( kwargs = _get_kwargs(
callback_url=callback_url, callback_url=callback_url,
@ -107,11 +107,11 @@ async def asyncio_detailed(
async def asyncio( async def asyncio(
callback_url: str,
email: str, email: str,
token: str, token: str,
*, *,
client: Client, client: Client,
callback_url: Optional[str] = None,
) -> Optional[Union[Any, Error]]: ) -> Optional[Union[Any, Error]]:
return ( return (

View File

@ -9,11 +9,11 @@ from ...models.created_at_sort_mode import CreatedAtSortMode
from ...types import Response from ...types import Response
def _get_kwargs( def _get_kwargs(
limit: int,
page_token: str,
sort_by: CreatedAtSortMode, sort_by: CreatedAtSortMode,
*, *,
client: Client, client: Client,
limit: Optional[int] = None,
page_token: Optional[str] = None,
) -> Dict[str, Any]: ) -> Dict[str, Any]:
url = "{}/users?limit={limit}&page_token={page_token}&sort_by={sort_by}".format(client.base_url, limit=limit, page_token=page_token, sort_by=sort_by) url = "{}/users?limit={limit}&page_token={page_token}&sort_by={sort_by}".format(client.base_url, limit=limit, page_token=page_token, sort_by=sort_by)
@ -51,11 +51,11 @@ def _build_response(*, response: httpx.Response) -> Response[Union[Any, UserResu
def sync_detailed( def sync_detailed(
limit: int,
page_token: str,
sort_by: CreatedAtSortMode, sort_by: CreatedAtSortMode,
*, *,
client: Client, client: Client,
limit: Optional[int] = None,
page_token: Optional[str] = None,
) -> Response[Union[Any, UserResultsPage, Error]]: ) -> Response[Union[Any, UserResultsPage, Error]]:
kwargs = _get_kwargs( kwargs = _get_kwargs(
limit=limit, limit=limit,
@ -73,11 +73,11 @@ def sync_detailed(
def sync( def sync(
limit: int,
page_token: str,
sort_by: CreatedAtSortMode, sort_by: CreatedAtSortMode,
*, *,
client: Client, client: Client,
limit: Optional[int] = None,
page_token: Optional[str] = None,
) -> Optional[Union[Any, UserResultsPage, Error]]: ) -> Optional[Union[Any, UserResultsPage, Error]]:
""" This endpoint required authentication by a KittyCAD employee. The users are returned in order of creation, with the most recently created users first. """ """ This endpoint required authentication by a KittyCAD employee. The users are returned in order of creation, with the most recently created users first. """
@ -90,11 +90,11 @@ def sync(
async def asyncio_detailed( async def asyncio_detailed(
limit: int,
page_token: str,
sort_by: CreatedAtSortMode, sort_by: CreatedAtSortMode,
*, *,
client: Client, client: Client,
limit: Optional[int] = None,
page_token: Optional[str] = None,
) -> Response[Union[Any, UserResultsPage, Error]]: ) -> Response[Union[Any, UserResultsPage, Error]]:
kwargs = _get_kwargs( kwargs = _get_kwargs(
limit=limit, limit=limit,
@ -110,11 +110,11 @@ async def asyncio_detailed(
async def asyncio( async def asyncio(
limit: int,
page_token: str,
sort_by: CreatedAtSortMode, sort_by: CreatedAtSortMode,
*, *,
client: Client, client: Client,
limit: Optional[int] = None,
page_token: Optional[str] = None,
) -> Optional[Union[Any, UserResultsPage, Error]]: ) -> Optional[Union[Any, UserResultsPage, Error]]:
""" This endpoint required authentication by a KittyCAD employee. The users are returned in order of creation, with the most recently created users first. """ """ This endpoint required authentication by a KittyCAD employee. The users are returned in order of creation, with the most recently created users first. """

View File

@ -9,11 +9,11 @@ from ...models.created_at_sort_mode import CreatedAtSortMode
from ...types import Response from ...types import Response
def _get_kwargs( def _get_kwargs(
limit: int,
page_token: str,
sort_by: CreatedAtSortMode, sort_by: CreatedAtSortMode,
*, *,
client: Client, client: Client,
limit: Optional[int] = None,
page_token: Optional[str] = None,
) -> Dict[str, Any]: ) -> Dict[str, Any]:
url = "{}/users-extended?limit={limit}&page_token={page_token}&sort_by={sort_by}".format(client.base_url, limit=limit, page_token=page_token, sort_by=sort_by) url = "{}/users-extended?limit={limit}&page_token={page_token}&sort_by={sort_by}".format(client.base_url, limit=limit, page_token=page_token, sort_by=sort_by)
@ -51,11 +51,11 @@ def _build_response(*, response: httpx.Response) -> Response[Union[Any, Extended
def sync_detailed( def sync_detailed(
limit: int,
page_token: str,
sort_by: CreatedAtSortMode, sort_by: CreatedAtSortMode,
*, *,
client: Client, client: Client,
limit: Optional[int] = None,
page_token: Optional[str] = None,
) -> Response[Union[Any, ExtendedUserResultsPage, Error]]: ) -> Response[Union[Any, ExtendedUserResultsPage, Error]]:
kwargs = _get_kwargs( kwargs = _get_kwargs(
limit=limit, limit=limit,
@ -73,11 +73,11 @@ def sync_detailed(
def sync( def sync(
limit: int,
page_token: str,
sort_by: CreatedAtSortMode, sort_by: CreatedAtSortMode,
*, *,
client: Client, client: Client,
limit: Optional[int] = None,
page_token: Optional[str] = None,
) -> Optional[Union[Any, ExtendedUserResultsPage, Error]]: ) -> Optional[Union[Any, ExtendedUserResultsPage, Error]]:
""" This endpoint required authentication by a KittyCAD employee. The users are returned in order of creation, with the most recently created users first. """ """ This endpoint required authentication by a KittyCAD employee. The users are returned in order of creation, with the most recently created users first. """
@ -90,11 +90,11 @@ def sync(
async def asyncio_detailed( async def asyncio_detailed(
limit: int,
page_token: str,
sort_by: CreatedAtSortMode, sort_by: CreatedAtSortMode,
*, *,
client: Client, client: Client,
limit: Optional[int] = None,
page_token: Optional[str] = None,
) -> Response[Union[Any, ExtendedUserResultsPage, Error]]: ) -> Response[Union[Any, ExtendedUserResultsPage, Error]]:
kwargs = _get_kwargs( kwargs = _get_kwargs(
limit=limit, limit=limit,
@ -110,11 +110,11 @@ async def asyncio_detailed(
async def asyncio( async def asyncio(
limit: int,
page_token: str,
sort_by: CreatedAtSortMode, sort_by: CreatedAtSortMode,
*, *,
client: Client, client: Client,
limit: Optional[int] = None,
page_token: Optional[str] = None,
) -> Optional[Union[Any, ExtendedUserResultsPage, Error]]: ) -> Optional[Union[Any, ExtendedUserResultsPage, Error]]:
""" This endpoint required authentication by a KittyCAD employee. The users are returned in order of creation, with the most recently created users first. """ """ This endpoint required authentication by a KittyCAD employee. The users are returned in order of creation, with the most recently created users first. """

View File

@ -3,10 +3,11 @@ import pytest
import asyncio import asyncio
from .client import ClientFromEnv from .client import ClientFromEnv
from .models import FileConversion, FileExportFormat, FileImportFormat, User, Pong, ApiCallStatus, FileMass, FileVolume from .models import FileConversion, FileExportFormat, FileImportFormat, User, Pong, ApiCallStatus, FileMass, FileVolume, ApiTokenResultsPage, CreatedAtSortMode
from .api.file import create_file_conversion_with_base64_helper, create_file_mass, create_file_volume from .api.file import create_file_conversion_with_base64_helper, create_file_mass, create_file_volume
from .api.meta import ping from .api.meta import ping
from .api.users import get_user_self from .api.users import get_user_self
from .api.api_tokens import list_api_tokens_for_user
def test_get_session(): def test_get_session():
@ -21,6 +22,20 @@ def test_get_session():
print(f"Session: {session}") print(f"Session: {session}")
@pytest.mark.asyncio
async def test_get_api_tokens_async():
# Create our client.
client = ClientFromEnv()
# List API tokens.
fc: ApiTokenResultsPage = list_api_tokens_for_user.sync(
client=client, sort_by=CreatedAtSortMode)
assert fc is not None
print(f"fc: {fc}")
@pytest.mark.asyncio @pytest.mark.asyncio
async def test_get_session_async(): async def test_get_session_async():
# Create our client. # Create our client.

View File

@ -1,6 +1,6 @@
[tool.poetry] [tool.poetry]
name = "kittycad" name = "kittycad"
version = "0.3.3" version = "0.3.4"
description = "A client library for accessing KittyCAD" description = "A client library for accessing KittyCAD"
authors = [] authors = []