Skip to content

Commit

Permalink
Merge pull request #68 from artsmolin/refactoring
Browse files Browse the repository at this point in the history
Add docs to methods
  • Loading branch information
artsmolin authored Sep 16, 2023
2 parents b308f6f + 09e5776 commit 80186ad
Show file tree
Hide file tree
Showing 10 changed files with 1,208 additions and 8 deletions.
160 changes: 159 additions & 1 deletion examples/petstore/client_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#
# Generator info:
# GitHub Page: https://github.com/artsmolin/pythogen
# Version: 0.2.24
# Version: 0.2.25
# ==============================================================================

# jinja2: lstrip_blocks: "True"
Expand Down Expand Up @@ -470,6 +470,24 @@ def __init__(
metrics_integration: MetricsIntegration | None = None,
logs_integration: LogsIntegration | None = DefaultLogsIntegration(),
):
"""
Parameters
----------
base_url
Base URL
timeout
In seconds
client_name
Used in metrics
client
httpx-client
headers
Headers that will be passed in all requests
metrics_integration
The object that is responsible for collecting and sending metrics
logs_integration
The object that is responsible for logging events
"""
self.client = client or httpx.AsyncClient(timeout=Timeout(timeout))
self.base_url = base_url
self.headers = headers or {}
Expand All @@ -483,6 +501,13 @@ async def findPetsByStatus(
auth: BasicAuth | None = None,
content: str | bytes | None = None,
) -> EmptyBody | list[Pet]:
"""
GET /pet/findByStatus
Operation ID: findPetsByStatus
Summary: Finds Pets by status
Description: Multiple status values can be provided with comma separated strings
"""

method = "get"

path = "/pet/findByStatus"
Expand Down Expand Up @@ -557,6 +582,13 @@ async def findPetsByTags(
auth: BasicAuth | None = None,
content: str | bytes | None = None,
) -> EmptyBody | list[Pet]:
"""
GET /pet/findByTags
Operation ID: findPetsByTags
Summary: Finds Pets by tags
Description: Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
"""

method = "get"

path = "/pet/findByTags"
Expand Down Expand Up @@ -631,6 +663,13 @@ async def getPetById(
auth: BasicAuth | None = None,
content: str | bytes | None = None,
) -> EmptyBody | Pet:
"""
GET /pet/{petId}
Operation ID: getPetById
Summary: Find pet by ID
Description: Returns a single pet
"""

method = "get"

if isinstance(path_params, GetPetByIdPathParams):
Expand Down Expand Up @@ -715,6 +754,13 @@ async def getInventory(
auth: BasicAuth | None = None,
content: str | bytes | None = None,
) -> GetinventoryResponse200 | None:
"""
GET /store/inventory
Operation ID: getInventory
Summary: Returns pet inventories by status
Description: Returns a map of status codes to quantities
"""

method = "get"

path = "/store/inventory"
Expand Down Expand Up @@ -775,6 +821,13 @@ async def getOrderById(
auth: BasicAuth | None = None,
content: str | bytes | None = None,
) -> EmptyBody | Order:
"""
GET /store/order/{orderId}
Operation ID: getOrderById
Summary: Find purchase order by ID
Description: For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions.
"""

method = "get"

if isinstance(path_params, GetOrderByIdPathParams):
Expand Down Expand Up @@ -860,6 +913,13 @@ async def loginUser(
auth: BasicAuth | None = None,
content: str | bytes | None = None,
) -> EmptyBody | str:
"""
GET /user/login
Operation ID: loginUser
Summary: Logs user into the system
Description:
"""

method = "get"

path = "/user/login"
Expand Down Expand Up @@ -933,6 +993,13 @@ async def logoutUser(
auth: BasicAuth | None = None,
content: str | bytes | None = None,
) -> None:
"""
GET /user/logout
Operation ID: logoutUser
Summary: Logs out current logged in user session
Description:
"""

method = "get"

path = "/user/logout"
Expand Down Expand Up @@ -990,6 +1057,13 @@ async def getUserByName(
auth: BasicAuth | None = None,
content: str | bytes | None = None,
) -> EmptyBody | User:
"""
GET /user/{username}
Operation ID: getUserByName
Summary: Get user by user name
Description:
"""

method = "get"

if isinstance(path_params, GetUserByNamePathParams):
Expand Down Expand Up @@ -1075,6 +1149,13 @@ async def addPet(
content: str | bytes | None = None,
body: Pet | dict[str, Any] | None = None,
) -> EmptyBody | Pet:
"""
POST /pet
Operation ID: addPet
Summary: Add a new pet to the store
Description: Add a new pet to the store
"""

