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
d8f636f1
Commit
d8f636f1
authored
Apr 23, 2019
by
Eric
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
modify service client
parent
c9ebf9bd
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
18 deletions
+14
-18
client.go
pkg/sdk/client.go
+14
-18
No files found.
pkg/sdk/client.go
View file @
d8f636f1
...
@@ -13,9 +13,10 @@ type ClientAuth interface {
...
@@ -13,9 +13,10 @@ type ClientAuth interface {
}
}
type
WrapperClient
struct
{
type
WrapperClient
struct
{
Http
*
common
.
Client
Http
*
common
.
Client
Auth
ClientAuth
AuthClient
*
common
.
Client
BaseHost
string
Auth
ClientAuth
BaseHost
string
}
}
func
(
c
*
WrapperClient
)
LoadAuth
()
error
{
func
(
c
*
WrapperClient
)
LoadAuth
()
error
{
...
@@ -43,46 +44,41 @@ func (c *WrapperClient) CheckAuth() error {
...
@@ -43,46 +44,41 @@ func (c *WrapperClient) CheckAuth() error {
func
(
c
*
WrapperClient
)
Get
(
url
string
,
res
interface
{},
needAuth
bool
)
error
{
func
(
c
*
WrapperClient
)
Get
(
url
string
,
res
interface
{},
needAuth
bool
)
error
{
if
needAuth
{
if
needAuth
{
c
.
Http
.
SetAuth
(
c
.
Auth
.
Sign
()
)
return
c
.
AuthClient
.
Get
(
c
.
BaseHost
+
url
,
res
)
}
else
{
}
else
{
c
.
Http
.
SetAuth
(
""
)
return
c
.
Http
.
Get
(
c
.
BaseHost
+
url
,
res
)
}
}
return
c
.
Http
.
Get
(
c
.
BaseHost
+
url
,
res
)
}
}
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
)
}
}
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