Go SDK

Last updated · Changelog · OpenAPI spec · Markdown

Our official Go SDK provides a fast, type-safe way to interact with the ShopSavvy Data API from Go applications.

Installation

go get github.com/shopsavvy/sdk-go

Quick Start

package main

import (
    "fmt"
    "log"

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

func main() {
    // Create a new client
    client, err := shopsavvy.NewClient("ss_live_your_api_key_here")
    if err != nil {
        log.Fatal(err)
    }
    defer client.Close()

    // Look up a product by barcode
    product, err := client.GetProductDetails("012345678901")
    if err != nil {
        log.Fatal(err)
    }

    fmt.Printf("Product: %s\n", product.Data.Name)

    // Get current offers
    offers, err := client.GetCurrentOffers("012345678901", "")
    if err != nil {
        log.Fatal(err)
    }

    for _, offer := range offers.Data {
        fmt.Printf("%s: $%.2f\n", offer.Retailer, offer.Price)
    }
}

Features

  • Full type safety with Go generics
  • Comprehensive error handling with custom error types
  • Context support for request cancellation
  • Built-in rate limiting and retry logic
  • Support for both JSON and CSV response formats
  • Batch operations for multiple products
Was this page helpful?