tremendous

package module
v0.0.0-...-9f7ff2f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 19, 2026 License: MIT Imports: 10 Imported by: 0

README

NOTICE: This repository has been moved to https://code.adriano.fyi/me/go-tremendous. Microsoft has shown little interest in stewarding what was once the best and largest open source community. This small act of migration is my way showing that we don't all support Microsoft's disinterest.

go-tremendous

go-tremendous is a Go client for Tremendous

This client supports a subset of the tremendous api. It does not support some endpoints and parameters, and is not affiliated with Tremendous.

If you would like to contribute additional functionality to this client, please feel free to open a pull request.

If you would like to report a bug or request additional features, please do not open an issue. This client is provided as-is.

Usage

See examples for examples.

Documentation

Index

Constants

View Source
const ProductionURL = "https://api.tremendous.com/api/v2"

ProductionURL is the production API endpoint

View Source
const TestflightURL = "https://testflight.tremendous.com/api/v2"

TestflightURL is the testflight API endpoint.

Variables

This section is empty.

Functions

This section is empty.

Types

type Campaign

type Campaign struct {
	ID          string `json:"id,omitempty"`
	Name        string `json:"name,omitempty"`
	Description string `json:"description,omitempty"`
	Status      string `json:"status,omitempty"`
}

Campaign represents a single campaign record from Tremendous.

type CampaignsService

type CampaignsService struct {
	// contains filtered or unexported fields
}

CampaignsService handles the "campaigns" resource.

func (*CampaignsService) List

func (cs *CampaignsService) List() ([]Campaign, error)

List fetches a filtered list of campaigns from the API.

Example usage:

client.Campaigns.List(&tremendous.ListCampaignsOptions{Name: "Summer", Status: "active"})

func (*CampaignsService) Retrieve

func (cs *CampaignsService) Retrieve(campaignID string) (*Campaign, error)

Retrieve fetches a single campaign by its ID if needed. (Optional: Implement similarly to the templates/products retrieve.)

type Client

type Client struct {
	APIKey    string
	BaseURL   string
	Campaigns *CampaignsService
	Orders    *OrdersService
	Products  *ProductsService
}

Client is the primary entry point for using the Tremendous API

func NewClient

func NewClient(args ClientArgs) *Client

NewClient constructs a new Tremendous client using the given API key.

type ClientArgs

type ClientArgs struct {
	ApiKey     string // the api key used to authenticate to the API
	Production bool   // whether to use the production or testflight API
}

type CreateProduct

type CreateProduct struct {
	Name        string  `json:"name,omitempty"`
	Brand       string  `json:"brand,omitempty"`
	Description string  `json:"description,omitempty"`
	Price       float64 `json:"price,omitempty"`
	Currency    string  `json:"currency,omitempty"`
}

CreateProduct is the structure inside the top-level "product" key for creation.

type CreateProductArgs

type CreateProductArgs struct {
	Product CreateProduct `json:"product"`
}

CreateProductArgs is the typed request for creating a new product.

type ListProductsOptions

type ListProductsOptions struct {
	Country string // e.g. "US" or "CA"
}

ListProductsOptions specifies optional query filters, such as country.

type Order

type Order struct {
	ID         string    `json:"id,omitempty"`
	ExternalID string    `json:"external_id,omitempty"`
	CreatedAt  time.Time `json:"created_at"`
	Message    string    `json:"message,omitempty"`
	Status     string    `json:"status,omitempty"`
	Payment    Payment   `json:"payment,omitempty"`
	Rewards    []Reward  `json:"rewards"`
}

Order represents the JSON structure of an order in the Tremendous API.

type OrderArgs

type OrderArgs struct {
	CampaignID *string         `json:"campaign_id"`
	ExternalID *string         `json:"external_id"`
	Payment    OrderPaymentArg `json:"payment"`
	Reward     RewardArg       `json:"reward"`
}

OrderArgs is the request struct for creating an order. It wraps the "order" object exactly as Tremendous expects in the JSON payload.

type OrderDelivery

type OrderDelivery struct {
	Method string `json:"method"` // email, link, or phone
	Status string `json:"status"`
	Link   string `json:"link"`
}

OrderDelivery designates how an order's reward is delivered

type OrderDenomination

type OrderDenomination struct {
	Denomination float64 `json:"denomination"`
	CurrencyCode string  `json:"currency_code"`
}

OrderDenomination denominates the reward's monetary value

type OrderPaymentArg

type OrderPaymentArg struct {
	FundingSourceID string `json:"funding_source_id,omitempty"`
}

OrderPaymentArg describes an order's payment details

type OrderRecipient

type OrderRecipient struct {
	Email string `json:"email,omitempty"`
	Name  string `json:"name,omitempty"`
}

OrderRecipient contains details about reward recipients

type OrdersService

type OrdersService struct {
	// contains filtered or unexported fields
}

OrdersService handles the "orders" resource.

func (*OrdersService) Create

func (s *OrdersService) Create(args OrderArgs) (*Order, error)

Create sends a new order to the Tremendous API for creation. It requires the Payment field to be non-nil in CreateOrderArgs.

func (*OrdersService) List

func (s *OrdersService) List() ([]Order, error)

List fetches all orders. (Query params, pagination, etc., may be added later.)

func (*OrdersService) Retrieve

func (s *OrdersService) Retrieve(orderID string) (*Order, error)

Retrieve fetches a single order by its ID.

type Payment

type Payment struct {
	FundingSourceID string  `json:"funding_source_id,omitempty"`
	Amount          float64 `json:"amount,omitempty"`
	CurrencyCode    string  `json:"currency_code,omitempty"`
	Object          string  `json:"object,omitempty"`
}

Payment captures details of the payment object used by the order.

type Product

type Product struct {
	ID          string  `json:"id,omitempty"`
	Name        string  `json:"name,omitempty"`
	Brand       string  `json:"brand,omitempty"`
	Description string  `json:"description,omitempty"`
	Price       float64 `json:"price,omitempty"`
	Currency    string  `json:"currency,omitempty"`
	Object      string  `json:"object,omitempty"`
}

Product is a fully parsed product object (fields may vary by API).

type ProductsService

type ProductsService struct {
	// contains filtered or unexported fields
}

ProductsService handles the “products” resource.

func (*ProductsService) Create

func (ps *ProductsService) Create(args CreateProductArgs) (*Product, error)

Create adds a new product to the Tremendous API.

func (*ProductsService) List

func (ps *ProductsService) List(opts *ListProductsOptions) ([]Product, error)

List retrieves all products, optionally filtering by country (and other options).

func (*ProductsService) Retrieve

func (ps *ProductsService) Retrieve(productID string) (*Product, error)

Retrieve fetches a single product by its ID.

type Reward

type Reward struct {
	ID        string            `json:"id"`
	OrderID   string            `json:"order_id"`
	CreatedAt time.Time         `json:"created_at"`
	Value     OrderDenomination `json:"value"`
	Delivery  OrderDelivery     `json:"delivery"`
	Recipient OrderRecipient    `json:"recipient"`
}

Reward captures details of a reward that has been paid out

type RewardArg

type RewardArg struct {
	CampaignID *string           `json:"campaign_id"`
	Delivery   OrderDelivery     `json:"delivery"`
	Products   []string          `json:"products"`
	Recipient  OrderRecipient    `json:"recipient"`
	Value      OrderDenomination `json:"value"`
}

RewardArg is subset of field for on order reward

Directories

Path Synopsis
examples
list_campaigns command
list_orders command
list_products command
place_order command

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL