Skip to content

brunobolting/go-snowy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Snowy

Snowy is a lightweight, type-safe HTTP client specifically designed for interacting with JSON APIs. It offers a clean, generics-based interface for making HTTP requests with automatic JSON marshalling/unmarshalling, configurable timeouts, and efficient connection pooling.

Coverage Badge

Go Reference

Key Features

  • Type-safe requests with generics
  • Connection pooling with automatic client caching
  • Support for JSON and form-encoded request bodies
  • Comprehensive error handling with custom error types
  • Convenient helper methods for authentication
  • Full HTTP method coverage (GET, POST, PUT, PATCH, DELETE)
  • Custom status code handling for non-standard APIs

Installation

go get github.com/brunobolting/go-snowy

Basic Examples

// Configure the client
config := snowy.Config{
    Timeout: 5 * time.Second,
}

// Define your response type
type UserResponse struct {
    ID    int    `json:"id"`
    Name  string `json:"name"`
    Email string `json:"email"`
}

// Make the request
response, err := snowy.Get[UserResponse](
    config,
    "https://api.example.com/users/1",
    nil,
    snowy.RequestData{}
)
if err != nil {
    // Handle error
    return err
}

// Access the data
user := response.Data
fmt.Println("User Name:", user.Name)

See documentation for more examples and details.

About

Snowy is a lightweight, type-safe HTTP client specifically designed for interacting with JSON APIs

Resources

License

Stars

Watchers

Forks

Languages