openapi-python-client icon indicating copy to clipboard operation
openapi-python-client copied to clipboard

New client proposition

Open lperdereau opened this issue 4 years ago • 2 comments

In my case I want to generate a client to interact with cloud-hypervisor. This means, the generated OA Client has to query a socket and not a common HTTP server. I saw your project is using httpx, with whom it is possible to query a socket when specifying a special transport type doc, but it is currently not possible to specify a specific transport type when generating a client.

We could make a new client generation allowing us to take adventage of httpx's features. As an example, it could be interesting to generate something like this :

from cloud_hypervisor_api_client import Client as CloudHypervisorClient
transport = httpx.HTTPTransport(uds="/var/run/docker.sock")

client = CloudHypervisorClient(transport=transport, base_url="https://api.example.com")
client.vm.get()
client.vm.list()
client.vm.create(VMObject)
client.vm.delete(VMObject)

lperdereau avatar Oct 29 '21 13:10 lperdereau

Is the transport something you can set on the httpx Client? Meaning would #202 potentially solve this?

dbanty avatar Oct 29 '21 13:10 dbanty

Actually yes I could set it on the httpx Client, this issue will solved transport methods.

lperdereau avatar Oct 29 '21 15:10 lperdereau