Skip to content

client: improve client.Client function returns #236

@bobheadxi

Description

@bobheadxi

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.

Metadata

Metadata

Assignees

Labels

:cmdcommand line and clientside functionalitytype: refactor 🏡code structure and architecture

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions