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

Can't get response codes as a consumer #55

Open
mwiggins-casa opened this issue Jan 25, 2023 · 2 comments
Open

Can't get response codes as a consumer #55

mwiggins-casa opened this issue Jan 25, 2023 · 2 comments

Comments

@mwiggins-casa
Copy link

mwiggins-casa commented Jan 25, 2023

I'd like to be able to be able to get the API response code returned from calls (post, get, put, ...). This would allow me to use the response code in order to make decisions depending on the type of response (200 vs 201, etc.).

I've got some ideas around how to accomplish this and can open a draft PR

@s4cha
Copy link
Member

s4cha commented Jan 25, 2023

Hey @mwiggins-casa, good call, indeed at the moment we can only get the response codes for errors, but not for successful calls. I just realized this recently and this is definitely something we need :)
Possible solutions that come to my mind would be to have a variant for get post/ put calls that returns a tuple (a,b) a being the ResponseData or status code and B the T:Decodable model. One other way would be to to have a NetworkingResponse variant that would have the mapped model inside for example.

Feel free to open a PR, contributions are always welcome of course. And also feel free to reach out if you want help/feedback or just discuss the api.

Thanks!

@mwiggins-casa
Copy link
Author

Hey @s4cha sounds good, thanks - the tuple approach is along the lines of my initial thoughts, I'll give it a shot over the next couple days.

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

No branches or pull requests

2 participants