Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Middleware and adapter functions #373

Merged
merged 2 commits into from
Apr 16, 2020

Conversation

dweinand
Copy link
Contributor

@dweinand dweinand commented Apr 8, 2020

Created based on feedback to #369

The Tesla.Client struct has a private legacy data structure intended to support macro-friendliness. This structure is different than the supported argument structure for Tesla.client/2. This means that one cannot copy the middleware or adapter from one client into a new one for example.

Since the internal structure is highly likely to change, we are keeping it private and adding accessor functions (Tesla.Client.adapter/1 and Tesla.Client.middleware/1) for getting a client's adapter or middleware in a format compatible with Tesla.client/2.

This supports a workflow like:

def my_client(gax_client)
  middleware = Tesla.Client.middleware(gax_client)
  adapter = Tesla.Client.adapter(gax_client)
  # modify middleware and adapter as needed
  Tesla.client(middleware, adapter)
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants