Introduction to the Go SDK

Welcome to the Go SDK for interacting with the Our API. This SDK simplifies the process of making requests to our platform from your Go applications, providing a type-safe and idiomatic Go experience.

Why Use the Go SDK?

Installation

To get started, you can install the SDK using Go Modules:

go get github.com/our-api/go-sdk

Getting Started: A Simple Example

Here’s a basic example demonstrating how to initialize the client and fetch a list of users:

Example: Fetching Users

package main

import (
	"fmt"
	"log"

	"github.com/our-api/go-sdk"
)

func main() {
	// Initialize the client with your API key
	// Ensure you have your API_KEY set as an environment variable or replace it directly.
	client, err := sdk.NewClient(sdk.WithAPIKey("YOUR_API_KEY"))
	if err != nil {
		log.Fatalf("Failed to create client: %v", err)
	}

	// Fetch a list of users
	users, err := client.Users.List(sdk.UserListParams{})
	if err != nil {
		log.Fatalf("Failed to list users: %v", err)
	}

	fmt.Printf("Successfully fetched %d users:\n", len(users))
	for _, user := range users {
		fmt.Printf("- ID: %s, Name: %s, Email: %s\n", user.ID, user.Name, user.Email)
	}
}

Note: Replace YOUR_API_KEY with your actual API key. It's recommended to use environment variables for sensitive credentials.

Key Features

Next Steps

Now that you've got the basics, dive deeper into specific resources: