func NewClient()

in internal/client/client.go [24:42]


func NewClient(host, token *string) (*Client, error) {
	// If token not provided, return error
	if token == nil {
		return nil, errors.New("no api token provided")
	}

	c := Client{
		HTTPClient: &http.Client{Timeout: 10 * time.Second},
		// Default Devlake URL
		HostURL: HostURL,
		Token:   *token,
	}

	if host != nil {
		c.HostURL = *host
	}

	return &c, nil
}