-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathclient.go
53 lines (43 loc) · 1.02 KB
/
client.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
package steam
import (
"net/url"
)
type (
Client interface {
SetReq(req Req)
RenderTo(callback string) string
MaybeRenderTo(url, callback string) string
OpenidBindQuery(param url.Values) (res *openidRes, err error)
OpenidBindMap(param map[string]string) (res *openidRes, err error)
Api() Api
}
client struct {
appKey string
req Req
}
)
func NewClient(appKey string) Client {
return &client{
appKey: appKey,
req: NewDefReq(),
}
}
func (c *client) SetReq(req Req) {
c.req = req
}
func (c *client) RenderTo(callback string) string {
return renderTo(callback)
}
// maybe open other to login steam
func (c *client) MaybeRenderTo(url, callback string) string {
return renderTo(callback, url)
}
func (c *client) OpenidBindQuery(param url.Values) (res *openidRes, err error) {
return openidBindQuery(param, c.req)
}
func (c *client) OpenidBindMap(param map[string]string) (res *openidRes, err error) {
return openidBindMap(param, c.req)
}
func (c *client) Api() Api {
return openApi(c.appKey, c.req)
}