tebexgo

package module
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2022 License: MIT Imports: 4 Imported by: 2

README

TebexGo

Go package for the Tebex Plugin API

Note

Please note that all requests to the API must be sent via HTTPS

Prerequisites

Golang

Installing
go get github.com/itschip/tebexgo
Getting started
Retrieve a package by id
import (
  "fmt"

  "github.com/itschip/tebexgo"
)

func main() {
	// Creates a new session
	s := tebexgo.New("your_secret")
	
	// You should handle your error here
	pkg, err := s.GetPackage("package_id")
	
	fmt.Println(pkg.Name) // Prints out the package name
}

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	TebexEndpoint           = "https://plugin.tebex.io"
	InformationEndpoint     = TebexEndpoint + "/information"
	AllPackagesEndpoint     = TebexEndpoint + "/packages"
	RetrievePackageEndpoint = TebexEndpoint + "/package/"
	ListingEndpoint         = TebexEndpoint + "/listing"
	BansEndpoint            = TebexEndpoint + "/bans"
	CheckoutEndpoint        = TebexEndpoint + "/checkout"
	AllSalesEndpoint        = TebexEndpoint + "/sales"
	GiftCardsEndpoint       = TebexEndpoint + "/gift-cards"
	PlayerLookupEndpoint    = TebexEndpoint + "/user"
	PaymentsEndpoint        = TebexEndpoint + "/payments"
	CommunityEndpoint       = TebexEndpoint + "/community_goals"
	CouponsEndpoint         = TebexEndpoint + "/coupons"
)

Functions

This section is empty.

Types

type Account

type Account struct {
	Id         int      `json:"id"`
	Domain     string   `json:"domain"`
	Name       string   `json:"name"`
	Currency   Currency `json:"currency"`
	OnlineMode bool     `json:"online_mode"`
	GameType   string   `json:"game_type"`
	LogEvents  bool     `json:"log_events"`
	Server     Server   `json:"server"`
}

type BanData added in v0.1.2

type BanData struct {
	Id           int     `json:"id"`
	Time         string  `json:"time"`
	Ip           string  `json:"ip"`
	PaymentEmail string  `json:"payment_email"`
	Reason       string  `json:"reason"`
	User         BanUser `json:"user"`
}

type BanInput added in v0.1.6

type BanInput struct {
	Reason string `json:"reason"`
	Ip     string `json:"ip"`
	User   string `json:"user"`
}

type BanUser added in v0.1.2

type BanUser struct {
	Ign  string `json:"ign"`
	Uuid string `json:"uuid"`
}

type Bans added in v0.1.2

type Bans struct {
	Data []BanData `json:"data"`
}

type Checkout added in v0.1.7

type Checkout struct {
	Url     string `json:"url"`
	Expires string `json:"expires"`
}

type CommunityGoal added in v1.0.1

type CommunityGoal struct {
	Id            int    `json:"id"`
	CreatedAt     string `json:"created_at"`
	UpdatedAt     string `json:"updated_at"`
	Account       int    `json:"account"`
	Name          string `json:"name"`
	Description   string `json:"description"`
	Image         string `json:"image"`
	Target        string `json:"target"`
	Current       string `json:"current"`
	Repeatable    int    `json:"repeatable"`
	LastAchieved  int    `json:"last_achieved"`
	TimesAchieved int    `json:"times_achieved"`
	Satus         string `json:"status"`
	Sale          int    `json:"sale"`
}

type Coupon added in v1.0.1

type Coupon struct {
	Data CouponData `json:"data"`
}

type CouponData added in v1.0.1

type CouponData struct {
	Id         int             `json:"id"`
	Code       string          `json:"code"`
	Effective  CouponEffective `json:"effective"`
	Expire     CouponExpire    `json:"expire"`
	BasketType string          `json:"basket_type"`
	StartDate  string          `json:"start_date"`
	UserLimit  string          `json:"user_limit"`
	Minimum    int             `json:"minimum"`
	Username   string          `json:"username"`
	Note       string          `json:"note"`
}

type CouponEffective added in v1.0.1

type CouponEffective struct {
	Type       string `json:"type"`
	Packages   []int  `json:"packages"`
	Categories []int  `json:"categories"`
}

