Skip to main content

Installation

go get github.com/wraithbytes/sdk-go
Requires Go 1.25+.

Quick Start

package main

import (
    "context"
    "fmt"
    "log"

    wraithbytes "github.com/wraithbytes/sdk-go"
)

func main() {
    client := wraithbytes.NewClient("YOUR_API_KEY")

    resp, err := client.Fetch(context.Background(), &wraithbytes.FetchRequest{
        URL: "https://www.linkedin.com/in/username",
        Options: &wraithbytes.FetchOptions{
            JSON: true,
        },
    })
    if err != nil {
        log.Fatal(err)
    }

    fmt.Printf("Success: %v\n", resp.Success)
    fmt.Printf("Data: %v\n", resp.Data)
}

Client

NewClient(apiKey string) *Client

Creates a new API client. Connects to https://web-acq.wraithbytes.com automatically.
client := wraithbytes.NewClient("YOUR_API_KEY")

Methods

Fetch(ctx, req) (*FetchResponse, error)

Fetch and parse a URL. Returns a typed FetchResponse.
resp, err := client.Fetch(ctx, &wraithbytes.FetchRequest{
    URL: "https://example.com",
    Options: &wraithbytes.FetchOptions{
        Markdown: true,
    },
})

FetchRaw(ctx, req) ([]byte, error)

Same as Fetch but returns raw JSON bytes instead of unmarshaling. Useful when you need to handle the JSON yourself.
raw, err := client.FetchRaw(ctx, &wraithbytes.FetchRequest{
    URL: "https://example.com",
})

GetResults(ctx) (*ResultsResponse, error)

Retrieve past fetch results.
results, err := client.GetResults(context.Background())

GetResultsRaw(ctx) ([]byte, error)

Same as GetResults but returns raw JSON bytes.

Types

FetchRequest

type FetchRequest struct {
    URL     string       `json:"url"`
    Filters *Filters     `json:"filters,omitempty"`
    Options *FetchOptions `json:"options,omitempty"`
}

FetchOptions

type FetchOptions struct {
    Markdown     bool        `json:"markdown,omitempty"`
    JSON         bool        `json:"json,omitempty"`
    IncludeLinks bool        `json:"include_links,omitempty"`
    IncludeHTML  string      `json:"include_html,omitempty"`
    ImageURLs    bool        `json:"image_urls,omitempty"`
    JSONSchema   interface{} `json:"json_schema,omitempty"`
    AI           *AIOptions  `json:"ai,omitempty"`
}

AIOptions

type AIOptions struct {
    Summary          bool `json:"summary,omitempty"`
    Image            bool `json:"image,omitempty"`
    AudioTranscriber bool `json:"audio_transcriber,omitempty"`
}

Filters

Parser-specific filter fields. Available fields vary by parser — see Custom Web Parsers for details.
type Filters struct {
    // Fields vary by parser. See parser documentation for available filter keys.
}

FetchResponse

type FetchResponse struct {
    Success bool         `json:"success"`
    Status  string       `json:"status"`
    Data    interface{}  `json:"data,omitempty"`
    Error   *ErrorDetail `json:"error,omitempty"`
}

ResultsResponse

type ResultsResponse struct {
    Success bool         `json:"success"`
    Data    interface{}  `json:"data,omitempty"`
    Error   *ErrorDetail `json:"error,omitempty"`
}

ErrorDetail

type ErrorDetail struct {
    Code    string `json:"code"`
    Message string `json:"message"`
}

Example: Custom JSON Schema

resp, err := client.Fetch(ctx, &wraithbytes.FetchRequest{
    URL: "https://example.com/product",
    Options: &wraithbytes.FetchOptions{
        JSONSchema: map[string]interface{}{
            "properties": []map[string]interface{}{
                {"name": "title", "type": "string"},
                {"name": "price", "type": "number"},
            },
        },
    },
})