generated from AdamMc331/AndroidAppTemplate
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding base ktor client and some octane GG models. (#577)
- Loading branch information
Showing
40 changed files
with
1,234 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
.../kotlin/com/adammcneilly/pocketleague/shared/app/data/octanegg/OctaneGGEventTierMapper.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package com.adammcneilly.pocketleague.shared.app.data.octanegg | ||
|
||
import com.adammcneilly.pocketleague.shared.app.core.models.EventTier | ||
|
||
object OctaneGGEventTierMapper { | ||
/** | ||
* Converts a tier string from the Octane.gg api to an [EventTier] enum entry. | ||
*/ | ||
fun fromString( | ||
tier: String, | ||
): EventTier { | ||
return when (tier) { | ||
"S" -> EventTier.S | ||
"A" -> EventTier.A | ||
"B" -> EventTier.B | ||
"C" -> EventTier.C | ||
"D" -> EventTier.D | ||
else -> EventTier.Unknown | ||
} | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
...nMain/kotlin/com/adammcneilly/pocketleague/shared/app/data/octanegg/OctaneGGKtorClient.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package com.adammcneilly.pocketleague.shared.app.data.octanegg | ||
|
||
import com.adammcneilly.pocketleague.shared.app.data.remote.BaseKtorClient | ||
|
||
/** | ||
* An instance of a [BaseKtorClient] that makes all requests to the octane.gg API. | ||
*/ | ||
object OctaneGGKtorClient : BaseKtorClient( | ||
baseURL = "https://zsr.octane.gg/", | ||
) |
24 changes: 24 additions & 0 deletions
24
...ain/kotlin/com/adammcneilly/pocketleague/shared/app/data/octanegg/OctaneGGRegionMapper.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package com.adammcneilly.pocketleague.shared.app.data.octanegg | ||
|
||
import com.adammcneilly.pocketleague.shared.app.core.models.Region | ||
|
||
object OctaneGGRegionMapper { | ||
/** | ||
* Converts a region string from the Octane.gg api to a [Region] enum entry. | ||
*/ | ||
fun fromString( | ||
region: String, | ||
): Region { | ||
return when (region) { | ||
"NA" -> Region.NA | ||
"EU" -> Region.EU | ||
"OCE" -> Region.OCE | ||
"SAM" -> Region.SAM | ||
"ASIA" -> Region.APAC | ||
"ME" -> Region.MENA | ||
"INT" -> Region.INT | ||
"AF" -> Region.SSA | ||
else -> Region.Unknown | ||
} | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
...Main/kotlin/com/adammcneilly/pocketleague/shared/app/data/octanegg/dto/OctaneGGAccount.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package com.adammcneilly.pocketleague.shared.app.data.octanegg.dto | ||
|
||
import kotlinx.serialization.SerialName | ||
import kotlinx.serialization.Serializable | ||
|
||
/** | ||
* Represents a player account within the octane.gg API. | ||
*/ | ||
@Serializable | ||
data class OctaneGGAccount( | ||
@SerialName("id") | ||
val id: String? = null, | ||
@SerialName("platform") | ||
val platform: String? = null, | ||
) |
17 changes: 17 additions & 0 deletions
17
...otlin/com/adammcneilly/pocketleague/shared/app/data/octanegg/dto/OctaneGGAdvancedStats.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package com.adammcneilly.pocketleague.shared.app.data.octanegg.dto | ||
|
||
import kotlinx.serialization.SerialName | ||
import kotlinx.serialization.Serializable | ||
|
||
/** | ||
* Advanced statistics for a player or a team. | ||
*/ | ||
@Serializable | ||
data class OctaneGGAdvancedStats( | ||
@SerialName("goalParticipation") | ||
val goalParticipation: Double? = null, | ||
@SerialName("mvp") | ||
val mvp: Boolean? = null, | ||
@SerialName("rating") | ||
val rating: Double? = null, | ||
) |
15 changes: 15 additions & 0 deletions
15
...in/kotlin/com/adammcneilly/pocketleague/shared/app/data/octanegg/dto/OctaneGGBallStats.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package com.adammcneilly.pocketleague.shared.app.data.octanegg.dto | ||
|
||
import kotlinx.serialization.SerialName | ||
import kotlinx.serialization.Serializable | ||
|
||
/** | ||
* Ball and possession related stats for a player or team. | ||
*/ | ||
@Serializable | ||
data class OctaneGGBallStats( | ||
@SerialName("possessionTime") | ||
val possessionTime: Double? = null, | ||
@SerialName("timeInSide") | ||
val timeInSide: Double? = null, | ||
) |
67 changes: 67 additions & 0 deletions
67
...n/kotlin/com/adammcneilly/pocketleague/shared/app/data/octanegg/dto/OctaneGGBoostStats.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
package com.adammcneilly.pocketleague.shared.app.data.octanegg.dto | ||
|
||
import kotlinx.serialization.SerialName | ||
import kotlinx.serialization.Serializable | ||
|
||
/** | ||
* Statistics about boost management for a player or team. | ||
*/ | ||
@Serializable | ||
data class OctaneGGBoostStats( | ||
@SerialName("amountCollected") | ||
val amountCollected: Int? = null, | ||
@SerialName("amountCollectedBig") | ||
val amountCollectedBig: Int? = null, | ||
@SerialName("amountCollectedSmall") | ||
val amountCollectedSmall: Int? = null, | ||
@SerialName("amountOverfill") | ||
val amountOverfill: Int? = null, | ||
@SerialName("amountOverfillStolen") | ||
val amountOverfillStolen: Int? = null, | ||
@SerialName("amountStolen") | ||
val amountStolen: Int? = null, | ||
@SerialName("amountStolenBig") | ||
val amountStolenBig: Int? = null, | ||
@SerialName("amountStolenSmall") | ||
val amountStolenSmall: Int? = null, | ||
@SerialName("amountUsedWhileSupersonic") | ||
val amountUsedWhileSupersonic: Int? = null, | ||
@SerialName("avgAmount") | ||
val avgAmount: Double? = null, | ||
@SerialName("bcpm") | ||
val bcpm: Double? = null, | ||
@SerialName("bpm") | ||
val bpm: Int? = null, | ||
@SerialName("countCollectedBig") | ||
val countCollectedBig: Int? = null, | ||
@SerialName("countCollectedSmall") | ||
val countCollectedSmall: Int? = null, | ||
@SerialName("countStolenBig") | ||
val countStolenBig: Int? = null, | ||
@SerialName("countStolenSmall") | ||
val countStolenSmall: Int? = null, | ||
@SerialName("percentBoost0To25") | ||
val percentBoost0To25: Double? = null, | ||
@SerialName("percentBoost25To50") | ||
val percentBoost25To50: Double? = null, | ||
@SerialName("percentBoost50To75") | ||
val percentBoost50To75: Double? = null, | ||
@SerialName("percentBoost75To100") | ||
val percentBoost75To100: Double? = null, | ||
@SerialName("percentFullBoost") | ||
val percentFullBoost: Double? = null, | ||
@SerialName("percentZeroBoost") | ||
val percentZeroBoost: Double? = null, | ||
@SerialName("timeBoost0To25") | ||
val timeBoost0To25: Double? = null, | ||
@SerialName("timeBoost25To50") | ||
val timeBoost25To50: Double? = null, | ||
@SerialName("timeBoost50To75") | ||
val timeBoost50To75: Double? = null, | ||
@SerialName("timeBoost75To100") | ||
val timeBoost75To100: Double? = null, | ||
@SerialName("timeFullBoost") | ||
val timeFullBoost: Double? = null, | ||
@SerialName("timeZeroBoost") | ||
val timeZeroBoost: Double? = null, | ||
) |
38 changes: 38 additions & 0 deletions
38
...in/kotlin/com/adammcneilly/pocketleague/shared/app/data/octanegg/dto/OctaneGGCoreStats.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package com.adammcneilly.pocketleague.shared.app.data.octanegg.dto | ||
|
||
import com.adammcneilly.pocketleague.shared.app.core.models.CoreStats | ||
import kotlinx.serialization.SerialName | ||
import kotlinx.serialization.Serializable | ||
|
||
/** | ||
* The core stats to track for a player or a team in any given match or stretch of time. | ||
*/ | ||
@Serializable | ||
data class OctaneGGCoreStats( | ||
@SerialName("shots") | ||
val shots: Int? = null, | ||
@SerialName("goals") | ||
val goals: Int? = null, | ||
@SerialName("saves") | ||
val saves: Int? = null, | ||
@SerialName("assists") | ||
val assists: Int? = null, | ||
@SerialName("score") | ||
val score: Int? = null, | ||
@SerialName("shootingPercentage") | ||
val shootingPercentage: Float? = null, | ||
) { | ||
/** | ||
* Converts an [OctaneGGCoreStats] entity to a [CoreStats] entity. | ||
*/ | ||
fun toCoreStats(): CoreStats { | ||
return CoreStats( | ||
shots = this.shots ?: 0, | ||
goals = this.goals ?: 0, | ||
saves = this.saves ?: 0, | ||
assists = this.assists ?: 0, | ||
score = this.score ?: 0, | ||
shootingPercentage = this.shootingPercentage ?: 0F, | ||
) | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
...in/kotlin/com/adammcneilly/pocketleague/shared/app/data/octanegg/dto/OctaneGGDemoStats.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package com.adammcneilly.pocketleague.shared.app.data.octanegg.dto | ||
|
||
import kotlinx.serialization.SerialName | ||
import kotlinx.serialization.Serializable | ||
|
||
/** | ||
* Statistics for demolitions for a player or team. | ||
*/ | ||
@Serializable | ||
data class OctaneGGDemoStats( | ||
@SerialName("inflicted") | ||
val inflicted: Int? = null, | ||
@SerialName("taken") | ||
val taken: Int? = null, | ||
) |
Oops, something went wrong.