EHS
Request.h
Go to the documentation of this file.
1
#pragma once
2
3
#include "
ehs/EHS.h
"
4
#include "
ehs/Vector.h
"
5
#include "
ehs/Str.h
"
6
#include "
ehs/json/Json.h
"
7
#include "
Socket.h
"
8
9
namespace
ehs
10
{
11
enum class
Verb
12
{
13
POST
,
14
GET
,
15
PUT
,
16
DEL
17
};
18
19
class
EHS_LIB_IO
Request
20
{
21
private
:
22
Verb
verb;
23
Str_8
rsrc;
24
Vector<Str_8>
queries;
25
Vector<Str_8>
header;
26
ContentType
cType;
27
Str_8
body;
28
29
public
:
31
Request
();
32
36
Request
(
const
Verb
verb,
const
Str_8
& rsrc);
37
41
Request
(
const
char
* data,
const
UInt_64 size);
42
45
Request
(
const
Str_8
& data);
46
49
Request
(
const
Request
& req) =
default
;
50
54
Request
& operator=(
const
Request
& req);
55
58
Verb
GetVerb()
const
;
59
62
void
SetContentType(
const
ContentType
cType);
63
66
ContentType
GetContentType()
const
;
67
70
void
SetResource(
const
Str_8
& rsrc);
71
74
Str_8
GetResource()
const
;
75
79
void
AddQuery(
const
Str_8
& var,
const
Str_8
& value);
80
84
Str_8
GetQuery(
const
Str_8
& var);
85
88
Vector<Str_8>
GetQueries()
const
;
89
93
void
BasicAuth(
const
Str_8
&
id
,
const
Str_8
& secret);
94
97
void
BearerAuth(
const
Str_8
& token);
98
102
void
BearerAuth(
const
Str_8
& token,
const
Str_8
& clientId);
103
106
void
BotAuth(
const
Str_8
& token);
107
111
void
AddToHeader(
const
Str_8
& var,
const
Str_8
& value);
112
116
Str_8
GetHeader(
const
Str_8
& var)
const
;
117
120
Vector<Str_8>
GetHeader()
const
;
121
125
void
AddToBody(
const
Str_8
& var,
const
Str_8
& value);
126
129
void
AddToBody(
const
Str_8
& data);
130
133
void
SetBody(
const
Str_8
& body);
134
138
Str_8
GetVar(
const
Str_8
& var)
const
;
139
142
Str_8
GetBody()
const
;
143
146
Json
GetJson()
const
;
147
150
Str_8
FormResult()
const
;
151
152
bool
IsValid()
const
;
153
154
private
:
155
static
Str_8
VerbToStr(
const
Verb
verb);
156
157
static
Str_8
ContentTypeToStr(
const
ContentType
cType);
158
159
static
ContentType
StrToContentType(
const
Str_8
& value);
160
161
void
ReadData(
const
Str_8
& data);
162
163
};
164
}
EHS.h
Json.h
Socket.h
Str.h
Vector.h
ehs::Json
Definition:
Json.h:16
ehs::Request
Definition:
Request.h:20
ehs::Request::Request
Request(const Request &req)=default
ehs::Str< Char_8, UInt_64 >
ehs::Vector
Definition:
Vector.h:18
ehs
Definition:
Anchor.h:6
ehs::ContentType
ContentType
Definition:
Socket.h:35
ehs::Verb
Verb
Definition:
Request.h:12
ehs::Verb::DEL
@ DEL
ehs::Verb::PUT
@ PUT
ehs::Verb::GET
@ GET
ehs::Verb::POST
@ POST
include
ehs
io
socket
Request.h
Generated by
1.9.4