- adds a vararg support for build request in java templates by baywet · Pull Request #292 · microsoftgraph/MSGraph-SDK-Code-Generator

Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,22 @@ import <#=importNamespace#>.core.IBaseClient;
super(requestUrl, client, requestOptions);
}

public <#=c.ITypeCollectionReferenceRequest()#> buildRequest() {
return buildRequest(getOptions());
/**
* Creates the request
*
* @param requestOptions the options for this request
* @return the IUserRequest instance
*/
public <#=c.ITypeCollectionReferenceRequest()#> buildRequest(final com.microsoft.graph.options.Option... requestOptions) {
return buildRequest(getOptions(requestOptions));
}

/**
* Creates the request
*
* @param requestOptions the options for this request
* @return the IUserRequest instance
*/
public <#=c.ITypeCollectionReferenceRequest()#> buildRequest(final java.util.List<? extends <#=importNamespace#>.options.Option> requestOptions) {
return new <#=c.TypeCollectionReferenceRequest()#>(getRequestUrl(), getClient(), requestOptions);
}
Expand Down

16 changes: 14 additions & 2 deletions Templates/Java/requests_extensions/BaseEntityCollectionRequestBuilder.java.tt

Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,22 @@ import <#=importNamespace#>.core.IBaseClient;
super(requestUrl, client, requestOptions);
}

public <#=c.ITypeCollectionRequest()#> buildRequest() {
return buildRequest(getOptions());
/**
* Creates the request
*
* @param requestOptions the options for this request
* @return the IUserRequest instance
*/
public <#=c.ITypeCollectionRequest()#> buildRequest(final com.microsoft.graph.options.Option... requestOptions) {
return buildRequest(getOptions(requestOptions));
}

/**
* Creates the request
*
* @param requestOptions the options for this request
* @return the IUserRequest instance
*/
public <#=c.ITypeCollectionRequest()#> buildRequest(final java.util.List<? extends <#=importNamespace#>.options.Option> requestOptions) {
return new <#=c.TypeCollectionRequest()#>(getRequestUrl(), getClient(), requestOptions);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,22 @@ import <#=importNamespace#>.core.IBaseClient;
super(requestUrl, client, requestOptions);
}

public <#=c.ITypeCollectionWithReferencesRequest()#> buildRequest() {
return buildRequest(getOptions());
/**
* Creates the request
*
* @param requestOptions the options for this request
* @return the IUserRequest instance
*/
public <#=c.ITypeCollectionWithReferencesRequest()#> buildRequest(final com.microsoft.graph.options.Option... requestOptions) {
return buildRequest(getOptions(requestOptions));
}

/**
* Creates the request
*
* @param requestOptions the options for this request
* @return the IUserRequest instance
*/
public <#=c.ITypeCollectionWithReferencesRequest()#> buildRequest(final java.util.List<? extends <#=importNamespace#>.options.Option> requestOptions) {
return new <#=c.TypeCollectionWithReferencesRequest()#>(getRequestUrl(), getClient(), requestOptions);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,11 @@ import <#=importNamespace#>.core.IBaseClient;
/**
* Creates the request
*
* @param requestOptions the options for this request
* @return The <#=c.ITypeReferenceRequest()#> instance
*/
public <#=c.ITypeReferenceRequest()#> buildRequest() {
return buildRequest(getOptions());
public <#=c.ITypeReferenceRequest()#> buildRequest(final com.microsoft.graph.options.Option... requestOptions) {
return buildRequest(getOptions(requestOptions));
}

/**
Expand Down

5 changes: 3 additions & 2 deletions Templates/Java/requests_extensions/BaseEntityRequestBuilder.java.tt

Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,11 @@ import <#=importNamespace#>.http.BaseRequestBuilder;
/**
* Creates the request
*
* @param requestOptions the options for this request
* @return the <#=c.ITypeRequest()#> instance
*/
public <#=c.ITypeRequest()#> buildRequest() {
return buildRequest(getOptions());
public <#=c.ITypeRequest()#> buildRequest(final com.microsoft.graph.options.Option... requestOptions) {
return buildRequest(getOptions(requestOptions));
}

/**
Expand Down

5 changes: 3 additions & 2 deletions Templates/Java/requests_extensions/BaseEntityStreamRequestBuilder.java.tt

Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,11 @@ import <#=importNamespace#>.http.BaseRequestBuilder;
/**
* Creates the request
*
* @param requestOptions the options for this request
* @return the <#=c.ITypeStreamRequest()#> instance
*/
public <#=c.ITypeStreamRequest()#> buildRequest() {
return buildRequest(getOptions());
public <#=c.ITypeStreamRequest()#> buildRequest(final com.microsoft.graph.options.Option... requestOptions) {
return buildRequest(getOptions(requestOptions));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,11 @@ import <#=importNamespace#>.core.IBaseClient;
/**
* Creates the request
*
* @param requestOptions the options for this request
* @return the <#=c.ITypeWithReferencesRequest()#> instance
*/
public <#=c.ITypeWithReferencesRequest()#> buildRequest() {
return buildRequest(getOptions());
public <#=c.ITypeWithReferencesRequest()#> buildRequest(final com.microsoft.graph.options.Option... requestOptions) {
return buildRequest(getOptions(requestOptions));
}

