# Go SDK

> go get github.com/shopsavvy/sdk-go and call the ShopSavvy Data API from Go services: product lookup by barcode or ASIN, offers, and price history.

*Source: https://shopsavvy.com/data/documentation/sdk-go* · Part of the [ShopSavvy Data API documentation](https://shopsavvy.com/data/documentation.md)

---

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

- [View on GitHub](https://github.com/shopsavvy/sdk-go)
- [View Docs on pkg.go.dev](https://pkg.go.dev/github.com/shopsavvy/sdk-go)

## Installation

```bash
go get github.com/shopsavvy/sdk-go
```

## Quick Start

```go
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
