diff options
| author | DJ O'Leary <dijitol@proton.me> | 2026-09-07 03:13:01 +0200 |
|---|---|---|
| committer | DJ O'Leary <dijitol@proton.me> | 2026-09-07 03:13:01 +0200 |
| commit | 2f61b07aea82fa0f5b98686bdfeba2e297c7b21b (patch) | |
| tree | b55f588e935b11decd782e7bd0a6c98f060e1654 /src/cardmarket/handlers/account.go | |
| parent | 5d3efcc64fc9664e061b44659f85aeec03a56685 (diff) | |
Diffstat (limited to 'src/cardmarket/handlers/account.go')
| -rw-r--r-- | src/cardmarket/handlers/account.go | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/src/cardmarket/handlers/account.go b/src/cardmarket/handlers/account.go new file mode 100644 index 0000000..213766d --- /dev/null +++ b/src/cardmarket/handlers/account.go @@ -0,0 +1,72 @@ +package handlers + +import ( + "context" + + "codeberg.org/dijitol/trading_post/src/cardmarket" +) + +type Account struct { + UserID uint32 `json:"idUser"` + Username string `json:"username"` + Type uint8 `json:"isCommercial"` + Reputation uint8 `json:"reputation"` + SalesCount uint32 `json:"sellCount"` + OnVacation bool `json:"onVacation"` + Country string `json:"country"` + MaySell bool `json:"maySell"` + SellerStatus uint8 `json:"sellerActivation"` + ShipsFast int8 `json:"shipsFast"` + SoldItemCount uint32 `json:"soldItems"` + AvgShippingTime uint8 `json:"avgShippingTime"` + DisplayLanguageID uint8 `json:"idDisplayLanguage"` + Name struct { + First string `json:"firstName"` + Last string `json:"lastName"` + } `json:"name"` + HomeAddress struct { + ReceiverName string `json:"name"` + Extra string `json:"extra"` + Street string `json:"street"` + PostCode string `json:"zip"` + City string `json:"city"` + Country string `json:"country"` + } `json:"homeAddress"` + Email string `json:"email"` + PhoneNumber string `json:"phoneNumber"` + VAT string `json:"vat"` + LegalInformation string `json:"legalInformation"` + RegistrationDate string `json:"registerDate"` + IsActivated bool `json:"isActivated"` + BankAccount struct { + AccountOwner string `json:"accountOwner"` + IBAN string `json:"iban"` + BIC string `json:"bic"` + BankName string `json:"bankName"` + } `json:"bankAccount"` + ArticlesInShoppingCart uint16 `json:"articlesInShoppingCart"` + UnreadMessages uint16 `json:"unreadMessages"` + Wallet struct { + TotalBalance float32 `json:"totalBalance"` + MoneyBalance float32 `json:"moneyBalance"` + BonusBalance float32 `json:"bonusBalance"` + UnpaidAmount float32 `json:"unpaidAmount"` + ProviderRechargeAmount float32 `json:"providerRechargeAmount"` + CurrencyID uint8 `json:"idCurrency"` + CurrencyCode string `json:"currencyCode"` + } `json:"moneyDetails"` + RiskGroup uint8 `json:"riskGroup"` + LossPercentage string `json:"lossPercentage"` +} + +func GetAccountInformation(ctx context.Context, c *cardmarket.ApiClient) (Account, error) { + type responseBody struct { + Account Account `json:"account"` + Links cardmarket.Links `json:"links"` + } + respBody := &responseBody{} + if err := c.Get(ctx, "/account", nil, respBody); err != nil { + return Account{}, err + } + return respBody.Account, nil +} |
