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

Commit 74b33df

Browse files
committed
lol
1 parent 413f717 commit 74b33df

File tree

6 files changed

+12
-6
lines changed

6 files changed

+12
-6
lines changed

.idea/misc.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ This wrapper is wrote in Kotlin but is fully supported in Java. But Kotlin is ve
33

44
NOTE: This is not supported for Java 12+
55

6-
#Examples
6+
# Examples
77

8-
######Java:
8+
###### Java:
99
```java
1010
// Creates a new instance of the FortniteAPI class
1111
FortniteAPI api = new FortniteAPI.Builder()
@@ -21,7 +21,7 @@ for(Cosmetic cosmetic : cosmetics){
2121
System.out.println(cosmetic.name);
2222
}
2323
```
24-
######Kotlin
24+
###### Kotlin
2525
```kotlin
2626
// Creates a new instance of the FortniteAPI class
2727
val api: FortniteAPI = FortniteAPI.Builder()

src/main/java/com/thoo/api/endpoints/CosmeticEndpoint.kt

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,16 @@ class CosmeticEndpoint(retrofit: Retrofit, private val client: OkHttpClient, pri
2424
@JvmOverloads
2525
fun searchCosmetic(query: QueryBuilder, language: Language = defaultLang): BaseModel<Cosmetic> {
2626
var url = "https://fortnite-api.com/v2/cosmetics/br/search"
27-
for(field in query::class.java.declaredFields){
27+
var j = 0
28+
for(i in query::class.java.declaredFields.indices){
29+
val field = query::class.java.declaredFields[i]
2830
field.isAccessible = true
2931
val value = field.get(query)
30-
if(value != null) url += "?${field.name}=$value"
32+
if(value != null) {
33+
url += "${if (j == 0) "?" else "&"}${field.name}=$value"
34+
j++
35+
}
36+
3137
}
3238
println(url)
3339
val requestBuilder = Request.Builder().url(url)
Binary file not shown.
129 Bytes
Binary file not shown.

target/test-classes/Test.class

110 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)