github.com/instill-ai/component@v0.16.0-beta/pkg/connector/stabilityai/v0/client.go (about) 1 package stabilityai 2 3 import ( 4 "github.com/instill-ai/component/pkg/connector/util/httpclient" 5 "go.uber.org/zap" 6 "google.golang.org/protobuf/types/known/structpb" 7 ) 8 9 func newClient(config *structpb.Struct, logger *zap.Logger) *httpclient.Client { 10 c := httpclient.New("Stability AI", getBasePath(config), 11 httpclient.WithLogger(logger), 12 httpclient.WithEndUserError(new(errBody)), 13 ) 14 15 c.SetAuthToken(getAPIKey(config)) 16 17 return c 18 } 19 20 type errBody struct { 21 Msg string `json:"message"` 22 } 23 24 func (e errBody) Message() string { 25 return e.Msg 26 }