crawlsnap

package module
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2026 License: MIT Imports: 17 Imported by: 0

README

CrawlSnap Go SDK

Official Go client for the CrawlSnap data intelligence platform. Typed responses, typed errors, automatic retries, and per-product API versioning.

Install

go get github.com/crawlsnap/crawlsnap-go

Requires Go 1.23+ (the paginator uses range-over-func).

Authentication

Get an API key from your dashboard and pass it to NewClient, or set CRAWLSNAP_API_KEY and pass an empty string.

client, err := crawlsnap.NewClient("sk-cs-...")   // or NewClient("") with the env var
if err != nil {
    log.Fatal(err)
}

Quick start

package main

import (
    "context"
    "fmt"
    "log"

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

func main() {
    client, err := crawlsnap.NewClient("")
    if err != nil {
        log.Fatal(err)
    }

    ip, err := client.VectorSnap.IP(context.Background(), "8.8.8.8")
    if err != nil {
        log.Fatal(err)
    }
    fmt.Println(ip.GetReputation(), ip.GetAsOwner())
}

Every call returns the unwrapped, typed payload on success and a typed error otherwise — you never inspect the response envelope yourself.

Resources

Call Returns
client.VectorSnap.URL(ctx, q) reputation enrichment for a URL
client.VectorSnap.Hash(ctx, q) reputation enrichment for a file hash
client.VectorSnap.IP(ctx, q) reputation enrichment for an IP
client.VectorSnap.Domain(ctx, q) reputation enrichment for a domain
client.PulseSnap.URL / Hash / IP / Domain(ctx, q) threat-intelligence pulse enrichment
client.SubdoSnap.Scan(ctx, q) one page of subdomains
client.SubdoSnap.ScanIter(ctx, q) every subdomain across all pages
client.SportSnap.Livescores(ctx) live-score board with in-match events
client.SportSnap.Matches(ctx, isoCode) fixtures grouped by competition
client.SportSnap.MatchesExtended(ctx, isoCode, ts) extended fixtures + translations
client.SportSnap.Match(ctx, id) full match view (lineups, events, stats, broadcasts)
client.SportSnap.MatchStats / MatchCommentaries / MatchChannels(ctx, id, …) match view variants
client.SportSnap.Competitions(ctx, isoCode) competition catalog
client.SportSnap.Competition(ctx, country, slug) competition detail (fixtures, tables, scorers)
client.SportSnap.CompetitionTables / TvRights / Twitter(ctx, country, slug) standings, TV rights, social
client.SportSnap.PopularTeams / AllTeams(ctx) popular teams, national-team catalog
client.SportSnap.NationalTeam(ctx, slug) / ClubTeam(ctx, country, team) team detail
client.SportSnap.AllChannels / Channels(ctx, isoCode) TV channel directories
client.SportSnap.ChannelInfo / ChannelRepeats(ctx, slug, isoCode) channel metadata + schedule
client.SportSnap.News(ctx, start, isoCode) news feed
client.SportSnap.NewsByTag(ctx, tag, start) / NewsArticle(ctx, id) tagged news, single article
client.SportSnap.CompetitionNews / NationalTeamNews / ClubTeamNews(ctx, …, start) entity news
client.SportSnap.SearchAll / SearchTeams / SearchCompetitions / SearchMatches / SearchPlayers(ctx, q) full-text search
client.SportSnap.PopularSearches(ctx) popular searches
client.SportSnap.Player(ctx, slug, id) player profile + per-season stats

SportSnap covers football (soccer) data: live scores, fixtures, match detail, competitions, teams, TV channels, news, search, and player profiles. iso_code is a two-letter region code that resolves region-specific broadcast channels — pass "" for the server default. Path segments (competition country/slug, team country/team, player slug/id) and match ids come from the url and fixture_id fields in list, search, and detail payloads.

Errors

Failures return typed errors discoverable with errors.As:

ip, err := client.VectorSnap.IP(ctx, "8.8.8.8")
if err != nil {
    var nf *crawlsnap.NotFoundError
    switch {
    case errors.As(err, &nf):
        // no data for this indicator
    default:
        var status *crawlsnap.APIStatusError // any HTTP status error
        if errors.As(err, &status) {
            log.Printf("status=%d request_id=%s", status.StatusCode, status.RequestID)
        }
    }
}
Type Status Meaning
BadRequestError 400 invalid indicator
AuthenticationError 401 missing / invalid key
QuotaExceededError 402 out of credits or monthly quota
SubscriptionInactiveError 403 subscription not active
NotFoundError 404 no data for the indicator
RateLimitError 429 request limit (carries RetryAfter)
ServerError 5xx server / upstream failure
APIConnectionError transport failure (DNS / connection / TLS)
APITimeoutError request timed out (also an APIConnectionError)

APIStatusError matches any status error; the CrawlSnapError interface matches anything the SDK returns.

Pagination

ScanIter follows the cursor for you. Range over it with Go 1.23+:

for sub, err := range client.SubdoSnap.ScanIter(ctx, "example.com") {
    if err != nil {
        log.Fatal(err)
    }
    fmt.Println(sub["subdomain"])
}

For manual paging, use Scan then ScanWithCursor with the returned Cursor.

API versioning

Each product is versioned independently. A direct call uses that product's stable default version (crawlsnap.DefaultVersion), which never moves on its own when you upgrade the SDK. Pin one product to a specific version without affecting the others:

client.VectorSnap.IP(ctx, "8.8.8.8")        // stable default version
client.VectorSnap.V1().IP(ctx, "8.8.8.8")   // explicitly VectorSnap v1
client.PulseSnap.Domain(ctx, "example.com") // unaffected — PulseSnap default

Configuration

client, err := crawlsnap.NewClient("sk-cs-...",
    crawlsnap.WithBaseURL("https://api.crawlsnap.com"), // or $CRAWLSNAP_BASE_URL
    crawlsnap.WithTimeout(30*time.Second),
    crawlsnap.WithMaxRetries(3),                        // 429 / 5xx / connection
    crawlsnap.WithHTTPClient(myHTTPClient),             // advanced
)

Retries use exponential backoff with jitter and honor the Retry-After header on 429s.

Raw response

Capture the full envelope (status, headers, request id) alongside the typed return:

var raw crawlsnap.RawResponse
ip, err := client.VectorSnap.IP(ctx, "8.8.8.8", crawlsnap.WithRawResponse(&raw))
// raw.StatusCode, raw.RequestID, raw.Headers, raw.IsSuccess, raw.Data

Development

The typed models in models/ are generated from the public OpenAPI contract; the facade is hand-written. Regenerate the models after a contract change:

./scripts/regenerate.sh   # re-bundles the contract and regenerates models/ only
go test ./...

Releasing

Releases are git tags — pushing a vX.Y.Z tag publishes the module to the Go proxy (no separate registry upload). Use the helper:

./scripts/release.sh 0.2.0   # bumps version.go, runs checks, commits, tags, pushes, gh release

Tags are immutable: to fix a bad release, cut a new patch. A v2+ release additionally requires the /v2 module-path suffix in go.mod.

License

MIT

Documentation

Overview

Package crawlsnap is the official Go client for the CrawlSnap data intelligence platform.

client, err := crawlsnap.NewClient("sk-cs-...")   // or set CRAWLSNAP_API_KEY
if err != nil { log.Fatal(err) }

ip, err := client.VectorSnap.IP(ctx, "8.8.8.8")
if err != nil { log.Fatal(err) }
fmt.Println(ip.GetReputation(), ip.GetAsOwner())

Every call returns the unwrapped, typed payload on success and a typed error otherwise (see errors.go) — the caller never inspects the response envelope.

Package crawlsnap — error types.

Hierarchy (mirrors the other CrawlSnap SDKs):

CrawlSnapError                      marker interface for everything the SDK returns
├── ConfigError                     misconfiguration (e.g. missing API key)
├── DecodeError                     a 2xx body could not be decoded
├── APIConnectionError              transport failed (no HTTP response)
│   └── APITimeoutError             the request timed out
└── APIStatusError                  the API returned a non-success status
    ├── BadRequestError             400  invalid input
    ├── AuthenticationError         401  missing / invalid API key
    ├── QuotaExceededError          402  out of credits / monthly quota
    ├── SubscriptionInactiveError   403  subscription not active
    ├── NotFoundError               404  no data for the indicator
    ├── RateLimitError              429  request limit exceeded
    └── ServerError                 5xx  server / upstream failure

Discover the concrete type with errors.As:

if _, err := client.VectorSnap.IP(ctx, "8.8.8.8"); err != nil {
    var nf *crawlsnap.NotFoundError
    if errors.As(err, &nf) { /* no data for this indicator */ }

    var status *crawlsnap.APIStatusError   // catches any HTTP status error
    if errors.As(err, &status) { log.Println(status.StatusCode, status.RequestID) }

    var any crawlsnap.CrawlSnapError       // catches anything the SDK returns
    if errors.As(err, &any) { /* ... */ }
}

Index

Constants

View Source
const (
	DefaultBaseURL    = "https://api.crawlsnap.com"
	DefaultTimeout    = 30 * time.Second
	DefaultMaxRetries = 2
)

Defaults for client configuration.

View Source
const DefaultVersion = "v1"

DefaultVersion is the stable, per-release default API version used by unpinned calls. It does not move on its own: upgrading the SDK never silently retargets your calls at a newer API version. Promoting a product's default to a new version is a deliberate, changelogged release change.

Pin a single product to a specific version with its version accessor (e.g. VectorSnap.V1()) — this affects only that product, leaving the others on their own defaults.

View Source
const Version = "0.5.0"

Version is the SDK release version, sent in the User-Agent header.

Variables

View Source
var ErrNoAPIKey = &ConfigError{Message: "no API key provided: pass it to NewClient or set CRAWLSNAP_API_KEY"}

ErrNoAPIKey is returned by NewClient when no API key is supplied and CRAWLSNAP_API_KEY is unset.

Functions

This section is empty.

Types

type APIConnectionError

type APIConnectionError struct {
	Message string
	Err     error
}

APIConnectionError is returned when the request never reached the API (DNS, connection refused, TLS, ...). Unwrap to inspect the underlying cause.

func (*APIConnectionError) As

func (e *APIConnectionError) As(target any) bool

As lets errors.As extract the embedded *APIConnectionError from *APITimeoutError.

func (*APIConnectionError) Error

func (e *APIConnectionError) Error() string

func (*APIConnectionError) Unwrap

func (e *APIConnectionError) Unwrap() error

type APIStatusError

type APIStatusError struct {
	// StatusCode is the effective HTTP status (the body response_code when it
	// disagrees with and supersedes the transport status).
	StatusCode int
	// Message is the human-readable error from the response envelope.
	Message string
	// RequestID is the x-request-id response header, useful for support.
	RequestID string
	// Body is the raw response body (the BaseResponse envelope), when available.
	Body []byte
}

APIStatusError is the base error for any non-success HTTP status. The seven status-specific types embed it; errors.As(err, &(*APIStatusError)(nil)) on any of them yields this base value.

func (*APIStatusError) As

func (e *APIStatusError) As(target any) bool

As lets errors.As extract the embedded *APIStatusError from any of the status-specific subtypes (they embed APIStatusError and promote this method).

func (*APIStatusError) Error

func (e *APIStatusError) Error() string

type APITimeoutError

type APITimeoutError struct {
	*APIConnectionError
}

APITimeoutError is returned when the request timed out. It embeds *APIConnectionError, so it is also matched by errors.As as a connection error.

type AllTeamsData added in v0.5.0

type AllTeamsData = models.AllTeamsData

Convenience aliases for the typed response payloads, so callers can refer to them without importing the models package directly. The canonical definitions (generated from the OpenAPI contract) live in package models.

type AuthenticationError

type AuthenticationError struct{ APIStatusError }

AuthenticationError is returned for HTTP 401 (missing / invalid API key).

type BadRequestError

type BadRequestError struct{ APIStatusError }

BadRequestError is returned for HTTP 400 (invalid indicator).

type ChannelInfoData added in v0.5.0

type ChannelInfoData = models.ChannelInfoData

Convenience aliases for the typed response payloads, so callers can refer to them without importing the models package directly. The canonical definitions (generated from the OpenAPI contract) live in package models.

type ChannelRepeatsData added in v0.5.0

type ChannelRepeatsData = models.ChannelRepeatsData

Convenience aliases for the typed response payloads, so callers can refer to them without importing the models package directly. The canonical definitions (generated from the OpenAPI contract) live in package models.

type ChannelsData added in v0.5.0

type ChannelsData = models.ChannelsData

Convenience aliases for the typed response payloads, so callers can refer to them without importing the models package directly. The canonical definitions (generated from the OpenAPI contract) live in package models.

type Client

type Client struct {

	// Resource groups.
	VectorSnap *VectorSnap
	PulseSnap  *PulseSnap
	SubdoSnap  *SubdoSnap
	SportSnap  *SportSnap
	// contains filtered or unexported fields
}

Client is the CrawlSnap API client. It is safe for concurrent use.

func NewClient

func NewClient(apiKey string, opts ...Option) (*Client, error)

NewClient creates a client. The API key falls back to $CRAWLSNAP_API_KEY when empty; if neither is set, ErrNoAPIKey is returned.

type CompetitionDetailData added in v0.5.0

type CompetitionDetailData = models.CompetitionDetailData

Convenience aliases for the typed response payloads, so callers can refer to them without importing the models package directly. The canonical definitions (generated from the OpenAPI contract) live in package models.

type CompetitionTablesData added in v0.5.0

type CompetitionTablesData = models.CompetitionTablesData

Convenience aliases for the typed response payloads, so callers can refer to them without importing the models package directly. The canonical definitions (generated from the OpenAPI contract) live in package models.

type CompetitionTvRightsData added in v0.5.0

type CompetitionTvRightsData = models.CompetitionTvRightsData

Convenience aliases for the typed response payloads, so callers can refer to them without importing the models package directly. The canonical definitions (generated from the OpenAPI contract) live in package models.

type CompetitionTwitterData added in v0.5.0

type CompetitionTwitterData = models.CompetitionTwitterData

Convenience aliases for the typed response payloads, so callers can refer to them without importing the models package directly. The canonical definitions (generated from the OpenAPI contract) live in package models.

type CompetitionsData added in v0.5.0

type CompetitionsData = models.CompetitionsData

Convenience aliases for the typed response payloads, so callers can refer to them without importing the models package directly. The canonical definitions (generated from the OpenAPI contract) live in package models.

type ConfigError

type ConfigError struct{ Message string }

ConfigError is returned for SDK misconfiguration detected before any request is made (e.g. a missing API key). It is a config-time error, distinct from the transport-level APIConnectionError.

func (*ConfigError) Error

func (e *ConfigError) Error() string

type CrawlSnapError

type CrawlSnapError interface {
	error
	// contains filtered or unexported methods
}

CrawlSnapError is implemented by every error the SDK returns. Use it with errors.As to catch anything originating from this package.

type DecodeError

type DecodeError struct {
	Message string
	Err     error
}

DecodeError is returned when a successful (2xx) response body could not be decoded into the expected typed payload — an application-layer failure, not a transport one.

func (*DecodeError) Error

func (e *DecodeError) Error() string

func (*DecodeError) Unwrap

func (e *DecodeError) Unwrap() error

type IocDomainScanData

type IocDomainScanData = models.IocDomainScanData

Convenience aliases for the typed response payloads, so callers can refer to them without importing the models package directly. The canonical definitions (generated from the OpenAPI contract) live in package models.

type IocHashScanData

type IocHashScanData = models.IocHashScanData

Convenience aliases for the typed response payloads, so callers can refer to them without importing the models package directly. The canonical definitions (generated from the OpenAPI contract) live in package models.

type IocIPScanData

type IocIPScanData = models.IocIpScanData

Convenience aliases for the typed response payloads, so callers can refer to them without importing the models package directly. The canonical definitions (generated from the OpenAPI contract) live in package models.

type IocURLScanData

type IocURLScanData = models.IocUrlScanData

Convenience aliases for the typed response payloads, so callers can refer to them without importing the models package directly. The canonical definitions (generated from the OpenAPI contract) live in package models.

type LivescoresData added in v0.5.0

type LivescoresData = models.LivescoresData

SportSnap payloads.

type MatchData added in v0.5.0

type MatchData = models.MatchData

Convenience aliases for the typed response payloads, so callers can refer to them without importing the models package directly. The canonical definitions (generated from the OpenAPI contract) live in package models.

type MatchesData added in v0.5.0

type MatchesData = models.MatchesData

Convenience aliases for the typed response payloads, so callers can refer to them without importing the models package directly. The canonical definitions (generated from the OpenAPI contract) live in package models.

type NewsDetailData added in v0.5.0

type NewsDetailData = models.NewsDetailData

Convenience aliases for the typed response payloads, so callers can refer to them without importing the models package directly. The canonical definitions (generated from the OpenAPI contract) live in package models.

type NewsListData added in v0.5.0

type NewsListData = models.NewsListData

Convenience aliases for the typed response payloads, so callers can refer to them without importing the models package directly. The canonical definitions (generated from the OpenAPI contract) live in package models.

type NotFoundError

type NotFoundError struct{ APIStatusError }

NotFoundError is returned for HTTP 404 (no data for the supplied indicator).

type Option

type Option func(*clientConfig)

Option configures a Client in NewClient.

func WithBaseURL

func WithBaseURL(baseURL string) Option

WithBaseURL overrides the API host (default https://api.crawlsnap.com, or $CRAWLSNAP_BASE_URL).

func WithHTTPClient

func WithHTTPClient(hc *http.Client) Option

WithHTTPClient supplies your own *http.Client (advanced). Takes precedence over WithTimeout and WithTransport.

func WithMaxRetries

func WithMaxRetries(n int) Option

WithMaxRetries sets retries for 429 / 5xx / connection errors (default 2).

func WithTimeout

func WithTimeout(d time.Duration) Option

WithTimeout sets the per-request timeout (default 30s). Ignored when WithHTTPClient is supplied.

func WithTransport

func WithTransport(rt http.RoundTripper) Option

WithTransport supplies a custom http.RoundTripper, e.g. a mock for testing.

type PlayerData added in v0.5.0

type PlayerData = models.PlayerData

Convenience aliases for the typed response payloads, so callers can refer to them without importing the models package directly. The canonical definitions (generated from the OpenAPI contract) live in package models.

type PopularTeamsData added in v0.5.0

type PopularTeamsData = models.PopularTeamsData

Convenience aliases for the typed response payloads, so callers can refer to them without importing the models package directly. The canonical definitions (generated from the OpenAPI contract) live in package models.

type PulseDomainScanData

type PulseDomainScanData = models.PulseDomainScanData

Convenience aliases for the typed response payloads, so callers can refer to them without importing the models package directly. The canonical definitions (generated from the OpenAPI contract) live in package models.

type PulseHashScanData

type PulseHashScanData = models.PulseHashScanData

Convenience aliases for the typed response payloads, so callers can refer to them without importing the models package directly. The canonical definitions (generated from the OpenAPI contract) live in package models.

type PulseIPScanData

type PulseIPScanData = models.PulseIpScanData

Convenience aliases for the typed response payloads, so callers can refer to them without importing the models package directly. The canonical definitions (generated from the OpenAPI contract) live in package models.

type PulseSnap

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

PulseSnap is the threat-intelligence pulse enrichment resource. A direct call uses the stable default API version; pin explicitly with V1().

func (*PulseSnap) Domain

func (r *PulseSnap) Domain(ctx context.Context, query string, opts ...RequestOption) (models.PulseDomainScanData, error)

Domain returns pulse enrichment for a domain.

func (*PulseSnap) Hash

func (r *PulseSnap) Hash(ctx context.Context, query string, opts ...RequestOption) (models.PulseHashScanData, error)

Hash returns pulse enrichment for a file hash.

func (*PulseSnap) IP

func (r *PulseSnap) IP(ctx context.Context, query string, opts ...RequestOption) (models.PulseIpScanData, error)

IP returns pulse enrichment for an IP address.

func (*PulseSnap) URL

func (r *PulseSnap) URL(ctx context.Context, query string, opts ...RequestOption) (models.PulseUrlScanData, error)

URL returns pulse enrichment for a URL.

func (*PulseSnap) V1

func (r *PulseSnap) V1() *PulseSnap

V1 pins PulseSnap to API version v1.

type PulseURLScanData

type PulseURLScanData = models.PulseUrlScanData

Convenience aliases for the typed response payloads, so callers can refer to them without importing the models package directly. The canonical definitions (generated from the OpenAPI contract) live in package models.

type QuotaExceededError

type QuotaExceededError struct{ APIStatusError }

QuotaExceededError is returned for HTTP 402 (out of credits or monthly quota).

type RateLimitError

type RateLimitError struct {
	APIStatusError
	// RetryAfter is the Retry-After header value in seconds, if the server sent one.
	RetryAfter float64
}

RateLimitError is returned for HTTP 429 (request limit exceeded).

type RawResponse

type RawResponse struct {
	StatusCode   int
	IsSuccess    bool
	Data         any
	Message      string
	ResponseCode *int
	RequestID    string
	Headers      http.Header
}

RawResponse is the full envelope, populated when a call is made with WithRawResponse. Data holds the parsed typed payload.

type RequestOption

type RequestOption func(*requestConfig)

RequestOption customizes a single request.

func WithRawResponse

func WithRawResponse(dst *RawResponse) RequestOption

WithRawResponse populates dst with the full response envelope (status, headers, request id, is_success, message) alongside the normal typed return.

type SearchData added in v0.5.0

type SearchData = models.SearchData

Convenience aliases for the typed response payloads, so callers can refer to them without importing the models package directly. The canonical definitions (generated from the OpenAPI contract) live in package models.

type ServerError

type ServerError struct{ APIStatusError }

ServerError is returned for HTTP 5xx (server or upstream failure).

type SportSnap added in v0.3.0

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

SportSnap is the football data resource. It exposes the full source surface: live scores with in-match events, fixture lists, single-match views (detail, stats, commentary, broadcasts), competition catalog and detail (fixtures, standings, top scorers, TV rights), national and club teams, TV channel directories and schedules, a news feed, full-text search across every entity type, and player profiles. A direct call uses the stable default API version; pin explicitly with V1().

Path segments (competition country/slug, team country/team, player slug/id) come from the `url` fields in list, search, and detail payloads. iso_code is a two-letter region code that resolves region-specific broadcast channels; pass "" to use the server default.

func (*SportSnap) AllChannels added in v0.5.0

func (r *SportSnap) AllChannels(ctx context.Context, isoCode string, opts ...RequestOption) (models.ChannelsData, error)

AllChannels returns the full TV channel catalog for the iso_code region.

func (*SportSnap) AllTeams added in v0.5.0

func (r *SportSnap) AllTeams(ctx context.Context, opts ...RequestOption) (models.AllTeamsData, error)

AllTeams returns the full national-team catalog: per-country men's and women's team names with the slugs used by NationalTeam.

func (*SportSnap) ChannelInfo added in v0.5.0

func (r *SportSnap) ChannelInfo(ctx context.Context, slug, isoCode string, opts ...RequestOption) (models.ChannelInfoData, error)

ChannelInfo returns channel metadata (name, platform, website, coverage) and the channel's broadcast rights for a channel slug.

func (*SportSnap) ChannelRepeats added in v0.5.0

func (r *SportSnap) ChannelRepeats(ctx context.Context, slug, isoCode string, opts ...RequestOption) (models.ChannelRepeatsData, error)

ChannelRepeats returns the channel's repeat/upcoming broadcast schedule with paging cursors. An empty fixtures array is a valid result, not an error.

func (*SportSnap) Channels added in v0.5.0

func (r *SportSnap) Channels(ctx context.Context, isoCode string, opts ...RequestOption) (models.ChannelsData, error)

Channels returns the curated (football-relevant) channel list for the iso_code region.

func (*SportSnap) ClubTeam added in v0.5.0

func (r *SportSnap) ClubTeam(ctx context.Context, country, team string, opts ...RequestOption) (models.TeamDetailData, error)

ClubTeam returns the club view (profile, squad, competitions, fixtures). country/team come from team url values in other payloads (e.g. spain/barcelona).

func (*SportSnap) ClubTeamNews added in v0.5.0

func (r *SportSnap) ClubTeamNews(ctx context.Context, country, team string, start int, opts ...RequestOption) (models.NewsListData, error)

ClubTeamNews returns news about a club team, paginated via start.

func (*SportSnap) Competition added in v0.5.0

func (r *SportSnap) Competition(ctx context.Context, country, slug string, opts ...RequestOption) (models.CompetitionDetailData, error)

Competition returns the competition detail: fixtures around the current date, standings, top scorers, and broadcast-rights holders. country/slug come from competition_url values in other payloads.

func (*SportSnap) CompetitionNews added in v0.5.0

func (r *SportSnap) CompetitionNews(ctx context.Context, country, slug string, start int, opts ...RequestOption) (models.NewsListData, error)

CompetitionNews returns news about a competition, paginated via start.

func (*SportSnap) CompetitionTables added in v0.5.0

func (r *SportSnap) CompetitionTables(ctx context.Context, country, slug string, opts ...RequestOption) (models.CompetitionTablesData, error)

CompetitionTables returns the competition standings, grouped by stage.

func (*SportSnap) CompetitionTvRights added in v0.5.0

func (r *SportSnap) CompetitionTvRights(ctx context.Context, country, slug string, opts ...RequestOption) (models.CompetitionTvRightsData, error)

CompetitionTvRights returns the channels holding broadcast rights for the competition.

func (*SportSnap) CompetitionTwitter added in v0.5.0

func (r *SportSnap) CompetitionTwitter(ctx context.Context, country, slug string, opts ...RequestOption) (models.CompetitionTwitterData, error)

CompetitionTwitter returns social feed items for the competition (often empty).

func (*SportSnap) Competitions added in v0.5.0

func (r *SportSnap) Competitions(ctx context.Context, isoCode string, opts ...RequestOption) (models.CompetitionsData, error)

Competitions returns the competition catalog: popular competitions, domestic leagues grouped by country, international club competitions, and tournaments.

func (*SportSnap) Livescores added in v0.5.0

func (r *SportSnap) Livescores(ctx context.Context, opts ...RequestOption) (models.LivescoresData, error)

Livescores returns the live-score board for every tracked competition: score line, match status, and structured in-match events.

func (*SportSnap) Match added in v0.3.0

func (r *SportSnap) Match(ctx context.Context, id int64, opts ...RequestOption) (models.MatchData, error)

Match returns the full match view keyed by the numeric match id (fixture_id from fixture lists, live scores, or search): teams, kickoff, venue, lineups, structured events, statistics, and broadcast channels.

func (*SportSnap) MatchChannels added in v0.5.0

func (r *SportSnap) MatchChannels(ctx context.Context, id int64, isoCode string, opts ...RequestOption) (models.MatchData, error)

MatchChannels returns the match view with broadcast channels resolved for the requested iso_code region.

func (*SportSnap) MatchCommentaries added in v0.5.0

func (r *SportSnap) MatchCommentaries(ctx context.Context, id int64, opts ...RequestOption) (models.MatchData, error)

MatchCommentaries returns the match view with the structured event feed populated when the source provides it.

func (*SportSnap) MatchExtended added in v0.5.0

func (r *SportSnap) MatchExtended(ctx context.Context, id int64, opts ...RequestOption) (models.MatchData, error)

MatchExtended is the extended match view: it adds *_translations maps for the competition and team names.

func (*SportSnap) MatchExtraBroadcasts added in v0.5.0

func (r *SportSnap) MatchExtraBroadcasts(ctx context.Context, id int64, opts ...RequestOption) (models.MatchData, error)

MatchExtraBroadcasts returns the extended match view carrying additional broadcast options (repeats, on-demand listings).

func (*SportSnap) MatchStats added in v0.5.0

func (r *SportSnap) MatchStats(ctx context.Context, id int64, opts ...RequestOption) (models.MatchData, error)

MatchStats returns the match view with statistics fields populated when the source provides them.

func (*SportSnap) Matches added in v0.5.0

func (r *SportSnap) Matches(ctx context.Context, isoCode string, opts ...RequestOption) (models.MatchesData, error)

Matches returns upcoming/current fixtures grouped by competition, with the broadcast channels available in the requested iso_code region. Pass "" for the server-default region.

func (*SportSnap) MatchesExtended added in v0.5.0

func (r *SportSnap) MatchesExtended(ctx context.Context, isoCode string, timestamp int64, opts ...RequestOption) (models.MatchesData, error)

MatchesExtended is the extended fixture list: it adds per-locale team-name translations and omits per-fixture channels. timestamp is a unix-second watermark for incremental fetches (0 returns everything).

func (*SportSnap) NationalTeam added in v0.5.0

func (r *SportSnap) NationalTeam(ctx context.Context, slug string, opts ...RequestOption) (models.TeamDetailData, error)

NationalTeam returns the national-team view (profile, squad, competitions, fixtures) for a country slug.

func (*SportSnap) NationalTeamNews added in v0.5.0

func (r *SportSnap) NationalTeamNews(ctx context.Context, slug string, start int, opts ...RequestOption) (models.NewsListData, error)

NationalTeamNews returns news about a national team, paginated via start.

func (*SportSnap) News added in v0.5.0

func (r *SportSnap) News(ctx context.Context, start int, isoCode string, opts ...RequestOption) (models.NewsListData, error)

News returns the news feed, paginated via start (0 for the first page), for the iso_code region.

func (*SportSnap) NewsArticle added in v0.5.0

func (r *SportSnap) NewsArticle(ctx context.Context, id int64, opts ...RequestOption) (models.NewsDetailData, error)

NewsArticle returns a single article (body HTML, tags, byline) plus related articles.

func (*SportSnap) NewsByTag added in v0.5.0

func (r *SportSnap) NewsByTag(ctx context.Context, tag string, start int, opts ...RequestOption) (models.NewsListData, error)

NewsByTag returns news carrying the given tag (e.g. "messi", "world-cup"), paginated via start.

func (*SportSnap) Player added in v0.5.0

func (r *SportSnap) Player(ctx context.Context, slug string, id int64, opts ...RequestOption) (models.PlayerData, error)

Player returns the player profile, current team, and per-season statistics. The slug/id pair comes from player url values in search results, lineups, and squads.

func (*SportSnap) PopularSearches added in v0.5.0

func (r *SportSnap) PopularSearches(ctx context.Context, opts ...RequestOption) (models.SearchData, error)

PopularSearches returns the currently popular search results.

func (*SportSnap) PopularTeams added in v0.5.0

func (r *SportSnap) PopularTeams(ctx context.Context, opts ...RequestOption) (models.PopularTeamsData, error)

PopularTeams returns the popular-teams list.

func (*SportSnap) SearchAll added in v0.5.0

func (r *SportSnap) SearchAll(ctx context.Context, query string, opts ...RequestOption) (models.SearchData, error)

SearchAll runs full-text search across teams, competitions, matches, and players. Result url values feed the corresponding endpoints of this API.

func (*SportSnap) SearchCompetitions added in v0.5.0

func (r *SportSnap) SearchCompetitions(ctx context.Context, query string, opts ...RequestOption) (models.SearchData, error)

SearchCompetitions runs full-text search over competitions.

func (*SportSnap) SearchMatches added in v0.5.0

func (r *SportSnap) SearchMatches(ctx context.Context, query string, opts ...RequestOption) (models.SearchData, error)

SearchMatches runs full-text search over matches.

func (*SportSnap) SearchPlayers added in v0.5.0

func (r *SportSnap) SearchPlayers(ctx context.Context, query string, opts ...RequestOption) (models.SearchData, error)

SearchPlayers runs full-text search over players. Result url values carry the slug/id segments used by Player.

func (*SportSnap) SearchTeams added in v0.5.0

func (r *SportSnap) SearchTeams(ctx context.Context, query string, opts ...RequestOption) (models.SearchData, error)

SearchTeams runs full-text search over teams.

func (*SportSnap) V1 added in v0.3.0

func (r *SportSnap) V1() *SportSnap

V1 pins SportSnap to API version v1.

type SubdoSnap

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

SubdoSnap is the subdomain enumeration resource. A direct call uses the stable default API version; pin explicitly with V1().

func (*SubdoSnap) Scan

func (r *SubdoSnap) Scan(ctx context.Context, query string, opts ...RequestOption) (models.SubdoSnapScanData, error)

Scan fetches the first page of subdomains for a domain. Use the returned Cursor with ScanWithCursor to page manually, or ScanIter to stream every subdomain automatically.

func (*SubdoSnap) ScanIter

func (r *SubdoSnap) ScanIter(ctx context.Context, query string) iter.Seq2[map[string]any, error]

ScanIter streams every subdomain across all pages, following the cursor for you. Range over it with Go 1.23+ range-over-func:

for sub, err := range client.SubdoSnap.ScanIter(ctx, "example.com") {
    if err != nil { return err }
    fmt.Println(sub["subdomain"])
}

Iteration stops at the first error (yielded once with a nil subdomain) or when the cursor is exhausted.

func (*SubdoSnap) ScanWithCursor

func (r *SubdoSnap) ScanWithCursor(ctx context.Context, query, cursor string, opts ...RequestOption) (models.SubdoSnapScanData, error)

ScanWithCursor fetches one page of subdomains starting at the given cursor.

func (*SubdoSnap) V1

func (r *SubdoSnap) V1() *SubdoSnap

V1 pins SubdoSnap to API version v1.

type SubdoSnapScanData

type SubdoSnapScanData = models.SubdoSnapScanData

Convenience aliases for the typed response payloads, so callers can refer to them without importing the models package directly. The canonical definitions (generated from the OpenAPI contract) live in package models.

type SubscriptionInactiveError

type SubscriptionInactiveError struct{ APIStatusError }

SubscriptionInactiveError is returned for HTTP 403 (subscription not active).

type TeamDetailData added in v0.5.0

type TeamDetailData = models.TeamDetailData

Convenience aliases for the typed response payloads, so callers can refer to them without importing the models package directly. The canonical definitions (generated from the OpenAPI contract) live in package models.

type VectorSnap

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

VectorSnap is the IoC reputation enrichment resource. A direct call uses the stable default API version; pin explicitly with V1().

func (*VectorSnap) Domain

func (r *VectorSnap) Domain(ctx context.Context, query string, opts ...RequestOption) (models.IocDomainScanData, error)

Domain returns reputation enrichment for a domain.

func (*VectorSnap) Hash

func (r *VectorSnap) Hash(ctx context.Context, query string, opts ...RequestOption) (models.IocHashScanData, error)

Hash returns reputation enrichment for a file hash.

func (*VectorSnap) IP

func (r *VectorSnap) IP(ctx context.Context, query string, opts ...RequestOption) (models.IocIpScanData, error)

IP returns reputation enrichment for an IP address.

func (*VectorSnap) URL

func (r *VectorSnap) URL(ctx context.Context, query string, opts ...RequestOption) (models.IocUrlScanData, error)

URL returns reputation enrichment for a URL.

func (*VectorSnap) V1

func (r *VectorSnap) V1() *VectorSnap

V1 pins VectorSnap to API version v1.

Directories

Path Synopsis
examples
quickstart command
Command quickstart demonstrates the CrawlSnap Go SDK.
Command quickstart demonstrates the CrawlSnap Go SDK.

Jump to

Keyboard shortcuts

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