/**
Expand Down

18 changes: 15 additions & 3 deletions Templates/Java/requests_extensions/BaseMethodCollectionRequestBuilder.java.tt

Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,23 @@ import <#=importNamespace#>.core.<#=c.GetMethodRequestBuilderSuperClass() #>;
<# } #>
}
<# } #>

public <#=c.ITypeCollectionRequest()#> buildRequest() {
return buildRequest(getOptions());

/**
* Creates the request
*
* @param requestOptions the options for this request
* @return the IUserRequest instance
*/
public <#=c.ITypeCollectionRequest()#> buildRequest(final com.microsoft.graph.options.Option... requestOptions) {
return buildRequest(getOptions(requestOptions));
}

/**
* Creates the request
*
* @param requestOptions the options for this request
* @return the IUserRequest instance
*/
public <#=c.ITypeCollectionRequest()#> buildRequest(final java.util.List<? extends <#=importNamespace#>.options.Option> requestOptions) {
<#= c.TypeCollectionRequest()#> request = new <#=c.TypeCollectionRequest()#>(
getRequestUrl(),
Expand Down

5 changes: 3 additions & 2 deletions Templates/Java/requests_extensions/BaseMethodRequestBuilder.java.tt

Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,11 @@ import com.google.gson.JsonElement;
/**
* Creates the <#=c.ITypeRequest()#>
*
* @param requestOptions the options for the request
* @return the <#=c.ITypeRequest()#> instance
*/
public <#=c.ITypeRequest()#> buildRequest() {
return buildRequest(getOptions());
public <#=c.ITypeRequest()#> buildRequest(final com.microsoft.graph.options.Option... requestOptions) {
return buildRequest(getOptions(requestOptions));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,19 @@

<#=TypeHelperJava.CreateInterfaceDef(c.ITypeCollectionReferenceRequestBuilder(), "IRequestBuilder")#>

<#=c.ITypeCollectionReferenceRequest()#> buildRequest();

/**
* Creates the request
*
* @param requestOptions the options for this request
* @return the IUserRequest instance
*/
<#=c.ITypeCollectionReferenceRequest()#> buildRequest(final com.microsoft.graph.options.Option... requestOptions);

/**
* Creates the request
*
* @param requestOptions the options for this request
* @return the IUserRequest instance
*/
<#=c.ITypeCollectionReferenceRequest()#> buildRequest(final java.util.List<? extends <#=importNamespace#>.options.Option> requestOptions);
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,20 @@ import <#=importNamespace#>.http.IBaseCollectionPage;

<#=TypeHelperJava.CreateInterfaceDef(c.ITypeCollectionRequestBuilder(), "IRequestBuilder")#>

<#=c.ITypeCollectionRequest()#> buildRequest();
/**
* Creates the request
*
* @param requestOptions the options for this request
* @return the IUserRequest instance
*/
<#=c.ITypeCollectionRequest()#> buildRequest(final com.microsoft.graph.options.Option... requestOptions);

/**
* Creates the request
*
* @param requestOptions the options for this request
* @return the IUserRequest instance
*/
<#=c.ITypeCollectionRequest()#> buildRequest(final java.util.List<? extends <#=importNamespace#>.options.Option> requestOptions);

<#=c.ITypeRequestBuilder()#> byId(final String id);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,20 @@ import <#=importNamespace#>.http.IHttpRequest;

<#=TypeHelperJava.CreateInterfaceDef(c.ITypeCollectionWithReferencesRequestBuilder(), "IRequestBuilder")#>

<#=c.ITypeCollectionWithReferencesRequest()#> buildRequest();

/**
* Creates the request
*
* @param requestOptions the options for this request
* @return the IUserRequest instance
*/
<#=c.ITypeCollectionWithReferencesRequest()#> buildRequest(final com.microsoft.graph.options.Option... requestOptions);

/**
* Creates the request
*
* @param requestOptions the options for this request
* @return the IUserRequest instance
*/
<#=c.ITypeCollectionWithReferencesRequest()#> buildRequest(final java.util.List<? extends <#=importNamespace#>.options.Option> requestOptions);

<#=c.ITypeWithReferencesRequestBuilder()#> byId(final String id);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@ import <#=mainNamespace#>.<#=c.GetPackagePrefix()#>.<#=c.TypeName()#>;
/**
* Creates the request
*
* @param requestOptions the options for this request
* @return the <#=c.ITypeReferenceRequest()#> instance
*/
<#=c.ITypeReferenceRequest()#> buildRequest();
<#=c.ITypeReferenceRequest()#> buildRequest(final com.microsoft.graph.options.Option... requestOptions);

