Title: Add object-oriented client option · Issue #224 · openapi-generators/openapi-python-client · GitHub
Open Graph Title: Add object-oriented client option · Issue #224 · openapi-generators/openapi-python-client
X Title: Add object-oriented client option · Issue #224 · openapi-generators/openapi-python-client
Description: First of all, thank you for this great project, the code is very nice and I think it really has a lot of potential. Is your feature request related to a problem? Please describe. As mentioned in #171, the current approach arguably needs ...
Open Graph Description: First of all, thank you for this great project, the code is very nice and I think it really has a lot of potential. Is your feature request related to a problem? Please describe. As mentioned in #1...
X Description: First of all, thank you for this great project, the code is very nice and I think it really has a lot of potential. Is your feature request related to a problem? Please describe. As mentioned in #1...
Opengraph URL: https://github.com/openapi-generators/openapi-python-client/issues/224
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Add object-oriented client option","articleBody":"First of all, thank you for this great project, the code is very nice and I think it really has a lot of potential.\r\n\r\n**Is your feature request related to a problem? Please describe.**\r\n\r\nAs mentioned in https://github.com/triaxtec/openapi-python-client/issues/171, the current approach arguably needs a little too much boilerplate that could be avoided by adding a more object oriented `Client`.\r\n\r\n**Describe the solution you'd like**\r\n\r\n* Add two new client interfaces, `SyncClient` and `AsyncClient` that would wrap the currently generated tag packages in objects, and expose them as properties.\r\n\r\nWith that approach, a developer could call an endpoint with as little code as:\r\n```python\r\nfrom petstore_client import SyncPetstoreClient # Named after the spec title, nicer if you import several auto-generated clients\r\nclient = SyncPetstoreClient(\"http://mypetstore\")\r\npets = client.pets.list_pets()\r\n```\r\n\r\n* One issue is that we loose the ability to statically tell the user that some endpoint requires an `AuthenticatedClient` or not... Some thinking required here I guess.\r\n\r\n* Additionally, a default `base_url` could be provided through an environment variable named after the spec title, for instance: `SWAGGER_PETSTORE_BASE_URL`. It could be nice to prevent microservices from using different naming conventions.\r\n\r\nFor reference, my crude attempt at implementing those interfaces is available here: https://github.com/upciti/openapi-python-client/tree/feature/0-boilerplate-clients.\r\n","author":{"url":"https://github.com/fyhertz","@type":"Person","name":"fyhertz"},"datePublished":"2020-10-28T13:15:50.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":5},"url":"https://github.com/224/openapi-python-client/issues/224"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:98326d72-9652-2aa2-faa1-473ea221eedc |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8B58:7E680:2490A0:2E9566:697F3B70 |
| html-safe-nonce | c9925cc82bffb0e547b18013e5413765709713925e6158a161544c49c31bc719 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4QjU4OjdFNjgwOjI0OTBBMDoyRTk1NjY6Njk3RjNCNzAiLCJ2aXNpdG9yX2lkIjoiODg4MzA1OTQ2MzExMjU3MTc2MCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 4b4378b9934c8e3d4e696b9ae60219a8276e4431c1723a6e57bf4c0edfbe9aac |
| hovercard-subject-tag | issue:731431942 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/openapi-generators/openapi-python-client/224/issue_layout |
| twitter:image | https://opengraph.githubassets.com/f00b1602379cac9fe60d3385952ba35d40b6d1bb6cf392f2012d33ff655ac1e0/openapi-generators/openapi-python-client/issues/224 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/f00b1602379cac9fe60d3385952ba35d40b6d1bb6cf392f2012d33ff655ac1e0/openapi-generators/openapi-python-client/issues/224 |
| og:image:alt | First of all, thank you for this great project, the code is very nice and I think it really has a lot of potential. Is your feature request related to a problem? Please describe. As mentioned in #1... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | fyhertz |
| hostname | github.com |
| expected-hostname | github.com |
| None | 60279d4097367e16897439d16d6bbe4180663db828c666eeed2656988ffe59f6 |
| turbo-cache-control | no-preview |
| go-import | github.com/openapi-generators/openapi-python-client git https://github.com/openapi-generators/openapi-python-client.git |
| octolytics-dimension-user_id | 84925606 |
| octolytics-dimension-user_login | openapi-generators |
| octolytics-dimension-repository_id | 240776275 |
| octolytics-dimension-repository_nwo | openapi-generators/openapi-python-client |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 240776275 |
| octolytics-dimension-repository_network_root_nwo | openapi-generators/openapi-python-client |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 7c85641c598ad130c74f7bcc27f58575cac69551 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width