annotate Framework/Toolbox/OrthancApiClient.h @ 377:8eb4fe74000f

refactoring
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 05 Nov 2018 16:18:27 +0100
parents c2e040ea8fbe
children dd4c7e82b4be
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
270
2d64f4d39610 backup (work in progress)
am@osimis.io
parents:
diff changeset
1 /**
2d64f4d39610 backup (work in progress)
am@osimis.io
parents:
diff changeset
2 * Stone of Orthanc
2d64f4d39610 backup (work in progress)
am@osimis.io
parents:
diff changeset
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
2d64f4d39610 backup (work in progress)
am@osimis.io
parents:
diff changeset
4 * Department, University Hospital of Liege, Belgium
2d64f4d39610 backup (work in progress)
am@osimis.io
parents:
diff changeset
5 * Copyright (C) 2017-2018 Osimis S.A., Belgium
2d64f4d39610 backup (work in progress)
am@osimis.io
parents:
diff changeset
6 *
2d64f4d39610 backup (work in progress)
am@osimis.io
parents:
diff changeset
7 * This program is free software: you can redistribute it and/or
2d64f4d39610 backup (work in progress)
am@osimis.io
parents:
diff changeset
8 * modify it under the terms of the GNU Affero General Public License
2d64f4d39610 backup (work in progress)
am@osimis.io
parents:
diff changeset
9 * as published by the Free Software Foundation, either version 3 of
2d64f4d39610 backup (work in progress)
am@osimis.io
parents:
diff changeset
10 * the License, or (at your option) any later version.
2d64f4d39610 backup (work in progress)
am@osimis.io
parents:
diff changeset
11 *
2d64f4d39610 backup (work in progress)
am@osimis.io
parents:
diff changeset
12 * This program is distributed in the hope that it will be useful, but
2d64f4d39610 backup (work in progress)
am@osimis.io
parents:
diff changeset
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
2d64f4d39610 backup (work in progress)
am@osimis.io
parents:
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
2d64f4d39610 backup (work in progress)
am@osimis.io
parents:
diff changeset
15 * Affero General Public License for more details.
2d64f4d39610 backup (work in progress)
am@osimis.io
parents:
diff changeset
16 *
2d64f4d39610 backup (work in progress)
am@osimis.io
parents:
diff changeset
17 * You should have received a copy of the GNU Affero General Public License
2d64f4d39610 backup (work in progress)
am@osimis.io
parents:
diff changeset
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
2d64f4d39610 backup (work in progress)
am@osimis.io
parents:
diff changeset
19 **/
2d64f4d39610 backup (work in progress)
am@osimis.io
parents:
diff changeset
20
2d64f4d39610 backup (work in progress)
am@osimis.io
parents:
diff changeset
21
2d64f4d39610 backup (work in progress)
am@osimis.io
parents:
diff changeset
22 #pragma once
2d64f4d39610 backup (work in progress)
am@osimis.io
parents:
diff changeset
23
2d64f4d39610 backup (work in progress)
am@osimis.io
parents:
diff changeset
24 #include <boost/shared_ptr.hpp>
2d64f4d39610 backup (work in progress)
am@osimis.io
parents:
diff changeset
25 #include <json/json.h>
2d64f4d39610 backup (work in progress)
am@osimis.io
parents:
diff changeset
26
2d64f4d39610 backup (work in progress)
am@osimis.io
parents:
diff changeset
27 #include "IWebService.h"
2d64f4d39610 backup (work in progress)
am@osimis.io
parents:
diff changeset
28 #include "../Messages/IObservable.h"
299
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents: 271
diff changeset
29 #include "../Messages/Promise.h"
270
2d64f4d39610 backup (work in progress)
am@osimis.io
parents:
diff changeset
30
2d64f4d39610 backup (work in progress)
am@osimis.io
parents:
diff changeset
31 namespace OrthancStone
2d64f4d39610 backup (work in progress)
am@osimis.io
parents:
diff changeset
32 {
377
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 346
diff changeset
33 class OrthancApiClient : public IObservable
270
2d64f4d39610 backup (work in progress)
am@osimis.io
parents:
diff changeset
34 {
300
b4abaeb783b1 messaging refactoring almost complete: works fine in native
am@osimis.io
parents: 299
diff changeset
35 public:
377
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 346
diff changeset
36 class JsonResponseReadyMessage : public BaseMessage<MessageType_OrthancApi_GenericGetJson_Ready>
270
2d64f4d39610 backup (work in progress)
am@osimis.io
parents:
diff changeset
37 {
377
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 346
diff changeset
38 private:
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 346
diff changeset
39 const std::string& uri_;
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 346
diff changeset
40 const Json::Value& json_;
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 346
diff changeset
41 const Orthanc::IDynamicObject* payload_;
270
2d64f4d39610 backup (work in progress)
am@osimis.io
parents:
diff changeset
42
377
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 346
diff changeset
43 public:
300
b4abaeb783b1 messaging refactoring almost complete: works fine in native
am@osimis.io
parents: 299
diff changeset
44 JsonResponseReadyMessage(const std::string& uri,
377
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 346
diff changeset
45 const Json::Value& json,
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 346
diff changeset
46 const Orthanc::IDynamicObject* payload) :
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 346
diff changeset
47 uri_(uri),
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 346
diff changeset
48 json_(json),
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 346
diff changeset
49 payload_(payload)
270
2d64f4d39610 backup (work in progress)
am@osimis.io
parents:
diff changeset
50 {
2d64f4d39610 backup (work in progress)
am@osimis.io
parents:
diff changeset
51 }
2d64f4d39610 backup (work in progress)
am@osimis.io
parents:
diff changeset
52
377
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 346
diff changeset
53 const std::string& GetUri() const
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 346
diff changeset
54 {
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 346
diff changeset
55 return uri_;
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 346
diff changeset
56 }
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 346
diff changeset
57
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 346
diff changeset
58 const Json::Value& GetJson() const
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 346
diff changeset
59 {
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 346
diff changeset
60 return json_;
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 346
diff changeset
61 }
315
aad37d0b6407 Added LayerWidget::RemoveLayer + DELETE commands in WebService
am@osimis.io
parents: 309
diff changeset
62
377
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 346
diff changeset
63 bool HasPayload() const
315
aad37d0b6407 Added LayerWidget::RemoveLayer + DELETE commands in WebService
am@osimis.io
parents: 309
diff changeset
64 {
377
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 346
diff changeset
65 return payload_ != NULL;
315
aad37d0b6407 Added LayerWidget::RemoveLayer + DELETE commands in WebService
am@osimis.io
parents: 309
diff changeset
66 }
377
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 346
diff changeset
67
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 346
diff changeset
68 const Orthanc::IDynamicObject& GetPayload() const;
315
aad37d0b6407 Added LayerWidget::RemoveLayer + DELETE commands in WebService
am@osimis.io
parents: 309
diff changeset
69 };
377
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 346
diff changeset
70
315
aad37d0b6407 Added LayerWidget::RemoveLayer + DELETE commands in WebService
am@osimis.io
parents: 309
diff changeset
71
377
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 346
diff changeset
72 class BinaryResponseReadyMessage : public BaseMessage<MessageType_OrthancApi_GenericGetBinary_Ready>
299
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents: 271
diff changeset
73 {
377
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 346
diff changeset
74 private:
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 346
diff changeset
75 const std::string& uri_;
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 346
diff changeset
76 const void* answer_;
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 346
diff changeset
77 size_t answerSize_;
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 346
diff changeset
78 const Orthanc::IDynamicObject* payload_;
299
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents: 271
diff changeset
79
377
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 346
diff changeset
80 public:
300
b4abaeb783b1 messaging refactoring almost complete: works fine in native
am@osimis.io
parents: 299
diff changeset
81 BinaryResponseReadyMessage(const std::string& uri,
b4abaeb783b1 messaging refactoring almost complete: works fine in native
am@osimis.io
parents: 299
diff changeset
82 const void* answer,
b4abaeb783b1 messaging refactoring almost complete: works fine in native
am@osimis.io
parents: 299
diff changeset
83 size_t answerSize,
377
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 346
diff changeset
84 const Orthanc::IDynamicObject* payload) :
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 346
diff changeset
85 uri_(uri),
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 346
diff changeset
86 answer_(answer),
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 346
diff changeset
87 answerSize_(answerSize),
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 346
diff changeset
88 payload_(payload)
299
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents: 271
diff changeset
89 {
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents: 271
diff changeset
90 }
377
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 346
diff changeset
91
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 346
diff changeset
92 const std::string& GetUri() const
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 346
diff changeset
93 {
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 346
diff changeset
94 return uri_;
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 346
diff changeset
95 }
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 346
diff changeset
96
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 346
diff changeset
97 const void* GetAnswer() const
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 346
diff changeset
98 {
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 346
diff changeset
99 return answer_;
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 346
diff changeset
100 }
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 346
diff changeset
101
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 346
diff changeset
102 size_t GetAnswerSize() const
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 346
diff changeset
103 {
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 346
diff changeset
104 return answerSize_;
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 346
diff changeset
105 }
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 346
diff changeset
106
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 346
diff changeset
107 bool HasPayload() const
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 346
diff changeset
108 {
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 346
diff changeset
109 return payload_ != NULL;
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 346
diff changeset
110 }
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 346
diff changeset
111
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 346
diff changeset
112 const Orthanc::IDynamicObject& GetPayload() const;
299
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents: 271
diff changeset
113 };
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents: 271
diff changeset
114
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents: 271
diff changeset
115
377
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 346
diff changeset
116 class EmptyResponseReadyMessage : public BaseMessage<MessageType_OrthancApi_GenericEmptyResponse_Ready>
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 346
diff changeset
117 {
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 346
diff changeset
118 private:
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 346
diff changeset
119 const std::string& uri_;
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 346
diff changeset
120 const Orthanc::IDynamicObject* payload_;
300
b4abaeb783b1 messaging refactoring almost complete: works fine in native
am@osimis.io
parents: 299
diff changeset
121
377
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 346
diff changeset
122 public:
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 346
diff changeset
123 EmptyResponseReadyMessage(const std::string& uri,
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 346
diff changeset
124 const Orthanc::IDynamicObject* payload) :
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 346
diff changeset
125 uri_(uri),
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 346
diff changeset
126 payload_(payload)
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 346
diff changeset
127 {
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 346
diff changeset
128 }
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 346
diff changeset
129
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 346
diff changeset
130 const std::string& GetUri() const
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 346
diff changeset
131 {
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 346
diff changeset
132 return uri_;
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 346
diff changeset
133 }
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 346
diff changeset
134
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 346
diff changeset
135 bool HasPayload() const
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 346
diff changeset
136 {
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 346
diff changeset
137 return payload_ != NULL;
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 346
diff changeset
138 }
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 346
diff changeset
139
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 346
diff changeset
140 const Orthanc::IDynamicObject& GetPayload() const;
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 346
diff changeset
141 };
270
2d64f4d39610 backup (work in progress)
am@osimis.io
parents:
diff changeset
142
377
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 346
diff changeset
143
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 346
diff changeset
144 class HttpErrorMessage : public BaseMessage<MessageType_OrthancApi_GenericHttpError_Ready>
270
2d64f4d39610 backup (work in progress)
am@osimis.io
parents:
diff changeset
145 {
377
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 346
diff changeset
146 private:
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 346
diff changeset
147 const std::string& uri_;
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 346
diff changeset
148 const Orthanc::IDynamicObject* payload_;
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 346
diff changeset
149
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 346
diff changeset
150 public:
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 346
diff changeset
151 HttpErrorMessage(const std::string& uri,
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 346
diff changeset
152 const Orthanc::IDynamicObject* payload) :
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 346
diff changeset
153 uri_(uri),
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 346
diff changeset
154 payload_(payload)
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 346
diff changeset
155 {
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 346
diff changeset
156 }
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 346
diff changeset
157
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 346
diff changeset
158 const std::string& GetUri() const
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 346
diff changeset
159 {
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 346
diff changeset
160 return uri_;
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 346
diff changeset
161 }
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 346
diff changeset
162
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 346
diff changeset
163 bool HasPayload() const
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 346
diff changeset
164 {
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 346
diff changeset
165 return payload_ != NULL;
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 346
diff changeset
166 }
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 346
diff changeset
167
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 346
diff changeset
168 const Orthanc::IDynamicObject& GetPayload() const;
270
2d64f4d39610 backup (work in progress)
am@osimis.io
parents:
diff changeset
169 };
2d64f4d39610 backup (work in progress)
am@osimis.io
parents:
diff changeset
170
377
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 346
diff changeset
171
270
2d64f4d39610 backup (work in progress)
am@osimis.io
parents:
diff changeset
172 protected:
2d64f4d39610 backup (work in progress)
am@osimis.io
parents:
diff changeset
173 IWebService& orthanc_;
2d64f4d39610 backup (work in progress)
am@osimis.io
parents:
diff changeset
174
2d64f4d39610 backup (work in progress)
am@osimis.io
parents:
diff changeset
175 public:
2d64f4d39610 backup (work in progress)
am@osimis.io
parents:
diff changeset
176 OrthancApiClient(MessageBroker& broker,
299
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents: 271
diff changeset
177 IWebService& orthanc);
377
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 346
diff changeset
178
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 346
diff changeset
179 virtual ~OrthancApiClient()
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 346
diff changeset
180 {
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 346
diff changeset
181 }
270
2d64f4d39610 backup (work in progress)
am@osimis.io
parents:
diff changeset
182
300
b4abaeb783b1 messaging refactoring almost complete: works fine in native
am@osimis.io
parents: 299
diff changeset
183 // schedule a GET request expecting a JSON response.
b4abaeb783b1 messaging refactoring almost complete: works fine in native
am@osimis.io
parents: 299
diff changeset
184 void GetJsonAsync(const std::string& uri,
b4abaeb783b1 messaging refactoring almost complete: works fine in native
am@osimis.io
parents: 299
diff changeset
185 MessageHandler<JsonResponseReadyMessage>* successCallback,
b4abaeb783b1 messaging refactoring almost complete: works fine in native
am@osimis.io
parents: 299
diff changeset
186 MessageHandler<HttpErrorMessage>* failureCallback = NULL,
377
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 346
diff changeset
187 Orthanc::IDynamicObject* payload = NULL /* takes ownership */);
270
2d64f4d39610 backup (work in progress)
am@osimis.io
parents:
diff changeset
188
300
b4abaeb783b1 messaging refactoring almost complete: works fine in native
am@osimis.io
parents: 299
diff changeset
189 // schedule a GET request expecting a binary response.
b4abaeb783b1 messaging refactoring almost complete: works fine in native
am@osimis.io
parents: 299
diff changeset
190 void GetBinaryAsync(const std::string& uri,
b4abaeb783b1 messaging refactoring almost complete: works fine in native
am@osimis.io
parents: 299
diff changeset
191 const std::string& contentType,
b4abaeb783b1 messaging refactoring almost complete: works fine in native
am@osimis.io
parents: 299
diff changeset
192 MessageHandler<BinaryResponseReadyMessage>* successCallback,
b4abaeb783b1 messaging refactoring almost complete: works fine in native
am@osimis.io
parents: 299
diff changeset
193 MessageHandler<HttpErrorMessage>* failureCallback = NULL,
377
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 346
diff changeset
194 Orthanc::IDynamicObject* payload = NULL /* takes ownership */)
300
b4abaeb783b1 messaging refactoring almost complete: works fine in native
am@osimis.io
parents: 299
diff changeset
195 {
b4abaeb783b1 messaging refactoring almost complete: works fine in native
am@osimis.io
parents: 299
diff changeset
196 IWebService::Headers headers;
b4abaeb783b1 messaging refactoring almost complete: works fine in native
am@osimis.io
parents: 299
diff changeset
197 headers["Accept"] = contentType;
b4abaeb783b1 messaging refactoring almost complete: works fine in native
am@osimis.io
parents: 299
diff changeset
198 GetBinaryAsync(uri, headers, successCallback, failureCallback, payload);
b4abaeb783b1 messaging refactoring almost complete: works fine in native
am@osimis.io
parents: 299
diff changeset
199 }
270
2d64f4d39610 backup (work in progress)
am@osimis.io
parents:
diff changeset
200
300
b4abaeb783b1 messaging refactoring almost complete: works fine in native
am@osimis.io
parents: 299
diff changeset
201 // schedule a GET request expecting a binary response.
b4abaeb783b1 messaging refactoring almost complete: works fine in native
am@osimis.io
parents: 299
diff changeset
202 void GetBinaryAsync(const std::string& uri,
b4abaeb783b1 messaging refactoring almost complete: works fine in native
am@osimis.io
parents: 299
diff changeset
203 const IWebService::Headers& headers,
b4abaeb783b1 messaging refactoring almost complete: works fine in native
am@osimis.io
parents: 299
diff changeset
204 MessageHandler<BinaryResponseReadyMessage>* successCallback,
b4abaeb783b1 messaging refactoring almost complete: works fine in native
am@osimis.io
parents: 299
diff changeset
205 MessageHandler<HttpErrorMessage>* failureCallback = NULL,
377
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 346
diff changeset
206 Orthanc::IDynamicObject* payload = NULL /* takes ownership */);
299
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents: 271
diff changeset
207
300
b4abaeb783b1 messaging refactoring almost complete: works fine in native
am@osimis.io
parents: 299
diff changeset
208 // schedule a POST request expecting a JSON response.
b4abaeb783b1 messaging refactoring almost complete: works fine in native
am@osimis.io
parents: 299
diff changeset
209 void PostBinaryAsyncExpectJson(const std::string& uri,
b4abaeb783b1 messaging refactoring almost complete: works fine in native
am@osimis.io
parents: 299
diff changeset
210 const std::string& body,
b4abaeb783b1 messaging refactoring almost complete: works fine in native
am@osimis.io
parents: 299
diff changeset
211 MessageHandler<JsonResponseReadyMessage>* successCallback,
b4abaeb783b1 messaging refactoring almost complete: works fine in native
am@osimis.io
parents: 299
diff changeset
212 MessageHandler<HttpErrorMessage>* failureCallback = NULL,
377
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 346
diff changeset
213 Orthanc::IDynamicObject* payload = NULL /* takes ownership */);
299
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents: 271
diff changeset
214
309
14ef1227120f web services: better handling of failures
am@osimis.io
parents: 300
diff changeset
215 // schedule a POST request expecting a JSON response.
14ef1227120f web services: better handling of failures
am@osimis.io
parents: 300
diff changeset
216 void PostJsonAsyncExpectJson(const std::string& uri,
14ef1227120f web services: better handling of failures
am@osimis.io
parents: 300
diff changeset
217 const Json::Value& data,
14ef1227120f web services: better handling of failures
am@osimis.io
parents: 300
diff changeset
218 MessageHandler<JsonResponseReadyMessage>* successCallback,
14ef1227120f web services: better handling of failures
am@osimis.io
parents: 300
diff changeset
219 MessageHandler<HttpErrorMessage>* failureCallback = NULL,
377
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 346
diff changeset
220 Orthanc::IDynamicObject* payload = NULL /* takes ownership */);
299
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents: 271
diff changeset
221
315
aad37d0b6407 Added LayerWidget::RemoveLayer + DELETE commands in WebService
am@osimis.io
parents: 309
diff changeset
222 // schedule a DELETE request expecting an empty response.
aad37d0b6407 Added LayerWidget::RemoveLayer + DELETE commands in WebService
am@osimis.io
parents: 309
diff changeset
223 void DeleteAsync(const std::string& uri,
aad37d0b6407 Added LayerWidget::RemoveLayer + DELETE commands in WebService
am@osimis.io
parents: 309
diff changeset
224 MessageHandler<EmptyResponseReadyMessage>* successCallback,
aad37d0b6407 Added LayerWidget::RemoveLayer + DELETE commands in WebService
am@osimis.io
parents: 309
diff changeset
225 MessageHandler<HttpErrorMessage>* failureCallback = NULL,
377
8eb4fe74000f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 346
diff changeset
226 Orthanc::IDynamicObject* payload = NULL /* takes ownership */);
315
aad37d0b6407 Added LayerWidget::RemoveLayer + DELETE commands in WebService
am@osimis.io
parents: 309
diff changeset
227
aad37d0b6407 Added LayerWidget::RemoveLayer + DELETE commands in WebService
am@osimis.io
parents: 309
diff changeset
228
270
2d64f4d39610 backup (work in progress)
am@osimis.io
parents:
diff changeset
229 };
2d64f4d39610 backup (work in progress)
am@osimis.io
parents:
diff changeset
230 }