-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRestClient.h
52 lines (44 loc) · 1.34 KB
/
RestClient.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#include <Arduino.h>
#include <SPI.h>
#include <WiFi101.h>
class RestClient {
public:
RestClient(const char* host,WiFiSSLClient &client_);
//Client Setup
//Generic HTTP Request
int request(const char* method, const char* path,
const char* body, String* response);
// Set a Request Header
void setHeader(const char*);
// Set Content-Type Header
void setContentType(const char*);
// GET path
int get(const char*);
// GET path and response
int get(const char*, String*);
// POST path and body
int post(const char* path, const char* body);
// POST path and body and response
int post(const char* path, const char* body, String*);
// PUT path and body
int put(const char* path, const char* body);
// PUT path and body and response
int put(const char* path, const char* body, String*);
// DELETE path
int del(const char*);
// DELETE path and body
int del(const char*, const char*);
// DELETE path and response
int del(const char*, String*);
// DELETE path and body and response
int del(const char*, const char*, String*);
private:
WiFiSSLClient client;
int readResponse(String*);
void write(const char*);
const char* host;
int port;
int num_headers;
const char* headers[10];
const char* contentType;
};