Skip to content
This repository was archived by the owner on Apr 9, 2024. It is now read-only.

Commit c1f43fc

Browse files
committed
First Release
0 parents  commit c1f43fc

20 files changed

+428
-0
lines changed

com/thoo/api/FortniteAPI.kt

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
package com.thoo.api
2+
3+
import com.thoo.api.model.*
4+
import com.thoo.api.service.FortniteAPIService
5+
import retrofit2.Retrofit
6+
import retrofit2.converter.gson.GsonConverterFactory
7+
8+
class FortniteAPI {
9+
10+
private var retrofit: Retrofit? = null
11+
private var service: FortniteAPIService? = null
12+
13+
init {
14+
retrofit = Retrofit.Builder().baseUrl("https://fortnite-api.com").addConverterFactory(GsonConverterFactory.create()).build()
15+
service = retrofit?.create(FortniteAPIService::class.java)
16+
}
17+
18+
fun getCosmeticByID(id: String): BRCosmeticResponse? = service?.getCosmeticByID(id)?.execute()?.body()
19+
20+
fun getCosmeticByID(id: String, language: Language): BRCosmeticResponse? = service?.getCosmeticByID(id, language.toString().toLowerCase())?.execute()?.body()
21+
22+
fun getAllCosmetics(): BRCosmeticsResponse? = service?.getAllCosmetics()?.execute()?.body()
23+
24+
fun getAllCosmetics(language: Language): BRCosmeticsResponse? = service?.getAllCosmetics(language.toString().toLowerCase())?.execute()?.body()
25+
26+
fun getCosmeticsByID(ids: Array<String>): BRCosmeticsResponse? = service?.getCosmeticsByID(ids)?.execute()?.body()
27+
28+
fun getCosmeticsByID(ids: Array<String>, language: Language): BRCosmeticsResponse? = service?.getCosmeticsByID(ids, language.toString().toLowerCase())?.execute()?.body()
29+
30+
fun getItemShop(): BRItemShop? = service?.getItemShop()?.execute()?.body();
31+
32+
fun getItemShop(language: Language): BRItemShop? = service?.getItemShop(language.toString().toLowerCase())?.execute()?.body();
33+
34+
fun getNews(): NewsResponse? = service?.getNews()?.execute()?.body();
35+
36+
fun getNews(language: Language): NewsResponse? = service?.getNews(language.toString().toLowerCase())?.execute()?.body();
37+
38+
fun getNewsBR(): SepNewsResponse? = service?.getNewsBR()?.execute()?.body();
39+
40+
fun getNewsBR(language: Language): SepNewsResponse? = service?.getNewsBR(language.toString().toLowerCase())?.execute()?.body();
41+
42+
fun getNewsSTW(): SepNewsResponse? = service?.getNewsSTW()?.execute()?.body();
43+
44+
fun getNewsSTW(language: Language): SepNewsResponse? = service?.getNewsSTW(language.toString().toLowerCase())?.execute()?.body();
45+
46+
fun getNewsCreative(): SepNewsResponse? = service?.getNewsCreative()?.execute()?.body();
47+
48+
fun getNewsCreative(language: Language): SepNewsResponse? = service?.getNewsCreative(language.toString().toLowerCase())?.execute()?.body();
49+
50+
/*fun getMatched(matchBuilder: MatchBuilder):BRCosmeticsResponse? {
51+
val fields: Array<Field> = matchBuilder::javaClass.get().declaredFields
52+
val queryMap: HashMap<String, Any> = HashMap()
53+
fields.forEach {
54+
if(it.isAccessible){
55+
val value: Any? = it.get(matchBuilder)
56+
if(value != null){
57+
queryMap[it.name] = value
58+
}
59+
}
60+
}
61+
return service?.matchCosmetics(queryMap)?.execute()?.body()
62+
}*/
63+
64+
}

com/thoo/api/match/MatchBuilder.kt

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
package com.thoo.api.match
2+
3+
class MatchBuilder {
4+
5+
private var type: String? = null
6+
private var backendType: String? = null
7+
private var rarity: String? = null
8+
private var backendRarity: String? = null
9+
private var name: String? = null
10+
private var shortDescription: String? = null
11+
private var description: String? = null
12+
private var set: String? = null
13+
private var series: String? = null
14+
private var backendSeries: String? = null
15+
private var hasSmallIcon: Boolean? = null
16+
private var hasIcon: Boolean? = null
17+
private var hasFeaturedImage: Boolean? = null
18+
private var hasBackgroundImage: Boolean? = null
19+
private var hasCovertArt: Boolean? = null
20+
private var hasDecal: Boolean? = null
21+
private var hasVariants: Boolean? = null
22+
private var hasGameplayTags: Boolean? = null
23+
private var gameplayTag: String? = null
24+
25+
fun setType(type: String):MatchBuilder {
26+
this.type = type
27+
return this
28+
}
29+
30+
fun setBackendType(backendType: String):MatchBuilder {
31+
this.backendType = backendType
32+
return this
33+
}
34+
35+
fun setRarity(rarity: String):MatchBuilder {
36+
this.rarity = rarity
37+
return this
38+
}
39+
40+
fun setBackendRarity(backendRarity: String):MatchBuilder {
41+
this.backendRarity = backendRarity
42+
return this
43+
}
44+
45+
fun setName(name: String):MatchBuilder {
46+
this.name = name
47+
return this
48+
}
49+
50+
fun setShortDescription(shortDescription: String):MatchBuilder {
51+
this.shortDescription = shortDescription
52+
return this
53+
}
54+
55+
fun setDescription(description: String):MatchBuilder {
56+
this.description = description
57+
return this
58+
}
59+
60+
fun setSet(set: String):MatchBuilder {
61+
this.set = set
62+
return this
63+
}
64+
65+
fun setSeries(series: String):MatchBuilder {
66+
this.series = series
67+
return this
68+
}
69+
70+
fun setBackendSeries(backendSeries: String):MatchBuilder {
71+
this.backendSeries = backendSeries
72+
return this
73+
}
74+
75+
fun setSmallIcon(hasSmallIcon: Boolean):MatchBuilder {
76+
this.hasSmallIcon = hasSmallIcon
77+
return this
78+
}
79+
80+
fun setIcon(hasIcon: Boolean):MatchBuilder {
81+
this.hasIcon = hasIcon
82+
return this
83+
}
84+
85+
fun setFeaturedImage(hasFeaturedImage: Boolean):MatchBuilder {
86+
this.hasFeaturedImage = hasFeaturedImage
87+
return this
88+
}
89+
90+
fun setBackgroundImage(hasBackgroundImage: Boolean):MatchBuilder {
91+
this.hasBackgroundImage = hasBackgroundImage
92+
return this
93+
}
94+
95+
fun setCovertArt(hasCovertArt: Boolean):MatchBuilder {
96+
this.hasCovertArt = hasCovertArt
97+
return this
98+
}
99+
100+
fun setDecal(hasDecal: Boolean):MatchBuilder {
101+
this.hasDecal = hasDecal
102+
return this
103+
}
104+
105+
fun setVariants(hasVariants: Boolean):MatchBuilder {
106+
this.hasVariants = hasVariants
107+
return this
108+
}
109+
110+
fun setGameplayTags(hasGameplayTags: Boolean):MatchBuilder {
111+
this.hasGameplayTags = hasGameplayTags
112+
return this
113+
}
114+
115+
fun setGameplayTag(gameplayTag: String):MatchBuilder {
116+
this.gameplayTag = gameplayTag
117+
return this
118+
}
119+
120+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
package com.thoo.api.model
2+
3+
import java.util.*
4+
5+
class BRCosmeticData {
6+
7+
val id: String = ""
8+
val type: String = ""
9+
val backendType: String = ""
10+
val rarity: String = ""
11+
val backendRarity: String = ""
12+
val name: String = ""
13+
val shortDescription: String = ""
14+
val set: String = ""
15+
val series: String = ""
16+
val backendSeries: String = ""
17+
val images: Map<String, BRCosmeticIcon>? = null
18+
val variants: Array<BRVariant>? = null
19+
val gameplayTags: Array<String>? = null
20+
val displayAssetPath: String = ""
21+
val definition: String = ""
22+
val requiredItemId: String = ""
23+
val builtInEmoteId: String = ""
24+
val path: String = ""
25+
val lastUpdate: Date? = null
26+
val added: Date? = null
27+
28+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
package com.thoo.api.model
2+
3+
class BRCosmeticIcon {
4+
5+
val hash: String = ""
6+
val url: String = ""
7+
8+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
package com.thoo.api.model
2+
3+
class BRCosmeticResponse {
4+
5+
val status = 0
6+
val data: BRCosmeticData? = null
7+
8+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
package com.thoo.api.model
2+
3+
class BRCosmeticsResponse {
4+
5+
val status: Int = 0
6+
val data: Array<BRCosmeticData>? = null
7+
8+
}

com/thoo/api/model/BRItem.kt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package com.thoo.api.model
2+
3+
class BRItem {
4+
5+
val regularPrice: Int = 0
6+
val finalPrice: Int = 0
7+
val panel: Int = 0
8+
val banner:String = ""
9+
val items: Array<BRCosmeticData>? = null
10+
11+
}

com/thoo/api/model/BRItemShop.kt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
package com.thoo.api.model
2+
3+
class BRItemShop {
4+
5+
val status: Int = 0
6+
val data: BRItemShopData? = null
7+
8+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package com.thoo.api.model
2+
3+
import java.util.*
4+
5+
class BRItemShopData {
6+
7+
val hash: String = ""
8+
val date: Date? = null
9+
val featured: Array<BRItem>? = null
10+
val daily: Array<BRItem>? = null
11+
12+
}

com/thoo/api/model/BRStyle.kt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
package com.thoo.api.model
2+
3+
class BRStyle {
4+
5+
val name: String = ""
6+
val image: BRCosmeticIcon? = null
7+
8+
}

0 commit comments

Comments
 (0)