139 lines
2.7 KiB
Go
139 lines
2.7 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"
|
|
taskCancelPath = "/saas/task/delete"
|
|
taskInfoPath = "/saas/task/info"
|
|
taskUploadPath = "/saas/task/upload"
|
|
taskDownloadPath = "/saas/task/download"
|
|
taskDeletePath = "/saas/task/delete"
|
|
taskRunPath = "/saas/task/run"
|
|
targetListPath = "/saas/target/list"
|
|
bindSetPath = "/saas/bind/set"
|
|
bindDeletePath = "/saas/bind/delete"
|
|
)
|
|
|
|
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
|
|
BindSetPath string
|
|
BindDeletePath 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.BindSetPath != "" {
|
|
r.BindSetPath = c.BindSetPath
|
|
} else {
|
|
r.BindSetPath = bindSetPath
|
|
}
|
|
|
|
if c.BindDeletePath != "" {
|
|
r.BindDeletePath = c.BindDeletePath
|
|
} else {
|
|
r.BindDeletePath = bindDeletePath
|
|
}
|
|
|
|
return r
|
|
}
|
|
|
|
type Auth struct {
|
|
Account string
|
|
Token string
|
|
}
|