bazaar

package module
v0.0.0-...-6ec50f1 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2015 License: MIT Imports: 10 Imported by: 0

README

Bazaar GoDoc

Simple Golang API wrapper for Cafebazaar purchase API in, You can find incomplete documentation on godoc.org.

Documentation

Overview

Bazaar is an wrapper for cafebazaar.ir purchase API

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

func NewClient

func NewClient(clientId string, clientSecret string, refreshToken string) (c Client, err error)

Create a new client and define it's configuration based on given argumans

func NewClientFromFile

func NewClientFromFile(path string) (c Client, err error)

Create a new client based on config file

func (*Client) PurchaseValidate

func (c *Client) PurchaseValidate(packageName string, productId string, purchaseToken string) (p Purchase, err error)

Validate a purchase

func (*Client) RefreshToken

func (c *Client) RefreshToken() error

Refresh access token using user credentials

func (*Client) SubscriptionCancel

func (c *Client) SubscriptionCancel(packageName string, subscriptionId string, purchaseToken string) error

Cancel a subscription

func (*Client) SubscriptionGet

func (c *Client) SubscriptionGet(packageName string, subscriptionId string, purchaseToken string) (s Subscription, err error)

Get status of a subscription

type Endpoint

type Endpoint struct {
	BaseUrl      string
	Vars         map[string]string
	Route        string
	AcceessToken string
}

Endpoint structure

func NewEndpoint

func NewEndpoint(route string) Endpoint

Create new endpoint

type Form

type Form map[string]string

Multipart map structure

func (Form) Build

func (f Form) Build() (body *bytes.Buffer, contentType string)

Create body of request based on the map fields, Also return content type

type Purchase

type Purchase struct {
	ConsumptionState int    `json:"consumptionState"`
	PurchaseState    int    `json:"purchaseState"`
	Kind             string `json:"kind"`
	DeveloperPayload string `json:"developerPayload"`
	PurchaseTime     int    `json:"purchaseTime"`
}

Purchase structure

type Subscription

type Subscription struct {
	Kind                    string `json:"kind"`
	InitiationTimestampMsec int    `json:"initiationTimestampMsec"`
	ValidUntilTimestampMsec int    `json:"validUntilTimestampMsec"`
	AutoRenewing            bool   `json:"autoRenewing"`
}

Subscription status

Jump to

Keyboard shortcuts

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