Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
K
koko
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ops
koko
Commits
466fa48a
Commit
466fa48a
authored
Apr 24, 2019
by
Eric
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add authclient for needauth request
parent
a9e4d5f4
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
25 deletions
+28
-25
client.go
pkg/sdk/client.go
+22
-24
assets.go
pkg/service/assets.go
+1
-1
init.go
pkg/service/init.go
+5
-0
No files found.
pkg/sdk/client.go
View file @
466fa48a
...
@@ -51,37 +51,35 @@ func (c *WrapperClient) Get(url string, res interface{}, needAuth bool) error {
...
@@ -51,37 +51,35 @@ func (c *WrapperClient) Get(url string, res interface{}, needAuth bool) error {
}
}
func
(
c
*
WrapperClient
)
Post
(
url
string
,
data
interface
{},
res
interface
{},
needAuth
bool
)
error
{
func
(
c
*
WrapperClient
)
Post
(
url
string
,
data
interface
{},
res
interface
{},
needAuth
bool
)
error
{
//if needAuth {
if
needAuth
{
// c.Http.SetAuth(c.Auth.Sign())
return
c
.
AuthClient
.
Post
(
url
,
data
,
res
)
//} else {
}
else
{
// c.Http.SetAuth("")
return
c
.
Http
.
Post
(
url
,
data
,
res
)
//}
}
return
c
.
Http
.
Post
(
url
,
data
,
res
)
}
}
func
(
c
*
WrapperClient
)
Delete
(
url
string
,
res
interface
{},
needAuth
bool
)
error
{
func
(
c
*
WrapperClient
)
Delete
(
url
string
,
res
interface
{},
needAuth
bool
)
error
{
//if needAuth {
if
needAuth
{
// c.Http.SetAuth(c.Auth.Sign())
return
c
.
AuthClient
.
Delete
(
url
,
res
)
//} else {
}
else
{
// c.Http.SetAuth("")
return
c
.
Http
.
Delete
(
url
,
res
)
//}
}
return
c
.
Http
.
Delete
(
url
,
res
)
}
}
func
(
c
*
WrapperClient
)
Put
(
url
string
,
data
interface
{},
res
interface
{},
needAuth
bool
)
error
{
func
(
c
*
WrapperClient
)
Put
(
url
string
,
data
interface
{},
res
interface
{},
needAuth
bool
)
error
{
//
if needAuth {
if
needAuth
{
// c.Http.SetAuth(c.Auth.Sign()
)
return
c
.
AuthClient
.
Put
(
url
,
data
,
res
)
//
} else {
}
else
{
// c.Http.SetAuth(""
)
return
c
.
Http
.
Put
(
url
,
data
,
res
)
//
}
}
return
c
.
Http
.
Put
(
url
,
data
,
res
)
}
}
func
(
c
*
WrapperClient
)
Patch
(
url
string
,
data
interface
{},
res
interface
{},
needAuth
bool
)
error
{
func
(
c
*
WrapperClient
)
Patch
(
url
string
,
data
interface
{},
res
interface
{},
needAuth
bool
)
error
{
//
if needAuth {
if
needAuth
{
// c.Http.SetAuth(c.Auth.Sign()
)
return
c
.
AuthClient
.
Patch
(
url
,
data
,
res
)
//
} else {
}
else
{
// c.Http.SetAuth(""
)
return
c
.
Http
.
Patch
(
url
,
data
,
res
)
//
}
}
return
c
.
Http
.
Patch
(
url
,
data
,
res
)
}
}
pkg/service/assets.go
View file @
466fa48a
...
@@ -13,7 +13,7 @@ func GetSystemUserAssetAuthInfo(systemUserID, assetID string) (info sdk.SystemUs
...
@@ -13,7 +13,7 @@ func GetSystemUserAssetAuthInfo(systemUserID, assetID string) (info sdk.SystemUs
func
GetSystemUserAuthInfo
(
systemUserID
string
)
(
info
sdk
.
SystemUserAuthInfo
)
{
func
GetSystemUserAuthInfo
(
systemUserID
string
)
(
info
sdk
.
SystemUserAuthInfo
)
{
Url
:=
fmt
.
Sprintf
(
sdk
.
SystemUserAuthInfoURL
,
systemUserID
)
Url
:=
fmt
.
Sprintf
(
sdk
.
SystemUserAuthInfoURL
,
systemUserID
)
err
:=
C
lient
.
Get
(
Url
,
&
info
,
true
)
err
:=
c
lient
.
Get
(
Url
,
&
info
,
true
)
if
err
!=
nil
{
if
err
!=
nil
{
logger
.
Error
(
"Get system user auth info failed"
)
logger
.
Error
(
"Get system user auth info failed"
)
}
}
...
...
pkg/service/init.go
0 → 100644
View file @
466fa48a
package
service
import
"cocogo/pkg/sdk"
var
client
=
sdk
.
WrapperClient
{}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment