Go SDK
Official Go SDK for Venym Search APIs. Built with Go's native performance, strong typing, and excellent concurrency support for high-throughput applications.
Quick Start
1. Installation
# Install using go mod
go get github.com/VENYM_SEARCH/VENYM_SEARCH-go
# Or with specific version
go get github.com/VENYM_SEARCH/VENYM_SEARCH-go@v1.2.0
# Initialize in your project
go mod init your-project
go get github.com/VENYM_SEARCH/VENYM_SEARCH-go2. Basic Usage
package main
import (
"context"
"fmt"
"log"
"os"
"github.com/VENYM_SEARCH/VENYM_SEARCH-go"
)
func main() {
client := VENYM_SEARCH.NewClient(&VENYM_SEARCH.Config{
APIKey: os.Getenv("VENYM_SEARCH_API_KEY"),
})
ctx := context.Background()
searchReq := &VENYM_SEARCH.SearchRequest{
Query: "latest Go programming trends 2025",
MaxResults: 10,
}
result, err := client.Search(ctx, searchReq)
if err != nil {
log.Fatalf("Search failed: %v", err)
}
fmt.Printf("Found %d results\n", len(result.SearchResults))
fmt.Printf("Credits used: %d\n", result.CreditsUsed)
}Key Features
Built with Go's native performance and efficiency, optimized for concurrent operations
Strong typing with comprehensive struct definitions and compile-time error checking
Native goroutine support with built-in rate limiting and worker pools
Go's garbage collector and memory safety features prevent common bugs
Core Methods
| Method | Description | Returns |
|---|---|---|
| Search(ctx, req) | Perform real-time web search with context cancellation support | (*SearchResponse, error) |
| Scrape(ctx, req) | Extract content from single webpage with advanced parsing options | (*ScrapeResponse, error) |
| ScrapeBulk(ctx, req) | Scrape multiple URLs concurrently with progress tracking | ([]*ScrapeResponse, error) |
| Research(ctx, req) | AI-powered research across multiple sources with summarization | (*ResearchResponse, error) |
| GetUsage(ctx) | Get current API usage statistics and remaining credits | (*UsageResponse, error) |
| ValidateKey(ctx) | Validate API key and check account status with timeout | (bool, error) |
Web Scraping Examples
Extract content from any webpage with advanced parsing and bulk operations:
package main
import (
"context"
"fmt"
"log"
"os"
"github.com/VENYM_SEARCH/VENYM_SEARCH-go"
)
func scrapeWebpage() {
client := VENYM_SEARCH.NewClient(&VENYM_SEARCH.Config{
APIKey: os.Getenv("VENYM_SEARCH_API_KEY"),
})
ctx := context.Background()
scrapeReq := &VENYM_SEARCH.ScrapeRequest{
URL: "https://example.com/article",
ExtractOptions: []string{"title", "text", "links", "images"},
FollowRedirects: true,
WaitForSelector: ".content",
RemoveSelectors: []string{".ads", ".popup"},
}
result, err := client.Scrape(ctx, scrapeReq)
if err != nil {
log.Fatalf("Scraping failed: %v", err)
}
fmt.Printf("Page title: %s\n", result.PrimaryContent.Title)
fmt.Printf("Content length: %d characters\n", len(result.PrimaryContent.Text))
}
func bulkScrape() {
client := VENYM_SEARCH.NewClient(&VENYM_SEARCH.Config{
APIKey: os.Getenv("VENYM_SEARCH_API_KEY"),
})
ctx := context.Background()
urls := []string{
"https://example.com/page1",
"https://example.com/page2",
"https://example.com/page3",
}
bulkReq := &VENYM_SEARCH.BulkScrapeRequest{
URLs: urls,
ExtractOptions: []string{"title", "text"},
Concurrent: 2,
}
results, err := client.ScrapeBulk(ctx, bulkReq)
if err != nil {
log.Fatalf("Bulk scraping failed: %v", err)
}
for i, result := range results {
if result.Success {
fmt.Printf("%s: %s\n", urls[i], result.Data.PrimaryContent.Title)
} else {
fmt.Printf("%s failed: %s\n", urls[i], result.Error)
}
}
}AI-Powered Research
Leverage AI to research topics across multiple sources with automatic summarization:
package main
import (
"context"
"fmt"
"log"
"os"
"github.com/VENYM_SEARCH/VENYM_SEARCH-go"
)
func researchTopic() {
client := VENYM_SEARCH.NewClient(&VENYM_SEARCH.Config{
APIKey: os.Getenv("VENYM_SEARCH_API_KEY"),
})
ctx := context.Background()
researchReq := &VENYM_SEARCH.ResearchRequest{
Topic: "sustainable energy solutions 2025",
MaxSources: 10,
IncludeImages: true,
Language: "en",
}
result, err := client.Research(ctx, researchReq)
if err != nil {
log.Fatalf("Research failed: %v", err)
}
fmt.Println(result.Summary)
}Advanced Configuration
Customize the SDK behavior with advanced configuration options:
package main
import (
"context"
"net/http"
"net/url"
"os"
"time"
"github.com/VENYM_SEARCH/VENYM_SEARCH-go"
)
func advancedConfiguration() {
proxyURL, _ := url.Parse("http://proxy.example.com:8080")
transport := &http.Transport{
Proxy: http.ProxyURL(proxyURL),
}
httpClient := &http.Client{
Transport: transport,
Timeout: 60 * time.Second,
}
client := VENYM_SEARCH.NewClient(&VENYM_SEARCH.Config{
APIKey: os.Getenv("VENYM_SEARCH_API_KEY"),
HTTPClient: httpClient,
Timeout: 60 * time.Second,
Retries: 5,
RetryDelay: 1 * time.Second,
})
_ = client
_ = context.Background()
}Error Handling
Robust error handling with Go's native error interface and specific error types:
package main
import (
"context"
"errors"
"fmt"
"log"
"os"
"time"
"github.com/VENYM_SEARCH/VENYM_SEARCH-go"
)
func robustAPICall() (*VENYM_SEARCH.SearchResponse, error) {
client := VENYM_SEARCH.NewClient(&VENYM_SEARCH.Config{
APIKey: os.Getenv("VENYM_SEARCH_API_KEY"),
})
ctx := context.Background()
result, err := client.Search(ctx, &VENYM_SEARCH.SearchRequest{
Query: "example query",
MaxResults: 10,
})
if err != nil {
var rateLimitErr *VENYM_SEARCH.RateLimitError
var authErr *VENYM_SEARCH.AuthenticationError
switch {
case errors.As(err, &rateLimitErr):
time.Sleep(time.Duration(rateLimitErr.RetryAfter) * time.Second)
return robustAPICall()
case errors.As(err, &authErr):
return nil, fmt.Errorf("check your API key: %w", authErr)
default:
log.Printf("Unexpected error: %v", err)
return nil, err
}
}
return result, nil
}Concurrency & Performance
Leverage Go's powerful concurrency features for high-performance applications:
package main
import (
"context"
"fmt"
"os"
"sync"
"time"
"github.com/VENYM_SEARCH/VENYM_SEARCH-go"
)
func concurrentSearch() {
client := VENYM_SEARCH.NewClient(&VENYM_SEARCH.Config{
APIKey: os.Getenv("VENYM_SEARCH_API_KEY"),
})
queries := []string{
"Go programming best practices",
"microservices architecture patterns",
"cloud native development",
}
jobs := make(chan string, len(queries))
results := make(chan *VENYM_SEARCH.SearchResponse, len(queries))
numWorkers := 3
var wg sync.WaitGroup
for i := 0; i < numWorkers; i++ {
wg.Add(1)
go func() {
defer wg.Done()
for query := range jobs {
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
result, err := client.Search(ctx, &VENYM_SEARCH.SearchRequest{
Query: query,
MaxResults: 5,
})
cancel()
if err == nil {
results <- result
}
}
}()
}
for _, query := range queries {
jobs <- query
}
close(jobs)
go func() {
wg.Wait()
close(results)
}()
for result := range results {
fmt.Printf("Got %d results\n", len(result.SearchResults))
}
}Custom Middleware
Extend functionality with custom middleware for logging, authentication, and more:
package main
import (
"context"
"log"
"time"
"github.com/VENYM_SEARCH/VENYM_SEARCH-go"
)
type LoggingMiddleware struct{}
func (m *LoggingMiddleware) ProcessRequest(ctx context.Context, req *VENYM_SEARCH.Request) (*VENYM_SEARCH.Request, error) {
start := time.Now()
req.Headers["X-Request-Start"] = start.Format(time.RFC3339)
log.Printf("Making request to %s %s", req.Method, req.URL)
return req, nil
}
func (m *LoggingMiddleware) ProcessResponse(ctx context.Context, resp *VENYM_SEARCH.Response) (*VENYM_SEARCH.Response, error) {
log.Printf("Request completed (status: %d)", resp.StatusCode)
return resp, nil
}Environment Support
Full support for Go 1.18+ with generics and latest language features.
- • Generic type constraints
- • Context-aware operations
- • Module support
- • Build constraints
Works across all platforms supported by Go runtime.
- • Linux (amd64, arm64)
- • macOS (amd64, arm64)
- • Windows (amd64, 386)
- • FreeBSD, OpenBSD
Optimized for various deployment environments and patterns.
- • Docker containers
- • Kubernetes pods
- • AWS Lambda
- • Cloud Run
Examples & Resources
Ready to Build?
Start building with the Venym Search Go SDK and explore our comprehensive API documentation.
Need Help?
Get support, report issues, or contribute to the Venym Search Go SDK development.