Skip to content

Commit abaa295

Browse files
add requestoptions from generator
1 parent df0ace1 commit abaa295

1 file changed

Lines changed: 32 additions & 0 deletions

File tree

src/main/java/com/auth0/client/mgmt/core/RequestOptions.java

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ public final class RequestOptions {
2323

2424
private final Map<String, Supplier<String>> headerSuppliers;
2525

26+
private final Map<String, String> queryParameters;
27+
28+
private final Map<String, Supplier<String>> queryParameterSuppliers;
29+
2630
// Per-request OAuth credentials
2731
private final String clientId;
2832

@@ -41,6 +45,8 @@ private RequestOptions(
4145
TimeUnit timeoutTimeUnit,
4246
Map<String, String> headers,
4347
Map<String, Supplier<String>> headerSuppliers,
48+
Map<String, String> queryParameters,
49+
Map<String, Supplier<String>> queryParameterSuppliers,
4450
String clientId,
4551
String clientSecret,
4652
String audience,
@@ -50,6 +56,8 @@ private RequestOptions(
5056
this.timeoutTimeUnit = timeoutTimeUnit;
5157
this.headers = headers;
5258
this.headerSuppliers = headerSuppliers;
59+
this.queryParameters = queryParameters;
60+
this.queryParameterSuppliers = queryParameterSuppliers;
5361
this.clientId = clientId;
5462
this.clientSecret = clientSecret;
5563
this.audience = audience;
@@ -131,6 +139,14 @@ public Map<String, String> getHeaders() {
131139
return headers;
132140
}
133141

142+
public Map<String, String> getQueryParameters() {
143+
Map<String, String> queryParameters = new HashMap<>(this.queryParameters);
144+
this.queryParameterSuppliers.forEach((key, supplier) -> {
145+
queryParameters.put(key, supplier.get());
146+
});
147+
return queryParameters;
148+
}
149+
134150
public static Builder builder() {
135151
return new Builder();
136152
}
@@ -146,6 +162,10 @@ public static class Builder {
146162

147163
private final Map<String, Supplier<String>> headerSuppliers = new HashMap<>();
148164

165+
private final Map<String, String> queryParameters = new HashMap<>();
166+
167+
private final Map<String, Supplier<String>> queryParameterSuppliers = new HashMap<>();
168+
149169
private String clientId = null;
150170

151171
private String clientSecret = null;
@@ -228,13 +248,25 @@ public Builder addHeader(String key, Supplier<String> value) {
228248
return this;
229249
}
230250

251+
public Builder addQueryParameter(String key, String value) {
252+
this.queryParameters.put(key, value);
253+
return this;
254+
}
255+
256+
public Builder addQueryParameter(String key, Supplier<String> value) {
257+
this.queryParameterSuppliers.put(key, value);
258+
return this;
259+
}
260+
231261
public RequestOptions build() {
232262
return new RequestOptions(
233263
token,
234264
timeout,
235265
timeoutTimeUnit,
236266
headers,
237267
headerSuppliers,
268+
queryParameters,
269+
queryParameterSuppliers,
238270
clientId,
239271
clientSecret,
240272
audience,

0 commit comments

Comments
 (0)