Skip to content

Commit d478f5d

Browse files
committed
Merge pull request #3 from msomhorst-bolcom/master
Extend the ListBuilder to support selecting the DataType(s)
2 parents 08c86b1 + c3898f4 commit d478f5d

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

subprojects/client/src/integrationTest/groovy/com/bol/openapi/OpenApiClientIntegrationSpec.groovy

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,4 +119,26 @@ class OpenApiClientIntegrationSpec extends Specification {
119119
results.categories.size() == 0
120120
results.refinementGroups.size() == 0
121121
}
122+
123+
def 'Can get list of categories'() {
124+
def results = OpenApiClient.withDefaultClient(apiKey).listBuilder().dataType(QueryDataType.DataType.CATEGORIES)
125+
.list()
126+
127+
expect:
128+
results.totalResultSize > 0
129+
results.products.size() == 0
130+
results.categories.size() > 0
131+
results.refinementGroups.size() == 0
132+
}
133+
134+
def 'Can get list of products and refinements'() {
135+
def results = OpenApiClient.withDefaultClient(apiKey).listBuilder().dataType(QueryDataType.DataType.PRODUCTS).dataType(QueryDataType.DataType.REFINEMENTS)
136+
.list()
137+
138+
expect:
139+
results.totalResultSize > 0
140+
results.products.size() > 0
141+
results.categories.size() == 0
142+
results.refinementGroups.size() > 0
143+
}
122144
}

subprojects/client/src/main/java/com/bol/openapi/ListBuilder.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,11 @@ public ListBuilder category(String id) {
6767
return new ListBuilder(this);
6868
}
6969

70+
public ListBuilder dataType(QueryDataType.DataType dataType) {
71+
dataTypes.add(dataType);
72+
return new ListBuilder(this);
73+
}
74+
7075
public ListBuilder allOffers() {
7176
offerTypes.add(ALL);
7277
return new ListBuilder(this);

0 commit comments

Comments
 (0)