@@ -106,6 +106,27 @@ std::unique_ptr<TodayMockService> mock_service() noexcept
106
106
return result;
107
107
}
108
108
109
+ RequestState::RequestState (size_t id)
110
+ : requestId(id)
111
+ {
112
+ }
113
+
114
+ PageInfo::PageInfo (bool hasNextPage, bool hasPreviousPage)
115
+ : _hasNextPage(hasNextPage)
116
+ , _hasPreviousPage(hasPreviousPage)
117
+ {
118
+ }
119
+
120
+ bool PageInfo::getHasNextPage () const noexcept
121
+ {
122
+ return _hasNextPage;
123
+ }
124
+
125
+ bool PageInfo::getHasPreviousPage () const noexcept
126
+ {
127
+ return _hasPreviousPage;
128
+ }
129
+
109
130
Appointment::Appointment (
110
131
response::IdType&& id, std::string&& when, std::string&& subject, bool isNow)
111
132
: _id(std::move(id))
@@ -115,20 +136,219 @@ Appointment::Appointment(
115
136
{
116
137
}
117
138
139
+ const response::IdType& Appointment::id () const noexcept
140
+ {
141
+ return _id;
142
+ }
143
+
144
+ service::AwaitableScalar<response::IdType> Appointment::getId () const noexcept
145
+ {
146
+ return _id;
147
+ }
148
+
149
+ std::shared_ptr<const response::Value> Appointment::getWhen () const noexcept
150
+ {
151
+ return _when;
152
+ }
153
+
154
+ std::shared_ptr<const response::Value> Appointment::getSubject () const noexcept
155
+ {
156
+ return _subject;
157
+ }
158
+
159
+ bool Appointment::getIsNow () const noexcept
160
+ {
161
+ return _isNow;
162
+ }
163
+
164
+ std::optional<std::string> Appointment::getForceError () const
165
+ {
166
+ throw std::runtime_error (R"ex( this error was forced)ex" );
167
+ }
168
+
169
+ AppointmentEdge::AppointmentEdge (std::shared_ptr<Appointment> appointment)
170
+ : _appointment(std::move(appointment))
171
+ {
172
+ }
173
+
174
+ std::shared_ptr<object::Appointment> AppointmentEdge::getNode () const noexcept
175
+ {
176
+ return std::make_shared<object::Appointment>(_appointment);
177
+ }
178
+
179
+ service::AwaitableScalar<response::Value> AppointmentEdge::getCursor () const
180
+ {
181
+ co_return response::Value (co_await _appointment->getId ());
182
+ }
183
+
184
+ AppointmentConnection::AppointmentConnection (
185
+ bool hasNextPage, bool hasPreviousPage, std::vector<std::shared_ptr<Appointment>> appointments)
186
+ : _pageInfo(std::make_shared<PageInfo>(hasNextPage, hasPreviousPage))
187
+ , _appointments(std::move(appointments))
188
+ {
189
+ }
190
+
191
+ std::shared_ptr<object::PageInfo> AppointmentConnection::getPageInfo () const noexcept
192
+ {
193
+ return std::make_shared<object::PageInfo>(_pageInfo);
194
+ }
195
+
196
+ std::optional<std::vector<std::shared_ptr<object::AppointmentEdge>>> AppointmentConnection::
197
+ getEdges () const noexcept
198
+ {
199
+ auto result = std::make_optional<std::vector<std::shared_ptr<object::AppointmentEdge>>>(
200
+ _appointments.size ());
201
+
202
+ std::transform (_appointments.cbegin (),
203
+ _appointments.cend (),
204
+ result->begin (),
205
+ [](const std::shared_ptr<Appointment>& node) {
206
+ return std::make_shared<object::AppointmentEdge>(
207
+ std::make_shared<AppointmentEdge>(node));
208
+ });
209
+
210
+ return result;
211
+ }
212
+
118
213
Task::Task (response::IdType&& id, std::string&& title, bool isComplete)
119
214
: _id(std::move(id))
120
215
, _title(std::make_shared<response::Value>(std::move(title)))
121
216
, _isComplete(isComplete)
122
217
{
123
218
}
124
219
220
+ const response::IdType& Task::id () const
221
+ {
222
+ return _id;
223
+ }
224
+
225
+ service::AwaitableScalar<response::IdType> Task::getId () const noexcept
226
+ {
227
+ return _id;
228
+ }
229
+
230
+ std::shared_ptr<const response::Value> Task::getTitle () const noexcept
231
+ {
232
+ return _title;
233
+ }
234
+
235
+ bool Task::getIsComplete () const noexcept
236
+ {
237
+ return _isComplete;
238
+ }
239
+
240
+ TaskEdge::TaskEdge (std::shared_ptr<Task> task)
241
+ : _task(std::move(task))
242
+ {
243
+ }
244
+
245
+ std::shared_ptr<object::Task> TaskEdge::getNode () const noexcept
246
+ {
247
+ return std::make_shared<object::Task>(_task);
248
+ }
249
+
250
+ service::AwaitableScalar<response::Value> TaskEdge::getCursor () const noexcept
251
+ {
252
+ co_return response::Value (co_await _task->getId ());
253
+ }
254
+
255
+ TaskConnection::TaskConnection (
256
+ bool hasNextPage, bool hasPreviousPage, std::vector<std::shared_ptr<Task>> tasks)
257
+ : _pageInfo(std::make_shared<PageInfo>(hasNextPage, hasPreviousPage))
258
+ , _tasks(std::move(tasks))
259
+ {
260
+ }
261
+
262
+ std::shared_ptr<object::PageInfo> TaskConnection::getPageInfo () const noexcept
263
+ {
264
+ return std::make_shared<object::PageInfo>(_pageInfo);
265
+ }
266
+
267
+ std::optional<std::vector<std::shared_ptr<object::TaskEdge>>> TaskConnection::getEdges ()
268
+ const noexcept
269
+ {
270
+ auto result = std::make_optional<std::vector<std::shared_ptr<object::TaskEdge>>>(_tasks.size ());
271
+
272
+ std::transform (_tasks.cbegin (),
273
+ _tasks.cend (),
274
+ result->begin (),
275
+ [](const std::shared_ptr<Task>& node) {
276
+ return std::make_shared<object::TaskEdge>(std::make_shared<TaskEdge>(node));
277
+ });
278
+
279
+ return result;
280
+ }
281
+
125
282
Folder::Folder (response::IdType&& id, std::string&& name, int unreadCount)
126
283
: _id(std::move(id))
127
284
, _name(std::make_shared<response::Value>(std::move(name)))
128
285
, _unreadCount(unreadCount)
129
286
{
130
287
}
131
288
289
+ const response::IdType& Folder::id () const noexcept
290
+ {
291
+ return _id;
292
+ }
293
+
294
+ service::AwaitableScalar<response::IdType> Folder::getId () const noexcept
295
+ {
296
+ return _id;
297
+ }
298
+
299
+ std::shared_ptr<const response::Value> Folder::getName () const noexcept
300
+ {
301
+ return _name;
302
+ }
303
+
304
+ int Folder::getUnreadCount () const noexcept
305
+ {
306
+ return _unreadCount;
307
+ }
308
+
309
+ FolderEdge::FolderEdge (std::shared_ptr<Folder> folder)
310
+ : _folder(std::move(folder))
311
+ {
312
+ }
313
+
314
+ std::shared_ptr<object::Folder> FolderEdge::getNode () const noexcept
315
+ {
316
+ return std::make_shared<object::Folder>(_folder);
317
+ }
318
+
319
+ service::AwaitableScalar<response::Value> FolderEdge::getCursor () const noexcept
320
+ {
321
+ co_return response::Value (co_await _folder->getId ());
322
+ }
323
+
324
+ FolderConnection::FolderConnection (
325
+ bool hasNextPage, bool hasPreviousPage, std::vector<std::shared_ptr<Folder>> folders)
326
+ : _pageInfo(std::make_shared<PageInfo>(hasNextPage, hasPreviousPage))
327
+ , _folders(std::move(folders))
328
+ {
329
+ }
330
+
331
+ std::shared_ptr<object::PageInfo> FolderConnection::getPageInfo () const noexcept
332
+ {
333
+ return std::make_shared<object::PageInfo>(_pageInfo);
334
+ }
335
+
336
+ std::optional<std::vector<std::shared_ptr<object::FolderEdge>>> FolderConnection::getEdges ()
337
+ const noexcept
338
+ {
339
+ auto result =
340
+ std::make_optional<std::vector<std::shared_ptr<object::FolderEdge>>>(_folders.size ());
341
+
342
+ std::transform (_folders.cbegin (),
343
+ _folders.cend (),
344
+ result->begin (),
345
+ [](const std::shared_ptr<Folder>& node) {
346
+ return std::make_shared<object::FolderEdge>(std::make_shared<FolderEdge>(node));
347
+ });
348
+
349
+ return result;
350
+ }
351
+
132
352
Query::Query (appointmentsLoader&& getAppointments, tasksLoader&& getTasks,
133
353
unreadCountsLoader&& getUnreadCounts)
134
354
: _getAppointments(std::move(getAppointments))
@@ -574,6 +794,23 @@ std::optional<std::string> Query::getDefault() const noexcept
574
794
return std::nullopt;
575
795
}
576
796
797
+ CompleteTaskPayload::CompleteTaskPayload (
798
+ std::shared_ptr<Task> task, std::optional<std::string>&& clientMutationId)
799
+ : _task(std::move(task))
800
+ , _clientMutationId(std::move(clientMutationId))
801
+ {
802
+ }
803
+
804
+ std::shared_ptr<object::Task> CompleteTaskPayload::getTask () const noexcept
805
+ {
806
+ return std::make_shared<object::Task>(_task);
807
+ }
808
+
809
+ const std::optional<std::string>& CompleteTaskPayload::getClientMutationId () const noexcept
810
+ {
811
+ return _clientMutationId;
812
+ }
813
+
577
814
Mutation::Mutation (completeTaskMutation&& mutateCompleteTask)
578
815
: _mutateCompleteTask(std::move(mutateCompleteTask))
579
816
{
@@ -598,10 +835,94 @@ double Mutation::applySetFloat(double valueArg) noexcept
598
835
return valueArg;
599
836
}
600
837
838
+ std::shared_ptr<object::Appointment> Subscription::getNextAppointmentChange () const
839
+ {
840
+ throw std::runtime_error (" Unexpected call to getNextAppointmentChange" );
841
+ }
842
+
843
+ std::shared_ptr<object::Node> Subscription::getNodeChange (const response::IdType&) const
844
+ {
845
+ throw std::runtime_error (" Unexpected call to getNodeChange" );
846
+ }
847
+
601
848
size_t NextAppointmentChange::_notifySubscribeCount = 0 ;
602
849
size_t NextAppointmentChange::_subscriptionCount = 0 ;
603
850
size_t NextAppointmentChange::_notifyUnsubscribeCount = 0 ;
604
851
852
+ NextAppointmentChange::NextAppointmentChange (nextAppointmentChange&& changeNextAppointment)
853
+ : _changeNextAppointment(std::move(changeNextAppointment))
854
+ {
855
+ }
856
+
857
+ size_t NextAppointmentChange::getCount (service::ResolverContext resolverContext)
858
+ {
859
+ switch (resolverContext)
860
+ {
861
+ case service::ResolverContext::NotifySubscribe:
862
+ return _notifySubscribeCount;
863
+
864
+ case service::ResolverContext::Subscription:
865
+ return _subscriptionCount;
866
+
867
+ case service::ResolverContext::NotifyUnsubscribe:
868
+ return _notifyUnsubscribeCount;
869
+
870
+ default :
871
+ throw std::runtime_error (" Unexpected ResolverContext" );
872
+ }
873
+ }
874
+
875
+ std::shared_ptr<object::Appointment> NextAppointmentChange::getNextAppointmentChange (
876
+ const service::FieldParams& params) const
877
+ {
878
+ switch (params.resolverContext )
879
+ {
880
+ case service::ResolverContext::NotifySubscribe:
881
+ {
882
+ ++_notifySubscribeCount;
883
+ break ;
884
+ }
885
+
886
+ case service::ResolverContext::Subscription:
887
+ {
888
+ ++_subscriptionCount;
889
+ break ;
890
+ }
891
+
892
+ case service::ResolverContext::NotifyUnsubscribe:
893
+ {
894
+ ++_notifyUnsubscribeCount;
895
+ break ;
896
+ }
897
+
898
+ default :
899
+ throw std::runtime_error (" Unexpected ResolverContext" );
900
+ }
901
+
902
+ return std::make_shared<object::Appointment>(_changeNextAppointment (params.state ));
903
+ }
904
+
905
+ std::shared_ptr<object::Node> NextAppointmentChange::getNodeChange (const response::IdType&) const
906
+ {
907
+ throw std::runtime_error (" Unexpected call to getNodeChange" );
908
+ }
909
+
910
+ NodeChange::NodeChange (nodeChange&& changeNode)
911
+ : _changeNode(std::move(changeNode))
912
+ {
913
+ }
914
+
915
+ std::shared_ptr<object::Appointment> NodeChange::getNextAppointmentChange () const
916
+ {
917
+ throw std::runtime_error (" Unexpected call to getNextAppointmentChange" );
918
+ }
919
+
920
+ std::shared_ptr<object::Node> NodeChange::getNodeChange (
921
+ const service::FieldParams& params, response::IdType&& idArg) const
922
+ {
923
+ return _changeNode (params.resolverContext , params.state , std::move (idArg));
924
+ }
925
+
605
926
std::stack<CapturedParams> NestedType::_capturedParams;
606
927
607
928
NestedType::NestedType (service::FieldParams&& params, int depth)
0 commit comments