Documentation ¶
Index ¶
- Variables
- type Auth
- type BaseResponse
- type Client
- func (c *Client) MigrateDeviceID(user common.UserConfig, oldDeviceID string) error
- func (c *Client) PaymentMethods(user common.UserConfig) (*paymentMethodsResponse, error)
- func (c *Client) Plans(user common.UserConfig) (*plansResponse, error)
- func (c *Client) RecoverProAccount(user common.UserConfig, emailAddress string) (*LinkResponse, error)
- func (c *Client) RedeemResellerCode(user common.UserConfig, ...) (*BaseResponse, error)
- func (c *Client) RequestDeviceLinkingCode(user common.UserConfig, deviceName string) (*LinkCodeResponse, error)
- func (c *Client) RequestRecoveryEmail(user common.UserConfig, deviceName, emailAddress string) (err error)
- func (c *Client) UserCreate(user common.UserConfig) (res *UserDataResponse, err error)
- func (c *Client) UserData(user common.UserConfig) (*UserDataResponse, error)
- func (c *Client) ValidateDeviceLinkingCode(user common.UserConfig, deviceName, code string) (*LinkResponse, error)
- func (c *Client) ValidateRecoveryCode(user common.UserConfig, code string) (*LinkResponse, error)
- type Device
- type LinkCodeResponse
- type LinkResponse
- type PaymentMethod
- func (*PaymentMethod) Descriptor() ([]byte, []int)deprecated
- func (x *PaymentMethod) GetMethod() string
- func (x *PaymentMethod) GetProviders() []*PaymentProvider
- func (*PaymentMethod) ProtoMessage()
- func (x *PaymentMethod) ProtoReflect() protoreflect.Message
- func (x *PaymentMethod) Reset()
- func (x *PaymentMethod) String() string
- type PaymentMethodsResponse
- func (*PaymentMethodsResponse) Descriptor() ([]byte, []int)deprecated
- func (x *PaymentMethodsResponse) GetProviders() map[string]*structpb.ListValue
- func (*PaymentMethodsResponse) ProtoMessage()
- func (x *PaymentMethodsResponse) ProtoReflect() protoreflect.Message
- func (x *PaymentMethodsResponse) Reset()
- func (x *PaymentMethodsResponse) String() string
- type PaymentProvider
- func (*PaymentProvider) Descriptor() ([]byte, []int)deprecated
- func (x *PaymentProvider) GetData() map[string]string
- func (x *PaymentProvider) GetName() string
- func (*PaymentProvider) ProtoMessage()
- func (x *PaymentProvider) ProtoReflect() protoreflect.Message
- func (x *PaymentProvider) Reset()
- func (x *PaymentProvider) String() string
- type Plan
- func (*Plan) Descriptor() ([]byte, []int)deprecated
- func (x *Plan) GetBestValue() bool
- func (x *Plan) GetDescription() string
- func (x *Plan) GetExpectedMonthlyPrice() map[string]int64
- func (x *Plan) GetFormattedBonus() string
- func (x *Plan) GetId() string
- func (x *Plan) GetOneMonthCost() string
- func (x *Plan) GetPrice() map[string]int64
- func (x *Plan) GetRenewalText() string
- func (x *Plan) GetTotalCost() string
- func (x *Plan) GetTotalCostBilledOneTime() string
- func (x *Plan) GetUsdPrice() int64
- func (*Plan) ProtoMessage()
- func (x *Plan) ProtoReflect() protoreflect.Message
- func (x *Plan) Reset()
- func (x *Plan) String() string
- type PlansResponse
- type Provider
- type PurchaseRequest
- func (*PurchaseRequest) Descriptor() ([]byte, []int)deprecated
- func (x *PurchaseRequest) GetCardNumber() string
- func (x *PurchaseRequest) GetCurrency() string
- func (x *PurchaseRequest) GetCvc() string
- func (x *PurchaseRequest) GetDeviceName() string
- func (x *PurchaseRequest) GetEmail() string
- func (x *PurchaseRequest) GetExpDate() string
- func (x *PurchaseRequest) GetPlan() string
- func (x *PurchaseRequest) GetProvider() Provider
- func (x *PurchaseRequest) GetResellerCode() string
- func (x *PurchaseRequest) GetStripeEmail() string
- func (x *PurchaseRequest) GetStripePublicKey() string
- func (x *PurchaseRequest) GetStripeToken() string
- func (x *PurchaseRequest) GetToken() string
- func (*PurchaseRequest) ProtoMessage()
- func (x *PurchaseRequest) ProtoReflect() protoreflect.Message
- func (x *PurchaseRequest) Reset()
- func (x *PurchaseRequest) String() string
- type PurchaseResponse
- type User
- type UserDataResponse
Constants ¶
This section is empty.
Variables ¶
var ( Provider_name = map[int32]string{ 0: "PROVIDER_UNSET", 1: "STRIPE", 2: "FREEKASSA", } Provider_value = map[string]int32{ "PROVIDER_UNSET": 0, "STRIPE": 1, "FREEKASSA": 2, } )
Enum value maps for Provider.
var (
)var File_pro_client_api_proto protoreflect.FileDescriptor
Functions ¶
This section is empty.
Types ¶
type BaseResponse ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func NewClient ¶
func NewClient(httpClient *http.Client, preparePro func(r *http.Request, uc common.UserConfig)) *Client
NewClient creates a new pro client.
func (*Client) MigrateDeviceID ¶
func (c *Client) MigrateDeviceID(user common.UserConfig, oldDeviceID string) error
MigrateDeviceID migrates from the old device ID scheme to the new
func (*Client) PaymentMethods ¶ added in v7.6.34
func (c *Client) PaymentMethods(user common.UserConfig) (*paymentMethodsResponse, error)
PaymentMethods returns a list of payment options available to the given user
func (*Client) Plans ¶ added in v7.6.34
func (c *Client) Plans(user common.UserConfig) (*plansResponse, error)
Plans returns a list of Pro plans
func (*Client) RecoverProAccount ¶
func (c *Client) RecoverProAccount(user common.UserConfig, emailAddress string) (*LinkResponse, error)
RecoverProAccount attempts to recover an existing Pro account linked to this email address and device ID
func (*Client) RedeemResellerCode ¶
func (c *Client) RedeemResellerCode(user common.UserConfig, emailAddress, resellerCode, deviceName, currency string) (*BaseResponse, error)
RedeemResellerCode redeems a reseller code for the given user
Note: In reality, the response for this route from pro-server is not BaseResponse but of this type https://github.com/getlantern/pro-server-neu/blob/34bcdc042e983bf9504014aa066bba6bdedcebdb/handlers/purchase.go#L201. That being said, we don't really care about the response from pro-server here. We just wanna know if it succeeded or failed, which is encapsulated in the fields of BaseResponse.
func (*Client) RequestDeviceLinkingCode ¶
func (c *Client) RequestDeviceLinkingCode(user common.UserConfig, deviceName string) (*LinkCodeResponse, error)
RequestDeviceLinkingCode requests a new device linking code to allow linking the current device to a pro account via an existing pro device.
func (*Client) RequestRecoveryEmail ¶
func (c *Client) RequestRecoveryEmail(user common.UserConfig, deviceName, emailAddress string) (err error)
RequestRecoveryEmail requests an account recovery email for linking to an existing pro account
func (*Client) UserCreate ¶
func (c *Client) UserCreate(user common.UserConfig) (res *UserDataResponse, err error)
UserCreate creates an user without asking for any payment.
func (*Client) UserData ¶
func (c *Client) UserData(user common.UserConfig) (*UserDataResponse, error)
UserData Returns all user data, including payments, referrals and all available fields.
func (*Client) ValidateDeviceLinkingCode ¶
func (c *Client) ValidateDeviceLinkingCode(user common.UserConfig, deviceName, code string) (*LinkResponse, error)
ValidateDeviceLinkingCode validates a device linking code to allow linking the current device to a pro account via an existing pro device.
func (*Client) ValidateRecoveryCode ¶
func (c *Client) ValidateRecoveryCode(user common.UserConfig, code string) (*LinkResponse, error)
ValidateRecoveryCode validates the given recovery code and finishes linking the device, returning the user_id and pro_token for the account.
type LinkCodeResponse ¶
type LinkCodeResponse struct { BaseResponse Code string ExpireAt int64 }
type LinkResponse ¶
type LinkResponse struct { BaseResponse UserID int `json:"userID"` ProToken string `json:"token"` }
type PaymentMethod ¶ added in v7.6.34
type PaymentMethod struct { Method string `protobuf:"bytes,1,opt,name=method,proto3" json:"method,omitempty"` Providers []*PaymentProvider `protobuf:"bytes,2,rep,name=providers,proto3" json:"providers,omitempty"` // contains filtered or unexported fields }
func (*PaymentMethod) Descriptor
deprecated
added in
v7.6.34
func (*PaymentMethod) Descriptor() ([]byte, []int)
Deprecated: Use PaymentMethod.ProtoReflect.Descriptor instead.
func (*PaymentMethod) GetMethod ¶ added in v7.6.34
func (x *PaymentMethod) GetMethod() string
func (*PaymentMethod) GetProviders ¶ added in v7.6.34
func (x *PaymentMethod) GetProviders() []*PaymentProvider
func (*PaymentMethod) ProtoMessage ¶ added in v7.6.34
func (*PaymentMethod) ProtoMessage()
func (*PaymentMethod) ProtoReflect ¶ added in v7.6.34
func (x *PaymentMethod) ProtoReflect() protoreflect.Message
func (*PaymentMethod) Reset ¶ added in v7.6.34
func (x *PaymentMethod) Reset()
func (*PaymentMethod) String ¶ added in v7.6.34
func (x *PaymentMethod) String() string
type PaymentMethodsResponse ¶ added in v7.6.34
type PaymentMethodsResponse struct { Providers map[string]*structpb.ListValue `` /* 159-byte string literal not displayed */ // contains filtered or unexported fields }
func (*PaymentMethodsResponse) Descriptor
deprecated
added in
v7.6.34
func (*PaymentMethodsResponse) Descriptor() ([]byte, []int)
Deprecated: Use PaymentMethodsResponse.ProtoReflect.Descriptor instead.
func (*PaymentMethodsResponse) GetProviders ¶ added in v7.6.34
func (x *PaymentMethodsResponse) GetProviders() map[string]*structpb.ListValue
func (*PaymentMethodsResponse) ProtoMessage ¶ added in v7.6.34
func (*PaymentMethodsResponse) ProtoMessage()
func (*PaymentMethodsResponse) ProtoReflect ¶ added in v7.6.34
func (x *PaymentMethodsResponse) ProtoReflect() protoreflect.Message
func (*PaymentMethodsResponse) Reset ¶ added in v7.6.34
func (x *PaymentMethodsResponse) Reset()
func (*PaymentMethodsResponse) String ¶ added in v7.6.34
func (x *PaymentMethodsResponse) String() string
type PaymentProvider ¶ added in v7.6.34
type PaymentProvider struct { Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` Data map[string]string `` /* 149-byte string literal not displayed */ // contains filtered or unexported fields }
func (*PaymentProvider) Descriptor
deprecated
added in
v7.6.34
func (*PaymentProvider) Descriptor() ([]byte, []int)
Deprecated: Use PaymentProvider.ProtoReflect.Descriptor instead.
func (*PaymentProvider) GetData ¶ added in v7.6.34
func (x *PaymentProvider) GetData() map[string]string
func (*PaymentProvider) GetName ¶ added in v7.6.34
func (x *PaymentProvider) GetName() string
func (*PaymentProvider) ProtoMessage ¶ added in v7.6.34
func (*PaymentProvider) ProtoMessage()
func (*PaymentProvider) ProtoReflect ¶ added in v7.6.34
func (x *PaymentProvider) ProtoReflect() protoreflect.Message
func (*PaymentProvider) Reset ¶ added in v7.6.34
func (x *PaymentProvider) Reset()
func (*PaymentProvider) String ¶ added in v7.6.34
func (x *PaymentProvider) String() string
type Plan ¶ added in v7.6.34
type Plan struct { Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` BestValue bool `protobuf:"varint,3,opt,name=bestValue,proto3" json:"bestValue,omitempty"` UsdPrice int64 `protobuf:"varint,4,opt,name=usdPrice,proto3" json:"usdPrice,omitempty"` Price map[string]int64 `` /* 152-byte string literal not displayed */ ExpectedMonthlyPrice map[string]int64 `` /* 182-byte string literal not displayed */ TotalCostBilledOneTime string `protobuf:"bytes,7,opt,name=totalCostBilledOneTime,proto3" json:"totalCostBilledOneTime,omitempty"` OneMonthCost string `protobuf:"bytes,8,opt,name=oneMonthCost,proto3" json:"oneMonthCost,omitempty"` TotalCost string `protobuf:"bytes,9,opt,name=totalCost,proto3" json:"totalCost,omitempty"` FormattedBonus string `protobuf:"bytes,10,opt,name=formattedBonus,proto3" json:"formattedBonus,omitempty"` RenewalText string `protobuf:"bytes,11,opt,name=renewalText,proto3" json:"renewalText,omitempty"` // contains filtered or unexported fields }
func (*Plan) Descriptor
deprecated
added in
v7.6.34
func (*Plan) GetBestValue ¶ added in v7.6.34
func (*Plan) GetDescription ¶ added in v7.6.34
func (*Plan) GetExpectedMonthlyPrice ¶ added in v7.6.34
func (*Plan) GetFormattedBonus ¶ added in v7.6.34
func (*Plan) GetOneMonthCost ¶ added in v7.6.34
func (*Plan) GetRenewalText ¶ added in v7.6.34
func (*Plan) GetTotalCost ¶ added in v7.6.34
func (*Plan) GetTotalCostBilledOneTime ¶ added in v7.6.34
func (*Plan) GetUsdPrice ¶ added in v7.6.34
func (*Plan) ProtoMessage ¶ added in v7.6.34
func (*Plan) ProtoMessage()
func (*Plan) ProtoReflect ¶ added in v7.6.34
func (x *Plan) ProtoReflect() protoreflect.Message
type PlansResponse ¶ added in v7.6.34
type PlansResponse struct { Plans []*Plan `protobuf:"bytes,1,rep,name=plans,proto3" json:"plans,omitempty"` // contains filtered or unexported fields }
func (*PlansResponse) Descriptor
deprecated
added in
v7.6.34
func (*PlansResponse) Descriptor() ([]byte, []int)
Deprecated: Use PlansResponse.ProtoReflect.Descriptor instead.
func (*PlansResponse) GetPlans ¶ added in v7.6.34
func (x *PlansResponse) GetPlans() []*Plan
func (*PlansResponse) ProtoMessage ¶ added in v7.6.34
func (*PlansResponse) ProtoMessage()
func (*PlansResponse) ProtoReflect ¶ added in v7.6.34
func (x *PlansResponse) ProtoReflect() protoreflect.Message
func (*PlansResponse) Reset ¶ added in v7.6.34
func (x *PlansResponse) Reset()
func (*PlansResponse) String ¶ added in v7.6.34
func (x *PlansResponse) String() string
type Provider ¶ added in v7.6.34
type Provider int32
func (Provider) Descriptor ¶ added in v7.6.34
func (Provider) Descriptor() protoreflect.EnumDescriptor
func (Provider) EnumDescriptor
deprecated
added in
v7.6.34
func (Provider) Number ¶ added in v7.6.34
func (x Provider) Number() protoreflect.EnumNumber
func (Provider) Type ¶ added in v7.6.34
func (Provider) Type() protoreflect.EnumType
type PurchaseRequest ¶ added in v7.6.34
type PurchaseRequest struct { Provider Provider `protobuf:"varint,1,opt,name=provider,proto3,enum=Provider" json:"provider,omitempty"` Email string `protobuf:"bytes,2,opt,name=email,proto3" json:"email,omitempty"` Plan string `protobuf:"bytes,3,opt,name=plan,proto3" json:"plan,omitempty"` CardNumber string `protobuf:"bytes,4,opt,name=cardNumber,proto3" json:"cardNumber,omitempty"` ExpDate string `protobuf:"bytes,5,opt,name=expDate,proto3" json:"expDate,omitempty"` Cvc string `protobuf:"bytes,6,opt,name=cvc,proto3" json:"cvc,omitempty"` Currency string `protobuf:"bytes,7,opt,name=currency,proto3" json:"currency,omitempty"` DeviceName string `protobuf:"bytes,8,opt,name=deviceName,proto3" json:"deviceName,omitempty"` StripePublicKey string `protobuf:"bytes,9,opt,name=stripePublicKey,proto3" json:"stripePublicKey,omitempty"` StripeEmail string `protobuf:"bytes,10,opt,name=stripeEmail,proto3" json:"stripeEmail,omitempty"` StripeToken string `protobuf:"bytes,11,opt,name=stripeToken,proto3" json:"stripeToken,omitempty"` Token string `protobuf:"bytes,12,opt,name=token,proto3" json:"token,omitempty"` ResellerCode string `protobuf:"bytes,13,opt,name=resellerCode,proto3" json:"resellerCode,omitempty"` // contains filtered or unexported fields }
func (*PurchaseRequest) Descriptor
deprecated
added in
v7.6.34
func (*PurchaseRequest) Descriptor() ([]byte, []int)
Deprecated: Use PurchaseRequest.ProtoReflect.Descriptor instead.
func (*PurchaseRequest) GetCardNumber ¶ added in v7.6.34
func (x *PurchaseRequest) GetCardNumber() string
func (*PurchaseRequest) GetCurrency ¶ added in v7.6.34
func (x *PurchaseRequest) GetCurrency() string
func (*PurchaseRequest) GetCvc ¶ added in v7.6.34
func (x *PurchaseRequest) GetCvc() string
func (*PurchaseRequest) GetDeviceName ¶ added in v7.6.34
func (x *PurchaseRequest) GetDeviceName() string
func (*PurchaseRequest) GetEmail ¶ added in v7.6.34
func (x *PurchaseRequest) GetEmail() string
func (*PurchaseRequest) GetExpDate ¶ added in v7.6.34
func (x *PurchaseRequest) GetExpDate() string
func (*PurchaseRequest) GetPlan ¶ added in v7.6.34
func (x *PurchaseRequest) GetPlan() string
func (*PurchaseRequest) GetProvider ¶ added in v7.6.34
func (x *PurchaseRequest) GetProvider() Provider
func (*PurchaseRequest) GetResellerCode ¶ added in v7.6.34
func (x *PurchaseRequest) GetResellerCode() string
func (*PurchaseRequest) GetStripeEmail ¶ added in v7.6.34
func (x *PurchaseRequest) GetStripeEmail() string
func (*PurchaseRequest) GetStripePublicKey ¶ added in v7.6.34
func (x *PurchaseRequest) GetStripePublicKey() string
func (*PurchaseRequest) GetStripeToken ¶ added in v7.6.34
func (x *PurchaseRequest) GetStripeToken() string
func (*PurchaseRequest) GetToken ¶ added in v7.6.34
func (x *PurchaseRequest) GetToken() string
func (*PurchaseRequest) ProtoMessage ¶ added in v7.6.34
func (*PurchaseRequest) ProtoMessage()
func (*PurchaseRequest) ProtoReflect ¶ added in v7.6.34
func (x *PurchaseRequest) ProtoReflect() protoreflect.Message
func (*PurchaseRequest) Reset ¶ added in v7.6.34
func (x *PurchaseRequest) Reset()
func (*PurchaseRequest) String ¶ added in v7.6.34
func (x *PurchaseRequest) String() string
type PurchaseResponse ¶ added in v7.6.34
type PurchaseResponse struct { Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` // contains filtered or unexported fields }
func (*PurchaseResponse) Descriptor
deprecated
added in
v7.6.34
func (*PurchaseResponse) Descriptor() ([]byte, []int)
Deprecated: Use PurchaseResponse.ProtoReflect.Descriptor instead.
func (*PurchaseResponse) GetSuccess ¶ added in v7.6.34
func (x *PurchaseResponse) GetSuccess() bool
func (*PurchaseResponse) ProtoMessage ¶ added in v7.6.34
func (*PurchaseResponse) ProtoMessage()
func (*PurchaseResponse) ProtoReflect ¶ added in v7.6.34
func (x *PurchaseResponse) ProtoReflect() protoreflect.Message
func (*PurchaseResponse) Reset ¶ added in v7.6.34
func (x *PurchaseResponse) Reset()
func (*PurchaseResponse) String ¶ added in v7.6.34
func (x *PurchaseResponse) String() string
type User ¶
type User struct { Auth `json:",inline"` Email string `json:"email"` PhoneNumber string `json:"telephone"` UserStatus string `json:"userStatus"` Locale string `json:"locale"` Expiration int64 `json:"expiration"` Devices []Device `json:"devices"` Code string `json:"code"` ExpireAt int64 `json:"expireAt"` Referral string `json:"referral"` YinbiEnabled bool `json:"yinbiEnabled"` }
type UserDataResponse ¶
type UserDataResponse struct { BaseResponse User `json:",inline"` }