type CouponExpire added in v1.0.1

type CouponExpire struct {
	ReedemUnlimited string `json:"reedem_unlimited"`
	ExpireNever     string `json:"expire_never"`
	Limit           int    `json:"limit"`
	Date            string `json:"date"`
}

type CouponPagination added in v1.0.1

type CouponPagination struct {
	TotalResults int    `json:"totalResults"`
	CurrentPage  int    `json:"currentPage"`
	LastPage     int    `json:"lastPage"`
	Previous     int    `json:"previous"`
	Next         string `json:"next"`
}

type Coupons added in v1.0.1

type Coupons struct {
	Pagination CouponPagination `json:"pagination"`
	Data       CouponData       `json:"data"`
}

type CreateCouponObject added in v1.0.1

type CreateCouponObject struct {
	Code                      string `json:"code"`
	EffectiveOn               string `json:'effective_on"`
	Packages                  []int  `json:"packages"`
	Categories                []int  `json:"categories"`
	DiscountType              string `json:"discount_type"`
	DiscountAmount            int    `json:"discount_amount"`
	DiscountPrecentage        int    `json:"discount_precentage"`
	ReedemUnlimited           bool   `json:"reedem_unlimited"`
	ExpireNever               bool   `json:"expire_never"`
	ExpireLimit               int    `json:"expire_limit"`
	ExpireDate                string `json:"expire_date"`
	StartDate                 string `json:"start_date"`
	BasketType                string `json:"basket_type"`
	Minium                    int    `json:"minimum"`
	DiscountApplicationMethod int    `json:"discount_application_method"`
	Username                  string `json:"username"`
	Note                      string `json:"note"`
}

type Currency

type Currency struct {
	Iso4217 string `json:"iso_4217"`
	Symbol  string `json:"symbol"`
}

type GiftCard added in v1.0.1

type GiftCard struct {
	Id      int             `json:"id"`
	Code    string          `json:"code"`
	Balance GiftCardBalance `json:"balance"`
	Note    string          `json:"note"`
	Void    bool            `json:"void"`
}

type GiftCardBalance added in v1.0.1

type GiftCardBalance struct {
	Starting  string `json:"starting"`
	Remaining string `json:"remaining"`
	Currency  string `json:"currency"`
}

type GiftCards added in v1.0.1

type GiftCards struct {
	Data []GiftCard `json:"data"`
}

type Listing added in v0.1.2

type Listing struct {
	Categories []ListingCategory `json:"categories"`
}

type ListingCategory added in v0.1.2

type ListingCategory struct {
	Id                int            `json:"id"`
	Order             int            `json:"order"`
	Name              string         `json:"name"`
	OnlySubcategories bool           `json:"only_subcategories"`
	Subcategories     []interface{}  `json:"subcategories"`
	Packages          ListingPackage `json:"packages"`
}

type ListingPackage added in v0.1.2

type ListingPackage struct {
	Id    int                `json:"id"`
	Order int                `json:"order"`
	Name  string             `json:"name"`
	Price string             `json:"price"`
	Sale  ListingPackageSale `json:"sale"`
}

type ListingPackageSale added in v0.1.2

type ListingPackageSale struct {
	Active   bool   `json:"active"`
	Discount string `json:"discount"`
}

type Package added in v0.1.2

type Package struct {
	Id                int             `json:"id"`
	Name              string          `json:"name"`
	Image             interface{}     `json:"image"`
	Price             float32         `json:"price"`
	ExpiryLength      int             `json:"expiry_length"`
	ExpiryPeriod      string          `json:"expiry_period"`
	Type              string          `json:"type"`
	Category          PackageCategory `json:"category"`
	GlobalLimit       int             `json:"global_limit"`
	GlobalLimitPeriod string          `json:"global_limit_period"`
	UserLimit         int             `json:"user_limit"`
	Servers           []PackageServer `json:"servers"`
	RequiredPackages  []interface{}   `json:"required_packages"`
	RequireAny        bool            `json:"require_any"`
	CreateGiftcard    bool            `json:"create_giftcard"`
	ShowUntil         bool            `json:"show_until"`
	GuiItem           string          `json:"gui_item"`
	Disabled          bool            `json:"disabled"`
	DisableQuantity   bool            `json:"disable_quantity"`
	CustomPrice       bool            `json:"custom_price"`
	ChooseServer      bool            `json:"choose_server"`
	LimitExpires      bool            `json:"limit_expires"`
	InheritCommands   bool            `json:"inherit_commands"`
	VariableGiftcard  bool            `json:"variable_giftcard"`
}

type PackageCategory added in v0.1.2

type PackageCategory struct {
	Id   int    `json:"id"`
	Name string `json:"name"`
}

type PackageServer added in v0.1.2

type PackageServer struct {
	Id   int    `json:"id"`
	Name string `json:"name"`
}

type Payment added in v1.0.1

type Payment struct {
	Id             int              `json:"id"`
	Amount         string           `json:"amount"`
	Date           string           `json:"date"`
	Currency       Currency         `json:"currency"`
	PaymentGateway PaymentGateway   `json:"gateway"`
	Status         string           `json:"status"`
	Email          string           `json:"email"`
	Player         PaymentPlayer    `json:"player"`
	Packages       []PaymentPackage `json:"packages"`
}

type PaymentGateway added in v1.0.1

type PaymentGateway struct {
	Id   int    `json:"id"`
	Name string `json:"name"`
}

type PaymentPackage added in v1.0.1

type PaymentPackage struct {
	Id   int    `json:"id"`
	Name string `json:"name"`
}

type PaymentPackageFieldOption added in v1.0.1

type PaymentPackageFieldOption struct {
	Label string `json:"label"`
	Value int    `json:"value"`
}

type PaymentPackageFields added in v1.0.1

type PaymentPackageFields struct {
	Name    string                      `json:"name"`
	Value   string                      `json:"value"`
	Type    string                      `json:"type"`
	Options []PaymentPackageFieldOption `json:"options"`
}

type PaymentPlayer added in v1.0.1

type PaymentPlayer struct {
	Id   int    `json:"id"`
	Name string `json:"name"`
	Uuid string `json:"uuid"`
}

type Player added in v1.0.1

type Player struct {
	Id               string `json:"id"`
	CreatedAt        string `json:"created_at"`
	UpdatedAt        string `json:"updated_at"`
	CacheExpire      string `json:"cache_expire"`
	Username         string `json:"username"`
	Meta             string `json:"meta"`
	PluginUsernameId string `json:"plugin_username_id"`
}

type PlayerData added in v1.0.1

type PlayerData struct {
	Player         Player          `json:"player"`
	BanCount       int             `json:"banCount"`
	ChargebackRate int             `json:"chargebackRate"`
	Payments       []PlayerPayment `json:"payments"`
	PurchaseTotals PurchaseTotals  `json:"purchaseTotals"`
}

type PlayerPayment added in v1.0.1

type PlayerPayment struct {
	TxnId    string `json:"txn_id"`
	Time     int    `json:"time"`
	Price    int64  `json:"price"`
	Currency string `json:"currency"`
	Status   int    `json:"status"`
}

type PurchaseTotals added in v1.0.1

type PurchaseTotals struct {
	USD int64 `json:"USD"`
	GBP int64 `json:"GBP"`
}

type PutCheckoutObject added in v0.1.7

type PutCheckoutObject struct {
	PackageId string `json:"package_id"`
	Username  string `json:"username"`
}

type PutGiftCardObject added in v1.0.1

type PutGiftCardObject struct {
	ExpiresAt string `json:"expires_at"`
	Note      string `json:"note"`
	Amount    int    `json:"amount"`
}

type Sale added in v1.0.1

type Sale struct {
	Id        int           `json:"id"`
	Effective SaleEffective `json:"effective"`
	Discount  SaleDiscount  `json:"discount"`
	Start     int           `json:"start"`
	Expire    int           `json:"expire"`
	Order     int           `json:"order"`
}

type SaleDiscount added in v1.0.1

type SaleDiscount struct {
	Type       string `json:"type"`
	Percentage int    `json:"percentage"`
	Value      int    `json:"value"`
}

type SaleEffective added in v1.0.1

type SaleEffective struct {
	Type       string `json:"package"`
	Packages   []int  `json:"packages"`
	Categories []int  `json:"categories"`
}

type Sales added in v1.0.1

