Documentation
¶
Index ¶
- Variables
- type Auth
- type BaseResponse
- type Client
- func (c *Client) MigrateDeviceID(user common.UserConfig, oldDeviceID string) 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 User
- type UserDataResponse
Constants ¶
This section is empty.
Variables ¶
var (
)
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) 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 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"`
}