DynXX-Cxx
Loading...
Searching...
No Matches
Net.hxx
Go to the documentation of this file.
1#pragma once
2
3#include "Types.hxx"
4#include <cstdio>
5
6constexpr auto DynXXHttpDefaultTimeout = 15 * 1000;
7
8enum class DynXXHttpMethodX : uint8_t {
9 Get,
10 Post,
11 Put,
12};
13
15 std::string contentType;
16 std::string data;
18 int code{0};
19
20 std::optional<std::string> toJson() const;
21};
22#if !defined(_WIN32)
24#endif
25
27 DynXXHttpMethodX method,
28 std::string_view params,
29 BytesView rawBody = {},
30 const std::vector<std::string> &headerV = {},
31 const std::vector<std::string> &formFieldNameV = {},
32 const std::vector<std::string> &formFieldMimeV = {},
33 const std::vector<std::string> &formFieldDataV = {},
34 std::FILE *cFILE = nullptr, size_t fileSize = 0,
35 size_t timeout = DynXXHttpDefaultTimeout);
36
38 DynXXHttpMethodX method,
39 const DictAny &params,
40 BytesView rawBody = {},
41 const Dict &headers = {},
42 const std::vector<std::string> &formFieldNameV = {},
43 const std::vector<std::string> &formFieldMimeV = {},
44 const std::vector<std::string> &formFieldDataV = {},
45 std::FILE *cFILE = nullptr, size_t fileSize = 0,
46 size_t timeout = DynXXHttpDefaultTimeout);
47
48[[nodiscard]] bool dynxxNetHttpDownload(std::string_view url, std::string_view filePath,
49 size_t timeout = DynXXHttpDefaultTimeout);
DynXXHttpMethodX
Definition Net.hxx:8
bool dynxxNetHttpDownload(std::string_view url, std::string_view filePath, size_t timeout=DynXXHttpDefaultTimeout)
DynXXHttpResponse dynxxNetHttpRequest(std::string_view url, DynXXHttpMethodX method, std::string_view params, BytesView rawBody={}, const std::vector< std::string > &headerV={}, const std::vector< std::string > &formFieldNameV={}, const std::vector< std::string > &formFieldMimeV={}, const std::vector< std::string > &formFieldDataV={}, std::FILE *cFILE=nullptr, size_t fileSize=0, size_t timeout=DynXXHttpDefaultTimeout)
constexpr auto DynXXHttpDefaultTimeout
Definition Net.hxx:6
std::unordered_map< std::string, Any > DictAny
Definition Types.hxx:247
std::span< const byte > BytesView
Definition Types.hxx:289
std::unordered_map< std::string, std::string > Dict
Definition Types.hxx:246
#define AssertMove(T)
Definition Types.hxx:20
Definition Net.hxx:14
Dict headers
Definition Net.hxx:17
std::string contentType
Definition Net.hxx:15
std::string data
Definition Net.hxx:16
std::optional< std::string > toJson() const
int code
Definition Net.hxx:18