23 lines
532 B
Go
23 lines
532 B
Go
|
package supplier
|
||
|
|
||
|
import (
|
||
|
"fmt"
|
||
|
|
||
|
"github.com/go-resty/resty/v2"
|
||
|
)
|
||
|
|
||
|
func NewServiceProviderSupplier(name string, config ServiceProviderConfig) (ServiceProviderSupplier, error) {
|
||
|
switch name {
|
||
|
case "rocketchat":
|
||
|
return &rocketchat{
|
||
|
// until the app is added to the marketplace.
|
||
|
sideLoading: true,
|
||
|
ServiceProviderConfig: config,
|
||
|
Client: resty.New().
|
||
|
SetBaseURL(config.Host).
|
||
|
SetHeader("Content-Type", "application/json"),
|
||
|
}, nil
|
||
|
}
|
||
|
return nil, fmt.Errorf("unkown service provider : %s", name)
|
||
|
}
|