lib/app/force.go

27 lines
609 B
Go
Raw Normal View History

2021-01-10 23:14:20 +00:00
package app
import (
"github.com/taxnexus/go-force/force"
)
// InitForce creates a salesforce connection using serviceAccountName
func InitForce(serviceAccountName string) *force.API {
2021-01-12 22:37:03 +00:00
sugar.Infof("app.initForce: 📥 %s", serviceAccountName)
2021-01-10 23:14:20 +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
}
sugar.Info("app.InitForce: 👍 📤")
return theForce
}