-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathclient.go
52 lines (46 loc) · 932 Bytes
/
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
package serp
import (
"net/http"
)
type ApiCredentials struct {
Username string
Password string
}
type SerpClient struct {
HttpClient *http.Client
ApiCredentials *ApiCredentials
BaseUrl string
}
// Init for Sync runtime model.
func Init(
username string,
password string,
) *SerpClient {
return &SerpClient{
ApiCredentials: &ApiCredentials{
Username: username,
Password: password,
},
HttpClient: &http.Client{},
BaseUrl: "https://realtime.oxylabs.io/v1/queries",
}
}
type SerpClientAsync struct {
HttpClient *http.Client
ApiCredentials *ApiCredentials
BaseUrl string
}
// Init for Async runtime model.
func InitAsync(
username string,
password string,
) *SerpClientAsync {
return &SerpClientAsync{
ApiCredentials: &ApiCredentials{
Username: username,
Password: password,
},
HttpClient: &http.Client{},
BaseUrl: "https://data.oxylabs.io/v1/queries",
}
}