2929import com .microsoft .graph .options .Option ;
3030import com .microsoft .graph .options .QueryOption ;
3131
32- public class CustomRequest extends BaseRequest {
32+ public class CustomRequest < T > extends BaseRequest {
3333
34- public CustomRequest (final String requestUrl , final IBaseClient client , final java .util .List <? extends Option > requestOptions , final Class <? > responseClass ) {
34+ public CustomRequest (final String requestUrl , final IBaseClient client , final java .util .List <? extends Option > requestOptions , final Class <T > responseClass ) {
3535 super (requestUrl , client , requestOptions , responseClass );
3636 }
3737
38- public CustomRequest (final String requestUrl , final IBaseClient client , final java .util .List <? extends Option > requestOptions ) {
39- super (requestUrl , client , requestOptions , JsonObject .class );
38+ public static CustomRequest < JsonObject > create (final String requestUrl , final IBaseClient client , final java .util .List <? extends Option > requestOptions ) {
39+ return new CustomRequest < JsonObject > (requestUrl , client , requestOptions , JsonObject .class );
4040 }
4141
42- public < T > T get () throws ClientException {
42+ public T get () throws ClientException {
4343 return send (HttpMethod .GET , null );
4444 }
4545
46- public < T > void get (final ICallback <T > callback ) {
46+ public void get (final ICallback <T > callback ) {
4747 send (HttpMethod .GET , callback , null );
4848 }
4949
@@ -68,8 +68,8 @@ public void delete() throws ClientException {{
6868 * @param sourceItem The source object with updates
6969 * @param callback The callback to be called after success or failure.
7070 */
71- public < T > void patch (final Class <?> sourceObject , final ICallback <T > callback ) {
72- send (HttpMethod .PATCH , callback , sourceObject );
71+ public void patch (final ICallback <T > callback ) {
72+ send (HttpMethod .PATCH , callback , super . getResponseType () );
7373 }
7474
7575 /**
@@ -78,26 +78,26 @@ public <T> void patch(final Class<?> sourceObject, final ICallback<T> callback)
7878 * @return The updated item
7979 * @throws ClientException This exception occurs if the request was unable to complete for any reason.
8080 */
81- public < T > T patch (final Class <?> sourceObject ) throws ClientException {
81+ public T patch (final T sourceObject ) throws ClientException {
8282 return send (HttpMethod .PATCH , sourceObject );
8383 }
8484
8585 /**
86- * Creates an item with a new object
87- * @param newObject The new object to create
86+ * Creates a new object
87+ * @param newAttachment The new object to create
8888 * @param callback The callback to be called after success or failure.
8989 */
90- public < T > void post (final Class <?> newObject , final ICallback <T > callback ) {
90+ public void post (final T newObject , final ICallback <T > callback ) {
9191 send (HttpMethod .POST , callback , newObject );
9292 }
9393
9494 /**
95- * Creates an item with a new object
96- * @param newObject The new object to create
97- * @return The created item
95+ * Creates a new object
96+ * @param newAttachment The new object to create
97+ * @return The created Attachment
9898 * @throws ClientException This exception occurs if the request was unable to complete for any reason.
9999 */
100- public < T > T post (final Class <?> newObject ) throws ClientException {
100+ public T post (final T newObject ) throws ClientException {
101101 return send (HttpMethod .POST , newObject );
102102 }
103103
@@ -107,7 +107,7 @@ public <T> T post(final Class<?> newObject) throws ClientException {
107107 * @param value The select clause
108108 * @return The updated request
109109 */
110- public CustomRequest select (final String value ) {
110+ public CustomRequest < T > select (final String value ) {
111111 getQueryOptions ().add (new QueryOption ("$select" , value ));
112112 return this ;
113113 }
@@ -118,7 +118,7 @@ public CustomRequest select(final String value) {
118118 * @param value The expand clause
119119 * @return The updated request
120120 */
121- public CustomRequest expand (final String value ) {
121+ public CustomRequest < T > expand (final String value ) {
122122 getQueryOptions ().add (new QueryOption ("$expand" , value ));
123123 return this ;
124124 }
0 commit comments