diff options
| author | DJ O'Leary <dijitol@proton.me> | 2026-09-03 03:05:48 +0200 |
|---|---|---|
| committer | DJ O'Leary <dijitol@proton.me> | 2026-09-03 03:05:48 +0200 |
| commit | e6a13e0aca32b8df8453e7ce3a02a5e0f88de609 (patch) | |
| tree | 65f76196c9826210d88f2f039bfc43da0d30ad03 | |
| parent | 581ef29c52a26612ee6056841abf8da5898dca92 (diff) | |
refactor(cardmarket,account): update responseBody struct to match actual response body
| -rw-r--r-- | src/cardmarket/account.go | 104 |
1 files changed, 57 insertions, 47 deletions
diff --git a/src/cardmarket/account.go b/src/cardmarket/account.go index 3baa747..3f9fbd2 100644 --- a/src/cardmarket/account.go +++ b/src/cardmarket/account.go @@ -29,53 +29,63 @@ func (c *ApiClient) GetAccountInformation(ctx context.Context) (Account, error) slog.DebugContext(ctx, "parsing body...", "respBodyBuf", string(respBodyBuf)) type responseBody struct { - UserID uint32 `json:"idUser"` - Username []byte `json:"username"` - Country []byte `json:"country"` - Type uint8 `json:"isCommercial"` - SellerStatus uint8 `json:"sellerActivation"` - RiskGroup uint8 `json:"riskGroup"` - Reputation uint8 `json:"reputation"` - ShipsFast uint8 `json:"shipsFast"` - SalesCount uint32 `json:"sellCount"` - SoldItemCount uint32 `json:"soldItems"` - AvgShippingTime uint8 `json:"avgShippingTime"` - OnVacation bool `json:"onVacation"` - DisplayLanguageID uint8 `json:"idDisplayLanguage"` - Name struct { - First []byte `json:"firstName"` - Last []byte `json:"lastName"` - } `json:"name"` - HomeAddress struct { - ReceiverName []byte `json:"name"` - Extra []byte `json:"extra"` - Street []byte `json:"street"` - PostCode []byte `json:"zip"` - City []byte `json:"city"` - Country []byte `json:"country"` - } `json:"homeAddress"` - Email []byte `json:"email"` - PhoneNumber []byte `json:"phoneNumber"` - VAT []byte `json:"vat"` - RegistrationDate []byte `json:"registerDate"` - IsActivated bool `json:"isActivated"` - Wallet struct { - TotalBalance float32 `json:"totalBalance"` - MoneyBalance float32 `json:"moneyBalance"` - BonusBalance float32 `json:"bonusBalance"` - UnpaidAmount float32 `json:"unpaidAmount"` - ProviderRechargeAmount float32 `json:"providerRechargeAmount"` - } `json:"moneyDetails"` - BankAccount struct { - AccountOwner []byte `json:"accountOwner"` - IBAN []byte `json:"iban"` - BIC []byte `json:"bic"` - BankName []byte `json:"bankName"` - } `json:"bankAccount"` - ArticlesInShoppingCart uint16 `json:"articlesInShoppingCart"` - UnreadMessages uint16 `json:"unreadMessages"` - MaySell bool `json:"maySell"` - Links map[string]string `json:"links"` + 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"` + } `json:"account"` + Links []struct { + Relationship string `json:"rel"` + Endpoint string `json:"href"` + Method string `json:"method"` + } `json:"links"` } respBody := new(responseBody) if err = json.Unmarshal(respBodyBuf, respBody); err != nil { |