method = "post"

path = "/pet"
Expand Down Expand Up @@ -1153,6 +1234,13 @@ async def addPetOrTag(
content: str | bytes | None = None,
body: AddpetortagRequestBody | dict[str, Any] | None = None,
) -> AddpetortagResponse200 | EmptyBody:
"""
POST /pet_or_tag
Operation ID: addPetOrTag
Summary: Add a new pet or tag to the store
Description: Add a new pet or tag to the store
"""

method = "post"

path = "/pet_or_tag"
Expand Down Expand Up @@ -1232,6 +1320,13 @@ async def updatePetWithForm(
auth: BasicAuth | None = None,
content: str | bytes | None = None,
) -> EmptyBody | None:
"""
POST /pet/{petId}
Operation ID: updatePetWithForm
Summary: Updates a pet in the store with form data
Description:
"""

method = "post"

if isinstance(path_params, UpdatePetWithFormPathParams):
Expand Down Expand Up @@ -1308,6 +1403,13 @@ async def uploadFile(
content: str | bytes | None = None,
body: bytes | dict[str, Any] | None = None,
) -> ApiResponse | None:
"""
POST /pet/{petId}/uploadImage
Operation ID: uploadFile
Summary: uploads an image
Description:
"""

method = "post"

if isinstance(path_params, UploadFilePathParams):
Expand Down Expand Up @@ -1381,6 +1483,13 @@ async def placeOrder(
content: str | bytes | None = None,
body: Order | dict[str, Any] | None = None,
) -> EmptyBody | Order:
"""
POST /store/order
Operation ID: placeOrder
Summary: Place an order for a pet
Description: Place a new order in the store
"""

method = "post"

path = "/store/order"
Expand Down Expand Up @@ -1459,6 +1568,13 @@ async def createUser(
content: str | bytes | None = None,
body: User | dict[str, Any] | None = None,
) -> None:
"""
POST /user
Operation ID: createUser
Summary: Create user
Description: This can only be done by the logged in user.
"""

method = "post"

path = "/user"
Expand Down Expand Up @@ -1523,6 +1639,13 @@ async def createUsersWithListInput(
content: str | bytes | None = None,
body: list[User] | dict[str, Any] | None = None,
) -> User | None:
"""
POST /user/createWithList
Operation ID: createUsersWithListInput
Summary: Creates list of users with given input array
Description: Creates list of users with given input array
"""

method = "post"

path = "/user/createWithList"
Expand Down Expand Up @@ -1590,6 +1713,13 @@ async def updatePet(
content: str | bytes | None = None,
body: Pet | dict[str, Any] | None = None,
) -> EmptyBody | Pet:
"""
PUT /pet
Operation ID: updatePet
Summary: Update an existing pet
Description: Update an existing pet by Id
"""

method = "put"

path = "/pet"
Expand Down Expand Up @@ -1691,6 +1821,13 @@ async def updateUser(
content: str | bytes | None = None,
body: User | dict[str, Any] | None = None,
) -> None:
"""
PUT /user/{username}
Operation ID: updateUser
Summary: Update user
Description: This can only be done by the logged in user.
"""

method = "put"

if isinstance(path_params, UpdateUserPathParams):
Expand Down Expand Up @@ -1759,6 +1896,13 @@ async def deletePet(
content: str | bytes | None = None,
headers: DeletePetHeaders | dict[str, Any] | None = None,
) -> EmptyBody | None:
"""
DELETE /pet/{petId}
Operation ID: deletePet
Summary: Deletes a pet
Description:
"""

method = "delete"

if isinstance(path_params, DeletePetPathParams):
Expand Down Expand Up @@ -1835,6 +1979,13 @@ async def deleteOrder(
auth: BasicAuth | None = None,
content: str | bytes | None = None,
) -> EmptyBody | None:
"""
DELETE /store/order/{orderId}
Operation ID: deleteOrder
Summary: Delete purchase order by ID
Description: For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
"""

method = "delete"

if isinstance(path_params, DeleteOrderPathParams):
Expand Down Expand Up @@ -1917,6 +2068,13 @@ async def deleteUser(
auth: BasicAuth | None = None,
content: str | bytes | None = None,
) -> EmptyBody | None:
"""
DELETE /user/{username}
Operation ID: deleteUser
Summary: Delete user
Description: This can only be done by the logged in user.
"""

method = "delete"

if isinstance(path_params, DeleteUserPathParams):
Expand Down
Loading

0 comments on commit 80186ad

Please sign in to comment.