Browse Source

User transactions API

master
Fornax 3 years ago
parent
commit
617387c4f7
  1. 2
      pixelapi/subscription.go
  2. 16
      pixelapi/user.go

2
pixelapi/subscription.go

@ -32,6 +32,8 @@ type SubscriptionType struct {
FileExpiryDays int `json:"file_expiry_days"` FileExpiryDays int `json:"file_expiry_days"`
DirectLinkingBandwidth int64 `json:"direct_linking_bandwidth"` DirectLinkingBandwidth int64 `json:"direct_linking_bandwidth"`
StorageSpace int64 `json:"storage_space"` StorageSpace int64 `json:"storage_space"`
PricePerTBStorage int64 `json:"price_per_tb_storage"`
PricePerTBBandwidth int64 `json:"price_per_tb_bandwidth"`
} }
// GetSubscriptionID returns the subscription object identified by the given ID // GetSubscriptionID returns the subscription object identified by the given ID

16
pixelapi/user.go

@ -15,6 +15,7 @@ type UserInfo struct {
Subscription SubscriptionType `json:"subscription"` Subscription SubscriptionType `json:"subscription"`
StorageSpaceUsed int64 `json:"storage_space_used"` StorageSpaceUsed int64 `json:"storage_space_used"`
IsAdmin bool `json:"is_admin"` IsAdmin bool `json:"is_admin"`
BalanceMicroEUR int64 `json:"balance_micro_eur"`
} }
// UserSession is one user session // UserSession is one user session
@ -101,6 +102,21 @@ func (p *PixelAPI) GetUserLists() (resp ListInfoSlice, err error) {
return resp, p.jsonRequest("GET", "user/lists", &resp) return resp, p.jsonRequest("GET", "user/lists", &resp)
} }
type UserTransaction struct {
Time time.Time `json:"time"`
NewBalance int64 `json:"new_balance"`
DepositAmount int64 `json:"deposit_amount"`
SubscriptionCharge int64 `json:"subscription_charge"`
StorageCharge int64 `json:"storage_charge"`
StorageUsed int64 `json:"storage_used"`
BandwidthCharge int64 `json:"bandwidth_charge"`
BandwidthUsed int64 `json:"bandwidth_used"`
}
func (p *PixelAPI) GetUserTransactions() (resp []UserTransaction, err error) {
return resp, p.jsonRequest("GET", "user/transactions", &resp)
}
// PutUserPassword changes the user's password // PutUserPassword changes the user's password
func (p *PixelAPI) PutUserPassword(oldPW, newPW string) (err error) { func (p *PixelAPI) PutUserPassword(oldPW, newPW string) (err error) {
return p.form( return p.form(

Loading…
Cancel
Save