App.h
Go to the documentation of this file.
1 
20 #pragma once
21 
22 #include <WString.h>
23 #include <Delegate.h>
26 
33 namespace Dial
34 {
35 class Client;
36 
37 class App
38 {
39 public:
40  using ResponseCallback = Delegate<void(App& app, HttpResponse& response)>;
41 
42  App(Client& client, const String& name) : client(client), name(name)
43  {
44  }
45 
46  Client& getClient() const
47  {
48  return client;
49  }
50 
51  String getName() const
52  {
53  return name;
54  }
55 
56  bool status(ResponseCallback onResponse);
57 
61  bool run(ResponseCallback onResponse = nullptr)
62  {
63  return sendRunRequest(createApplicationRequest(), onResponse);
64  }
65 
66  bool run(const String& body, MimeType mime, ResponseCallback onResponse = nullptr);
67 
68  bool run(const HttpParams& params, ResponseCallback onResponse = nullptr);
69 
70  bool stop(ResponseCallback onResponse = nullptr);
71 
72 private:
73  bool sendRunRequest(HttpRequest* request, ResponseCallback onResponse);
74  HttpRequest* createApplicationRequest();
75 
76  Client& client;
77  String name;
78  String instanceUrl;
79 };
80 
81 } // namespace Dial
82 
Definition: Delegate.h:20
Definition: App.h:38
bool run(const String &body, MimeType mime, ResponseCallback onResponse=nullptr)
bool stop(ResponseCallback onResponse=nullptr)
bool run(const HttpParams &params, ResponseCallback onResponse=nullptr)
bool status(ResponseCallback onResponse)
bool run(ResponseCallback onResponse=nullptr)
Definition: App.h:61
String getName() const
Definition: App.h:51
Client & getClient() const
Definition: App.h:46
App(Client &client, const String &name)
Definition: App.h:42
Definition: Libraries/DIAL/src/Dial/Client.h:34
Handles the query portion of a URI.
Definition: HttpParams.h:35
Encapsulates an incoming or outgoing request.
Definition: HttpRequest.h:37
Represents either an incoming or outgoing response to a HTTP request.
Definition: HttpResponse.h:26
The String class.
Definition: WString.h:137
MimeType
Definition: WebConstants.h:53
Definition: App.h:34