From 601e6746312b105e3367f8e8e9cd81b5ee915fa3 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Wed, 2 Sep 2020 14:23:45 -0400 Subject: [PATCH] - adds missing skip and skipToken methods for collection requests --- .../BaseEntityCollectionRequest.java.tt | 23 +++++++++++++++++++ .../IBaseEntityCollectionRequest.java.tt | 18 +++++++++++++++ 2 files changed, 41 insertions(+) diff --git a/Templates/Java/requests_extensions/BaseEntityCollectionRequest.java.tt b/Templates/Java/requests_extensions/BaseEntityCollectionRequest.java.tt index e052939a9..db7154f02 100644 --- a/Templates/Java/requests_extensions/BaseEntityCollectionRequest.java.tt +++ b/Templates/Java/requests_extensions/BaseEntityCollectionRequest.java.tt @@ -103,6 +103,29 @@ import <#=mainNamespace#>.<#=TypeHelperJava.GetPrefixForRequests()#>.<#=c.TypeCo } <# } #> +<# if (c.GetFeatures().CanSkip) { #> + /** + * Sets the skip value for the request + * + * @param value of the number of items to skip + * @return the updated request + */ + public <#=c.ITypeCollectionRequest()#> skip(final int value) { + addQueryOption(new com.microsoft.graph.options.QueryOption("$skip", value + "")); + return (<#=c.TypeCollectionRequest()#>)this; + } + +<# } #> + + /** + * Add Skip token for pagination + * @param skipToken - Token for pagination + * @return the updated request + */ + public <#=c.ITypeCollectionRequest()#> skipToken(final String skipToken) { + addQueryOption(new QueryOption("$skiptoken", skipToken)); + return (<#=c.ITypeCollectionRequest()#>)this; + } public <#=c.ITypeCollectionPage()#> buildFromResponse(final <#=c.BaseTypeCollectionResponse()#> response) { final <#=c.ITypeCollectionRequestBuilder()#> builder; if (response.nextLink != null) { diff --git a/Templates/Java/requests_extensions/IBaseEntityCollectionRequest.java.tt b/Templates/Java/requests_extensions/IBaseEntityCollectionRequest.java.tt index 80e567539..24d494920 100644 --- a/Templates/Java/requests_extensions/IBaseEntityCollectionRequest.java.tt +++ b/Templates/Java/requests_extensions/IBaseEntityCollectionRequest.java.tt @@ -49,5 +49,23 @@ import <#=importNamespace#>.http.IBaseCollectionPage; <#=c.ITypeCollectionRequest()#> top(final int value); <# } #> +<# if (c.GetFeatures().CanSkip) { #> + /** + * Sets the skip value for the request + * + * @param value of the number of items to skip + * @return the updated request + */ + <#=c.ITypeCollectionRequest()#> skip(final int value); + +<# } #> + /** + * Sets the skip token value for the request + * + * @param skipToken value for pagination + * + * @return the updated request + */ + <#=c.ITypeCollectionRequest()#> skipToken(String skipToken); } <#=PostProcess(c.ITypeCollectionRequest())#> \ No newline at end of file