Skip to content

Commit 1e6a8d2

Browse files
committed
getContinuationToken method for retrieving x-ms-continuationtoken response header value
1 parent 170dca9 commit 1e6a8d2

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

azd/src/main/java/org/azd/common/types/BaseAbstractMethod.java

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,15 @@
33
import com.fasterxml.jackson.databind.JsonNode;
44
import org.azd.exceptions.AzDException;
55
import org.azd.helpers.JsonMapper;
6+
import org.azd.utils.RestClient;
67

78
public abstract class BaseAbstractMethod {
89
private final JsonMapper MAPPER = new JsonMapper();
910

11+
/**
12+
* toString() method to convert the POJO to string.
13+
* @return String result.
14+
*/
1015
public String toString() {
1116
String res = null;
1217

@@ -17,6 +22,10 @@ public String toString() {
1722
return res;
1823
}
1924

25+
/**
26+
* Helper method to convert the string to Json node.
27+
* @return JsonNode object.
28+
*/
2029
public JsonNode toJsonTree() {
2130
JsonNode res = null;
2231
try {
@@ -25,4 +34,14 @@ public JsonNode toJsonTree() {
2534

2635
return res;
2736
}
37+
38+
/**
39+
* Retrieves the continuation token from response header. This can then be used for getting the paginated response.
40+
* Note that not all the Apis return continuation token in the headers. If the header value "x-ms-continuationtoken"
41+
* is present then it will be returned or an empty string will be returned.
42+
* @return String value.
43+
*/
44+
public String getContinuationToken() {
45+
return RestClient.Metadata.getResponseHeader("x-ms-continuationtoken");
46+
}
2847
}

0 commit comments

Comments
 (0)