Documentation
ΒΆ
Index ΒΆ
- Constants
- type APIError
- type Client
- func (c *Client) CreateTask(task Task) (string, error)
- func (c *Client) GetBalance() (float64, error)
- func (c *Client) GetPricing() ([]PricingItem, error)
- func (c *Client) GetTaskResult(taskID string) (*TaskResult, error)
- func (c *Client) SetBaseURL(baseURL string)
- func (c *Client) SetDeveloperKey(key string)
- func (c *Client) Solve(task Task, timeout int) (map[string]interface{}, error)
- type CreateTaskRequest
- type CreateTaskResponse
- type ErrAuthentication
- type ErrGateway
- type ErrInsufficientBalance
- type ErrInternal
- type ErrNetwork
- type ErrParse
- type ErrRateLimit
- type ErrServer
- type ErrSolver
- type ErrTaskNotFound
- type ErrTimeout
- type ErrValidation
- type GetBalanceRequest
- type GetBalanceResponse
- type GetTaskResultRequest
- type PricingItem
- type PricingResponse
- type Task
- type TaskResult
Constants ΒΆ
const ( // AWS WAF task types TaskTypeAntiAwsWaf = "AntiAwsWafTask" TaskTypeAntiAwsWafProxyLess = "AntiAwsWafTaskProxyLess" // reCAPTCHA v2 task types TaskTypeReCaptchaV2 = "ReCaptchaV2Task" TaskTypeReCaptchaV2ProxyLess = "ReCaptchaV2TaskProxyLess" // reCAPTCHA v3 task types TaskTypeReCaptchaV3 = "ReCaptchaV3Task" TaskTypeReCaptchaV3ProxyLess = "ReCaptchaV3TaskProxyLess" // reCAPTCHA v3 Enterprise task types TaskTypeReCaptchaV3Enterprise = "ReCaptchaV3EnterpriseTask" TaskTypeReCaptchaV3EnterpriseProxyLess = "ReCaptchaV3EnterpriseTaskProxyLess" )
Task type constants for CapBypass API.
Variables ΒΆ
This section is empty.
Functions ΒΆ
This section is empty.
Types ΒΆ
type APIError ΒΆ
type APIError struct {
ErrorID int `json:"errorId,omitempty"`
ErrorCode string `json:"errorCode,omitempty"`
ErrorDescription string `json:"errorDescription,omitempty"`
}
APIError represents a CapBypass API error with Capsolver-compatible structure.
type Client ΒΆ
type Client struct {
// contains filtered or unexported fields
}
Client is the CapBypass API client.
func NewClient ΒΆ
NewClient creates a new CapBypass client. If apiKey is empty, it will be read from CAPBYPASS_API_KEY environment variable.
func (*Client) CreateTask ΒΆ
CreateTask creates a new CAPTCHA solving task.
func (*Client) GetBalance ΒΆ
GetBalance retrieves the account balance.
func (*Client) GetPricing ΒΆ added in v1.0.1
func (c *Client) GetPricing() ([]PricingItem, error)
GetPricing retrieves pricing for all task types. This is a public endpoint and does not require authentication.
func (*Client) GetTaskResult ΒΆ
func (c *Client) GetTaskResult(taskID string) (*TaskResult, error)
GetTaskResult retrieves the result of a task.
func (*Client) SetBaseURL ΒΆ
SetBaseURL sets a custom base URL for the API.
func (*Client) SetDeveloperKey ΒΆ added in v1.0.1
SetDeveloperKey sets the developer affiliate key for commission attribution. Can also be set via CAPBYPASS_DEVELOPER_KEY environment variable.
type CreateTaskRequest ΒΆ
type CreateTaskRequest struct {
ClientKey string `json:"clientKey"`
Task Task `json:"task"`
DeveloperKey string `json:"developerKey,omitempty"`
}
CreateTaskRequest represents the request for createTask.
type CreateTaskResponse ΒΆ
type CreateTaskResponse struct {
ErrorID int `json:"errorId"`
ErrorCode string `json:"errorCode,omitempty"`
ErrorDescription string `json:"errorDescription,omitempty"`
TaskID string `json:"taskId,omitempty"`
}
CreateTaskResponse represents the response from createTask.
type ErrAuthentication ΒΆ
type ErrAuthentication struct {
APIError
}
ErrAuthentication indicates invalid API key.
type ErrGateway ΒΆ
ErrGateway indicates a gateway error (HTTP 502/503/504).
func (*ErrGateway) Error ΒΆ
func (e *ErrGateway) Error() string
type ErrInsufficientBalance ΒΆ
type ErrInsufficientBalance struct {
APIError
}
ErrInsufficientBalance indicates zero or insufficient account balance.
type ErrInternal ΒΆ
type ErrInternal struct {
APIError
}
ErrInternal indicates an internal server error.
type ErrNetwork ΒΆ
ErrNetwork indicates a network connection error.
func (*ErrNetwork) Error ΒΆ
func (e *ErrNetwork) Error() string
func (*ErrNetwork) Unwrap ΒΆ
func (e *ErrNetwork) Unwrap() error
type ErrRateLimit ΒΆ
type ErrRateLimit struct {
Message string
}
ErrRateLimit indicates rate limiting (HTTP 429).
func (*ErrRateLimit) Error ΒΆ
func (e *ErrRateLimit) Error() string
type ErrSolver ΒΆ
type ErrSolver struct {
APIError
}
ErrSolver indicates the CAPTCHA could not be solved.
type ErrTaskNotFound ΒΆ
type ErrTaskNotFound struct {
APIError
}
ErrTaskNotFound indicates the task ID does not exist.
type ErrTimeout ΒΆ
type ErrTimeout struct {
APIError
}
ErrTimeout indicates the solve operation exceeded the timeout.
type ErrValidation ΒΆ
type ErrValidation struct {
APIError
}
ErrValidation indicates invalid task data or parameters.
type GetBalanceRequest ΒΆ
type GetBalanceRequest struct {
ClientKey string `json:"clientKey"`
}
GetBalanceRequest represents the request for getBalance.
type GetBalanceResponse ΒΆ
type GetBalanceResponse struct {
ErrorID int `json:"errorId"`
ErrorCode string `json:"errorCode,omitempty"`
ErrorDescription string `json:"errorDescription,omitempty"`
Balance float64 `json:"balance,omitempty"`
}
GetBalanceResponse represents the response from getBalance.
type GetTaskResultRequest ΒΆ
type GetTaskResultRequest struct {
ClientKey string `json:"clientKey"`
TaskID string `json:"taskId"`
}
GetTaskResultRequest represents the request for getTaskResult.
type PricingItem ΒΆ added in v1.0.1
type PricingItem struct {
TaskType string `json:"task_type"`
UserCost float64 `json:"user_cost"`
Status string `json:"status"`
}
PricingItem represents pricing for a single task type.
type PricingResponse ΒΆ added in v1.0.1
type PricingResponse struct {
Pricing []PricingItem `json:"pricing"`
}
PricingResponse represents the response from GET /pricing.
type TaskResult ΒΆ
type TaskResult struct {
ErrorID int `json:"errorId"`
ErrorCode string `json:"errorCode,omitempty"`
ErrorDescription string `json:"errorDescription,omitempty"`
Status string `json:"status,omitempty"`
Solution map[string]interface{} `json:"solution,omitempty"`
}
TaskResult represents the response from getTaskResult.