MCPcopy Create free account
hub / github.com/ProspectOne/perfops-cli / NewClient

Function NewClient

perfops/client.go:109–125  ·  view source on GitHub ↗

NewClient returns a new Client given an API key and options.

(opts ...func(c *Client) error)

Source from the content-addressed store, hash-verified

107
108// NewClient returns a new Client given an API key and options.
109func NewClient(opts ...func(c *Client) error) (*Client, error) {
110 c := &Client{
111 client: http.DefaultClient,
112 BasePath: basePath,
113 }
114 c.common.client = c
115 for _, opt := range opts {
116 if err := opt(c); err != nil {
117 return nil, err
118 }
119 }
120
121 c.DNS = (*DNSService)(&c.common)
122 c.Run = (*RunService)(&c.common)
123
124 return c, nil
125}
126
127func (c *Client) DoRequest(req *http.Request, v interface{}) error {
128 if err := c.do(req, &v); err != nil {

Callers 4

newPerfOpsClientFunction · 0.92
newTestPerfopsClientFunction · 0.92
TestNewClientFunction · 0.85
newTestClientFunction · 0.85

Calls

no outgoing calls

Tested by 3

newTestPerfopsClientFunction · 0.74
TestNewClientFunction · 0.68
newTestClientFunction · 0.68