lib/app/force.go

27 lines
609 B
Go
Raw Normal View History

2023-09-12 03:42:13 +00:00
package app
import (
"github.com/taxnexus/go-force/force"
)
// InitForce creates a salesforce connection using serviceAccountName
func InitForce(serviceAccountName string) *force.API {
2023-11-19 19:31:26 +00:00
sugar.Infof("app.initForce: 👉 %s", serviceAccountName)
2023-09-12 03:42:13 +00:00
acct := GetServiceAccount(serviceAccountName)
theForce, err := force.Create(
"v45.0",
acct.ClientID,
acct.ClientSecret,
acct.Username,
acct.Password,
acct.SecurityToken,
"production",
)
if err != nil {
sugar.Errorf("app.InitForce: salesforce error: %s", err.Error())
return nil
}
2023-11-19 19:31:26 +00:00
sugar.Info("app.InitForce: 👍 👈")
2023-09-12 03:42:13 +00:00
return theForce
}