Skip to content

ramaris-app/go-sdk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ramaris Go SDK

Go client library for the Ramaris API — Base-focused wallet analytics and strategy tracking.

Install

go get github.com/ramaris-app/go-sdk

Requires Go 1.22+. Zero external dependencies (stdlib only).

Quick Start

package main

import (
    "context"
    "fmt"
    "log"

    ramaris "github.com/ramaris-app/go-sdk"
)

func main() {
    client := ramaris.NewClient("rms_your_api_key")

    ctx := context.Background()

    // List strategies
    strategies, err := client.ListStrategies(ctx, &ramaris.ListOptions{Page: 1, PageSize: 10})
    if err != nil {
        log.Fatal(err)
    }
    for _, s := range strategies.Data {
        fmt.Printf("%s — %d wallets tracked\n", s.Name, s.Stats.WalletsTracked)
    }
}

Client Options

// Default client — connects to https://api.ramaris.app/api/v1
client := ramaris.NewClient("rms_your_api_key")

// Custom base URL — useful for local development or running your own instance
client := ramaris.NewClient("rms_key", ramaris.WithBaseURL("http://localhost:3000/api/v1"))

// Custom HTTP client
client := ramaris.NewClient("rms_key", ramaris.WithHTTPClient(&http.Client{Timeout: 10 * time.Second}))

The default base URL points to the production Ramaris API at https://api.ramaris.app/api/v1. The WithBaseURL option is only needed if you're testing against a local server or a custom deployment.

Endpoints

Strategies

// List strategies with pagination
resp, err := client.ListStrategies(ctx, &ramaris.ListOptions{Page: 1, PageSize: 50})

// Get a single strategy by share ID
strategy, err := client.GetStrategy(ctx, "shareId")

// List your watchlist
watchlist, err := client.ListWatchlist(ctx, nil) // nil = default pagination

Wallets

// List wallets
resp, err := client.ListWallets(ctx, nil)

// Get a single wallet by ID
wallet, err := client.GetWallet(ctx, 456)

User

// Get your profile
profile, err := client.GetProfile(ctx)

// Get your subscription
sub, err := client.GetSubscription(ctx)

Health

health, err := client.Health(ctx)

Error Handling

import "errors"

strategy, err := client.GetStrategy(ctx, "invalid")
if err != nil {
    var apiErr *ramaris.Error
    if errors.As(err, &apiErr) {
        fmt.Printf("API error: %s (HTTP %d)\n", apiErr.Code, apiErr.StatusCode)
    }

    var rlErr *ramaris.RateLimitError
    if errors.As(err, &rlErr) {
        fmt.Printf("Rate limited, retry after %d seconds\n", rlErr.RetryAfter)
    }
}

Rate Limits

Rate limit info is updated after every successful request:

client.Health(ctx)

if rl := client.RateLimit(); rl != nil {
    fmt.Printf("%d/%d requests remaining (resets at %d)\n", rl.Remaining, rl.Limit, rl.Reset)
}

Retry Behavior

  • 5xx errors: Retried up to 3 times with exponential backoff (500ms, 1s, 2s)
  • 429 rate limit: Returns *RateLimitError immediately with RetryAfter — caller decides when to retry
  • 4xx errors: Returns *Error immediately (no retry)
  • All methods respect context.Context for cancellation and timeouts

Testing

# Unit tests
go test -v -race ./...

# Integration tests (requires API key)
RAMARIS_API_KEY=rms_... go test -tags=integration -v ./...

# Coverage
go test -coverprofile=c.out ./... && go tool cover -func=c.out

License

MIT

About

Go client library for the Ramaris API

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages