pro

package
v0.0.0-...-b80b294 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2024 License: GPL-3.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func APIHandler

func APIHandler(proAPIHost string, userConfig common.UserConfig) http.Handler

APIHandler returns an HTTP handler that specifically looks for and properly handles pro server requests.

func NewHTTPClient

func NewHTTPClient(rt http.RoundTripper, timeout time.Duration) *http.Client

NewHTTPClient creates a new http.Client that is configured to use the given options and http.RoundTripper wrapped with proxied.AsRoundTripper to process requests

Types

type LinkCodeRedeemResponse

type LinkCodeRedeemResponse struct {
	*protos.BaseResponse `json:",inline"`
	Status               string `json:"status"`
	UserID               int64  `json:"userId"`
	Token                string `json:"token"`
}

type LinkCodeResponse

type LinkCodeResponse struct {
	*protos.BaseResponse `json:",inline"`
	Code                 string
	ExpireAt             int64
}

type LinkResponse

type LinkResponse struct {
	*protos.BaseResponse `json:",inline"`
	UserID               int    `json:"userID"`
	ProToken             string `json:"token"`
}

type OkResponse

type OkResponse struct {
	Status string `json:"status"`
}

type PaymentMethodsResponse

type PaymentMethodsResponse struct {
	*protos.BaseResponse `json:",inline"`
	Providers            map[string][]protos.PaymentMethod `json:"providers"`
	Plans                []protos.Plan                     `json:"plans"`
}

type PaymentRedirectResponse

type PaymentRedirectResponse struct {
	*protos.BaseResponse `json:",inline"`
	Redirect             string `json:"redirect"`
}

type PlansResponse

type PlansResponse struct {
	*protos.BaseResponse `json:",inline"`
	Plans                []protos.Plan `json:"plans"`
}

type ProClient

type ProClient interface {
	webclient.RESTClient
	EmailExists(ctx context.Context, email string) (*protos.BaseResponse, error)
	PaymentMethods(ctx context.Context) (*PaymentMethodsResponse, error)
	PaymentMethodsV4(ctx context.Context) (*PaymentMethodsResponse, error)
	PaymentRedirect(ctx context.Context, req *protos.PaymentRedirectRequest) (*PaymentRedirectResponse, error)
	Plans(ctx context.Context) (*PlansResponse, error)
	RedeemResellerCode(ctx context.Context, req *protos.RedeemResellerCodeRequest) (*protos.BaseResponse, error)
	UserCreate(ctx context.Context) (*UserDataResponse, error)
	UserData(ctx context.Context) (*UserDataResponse, error)
	PurchaseRequest(ctx context.Context, data map[string]interface{}) (*PurchaseResponse, error)
	RestorePurchase(ctx context.Context, req map[string]interface{}) (*OkResponse, error)
	EmailRequest(ctx context.Context, email string) (*OkResponse, error)
	ReferralAttach(ctx context.Context, refCode string) (bool, error)
	//Device Linking
	LinkCodeApprove(ctx context.Context, code string) (*protos.BaseResponse, error)
	LinkCodeRequest(ctx context.Context, deviceName string) (*LinkCodeResponse, error)
	LinkCodeRedeem(ctx context.Context, deviceName string, deviceCode string) (*LinkCodeRedeemResponse, error)
	UserLinkCodeRequest(ctx context.Context, deviceId string, email string) (bool, error)
	UserLinkValidate(ctx context.Context, code string) (*UserRecovery, error)
	DeviceRemove(ctx context.Context, deviceId string) (*LinkResponse, error)
	DeviceAdd(ctx context.Context, deviceName string) (bool, error)
}

func NewClient

func NewClient(baseURL string, opts *webclient.Opts) ProClient

NewClient creates a new instance of ProClient

type PurchaseResponse

type PurchaseResponse struct {
	*protos.BaseResponse `json:",inline"`
	PaymentStatus        string      `json:"paymentStatus"`
	Plan                 protos.Plan `json:"plan"`
	Status               string      `json:"status"`
}

type RestorePurchaseRequest

type RestorePurchaseRequest struct {
	Provider   string
	Token      string
	DeviceName string
	Email      string
	Code       string
}

Request

type UserDataResponse

type UserDataResponse struct {
	*protos.BaseResponse `json:",inline"`
	*protos.User         `json:",inline"`
}

type UserRecovery

type UserRecovery struct {
	Status string `json:"status"`
	UserID int64  `json:"userID"`
	Token  string `json:"token"`
}

Jump to

Keyboard shortcuts

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