Skip to content

Remove Client class in favor of direct axios instance #6

@jjnesbitt

Description

@jjnesbitt

This has been a source of pain for me several times in the past. I don't see a real reason to wrap calls with the Client class within multinetjs itself. The result of having this abstraction is less flexibility (as you can't just pass any axios parameters into the exposed API methods), which results in both more changes/releases to multinetjs, as well as workarounds.

I think we should remove the Client field in the MultinetAPI class altogether, and replace it with an axios instance. Along with this, we should have a parameter in each function that accepts an AxiosRequestConfig object, which we could just pass to the axios call, allowing more flexibility and less multinetjs releases.

The other benefit of replacing these wrapping calls with axios calls directly, is that the client can have access to the details of the request. This can be useful for several reasons, and has already been required in the project. This would result in a breaking change to multinetjs however, so if we were to move forward with this, we'd have to coordinate with that repository as well.

I believe I've already discussed this somewhat with @waxlamp, but I've again run into roadblocks as a result of this, so that's why I'm raising this issue now. I'm willing to do much of the work required for this, but I want to make sure we're in agreement first. Please let me know what you think.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions