kloakd

package module
v0.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 10, 2026 License: MIT Imports: 12 Imported by: 0

README

kloakd-go

Official Go SDK for the KLOAKD API — the anti-bot intelligence platform.

Requirements

  • Go 1.21+
  • KLOAKD API key and organization ID

Installation

go get github.com/kloakd/kloakd-go

Quickstart

package main

import (
    "context"
    "fmt"
    "log"

    kloakd "github.com/kloakd/kloakd-go"
)

func main() {
    client, err := kloakd.New(kloakd.Config{
        APIKey:         "sk-live-...",
        OrganizationID: "your-org-uuid",
    })
    if err != nil {
        log.Fatal(err)
    }

    ctx := context.Background()

    // Anti-bot fetch
    fetch, err := client.Evadr.Fetch(ctx, "https://books.toscrape.com", nil)
    if err != nil {
        log.Fatal(err)
    }
    fmt.Printf("Fetched via tier %d\n", fetch.TierUsed)

    // Site crawl (reuse fetch artifact)
    crawl, err := client.Webgrph.Crawl(ctx, "https://books.toscrape.com", &kloakd.CrawlOptions{
        MaxDepth: 2,
        MaxPages: 50,
    })
    fmt.Printf("Found %d pages\n", crawl.TotalPages)

    // Extract structured data
    data, err := client.Kolektr.Page(ctx, "https://books.toscrape.com", &kloakd.PageOptions{
        Schema: map[string]interface{}{
            "title": "css:h3 a",
            "price": "css:p.price_color",
        },
    })
    fmt.Printf("Extracted %d records\n", data.TotalRecords)
}

Configuration

client, err := kloakd.New(kloakd.Config{
    APIKey:         "sk-live-...",   // required
    OrganizationID: "org-uuid",      // required
    BaseURL:        "https://api.kloakd.dev", // optional, default shown
    Timeout:        30 * time.Second,         // optional, default 30s
    MaxRetries:     3,                        // optional, default 3
    HTTPClient:     customHTTPClient,         // optional, for testing/proxies
})

Modules

client.Evadr — Anti-Bot Intelligence
// Fetch a URL through anti-bot bypass
result, err := client.Evadr.Fetch(ctx, url, nil)

// Async job
jobID, err := client.Evadr.FetchAsync(ctx, url, nil)

// SSE streaming
ch, err := client.Evadr.FetchStream(ctx, url, nil)
for event := range ch {
    fmt.Println(event.Type, event.Tier)
}

// Analyze anti-bot defenses
analysis, err := client.Evadr.Analyze(ctx, url, nil)
client.Webgrph — Site Mapping
// Crawl site hierarchy
crawl, err := client.Webgrph.Crawl(ctx, url, &kloakd.CrawlOptions{MaxDepth: 3, MaxPages: 100})

// Auto-paginate all pages
pages, err := client.Webgrph.CrawlAll(ctx, url, nil)

// SSE streaming
ch, err := client.Webgrph.CrawlStream(ctx, url, nil)
for event := range ch {
    fmt.Println(event.Type, event.URL)
}
client.Skanyr — API Discovery
result, err := client.Skanyr.Discover(ctx, url, nil)
endpoints, err := client.Skanyr.DiscoverAll(ctx, url, nil)

ch, err := client.Skanyr.DiscoverStream(ctx, url, nil)
for event := range ch {
    fmt.Println(event.Type, event.EndpointURL)
}
client.Nexus — Strategy Engine
perception, _ := client.Nexus.Analyze(ctx, url, nil)
strategy, _   := client.Nexus.Synthesize(ctx, perception.PerceptionID, nil)
verified, _   := client.Nexus.Verify(ctx, strategy.StrategyID)
result, _     := client.Nexus.Execute(ctx, strategy.StrategyID, url)
knowledge, _  := client.Nexus.Knowledge(ctx, result.ExecutionResultID)
client.Parlyr — Conversational NLP
parse, err := client.Parlyr.Parse(ctx, "scrape example.com", nil)

// Blocking chat (collects SSE internally)
turn, err := client.Parlyr.Chat(ctx, sessionID, "scrape example.com")

// SSE streaming
ch, err := client.Parlyr.ChatStream(ctx, sessionID, message)
for event := range ch {
    fmt.Println(event.Event, event.Data)
}
client.Fetchyr — RPA & Authentication
session, err := client.Fetchyr.Login(ctx, loginURL, "#user", "#pass", "u", "p", nil)
page, err    := client.Fetchyr.Fetch(ctx, protectedURL, *session.ArtifactID, nil)
client.Kolektr — Data Extraction
data, err := client.Kolektr.Page(ctx, url, &kloakd.PageOptions{
    Schema: map[string]interface{}{"title": "css:h1", "price": "css:.price"},
})

// Auto-paginate
records, err := client.Kolektr.PageAll(ctx, url, nil)

// From raw HTML
data, err = client.Kolektr.ExtractHTML(ctx, html, url, nil)

Error Handling

import "errors"

result, err := client.Evadr.Fetch(ctx, url, nil)
if err != nil {
    var rlErr *kloakd.RateLimitError
    var authErr *kloakd.AuthenticationError
    switch {
    case errors.As(err, &rlErr):
        time.Sleep(time.Duration(rlErr.RetryAfter) * time.Second)
    case errors.As(err, &authErr):
        log.Fatal("invalid API key")
    default:
        log.Printf("error: %v", err)
    }
}

Error types: KloakdError, AuthenticationError (401), NotEntitledError (403), RateLimitError (429), UpstreamError (502), ApiError (other 4xx/5xx).

Retry Policy

  • Retryable status codes: 429, 500, 502, 503, 504
  • Strategy: exponential backoff — 1s × 2^attempt, capped at 60s
  • 429: respects Retry-After header / retry_after body field
  • Non-retryable: 400, 401, 403, 404
  • Default max retries: 3 (override via Config.MaxRetries)

Running the Quickstart

export KLOAKD_API_KEY=sk-live-...
export KLOAKD_ORG_ID=your-org-uuid
go run ./examples/quickstart/main.go

Running Tests

go test . -v
go test . -cover

License

MIT

Documentation

Overview

Package kloakd provides the Go SDK for the KLOAKD API. Error hierarchy mirrors the design document §6.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AnalyzeOptions

type AnalyzeOptions struct {
	StatusCode  int
	Headers     map[string]string
	BodySnippet string
}

AnalyzeOptions configures optional parameters for Evadr.Analyze.

type AnalyzeResult

type AnalyzeResult struct {
	Blocked            bool
	Vendor             *string
	Confidence         float64
	RecommendedActions []string
}

AnalyzeResult is returned by Evadr.Analyze.

type ApiEndpoint

type ApiEndpoint struct {
	URL        string
	Method     string
	ApiType    string
	Confidence float64
	Parameters map[string]interface{}
}

ApiEndpoint represents a discovered API endpoint.

type ApiError

type ApiError struct {
	KloakdError
}

ApiError is returned for any other 4xx/5xx response.

func (*ApiError) Error

func (e *ApiError) Error() string

type AuthenticationError

type AuthenticationError struct {
	KloakdError
}

AuthenticationError is returned for HTTP 401 — invalid or expired API key.

func (*AuthenticationError) Error

func (e *AuthenticationError) Error() string

type ChatEvent

type ChatEvent struct {
	Event string
	Data  map[string]interface{}
}

ChatEvent is yielded by Parlyr.ChatStream.

type ChatTurn

type ChatTurn struct {
	SessionID           string
	Intent              string
	Confidence          float64
	Tier                int
	Response            string
	Entities            map[string]interface{}
	RequiresAction      bool
	ClarificationNeeded *string
}

ChatTurn is returned by Parlyr.Chat.

type Client

type Client struct {
	Evadr   *EvadrNamespace
	Webgrph *WebgrphNamespace
	Skanyr  *SkanyrNamespace
	Nexus   *NexusNamespace
	Parlyr  *ParlyrNamespace
	Fetchyr *FetchyrNamespace
	Kolektr *KolektrNamespace
	// contains filtered or unexported fields
}

Client is the KLOAKD SDK client. Create one with New().

client := kloakd.New(kloakd.Config{
    APIKey:         "sk-live-...",
    OrganizationID: "your-org-uuid",
})

func MustNew

func MustNew(cfg Config) *Client

MustNew is like New but panics on configuration error.

func New

func New(cfg Config) (*Client, error)

New creates a new KLOAKD client with the given configuration. Returns an error if APIKey or OrganizationID are missing.

type Config

type Config struct {
	// APIKey is the KLOAKD API key (required). Starts with "sk-".
	APIKey string

	// OrganizationID is the UUID of the organization (required).
	OrganizationID string

	// BaseURL overrides the API base URL. Defaults to https://api.kloakd.dev.
	BaseURL string

	// Timeout is the per-request timeout. Defaults to 30s.
	Timeout time.Duration

	// MaxRetries sets the number of retry attempts for retryable errors.
	// 0 means one attempt (no retries). Defaults to 3.
	MaxRetries int

	// HTTPClient allows injecting a custom *http.Client (e.g. for testing).
	HTTPClient *http.Client
}

Config holds all configuration for the KLOAKD client.

type CrawlEvent

type CrawlEvent struct {
	Type       string
	URL        *string
	Depth      *int
	PagesFound *int
	Metadata   map[string]interface{}
}

CrawlEvent is yielded by Webgrph.CrawlStream.

type CrawlOptions

type CrawlOptions struct {
	MaxDepth             int
	MaxPages             int
	IncludeExternalLinks bool
	SessionArtifactID    string
	Limit                int
	Offset               int
}

CrawlOptions configures optional parameters for Webgrph.Crawl.

type CrawlResult

type CrawlResult struct {
	Success         bool
	CrawlID         string
	URL             string
	TotalPages      int
	MaxDepthReached int
	Pages           []PageNode
	HasMore         bool
	Total           int
	ArtifactID      *string
	Error           *string
}

CrawlResult is returned by Webgrph.Crawl.

type CrawlStreamOptions

type CrawlStreamOptions struct {
	MaxDepth          int
	MaxPages          int
	SessionArtifactID string
}

CrawlStreamOptions configures optional parameters for Webgrph.CrawlStream.

type DeduplicationResult

type DeduplicationResult struct {
	UniqueRecords  []map[string]interface{}
	DuplicateCount int
	TotalInput     int
	Error          *string
}

DeduplicationResult is returned by Fetchyr.CheckDuplicates.

type DiscoverEvent

type DiscoverEvent struct {
	Type        string
	EndpointURL *string
	ApiType     *string
	Metadata    map[string]interface{}
}

DiscoverEvent is yielded by Skanyr.DiscoverStream.

type DiscoverOptions

type DiscoverOptions struct {
	SiteHierarchyArtifactID string
	MaxRequests             int
	SessionArtifactID       string
	Limit                   int
	Offset                  int
}

DiscoverOptions configures optional parameters for Skanyr.Discover.

type DiscoverResult

type DiscoverResult struct {
	Success        bool
	DiscoveryID    string
	URL            string
	TotalEndpoints int
	Endpoints      []ApiEndpoint
	HasMore        bool
	Total          int
	ArtifactID     *string
	Error          *string
}

DiscoverResult is returned by Skanyr.Discover.

type DiscoverStreamOptions

type DiscoverStreamOptions struct {
	SiteHierarchyArtifactID string
	MaxRequests             int
}

DiscoverStreamOptions configures optional parameters for Skanyr.DiscoverStream.

type EvadrNamespace

type EvadrNamespace struct {
	// contains filtered or unexported fields
}

EvadrNamespace exposes the Anti-Bot Intelligence module. Access via client.Evadr.

func (*EvadrNamespace) Analyze

func (e *EvadrNamespace) Analyze(ctx context.Context, targetURL string, opts *AnalyzeOptions) (*AnalyzeResult, error)

Analyze inspects the anti-bot defenses of the given URL.

func (*EvadrNamespace) Fetch

func (e *EvadrNamespace) Fetch(ctx context.Context, targetURL string, opts *FetchOptions) (*FetchResult, error)

Fetch performs an anti-bot fetch of the given URL.

func (*EvadrNamespace) FetchAsync

func (e *EvadrNamespace) FetchAsync(ctx context.Context, targetURL string, opts *FetchAsyncOptions) (string, error)

FetchAsync enqueues an anti-bot fetch job and returns the job ID.

func (*EvadrNamespace) FetchStream

func (e *EvadrNamespace) FetchStream(ctx context.Context, targetURL string, opts *FetchStreamOptions) (<-chan FetchEvent, error)

