github.com/grokify/go-ringcentral-client@v0.3.31/engagevoice/v1/util/client.go (about) 1 package engagevoiceutil 2 3 import ( 4 "context" 5 "net/http" 6 7 engagevoice "github.com/grokify/go-ringcentral-client/engagevoice/v1/client" 8 "github.com/grokify/go-ringcentral-client/engagevoice/v1/util/lite" 9 ) 10 11 type ClientAPIs struct { 12 APIClient *engagevoice.APIClient 13 Config *engagevoice.Configuration 14 } 15 16 func NewClientAPIsRingCentralPassword(ctx context.Context, rcCredentials []byte) (ClientAPIs, error) { 17 httpClient, err := lite.NewClientRingCentralPassword(ctx, rcCredentials) 18 if err != nil { 19 return ClientAPIs{}, err 20 } 21 return NewClientAPIsHTTPClient(httpClient), nil 22 } 23 24 func NewClientAPIsHTTPClient(httpClient *http.Client) ClientAPIs { 25 cfg := engagevoice.NewConfiguration() 26 cfg.HTTPClient = httpClient 27 return ClientAPIs{ 28 Config: cfg, 29 APIClient: engagevoice.NewAPIClient(cfg)} 30 } 31 32 func NewClientAPIs(apiToken string) ClientAPIs { 33 return NewClientAPIsHTTPClient(lite.NewClientToken(apiToken)) 34 }