Files
saasapi/pkg/saashttp/cfg.go

203 lines
4.4 KiB
Go

package saashttp
const (
baseUrl = "https://api.rta.qq.com"
infoPath = "/saas/info"
writePath = "/saas/write"
readPath = "/saas/read"
columnWritePath = "/saas/column_write"
taskCreatePath = "/saas/task/create"
taskListPath = "/saas/task/list"
taskInfoPath = "/saas/task/info"
taskUploadPath = "/saas/task/upload"
taskDownloadPath = "/saas/task/download"
taskDeletePath = "/saas/task/delete"
taskRunPath = "/saas/task/run"
targetListPath = "/saas/target/list"
targetCreatePath = "/saas/target/create"
targetDeletePath = "/saas/target/delete"
bindSetPath = "/saas/bind/set"
bindDeletePath = "/saas/bind/delete"
scriptRunPath = "/saas/script/run"
scriptCreatePath = "/saas/script/create"
scriptListPath = "/saas/script/list"
scriptDeletePath = "/saas/script/delete"
scriptGetPath = "/saas/script/get"
scriptUsePath = "/saas/script/use"
expListPath = "/saas/exp/list"
expGetPath = "/saas/exp/get"
)
type Auth struct {
Account string
Token string
}
type ApiUrls struct {
BaseUrl string
InfoPath string
WritePath string
ReadPath string
ColumnWritePath string
TaskCreatePath string
TaskListPath string
TaskInfoPath string
TaskDeletePath string
TaskRunPath string
TaskUploadPath string
TaskDownloadPath string
TargetListPath string
TargetCreatePath string
TargetDeletePath string
BindSetPath string
BindDeletePath string
ScriptRunPath string
ScriptCreatePath string
ScriptListPath string
ScriptDeletePath string
ScriptGetPath string
ScriptUsePath string
ExpListPath string
ExpGetPath string
}
func InitAPIUrl(c *ApiUrls) *ApiUrls {
r := &ApiUrls{}
if c.BaseUrl != "" {
r.BaseUrl = c.BaseUrl
} else {
r.BaseUrl = baseUrl
}
if c.InfoPath != "" {
r.InfoPath = c.InfoPath
} else {
r.InfoPath = infoPath
}
if c.WritePath != "" {
r.WritePath = c.WritePath
} else {
r.WritePath = writePath
}
if c.ReadPath != "" {
r.ReadPath = c.ReadPath
} else {
r.ReadPath = readPath
}
if c.ColumnWritePath != "" {
r.ColumnWritePath = c.ColumnWritePath
} else {
r.ColumnWritePath = columnWritePath
}
if c.TaskCreatePath != "" {
r.TaskCreatePath = c.TaskCreatePath
} else {
r.TaskCreatePath = taskCreatePath
}
if c.TaskListPath != "" {
r.TaskListPath = c.TaskListPath
} else {
r.TaskListPath = taskListPath
}
if c.TaskInfoPath != "" {
r.TaskInfoPath = c.TaskInfoPath
} else {
r.TaskInfoPath = taskInfoPath
}
if c.TaskDeletePath != "" {
r.TaskDeletePath = c.TaskDeletePath
} else {
r.TaskDeletePath = taskDeletePath
}
if c.TaskRunPath != "" {
r.TaskRunPath = c.TaskRunPath
} else {
r.TaskRunPath = taskRunPath
}
if c.TaskUploadPath != "" {
r.TaskUploadPath = c.TaskUploadPath
} else {
r.TaskUploadPath = taskUploadPath
}
if c.TaskDownloadPath != "" {
r.TaskDownloadPath = c.TaskDownloadPath
} else {
r.TaskDownloadPath = taskDownloadPath
}
if c.TargetListPath != "" {
r.TargetListPath = c.TargetListPath
} else {
r.TargetListPath = targetListPath
}
if c.TargetCreatePath != "" {
r.TargetCreatePath = c.TargetCreatePath
} else {
r.TargetCreatePath = targetCreatePath
}
if c.TargetDeletePath != "" {
r.TargetDeletePath = c.TargetDeletePath
} else {
r.TargetDeletePath = targetDeletePath
}
if c.BindSetPath != "" {
r.BindSetPath = c.BindSetPath
} else {
r.BindSetPath = bindSetPath
}
if c.BindDeletePath != "" {
r.BindDeletePath = c.BindDeletePath
} else {
r.BindDeletePath = bindDeletePath
}
if c.ScriptRunPath != "" {
r.ScriptRunPath = c.ScriptRunPath
} else {
r.ScriptRunPath = scriptRunPath
}
if c.ScriptCreatePath != "" {
r.ScriptCreatePath = c.ScriptCreatePath
} else {
r.ScriptCreatePath = scriptCreatePath
}
if c.ScriptListPath != "" {
r.ScriptListPath = c.ScriptListPath
} else {
r.ScriptListPath = scriptListPath
}
if c.ScriptDeletePath != "" {
r.ScriptDeletePath = c.ScriptDeletePath
} else {
r.ScriptDeletePath = scriptDeletePath
}
if c.ScriptGetPath != "" {
r.ScriptGetPath = c.ScriptGetPath
} else {
r.ScriptGetPath = scriptGetPath
}
if c.ScriptUsePath != "" {
r.ScriptUsePath = c.ScriptUsePath
} else {
r.ScriptUsePath = scriptUsePath
}
if c.ExpListPath != "" {
r.ExpListPath = c.ExpListPath
} else {
r.ExpListPath = expListPath
}
if c.ExpGetPath != "" {
r.ExpGetPath = c.ExpGetPath
} else {
r.ExpGetPath = expGetPath
}
return r
}