v0.5.0: batch-first API, player/leaderboard handles, unified naming, Storage is global project storage, catalog list methods
CI / build (push) Successful in 49s
CI / build (push) Successful in 49s
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
package rudder
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"hub.rudder.build/rudder/rudder-go-sdk/models"
|
||||
)
|
||||
|
||||
type PlayerWalletHandle struct {
|
||||
playerID string
|
||||
wallet *WalletService
|
||||
}
|
||||
|
||||
type AdjustPlayerWalletParameters struct {
|
||||
IdempotencyKey string
|
||||
CurrencyCode string
|
||||
Amount int64
|
||||
Reason string
|
||||
}
|
||||
|
||||
func (h *PlayerWalletHandle) Adjust(ctx context.Context, parameters AdjustPlayerWalletParameters) (*models.WalletDetails, error) {
|
||||
wallets, err := h.wallet.Adjust(ctx, AdjustWalletParameters{
|
||||
IdempotencyKey: parameters.IdempotencyKey,
|
||||
Items: []models.BatchAdjustPlayerWalletsItem{{
|
||||
PlayerID: h.playerID,
|
||||
CurrencyCode: parameters.CurrencyCode,
|
||||
Amount: parameters.Amount,
|
||||
Reason: parameters.Reason,
|
||||
}},
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &wallets[0], nil
|
||||
}
|
||||
|
||||
func (h *PlayerWalletHandle) History(ctx context.Context, parameters WalletHistoryParameters) (*models.GetWalletHistoryResponse, error) {
|
||||
return h.wallet.History(ctx, h.playerID, parameters)
|
||||
}
|
||||
Reference in New Issue
Block a user