forked from Azure/azure-sdk-for-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Renames RestResponse to RestResponseBase, RestContentResponse to Rest…
…Response (Azure#570) * Renaming RestResponse to RestResponseBase. * Renaming RestContentResponse to RestResponse * Renaming generic types in rest response models (TBody -> T, THeaders -> H)
- Loading branch information
Showing
15 changed files
with
170 additions
and
170 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 0 additions & 43 deletions
43
client-runtime/src/main/java/com/microsoft/rest/v3/RestContentResponse.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
77 changes: 77 additions & 0 deletions
77
client-runtime/src/main/java/com/microsoft/rest/v3/RestResponseBase.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
/** | ||
* Copyright (c) Microsoft Corporation. All rights reserved. | ||
* Licensed under the MIT License. See License.txt in the project root for | ||
* license information. | ||
*/ | ||
|
||
package com.microsoft.rest.v3; | ||
|
||
import com.microsoft.rest.v3.http.HttpRequest; | ||
|
||
import java.util.Map; | ||
|
||
/** | ||
* The response of a REST request. | ||
* | ||
* @param <H> The deserialized type of the response headers. | ||
* @param <T> The deserialized type of the response body. | ||
*/ | ||
public class RestResponseBase<H, T> { | ||
private final HttpRequest request; | ||
private final int statusCode; | ||
private final H headers; | ||
private final Map<String, String> rawHeaders; | ||
private final T body; | ||
|
||
/** | ||
* Create RestResponseBase. | ||
* | ||
* @param request the request which resulted in this response | ||
* @param statusCode the status code of the HTTP response | ||
* @param headers the deserialized headers of the HTTP response | ||
* @param rawHeaders the raw headers of the HTTP response | ||
* @param body the deserialized body | ||
*/ | ||
public RestResponseBase(HttpRequest request, int statusCode, H headers, Map<String, String> rawHeaders, T body) { | ||
this.request = request; | ||
this.statusCode = statusCode; | ||
this.headers = headers; | ||
this.rawHeaders = rawHeaders; | ||
this.body = body; | ||
} | ||
|
||
/** | ||
* @return the request which resulted in this RestResponseBase. | ||
*/ | ||
public HttpRequest request() { | ||
return request; | ||
} | ||
|
||
/** | ||
* @return the status code of the HTTP response. | ||
*/ | ||
public int statusCode() { | ||
return statusCode; | ||
} | ||
|
||
/** | ||
* @return the deserialized headers of the HTTP response. | ||
*/ | ||
public H headers() { | ||
return headers; | ||
} | ||
|
||
/** | ||
* @return a Map containing the raw HTTP response headers. | ||
*/ | ||
public Map<String, String> rawHeaders() { | ||
return rawHeaders; | ||
} | ||
|
||
/** | ||
* @return the deserialized body of the HTTP response. | ||
*/ | ||
public T body() { | ||
return body; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.