Documentation ¶
Index ¶
- type APITransaction
- type Balance
- type BalanceHistory
- type HistoryResponse
- type HistoryResponseWeek
- type ReferralHistory
- type ReferralsController
- type RewardsController
- type TransactionHistory
- type UserResponse
- type UserResponseDevice
- type UserResponseIntegration
- type UserResponseLevel
- type UserResponseThisWeek
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APITransaction ¶ added in v1.5.0
type APITransaction struct { // ChainID is the chain id of the chain on which the transaction took place. Important // values are 137 for Polygon, 1 for Ethereum. ChainID int64 `json:"chainId" example:"137"` // Time is the timestamp of the block in which the transaction took place, in RFC-3999 format. Time time.Time `json:"time" example:"2023-01-22T09:00:12Z"` // From is the address of the source of the value, in 0x-prefixed hex. From common.Address `json:"from" example:"0xf316832fbfe49f90df09eee019c2ece87fad3fac" swaggertype:"string"` // To is the address of the recipient of the value, in 0x-prefixed hex. To common.Address `json:"to" example:"0xc66d80f5063677425270013136ef9fa2bf1f9f1a" swaggertype:"string"` // Value is the amount of token being transferred. Divide by 10^18 to get what people // normally consider $DIMO. Value *big.Int `json:"value" example:"10000000000000000" swaggertype:"number"` // Type is a transaction type. Type *string `json:"type,omitempty" enums:"Baseline,Referrals,Marketplace"` // Description is a short elaboration of the Type or a generic, e.g., "Incoming transfer" message. Description string `json:"description"` }
type Balance ¶ added in v1.6.0
type Balance struct { // Time is the block timestamp of this balance update. Time time.Time `json:"time" swaggertype:"string" example:"2023-03-06T09:11:00Z"` // Balance is the total amount of $DIMO held at this time, across all chains. Balance *big.Int `json:"balance" swaggertype:"number" example:"237277217092548851191"` }
type BalanceHistory ¶ added in v1.6.0
type BalanceHistory struct {
BalanceHistory []Balance `json:"balanceHistory"`
}
type HistoryResponse ¶
type HistoryResponse struct {
Weeks []HistoryResponseWeek `json:"weeks"`
}
type HistoryResponseWeek ¶
type HistoryResponseWeek struct { // Start is the starting time of the issuance week. Start time.Time `json:"start" example:"2022-04-11T05:00:00Z"` // End is the starting time of the issuance week after this one. End time.Time `json:"end" example:"2022-04-18T05:00:00Z"` // Points is the number of points the user earned this week. Points int `json:"points" example:"4000"` // Tokens is the number of tokens the user earned this week. Tokens *big.Int `json:"tokens" example:"4000" swaggertype:"number"` }
type ReferralHistory ¶ added in v1.7.0
type ReferralsController ¶ added in v1.7.0
type ReferralsController struct { DB db.Store Logger *zerolog.Logger UsersClient pb_users.UserServiceClient Settings *config.Settings }
func (*ReferralsController) GetUserReferralHistory ¶ added in v1.7.0
func (r *ReferralsController) GetUserReferralHistory(c *fiber.Ctx) error
GetUserReferralHistory godoc @Description A summary of the user's referrals. @Success 200 {object} controllers.UserResponse @Security BearerAuth @Router /user/referrals [get]
type RewardsController ¶
type RewardsController struct { DB db.Store Logger *zerolog.Logger DataClient services.DeviceDataClient DefinitionsClient pb_defs.DeviceDefinitionServiceClient DevicesClient pb_devices.UserDeviceServiceClient UsersClient pb_users.UserServiceClient Settings *config.Settings Tokens []*contracts.Token }
func (*RewardsController) GetBalanceHistory ¶ added in v1.6.0
func (r *RewardsController) GetBalanceHistory(c *fiber.Ctx) error
GetBalanceHistory godoc @Description A summary of the user's DIMO balance across all chains. @Success 200 {object} controllers.BalanceHistory @Security BearerAuth @Router /user/history/balance [get]
func (*RewardsController) GetTransactionHistory ¶ added in v1.5.0
func (r *RewardsController) GetTransactionHistory(c *fiber.Ctx) error
GetTransactionHistory godoc @Description A summary of the user's DIMO transaction history, all time. @Success 200 {object} controllers.TransactionHistory @Security BearerAuth @Param type query string false "A label for a transaction type." Enums(Baseline, Referrals, Marketplace, Other) @Router /user/history/transactions [get]
func (*RewardsController) GetUserRewards ¶
func (r *RewardsController) GetUserRewards(c *fiber.Ctx) error
GetUserRewards godoc @Description A summary of the user's rewards. @Success 200 {object} controllers.UserResponse @Security BearerAuth @Router /user [get]
func (*RewardsController) GetUserRewardsHistory ¶
func (r *RewardsController) GetUserRewardsHistory(c *fiber.Ctx) error
GetUserRewardsHistory godoc @Description A summary of the user's rewards for past weeks. @Success 200 {object} controllers.HistoryResponse @Security BearerAuth @Router /user/history [get]
type TransactionHistory ¶ added in v1.5.0
type TransactionHistory struct {
Transactions []APITransaction `json:"transactions"`
}
type UserResponse ¶
type UserResponse struct { // Points is the user's total number of points, across all devices and issuance weeks. Points int `json:"points" example:"5000"` // Tokens is the number of tokens the user has earned, across all devices and issuance // weeks. Tokens *big.Int `json:"tokens" example:"1105000000000000000000000" swaggertype:"number"` // WalletBalance is the number of tokens held in the users's wallet, if he has a wallet // attached to the present account. WalletBalance *big.Int `json:"walletBalance" example:"1105000000000000000000000" swaggertype:"number"` // Devices is a list of the user's devices, together with some information about their // connectivity. Devices []*UserResponseDevice `json:"devices"` // ThisWeek describes the current issuance week. ThisWeek UserResponseThisWeek `json:"thisWeek"` }
type UserResponseDevice ¶
type UserResponseDevice struct { // ID is the user device ID used across all services. ID string `json:"id" example:"27cv7gVTh9h4RJuTsmJHpBcr4I9"` // Points is the total number of points that the device has earned across all weeks. Points int `json:"points" example:"5000"` // Tokens is the total number of tokens that the device has earned across all weeks. Tokens *big.Int `json:"tokens,omitempty" example:"5000" swaggertype:"number"` // ConnectedThisWeek is true if we've seen activity from the device during the current issuance // week. ConnectedThisWeek bool `json:"connectedThisWeek" example:"true"` // IntegrationsThisWeek details the integrations we've seen active this week. IntegrationsThisWeek []UserResponseIntegration `json:"integrationsThisWeek"` // LastActive is the last time we saw activity from the vehicle. LastActive *time.Time `json:"lastActive,omitempty" example:"2022-04-12T09:23:01Z"` // ConnectionStreak is what we consider the streak of the device to be. This may not literally // be the number of consecutive connected weeks, because the user may disconnect for a week // without penalty, or have the connection streak reduced after three weeks of inactivity. ConnectionStreak int `json:"connectionStreak" example:"4"` // DisconnectionStreak is the number of consecutive issuance weeks that the device has been // disconnected. This number resets to 0 as soon as a device earns rewards for a certain week. DisconnectionStreak int `json:"disconnectionStreak,omitempty" example:"0"` // Level is the level 1-4 of the device. This is fully determined by ConnectionStreak. Level UserResponseLevel `json:"level"` // Minted is true if the device has been minted on-chain. Minted bool `json:"minted"` // OptedIn is true if the user has agreed to the terms of service. OptedIn bool `json:"optedIn"` }
type UserResponseIntegration ¶
type UserResponseIntegration struct { // ID is the integration ID. ID string `json:"id" example:"27egBSLazAT7njT2VBjcISPIpiU"` // Vendor is the name of the integration vendor. At present, this uniquely determines the // integration. Vendor string `json:"vendor" example:"SmartCar"` DataThisWeek bool `json:"dataThisWeek"` // Points is the number of points a user earns for being connected with this integration // for a week. Points int `json:"points" example:"1000"` // OnChainPairingStatus is the on-chain pairing status of the integration. OnChainPairingStatus string `json:"onChainPairingStatus" enums:"Paired,Unpaired,NotApplicable" example:"Paired"` }
type UserResponseLevel ¶
type UserResponseLevel struct { // Number is the level number 1-4 Number int `json:"number" example:"2"` // MinWeeks is the minimum streak of weeks needed to enter this level. MinWeeks int `json:"minWeeks" example:"4"` // MaxWeeks is the last streak week at this level. In the next week, we enter the next level. MaxWeeks *int `json:"maxWeeks,omitempty" example:"20"` // StreakPoints is the number of points you earn per week at this level. StreakPoints int `json:"streakPoints" example:"1000"` }