35 lines
573 B
Go
35 lines
573 B
Go
package mcm
|
|
|
|
import (
|
|
"fmt"
|
|
"go.etztech.xyz/go-mcm/model"
|
|
"go.etztech.xyz/go-mcm/web"
|
|
"strings"
|
|
)
|
|
|
|
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, "/")),
|
|
}
|
|
}
|