github.com/datreeio/datree@v1.9.22-rc/pkg/cliClient/cliClient.go (about) 1 package cliClient 2 3 import ( 4 "github.com/datreeio/datree/pkg/httpClient" 5 ) 6 7 type HTTPClient interface { 8 Request(method string, resourceURI string, body interface{}, headers map[string]string) (httpClient.Response, error) 9 } 10 type NetworkValidator interface { 11 IdentifyNetworkError(err error) error 12 IsLocalMode() bool 13 } 14 15 type CliClient struct { 16 baseUrl string 17 httpClient HTTPClient 18 timeoutClient HTTPClient 19 httpErrors []string 20 networkValidator NetworkValidator 21 flagsHeaders map[string]string 22 } 23 24 func NewCliClient(url string, networkValidator NetworkValidator) *CliClient { 25 httpClient := httpClient.NewClient(url, nil) 26 return &CliClient{ 27 baseUrl: url, 28 httpClient: httpClient, 29 timeoutClient: nil, 30 httpErrors: []string{}, 31 networkValidator: networkValidator, 32 flagsHeaders: make(map[string]string), 33 } 34 }