The code generates the client receiver functions today. This request is to add those functions to an interface, so users can easily stub the interface out for unit testing.
Example: Today the client is generated for something like this, where th query geneated is 'AddNumbers':
Ideally an interface would also be created with AddNumbers in it so client side code can create mock versions of the interface to test with. The NewClient would return the interface implemention. Something like:
The code generates the client receiver functions today. This request is to add those functions to an interface, so users can easily stub the interface out for unit testing.
Example: Today the client is generated for something like this, where th query geneated is 'AddNumbers':
type Client struct { Client *client.Client }
func NewClient(cli http.Client, baseURL string, options ...client.HTTPRequestOption) Client { return &Client{Client: client.NewClient(cli, baseURL, options...)} }
func (c *Client) AddNumbers( ... }
Ideally an interface would also be created with AddNumbers in it so client side code can create mock versions of the interface to test with. The NewClient would return the interface implemention. Something like:
type Client interface { AddNumbers(... }
type gqlClient struct { Client *client.Client }
func NewClient(cli *http.Client, baseURL string, options ...client.HTTPRequestOption) Client { return &gqlClient{Client: client.NewClient(cli, baseURL, options...)} }
func (c *gqlClient) AddNumbers( ... }