Documentation
¶
Index ¶
- Constants
- type Client
- func (c *Client) Get(ctx context.Context, url string, params map[string]any) (*Response, error)
- func (c *Client) Post(ctx context.Context, url string, postData string, params map[string]any) (*Response, error)
- func (c *Client) RequestGet(ctx context.Context, url string, params map[string]any) (*Response, error)
- func (c *Client) RequestPost(ctx context.Context, url string, postData string, params map[string]any) (*Response, error)
- func (c *Client) SessionsCreate(ctx context.Context, session string, params map[string]any) error
- func (c *Client) SessionsDestroy(ctx context.Context, session string) error
- func (c *Client) SessionsList(ctx context.Context) ([]string, error)
- func (c *Client) Submit(ctx context.Context, cmd string, params map[string]any) (*Response, error)
- type Cmd
- type Cookie
- type Cookies
- type Param
- type RespBase
- type Response
- type Solution
Constants ¶
View Source
const RESP_STATUS_OK = "ok"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
Endpoint string
}
func (*Client) RequestGet ¶
func (c *Client) RequestGet(ctx context.Context, url string, params map[string]any) (*Response, error)
params:
(*)url
session
session_ttl_minutes
maxTimeout: 60000
cookies: [{"name": "cookie1", "value": "value1"}, {"name": "cookie2", "value": "value2"}]
returnOnlyCookies: false
returnScreenshot: false
proxy: {"url": "http://127.0.0.1:7890", "username": "testuser", "password": "testpass"}
waitInSeconds: 0 // Useful to allow it to load dynamic content.
func (*Client) RequestPost ¶
func (c *Client) RequestPost(ctx context.Context, url string, postData string, params map[string]any) (*Response, error)
params:
(*)url postData: "a=b&c=d" // application/x-www-form-urlencoded // other params same as [Client.RequestGet]
func (*Client) SessionsCreate ¶
params:
(*)session
proxy: {"url": "http://127.0.0.1:7890", "username": "testuser", "password": "testpass"}
type Cookie ¶
type Cookie struct {
Name string `json:"name"`
Value string `json:"value"`
Path string `json:"path"`
Domain string `json:"domain"`
Expiry int64 `json:"expiry"`
Secure bool `json:"secure"`
HttpOnly bool `json:"httpOnly"`
SameSite string `json:"sameSite"`
}
func (*Cookie) ToHttpCookie ¶
type Param ¶
type Param = string
const ( PARAM_CMD Param = "cmd" // [CMD_REQUEST_GET] | [CMD_REQUEST_POST] ... PARAM_URL Param = "url" PARAM_SESSION Param = "session" PARAM_SESSION_TTL_MINUTES Param = "session_ttl_minutes" // int PARAM_MAX_TIMEOUT Param = "maxTimeout" // int PARAM_COOKIES Param = "cookies" PARAM_RETURN_ONLY_COOKIES Param = "returnOnlyCookies" // bool PARAM_RETURN_SCREENSHOT Param = "returnScreenshot" // bool PARAM_PROXY Param = "proxy" PARAM_WAIT_IN_SECONDS Param = "waitInSeconds" // int PARAM_POST_DATA Param = "postData" // string // application/x-www-form-urlencoded )
Click to show internal directories.
Click to hide internal directories.