/**
* Creates the request with specific options instead of the existing options
Expand Down

3 changes: 2 additions & 1 deletion Templates/Java/requests_extensions/IBaseEntityRequestBuilder.java.tt

Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@
/**
* Creates the request
*
* @param requestOptions the options for this request
* @return the <#=c.ITypeRequest()#> instance
*/
<#=c.ITypeRequest()#> buildRequest();
<#=c.ITypeRequest()#> buildRequest(final com.microsoft.graph.options.Option... requestOptions);

/**
* Creates the request with specific options instead of the existing options
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@ import <#=mainNamespace#>.<#=TypeHelperJava.GetPrefixForRequests()#>.<#=c.ITypeS
/**
* Creates the request
*
* @param requestOptions the options for this request
* @return the <#=c.ITypeStreamRequest()#> instance
*/
<#=c.ITypeStreamRequest()#> buildRequest();
<#=c.ITypeStreamRequest()#> buildRequest(final com.microsoft.graph.options.Option... requestOptions);

/**
* Creates the request with specific options instead of the existing options
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@
/**
* Creates the request
*
* @param requestOptions the options for this request
* @return the <#=c.ITypeWithReferencesRequest()#> instance
*/
<#=c.ITypeWithReferencesRequest()#> buildRequest();
<#=c.ITypeWithReferencesRequest()#> buildRequest(final com.microsoft.graph.options.Option... requestOptions);

/**
* Creates the request with specific options instead of the existing options
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,20 @@ import <#=mainNamespace#>.<#=TypeHelperJava.GetPrefixForRequests()#>.<#=c.ITypeC

<#=TypeHelperJava.CreateInterfaceDef(c.ITypeCollectionRequestBuilder(), "IRequestBuilder")#>

<#=c.ITypeCollectionRequest()#> buildRequest();
/**
* Creates the request
*
* @param requestOptions the options for this request
* @return the IUserRequest instance
*/
<#=c.ITypeCollectionRequest()#> buildRequest(final com.microsoft.graph.options.Option... requestOptions);

/**
* Creates the request
*
* @param requestOptions the options for this request
* @return the IUserRequest instance
*/
<#=c.ITypeCollectionRequest()#> buildRequest(final java.util.List<? extends <#=importNamespace#>.options.Option> requestOptions);

}

3 changes: 2 additions & 1 deletion Templates/Java/requests_extensions/IBaseMethodRequestBuilder.java.tt

Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@ import <#=importNamespace#>.http.IRequestBuilder;
/**
* Creates the <#=c.ITypeRequest()#>
*
* @param requestOptions the options for the request
* @return the <#=c.ITypeRequest()#> instance
*/
<#=c.ITypeRequest()#> buildRequest();
<#=c.ITypeRequest()#> buildRequest(final com.microsoft.graph.options.Option... requestOptions);

/**
* Creates the <#=c.ITypeRequest()#> with specific options instead of the existing options
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,22 @@ public CallCollectionRequestBuilder(final String requestUrl, final IBaseClient c
super(requestUrl, client, requestOptions);
}

public ICallCollectionRequest buildRequest() {
return buildRequest(getOptions());
/**
* Creates the request
*
* @param requestOptions the options for this request
* @return the IUserRequest instance
*/
public ICallCollectionRequest buildRequest(final com.microsoft.graph.options.Option... requestOptions) {
return buildRequest(getOptions(requestOptions));
}

/**
* Creates the request
*
* @param requestOptions the options for this request
* @return the IUserRequest instance
*/
public ICallCollectionRequest buildRequest(final java.util.List<? extends com.microsoft.graph.options.Option> requestOptions) {
return new CallCollectionRequest(getRequestUrl(), getClient(), requestOptions);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,11 @@ public CallReferenceRequestBuilder(final String requestUrl, final IBaseClient cl
/**
* Creates the request
*
* @param requestOptions the options for this request
* @return The ICallReferenceRequest instance
*/
public ICallReferenceRequest buildRequest() {
return buildRequest(getOptions());
public ICallReferenceRequest buildRequest(final com.microsoft.graph.options.Option... requestOptions) {
return buildRequest(getOptions(requestOptions));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,11 @@ public CallRequestBuilder(final String requestUrl, final IBaseClient client, fin
/**
* Creates the request
*
* @param requestOptions the options for this request
* @return the ICallRequest instance
*/
public ICallRequest buildRequest() {
return buildRequest(getOptions());
public ICallRequest buildRequest(final com.microsoft.graph.options.Option... requestOptions) {
return buildRequest(getOptions(requestOptions));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,11 @@ public CallWithReferenceRequestBuilder(final String requestUrl, final IBaseClien
/**
* Creates the request
*
* @param requestOptions the options for this request
* @return the ICallWithReferenceRequest instance
*/
public ICallWithReferenceRequest buildRequest() {
return buildRequest(getOptions());
public ICallWithReferenceRequest buildRequest(final com.microsoft.graph.options.Option... requestOptions) {
return buildRequest(getOptions(requestOptions));
}

/**
Expand Down