2019-10-03 20:22:22 +00:00
|
|
|
package mcm
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
2020-06-11 06:10:01 +00:00
|
|
|
"strings"
|
|
|
|
|
2021-07-13 23:28:16 +00:00
|
|
|
"git.canopymc.net/Etzelia/go-mcm/model"
|
|
|
|
"git.canopymc.net/Etzelia/go-mcm/web"
|
2019-10-03 20:22:22 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
type MCM struct {
|
|
|
|
Token string
|
|
|
|
URL string
|
|
|
|
}
|
|
|
|
|
|
|
|
func NewMCM(token, baseURL string) *MCM {
|
|
|
|
return &MCM{
|
|
|
|
Token: token,
|
|
|
|
URL: strings.TrimRight(baseURL, "/"),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func (mcm *MCM) NewModel() *model.Model {
|
|
|
|
return &model.Model{
|
|
|
|
Token: mcm.Token,
|
|
|
|
URL: fmt.Sprintf("%s/model", strings.TrimRight(mcm.URL, "/")),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func (mcm *MCM) NewWeb() *web.Web {
|
|
|
|
return &web.Web{
|
|
|
|
Token: mcm.Token,
|
|
|
|
URL: fmt.Sprintf("%s/web", strings.TrimRight(mcm.URL, "/")),
|
|
|
|
}
|
|
|
|
}
|