type Sales struct {
	Data []Sale `json:"data"`
}

type Server

type Server struct {
	Id   int    `json:"id"`
	Name string `json:"name"`
}

type ServerInformation

type ServerInformation struct {
	Account
	Server
}

type Session

type Session struct {
	Secret string
}

func New

func New(secret string) (s *Session)

func (*Session) CreateBan added in v0.1.6

func (s *Session) CreateBan(input *BanInput) (*Bans, error)

func (*Session) CreateCheckoutUrl added in v0.1.7

func (s *Session) CreateCheckoutUrl(checkoutObject *PutCheckoutObject) (*Checkout, error)

func (*Session) CreateCoupon added in v1.0.1

func (s *Session) CreateCoupon(createObject *CreateCouponObject) (*CouponData, error)

func (*Session) CreateGiftCard added in v1.0.1

func (s *Session) CreateGiftCard(cardObject *PutGiftCardObject) (*GiftCard, error)

func (*Session) DeleteCoupon added in v1.0.1

func (s *Session) DeleteCoupon(couponId string) error

func (*Session) DisableGiftCard added in v1.0.1

func (s *Session) DisableGiftCard(giftCardId string) (*GiftCard, error)

func (*Session) GetAllBans added in v0.1.6

func (s *Session) GetAllBans() (*Bans, error)

func (*Session) GetAllCommunityGoals added in v1.0.1

func (s *Session) GetAllCommunityGoals() (*[]CommunityGoal, error)

func (*Session) GetAllCoupons added in v1.0.1

func (s *Session) GetAllCoupons() (*Coupons, error)

func (*Session) GetAllGiftCards added in v1.0.1

func (s *Session) GetAllGiftCards() (*GiftCards, error)

func (*Session) GetAllPackages

func (s *Session) GetAllPackages() ([]Package, error)

func (*Session) GetAllPayments added in v1.0.1

func (s *Session) GetAllPayments() (*[]Payment, error)

Retrive the latest payments (up to a maximum of 100) made on your webstore.

func (*Session) GetAllSales added in v1.0.1

func (s *Session) GetAllSales() (*Sales, error)

func (*Session) GetCoupon added in v1.0.1

func (s *Session) GetCoupon(couponId string) (*Coupon, error)

func (*Session) GetGiftCard added in v1.0.1

func (s *Session) GetGiftCard(cardId string) (*GiftCard, error)

func (*Session) GetListing added in v0.1.6

func (s *Session) GetListing() (*Listing, error)

func (*Session) GetPackage added in v0.1.2

func (s *Session) GetPackage(packageId string) (Package, error)

func (*Session) GetRequiredPaymentFields added in v1.0.1

func (s *Session) GetRequiredPaymentFields(packageId string) (*[]PaymentPackageFields, error)

Returns an array of fields (custom variables, etc) required to be entered for a manual payment to be created for a package.

func (*Session) GetServerInfo added in v0.1.5

func (s *Session) GetServerInfo() (*ServerInformation, error)

func (*Session) PlayerLookup added in v1.0.1

func (s *Session) PlayerLookup(user string) (*PlayerData, error)

func (*Session) RetrieveCommunityGoal added in v1.0.1

func (s *Session) RetrieveCommunityGoal(communityGoal int) (*CommunityGoal, error)

func (*Session) RetrievePayment added in v1.0.1

func (s *Session) RetrievePayment(transactionId string) (*Payment, error)

Retrive a payment made on your webstore by transaction ID.

func (*Session) TopUpGiftCard added in v1.0.1

func (s *Session) TopUpGiftCard(giftCardId string) (*GiftCard, error)

func (*Session) UpdatePackage added in v0.1.7

func (s *Session) UpdatePackage(packageId string, updateObject *UpdatePackageObject) error

func (*Session) UpdatePayment added in v1.0.1

func (s *Session) UpdatePayment(transactionId string, object *UpdatePaymentObject) error

type UpdatePackageObject added in v0.1.2

type UpdatePackageObject struct {
	Disabled bool   `json:"disabled"`
	Name     string `json:"name"`
	Price    int    `json:"price"`
}

type UpdatePaymentObject added in v1.0.1

type UpdatePaymentObject struct {
	Username string `json:"username"`
	Status   string `json:"status"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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