FetchStream opens a server-sent events stream for an anti-bot fetch operation. Returns a read-only channel of FetchEvent values. The channel is closed when the stream ends or ctx is cancelled.

func (*EvadrNamespace) StoreProxy

func (e *EvadrNamespace) StoreProxy(ctx context.Context, name, proxyURL string) error

StoreProxy registers a named proxy in the organization's proxy pool.

type ExecutionResult

type ExecutionResult struct {
	ExecutionID string
	WorkflowID  string
	Status      string
	StartedAt   *string
	CompletedAt *string
	Records     []map[string]interface{}
	Error       *string
}

ExecutionResult is returned by Fetchyr.ExecuteWorkflow / GetExecution.

type ExtractHTMLOptions

type ExtractHTMLOptions struct {
	Schema map[string]interface{}
}

ExtractHTMLOptions configures optional parameters for Kolektr.ExtractHTML.

type ExtractionResult

type ExtractionResult struct {
	Success      bool
	URL          string
	Method       string
	Records      []map[string]interface{}
	TotalRecords int
	PagesScraped int
	HasMore      bool
	Total        int
	ArtifactID   *string
	JobID        *string
	Error        *string
}

ExtractionResult is returned by Kolektr.Page and Kolektr.ExtractHTML.

type FetchAsyncOptions

type FetchAsyncOptions struct {
	ForceBrowser bool
	UseProxy     bool
	WebhookURL   string
}

FetchAsyncOptions configures optional parameters for Evadr.FetchAsync.

type FetchEvent

type FetchEvent struct {
	Type     string
	Tier     *int
	Vendor   *string
	Metadata map[string]interface{}
}

FetchEvent is yielded by Evadr.FetchStream.

type FetchOptions

type FetchOptions struct {
	ForceBrowser      bool
	UseProxy          bool
	SessionArtifactID string
}

FetchOptions configures optional parameters for Evadr.Fetch.

type FetchResult

type FetchResult struct {
	Success         bool
	URL             string
	StatusCode      int
	TierUsed        int
	HTML            *string
	VendorDetected  *string
	AntiBotBypassed bool
	ArtifactID      *string
	Error           *string
}

FetchResult is returned by Evadr.Fetch.

type FetchStreamOptions

type FetchStreamOptions struct {
	ForceBrowser bool
}

FetchStreamOptions configures optional parameters for Evadr.FetchStream.

type FetchyrFetchOptions

type FetchyrFetchOptions struct {
	WaitForSelector string
	ExtractHTML     bool
}

FetchyrFetchOptions configures optional parameters for Fetchyr.Fetch.

type FetchyrNamespace

type FetchyrNamespace struct {
	// contains filtered or unexported fields
}

FetchyrNamespace exposes the RPA & Authentication module. Access via client.Fetchyr.

func (*FetchyrNamespace) CheckDuplicates

func (f *FetchyrNamespace) CheckDuplicates(ctx context.Context, records []map[string]interface{}, domain string) (*DeduplicationResult, error)

CheckDuplicates deduplicates a list of records, optionally scoped to a domain.

func (*FetchyrNamespace) CreateWorkflow

func (f *FetchyrNamespace) CreateWorkflow(ctx context.Context, name string, steps []map[string]interface{}, targetURL string) (*WorkflowResult, error)

CreateWorkflow creates a new RPA workflow.

func (*FetchyrNamespace) DetectForms

func (f *FetchyrNamespace) DetectForms(ctx context.Context, targetURL string, sessionArtifactID string) (*FormDetectionResult, error)

DetectForms detects forms on a page.

func (*FetchyrNamespace) DetectMFA

func (f *FetchyrNamespace) DetectMFA(ctx context.Context, targetURL string, sessionArtifactID string) (*MfaDetectionResult, error)

DetectMFA detects MFA challenges on a page.

func (*FetchyrNamespace) ExecuteWorkflow

func (f *FetchyrNamespace) ExecuteWorkflow(ctx context.Context, workflowID string) (*ExecutionResult, error)

ExecuteWorkflow triggers execution of a workflow by ID.

func (*FetchyrNamespace) Fetch

func (f *FetchyrNamespace) Fetch(
	ctx context.Context,
	targetURL, sessionArtifactID string,
	opts *FetchyrFetchOptions,
) (*FetchyrResult, error)

Fetch performs an authenticated fetch within an existing session.

func (*FetchyrNamespace) GetExecution

func (f *FetchyrNamespace) GetExecution(ctx context.Context, workflowID, executionID string) (*ExecutionResult, error)

GetExecution retrieves the result of a workflow execution.

func (*FetchyrNamespace) Login

func (f *FetchyrNamespace) Login(
	ctx context.Context,
	targetURL, usernameSelector, passwordSelector, username, password string,
	opts *LoginOptions,
) (*SessionResult, error)

Login performs an automated login and returns an authenticated session artifact.

func (*FetchyrNamespace) SubmitMFA

func (f *FetchyrNamespace) SubmitMFA(ctx context.Context, challengeID, code string) (*MfaResult, error)

SubmitMFA submits an MFA code for the given challenge ID.

type FetchyrResult

type FetchyrResult struct {
	Success           bool
	URL               string
	StatusCode        int
	HTML              *string
	ArtifactID        *string
	SessionArtifactID string
	Error             *string
}

FetchyrResult is returned by Fetchyr.Fetch.

type FormDetectionResult

type FormDetectionResult struct {
	Forms      []map[string]interface{}
	TotalForms int
	Error      *string
}

FormDetectionResult is returned by Fetchyr.DetectForms.

type KloakdError

type KloakdError struct {
	StatusCode int
	Message    string
}

KloakdError is the base error type for all SDK errors. Every error carries StatusCode and Message.

func (*KloakdError) Error

func (e *KloakdError) Error() string

type KolektrNamespace

type KolektrNamespace struct {
	// contains filtered or unexported fields
}

KolektrNamespace exposes the Data Extraction module. Access via client.Kolektr.

func (*KolektrNamespace) ExtractHTML

func (k *KolektrNamespace) ExtractHTML(ctx context.Context, html, targetURL string, opts *ExtractHTMLOptions) (*ExtractionResult, error)

ExtractHTML extracts structured data from raw HTML without making a network request.

func (*KolektrNamespace) Page

func (k *KolektrNamespace) Page(ctx context.Context, targetURL string, opts *PageOptions) (*ExtractionResult, error)

Page extracts structured data from a URL using the full Kolektr pipeline.

func (*KolektrNamespace) PageAll

func (k *KolektrNamespace) PageAll(ctx context.Context, targetURL string, opts *PageOptions) ([]map[string]interface{}, error)

PageAll auto-paginates until all records are retrieved.

type LoginOptions

type LoginOptions struct {
	SubmitSelector     string
	SuccessURLContains string
}

LoginOptions configures optional parameters for Fetchyr.Login.

type MfaDetectionResult

type MfaDetectionResult struct {
	MfaDetected bool
	ChallengeID *string
	MfaType     *string
	Error       *string
}

MfaDetectionResult is returned by Fetchyr.DetectMFA.

type MfaResult

type MfaResult struct {
	Success           bool
	SessionArtifactID *string
	Error             *string
}

MfaResult is returned by Fetchyr.SubmitMFA.

type NexusAnalyzeOptions

type NexusAnalyzeOptions struct {
	HTML        string
	Constraints map[string]interface{}
}

NexusAnalyzeOptions configures optional parameters for Nexus.Analyze.

type NexusAnalyzeResult

type NexusAnalyzeResult struct {
	PerceptionID    string
	Strategy        map[string]interface{}
	PageType        string
	ComplexityLevel string
	ArtifactID      *string
	DurationMs      int
	Error           *string
}

NexusAnalyzeResult is returned by Nexus.Analyze.

type NexusExecuteResult

type NexusExecuteResult struct {
	ExecutionResultID string
	Success           bool
	Records           []map[string]interface{}
	ArtifactID        *string
	DurationMs        int
	Error             *string
}

NexusExecuteResult is returned by Nexus.Execute.

type NexusKnowledgeResult

type NexusKnowledgeResult struct {
	LearnedConcepts []map[string]interface{}
	LearnedPatterns []map[string]interface{}
	DurationMs      int
	Error           *string
}

NexusKnowledgeResult is returned by Nexus.Knowledge.

type NexusNamespace

type NexusNamespace struct {
	// contains filtered or unexported fields
}

NexusNamespace exposes the Strategy Engine module (5-layer cognitive pipeline). Access via client.Nexus.

func (*NexusNamespace) Analyze

func (n *NexusNamespace) Analyze(ctx context.Context, targetURL string, opts *NexusAnalyzeOptions) (*NexusAnalyzeResult, error)

Analyze analyzes a URL using the Nexus perception layer.

func (*NexusNamespace) Execute

func (n *NexusNamespace) Execute(ctx context.Context, strategyID, targetURL string) (*NexusExecuteResult, error)

Execute runs a verified strategy against a URL.

func (*NexusNamespace) Knowledge

func (n *NexusNamespace) Knowledge(ctx context.Context, executionResultID string) (*NexusKnowledgeResult, error)

Knowledge stores learned concepts and patterns from an execution result.

func (*NexusNamespace) Synthesize

func (n *NexusNamespace) Synthesize(ctx context.Context, perceptionID string, opts *NexusSynthesizeOptions) (*NexusSynthesisResult, error)

Synthesize generates a scraping strategy from a perception ID.

func (*NexusNamespace) Verify

func (n *NexusNamespace) Verify(ctx context.Context, strategyID string) (*NexusVerifyResult, error)

Verify verifies the safety of a strategy before execution.

type NexusSynthesisResult

type NexusSynthesisResult struct {
	StrategyID      string
	StrategyName    string
	GeneratedCode   string
	ArtifactID      *string
	SynthesisTimeMs int
	Error           *string
}

NexusSynthesisResult is returned by Nexus.Synthesize.

type NexusSynthesizeOptions

type NexusSynthesizeOptions struct {
	Strategy string
	Timeout  int
}

NexusSynthesizeOptions configures optional parameters for Nexus.Synthesize.

type NexusVerifyResult

type NexusVerifyResult struct {
	VerificationResultID string
	IsSafe               bool
	RiskScore            float64
	SafetyScore          float64
	Violations           []string
	DurationMs           int
	Error                *string
}

NexusVerifyResult is returned by Nexus.Verify.

type NotEntitledError

type NotEntitledError struct {
	KloakdError
	Module     string
	UpgradeURL string
}

NotEntitledError is returned for HTTP 403 — tenant not on required plan.

func (*NotEntitledError) Error

func (e *NotEntitledError) Error() string

type PageNode

type PageNode struct {
	URL        string
	Depth      int
	Title      *string
	StatusCode *int
	Children   []string
}

PageNode represents a single page in the site hierarchy.

type PageOptions

type PageOptions struct {
	Schema            map[string]interface{}
	FetchArtifactID   string
	SessionArtifactID string
	ApiMapArtifactID  string
	Limit             int
	Offset            int
}

PageOptions configures optional parameters for Kolektr.Page.

type ParlyrNamespace

type ParlyrNamespace struct {
	// contains filtered or unexported fields
}

ParlyrNamespace exposes the Conversational NLP module. Access via client.Parlyr.

func (*ParlyrNamespace) Chat

func (p *ParlyrNamespace) Chat(ctx context.Context, sessionID, message string) (*ChatTurn, error)

Chat sends a message to a conversation session and blocks until the full response is collected from the SSE stream.

func (*ParlyrNamespace) ChatStream

func (p *ParlyrNamespace) ChatStream(ctx context.Context, sessionID, message string) (<-chan ChatEvent, error)

ChatStream opens an SSE stream for a conversation turn. Returns a read-only channel of ChatEvent values.

func (*ParlyrNamespace) DeleteSession

func (p *ParlyrNamespace) DeleteSession(ctx context.Context, sessionID string) error

DeleteSession removes a conversation session.

func (*ParlyrNamespace) Parse

func (p *ParlyrNamespace) Parse(ctx context.Context, message string, opts *ParseOptions) (*ParseResult, error)

Parse interprets a natural language message.

type ParseOptions

type ParseOptions struct {
	SessionID string
}

ParseOptions configures optional parameters for Parlyr.Parse.

type ParseResult

type ParseResult struct {
	Intent              string
	Confidence          float64
	Tier                int
	Source              string
	Entities            map[string]interface{}
	RequiresAction      bool
	ClarificationNeeded *string
	Reasoning           *string
	DetectedURL         *string
}

ParseResult is returned by Parlyr.Parse.

type RateLimitError

type RateLimitError struct {
	KloakdError
	RetryAfter int    // seconds
	ResetAt    string // ISO timestamp
}

RateLimitError is returned for HTTP 429 — quota exceeded.

func (*RateLimitError) Error

func (e *RateLimitError) Error() string

type SessionResult

type SessionResult struct {
	Success       bool
	SessionID     string
	URL           string
	ArtifactID    *string
	ScreenshotURL *string
	Error         *string
}

SessionResult is returned by Fetchyr.Login.

type SkanyrNamespace

type SkanyrNamespace struct {
	// contains filtered or unexported fields
}

SkanyrNamespace exposes the API Discovery module. Access via client.Skanyr.

func (*SkanyrNamespace) Discover

func (s *SkanyrNamespace) Discover(ctx context.Context, targetURL string, opts *DiscoverOptions) (*DiscoverResult, error)

Discover discovers API endpoints on the given URL.

func (*SkanyrNamespace) DiscoverAll

func (s *SkanyrNamespace) DiscoverAll(ctx context.Context, targetURL string, opts *DiscoverOptions) ([]ApiEndpoint, error)

DiscoverAll auto-paginates until all endpoints are retrieved.

func (*SkanyrNamespace) DiscoverStream

func (s *SkanyrNamespace) DiscoverStream(ctx context.Context, targetURL string, opts *DiscoverStreamOptions) (<-chan DiscoverEvent, error)

DiscoverStream opens a server-sent events stream for the API discovery operation. Returns a read-only channel of DiscoverEvent values.

func (*SkanyrNamespace) GetApiMap

func (s *SkanyrNamespace) GetApiMap(ctx context.Context, artifactID string) (map[string]interface{}, error)

GetApiMap retrieves a stored API map artifact by ID.

func (*SkanyrNamespace) GetJob

func (s *SkanyrNamespace) GetJob(ctx context.Context, jobID string) (map[string]interface{}, error)

GetJob retrieves the status of a discovery job by ID.

type UpstreamError

type UpstreamError struct {
	KloakdError
}

UpstreamError is returned for HTTP 502 — upstream site fetch failed.

func (*UpstreamError) Error

func (e *UpstreamError) Error() string

type WebgrphNamespace

type WebgrphNamespace struct {
	// contains filtered or unexported fields
}

WebgrphNamespace exposes the Site Mapping & Discovery module. Access via client.Webgrph.

func (*WebgrphNamespace) Crawl

func (w *WebgrphNamespace) Crawl(ctx context.Context, targetURL string, opts *CrawlOptions) (*CrawlResult, error)

Crawl performs a site crawl and returns the hierarchy result.

func (*WebgrphNamespace) CrawlAll

func (w *WebgrphNamespace) CrawlAll(ctx context.Context, targetURL string, opts *CrawlOptions) ([]PageNode, error)

CrawlAll auto-paginates until all pages are retrieved.

func (*WebgrphNamespace) CrawlStream

func (w *WebgrphNamespace) CrawlStream(ctx context.Context, targetURL string, opts *CrawlStreamOptions) (<-chan CrawlEvent, error)

CrawlStream opens a server-sent events stream for the crawl operation. Returns a read-only channel of CrawlEvent values.

func (*WebgrphNamespace) GetHierarchy

func (w *WebgrphNamespace) GetHierarchy(ctx context.Context, artifactID string) (map[string]interface{}, error)

GetHierarchy retrieves a stored site hierarchy artifact by ID.

func (*WebgrphNamespace) GetJob

func (w *WebgrphNamespace) GetJob(ctx context.Context, jobID string) (map[string]interface{}, error)

GetJob retrieves the status of a crawl job by ID.

type WorkflowResult

type WorkflowResult struct {
	WorkflowID string
	Name       string
	Steps      []map[string]interface{}
	URL        *string
	CreatedAt  string
	Error      *string
}

WorkflowResult is returned by Fetchyr.CreateWorkflow.

Directories

Path Synopsis
examples
quickstart command
Quickstart: Discover and extract from a site in ~10 lines.
Quickstart: Discover and extract from a site in ~10 lines.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL