支持数据授权管理功能
This commit is contained in:
@@ -26,6 +26,9 @@ const (
|
||||
scriptUsePath = "/saas/script/use"
|
||||
expListPath = "/saas/exp/list"
|
||||
expGetPath = "/saas/exp/get"
|
||||
grantListPath = "/saas/grant/list"
|
||||
grantAddPath = "/saas/grant/add"
|
||||
grantDeletePath = "/saas/grant/delete"
|
||||
)
|
||||
|
||||
type Auth struct {
|
||||
@@ -59,6 +62,9 @@ type ApiUrls struct {
|
||||
ScriptUsePath string
|
||||
ExpListPath string
|
||||
ExpGetPath string
|
||||
GrantListPath string
|
||||
GrantAddPath string
|
||||
GrantDeletePath string
|
||||
}
|
||||
|
||||
func InitAPIUrl(c *ApiUrls) *ApiUrls {
|
||||
@@ -198,5 +204,23 @@ func InitAPIUrl(c *ApiUrls) *ApiUrls {
|
||||
r.ExpGetPath = expGetPath
|
||||
}
|
||||
|
||||
if c.GrantListPath != "" {
|
||||
r.GrantListPath = c.GrantListPath
|
||||
} else {
|
||||
r.GrantListPath = grantListPath
|
||||
}
|
||||
|
||||
if c.GrantAddPath != "" {
|
||||
r.GrantAddPath = c.GrantAddPath
|
||||
} else {
|
||||
r.GrantAddPath = grantAddPath
|
||||
}
|
||||
|
||||
if c.GrantDeletePath != "" {
|
||||
r.GrantDeletePath = c.GrantDeletePath
|
||||
} else {
|
||||
r.GrantDeletePath = grantDeletePath
|
||||
}
|
||||
|
||||
return r
|
||||
}
|
||||
|
||||
@@ -128,6 +128,21 @@ func (c *SaasClient) ExpGet(saasReq *saasapi.SaasReq) (saasRes *saasapi.SaasRes,
|
||||
return c.post(postUrl, saasReq)
|
||||
}
|
||||
|
||||
func (c *SaasClient) GrantList(saasReq *saasapi.SaasReq) (saasRes *saasapi.SaasRes, err error) {
|
||||
postUrl := c.makeUrl(c.ApiUrls.BaseUrl, c.ApiUrls.GrantListPath)
|
||||
return c.post(postUrl, saasReq)
|
||||
}
|
||||
|
||||
func (c *SaasClient) GrantAdd(saasReq *saasapi.SaasReq) (saasRes *saasapi.SaasRes, err error) {
|
||||
postUrl := c.makeUrl(c.ApiUrls.BaseUrl, c.ApiUrls.GrantAddPath)
|
||||
return c.post(postUrl, saasReq)
|
||||
}
|
||||
|
||||
func (c *SaasClient) GrantDelete(saasReq *saasapi.SaasReq) (saasRes *saasapi.SaasRes, err error) {
|
||||
postUrl := c.makeUrl(c.ApiUrls.BaseUrl, c.ApiUrls.GrantDeletePath)
|
||||
return c.post(postUrl, saasReq)
|
||||
}
|
||||
|
||||
func (c *SaasClient) makeUrl(baseUrl, path string, params ...string) string {
|
||||
url, err := url.Parse(baseUrl)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user