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 {
sugar.Infof("app.initForce: 📥 %s", serviceAccountName)
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
}
sugar.Info("app.InitForce: 👍 📤")
return theForce
}