Audacity 3.2.0
Request.h
Go to the documentation of this file.
1/*!********************************************************************
2
3 Audacity: A Digital Audio Editor
4
5 @file Request.h
6 @brief Declare a class for constructing HTTP requests.
7
8 Dmitry Vedenko
9 **********************************************************************/
10
11#pragma once
12
13#include <string>
14#include <chrono>
15#include <numeric>
16
17#include "NetworkManagerApi.h"
18
19#include "HeadersList.h"
20#include "CookiesList.h"
21
22namespace audacity
23{
24namespace network_manager
25{
26
28{
29public:
30 using Timeout = std::chrono::milliseconds;
31
32 static constexpr size_t INFINITE_REDIRECTS = std::numeric_limits<size_t>::max();
33
34 Request() = default;
35 explicit Request(std::string url) noexcept;
36
37 Request(const Request&) = default;
38 Request(Request&&) = default;
39 Request& operator = (const Request&) = default;
40 Request& operator = (Request&&) = default;
41
42 Request& setURL(std::string url) noexcept;
43 const std::string& getURL() const noexcept;
44
45 Request& setHeader(const std::string& name, std::string value);
46 std::string getHeader(const std::string& name) const;
47
48 const HeadersList& getHeaders () const noexcept;
49
50 Request& setCookie(const std::string& name, std::string value);
51 Request& appendCookies (const CookiesList& list);
52
53 std::string getCookie(const std::string& name) const;
54
55 const CookiesList& getCookies () noexcept;
56
57 Request& setMaxRedirects(size_t redirects) noexcept;
58 size_t getMaxRedirects() const noexcept;
59
60
61 Request& setTimeout(Timeout timeout) noexcept;
62 Timeout getTimeout() const noexcept;
63private:
64 std::string mUrl;
65
66 HeadersList mHeaders;
67 CookiesList mCookies;
68
69 size_t mMaxRedirects { INFINITE_REDIRECTS };
70
71 Timeout mTimeout { std::chrono::seconds (5) };
72};
73
74}
75}
Define HTTP cookies list class.
Declare HTTP headers list class.
Declare macros for the Network Manager library DLL API.
#define NETWORK_MANAGER_API
wxString name
Definition: TagsEditor.cpp:166
Request(const Request &)=default
std::chrono::milliseconds Timeout
Definition: Request.h:30
STL namespace.