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

client: improve client.Client function returns #236

Closed
bobheadxi opened this issue Jun 11, 2018 · 0 comments
Closed

client: improve client.Client function returns #236

bobheadxi opened this issue Jun 11, 2018 · 0 comments
Assignees
Labels
:cmd command line and clientside functionality type: refactor 🏡 code structure and architecture
Milestone

Comments

@bobheadxi
Copy link
Member

bobheadxi commented Jun 11, 2018

Currently the vast majority of client.Client functions return http.Reponse, which is pretty unhelpful for the most part, and requires a lot of fiddling with response bodies etc on the user end

// Reset shuts down deployment and deletes the contents of the deployment's
// project directory
func (c *Client) Reset() (*http.Response, error) {
	return c.post("/reset", nil)
}

We should update these so that they handle http responses internally (and return errors if needed) and instead of returning the raw responses, return some more predictable stuff. Client.Reset(), for example, could just be:

func (c *Client) Reset() error {	
    /* handle http.Response and do stuff */
}

Theres a bit of code repetition in the client that we can probably improve on as well

This is not a particularly trivial PR, and might require a few passes.

@bobheadxi bobheadxi added :cmd command line and clientside functionality type: refactor 🏡 code structure and architecture labels Jun 11, 2018
@bobheadxi bobheadxi changed the title Improve client.Client functionality Improve client.Client function returns Aug 28, 2018
@bobheadxi bobheadxi added the good first issue cake for everyone! label Aug 28, 2018
@bobheadxi bobheadxi added this to the v0.6.0 milestone Jan 8, 2019
@bobheadxi bobheadxi changed the title Improve client.Client function returns client: improve client.Client function returns Feb 13, 2019
@bobheadxi bobheadxi self-assigned this Feb 14, 2019
@bobheadxi bobheadxi removed the good first issue cake for everyone! label Feb 14, 2019
bobheadxi added a commit that referenced this issue Feb 27, 2019
* client: rework function returns to remove http.Response

* client: split out UserClient

* client: add debugging output

* deps: update to include gorilla/[email protected]

* daemon: correct /logs response message

* docs: fix incorrect /logs documentation, regenerate tip documentation

* ci: build daemon with tag 'test',  fix bootstrap test to use version 'test'

closes #236
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:cmd command line and clientside functionality type: refactor 🏡 code structure and architecture
Projects
None yet
Development

No branches or pull requests

1 participant