Skip to content

Commit

Permalink
Merge pull request #30 from Bram--/dev
Browse files Browse the repository at this point in the history
Adds missing wishliscomment field to CollectionItem response object.
  • Loading branch information
Bram-- authored May 7, 2024
2 parents e7507d3 + 297616d commit 1f3cbde
Show file tree
Hide file tree
Showing 11 changed files with 17 additions and 17 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ using it is as simple as adding a single line to Gradle.
##### Gradle

```kotlin
implementation("org.audux.bgg:bggclient:0.8.1")
implementation("org.audux.bgg:bggclient:0.9.0")
```

##### Maven
Expand All @@ -35,7 +35,7 @@ implementation("org.audux.bgg:bggclient:0.8.1")
<dependency>
<groupId>org.audux.bgg</groupId>
<artifactId>bggclient</artifactId>
<version>0.8.1</version>
<version>0.9.0</version>
</dependency>
```

Expand Down
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ publishing {
create<MavenPublication>("mavenJava") {
groupId = "org.audux.bgg"
artifactId = "bggclient"
version = "0.8.1"
version = "0.9.0"

pom {
name = "Unofficial JVM BGG client"
Expand Down
2 changes: 1 addition & 1 deletion examples/android/app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ dependencies {
implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.7.0")
implementation("androidx.lifecycle:lifecycle-viewmodel-compose:2.7.0")
implementation("io.coil-kt:coil-compose:2.5.0")
implementation("org.audux.bgg:bggclient:0.8.1")
implementation("org.audux.bgg:bggclient:0.9.0")

testImplementation("junit:junit:4.13.2")

Expand Down
2 changes: 1 addition & 1 deletion examples/java/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ repositories {
}

dependencies {
implementation("org.audux.bgg:bggclient:0.8.1")
implementation("org.audux.bgg:bggclient:0.9.0")

testImplementation(platform("org.junit:junit-bom:5.9.1"))
testImplementation("org.junit.jupiter:junit-jupiter")
Expand Down
2 changes: 1 addition & 1 deletion examples/paginate/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ application {
}

dependencies {
implementation("org.audux.bgg:bggclient:0.8.1")
implementation("org.audux.bgg:bggclient:0.9.0")

testImplementation("org.jetbrains.kotlin:kotlin-test")
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/kotlin/org/audux/bgg/BggClient.kt
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ object BggClient {
@JvmOverloads
fun collection(
userName: String,
subType: ThingType,
subType: ThingType? = null,
excludeSubType: ThingType? = null,
ids: Array<Int>? = null,
version: Boolean = false,
Expand Down
4 changes: 2 additions & 2 deletions src/main/kotlin/org/audux/bgg/request/Collection.kt
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ import org.audux.bgg.response.Response
/** @see org.audux.bgg.BggClient.collection */
internal fun InternalBggClient.collection(
userName: String,
subType: ThingType,
subType: ThingType?,
excludeSubType: ThingType?,
ids: Array<Int>?,
version: Boolean,
Expand Down Expand Up @@ -94,7 +94,7 @@ internal fun InternalBggClient.collection(
appendPathSegments(PATH_COLLECTION)
parameters.apply {
append(PARAM_USERNAME, userName)
append(PARAM_SUBTYPE, subType.param)
subType?.let { append(PARAM_SUBTYPE, it.param) }

excludeSubType?.let { append(PARAM_EXCLUDE_SUBTYPE, it.param) }
ids?.let { append(PARAM_ID, it.joinToString(",")) }
Expand Down
3 changes: 3 additions & 0 deletions src/main/kotlin/org/audux/bgg/response/Collection.kt
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ data class CollectionItem(
/** Comment owner/user left on the collection item. */
val comment: String? = null,

/** Comment owner/user left on the wishlist item. */
val wishlistComment: String? = null,

/** Text user left on the condition of the item. */
val conditionText: String? = null,

Expand Down
3 changes: 2 additions & 1 deletion src/test/java/org/audux/bgg/BggClientJavaTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public void collectionRequest()
BggClient.setEngine(
() -> setupMockEngine("collection?username=novaeux&stats=1&subtype=rpgitem"));

var future = BggClient.collection("Novaeux", ThingType.BOARD_GAME).callAsync();
var future = BggClient.collection("Novaeux", ThingType.RPG_ITEM).callAsync();
var response = future.get(5_000, MILLISECONDS);

assertThat(response.getError()).isNull();
Expand Down Expand Up @@ -84,6 +84,7 @@ public void collectionRequest()
/* numPlays= */ 0,
/* comment= */ null,
/* conditionText= */ null,
/* wishlistComment= */ null,
new CollectionStatistics(
/* minimumPlayer= */ null,
/* maximumPlayers= */ null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,7 @@ class CollectionRequestTest {
TestUtils.setupMockEngine("collection?username=novaeux&stats=1&subtype=rpgitem")
BggClient.engine = { engine }

val response =
BggClient.collection(userName = "Noveaux", subType = ThingType.RPG_ITEM).call()
val response = BggClient.collection(userName = "Noveaux").call()

val request = engine.requestHistory[0]
assertThat(engine.requestHistory).hasSize(1)
Expand All @@ -92,11 +91,7 @@ class CollectionRequestTest {
}
)
assertThat(request.url)
.isEqualTo(
Url(
"https://boardgamegeek.com/xmlapi2/collection?username=Noveaux&subtype=rpgitem"
)
)
.isEqualTo(Url("https://boardgamegeek.com/xmlapi2/collection?username=Noveaux"))
assertThat(response.isError()).isFalse()
assertThat(response.isSuccess()).isTrue()
assertThat(response.data!!.items).hasSize(1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1295,6 +1295,7 @@
wanttoplay="0"
wishlist="1"
wishlistpriority="3" />
<wishlistcomment>Testing 1...2...3..</wishlistcomment>
<numplays>0</numplays>
</item>
<item
Expand Down

0 comments on commit 1f3cbde

Please sign in to comment.