|
1 | 1 | /* |
2 | | - * Copyright (C) 2019 HERE Europe B.V. |
| 2 | + * Copyright (C) 2019-2020 HERE Europe B.V. |
3 | 3 | * |
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
5 | 5 | * you may not use this file except in compliance with the License. |
@@ -34,59 +34,110 @@ class CORE_API NetworkResponse final { |
34 | 34 | public: |
35 | 35 | /** |
36 | 36 | * @brief Check if associated request was cancelled. |
| 37 | + * |
37 | 38 | * @return true if associated request was cancelled. |
38 | 39 | */ |
39 | 40 | bool IsCancelled() const; |
40 | 41 |
|
41 | 42 | /** |
42 | 43 | * @brief Get HTTP response code. |
| 44 | + * |
43 | 45 | * @return HTTP response code. |
44 | 46 | */ |
45 | 47 | int GetStatus() const; |
46 | 48 |
|
47 | 49 | /** |
48 | 50 | * @brief Set HTTP response code. |
| 51 | + * |
49 | 52 | * @param[in] status HTTP response code. |
| 53 | + * |
50 | 54 | * @return reference to *this. |
51 | 55 | */ |
52 | 56 | NetworkResponse& WithStatus(int status); |
53 | 57 |
|
54 | 58 | /** |
55 | 59 | * @brief Get human-readable error message in case of failed associated |
56 | 60 | * request. |
| 61 | + * |
57 | 62 | * @return human-readable error message in case of failed associated request. |
58 | 63 | */ |
59 | 64 | const std::string& GetError() const; |
60 | 65 |
|
61 | 66 | /** |
62 | 67 | * @brief Set human-readable error message in case of failed associated |
63 | 68 | * request. |
| 69 | + * |
64 | 70 | * @param[in] error Human-readable error message in case of failed |
65 | 71 | * associated request. |
| 72 | + * |
66 | 73 | * @return reference to *this. |
67 | 74 | */ |
68 | 75 | NetworkResponse& WithError(std::string error); |
69 | 76 |
|
70 | 77 | /** |
71 | 78 | * @brief Get id of associated network request. |
| 79 | + * |
72 | 80 | * @return id of associated network request. |
73 | 81 | */ |
74 | 82 | RequestId GetRequestId() const; |
75 | 83 |
|
76 | 84 | /** |
77 | 85 | * @brief Set id of associated network request. |
| 86 | + * |
78 | 87 | * @param[in] id Id of associated network request. |
| 88 | + * |
79 | 89 | * @return reference to *this. |
80 | 90 | */ |
81 | 91 | NetworkResponse& WithRequestId(RequestId id); |
82 | 92 |
|
| 93 | + /** |
| 94 | + * @brief Get the number of bytes uploaded during the associated network |
| 95 | + * request. |
| 96 | + * |
| 97 | + * @return The number of bytes uploaded during the associated network request. |
| 98 | + */ |
| 99 | + uint64_t GetBytesUploaded() const; |
| 100 | + |
| 101 | + /** |
| 102 | + * @brief Set the number of bytes uploaded during the associated network |
| 103 | + * request. |
| 104 | + * |
| 105 | + * @param[in] bytes_uploaded Number of uploaded bytes. |
| 106 | + * |
| 107 | + * @return reference to *this. |
| 108 | + */ |
| 109 | + NetworkResponse& WithBytesUploaded(uint64_t bytes_uploaded); |
| 110 | + |
| 111 | + /** |
| 112 | + * @brief Get the number of bytes downloaded during the associated network |
| 113 | + * request. |
| 114 | + * |
| 115 | + * @return The number of bytes downloaded during the associated network |
| 116 | + * request. |
| 117 | + */ |
| 118 | + uint64_t GetBytesDownloaded() const; |
| 119 | + |
| 120 | + /** |
| 121 | + * @brief Set the number of bytes downloaded during the associated network |
| 122 | + * request. |
| 123 | + * |
| 124 | + * @param[in] bytes_downloaded Number of downloaded bytes. |
| 125 | + * |
| 126 | + * @return reference to *this. |
| 127 | + */ |
| 128 | + NetworkResponse& WithBytesDownloaded(uint64_t bytes_downloaded); |
| 129 | + |
83 | 130 | private: |
84 | 131 | /// Associated request id. |
85 | 132 | RequestId request_id_{0}; |
86 | 133 | /// HTTP response code. |
87 | 134 | int status_{0}; |
88 | 135 | /// Human-readable error message in case of failed associated request. |
89 | 136 | std::string error_; |
| 137 | + /// Number of bytes uploaded during network request. |
| 138 | + uint64_t bytes_uploaded_; |
| 139 | + /// Number of bytes downloaded during network request. |
| 140 | + uint64_t bytes_downloaded_; |
90 | 141 | }; |
91 | 142 |
|
92 | 143 | } // namespace http |
|
0 commit comments