| 123456789101112131415161718192021222324252627282930313233343536 |
- package client
- import (
- "crypto/tls"
- "github.com/go-resty/resty/v2"
- "time"
- )
- type Client struct {
- restyClient *resty.Client
- baseUrl string
- token string
- options *Options
- }
- func NewClient(baseUrl string, token string, opts ...Option) *Client {
- options := new(Options)
- for _, opt := range opts {
- opt(options)
- }
- restyClient := resty.New().
- SetTLSClientConfig(&tls.Config{InsecureSkipVerify: true}).
- SetTimeout(time.Duration(options.timeoutSec) * time.Second).
- SetBaseURL(baseUrl)
- return &Client{
- restyClient: restyClient,
- baseUrl: baseUrl,
- token: token,
- options: options,
- }
- }
|