2024-10-10 15:05:46 +00:00
|
|
|
package x3_client
|
|
|
|
|
|
|
|
import (
|
|
|
|
"net/http"
|
|
|
|
"net/http/cookiejar"
|
|
|
|
)
|
|
|
|
|
|
|
|
type X3Client struct {
|
2024-10-10 17:25:05 +00:00
|
|
|
basePath string
|
2024-10-10 15:05:46 +00:00
|
|
|
|
|
|
|
httpClient *http.Client
|
|
|
|
}
|
|
|
|
|
2024-10-10 17:25:05 +00:00
|
|
|
func NewX3Client(basePath string) (*X3Client, error) {
|
2024-10-10 15:05:46 +00:00
|
|
|
jar, err := cookiejar.New(nil)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
|
|
|
|
return &X3Client{
|
2024-10-10 17:25:05 +00:00
|
|
|
basePath: basePath,
|
2024-10-10 15:05:46 +00:00
|
|
|
|
|
|
|
httpClient: &http.Client{
|
|
|
|
Jar: jar,
|
|
|
|
},
|
|
|
|
}, nil
|
|
|
|
}
|