Skip to content

Commit 62911a1

Browse files
Improve comments related HTTP headers (#1587)
* Improve comments related HTTP headers * Update src/main/java/com/adyen/model/RequestOptions.java Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * Update src/main/java/com/adyen/model/RequestOptions.java Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * Update src/main/java/com/adyen/model/RequestOptions.java Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * Update src/main/java/com/adyen/model/RequestOptions.java Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * Update src/main/java/com/adyen/model/RequestOptions.java Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * Update src/main/java/com/adyen/model/RequestOptions.java Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * Update src/main/java/com/adyen/model/RequestOptions.java Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * Update src/main/java/com/adyen/model/RequestOptions.java Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * Minor edit --------- Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
1 parent 671ca0c commit 62911a1

File tree

2 files changed

+97
-1
lines changed

2 files changed

+97
-1
lines changed

src/main/java/com/adyen/model/RequestOptions.java

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,89 @@
1+
/*
2+
* ######
3+
* ######
4+
* ############ ####( ###### #####. ###### ############ ############
5+
* ############# #####( ###### #####. ###### ############# #############
6+
* ###### #####( ###### #####. ###### ##### ###### ##### ######
7+
* ###### ###### #####( ###### #####. ###### ##### ##### ##### ######
8+
* ###### ###### #####( ###### #####. ###### ##### ##### ######
9+
* ############# ############# ############# ############# ##### ######
10+
* ############ ############ ############# ############ ##### ######
11+
* ######
12+
* #############
13+
* ############
14+
*
15+
* Adyen Java API Library
16+
*
17+
* Copyright (c) 2022 Adyen B.V.
18+
* This file is open source and available under the MIT license.
19+
* See the LICENSE file for more info.
20+
*/
121
package com.adyen.model;
222

323
import java.util.HashMap;
424

25+
/**
26+
* Container for optional HTTP headers that can be included in API requests.
27+
* These options can be used to specify headers such as the Idempotency-Key, WWW-Authenticate
28+
* or other custom headers.
29+
*/
530
public class RequestOptions {
631
private String idempotencyKey;
732
private String requestedVerificationCodeHeader;
833
private String wwwAuthenticateHeader;
934
private HashMap<String, String> additionalServiceHeaders;
1035

36+
/**
37+
* Set the Idempotency-Key header for the request.
38+
*
39+
* @param idempotencyKey The idempotency key.
40+
* @return This {@link RequestOptions} instance.
41+
*/
1142
public RequestOptions idempotencyKey(String idempotencyKey) {
1243
this.idempotencyKey = idempotencyKey;
1344
return this;
1445
}
1546

47+
/**
48+
* Set the x-requested-verification-code header for the request.
49+
*
50+
* @param requestedVerificationCodeHeader The requested verification code.
51+
* @return This {@link RequestOptions} instance.
52+
*/
1653
public RequestOptions requestedVerificationCodeHeader(String requestedVerificationCodeHeader) {
1754
this.requestedVerificationCodeHeader = requestedVerificationCodeHeader;
1855
return this;
1956
}
2057

58+
/**
59+
* Set the WWW-Authenticate header for the request.
60+
*
61+
* @param wwwAuthenticateHeader The WWW-Authenticate header value.
62+
* @return This {@link RequestOptions} instance.
63+
*/
2164
public RequestOptions wwwAuthenticateHeader(String wwwAuthenticateHeader) {
2265
this.wwwAuthenticateHeader = wwwAuthenticateHeader;
2366
return this;
2467
}
2568

69+
/**
70+
* Set additional headers for the request.
71+
*
72+
* @param additionalServiceHeaders A map of additional headers.
73+
* @return This {@link RequestOptions} instance.
74+
*/
2675
public RequestOptions additionalServiceHeaders(HashMap<String, String> additionalServiceHeaders) {
2776
this.additionalServiceHeaders = additionalServiceHeaders;
2877
return this;
2978
}
3079

80+
/**
81+
* Add an additional header to the request.
82+
*
83+
* @param key The key of the header.
84+
* @param value The value of the header.
85+
* @return This {@link RequestOptions} instance.
86+
*/
3187
public RequestOptions addAdditionalServiceHeader(String key, String value) {
3288
if (this.additionalServiceHeaders == null) {
3389
this.additionalServiceHeaders = new HashMap<>();
@@ -36,34 +92,74 @@ public RequestOptions addAdditionalServiceHeader(String key, String value) {
3692
return this;
3793
}
3894

95+
/**
96+
* Get the value of the Idempotency-Key header.
97+
*
98+
* @return The idempotency key.
99+
*/
39100
public String getIdempotencyKey() {
40101
return idempotencyKey;
41102
}
42103

104+
/**
105+
* Set the Idempotency-Key header for the request.
106+
*
107+
* @param idempotencyKey The idempotency key.
108+
*/
43109
public void setIdempotencyKey(String idempotencyKey) {
44110
this.idempotencyKey = idempotencyKey;
45111
}
46112

113+
/**
114+
* Get the value of the x-requested-verification-code header.
115+
*
116+
* @return The requested verification code.
117+
*/
47118
public String getRequestedVerificationCodeHeader() {
48119
return requestedVerificationCodeHeader;
49120
}
50121

122+
/**
123+
* Set the x-requested-verification-code header for the request.
124+
*
125+
* @param requestedVerificationCodeHeader The requested verification code.
126+
*/
51127
public void setRequestedVerificationCodeHeader(String requestedVerificationCodeHeader) {
52128
this.requestedVerificationCodeHeader = requestedVerificationCodeHeader;
53129
}
54130

131+
/**
132+
* Get additional headers for the request.
133+
*
134+
* @return A map of additional headers.
135+
*/
55136
public HashMap<String, String> getAdditionalServiceHeaders() {
56137
return additionalServiceHeaders;
57138
}
58139

140+
/**
141+
* Set additional headers for the request.
142+
*
143+
* @param additionalServiceHeaders A map of additional headers.
144+
*/
59145
public void setAdditionalServiceHeaders(HashMap<String, String> additionalServiceHeaders) {
60146
this.additionalServiceHeaders = additionalServiceHeaders;
61147
}
62148

149+
/**
150+
* Get the value of the WWW-Authenticate header.
151+
*
152+
* @return The WWW-Authenticate header value.
153+
*/
63154
public String getWwwAuthenticateHeader() {
64155
return wwwAuthenticateHeader;
65156
}
66157

158+
/**
159+
* Set the WWW-Authenticate header for the request.
160+
*
161+
* @param wwwAuthenticateHeader The WWW-Authenticate header value.
162+
*/
67163
public void setWwwAuthenticateHeader(String wwwAuthenticateHeader) {
68164
this.wwwAuthenticateHeader = wwwAuthenticateHeader;
69165
}

templates-v7/libraries/jersey3/api_summary.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
{{#queryParams}}
1111
* @param {{paramName}} {@link {{dataType}} } Query: {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{^isContainer}}{{#defaultValue}}, default to {{.}}{{/defaultValue}}){{/isContainer}}{{/required}}
1212
{{/queryParams}}
13-
* @param requestOptions {@link RequestOptions } Object to store additional data such as idempotency-keys (optional)
13+
* @param requestOptions {@link RequestOptions } Object to store additional HTTP headers such as idempotency-keys (optional)
1414
{{#returnType}}
1515
* @return {@link {{.}} }
1616
{{/returnType}}

0 commit comments

Comments
 (0)