Skip to content

Commit 3936e98

Browse files
feat: Add pricing models to represent the various pricing objects from the API response (#52)
1 parent 078d89a commit 3936e98

File tree

5 files changed

+191
-0
lines changed

5 files changed

+191
-0
lines changed

src/main/kotlin/net/tcgdex/sdk/models/Card.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,10 @@ data class Card internal constructor(
6262
*/
6363
val set: SetResume,
6464

65+
/**
66+
* Market pricing information
67+
*/
68+
val pricing: Pricing?,
6569

6670
/**
6771
* the Pokémon Pokédex IDs (multiple if multiple pokémon appears on the card)
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package net.tcgdex.sdk.models
2+
3+
import net.tcgdex.sdk.internal.Model
4+
import net.tcgdex.sdk.models.subs.PricingCardMarket
5+
import net.tcgdex.sdk.models.subs.PricingTcgPlayer
6+
7+
/**
8+
* Pokémon TCG Pricing class
9+
*/
10+
data class Pricing internal constructor(
11+
val tcgplayer: PricingTcgPlayer?,
12+
val cardmarket: PricingCardMarket?
13+
) : Model()
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
package net.tcgdex.sdk.models.subs
2+
3+
import com.google.gson.annotations.SerializedName
4+
import net.tcgdex.sdk.internal.Model
5+
6+
/**
7+
* Pokémon TCG PricingCardMarket class
8+
*/
9+
data class PricingCardMarket internal constructor(
10+
/**
11+
* Indicate when is the last time it was fetched
12+
*/
13+
val updated: String?,
14+
15+
/**
16+
* Indicate the unit in which the card is sold
17+
*/
18+
val unit: String?,
19+
20+
/**
21+
* Average selling price (non-foil)
22+
*/
23+
val avg: Float?,
24+
25+
/**
26+
* Lowest market price (non-foil)
27+
*/
28+
val low: Float?,
29+
30+
/**
31+
* Trend price from charts (non-foil)
32+
*/
33+
val trend: Float?,
34+
35+
/**
36+
* Average price (last 24 hours)
37+
*/
38+
val avg1: Float?,
39+
40+
/**
41+
* Average price (last 7 days)
42+
*/
43+
val avg7: Float?,
44+
45+
/**
46+
* Average price (last 30 days)
47+
*/
48+
val avg30: Float?,
49+
50+
/**
51+
* Average selling price (foil)
52+
*/
53+
@SerializedName("avg-holo")
54+
val avgHolo: Float?,
55+
56+
/**
57+
* Lowest market price (foil)
58+
*/
59+
@SerializedName("low-holo")
60+
val lowHolo: Float?,
61+
62+
/**
63+
* Trend price from charts (foil)
64+
*/
65+
@SerializedName("trend-holo")
66+
val trendHolo: Float?,
67+
68+
/**
69+
* Average price (last 24 hours, foil)
70+
*/
71+
@SerializedName("avg1-holo")
72+
val avg1Holo: Float?,
73+
74+
/**
75+
* Average price (last 7 days, foil)
76+
*/
77+
@SerializedName("avg7-holo")
78+
val avg7Holo: Float?,
79+
80+
/**
81+
* Average price (last 30 days, foil)
82+
*/
83+
@SerializedName("avg30-holo")
84+
val avg30Holo: Float?
85+
) : Model()
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
package net.tcgdex.sdk.models.subs
2+
3+
import com.google.gson.annotations.SerializedName
4+
import net.tcgdex.sdk.internal.Model
5+
6+
/**
7+
* Pokémon TCG PricingTcgPlayer class
8+
*/
9+
data class PricingTcgPlayer internal constructor(
10+
/**
11+
* Indicate when is the last time it was fetched
12+
*/
13+
val updated: String,
14+
15+
/**
16+
* Indicate the unit in which the card is sold
17+
*/
18+
val unit: String,
19+
20+
/**
21+
* Standard non-foil cards
22+
*/
23+
val normal: PricingTcgPlayerVariant?,
24+
25+
/**
26+
* Holofoil finish cards
27+
*/
28+
val holoFoil: PricingTcgPlayerVariant?,
29+
30+
/**
31+
* Reverse holofoil cards
32+
*/
33+
@SerializedName("reverse-holofoil")
34+
val reverseHolofoil: PricingTcgPlayerVariant?,
35+
36+
/**
37+
* First edition cards
38+
*/
39+
@SerializedName("1st-edition")
40+
val firstEdition: PricingTcgPlayerVariant?,
41+
42+
/**
43+
* First edition holofoil cards
44+
*/
45+
@SerializedName("1st-edition-holofoil")
46+
val firstEditionHolofoil: PricingTcgPlayerVariant?,
47+
48+
/**
49+
* Unlimited edition cards
50+
*/
51+
val unlimited: PricingTcgPlayerVariant?,
52+
53+
/**
54+
* Unlimited holofoil cards
55+
*/
56+
@SerializedName("unlimited-holofoil")
57+
val unlimitedHolofoil: PricingTcgPlayerVariant?
58+
) : Model()
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
package net.tcgdex.sdk.models.subs
2+
3+
/**
4+
* Pokémon TCG PricingTcgPlayerVariant class
5+
*/
6+
data class PricingTcgPlayerVariant internal constructor(
7+
/**
8+
* Lowest available price
9+
*/
10+
val lowPrice: Float?,
11+
12+
/**
13+
* Median market price
14+
*/
15+
val midPrice: Float?,
16+
17+
/**
18+
* Highest available price
19+
*/
20+
val highPrice: Float?,
21+
22+
/**
23+
* Current market price
24+
*/
25+
val marketPrice: Float?,
26+
27+
/**
28+
* Lowest direct seller price
29+
*/
30+
val directLowPrice: Float?
31+
)

0 commit comments

Comments
 (0)