WoW Model Viewer
Your premiere tool for viewing, equipping and animating World of Warcraft models.
Loading...
Searching...
No Matches
HttpClient.h
Go to the documentation of this file.
1/*----------------------------------------------------------------------*\
2| This file is part of WoW Model Viewer |
3| |
4| WoW Model Viewer is free software: you can redistribute it and/or |
5| modify it under the terms of the GNU General Public License as |
6| published by the Free Software Foundation, either version 3 of the |
7| License, or (at your option) any later version. |
8| |
9| WoW Model Viewer is distributed in the hope that it will be useful, |
10| but WITHOUT ANY WARRANTY; without even the implied warranty of |
11| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12| GNU General Public License for more details. |
13| |
14| You should have received a copy of the GNU General Public License |
15| along with WoW Model Viewer. |
16| If not, see <http://www.gnu.org/licenses/>. |
17\*----------------------------------------------------------------------*/
18
19#pragma once
20
21#include <functional>
22#include <string>
23#include <vector>
24
28namespace HttpClient
29{
31 struct Response
32 {
33 int statusCode = 0;
34 std::string body;
35 std::string error;
36 bool success = false;
37 };
38
40 using ProgressCallback = std::function<void(size_t bytesReceived, size_t totalBytes)>;
41
46 Response Get(const std::string& url, const ProgressCallback& progress = nullptr);
47}
Synchronous HTTP client using the Windows WinHTTP API.
Definition HttpClient.h:29
Response Get(const std::string &url, const ProgressCallback &progress=nullptr)
Perform a synchronous HTTP(S) GET request.
std::function< void(size_t bytesReceived, size_t totalBytes)> ProgressCallback
Optional progress callback: (bytesReceived, totalBytes). totalBytes may be 0 if unknown.
Definition HttpClient.h:40
Simple HTTP response containing status, body, and error info.
Definition HttpClient.h:32
bool success
True if the request completed without error.
Definition HttpClient.h:36
std::string body
Response body.
Definition HttpClient.h:34
std::string error
Error message (empty on success).
Definition HttpClient.h:35
int statusCode
HTTP status code (e.g. 200, 404).
Definition HttpClient.h:33