Documentation
¶
Index ¶
- Constants
- type Campaign
- type CampaignsService
- type Client
- type ClientArgs
- type CreateProduct
- type CreateProductArgs
- type ListProductsOptions
- type Order
- type OrderArgs
- type OrderDelivery
- type OrderDenomination
- type OrderPaymentArg
- type OrderRecipient
- type OrdersService
- type Payment
- type Product
- type ProductsService
- type Reward
- type RewardArg
Constants ¶
const ProductionURL = "https://api.tremendous.com/api/v2"
ProductionURL is the production API endpoint
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"})
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 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.)
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).
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
|