· 7 years ago · Jan 10, 2019, 02:48 PM
1// This file was automatically generated and should not be edited.
2
3import AWSAppSync
4
5public final class CreateConversationMutation: GraphQLMutation {
6 public static let operationString =
7 "mutation CreateConversation($createdAt: String, $id: ID!, $name: String!) {\n createConversation(createdAt: $createdAt, id: $id, name: $name) {\n __typename\n createdAt\n id\n messages {\n __typename\n messages {\n __typename\n content\n conversationId\n createdAt\n id\n isSent\n sender\n }\n nextToken\n }\n name\n }\n}"
8
9 public var createdAt: String?
10 public var id: GraphQLID
11 public var name: String
12
13 public init(createdAt: String? = nil, id: GraphQLID, name: String) {
14 self.createdAt = createdAt
15 self.id = id
16 self.name = name
17 }
18
19 public var variables: GraphQLMap? {
20 return ["createdAt": createdAt, "id": id, "name": name]
21 }
22
23 public struct Data: GraphQLSelectionSet {
24 public static let possibleTypes = ["Mutation"]
25
26 public static let selections: [GraphQLSelection] = [
27 GraphQLField("createConversation", arguments: ["createdAt": GraphQLVariable("createdAt"), "id": GraphQLVariable("id"), "name": GraphQLVariable("name")], type: .object(CreateConversation.selections)),
28 ]
29
30 public var snapshot: Snapshot
31
32 public init(snapshot: Snapshot) {
33 self.snapshot = snapshot
34 }
35
36 public init(createConversation: CreateConversation? = nil) {
37 self.init(snapshot: ["__typename": "Mutation", "createConversation": createConversation.flatMap { $0.snapshot }])
38 }
39
40 /// Create a Conversation. Use some of the cooked in template functions for UUID and DateTime.
41 public var createConversation: CreateConversation? {
42 get {
43 return (snapshot["createConversation"] as? Snapshot).flatMap { CreateConversation(snapshot: $0) }
44 }
45 set {
46 snapshot.updateValue(newValue?.snapshot, forKey: "createConversation")
47 }
48 }
49
50 public struct CreateConversation: GraphQLSelectionSet {
51 public static let possibleTypes = ["Conversation"]
52
53 public static let selections: [GraphQLSelection] = [
54 GraphQLField("__typename", type: .nonNull(.scalar(String.self))),
55 GraphQLField("createdAt", type: .scalar(String.self)),
56 GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))),
57 GraphQLField("messages", type: .object(Message.selections)),
58 GraphQLField("name", type: .nonNull(.scalar(String.self))),
59 ]
60
61 public var snapshot: Snapshot
62
63 public init(snapshot: Snapshot) {
64 self.snapshot = snapshot
65 }
66
67 public init(createdAt: String? = nil, id: GraphQLID, messages: Message? = nil, name: String) {
68 self.init(snapshot: ["__typename": "Conversation", "createdAt": createdAt, "id": id, "messages": messages.flatMap { $0.snapshot }, "name": name])
69 }
70
71 public var __typename: String {
72 get {
73 return snapshot["__typename"]! as! String
74 }
75 set {
76 snapshot.updateValue(newValue, forKey: "__typename")
77 }
78 }
79
80 /// The Conversation's timestamp.
81 public var createdAt: String? {
82 get {
83 return snapshot["createdAt"] as? String
84 }
85 set {
86 snapshot.updateValue(newValue, forKey: "createdAt")
87 }
88 }
89
90 /// A unique identifier for the Conversation.
91 public var id: GraphQLID {
92 get {
93 return snapshot["id"]! as! GraphQLID
94 }
95 set {
96 snapshot.updateValue(newValue, forKey: "id")
97 }
98 }
99
100 /// The Conversation's messages.
101 public var messages: Message? {
102 get {
103 return (snapshot["messages"] as? Snapshot).flatMap { Message(snapshot: $0) }
104 }
105 set {
106 snapshot.updateValue(newValue?.snapshot, forKey: "messages")
107 }
108 }
109
110 /// The Conversation's name.
111 public var name: String {
112 get {
113 return snapshot["name"]! as! String
114 }
115 set {
116 snapshot.updateValue(newValue, forKey: "name")
117 }
118 }
119
120 public struct Message: GraphQLSelectionSet {
121 public static let possibleTypes = ["MessageConnection"]
122
123 public static let selections: [GraphQLSelection] = [
124 GraphQLField("__typename", type: .nonNull(.scalar(String.self))),
125 GraphQLField("messages", type: .list(.object(Message.selections))),
126 GraphQLField("nextToken", type: .scalar(String.self)),
127 ]
128
129 public var snapshot: Snapshot
130
131 public init(snapshot: Snapshot) {
132 self.snapshot = snapshot
133 }
134
135 public init(messages: [Message?]? = nil, nextToken: String? = nil) {
136 self.init(snapshot: ["__typename": "MessageConnection", "messages": messages.flatMap { $0.map { $0.flatMap { $0.snapshot } } }, "nextToken": nextToken])
137 }
138
139 public var __typename: String {
140 get {
141 return snapshot["__typename"]! as! String
142 }
143 set {
144 snapshot.updateValue(newValue, forKey: "__typename")
145 }
146 }
147
148 public var messages: [Message?]? {
149 get {
150 return (snapshot["messages"] as? [Snapshot?]).flatMap { $0.map { $0.flatMap { Message(snapshot: $0) } } }
151 }
152 set {
153 snapshot.updateValue(newValue.flatMap { $0.map { $0.flatMap { $0.snapshot } } }, forKey: "messages")
154 }
155 }
156
157 public var nextToken: String? {
158 get {
159 return snapshot["nextToken"] as? String
160 }
161 set {
162 snapshot.updateValue(newValue, forKey: "nextToken")
163 }
164 }
165
166 public struct Message: GraphQLSelectionSet {
167 public static let possibleTypes = ["Message"]
168
169 public static let selections: [GraphQLSelection] = [
170 GraphQLField("__typename", type: .nonNull(.scalar(String.self))),
171 GraphQLField("content", type: .nonNull(.scalar(String.self))),
172 GraphQLField("conversationId", type: .nonNull(.scalar(GraphQLID.self))),
173 GraphQLField("createdAt", type: .scalar(String.self)),
174 GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))),
175 GraphQLField("isSent", type: .scalar(Bool.self)),
176 GraphQLField("sender", type: .scalar(String.self)),
177 ]
178
179 public var snapshot: Snapshot
180
181 public init(snapshot: Snapshot) {
182 self.snapshot = snapshot
183 }
184
185 public init(content: String, conversationId: GraphQLID, createdAt: String? = nil, id: GraphQLID, isSent: Bool? = nil, sender: String? = nil) {
186 self.init(snapshot: ["__typename": "Message", "content": content, "conversationId": conversationId, "createdAt": createdAt, "id": id, "isSent": isSent, "sender": sender])
187 }
188
189 public var __typename: String {
190 get {
191 return snapshot["__typename"]! as! String
192 }
193 set {
194 snapshot.updateValue(newValue, forKey: "__typename")
195 }
196 }
197
198 /// The message content.
199 public var content: String {
200 get {
201 return snapshot["content"]! as! String
202 }
203 set {
204 snapshot.updateValue(newValue, forKey: "content")
205 }
206 }
207
208 /// The id of the Conversation this message belongs to. This is the table primary key.
209 public var conversationId: GraphQLID {
210 get {
211 return snapshot["conversationId"]! as! GraphQLID
212 }
213 set {
214 snapshot.updateValue(newValue, forKey: "conversationId")
215 }
216 }
217
218 /// The message timestamp. This is also the table sort key.
219 public var createdAt: String? {
220 get {
221 return snapshot["createdAt"] as? String
222 }
223 set {
224 snapshot.updateValue(newValue, forKey: "createdAt")
225 }
226 }
227
228 /// Generated id for a message -- read-only
229 public var id: GraphQLID {
230 get {
231 return snapshot["id"]! as! GraphQLID
232 }
233 set {
234 snapshot.updateValue(newValue, forKey: "id")
235 }
236 }
237
238 /// Flag denoting if this message has been accepted by the server or not.
239 public var isSent: Bool? {
240 get {
241 return snapshot["isSent"] as? Bool
242 }
243 set {
244 snapshot.updateValue(newValue, forKey: "isSent")
245 }
246 }
247
248 public var sender: String? {
249 get {
250 return snapshot["sender"] as? String
251 }
252 set {
253 snapshot.updateValue(newValue, forKey: "sender")
254 }
255 }
256 }
257 }
258 }
259 }
260}
261
262public final class CreateMessageMutation: GraphQLMutation {
263 public static let operationString =
264 "mutation CreateMessage($content: String, $conversationId: ID!, $createdAt: String!, $id: ID!) {\n createMessage(content: $content, conversationId: $conversationId, createdAt: $createdAt, id: $id) {\n __typename\n author {\n __typename\n cognitoId\n conversations {\n __typename\n nextToken\n }\n id\n messages {\n __typename\n nextToken\n }\n username\n registered\n }\n content\n conversationId\n createdAt\n id\n isSent\n recipient {\n __typename\n cognitoId\n conversations {\n __typename\n nextToken\n }\n id\n messages {\n __typename\n nextToken\n }\n username\n registered\n }\n sender\n }\n}"
265
266 public var content: String?
267 public var conversationId: GraphQLID
268 public var createdAt: String
269 public var id: GraphQLID
270
271 public init(content: String? = nil, conversationId: GraphQLID, createdAt: String, id: GraphQLID) {
272 self.content = content
273 self.conversationId = conversationId
274 self.createdAt = createdAt
275 self.id = id
276 }
277
278 public var variables: GraphQLMap? {
279 return ["content": content, "conversationId": conversationId, "createdAt": createdAt, "id": id]
280 }
281
282 public struct Data: GraphQLSelectionSet {
283 public static let possibleTypes = ["Mutation"]
284
285 public static let selections: [GraphQLSelection] = [
286 GraphQLField("createMessage", arguments: ["content": GraphQLVariable("content"), "conversationId": GraphQLVariable("conversationId"), "createdAt": GraphQLVariable("createdAt"), "id": GraphQLVariable("id")], type: .object(CreateMessage.selections)),
287 ]
288
289 public var snapshot: Snapshot
290
291 public init(snapshot: Snapshot) {
292 self.snapshot = snapshot
293 }
294
295 public init(createMessage: CreateMessage? = nil) {
296 self.init(snapshot: ["__typename": "Mutation", "createMessage": createMessage.flatMap { $0.snapshot }])
297 }
298
299 /// Create a message in a Conversation.
300 public var createMessage: CreateMessage? {
301 get {
302 return (snapshot["createMessage"] as? Snapshot).flatMap { CreateMessage(snapshot: $0) }
303 }
304 set {
305 snapshot.updateValue(newValue?.snapshot, forKey: "createMessage")
306 }
307 }
308
309 public struct CreateMessage: GraphQLSelectionSet {
310 public static let possibleTypes = ["Message"]
311
312 public static let selections: [GraphQLSelection] = [
313 GraphQLField("__typename", type: .nonNull(.scalar(String.self))),
314 GraphQLField("author", type: .object(Author.selections)),
315 GraphQLField("content", type: .nonNull(.scalar(String.self))),
316 GraphQLField("conversationId", type: .nonNull(.scalar(GraphQLID.self))),
317 GraphQLField("createdAt", type: .scalar(String.self)),
318 GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))),
319 GraphQLField("isSent", type: .scalar(Bool.self)),
320 GraphQLField("recipient", type: .object(Recipient.selections)),
321 GraphQLField("sender", type: .scalar(String.self)),
322 ]
323
324 public var snapshot: Snapshot
325
326 public init(snapshot: Snapshot) {
327 self.snapshot = snapshot
328 }
329
330 public init(author: Author? = nil, content: String, conversationId: GraphQLID, createdAt: String? = nil, id: GraphQLID, isSent: Bool? = nil, recipient: Recipient? = nil, sender: String? = nil) {
331 self.init(snapshot: ["__typename": "Message", "author": author.flatMap { $0.snapshot }, "content": content, "conversationId": conversationId, "createdAt": createdAt, "id": id, "isSent": isSent, "recipient": recipient.flatMap { $0.snapshot }, "sender": sender])
332 }
333
334 public var __typename: String {
335 get {
336 return snapshot["__typename"]! as! String
337 }
338 set {
339 snapshot.updateValue(newValue, forKey: "__typename")
340 }
341 }
342
343 /// The author object. Note: `authorId` is only available because we list it in `extraAttributes` in `Conversation.messages`
344 public var author: Author? {
345 get {
346 return (snapshot["author"] as? Snapshot).flatMap { Author(snapshot: $0) }
347 }
348 set {
349 snapshot.updateValue(newValue?.snapshot, forKey: "author")
350 }
351 }
352
353 /// The message content.
354 public var content: String {
355 get {
356 return snapshot["content"]! as! String
357 }
358 set {
359 snapshot.updateValue(newValue, forKey: "content")
360 }
361 }
362
363 /// The id of the Conversation this message belongs to. This is the table primary key.
364 public var conversationId: GraphQLID {
365 get {
366 return snapshot["conversationId"]! as! GraphQLID
367 }
368 set {
369 snapshot.updateValue(newValue, forKey: "conversationId")
370 }
371 }
372
373 /// The message timestamp. This is also the table sort key.
374 public var createdAt: String? {
375 get {
376 return snapshot["createdAt"] as? String
377 }
378 set {
379 snapshot.updateValue(newValue, forKey: "createdAt")
380 }
381 }
382
383 /// Generated id for a message -- read-only
384 public var id: GraphQLID {
385 get {
386 return snapshot["id"]! as! GraphQLID
387 }
388 set {
389 snapshot.updateValue(newValue, forKey: "id")
390 }
391 }
392
393 /// Flag denoting if this message has been accepted by the server or not.
394 public var isSent: Bool? {
395 get {
396 return snapshot["isSent"] as? Bool
397 }
398 set {
399 snapshot.updateValue(newValue, forKey: "isSent")
400 }
401 }
402
403 public var recipient: Recipient? {
404 get {
405 return (snapshot["recipient"] as? Snapshot).flatMap { Recipient(snapshot: $0) }
406 }
407 set {
408 snapshot.updateValue(newValue?.snapshot, forKey: "recipient")
409 }
410 }
411
412 public var sender: String? {
413 get {
414 return snapshot["sender"] as? String
415 }
416 set {
417 snapshot.updateValue(newValue, forKey: "sender")
418 }
419 }
420
421 public struct Author: GraphQLSelectionSet {
422 public static let possibleTypes = ["User"]
423
424 public static let selections: [GraphQLSelection] = [
425 GraphQLField("__typename", type: .nonNull(.scalar(String.self))),
426 GraphQLField("cognitoId", type: .nonNull(.scalar(GraphQLID.self))),
427 GraphQLField("conversations", type: .object(Conversation.selections)),
428 GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))),
429 GraphQLField("messages", type: .object(Message.selections)),
430 GraphQLField("username", type: .nonNull(.scalar(String.self))),
431 GraphQLField("registered", type: .scalar(Bool.self)),
432 ]
433
434 public var snapshot: Snapshot
435
436 public init(snapshot: Snapshot) {
437 self.snapshot = snapshot
438 }
439
440 public init(cognitoId: GraphQLID, conversations: Conversation? = nil, id: GraphQLID, messages: Message? = nil, username: String, registered: Bool? = nil) {
441 self.init(snapshot: ["__typename": "User", "cognitoId": cognitoId, "conversations": conversations.flatMap { $0.snapshot }, "id": id, "messages": messages.flatMap { $0.snapshot }, "username": username, "registered": registered])
442 }
443
444 public var __typename: String {
445 get {
446 return snapshot["__typename"]! as! String
447 }
448 set {
449 snapshot.updateValue(newValue, forKey: "__typename")
450 }
451 }
452
453 /// A unique identifier for the user.
454 public var cognitoId: GraphQLID {
455 get {
456 return snapshot["cognitoId"]! as! GraphQLID
457 }
458 set {
459 snapshot.updateValue(newValue, forKey: "cognitoId")
460 }
461 }
462
463 /// A user's enrolled Conversations. This is an interesting case. This is an interesting pagination case.
464 public var conversations: Conversation? {
465 get {
466 return (snapshot["conversations"] as? Snapshot).flatMap { Conversation(snapshot: $0) }
467 }
468 set {
469 snapshot.updateValue(newValue?.snapshot, forKey: "conversations")
470 }
471 }
472
473 /// Generated id for a user. read-only
474 public var id: GraphQLID {
475 get {
476 return snapshot["id"]! as! GraphQLID
477 }
478 set {
479 snapshot.updateValue(newValue, forKey: "id")
480 }
481 }
482
483 /// Get a users messages by querying a GSI on the Messages table.
484 public var messages: Message? {
485 get {
486 return (snapshot["messages"] as? Snapshot).flatMap { Message(snapshot: $0) }
487 }
488 set {
489 snapshot.updateValue(newValue?.snapshot, forKey: "messages")
490 }
491 }
492
493 /// The username
494 public var username: String {
495 get {
496 return snapshot["username"]! as! String
497 }
498 set {
499 snapshot.updateValue(newValue, forKey: "username")
500 }
501 }
502
503 /// is the user registered?
504 public var registered: Bool? {
505 get {
506 return snapshot["registered"] as? Bool
507 }
508 set {
509 snapshot.updateValue(newValue, forKey: "registered")
510 }
511 }
512
513 public struct Conversation: GraphQLSelectionSet {
514 public static let possibleTypes = ["UserConverstationsConnection"]
515
516 public static let selections: [GraphQLSelection] = [
517 GraphQLField("__typename", type: .nonNull(.scalar(String.self))),
518 GraphQLField("nextToken", type: .scalar(String.self)),
519 ]
520
521 public var snapshot: Snapshot
522
523 public init(snapshot: Snapshot) {
524 self.snapshot = snapshot
525 }
526
527 public init(nextToken: String? = nil) {
528 self.init(snapshot: ["__typename": "UserConverstationsConnection", "nextToken": nextToken])
529 }
530
531 public var __typename: String {
532 get {
533 return snapshot["__typename"]! as! String
534 }
535 set {
536 snapshot.updateValue(newValue, forKey: "__typename")
537 }
538 }
539
540 public var nextToken: String? {
541 get {
542 return snapshot["nextToken"] as? String
543 }
544 set {
545 snapshot.updateValue(newValue, forKey: "nextToken")
546 }
547 }
548 }
549
550 public struct Message: GraphQLSelectionSet {
551 public static let possibleTypes = ["MessageConnection"]
552
553 public static let selections: [GraphQLSelection] = [
554 GraphQLField("__typename", type: .nonNull(.scalar(String.self))),
555 GraphQLField("nextToken", type: .scalar(String.self)),
556 ]
557
558 public var snapshot: Snapshot
559
560 public init(snapshot: Snapshot) {
561 self.snapshot = snapshot
562 }
563
564 public init(nextToken: String? = nil) {
565 self.init(snapshot: ["__typename": "MessageConnection", "nextToken": nextToken])
566 }
567
568 public var __typename: String {
569 get {
570 return snapshot["__typename"]! as! String
571 }
572 set {
573 snapshot.updateValue(newValue, forKey: "__typename")
574 }
575 }
576
577 public var nextToken: String? {
578 get {
579 return snapshot["nextToken"] as? String
580 }
581 set {
582 snapshot.updateValue(newValue, forKey: "nextToken")
583 }
584 }
585 }
586 }
587
588 public struct Recipient: GraphQLSelectionSet {
589 public static let possibleTypes = ["User"]
590
591 public static let selections: [GraphQLSelection] = [
592 GraphQLField("__typename", type: .nonNull(.scalar(String.self))),
593 GraphQLField("cognitoId", type: .nonNull(.scalar(GraphQLID.self))),
594 GraphQLField("conversations", type: .object(Conversation.selections)),
595 GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))),
596 GraphQLField("messages", type: .object(Message.selections)),
597 GraphQLField("username", type: .nonNull(.scalar(String.self))),
598 GraphQLField("registered", type: .scalar(Bool.self)),
599 ]
600
601 public var snapshot: Snapshot
602
603 public init(snapshot: Snapshot) {
604 self.snapshot = snapshot
605 }
606
607 public init(cognitoId: GraphQLID, conversations: Conversation? = nil, id: GraphQLID, messages: Message? = nil, username: String, registered: Bool? = nil) {
608 self.init(snapshot: ["__typename": "User", "cognitoId": cognitoId, "conversations": conversations.flatMap { $0.snapshot }, "id": id, "messages": messages.flatMap { $0.snapshot }, "username": username, "registered": registered])
609 }
610
611 public var __typename: String {
612 get {
613 return snapshot["__typename"]! as! String
614 }
615 set {
616 snapshot.updateValue(newValue, forKey: "__typename")
617 }
618 }
619
620 /// A unique identifier for the user.
621 public var cognitoId: GraphQLID {
622 get {
623 return snapshot["cognitoId"]! as! GraphQLID
624 }
625 set {
626 snapshot.updateValue(newValue, forKey: "cognitoId")
627 }
628 }
629
630 /// A user's enrolled Conversations. This is an interesting case. This is an interesting pagination case.
631 public var conversations: Conversation? {
632 get {
633 return (snapshot["conversations"] as? Snapshot).flatMap { Conversation(snapshot: $0) }
634 }
635 set {
636 snapshot.updateValue(newValue?.snapshot, forKey: "conversations")
637 }
638 }
639
640 /// Generated id for a user. read-only
641 public var id: GraphQLID {
642 get {
643 return snapshot["id"]! as! GraphQLID
644 }
645 set {
646 snapshot.updateValue(newValue, forKey: "id")
647 }
648 }
649
650 /// Get a users messages by querying a GSI on the Messages table.
651 public var messages: Message? {
652 get {
653 return (snapshot["messages"] as? Snapshot).flatMap { Message(snapshot: $0) }
654 }
655 set {
656 snapshot.updateValue(newValue?.snapshot, forKey: "messages")
657 }
658 }
659
660 /// The username
661 public var username: String {
662 get {
663 return snapshot["username"]! as! String
664 }
665 set {
666 snapshot.updateValue(newValue, forKey: "username")
667 }
668 }
669
670 /// is the user registered?
671 public var registered: Bool? {
672 get {
673 return snapshot["registered"] as? Bool
674 }
675 set {
676 snapshot.updateValue(newValue, forKey: "registered")
677 }
678 }
679
680 public struct Conversation: GraphQLSelectionSet {
681 public static let possibleTypes = ["UserConverstationsConnection"]
682
683 public static let selections: [GraphQLSelection] = [
684 GraphQLField("__typename", type: .nonNull(.scalar(String.self))),
685 GraphQLField("nextToken", type: .scalar(String.self)),
686 ]
687
688 public var snapshot: Snapshot
689
690 public init(snapshot: Snapshot) {
691 self.snapshot = snapshot
692 }
693
694 public init(nextToken: String? = nil) {
695 self.init(snapshot: ["__typename": "UserConverstationsConnection", "nextToken": nextToken])
696 }
697
698 public var __typename: String {
699 get {
700 return snapshot["__typename"]! as! String
701 }
702 set {
703 snapshot.updateValue(newValue, forKey: "__typename")
704 }
705 }
706
707 public var nextToken: String? {
708 get {
709 return snapshot["nextToken"] as? String
710 }
711 set {
712 snapshot.updateValue(newValue, forKey: "nextToken")
713 }
714 }
715 }
716
717 public struct Message: GraphQLSelectionSet {
718 public static let possibleTypes = ["MessageConnection"]
719
720 public static let selections: [GraphQLSelection] = [
721 GraphQLField("__typename", type: .nonNull(.scalar(String.self))),
722 GraphQLField("nextToken", type: .scalar(String.self)),
723 ]
724
725 public var snapshot: Snapshot
726
727 public init(snapshot: Snapshot) {
728 self.snapshot = snapshot
729 }
730
731 public init(nextToken: String? = nil) {
732 self.init(snapshot: ["__typename": "MessageConnection", "nextToken": nextToken])
733 }
734
735 public var __typename: String {
736 get {
737 return snapshot["__typename"]! as! String
738 }
739 set {
740 snapshot.updateValue(newValue, forKey: "__typename")
741 }
742 }
743
744 public var nextToken: String? {
745 get {
746 return snapshot["nextToken"] as? String
747 }
748 set {
749 snapshot.updateValue(newValue, forKey: "nextToken")
750 }
751 }
752 }
753 }
754 }
755 }
756}
757
758public final class CreateUserMutation: GraphQLMutation {
759 public static let operationString =
760 "mutation CreateUser($username: String!) {\n createUser(username: $username) {\n __typename\n cognitoId\n conversations {\n __typename\n nextToken\n userConversations {\n __typename\n conversationId\n userId\n }\n }\n id\n messages {\n __typename\n messages {\n __typename\n content\n conversationId\n createdAt\n id\n isSent\n sender\n }\n nextToken\n }\n username\n registered\n }\n}"
761
762 public var username: String
763
764 public init(username: String) {
765 self.username = username
766 }
767
768 public var variables: GraphQLMap? {
769 return ["username": username]
770 }
771
772 public struct Data: GraphQLSelectionSet {
773 public static let possibleTypes = ["Mutation"]
774
775 public static let selections: [GraphQLSelection] = [
776 GraphQLField("createUser", arguments: ["username": GraphQLVariable("username")], type: .object(CreateUser.selections)),
777 ]
778
779 public var snapshot: Snapshot
780
781 public init(snapshot: Snapshot) {
782 self.snapshot = snapshot
783 }
784
785 public init(createUser: CreateUser? = nil) {
786 self.init(snapshot: ["__typename": "Mutation", "createUser": createUser.flatMap { $0.snapshot }])
787 }
788
789 /// Put a single value of type 'User'. If an item does not exist with the same key the item will be created. If there exists an item at that key already, it will be updated.
790 public var createUser: CreateUser? {
791 get {
792 return (snapshot["createUser"] as? Snapshot).flatMap { CreateUser(snapshot: $0) }
793 }
794 set {
795 snapshot.updateValue(newValue?.snapshot, forKey: "createUser")
796 }
797 }
798
799 public struct CreateUser: GraphQLSelectionSet {
800 public static let possibleTypes = ["User"]
801
802 public static let selections: [GraphQLSelection] = [
803 GraphQLField("__typename", type: .nonNull(.scalar(String.self))),
804 GraphQLField("cognitoId", type: .nonNull(.scalar(GraphQLID.self))),
805 GraphQLField("conversations", type: .object(Conversation.selections)),
806 GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))),
807 GraphQLField("messages", type: .object(Message.selections)),
808 GraphQLField("username", type: .nonNull(.scalar(String.self))),
809 GraphQLField("registered", type: .scalar(Bool.self)),
810 ]
811
812 public var snapshot: Snapshot
813
814 public init(snapshot: Snapshot) {
815 self.snapshot = snapshot
816 }
817
818 public init(cognitoId: GraphQLID, conversations: Conversation? = nil, id: GraphQLID, messages: Message? = nil, username: String, registered: Bool? = nil) {
819 self.init(snapshot: ["__typename": "User", "cognitoId": cognitoId, "conversations": conversations.flatMap { $0.snapshot }, "id": id, "messages": messages.flatMap { $0.snapshot }, "username": username, "registered": registered])
820 }
821
822 public var __typename: String {
823 get {
824 return snapshot["__typename"]! as! String
825 }
826 set {
827 snapshot.updateValue(newValue, forKey: "__typename")
828 }
829 }
830
831 /// A unique identifier for the user.
832 public var cognitoId: GraphQLID {
833 get {
834 return snapshot["cognitoId"]! as! GraphQLID
835 }
836 set {
837 snapshot.updateValue(newValue, forKey: "cognitoId")
838 }
839 }
840
841 /// A user's enrolled Conversations. This is an interesting case. This is an interesting pagination case.
842 public var conversations: Conversation? {
843 get {
844 return (snapshot["conversations"] as? Snapshot).flatMap { Conversation(snapshot: $0) }
845 }
846 set {
847 snapshot.updateValue(newValue?.snapshot, forKey: "conversations")
848 }
849 }
850
851 /// Generated id for a user. read-only
852 public var id: GraphQLID {
853 get {
854 return snapshot["id"]! as! GraphQLID
855 }
856 set {
857 snapshot.updateValue(newValue, forKey: "id")
858 }
859 }
860
861 /// Get a users messages by querying a GSI on the Messages table.
862 public var messages: Message? {
863 get {
864 return (snapshot["messages"] as? Snapshot).flatMap { Message(snapshot: $0) }
865 }
866 set {
867 snapshot.updateValue(newValue?.snapshot, forKey: "messages")
868 }
869 }
870
871 /// The username
872 public var username: String {
873 get {
874 return snapshot["username"]! as! String
875 }
876 set {
877 snapshot.updateValue(newValue, forKey: "username")
878 }
879 }
880
881 /// is the user registered?
882 public var registered: Bool? {
883 get {
884 return snapshot["registered"] as? Bool
885 }
886 set {
887 snapshot.updateValue(newValue, forKey: "registered")
888 }
889 }
890
891 public struct Conversation: GraphQLSelectionSet {
892 public static let possibleTypes = ["UserConverstationsConnection"]
893
894 public static let selections: [GraphQLSelection] = [
895 GraphQLField("__typename", type: .nonNull(.scalar(String.self))),
896 GraphQLField("nextToken", type: .scalar(String.self)),
897 GraphQLField("userConversations", type: .list(.object(UserConversation.selections))),
898 ]
899
900 public var snapshot: Snapshot
901
902 public init(snapshot: Snapshot) {
903 self.snapshot = snapshot
904 }
905
906 public init(nextToken: String? = nil, userConversations: [UserConversation?]? = nil) {
907 self.init(snapshot: ["__typename": "UserConverstationsConnection", "nextToken": nextToken, "userConversations": userConversations.flatMap { $0.map { $0.flatMap { $0.snapshot } } }])
908 }
909
910 public var __typename: String {
911 get {
912 return snapshot["__typename"]! as! String
913 }
914 set {
915 snapshot.updateValue(newValue, forKey: "__typename")
916 }
917 }
918
919 public var nextToken: String? {
920 get {
921 return snapshot["nextToken"] as? String
922 }
923 set {
924 snapshot.updateValue(newValue, forKey: "nextToken")
925 }
926 }
927
928 public var userConversations: [UserConversation?]? {
929 get {
930 return (snapshot["userConversations"] as? [Snapshot?]).flatMap { $0.map { $0.flatMap { UserConversation(snapshot: $0) } } }
931 }
932 set {
933 snapshot.updateValue(newValue.flatMap { $0.map { $0.flatMap { $0.snapshot } } }, forKey: "userConversations")
934 }
935 }
936
937 public struct UserConversation: GraphQLSelectionSet {
938 public static let possibleTypes = ["UserConversations"]
939
940 public static let selections: [GraphQLSelection] = [
941 GraphQLField("__typename", type: .nonNull(.scalar(String.self))),
942 GraphQLField("conversationId", type: .nonNull(.scalar(GraphQLID.self))),
943 GraphQLField("userId", type: .nonNull(.scalar(GraphQLID.self))),
944 ]
945
946 public var snapshot: Snapshot
947
948 public init(snapshot: Snapshot) {
949 self.snapshot = snapshot
950 }
951
952 public init(conversationId: GraphQLID, userId: GraphQLID) {
953 self.init(snapshot: ["__typename": "UserConversations", "conversationId": conversationId, "userId": userId])
954 }
955
956 public var __typename: String {
957 get {
958 return snapshot["__typename"]! as! String
959 }
960 set {
961 snapshot.updateValue(newValue, forKey: "__typename")
962 }
963 }
964
965 public var conversationId: GraphQLID {
966 get {
967 return snapshot["conversationId"]! as! GraphQLID
968 }
969 set {
970 snapshot.updateValue(newValue, forKey: "conversationId")
971 }
972 }
973
974 public var userId: GraphQLID {
975 get {
976 return snapshot["userId"]! as! GraphQLID
977 }
978 set {
979 snapshot.updateValue(newValue, forKey: "userId")
980 }
981 }
982 }
983 }
984
985 public struct Message: GraphQLSelectionSet {
986 public static let possibleTypes = ["MessageConnection"]
987
988 public static let selections: [GraphQLSelection] = [
989 GraphQLField("__typename", type: .nonNull(.scalar(String.self))),
990 GraphQLField("messages", type: .list(.object(Message.selections))),
991 GraphQLField("nextToken", type: .scalar(String.self)),
992 ]
993
994 public var snapshot: Snapshot
995
996 public init(snapshot: Snapshot) {
997 self.snapshot = snapshot
998 }
999
1000 public init(messages: [Message?]? = nil, nextToken: String? = nil) {
1001 self.init(snapshot: ["__typename": "MessageConnection", "messages": messages.flatMap { $0.map { $0.flatMap { $0.snapshot } } }, "nextToken": nextToken])
1002 }
1003
1004 public var __typename: String {
1005 get {
1006 return snapshot["__typename"]! as! String
1007 }
1008 set {
1009 snapshot.updateValue(newValue, forKey: "__typename")
1010 }
1011 }
1012
1013 public var messages: [Message?]? {
1014 get {
1015 return (snapshot["messages"] as? [Snapshot?]).flatMap { $0.map { $0.flatMap { Message(snapshot: $0) } } }
1016 }
1017 set {
1018 snapshot.updateValue(newValue.flatMap { $0.map { $0.flatMap { $0.snapshot } } }, forKey: "messages")
1019 }
1020 }
1021
1022 public var nextToken: String? {
1023 get {
1024 return snapshot["nextToken"] as? String
1025 }
1026 set {
1027 snapshot.updateValue(newValue, forKey: "nextToken")
1028 }
1029 }
1030
1031 public struct Message: GraphQLSelectionSet {
1032 public static let possibleTypes = ["Message"]
1033
1034 public static let selections: [GraphQLSelection] = [
1035 GraphQLField("__typename", type: .nonNull(.scalar(String.self))),
1036 GraphQLField("content", type: .nonNull(.scalar(String.self))),
1037 GraphQLField("conversationId", type: .nonNull(.scalar(GraphQLID.self))),
1038 GraphQLField("createdAt", type: .scalar(String.self)),
1039 GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))),
1040 GraphQLField("isSent", type: .scalar(Bool.self)),
1041 GraphQLField("sender", type: .scalar(String.self)),
1042 ]
1043
1044 public var snapshot: Snapshot
1045
1046 public init(snapshot: Snapshot) {
1047 self.snapshot = snapshot
1048 }
1049
1050 public init(content: String, conversationId: GraphQLID, createdAt: String? = nil, id: GraphQLID, isSent: Bool? = nil, sender: String? = nil) {
1051 self.init(snapshot: ["__typename": "Message", "content": content, "conversationId": conversationId, "createdAt": createdAt, "id": id, "isSent": isSent, "sender": sender])
1052 }
1053
1054 public var __typename: String {
1055 get {
1056 return snapshot["__typename"]! as! String
1057 }
1058 set {
1059 snapshot.updateValue(newValue, forKey: "__typename")
1060 }
1061 }
1062
1063 /// The message content.
1064 public var content: String {
1065 get {
1066 return snapshot["content"]! as! String
1067 }
1068 set {
1069 snapshot.updateValue(newValue, forKey: "content")
1070 }
1071 }
1072
1073 /// The id of the Conversation this message belongs to. This is the table primary key.
1074 public var conversationId: GraphQLID {
1075 get {
1076 return snapshot["conversationId"]! as! GraphQLID
1077 }
1078 set {
1079 snapshot.updateValue(newValue, forKey: "conversationId")
1080 }
1081 }
1082
1083 /// The message timestamp. This is also the table sort key.
1084 public var createdAt: String? {
1085 get {
1086 return snapshot["createdAt"] as? String
1087 }
1088 set {
1089 snapshot.updateValue(newValue, forKey: "createdAt")
1090 }
1091 }
1092
1093 /// Generated id for a message -- read-only
1094 public var id: GraphQLID {
1095 get {
1096 return snapshot["id"]! as! GraphQLID
1097 }
1098 set {
1099 snapshot.updateValue(newValue, forKey: "id")
1100 }
1101 }
1102
1103 /// Flag denoting if this message has been accepted by the server or not.
1104 public var isSent: Bool? {
1105 get {
1106 return snapshot["isSent"] as? Bool
1107 }
1108 set {
1109 snapshot.updateValue(newValue, forKey: "isSent")
1110 }
1111 }
1112
1113 public var sender: String? {
1114 get {
1115 return snapshot["sender"] as? String
1116 }
1117 set {
1118 snapshot.updateValue(newValue, forKey: "sender")
1119 }
1120 }
1121 }
1122 }
1123 }
1124 }
1125}
1126
1127public final class CreateUserConversationsMutation: GraphQLMutation {
1128 public static let operationString =
1129 "mutation CreateUserConversations($conversationId: ID!, $userId: ID!) {\n createUserConversations(conversationId: $conversationId, userId: $userId) {\n __typename\n associated {\n __typename\n associated {\n __typename\n conversationId\n userId\n }\n conversation {\n __typename\n createdAt\n id\n name\n }\n conversationId\n user {\n __typename\n cognitoId\n id\n username\n registered\n }\n userId\n }\n conversation {\n __typename\n createdAt\n id\n messages {\n __typename\n nextToken\n }\n name\n }\n conversationId\n user {\n __typename\n cognitoId\n conversations {\n __typename\n nextToken\n }\n id\n messages {\n __typename\n nextToken\n }\n username\n registered\n }\n userId\n }\n}"
1130
1131 public var conversationId: GraphQLID
1132 public var userId: GraphQLID
1133
1134 public init(conversationId: GraphQLID, userId: GraphQLID) {
1135 self.conversationId = conversationId
1136 self.userId = userId
1137 }
1138
1139 public var variables: GraphQLMap? {
1140 return ["conversationId": conversationId, "userId": userId]
1141 }
1142
1143 public struct Data: GraphQLSelectionSet {
1144 public static let possibleTypes = ["Mutation"]
1145
1146 public static let selections: [GraphQLSelection] = [
1147 GraphQLField("createUserConversations", arguments: ["conversationId": GraphQLVariable("conversationId"), "userId": GraphQLVariable("userId")], type: .object(CreateUserConversation.selections)),
1148 ]
1149
1150 public var snapshot: Snapshot
1151
1152 public init(snapshot: Snapshot) {
1153 self.snapshot = snapshot
1154 }
1155
1156 public init(createUserConversations: CreateUserConversation? = nil) {
1157 self.init(snapshot: ["__typename": "Mutation", "createUserConversations": createUserConversations.flatMap { $0.snapshot }])
1158 }
1159
1160 /// Put a single value of type 'UserConversations'. If an item does not exist with the same key the item will be created. If there exists an item at that key already, it will be updated.
1161 public var createUserConversations: CreateUserConversation? {
1162 get {
1163 return (snapshot["createUserConversations"] as? Snapshot).flatMap { CreateUserConversation(snapshot: $0) }
1164 }
1165 set {
1166 snapshot.updateValue(newValue?.snapshot, forKey: "createUserConversations")
1167 }
1168 }
1169
1170 public struct CreateUserConversation: GraphQLSelectionSet {
1171 public static let possibleTypes = ["UserConversations"]
1172
1173 public static let selections: [GraphQLSelection] = [
1174 GraphQLField("__typename", type: .nonNull(.scalar(String.self))),
1175 GraphQLField("associated", type: .list(.object(Associated.selections))),
1176 GraphQLField("conversation", type: .object(Conversation.selections)),
1177 GraphQLField("conversationId", type: .nonNull(.scalar(GraphQLID.self))),
1178 GraphQLField("user", type: .object(User.selections)),
1179 GraphQLField("userId", type: .nonNull(.scalar(GraphQLID.self))),
1180 ]
1181
1182 public var snapshot: Snapshot
1183
1184 public init(snapshot: Snapshot) {
1185 self.snapshot = snapshot
1186 }
1187
1188 public init(associated: [Associated?]? = nil, conversation: Conversation? = nil, conversationId: GraphQLID, user: User? = nil, userId: GraphQLID) {
1189 self.init(snapshot: ["__typename": "UserConversations", "associated": associated.flatMap { $0.map { $0.flatMap { $0.snapshot } } }, "conversation": conversation.flatMap { $0.snapshot }, "conversationId": conversationId, "user": user.flatMap { $0.snapshot }, "userId": userId])
1190 }
1191
1192 public var __typename: String {
1193 get {
1194 return snapshot["__typename"]! as! String
1195 }
1196 set {
1197 snapshot.updateValue(newValue, forKey: "__typename")
1198 }
1199 }
1200
1201 public var associated: [Associated?]? {
1202 get {
1203 return (snapshot["associated"] as? [Snapshot?]).flatMap { $0.map { $0.flatMap { Associated(snapshot: $0) } } }
1204 }
1205 set {
1206 snapshot.updateValue(newValue.flatMap { $0.map { $0.flatMap { $0.snapshot } } }, forKey: "associated")
1207 }
1208 }
1209
1210 public var conversation: Conversation? {
1211 get {
1212 return (snapshot["conversation"] as? Snapshot).flatMap { Conversation(snapshot: $0) }
1213 }
1214 set {
1215 snapshot.updateValue(newValue?.snapshot, forKey: "conversation")
1216 }
1217 }
1218
1219 public var conversationId: GraphQLID {
1220 get {
1221 return snapshot["conversationId"]! as! GraphQLID
1222 }
1223 set {
1224 snapshot.updateValue(newValue, forKey: "conversationId")
1225 }
1226 }
1227
1228 public var user: User? {
1229 get {
1230 return (snapshot["user"] as? Snapshot).flatMap { User(snapshot: $0) }
1231 }
1232 set {
1233 snapshot.updateValue(newValue?.snapshot, forKey: "user")
1234 }
1235 }
1236
1237 public var userId: GraphQLID {
1238 get {
1239 return snapshot["userId"]! as! GraphQLID
1240 }
1241 set {
1242 snapshot.updateValue(newValue, forKey: "userId")
1243 }
1244 }
1245
1246 public struct Associated: GraphQLSelectionSet {
1247 public static let possibleTypes = ["UserConversations"]
1248
1249 public static let selections: [GraphQLSelection] = [
1250 GraphQLField("__typename", type: .nonNull(.scalar(String.self))),
1251 GraphQLField("associated", type: .list(.object(Associated.selections))),
1252 GraphQLField("conversation", type: .object(Conversation.selections)),
1253 GraphQLField("conversationId", type: .nonNull(.scalar(GraphQLID.self))),
1254 GraphQLField("user", type: .object(User.selections)),
1255 GraphQLField("userId", type: .nonNull(.scalar(GraphQLID.self))),
1256 ]
1257
1258 public var snapshot: Snapshot
1259
1260 public init(snapshot: Snapshot) {
1261 self.snapshot = snapshot
1262 }
1263
1264 public init(associated: [Associated?]? = nil, conversation: Conversation? = nil, conversationId: GraphQLID, user: User? = nil, userId: GraphQLID) {
1265 self.init(snapshot: ["__typename": "UserConversations", "associated": associated.flatMap { $0.map { $0.flatMap { $0.snapshot } } }, "conversation": conversation.flatMap { $0.snapshot }, "conversationId": conversationId, "user": user.flatMap { $0.snapshot }, "userId": userId])
1266 }
1267
1268 public var __typename: String {
1269 get {
1270 return snapshot["__typename"]! as! String
1271 }
1272 set {
1273 snapshot.updateValue(newValue, forKey: "__typename")
1274 }
1275 }
1276
1277 public var associated: [Associated?]? {
1278 get {
1279 return (snapshot["associated"] as? [Snapshot?]).flatMap { $0.map { $0.flatMap { Associated(snapshot: $0) } } }
1280 }
1281 set {
1282 snapshot.updateValue(newValue.flatMap { $0.map { $0.flatMap { $0.snapshot } } }, forKey: "associated")
1283 }
1284 }
1285
1286 public var conversation: Conversation? {
1287 get {
1288 return (snapshot["conversation"] as? Snapshot).flatMap { Conversation(snapshot: $0) }
1289 }
1290 set {
1291 snapshot.updateValue(newValue?.snapshot, forKey: "conversation")
1292 }
1293 }
1294
1295 public var conversationId: GraphQLID {
1296 get {
1297 return snapshot["conversationId"]! as! GraphQLID
1298 }
1299 set {
1300 snapshot.updateValue(newValue, forKey: "conversationId")
1301 }
1302 }
1303
1304 public var user: User? {
1305 get {
1306 return (snapshot["user"] as? Snapshot).flatMap { User(snapshot: $0) }
1307 }
1308 set {
1309 snapshot.updateValue(newValue?.snapshot, forKey: "user")
1310 }
1311 }
1312
1313 public var userId: GraphQLID {
1314 get {
1315 return snapshot["userId"]! as! GraphQLID
1316 }
1317 set {
1318 snapshot.updateValue(newValue, forKey: "userId")
1319 }
1320 }
1321
1322 public struct Associated: GraphQLSelectionSet {
1323 public static let possibleTypes = ["UserConversations"]
1324
1325 public static let selections: [GraphQLSelection] = [
1326 GraphQLField("__typename", type: .nonNull(.scalar(String.self))),
1327 GraphQLField("conversationId", type: .nonNull(.scalar(GraphQLID.self))),
1328 GraphQLField("userId", type: .nonNull(.scalar(GraphQLID.self))),
1329 ]
1330
1331 public var snapshot: Snapshot
1332
1333 public init(snapshot: Snapshot) {
1334 self.snapshot = snapshot
1335 }
1336
1337 public init(conversationId: GraphQLID, userId: GraphQLID) {
1338 self.init(snapshot: ["__typename": "UserConversations", "conversationId": conversationId, "userId": userId])
1339 }
1340
1341 public var __typename: String {
1342 get {
1343 return snapshot["__typename"]! as! String
1344 }
1345 set {
1346 snapshot.updateValue(newValue, forKey: "__typename")
1347 }
1348 }
1349
1350 public var conversationId: GraphQLID {
1351 get {
1352 return snapshot["conversationId"]! as! GraphQLID
1353 }
1354 set {
1355 snapshot.updateValue(newValue, forKey: "conversationId")
1356 }
1357 }
1358
1359 public var userId: GraphQLID {
1360 get {
1361 return snapshot["userId"]! as! GraphQLID
1362 }
1363 set {
1364 snapshot.updateValue(newValue, forKey: "userId")
1365 }
1366 }
1367 }
1368
1369 public struct Conversation: GraphQLSelectionSet {
1370 public static let possibleTypes = ["Conversation"]
1371
1372 public static let selections: [GraphQLSelection] = [
1373 GraphQLField("__typename", type: .nonNull(.scalar(String.self))),
1374 GraphQLField("createdAt", type: .scalar(String.self)),
1375 GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))),
1376 GraphQLField("name", type: .nonNull(.scalar(String.self))),
1377 ]
1378
1379 public var snapshot: Snapshot
1380
1381 public init(snapshot: Snapshot) {
1382 self.snapshot = snapshot
1383 }
1384
1385 public init(createdAt: String? = nil, id: GraphQLID, name: String) {
1386 self.init(snapshot: ["__typename": "Conversation", "createdAt": createdAt, "id": id, "name": name])
1387 }
1388
1389 public var __typename: String {
1390 get {
1391 return snapshot["__typename"]! as! String
1392 }
1393 set {
1394 snapshot.updateValue(newValue, forKey: "__typename")
1395 }
1396 }
1397
1398 /// The Conversation's timestamp.
1399 public var createdAt: String? {
1400 get {
1401 return snapshot["createdAt"] as? String
1402 }
1403 set {
1404 snapshot.updateValue(newValue, forKey: "createdAt")
1405 }
1406 }
1407
1408 /// A unique identifier for the Conversation.
1409 public var id: GraphQLID {
1410 get {
1411 return snapshot["id"]! as! GraphQLID
1412 }
1413 set {
1414 snapshot.updateValue(newValue, forKey: "id")
1415 }
1416 }
1417
1418 /// The Conversation's name.
1419 public var name: String {
1420 get {
1421 return snapshot["name"]! as! String
1422 }
1423 set {
1424 snapshot.updateValue(newValue, forKey: "name")
1425 }
1426 }
1427 }
1428
1429 public struct User: GraphQLSelectionSet {
1430 public static let possibleTypes = ["User"]
1431
1432 public static let selections: [GraphQLSelection] = [
1433 GraphQLField("__typename", type: .nonNull(.scalar(String.self))),
1434 GraphQLField("cognitoId", type: .nonNull(.scalar(GraphQLID.self))),
1435 GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))),
1436 GraphQLField("username", type: .nonNull(.scalar(String.self))),
1437 GraphQLField("registered", type: .scalar(Bool.self)),
1438 ]
1439
1440 public var snapshot: Snapshot
1441
1442 public init(snapshot: Snapshot) {
1443 self.snapshot = snapshot
1444 }
1445
1446 public init(cognitoId: GraphQLID, id: GraphQLID, username: String, registered: Bool? = nil) {
1447 self.init(snapshot: ["__typename": "User", "cognitoId": cognitoId, "id": id, "username": username, "registered": registered])
1448 }
1449
1450 public var __typename: String {
1451 get {
1452 return snapshot["__typename"]! as! String
1453 }
1454 set {
1455 snapshot.updateValue(newValue, forKey: "__typename")
1456 }
1457 }
1458
1459 /// A unique identifier for the user.
1460 public var cognitoId: GraphQLID {
1461 get {
1462 return snapshot["cognitoId"]! as! GraphQLID
1463 }
1464 set {
1465 snapshot.updateValue(newValue, forKey: "cognitoId")
1466 }
1467 }
1468
1469 /// Generated id for a user. read-only
1470 public var id: GraphQLID {
1471 get {
1472 return snapshot["id"]! as! GraphQLID
1473 }
1474 set {
1475 snapshot.updateValue(newValue, forKey: "id")
1476 }
1477 }
1478
1479 /// The username
1480 public var username: String {
1481 get {
1482 return snapshot["username"]! as! String
1483 }
1484 set {
1485 snapshot.updateValue(newValue, forKey: "username")
1486 }
1487 }
1488
1489 /// is the user registered?
1490 public var registered: Bool? {
1491 get {
1492 return snapshot["registered"] as? Bool
1493 }
1494 set {
1495 snapshot.updateValue(newValue, forKey: "registered")
1496 }
1497 }
1498 }
1499 }
1500
1501 public struct Conversation: GraphQLSelectionSet {
1502 public static let possibleTypes = ["Conversation"]
1503
1504 public static let selections: [GraphQLSelection] = [
1505 GraphQLField("__typename", type: .nonNull(.scalar(String.self))),
1506 GraphQLField("createdAt", type: .scalar(String.self)),
1507 GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))),
1508 GraphQLField("messages", type: .object(Message.selections)),
1509 GraphQLField("name", type: .nonNull(.scalar(String.self))),
1510 ]
1511
1512 public var snapshot: Snapshot
1513
1514 public init(snapshot: Snapshot) {
1515 self.snapshot = snapshot
1516 }
1517
1518 public init(createdAt: String? = nil, id: GraphQLID, messages: Message? = nil, name: String) {
1519 self.init(snapshot: ["__typename": "Conversation", "createdAt": createdAt, "id": id, "messages": messages.flatMap { $0.snapshot }, "name": name])
1520 }
1521
1522 public var __typename: String {
1523 get {
1524 return snapshot["__typename"]! as! String
1525 }
1526 set {
1527 snapshot.updateValue(newValue, forKey: "__typename")
1528 }
1529 }
1530
1531 /// The Conversation's timestamp.
1532 public var createdAt: String? {
1533 get {
1534 return snapshot["createdAt"] as? String
1535 }
1536 set {
1537 snapshot.updateValue(newValue, forKey: "createdAt")
1538 }
1539 }
1540
1541 /// A unique identifier for the Conversation.
1542 public var id: GraphQLID {
1543 get {
1544 return snapshot["id"]! as! GraphQLID
1545 }
1546 set {
1547 snapshot.updateValue(newValue, forKey: "id")
1548 }
1549 }
1550
1551 /// The Conversation's messages.
1552 public var messages: Message? {
1553 get {
1554 return (snapshot["messages"] as? Snapshot).flatMap { Message(snapshot: $0) }
1555 }
1556 set {
1557 snapshot.updateValue(newValue?.snapshot, forKey: "messages")
1558 }
1559 }
1560
1561 /// The Conversation's name.
1562 public var name: String {
1563 get {
1564 return snapshot["name"]! as! String
1565 }
1566 set {
1567 snapshot.updateValue(newValue, forKey: "name")
1568 }
1569 }
1570
1571 public struct Message: GraphQLSelectionSet {
1572 public static let possibleTypes = ["MessageConnection"]
1573
1574 public static let selections: [GraphQLSelection] = [
1575 GraphQLField("__typename", type: .nonNull(.scalar(String.self))),
1576 GraphQLField("nextToken", type: .scalar(String.self)),
1577 ]
1578
1579 public var snapshot: Snapshot
1580
1581 public init(snapshot: Snapshot) {
1582 self.snapshot = snapshot
1583 }
1584
1585 public init(nextToken: String? = nil) {
1586 self.init(snapshot: ["__typename": "MessageConnection", "nextToken": nextToken])
1587 }
1588
1589 public var __typename: String {
1590 get {
1591 return snapshot["__typename"]! as! String
1592 }
1593 set {
1594 snapshot.updateValue(newValue, forKey: "__typename")
1595 }
1596 }
1597
1598 public var nextToken: String? {
1599 get {
1600 return snapshot["nextToken"] as? String
1601 }
1602 set {
1603 snapshot.updateValue(newValue, forKey: "nextToken")
1604 }
1605 }
1606 }
1607 }
1608
1609 public struct User: GraphQLSelectionSet {
1610 public static let possibleTypes = ["User"]
1611
1612 public static let selections: [GraphQLSelection] = [
1613 GraphQLField("__typename", type: .nonNull(.scalar(String.self))),
1614 GraphQLField("cognitoId", type: .nonNull(.scalar(GraphQLID.self))),
1615 GraphQLField("conversations", type: .object(Conversation.selections)),
1616 GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))),
1617 GraphQLField("messages", type: .object(Message.selections)),
1618 GraphQLField("username", type: .nonNull(.scalar(String.self))),
1619 GraphQLField("registered", type: .scalar(Bool.self)),
1620 ]
1621
1622 public var snapshot: Snapshot
1623
1624 public init(snapshot: Snapshot) {
1625 self.snapshot = snapshot
1626 }
1627
1628 public init(cognitoId: GraphQLID, conversations: Conversation? = nil, id: GraphQLID, messages: Message? = nil, username: String, registered: Bool? = nil) {
1629 self.init(snapshot: ["__typename": "User", "cognitoId": cognitoId, "conversations": conversations.flatMap { $0.snapshot }, "id": id, "messages": messages.flatMap { $0.snapshot }, "username": username, "registered": registered])
1630 }
1631
1632 public var __typename: String {
1633 get {
1634 return snapshot["__typename"]! as! String
1635 }
1636 set {
1637 snapshot.updateValue(newValue, forKey: "__typename")
1638 }
1639 }
1640
1641 /// A unique identifier for the user.
1642 public var cognitoId: GraphQLID {
1643 get {
1644 return snapshot["cognitoId"]! as! GraphQLID
1645 }
1646 set {
1647 snapshot.updateValue(newValue, forKey: "cognitoId")
1648 }
1649 }
1650
1651 /// A user's enrolled Conversations. This is an interesting case. This is an interesting pagination case.
1652 public var conversations: Conversation? {
1653 get {
1654 return (snapshot["conversations"] as? Snapshot).flatMap { Conversation(snapshot: $0) }
1655 }
1656 set {
1657 snapshot.updateValue(newValue?.snapshot, forKey: "conversations")
1658 }
1659 }
1660
1661 /// Generated id for a user. read-only
1662 public var id: GraphQLID {
1663 get {
1664 return snapshot["id"]! as! GraphQLID
1665 }
1666 set {
1667 snapshot.updateValue(newValue, forKey: "id")
1668 }
1669 }
1670
1671 /// Get a users messages by querying a GSI on the Messages table.
1672 public var messages: Message? {
1673 get {
1674 return (snapshot["messages"] as? Snapshot).flatMap { Message(snapshot: $0) }
1675 }
1676 set {
1677 snapshot.updateValue(newValue?.snapshot, forKey: "messages")
1678 }
1679 }
1680
1681 /// The username
1682 public var username: String {
1683 get {
1684 return snapshot["username"]! as! String
1685 }
1686 set {
1687 snapshot.updateValue(newValue, forKey: "username")
1688 }
1689 }
1690
1691 /// is the user registered?
1692 public var registered: Bool? {
1693 get {
1694 return snapshot["registered"] as? Bool
1695 }
1696 set {
1697 snapshot.updateValue(newValue, forKey: "registered")
1698 }
1699 }
1700
1701 public struct Conversation: GraphQLSelectionSet {
1702 public static let possibleTypes = ["UserConverstationsConnection"]
1703
1704 public static let selections: [GraphQLSelection] = [
1705 GraphQLField("__typename", type: .nonNull(.scalar(String.self))),
1706 GraphQLField("nextToken", type: .scalar(String.self)),
1707 ]
1708
1709 public var snapshot: Snapshot
1710
1711 public init(snapshot: Snapshot) {
1712 self.snapshot = snapshot
1713 }
1714
1715 public init(nextToken: String? = nil) {
1716 self.init(snapshot: ["__typename": "UserConverstationsConnection", "nextToken": nextToken])
1717 }
1718
1719 public var __typename: String {
1720 get {
1721 return snapshot["__typename"]! as! String
1722 }
1723 set {
1724 snapshot.updateValue(newValue, forKey: "__typename")
1725 }
1726 }
1727
1728 public var nextToken: String? {
1729 get {
1730 return snapshot["nextToken"] as? String
1731 }
1732 set {
1733 snapshot.updateValue(newValue, forKey: "nextToken")
1734 }
1735 }
1736 }
1737
1738 public struct Message: GraphQLSelectionSet {
1739 public static let possibleTypes = ["MessageConnection"]
1740
1741 public static let selections: [GraphQLSelection] = [
1742 GraphQLField("__typename", type: .nonNull(.scalar(String.self))),
1743 GraphQLField("nextToken", type: .scalar(String.self)),
1744 ]
1745
1746 public var snapshot: Snapshot
1747
1748 public init(snapshot: Snapshot) {
1749 self.snapshot = snapshot
1750 }
1751
1752 public init(nextToken: String? = nil) {
1753 self.init(snapshot: ["__typename": "MessageConnection", "nextToken": nextToken])
1754 }
1755
1756 public var __typename: String {
1757 get {
1758 return snapshot["__typename"]! as! String
1759 }
1760 set {
1761 snapshot.updateValue(newValue, forKey: "__typename")
1762 }
1763 }
1764
1765 public var nextToken: String? {
1766 get {
1767 return snapshot["nextToken"] as? String
1768 }
1769 set {
1770 snapshot.updateValue(newValue, forKey: "nextToken")
1771 }
1772 }
1773 }
1774 }
1775 }
1776 }
1777}
1778
1779public final class AllMessageQuery: GraphQLQuery {
1780 public static let operationString =
1781 "query AllMessage($after: String, $conversationId: ID!, $first: Int) {\n allMessage(after: $after, conversationId: $conversationId, first: $first) {\n __typename\n author {\n __typename\n cognitoId\n conversations {\n __typename\n nextToken\n }\n id\n messages {\n __typename\n nextToken\n }\n username\n registered\n }\n content\n conversationId\n createdAt\n id\n isSent\n recipient {\n __typename\n cognitoId\n conversations {\n __typename\n nextToken\n }\n id\n messages {\n __typename\n nextToken\n }\n username\n registered\n }\n sender\n }\n}"
1782
1783 public var after: String?
1784 public var conversationId: GraphQLID
1785 public var first: Int?
1786
1787 public init(after: String? = nil, conversationId: GraphQLID, first: Int? = nil) {
1788 self.after = after
1789 self.conversationId = conversationId
1790 self.first = first
1791 }
1792
1793 public var variables: GraphQLMap? {
1794 return ["after": after, "conversationId": conversationId, "first": first]
1795 }
1796
1797 public struct Data: GraphQLSelectionSet {
1798 public static let possibleTypes = ["Query"]
1799
1800 public static let selections: [GraphQLSelection] = [
1801 GraphQLField("allMessage", arguments: ["after": GraphQLVariable("after"), "conversationId": GraphQLVariable("conversationId"), "first": GraphQLVariable("first")], type: .list(.object(AllMessage.selections))),
1802 ]
1803
1804 public var snapshot: Snapshot
1805
1806 public init(snapshot: Snapshot) {
1807 self.snapshot = snapshot
1808 }
1809
1810 public init(allMessage: [AllMessage?]? = nil) {
1811 self.init(snapshot: ["__typename": "Query", "allMessage": allMessage.flatMap { $0.map { $0.flatMap { $0.snapshot } } }])
1812 }
1813
1814 /// Scan through all values of type 'Message'. Use the 'after' and 'before' arguments with the 'nextToken' returned by the 'MessageConnection' result to fetch pages.
1815 public var allMessage: [AllMessage?]? {
1816 get {
1817 return (snapshot["allMessage"] as? [Snapshot?]).flatMap { $0.map { $0.flatMap { AllMessage(snapshot: $0) } } }
1818 }
1819 set {
1820 snapshot.updateValue(newValue.flatMap { $0.map { $0.flatMap { $0.snapshot } } }, forKey: "allMessage")
1821 }
1822 }
1823
1824 public struct AllMessage: GraphQLSelectionSet {
1825 public static let possibleTypes = ["Message"]
1826
1827 public static let selections: [GraphQLSelection] = [
1828 GraphQLField("__typename", type: .nonNull(.scalar(String.self))),
1829 GraphQLField("author", type: .object(Author.selections)),
1830 GraphQLField("content", type: .nonNull(.scalar(String.self))),
1831 GraphQLField("conversationId", type: .nonNull(.scalar(GraphQLID.self))),
1832 GraphQLField("createdAt", type: .scalar(String.self)),
1833 GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))),
1834 GraphQLField("isSent", type: .scalar(Bool.self)),
1835 GraphQLField("recipient", type: .object(Recipient.selections)),
1836 GraphQLField("sender", type: .scalar(String.self)),
1837 ]
1838
1839 public var snapshot: Snapshot
1840
1841 public init(snapshot: Snapshot) {
1842 self.snapshot = snapshot
1843 }
1844
1845 public init(author: Author? = nil, content: String, conversationId: GraphQLID, createdAt: String? = nil, id: GraphQLID, isSent: Bool? = nil, recipient: Recipient? = nil, sender: String? = nil) {
1846 self.init(snapshot: ["__typename": "Message", "author": author.flatMap { $0.snapshot }, "content": content, "conversationId": conversationId, "createdAt": createdAt, "id": id, "isSent": isSent, "recipient": recipient.flatMap { $0.snapshot }, "sender": sender])
1847 }
1848
1849 public var __typename: String {
1850 get {
1851 return snapshot["__typename"]! as! String
1852 }
1853 set {
1854 snapshot.updateValue(newValue, forKey: "__typename")
1855 }
1856 }
1857
1858 /// The author object. Note: `authorId` is only available because we list it in `extraAttributes` in `Conversation.messages`
1859 public var author: Author? {
1860 get {
1861 return (snapshot["author"] as? Snapshot).flatMap { Author(snapshot: $0) }
1862 }
1863 set {
1864 snapshot.updateValue(newValue?.snapshot, forKey: "author")
1865 }
1866 }
1867
1868 /// The message content.
1869 public var content: String {
1870 get {
1871 return snapshot["content"]! as! String
1872 }
1873 set {
1874 snapshot.updateValue(newValue, forKey: "content")
1875 }
1876 }
1877
1878 /// The id of the Conversation this message belongs to. This is the table primary key.
1879 public var conversationId: GraphQLID {
1880 get {
1881 return snapshot["conversationId"]! as! GraphQLID
1882 }
1883 set {
1884 snapshot.updateValue(newValue, forKey: "conversationId")
1885 }
1886 }
1887
1888 /// The message timestamp. This is also the table sort key.
1889 public var createdAt: String? {
1890 get {
1891 return snapshot["createdAt"] as? String
1892 }
1893 set {
1894 snapshot.updateValue(newValue, forKey: "createdAt")
1895 }
1896 }
1897
1898 /// Generated id for a message -- read-only
1899 public var id: GraphQLID {
1900 get {
1901 return snapshot["id"]! as! GraphQLID
1902 }
1903 set {
1904 snapshot.updateValue(newValue, forKey: "id")
1905 }
1906 }
1907
1908 /// Flag denoting if this message has been accepted by the server or not.
1909 public var isSent: Bool? {
1910 get {
1911 return snapshot["isSent"] as? Bool
1912 }
1913 set {
1914 snapshot.updateValue(newValue, forKey: "isSent")
1915 }
1916 }
1917
1918 public var recipient: Recipient? {
1919 get {
1920 return (snapshot["recipient"] as? Snapshot).flatMap { Recipient(snapshot: $0) }
1921 }
1922 set {
1923 snapshot.updateValue(newValue?.snapshot, forKey: "recipient")
1924 }
1925 }
1926
1927 public var sender: String? {
1928 get {
1929 return snapshot["sender"] as? String
1930 }
1931 set {
1932 snapshot.updateValue(newValue, forKey: "sender")
1933 }
1934 }
1935
1936 public struct Author: GraphQLSelectionSet {
1937 public static let possibleTypes = ["User"]
1938
1939 public static let selections: [GraphQLSelection] = [
1940 GraphQLField("__typename", type: .nonNull(.scalar(String.self))),
1941 GraphQLField("cognitoId", type: .nonNull(.scalar(GraphQLID.self))),
1942 GraphQLField("conversations", type: .object(Conversation.selections)),
1943 GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))),
1944 GraphQLField("messages", type: .object(Message.selections)),
1945 GraphQLField("username", type: .nonNull(.scalar(String.self))),
1946 GraphQLField("registered", type: .scalar(Bool.self)),
1947 ]
1948
1949 public var snapshot: Snapshot
1950
1951 public init(snapshot: Snapshot) {
1952 self.snapshot = snapshot
1953 }
1954
1955 public init(cognitoId: GraphQLID, conversations: Conversation? = nil, id: GraphQLID, messages: Message? = nil, username: String, registered: Bool? = nil) {
1956 self.init(snapshot: ["__typename": "User", "cognitoId": cognitoId, "conversations": conversations.flatMap { $0.snapshot }, "id": id, "messages": messages.flatMap { $0.snapshot }, "username": username, "registered": registered])
1957 }
1958
1959 public var __typename: String {
1960 get {
1961 return snapshot["__typename"]! as! String
1962 }
1963 set {
1964 snapshot.updateValue(newValue, forKey: "__typename")
1965 }
1966 }
1967
1968 /// A unique identifier for the user.
1969 public var cognitoId: GraphQLID {
1970 get {
1971 return snapshot["cognitoId"]! as! GraphQLID
1972 }
1973 set {
1974 snapshot.updateValue(newValue, forKey: "cognitoId")
1975 }
1976 }
1977
1978 /// A user's enrolled Conversations. This is an interesting case. This is an interesting pagination case.
1979 public var conversations: Conversation? {
1980 get {
1981 return (snapshot["conversations"] as? Snapshot).flatMap { Conversation(snapshot: $0) }
1982 }
1983 set {
1984 snapshot.updateValue(newValue?.snapshot, forKey: "conversations")
1985 }
1986 }
1987
1988 /// Generated id for a user. read-only
1989 public var id: GraphQLID {
1990 get {
1991 return snapshot["id"]! as! GraphQLID
1992 }
1993 set {
1994 snapshot.updateValue(newValue, forKey: "id")
1995 }
1996 }
1997
1998 /// Get a users messages by querying a GSI on the Messages table.
1999 public var messages: Message? {
2000 get {
2001 return (snapshot["messages"] as? Snapshot).flatMap { Message(snapshot: $0) }
2002 }
2003 set {
2004 snapshot.updateValue(newValue?.snapshot, forKey: "messages")
2005 }
2006 }
2007
2008 /// The username
2009 public var username: String {
2010 get {
2011 return snapshot["username"]! as! String
2012 }
2013 set {
2014 snapshot.updateValue(newValue, forKey: "username")
2015 }
2016 }
2017
2018 /// is the user registered?
2019 public var registered: Bool? {
2020 get {
2021 return snapshot["registered"] as? Bool
2022 }
2023 set {
2024 snapshot.updateValue(newValue, forKey: "registered")
2025 }
2026 }
2027
2028 public struct Conversation: GraphQLSelectionSet {
2029 public static let possibleTypes = ["UserConverstationsConnection"]
2030
2031 public static let selections: [GraphQLSelection] = [
2032 GraphQLField("__typename", type: .nonNull(.scalar(String.self))),
2033 GraphQLField("nextToken", type: .scalar(String.self)),
2034 ]
2035
2036 public var snapshot: Snapshot
2037
2038 public init(snapshot: Snapshot) {
2039 self.snapshot = snapshot
2040 }
2041
2042 public init(nextToken: String? = nil) {
2043 self.init(snapshot: ["__typename": "UserConverstationsConnection", "nextToken": nextToken])
2044 }
2045
2046 public var __typename: String {
2047 get {
2048 return snapshot["__typename"]! as! String
2049 }
2050 set {
2051 snapshot.updateValue(newValue, forKey: "__typename")
2052 }
2053 }
2054
2055 public var nextToken: String? {
2056 get {
2057 return snapshot["nextToken"] as? String
2058 }
2059 set {
2060 snapshot.updateValue(newValue, forKey: "nextToken")
2061 }
2062 }
2063 }
2064
2065 public struct Message: GraphQLSelectionSet {
2066 public static let possibleTypes = ["MessageConnection"]
2067
2068 public static let selections: [GraphQLSelection] = [
2069 GraphQLField("__typename", type: .nonNull(.scalar(String.self))),
2070 GraphQLField("nextToken", type: .scalar(String.self)),
2071 ]
2072
2073 public var snapshot: Snapshot
2074
2075 public init(snapshot: Snapshot) {
2076 self.snapshot = snapshot
2077 }
2078
2079 public init(nextToken: String? = nil) {
2080 self.init(snapshot: ["__typename": "MessageConnection", "nextToken": nextToken])
2081 }
2082
2083 public var __typename: String {
2084 get {
2085 return snapshot["__typename"]! as! String
2086 }
2087 set {
2088 snapshot.updateValue(newValue, forKey: "__typename")
2089 }
2090 }
2091
2092 public var nextToken: String? {
2093 get {
2094 return snapshot["nextToken"] as? String
2095 }
2096 set {
2097 snapshot.updateValue(newValue, forKey: "nextToken")
2098 }
2099 }
2100 }
2101 }
2102
2103 public struct Recipient: GraphQLSelectionSet {
2104 public static let possibleTypes = ["User"]
2105
2106 public static let selections: [GraphQLSelection] = [
2107 GraphQLField("__typename", type: .nonNull(.scalar(String.self))),
2108 GraphQLField("cognitoId", type: .nonNull(.scalar(GraphQLID.self))),
2109 GraphQLField("conversations", type: .object(Conversation.selections)),
2110 GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))),
2111 GraphQLField("messages", type: .object(Message.selections)),
2112 GraphQLField("username", type: .nonNull(.scalar(String.self))),
2113 GraphQLField("registered", type: .scalar(Bool.self)),
2114 ]
2115
2116 public var snapshot: Snapshot
2117
2118 public init(snapshot: Snapshot) {
2119 self.snapshot = snapshot
2120 }
2121
2122 public init(cognitoId: GraphQLID, conversations: Conversation? = nil, id: GraphQLID, messages: Message? = nil, username: String, registered: Bool? = nil) {
2123 self.init(snapshot: ["__typename": "User", "cognitoId": cognitoId, "conversations": conversations.flatMap { $0.snapshot }, "id": id, "messages": messages.flatMap { $0.snapshot }, "username": username, "registered": registered])
2124 }
2125
2126 public var __typename: String {
2127 get {
2128 return snapshot["__typename"]! as! String
2129 }
2130 set {
2131 snapshot.updateValue(newValue, forKey: "__typename")
2132 }
2133 }
2134
2135 /// A unique identifier for the user.
2136 public var cognitoId: GraphQLID {
2137 get {
2138 return snapshot["cognitoId"]! as! GraphQLID
2139 }
2140 set {
2141 snapshot.updateValue(newValue, forKey: "cognitoId")
2142 }
2143 }
2144
2145 /// A user's enrolled Conversations. This is an interesting case. This is an interesting pagination case.
2146 public var conversations: Conversation? {
2147 get {
2148 return (snapshot["conversations"] as? Snapshot).flatMap { Conversation(snapshot: $0) }
2149 }
2150 set {
2151 snapshot.updateValue(newValue?.snapshot, forKey: "conversations")
2152 }
2153 }
2154
2155 /// Generated id for a user. read-only
2156 public var id: GraphQLID {
2157 get {
2158 return snapshot["id"]! as! GraphQLID
2159 }
2160 set {
2161 snapshot.updateValue(newValue, forKey: "id")
2162 }
2163 }
2164
2165 /// Get a users messages by querying a GSI on the Messages table.
2166 public var messages: Message? {
2167 get {
2168 return (snapshot["messages"] as? Snapshot).flatMap { Message(snapshot: $0) }
2169 }
2170 set {
2171 snapshot.updateValue(newValue?.snapshot, forKey: "messages")
2172 }
2173 }
2174
2175 /// The username
2176 public var username: String {
2177 get {
2178 return snapshot["username"]! as! String
2179 }
2180 set {
2181 snapshot.updateValue(newValue, forKey: "username")
2182 }
2183 }
2184
2185 /// is the user registered?
2186 public var registered: Bool? {
2187 get {
2188 return snapshot["registered"] as? Bool
2189 }
2190 set {
2191 snapshot.updateValue(newValue, forKey: "registered")
2192 }
2193 }
2194
2195 public struct Conversation: GraphQLSelectionSet {
2196 public static let possibleTypes = ["UserConverstationsConnection"]
2197
2198 public static let selections: [GraphQLSelection] = [
2199 GraphQLField("__typename", type: .nonNull(.scalar(String.self))),
2200 GraphQLField("nextToken", type: .scalar(String.self)),
2201 ]
2202
2203 public var snapshot: Snapshot
2204
2205 public init(snapshot: Snapshot) {
2206 self.snapshot = snapshot
2207 }
2208
2209 public init(nextToken: String? = nil) {
2210 self.init(snapshot: ["__typename": "UserConverstationsConnection", "nextToken": nextToken])
2211 }
2212
2213 public var __typename: String {
2214 get {
2215 return snapshot["__typename"]! as! String
2216 }
2217 set {
2218 snapshot.updateValue(newValue, forKey: "__typename")
2219 }
2220 }
2221
2222 public var nextToken: String? {
2223 get {
2224 return snapshot["nextToken"] as? String
2225 }
2226 set {
2227 snapshot.updateValue(newValue, forKey: "nextToken")
2228 }
2229 }
2230 }
2231
2232 public struct Message: GraphQLSelectionSet {
2233 public static let possibleTypes = ["MessageConnection"]
2234
2235 public static let selections: [GraphQLSelection] = [
2236 GraphQLField("__typename", type: .nonNull(.scalar(String.self))),
2237 GraphQLField("nextToken", type: .scalar(String.self)),
2238 ]
2239
2240 public var snapshot: Snapshot
2241
2242 public init(snapshot: Snapshot) {
2243 self.snapshot = snapshot
2244 }
2245
2246 public init(nextToken: String? = nil) {
2247 self.init(snapshot: ["__typename": "MessageConnection", "nextToken": nextToken])
2248 }
2249
2250 public var __typename: String {
2251 get {
2252 return snapshot["__typename"]! as! String
2253 }
2254 set {
2255 snapshot.updateValue(newValue, forKey: "__typename")
2256 }
2257 }
2258
2259 public var nextToken: String? {
2260 get {
2261 return snapshot["nextToken"] as? String
2262 }
2263 set {
2264 snapshot.updateValue(newValue, forKey: "nextToken")
2265 }
2266 }
2267 }
2268 }
2269 }
2270 }
2271}
2272
2273public final class AllMessageConnectionQuery: GraphQLQuery {
2274 public static let operationString =
2275 "query AllMessageConnection($after: String, $conversationId: ID!, $first: Int) {\n allMessageConnection(after: $after, conversationId: $conversationId, first: $first) {\n __typename\n messages {\n __typename\n author {\n __typename\n cognitoId\n id\n username\n registered\n }\n content\n conversationId\n createdAt\n id\n isSent\n recipient {\n __typename\n cognitoId\n id\n username\n registered\n }\n sender\n }\n nextToken\n }\n}"
2276
2277 public var after: String?
2278 public var conversationId: GraphQLID
2279 public var first: Int?
2280
2281 public init(after: String? = nil, conversationId: GraphQLID, first: Int? = nil) {
2282 self.after = after
2283 self.conversationId = conversationId
2284 self.first = first
2285 }
2286
2287 public var variables: GraphQLMap? {
2288 return ["after": after, "conversationId": conversationId, "first": first]
2289 }
2290
2291 public struct Data: GraphQLSelectionSet {
2292 public static let possibleTypes = ["Query"]
2293
2294 public static let selections: [GraphQLSelection] = [
2295 GraphQLField("allMessageConnection", arguments: ["after": GraphQLVariable("after"), "conversationId": GraphQLVariable("conversationId"), "first": GraphQLVariable("first")], type: .object(AllMessageConnection.selections)),
2296 ]
2297
2298 public var snapshot: Snapshot
2299
2300 public init(snapshot: Snapshot) {
2301 self.snapshot = snapshot
2302 }
2303
2304 public init(allMessageConnection: AllMessageConnection? = nil) {
2305 self.init(snapshot: ["__typename": "Query", "allMessageConnection": allMessageConnection.flatMap { $0.snapshot }])
2306 }
2307
2308 /// Scan through all values of type 'MessageConnection'. Use the 'after' and 'before' arguments with the 'nextToken' returned by the 'MessageConnectionConnection' result to fetch pages.
2309 public var allMessageConnection: AllMessageConnection? {
2310 get {
2311 return (snapshot["allMessageConnection"] as? Snapshot).flatMap { AllMessageConnection(snapshot: $0) }
2312 }
2313 set {
2314 snapshot.updateValue(newValue?.snapshot, forKey: "allMessageConnection")
2315 }
2316 }
2317
2318 public struct AllMessageConnection: GraphQLSelectionSet {
2319 public static let possibleTypes = ["MessageConnection"]
2320
2321 public static let selections: [GraphQLSelection] = [
2322 GraphQLField("__typename", type: .nonNull(.scalar(String.self))),
2323 GraphQLField("messages", type: .list(.object(Message.selections))),
2324 GraphQLField("nextToken", type: .scalar(String.self)),
2325 ]
2326
2327 public var snapshot: Snapshot
2328
2329 public init(snapshot: Snapshot) {
2330 self.snapshot = snapshot
2331 }
2332
2333 public init(messages: [Message?]? = nil, nextToken: String? = nil) {
2334 self.init(snapshot: ["__typename": "MessageConnection", "messages": messages.flatMap { $0.map { $0.flatMap { $0.snapshot } } }, "nextToken": nextToken])
2335 }
2336
2337 public var __typename: String {
2338 get {
2339 return snapshot["__typename"]! as! String
2340 }
2341 set {
2342 snapshot.updateValue(newValue, forKey: "__typename")
2343 }
2344 }
2345
2346 public var messages: [Message?]? {
2347 get {
2348 return (snapshot["messages"] as? [Snapshot?]).flatMap { $0.map { $0.flatMap { Message(snapshot: $0) } } }
2349 }
2350 set {
2351 snapshot.updateValue(newValue.flatMap { $0.map { $0.flatMap { $0.snapshot } } }, forKey: "messages")
2352 }
2353 }
2354
2355 public var nextToken: String? {
2356 get {
2357 return snapshot["nextToken"] as? String
2358 }
2359 set {
2360 snapshot.updateValue(newValue, forKey: "nextToken")
2361 }
2362 }
2363
2364 public struct Message: GraphQLSelectionSet {
2365 public static let possibleTypes = ["Message"]
2366
2367 public static let selections: [GraphQLSelection] = [
2368 GraphQLField("__typename", type: .nonNull(.scalar(String.self))),
2369 GraphQLField("author", type: .object(Author.selections)),
2370 GraphQLField("content", type: .nonNull(.scalar(String.self))),
2371 GraphQLField("conversationId", type: .nonNull(.scalar(GraphQLID.self))),
2372 GraphQLField("createdAt", type: .scalar(String.self)),
2373 GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))),
2374 GraphQLField("isSent", type: .scalar(Bool.self)),
2375 GraphQLField("recipient", type: .object(Recipient.selections)),
2376 GraphQLField("sender", type: .scalar(String.self)),
2377 ]
2378
2379 public var snapshot: Snapshot
2380
2381 public init(snapshot: Snapshot) {
2382 self.snapshot = snapshot
2383 }
2384
2385 public init(author: Author? = nil, content: String, conversationId: GraphQLID, createdAt: String? = nil, id: GraphQLID, isSent: Bool? = nil, recipient: Recipient? = nil, sender: String? = nil) {
2386 self.init(snapshot: ["__typename": "Message", "author": author.flatMap { $0.snapshot }, "content": content, "conversationId": conversationId, "createdAt": createdAt, "id": id, "isSent": isSent, "recipient": recipient.flatMap { $0.snapshot }, "sender": sender])
2387 }
2388
2389 public var __typename: String {
2390 get {
2391 return snapshot["__typename"]! as! String
2392 }
2393 set {
2394 snapshot.updateValue(newValue, forKey: "__typename")
2395 }
2396 }
2397
2398 /// The author object. Note: `authorId` is only available because we list it in `extraAttributes` in `Conversation.messages`
2399 public var author: Author? {
2400 get {
2401 return (snapshot["author"] as? Snapshot).flatMap { Author(snapshot: $0) }
2402 }
2403 set {
2404 snapshot.updateValue(newValue?.snapshot, forKey: "author")
2405 }
2406 }
2407
2408 /// The message content.
2409 public var content: String {
2410 get {
2411 return snapshot["content"]! as! String
2412 }
2413 set {
2414 snapshot.updateValue(newValue, forKey: "content")
2415 }
2416 }
2417
2418 /// The id of the Conversation this message belongs to. This is the table primary key.
2419 public var conversationId: GraphQLID {
2420 get {
2421 return snapshot["conversationId"]! as! GraphQLID
2422 }
2423 set {
2424 snapshot.updateValue(newValue, forKey: "conversationId")
2425 }
2426 }
2427
2428 /// The message timestamp. This is also the table sort key.
2429 public var createdAt: String? {
2430 get {
2431 return snapshot["createdAt"] as? String
2432 }
2433 set {
2434 snapshot.updateValue(newValue, forKey: "createdAt")
2435 }
2436 }
2437
2438 /// Generated id for a message -- read-only
2439 public var id: GraphQLID {
2440 get {
2441 return snapshot["id"]! as! GraphQLID
2442 }
2443 set {
2444 snapshot.updateValue(newValue, forKey: "id")
2445 }
2446 }
2447
2448 /// Flag denoting if this message has been accepted by the server or not.
2449 public var isSent: Bool? {
2450 get {
2451 return snapshot["isSent"] as? Bool
2452 }
2453 set {
2454 snapshot.updateValue(newValue, forKey: "isSent")
2455 }
2456 }
2457
2458 public var recipient: Recipient? {
2459 get {
2460 return (snapshot["recipient"] as? Snapshot).flatMap { Recipient(snapshot: $0) }
2461 }
2462 set {
2463 snapshot.updateValue(newValue?.snapshot, forKey: "recipient")
2464 }
2465 }
2466
2467 public var sender: String? {
2468 get {
2469 return snapshot["sender"] as? String
2470 }
2471 set {
2472 snapshot.updateValue(newValue, forKey: "sender")
2473 }
2474 }
2475
2476 public struct Author: GraphQLSelectionSet {
2477 public static let possibleTypes = ["User"]
2478
2479 public static let selections: [GraphQLSelection] = [
2480 GraphQLField("__typename", type: .nonNull(.scalar(String.self))),
2481 GraphQLField("cognitoId", type: .nonNull(.scalar(GraphQLID.self))),
2482 GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))),
2483 GraphQLField("username", type: .nonNull(.scalar(String.self))),
2484 GraphQLField("registered", type: .scalar(Bool.self)),
2485 ]
2486
2487 public var snapshot: Snapshot
2488
2489 public init(snapshot: Snapshot) {
2490 self.snapshot = snapshot
2491 }
2492
2493 public init(cognitoId: GraphQLID, id: GraphQLID, username: String, registered: Bool? = nil) {
2494 self.init(snapshot: ["__typename": "User", "cognitoId": cognitoId, "id": id, "username": username, "registered": registered])
2495 }
2496
2497 public var __typename: String {
2498 get {
2499 return snapshot["__typename"]! as! String
2500 }
2501 set {
2502 snapshot.updateValue(newValue, forKey: "__typename")
2503 }
2504 }
2505
2506 /// A unique identifier for the user.
2507 public var cognitoId: GraphQLID {
2508 get {
2509 return snapshot["cognitoId"]! as! GraphQLID
2510 }
2511 set {
2512 snapshot.updateValue(newValue, forKey: "cognitoId")
2513 }
2514 }
2515
2516 /// Generated id for a user. read-only
2517 public var id: GraphQLID {
2518 get {
2519 return snapshot["id"]! as! GraphQLID
2520 }
2521 set {
2522 snapshot.updateValue(newValue, forKey: "id")
2523 }
2524 }
2525
2526 /// The username
2527 public var username: String {
2528 get {
2529 return snapshot["username"]! as! String
2530 }
2531 set {
2532 snapshot.updateValue(newValue, forKey: "username")
2533 }
2534 }
2535
2536 /// is the user registered?
2537 public var registered: Bool? {
2538 get {
2539 return snapshot["registered"] as? Bool
2540 }
2541 set {
2542 snapshot.updateValue(newValue, forKey: "registered")
2543 }
2544 }
2545 }
2546
2547 public struct Recipient: GraphQLSelectionSet {
2548 public static let possibleTypes = ["User"]
2549
2550 public static let selections: [GraphQLSelection] = [
2551 GraphQLField("__typename", type: .nonNull(.scalar(String.self))),
2552 GraphQLField("cognitoId", type: .nonNull(.scalar(GraphQLID.self))),
2553 GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))),
2554 GraphQLField("username", type: .nonNull(.scalar(String.self))),
2555 GraphQLField("registered", type: .scalar(Bool.self)),
2556 ]
2557
2558 public var snapshot: Snapshot
2559
2560 public init(snapshot: Snapshot) {
2561 self.snapshot = snapshot
2562 }
2563
2564 public init(cognitoId: GraphQLID, id: GraphQLID, username: String, registered: Bool? = nil) {
2565 self.init(snapshot: ["__typename": "User", "cognitoId": cognitoId, "id": id, "username": username, "registered": registered])
2566 }
2567
2568 public var __typename: String {
2569 get {
2570 return snapshot["__typename"]! as! String
2571 }
2572 set {
2573 snapshot.updateValue(newValue, forKey: "__typename")
2574 }
2575 }
2576
2577 /// A unique identifier for the user.
2578 public var cognitoId: GraphQLID {
2579 get {
2580 return snapshot["cognitoId"]! as! GraphQLID
2581 }
2582 set {
2583 snapshot.updateValue(newValue, forKey: "cognitoId")
2584 }
2585 }
2586
2587 /// Generated id for a user. read-only
2588 public var id: GraphQLID {
2589 get {
2590 return snapshot["id"]! as! GraphQLID
2591 }
2592 set {
2593 snapshot.updateValue(newValue, forKey: "id")
2594 }
2595 }
2596
2597 /// The username
2598 public var username: String {
2599 get {
2600 return snapshot["username"]! as! String
2601 }
2602 set {
2603 snapshot.updateValue(newValue, forKey: "username")
2604 }
2605 }
2606
2607 /// is the user registered?
2608 public var registered: Bool? {
2609 get {
2610 return snapshot["registered"] as? Bool
2611 }
2612 set {
2613 snapshot.updateValue(newValue, forKey: "registered")
2614 }
2615 }
2616 }
2617 }
2618 }
2619 }
2620}
2621
2622public final class AllMessageFromQuery: GraphQLQuery {
2623 public static let operationString =
2624 "query AllMessageFrom($after: String, $conversationId: ID!, $first: Int, $sender: String!) {\n allMessageFrom(after: $after, conversationId: $conversationId, first: $first, sender: $sender) {\n __typename\n author {\n __typename\n cognitoId\n conversations {\n __typename\n nextToken\n }\n id\n messages {\n __typename\n nextToken\n }\n username\n registered\n }\n content\n conversationId\n createdAt\n id\n isSent\n recipient {\n __typename\n cognitoId\n conversations {\n __typename\n nextToken\n }\n id\n messages {\n __typename\n nextToken\n }\n username\n registered\n }\n sender\n }\n}"
2625
2626 public var after: String?
2627 public var conversationId: GraphQLID
2628 public var first: Int?
2629 public var sender: String
2630
2631 public init(after: String? = nil, conversationId: GraphQLID, first: Int? = nil, sender: String) {
2632 self.after = after
2633 self.conversationId = conversationId
2634 self.first = first
2635 self.sender = sender
2636 }
2637
2638 public var variables: GraphQLMap? {
2639 return ["after": after, "conversationId": conversationId, "first": first, "sender": sender]
2640 }
2641
2642 public struct Data: GraphQLSelectionSet {
2643 public static let possibleTypes = ["Query"]
2644
2645 public static let selections: [GraphQLSelection] = [
2646 GraphQLField("allMessageFrom", arguments: ["after": GraphQLVariable("after"), "conversationId": GraphQLVariable("conversationId"), "first": GraphQLVariable("first"), "sender": GraphQLVariable("sender")], type: .list(.object(AllMessageFrom.selections))),
2647 ]
2648
2649 public var snapshot: Snapshot
2650
2651 public init(snapshot: Snapshot) {
2652 self.snapshot = snapshot
2653 }
2654
2655 public init(allMessageFrom: [AllMessageFrom?]? = nil) {
2656 self.init(snapshot: ["__typename": "Query", "allMessageFrom": allMessageFrom.flatMap { $0.map { $0.flatMap { $0.snapshot } } }])
2657 }
2658
2659 public var allMessageFrom: [AllMessageFrom?]? {
2660 get {
2661 return (snapshot["allMessageFrom"] as? [Snapshot?]).flatMap { $0.map { $0.flatMap { AllMessageFrom(snapshot: $0) } } }
2662 }
2663 set {
2664 snapshot.updateValue(newValue.flatMap { $0.map { $0.flatMap { $0.snapshot } } }, forKey: "allMessageFrom")
2665 }
2666 }
2667
2668 public struct AllMessageFrom: GraphQLSelectionSet {
2669 public static let possibleTypes = ["Message"]
2670
2671 public static let selections: [GraphQLSelection] = [
2672 GraphQLField("__typename", type: .nonNull(.scalar(String.self))),
2673 GraphQLField("author", type: .object(Author.selections)),
2674 GraphQLField("content", type: .nonNull(.scalar(String.self))),
2675 GraphQLField("conversationId", type: .nonNull(.scalar(GraphQLID.self))),
2676 GraphQLField("createdAt", type: .scalar(String.self)),
2677 GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))),
2678 GraphQLField("isSent", type: .scalar(Bool.self)),
2679 GraphQLField("recipient", type: .object(Recipient.selections)),
2680 GraphQLField("sender", type: .scalar(String.self)),
2681 ]
2682
2683 public var snapshot: Snapshot
2684
2685 public init(snapshot: Snapshot) {
2686 self.snapshot = snapshot
2687 }
2688
2689 public init(author: Author? = nil, content: String, conversationId: GraphQLID, createdAt: String? = nil, id: GraphQLID, isSent: Bool? = nil, recipient: Recipient? = nil, sender: String? = nil) {
2690 self.init(snapshot: ["__typename": "Message", "author": author.flatMap { $0.snapshot }, "content": content, "conversationId": conversationId, "createdAt": createdAt, "id": id, "isSent": isSent, "recipient": recipient.flatMap { $0.snapshot }, "sender": sender])
2691 }
2692
2693 public var __typename: String {
2694 get {
2695 return snapshot["__typename"]! as! String
2696 }
2697 set {
2698 snapshot.updateValue(newValue, forKey: "__typename")
2699 }
2700 }
2701
2702 /// The author object. Note: `authorId` is only available because we list it in `extraAttributes` in `Conversation.messages`
2703 public var author: Author? {
2704 get {
2705 return (snapshot["author"] as? Snapshot).flatMap { Author(snapshot: $0) }
2706 }
2707 set {
2708 snapshot.updateValue(newValue?.snapshot, forKey: "author")
2709 }
2710 }
2711
2712 /// The message content.
2713 public var content: String {
2714 get {
2715 return snapshot["content"]! as! String
2716 }
2717 set {
2718 snapshot.updateValue(newValue, forKey: "content")
2719 }
2720 }
2721
2722 /// The id of the Conversation this message belongs to. This is the table primary key.
2723 public var conversationId: GraphQLID {
2724 get {
2725 return snapshot["conversationId"]! as! GraphQLID
2726 }
2727 set {
2728 snapshot.updateValue(newValue, forKey: "conversationId")
2729 }
2730 }
2731
2732 /// The message timestamp. This is also the table sort key.
2733 public var createdAt: String? {
2734 get {
2735 return snapshot["createdAt"] as? String
2736 }
2737 set {
2738 snapshot.updateValue(newValue, forKey: "createdAt")
2739 }
2740 }
2741
2742 /// Generated id for a message -- read-only
2743 public var id: GraphQLID {
2744 get {
2745 return snapshot["id"]! as! GraphQLID
2746 }
2747 set {
2748 snapshot.updateValue(newValue, forKey: "id")
2749 }
2750 }
2751
2752 /// Flag denoting if this message has been accepted by the server or not.
2753 public var isSent: Bool? {
2754 get {
2755 return snapshot["isSent"] as? Bool
2756 }
2757 set {
2758 snapshot.updateValue(newValue, forKey: "isSent")
2759 }
2760 }
2761
2762 public var recipient: Recipient? {
2763 get {
2764 return (snapshot["recipient"] as? Snapshot).flatMap { Recipient(snapshot: $0) }
2765 }
2766 set {
2767 snapshot.updateValue(newValue?.snapshot, forKey: "recipient")
2768 }
2769 }
2770
2771 public var sender: String? {
2772 get {
2773 return snapshot["sender"] as? String
2774 }
2775 set {
2776 snapshot.updateValue(newValue, forKey: "sender")
2777 }
2778 }
2779
2780 public struct Author: GraphQLSelectionSet {
2781 public static let possibleTypes = ["User"]
2782
2783 public static let selections: [GraphQLSelection] = [
2784 GraphQLField("__typename", type: .nonNull(.scalar(String.self))),
2785 GraphQLField("cognitoId", type: .nonNull(.scalar(GraphQLID.self))),
2786 GraphQLField("conversations", type: .object(Conversation.selections)),
2787 GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))),
2788 GraphQLField("messages", type: .object(Message.selections)),
2789 GraphQLField("username", type: .nonNull(.scalar(String.self))),
2790 GraphQLField("registered", type: .scalar(Bool.self)),
2791 ]
2792
2793 public var snapshot: Snapshot
2794
2795 public init(snapshot: Snapshot) {
2796 self.snapshot = snapshot
2797 }
2798
2799 public init(cognitoId: GraphQLID, conversations: Conversation? = nil, id: GraphQLID, messages: Message? = nil, username: String, registered: Bool? = nil) {
2800 self.init(snapshot: ["__typename": "User", "cognitoId": cognitoId, "conversations": conversations.flatMap { $0.snapshot }, "id": id, "messages": messages.flatMap { $0.snapshot }, "username": username, "registered": registered])
2801 }
2802
2803 public var __typename: String {
2804 get {
2805 return snapshot["__typename"]! as! String
2806 }
2807 set {
2808 snapshot.updateValue(newValue, forKey: "__typename")
2809 }
2810 }
2811
2812 /// A unique identifier for the user.
2813 public var cognitoId: GraphQLID {
2814 get {
2815 return snapshot["cognitoId"]! as! GraphQLID
2816 }
2817 set {
2818 snapshot.updateValue(newValue, forKey: "cognitoId")
2819 }
2820 }
2821
2822 /// A user's enrolled Conversations. This is an interesting case. This is an interesting pagination case.
2823 public var conversations: Conversation? {
2824 get {
2825 return (snapshot["conversations"] as? Snapshot).flatMap { Conversation(snapshot: $0) }
2826 }
2827 set {
2828 snapshot.updateValue(newValue?.snapshot, forKey: "conversations")
2829 }
2830 }
2831
2832 /// Generated id for a user. read-only
2833 public var id: GraphQLID {
2834 get {
2835 return snapshot["id"]! as! GraphQLID
2836 }
2837 set {
2838 snapshot.updateValue(newValue, forKey: "id")
2839 }
2840 }
2841
2842 /// Get a users messages by querying a GSI on the Messages table.
2843 public var messages: Message? {
2844 get {
2845 return (snapshot["messages"] as? Snapshot).flatMap { Message(snapshot: $0) }
2846 }
2847 set {
2848 snapshot.updateValue(newValue?.snapshot, forKey: "messages")
2849 }
2850 }
2851
2852 /// The username
2853 public var username: String {
2854 get {
2855 return snapshot["username"]! as! String
2856 }
2857 set {
2858 snapshot.updateValue(newValue, forKey: "username")
2859 }
2860 }
2861
2862 /// is the user registered?
2863 public var registered: Bool? {
2864 get {
2865 return snapshot["registered"] as? Bool
2866 }
2867 set {
2868 snapshot.updateValue(newValue, forKey: "registered")
2869 }
2870 }
2871
2872 public struct Conversation: GraphQLSelectionSet {
2873 public static let possibleTypes = ["UserConverstationsConnection"]
2874
2875 public static let selections: [GraphQLSelection] = [
2876 GraphQLField("__typename", type: .nonNull(.scalar(String.self))),
2877 GraphQLField("nextToken", type: .scalar(String.self)),
2878 ]
2879
2880 public var snapshot: Snapshot
2881
2882 public init(snapshot: Snapshot) {
2883 self.snapshot = snapshot
2884 }
2885
2886 public init(nextToken: String? = nil) {
2887 self.init(snapshot: ["__typename": "UserConverstationsConnection", "nextToken": nextToken])
2888 }
2889
2890 public var __typename: String {
2891 get {
2892 return snapshot["__typename"]! as! String
2893 }
2894 set {
2895 snapshot.updateValue(newValue, forKey: "__typename")
2896 }
2897 }
2898
2899 public var nextToken: String? {
2900 get {
2901 return snapshot["nextToken"] as? String
2902 }
2903 set {
2904 snapshot.updateValue(newValue, forKey: "nextToken")
2905 }
2906 }
2907 }
2908
2909 public struct Message: GraphQLSelectionSet {
2910 public static let possibleTypes = ["MessageConnection"]
2911
2912 public static let selections: [GraphQLSelection] = [
2913 GraphQLField("__typename", type: .nonNull(.scalar(String.self))),
2914 GraphQLField("nextToken", type: .scalar(String.self)),
2915 ]
2916
2917 public var snapshot: Snapshot
2918
2919 public init(snapshot: Snapshot) {
2920 self.snapshot = snapshot
2921 }
2922
2923 public init(nextToken: String? = nil) {
2924 self.init(snapshot: ["__typename": "MessageConnection", "nextToken": nextToken])
2925 }
2926
2927 public var __typename: String {
2928 get {
2929 return snapshot["__typename"]! as! String
2930 }
2931 set {
2932 snapshot.updateValue(newValue, forKey: "__typename")
2933 }
2934 }
2935
2936 public var nextToken: String? {
2937 get {
2938 return snapshot["nextToken"] as? String
2939 }
2940 set {
2941 snapshot.updateValue(newValue, forKey: "nextToken")
2942 }
2943 }
2944 }
2945 }
2946
2947 public struct Recipient: GraphQLSelectionSet {
2948 public static let possibleTypes = ["User"]
2949
2950 public static let selections: [GraphQLSelection] = [
2951 GraphQLField("__typename", type: .nonNull(.scalar(String.self))),
2952 GraphQLField("cognitoId", type: .nonNull(.scalar(GraphQLID.self))),
2953 GraphQLField("conversations", type: .object(Conversation.selections)),
2954 GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))),
2955 GraphQLField("messages", type: .object(Message.selections)),
2956 GraphQLField("username", type: .nonNull(.scalar(String.self))),
2957 GraphQLField("registered", type: .scalar(Bool.self)),
2958 ]
2959
2960 public var snapshot: Snapshot
2961
2962 public init(snapshot: Snapshot) {
2963 self.snapshot = snapshot
2964 }
2965
2966 public init(cognitoId: GraphQLID, conversations: Conversation? = nil, id: GraphQLID, messages: Message? = nil, username: String, registered: Bool? = nil) {
2967 self.init(snapshot: ["__typename": "User", "cognitoId": cognitoId, "conversations": conversations.flatMap { $0.snapshot }, "id": id, "messages": messages.flatMap { $0.snapshot }, "username": username, "registered": registered])
2968 }
2969
2970 public var __typename: String {
2971 get {
2972 return snapshot["__typename"]! as! String
2973 }
2974 set {
2975 snapshot.updateValue(newValue, forKey: "__typename")
2976 }
2977 }
2978
2979 /// A unique identifier for the user.
2980 public var cognitoId: GraphQLID {
2981 get {
2982 return snapshot["cognitoId"]! as! GraphQLID
2983 }
2984 set {
2985 snapshot.updateValue(newValue, forKey: "cognitoId")
2986 }
2987 }
2988
2989 /// A user's enrolled Conversations. This is an interesting case. This is an interesting pagination case.
2990 public var conversations: Conversation? {
2991 get {
2992 return (snapshot["conversations"] as? Snapshot).flatMap { Conversation(snapshot: $0) }
2993 }
2994 set {
2995 snapshot.updateValue(newValue?.snapshot, forKey: "conversations")
2996 }
2997 }
2998
2999 /// Generated id for a user. read-only
3000 public var id: GraphQLID {
3001 get {
3002 return snapshot["id"]! as! GraphQLID
3003 }
3004 set {
3005 snapshot.updateValue(newValue, forKey: "id")
3006 }
3007 }
3008
3009 /// Get a users messages by querying a GSI on the Messages table.
3010 public var messages: Message? {
3011 get {
3012 return (snapshot["messages"] as? Snapshot).flatMap { Message(snapshot: $0) }
3013 }
3014 set {
3015 snapshot.updateValue(newValue?.snapshot, forKey: "messages")
3016 }
3017 }
3018
3019 /// The username
3020 public var username: String {
3021 get {
3022 return snapshot["username"]! as! String
3023 }
3024 set {
3025 snapshot.updateValue(newValue, forKey: "username")
3026 }
3027 }
3028
3029 /// is the user registered?
3030 public var registered: Bool? {
3031 get {
3032 return snapshot["registered"] as? Bool
3033 }
3034 set {
3035 snapshot.updateValue(newValue, forKey: "registered")
3036 }
3037 }
3038
3039 public struct Conversation: GraphQLSelectionSet {
3040 public static let possibleTypes = ["UserConverstationsConnection"]
3041
3042 public static let selections: [GraphQLSelection] = [
3043 GraphQLField("__typename", type: .nonNull(.scalar(String.self))),
3044 GraphQLField("nextToken", type: .scalar(String.self)),
3045 ]
3046
3047 public var snapshot: Snapshot
3048
3049 public init(snapshot: Snapshot) {
3050 self.snapshot = snapshot
3051 }
3052
3053 public init(nextToken: String? = nil) {
3054 self.init(snapshot: ["__typename": "UserConverstationsConnection", "nextToken": nextToken])
3055 }
3056
3057 public var __typename: String {
3058 get {
3059 return snapshot["__typename"]! as! String
3060 }
3061 set {
3062 snapshot.updateValue(newValue, forKey: "__typename")
3063 }
3064 }
3065
3066 public var nextToken: String? {
3067 get {
3068 return snapshot["nextToken"] as? String
3069 }
3070 set {
3071 snapshot.updateValue(newValue, forKey: "nextToken")
3072 }
3073 }
3074 }
3075
3076 public struct Message: GraphQLSelectionSet {
3077 public static let possibleTypes = ["MessageConnection"]
3078
3079 public static let selections: [GraphQLSelection] = [
3080 GraphQLField("__typename", type: .nonNull(.scalar(String.self))),
3081 GraphQLField("nextToken", type: .scalar(String.self)),
3082 ]
3083
3084 public var snapshot: Snapshot
3085
3086 public init(snapshot: Snapshot) {
3087 self.snapshot = snapshot
3088 }
3089
3090 public init(nextToken: String? = nil) {
3091 self.init(snapshot: ["__typename": "MessageConnection", "nextToken": nextToken])
3092 }
3093
3094 public var __typename: String {
3095 get {
3096 return snapshot["__typename"]! as! String
3097 }
3098 set {
3099 snapshot.updateValue(newValue, forKey: "__typename")
3100 }
3101 }
3102
3103 public var nextToken: String? {
3104 get {
3105 return snapshot["nextToken"] as? String
3106 }
3107 set {
3108 snapshot.updateValue(newValue, forKey: "nextToken")
3109 }
3110 }
3111 }
3112 }
3113 }
3114 }
3115}
3116
3117public final class AllUserQuery: GraphQLQuery {
3118 public static let operationString =
3119 "query AllUser($after: String, $first: Int) {\n allUser(after: $after, first: $first) {\n __typename\n cognitoId\n conversations {\n __typename\n nextToken\n userConversations {\n __typename\n conversationId\n userId\n }\n }\n id\n messages {\n __typename\n messages {\n __typename\n content\n conversationId\n createdAt\n id\n isSent\n sender\n }\n nextToken\n }\n username\n registered\n }\n}"
3120
3121 public var after: String?
3122 public var first: Int?
3123
3124 public init(after: String? = nil, first: Int? = nil) {
3125 self.after = after
3126 self.first = first
3127 }
3128
3129 public var variables: GraphQLMap? {
3130 return ["after": after, "first": first]
3131 }
3132
3133 public struct Data: GraphQLSelectionSet {
3134 public static let possibleTypes = ["Query"]
3135
3136 public static let selections: [GraphQLSelection] = [
3137 GraphQLField("allUser", arguments: ["after": GraphQLVariable("after"), "first": GraphQLVariable("first")], type: .list(.object(AllUser.selections))),
3138 ]
3139
3140 public var snapshot: Snapshot
3141
3142 public init(snapshot: Snapshot) {
3143 self.snapshot = snapshot
3144 }
3145
3146 public init(allUser: [AllUser?]? = nil) {
3147 self.init(snapshot: ["__typename": "Query", "allUser": allUser.flatMap { $0.map { $0.flatMap { $0.snapshot } } }])
3148 }
3149
3150 /// Scan through all values of type 'User'. Use the 'after' and 'before' arguments with the 'nextToken' returned by the 'UserConnection' result to fetch pages.
3151 public var allUser: [AllUser?]? {
3152 get {
3153 return (snapshot["allUser"] as? [Snapshot?]).flatMap { $0.map { $0.flatMap { AllUser(snapshot: $0) } } }
3154 }
3155 set {
3156 snapshot.updateValue(newValue.flatMap { $0.map { $0.flatMap { $0.snapshot } } }, forKey: "allUser")
3157 }
3158 }
3159
3160 public struct AllUser: GraphQLSelectionSet {
3161 public static let possibleTypes = ["User"]
3162
3163 public static let selections: [GraphQLSelection] = [
3164 GraphQLField("__typename", type: .nonNull(.scalar(String.self))),
3165 GraphQLField("cognitoId", type: .nonNull(.scalar(GraphQLID.self))),
3166 GraphQLField("conversations", type: .object(Conversation.selections)),
3167 GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))),
3168 GraphQLField("messages", type: .object(Message.selections)),
3169 GraphQLField("username", type: .nonNull(.scalar(String.self))),
3170 GraphQLField("registered", type: .scalar(Bool.self)),
3171 ]
3172
3173 public var snapshot: Snapshot
3174
3175 public init(snapshot: Snapshot) {
3176 self.snapshot = snapshot
3177 }
3178
3179 public init(cognitoId: GraphQLID, conversations: Conversation? = nil, id: GraphQLID, messages: Message? = nil, username: String, registered: Bool? = nil) {
3180 self.init(snapshot: ["__typename": "User", "cognitoId": cognitoId, "conversations": conversations.flatMap { $0.snapshot }, "id": id, "messages": messages.flatMap { $0.snapshot }, "username": username, "registered": registered])
3181 }
3182
3183 public var __typename: String {
3184 get {
3185 return snapshot["__typename"]! as! String
3186 }
3187 set {
3188 snapshot.updateValue(newValue, forKey: "__typename")
3189 }
3190 }
3191
3192 /// A unique identifier for the user.
3193 public var cognitoId: GraphQLID {
3194 get {
3195 return snapshot["cognitoId"]! as! GraphQLID
3196 }
3197 set {
3198 snapshot.updateValue(newValue, forKey: "cognitoId")
3199 }
3200 }
3201
3202 /// A user's enrolled Conversations. This is an interesting case. This is an interesting pagination case.
3203 public var conversations: Conversation? {
3204 get {
3205 return (snapshot["conversations"] as? Snapshot).flatMap { Conversation(snapshot: $0) }
3206 }
3207 set {
3208 snapshot.updateValue(newValue?.snapshot, forKey: "conversations")
3209 }
3210 }
3211
3212 /// Generated id for a user. read-only
3213 public var id: GraphQLID {
3214 get {
3215 return snapshot["id"]! as! GraphQLID
3216 }
3217 set {
3218 snapshot.updateValue(newValue, forKey: "id")
3219 }
3220 }
3221
3222 /// Get a users messages by querying a GSI on the Messages table.
3223 public var messages: Message? {
3224 get {
3225 return (snapshot["messages"] as? Snapshot).flatMap { Message(snapshot: $0) }
3226 }
3227 set {
3228 snapshot.updateValue(newValue?.snapshot, forKey: "messages")
3229 }
3230 }
3231
3232 /// The username
3233 public var username: String {
3234 get {
3235 return snapshot["username"]! as! String
3236 }
3237 set {
3238 snapshot.updateValue(newValue, forKey: "username")
3239 }
3240 }
3241
3242 /// is the user registered?
3243 public var registered: Bool? {
3244 get {
3245 return snapshot["registered"] as? Bool
3246 }
3247 set {
3248 snapshot.updateValue(newValue, forKey: "registered")
3249 }
3250 }
3251
3252 public struct Conversation: GraphQLSelectionSet {
3253 public static let possibleTypes = ["UserConverstationsConnection"]
3254
3255 public static let selections: [GraphQLSelection] = [
3256 GraphQLField("__typename", type: .nonNull(.scalar(String.self))),
3257 GraphQLField("nextToken", type: .scalar(String.self)),
3258 GraphQLField("userConversations", type: .list(.object(UserConversation.selections))),
3259 ]
3260
3261 public var snapshot: Snapshot
3262
3263 public init(snapshot: Snapshot) {
3264 self.snapshot = snapshot
3265 }
3266
3267 public init(nextToken: String? = nil, userConversations: [UserConversation?]? = nil) {
3268 self.init(snapshot: ["__typename": "UserConverstationsConnection", "nextToken": nextToken, "userConversations": userConversations.flatMap { $0.map { $0.flatMap { $0.snapshot } } }])
3269 }
3270
3271 public var __typename: String {
3272 get {
3273 return snapshot["__typename"]! as! String
3274 }
3275 set {
3276 snapshot.updateValue(newValue, forKey: "__typename")
3277 }
3278 }
3279
3280 public var nextToken: String? {
3281 get {
3282 return snapshot["nextToken"] as? String
3283 }
3284 set {
3285 snapshot.updateValue(newValue, forKey: "nextToken")
3286 }
3287 }
3288
3289 public var userConversations: [UserConversation?]? {
3290 get {
3291 return (snapshot["userConversations"] as? [Snapshot?]).flatMap { $0.map { $0.flatMap { UserConversation(snapshot: $0) } } }
3292 }
3293 set {
3294 snapshot.updateValue(newValue.flatMap { $0.map { $0.flatMap { $0.snapshot } } }, forKey: "userConversations")
3295 }
3296 }
3297
3298 public struct UserConversation: GraphQLSelectionSet {
3299 public static let possibleTypes = ["UserConversations"]
3300
3301 public static let selections: [GraphQLSelection] = [
3302 GraphQLField("__typename", type: .nonNull(.scalar(String.self))),
3303 GraphQLField("conversationId", type: .nonNull(.scalar(GraphQLID.self))),
3304 GraphQLField("userId", type: .nonNull(.scalar(GraphQLID.self))),
3305 ]
3306
3307 public var snapshot: Snapshot
3308
3309 public init(snapshot: Snapshot) {
3310 self.snapshot = snapshot
3311 }
3312
3313 public init(conversationId: GraphQLID, userId: GraphQLID) {
3314 self.init(snapshot: ["__typename": "UserConversations", "conversationId": conversationId, "userId": userId])
3315 }
3316
3317 public var __typename: String {
3318 get {
3319 return snapshot["__typename"]! as! String
3320 }
3321 set {
3322 snapshot.updateValue(newValue, forKey: "__typename")
3323 }
3324 }
3325
3326 public var conversationId: GraphQLID {
3327 get {
3328 return snapshot["conversationId"]! as! GraphQLID
3329 }
3330 set {
3331 snapshot.updateValue(newValue, forKey: "conversationId")
3332 }
3333 }
3334
3335 public var userId: GraphQLID {
3336 get {
3337 return snapshot["userId"]! as! GraphQLID
3338 }
3339 set {
3340 snapshot.updateValue(newValue, forKey: "userId")
3341 }
3342 }
3343 }
3344 }
3345
3346 public struct Message: GraphQLSelectionSet {
3347 public static let possibleTypes = ["MessageConnection"]
3348
3349 public static let selections: [GraphQLSelection] = [
3350 GraphQLField("__typename", type: .nonNull(.scalar(String.self))),
3351 GraphQLField("messages", type: .list(.object(Message.selections))),
3352 GraphQLField("nextToken", type: .scalar(String.self)),
3353 ]
3354
3355 public var snapshot: Snapshot
3356
3357 public init(snapshot: Snapshot) {
3358 self.snapshot = snapshot
3359 }
3360
3361 public init(messages: [Message?]? = nil, nextToken: String? = nil) {
3362 self.init(snapshot: ["__typename": "MessageConnection", "messages": messages.flatMap { $0.map { $0.flatMap { $0.snapshot } } }, "nextToken": nextToken])
3363 }
3364
3365 public var __typename: String {
3366 get {
3367 return snapshot["__typename"]! as! String
3368 }
3369 set {
3370 snapshot.updateValue(newValue, forKey: "__typename")
3371 }
3372 }
3373
3374 public var messages: [Message?]? {
3375 get {
3376 return (snapshot["messages"] as? [Snapshot?]).flatMap { $0.map { $0.flatMap { Message(snapshot: $0) } } }
3377 }
3378 set {
3379 snapshot.updateValue(newValue.flatMap { $0.map { $0.flatMap { $0.snapshot } } }, forKey: "messages")
3380 }
3381 }
3382
3383 public var nextToken: String? {
3384 get {
3385 return snapshot["nextToken"] as? String
3386 }
3387 set {
3388 snapshot.updateValue(newValue, forKey: "nextToken")
3389 }
3390 }
3391
3392 public struct Message: GraphQLSelectionSet {
3393 public static let possibleTypes = ["Message"]
3394
3395 public static let selections: [GraphQLSelection] = [
3396 GraphQLField("__typename", type: .nonNull(.scalar(String.self))),
3397 GraphQLField("content", type: .nonNull(.scalar(String.self))),
3398 GraphQLField("conversationId", type: .nonNull(.scalar(GraphQLID.self))),
3399 GraphQLField("createdAt", type: .scalar(String.self)),
3400 GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))),
3401 GraphQLField("isSent", type: .scalar(Bool.self)),
3402 GraphQLField("sender", type: .scalar(String.self)),
3403 ]
3404
3405 public var snapshot: Snapshot
3406
3407 public init(snapshot: Snapshot) {
3408 self.snapshot = snapshot
3409 }
3410
3411 public init(content: String, conversationId: GraphQLID, createdAt: String? = nil, id: GraphQLID, isSent: Bool? = nil, sender: String? = nil) {
3412 self.init(snapshot: ["__typename": "Message", "content": content, "conversationId": conversationId, "createdAt": createdAt, "id": id, "isSent": isSent, "sender": sender])
3413 }
3414
3415 public var __typename: String {
3416 get {
3417 return snapshot["__typename"]! as! String
3418 }
3419 set {
3420 snapshot.updateValue(newValue, forKey: "__typename")
3421 }
3422 }
3423
3424 /// The message content.
3425 public var content: String {
3426 get {
3427 return snapshot["content"]! as! String
3428 }
3429 set {
3430 snapshot.updateValue(newValue, forKey: "content")
3431 }
3432 }
3433
3434 /// The id of the Conversation this message belongs to. This is the table primary key.
3435 public var conversationId: GraphQLID {
3436 get {
3437 return snapshot["conversationId"]! as! GraphQLID
3438 }
3439 set {
3440 snapshot.updateValue(newValue, forKey: "conversationId")
3441 }
3442 }
3443
3444 /// The message timestamp. This is also the table sort key.
3445 public var createdAt: String? {
3446 get {
3447 return snapshot["createdAt"] as? String
3448 }
3449 set {
3450 snapshot.updateValue(newValue, forKey: "createdAt")
3451 }
3452 }
3453
3454 /// Generated id for a message -- read-only
3455 public var id: GraphQLID {
3456 get {
3457 return snapshot["id"]! as! GraphQLID
3458 }
3459 set {
3460 snapshot.updateValue(newValue, forKey: "id")
3461 }
3462 }
3463
3464 /// Flag denoting if this message has been accepted by the server or not.
3465 public var isSent: Bool? {
3466 get {
3467 return snapshot["isSent"] as? Bool
3468 }
3469 set {
3470 snapshot.updateValue(newValue, forKey: "isSent")
3471 }
3472 }
3473
3474 public var sender: String? {
3475 get {
3476 return snapshot["sender"] as? String
3477 }
3478 set {
3479 snapshot.updateValue(newValue, forKey: "sender")
3480 }
3481 }
3482 }
3483 }
3484 }
3485 }
3486}
3487
3488public final class MeQuery: GraphQLQuery {
3489 public static let operationString =
3490 "query Me {\n me {\n __typename\n cognitoId\n conversations {\n __typename\n nextToken\n userConversations {\n __typename\n conversationId\n userId\n }\n }\n id\n messages {\n __typename\n messages {\n __typename\n content\n conversationId\n createdAt\n id\n isSent\n sender\n }\n nextToken\n }\n username\n registered\n }\n}"
3491
3492 public init() {
3493 }
3494
3495 public struct Data: GraphQLSelectionSet {
3496 public static let possibleTypes = ["Query"]
3497
3498 public static let selections: [GraphQLSelection] = [
3499 GraphQLField("me", type: .object(Me.selections)),
3500 ]
3501
3502 public var snapshot: Snapshot
3503
3504 public init(snapshot: Snapshot) {
3505 self.snapshot = snapshot
3506 }
3507
3508 public init(me: Me? = nil) {
3509 self.init(snapshot: ["__typename": "Query", "me": me.flatMap { $0.snapshot }])
3510 }
3511
3512 /// Get my user.
3513 public var me: Me? {
3514 get {
3515 return (snapshot["me"] as? Snapshot).flatMap { Me(snapshot: $0) }
3516 }
3517 set {
3518 snapshot.updateValue(newValue?.snapshot, forKey: "me")
3519 }
3520 }
3521
3522 public struct Me: GraphQLSelectionSet {
3523 public static let possibleTypes = ["User"]
3524
3525 public static let selections: [GraphQLSelection] = [
3526 GraphQLField("__typename", type: .nonNull(.scalar(String.self))),
3527 GraphQLField("cognitoId", type: .nonNull(.scalar(GraphQLID.self))),
3528 GraphQLField("conversations", type: .object(Conversation.selections)),
3529 GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))),
3530 GraphQLField("messages", type: .object(Message.selections)),
3531 GraphQLField("username", type: .nonNull(.scalar(String.self))),
3532 GraphQLField("registered", type: .scalar(Bool.self)),
3533 ]
3534
3535 public var snapshot: Snapshot
3536
3537 public init(snapshot: Snapshot) {
3538 self.snapshot = snapshot
3539 }
3540
3541 public init(cognitoId: GraphQLID, conversations: Conversation? = nil, id: GraphQLID, messages: Message? = nil, username: String, registered: Bool? = nil) {
3542 self.init(snapshot: ["__typename": "User", "cognitoId": cognitoId, "conversations": conversations.flatMap { $0.snapshot }, "id": id, "messages": messages.flatMap { $0.snapshot }, "username": username, "registered": registered])
3543 }
3544
3545 public var __typename: String {
3546 get {
3547 return snapshot["__typename"]! as! String
3548 }
3549 set {
3550 snapshot.updateValue(newValue, forKey: "__typename")
3551 }
3552 }
3553
3554 /// A unique identifier for the user.
3555 public var cognitoId: GraphQLID {
3556 get {
3557 return snapshot["cognitoId"]! as! GraphQLID
3558 }
3559 set {
3560 snapshot.updateValue(newValue, forKey: "cognitoId")
3561 }
3562 }
3563
3564 /// A user's enrolled Conversations. This is an interesting case. This is an interesting pagination case.
3565 public var conversations: Conversation? {
3566 get {
3567 return (snapshot["conversations"] as? Snapshot).flatMap { Conversation(snapshot: $0) }
3568 }
3569 set {
3570 snapshot.updateValue(newValue?.snapshot, forKey: "conversations")
3571 }
3572 }
3573
3574 /// Generated id for a user. read-only
3575 public var id: GraphQLID {
3576 get {
3577 return snapshot["id"]! as! GraphQLID
3578 }
3579 set {
3580 snapshot.updateValue(newValue, forKey: "id")
3581 }
3582 }
3583
3584 /// Get a users messages by querying a GSI on the Messages table.
3585 public var messages: Message? {
3586 get {
3587 return (snapshot["messages"] as? Snapshot).flatMap { Message(snapshot: $0) }
3588 }
3589 set {
3590 snapshot.updateValue(newValue?.snapshot, forKey: "messages")
3591 }
3592 }
3593
3594 /// The username
3595 public var username: String {
3596 get {
3597 return snapshot["username"]! as! String
3598 }
3599 set {
3600 snapshot.updateValue(newValue, forKey: "username")
3601 }
3602 }
3603
3604 /// is the user registered?
3605 public var registered: Bool? {
3606 get {
3607 return snapshot["registered"] as? Bool
3608 }
3609 set {
3610 snapshot.updateValue(newValue, forKey: "registered")
3611 }
3612 }
3613
3614 public struct Conversation: GraphQLSelectionSet {
3615 public static let possibleTypes = ["UserConverstationsConnection"]
3616
3617 public static let selections: [GraphQLSelection] = [
3618 GraphQLField("__typename", type: .nonNull(.scalar(String.self))),
3619 GraphQLField("nextToken", type: .scalar(String.self)),
3620 GraphQLField("userConversations", type: .list(.object(UserConversation.selections))),
3621 ]
3622
3623 public var snapshot: Snapshot
3624
3625 public init(snapshot: Snapshot) {
3626 self.snapshot = snapshot
3627 }
3628
3629 public init(nextToken: String? = nil, userConversations: [UserConversation?]? = nil) {
3630 self.init(snapshot: ["__typename": "UserConverstationsConnection", "nextToken": nextToken, "userConversations": userConversations.flatMap { $0.map { $0.flatMap { $0.snapshot } } }])
3631 }
3632
3633 public var __typename: String {
3634 get {
3635 return snapshot["__typename"]! as! String
3636 }
3637 set {
3638 snapshot.updateValue(newValue, forKey: "__typename")
3639 }
3640 }
3641
3642 public var nextToken: String? {
3643 get {
3644 return snapshot["nextToken"] as? String
3645 }
3646 set {
3647 snapshot.updateValue(newValue, forKey: "nextToken")
3648 }
3649 }
3650
3651 public var userConversations: [UserConversation?]? {
3652 get {
3653 return (snapshot["userConversations"] as? [Snapshot?]).flatMap { $0.map { $0.flatMap { UserConversation(snapshot: $0) } } }
3654 }
3655 set {
3656 snapshot.updateValue(newValue.flatMap { $0.map { $0.flatMap { $0.snapshot } } }, forKey: "userConversations")
3657 }
3658 }
3659
3660 public struct UserConversation: GraphQLSelectionSet {
3661 public static let possibleTypes = ["UserConversations"]
3662
3663 public static let selections: [GraphQLSelection] = [
3664 GraphQLField("__typename", type: .nonNull(.scalar(String.self))),
3665 GraphQLField("conversationId", type: .nonNull(.scalar(GraphQLID.self))),
3666 GraphQLField("userId", type: .nonNull(.scalar(GraphQLID.self))),
3667 ]
3668
3669 public var snapshot: Snapshot
3670
3671 public init(snapshot: Snapshot) {
3672 self.snapshot = snapshot
3673 }
3674
3675 public init(conversationId: GraphQLID, userId: GraphQLID) {
3676 self.init(snapshot: ["__typename": "UserConversations", "conversationId": conversationId, "userId": userId])
3677 }
3678
3679 public var __typename: String {
3680 get {
3681 return snapshot["__typename"]! as! String
3682 }
3683 set {
3684 snapshot.updateValue(newValue, forKey: "__typename")
3685 }
3686 }
3687
3688 public var conversationId: GraphQLID {
3689 get {
3690 return snapshot["conversationId"]! as! GraphQLID
3691 }
3692 set {
3693 snapshot.updateValue(newValue, forKey: "conversationId")
3694 }
3695 }
3696
3697 public var userId: GraphQLID {
3698 get {
3699 return snapshot["userId"]! as! GraphQLID
3700 }
3701 set {
3702 snapshot.updateValue(newValue, forKey: "userId")
3703 }
3704 }
3705 }
3706 }
3707
3708 public struct Message: GraphQLSelectionSet {
3709 public static let possibleTypes = ["MessageConnection"]
3710
3711 public static let selections: [GraphQLSelection] = [
3712 GraphQLField("__typename", type: .nonNull(.scalar(String.self))),
3713 GraphQLField("messages", type: .list(.object(Message.selections))),
3714 GraphQLField("nextToken", type: .scalar(String.self)),
3715 ]
3716
3717 public var snapshot: Snapshot
3718
3719 public init(snapshot: Snapshot) {
3720 self.snapshot = snapshot
3721 }
3722
3723 public init(messages: [Message?]? = nil, nextToken: String? = nil) {
3724 self.init(snapshot: ["__typename": "MessageConnection", "messages": messages.flatMap { $0.map { $0.flatMap { $0.snapshot } } }, "nextToken": nextToken])
3725 }
3726
3727 public var __typename: String {
3728 get {
3729 return snapshot["__typename"]! as! String
3730 }
3731 set {
3732 snapshot.updateValue(newValue, forKey: "__typename")
3733 }
3734 }
3735
3736 public var messages: [Message?]? {
3737 get {
3738 return (snapshot["messages"] as? [Snapshot?]).flatMap { $0.map { $0.flatMap { Message(snapshot: $0) } } }
3739 }
3740 set {
3741 snapshot.updateValue(newValue.flatMap { $0.map { $0.flatMap { $0.snapshot } } }, forKey: "messages")
3742 }
3743 }
3744
3745 public var nextToken: String? {
3746 get {
3747 return snapshot["nextToken"] as? String
3748 }
3749 set {
3750 snapshot.updateValue(newValue, forKey: "nextToken")
3751 }
3752 }
3753
3754 public struct Message: GraphQLSelectionSet {
3755 public static let possibleTypes = ["Message"]
3756
3757 public static let selections: [GraphQLSelection] = [
3758 GraphQLField("__typename", type: .nonNull(.scalar(String.self))),
3759 GraphQLField("content", type: .nonNull(.scalar(String.self))),
3760 GraphQLField("conversationId", type: .nonNull(.scalar(GraphQLID.self))),
3761 GraphQLField("createdAt", type: .scalar(String.self)),
3762 GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))),
3763 GraphQLField("isSent", type: .scalar(Bool.self)),
3764 GraphQLField("sender", type: .scalar(String.self)),
3765 ]
3766
3767 public var snapshot: Snapshot
3768
3769 public init(snapshot: Snapshot) {
3770 self.snapshot = snapshot
3771 }
3772
3773 public init(content: String, conversationId: GraphQLID, createdAt: String? = nil, id: GraphQLID, isSent: Bool? = nil, sender: String? = nil) {
3774 self.init(snapshot: ["__typename": "Message", "content": content, "conversationId": conversationId, "createdAt": createdAt, "id": id, "isSent": isSent, "sender": sender])
3775 }
3776
3777 public var __typename: String {
3778 get {
3779 return snapshot["__typename"]! as! String
3780 }
3781 set {
3782 snapshot.updateValue(newValue, forKey: "__typename")
3783 }
3784 }
3785
3786 /// The message content.
3787 public var content: String {
3788 get {
3789 return snapshot["content"]! as! String
3790 }
3791 set {
3792 snapshot.updateValue(newValue, forKey: "content")
3793 }
3794 }
3795
3796 /// The id of the Conversation this message belongs to. This is the table primary key.
3797 public var conversationId: GraphQLID {
3798 get {
3799 return snapshot["conversationId"]! as! GraphQLID
3800 }
3801 set {
3802 snapshot.updateValue(newValue, forKey: "conversationId")
3803 }
3804 }
3805
3806 /// The message timestamp. This is also the table sort key.
3807 public var createdAt: String? {
3808 get {
3809 return snapshot["createdAt"] as? String
3810 }
3811 set {
3812 snapshot.updateValue(newValue, forKey: "createdAt")
3813 }
3814 }
3815
3816 /// Generated id for a message -- read-only
3817 public var id: GraphQLID {
3818 get {
3819 return snapshot["id"]! as! GraphQLID
3820 }
3821 set {
3822 snapshot.updateValue(newValue, forKey: "id")
3823 }
3824 }
3825
3826 /// Flag denoting if this message has been accepted by the server or not.
3827 public var isSent: Bool? {
3828 get {
3829 return snapshot["isSent"] as? Bool
3830 }
3831 set {
3832 snapshot.updateValue(newValue, forKey: "isSent")
3833 }
3834 }
3835
3836 public var sender: String? {
3837 get {
3838 return snapshot["sender"] as? String
3839 }
3840 set {
3841 snapshot.updateValue(newValue, forKey: "sender")
3842 }
3843 }
3844 }
3845 }
3846 }
3847 }
3848}
3849
3850public final class SubscribeToNewMessageSubscription: GraphQLSubscription {
3851 public static let operationString =
3852 "subscription SubscribeToNewMessage($conversationId: ID!) {\n subscribeToNewMessage(conversationId: $conversationId) {\n __typename\n author {\n __typename\n cognitoId\n conversations {\n __typename\n nextToken\n }\n id\n messages {\n __typename\n nextToken\n }\n username\n registered\n }\n content\n conversationId\n createdAt\n id\n isSent\n recipient {\n __typename\n cognitoId\n conversations {\n __typename\n nextToken\n }\n id\n messages {\n __typename\n nextToken\n }\n username\n registered\n }\n sender\n }\n}"
3853
3854 public var conversationId: GraphQLID
3855
3856 public init(conversationId: GraphQLID) {
3857 self.conversationId = conversationId
3858 }
3859
3860 public var variables: GraphQLMap? {
3861 return ["conversationId": conversationId]
3862 }
3863
3864 public struct Data: GraphQLSelectionSet {
3865 public static let possibleTypes = ["Subscription"]
3866
3867 public static let selections: [GraphQLSelection] = [
3868 GraphQLField("subscribeToNewMessage", arguments: ["conversationId": GraphQLVariable("conversationId")], type: .object(SubscribeToNewMessage.selections)),
3869 ]
3870
3871 public var snapshot: Snapshot
3872
3873 public init(snapshot: Snapshot) {
3874 self.snapshot = snapshot
3875 }
3876
3877 public init(subscribeToNewMessage: SubscribeToNewMessage? = nil) {
3878 self.init(snapshot: ["__typename": "Subscription", "subscribeToNewMessage": subscribeToNewMessage.flatMap { $0.snapshot }])
3879 }
3880
3881 /// Subscribes to all new messages in a given Conversation.
3882 public var subscribeToNewMessage: SubscribeToNewMessage? {
3883 get {
3884 return (snapshot["subscribeToNewMessage"] as? Snapshot).flatMap { SubscribeToNewMessage(snapshot: $0) }
3885 }
3886 set {
3887 snapshot.updateValue(newValue?.snapshot, forKey: "subscribeToNewMessage")
3888 }
3889 }
3890
3891 public struct SubscribeToNewMessage: GraphQLSelectionSet {
3892 public static let possibleTypes = ["Message"]
3893
3894 public static let selections: [GraphQLSelection] = [
3895 GraphQLField("__typename", type: .nonNull(.scalar(String.self))),
3896 GraphQLField("author", type: .object(Author.selections)),
3897 GraphQLField("content", type: .nonNull(.scalar(String.self))),
3898 GraphQLField("conversationId", type: .nonNull(.scalar(GraphQLID.self))),
3899 GraphQLField("createdAt", type: .scalar(String.self)),
3900 GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))),
3901 GraphQLField("isSent", type: .scalar(Bool.self)),
3902 GraphQLField("recipient", type: .object(Recipient.selections)),
3903 GraphQLField("sender", type: .scalar(String.self)),
3904 ]
3905
3906 public var snapshot: Snapshot
3907
3908 public init(snapshot: Snapshot) {
3909 self.snapshot = snapshot
3910 }
3911
3912 public init(author: Author? = nil, content: String, conversationId: GraphQLID, createdAt: String? = nil, id: GraphQLID, isSent: Bool? = nil, recipient: Recipient? = nil, sender: String? = nil) {
3913 self.init(snapshot: ["__typename": "Message", "author": author.flatMap { $0.snapshot }, "content": content, "conversationId": conversationId, "createdAt": createdAt, "id": id, "isSent": isSent, "recipient": recipient.flatMap { $0.snapshot }, "sender": sender])
3914 }
3915
3916 public var __typename: String {
3917 get {
3918 return snapshot["__typename"]! as! String
3919 }
3920 set {
3921 snapshot.updateValue(newValue, forKey: "__typename")
3922 }
3923 }
3924
3925 /// The author object. Note: `authorId` is only available because we list it in `extraAttributes` in `Conversation.messages`
3926 public var author: Author? {
3927 get {
3928 return (snapshot["author"] as? Snapshot).flatMap { Author(snapshot: $0) }
3929 }
3930 set {
3931 snapshot.updateValue(newValue?.snapshot, forKey: "author")
3932 }
3933 }
3934
3935 /// The message content.
3936 public var content: String {
3937 get {
3938 return snapshot["content"]! as! String
3939 }
3940 set {
3941 snapshot.updateValue(newValue, forKey: "content")
3942 }
3943 }
3944
3945 /// The id of the Conversation this message belongs to. This is the table primary key.
3946 public var conversationId: GraphQLID {
3947 get {
3948 return snapshot["conversationId"]! as! GraphQLID
3949 }
3950 set {
3951 snapshot.updateValue(newValue, forKey: "conversationId")
3952 }
3953 }
3954
3955 /// The message timestamp. This is also the table sort key.
3956 public var createdAt: String? {
3957 get {
3958 return snapshot["createdAt"] as? String
3959 }
3960 set {
3961 snapshot.updateValue(newValue, forKey: "createdAt")
3962 }
3963 }
3964
3965 /// Generated id for a message -- read-only
3966 public var id: GraphQLID {
3967 get {
3968 return snapshot["id"]! as! GraphQLID
3969 }
3970 set {
3971 snapshot.updateValue(newValue, forKey: "id")
3972 }
3973 }
3974
3975 /// Flag denoting if this message has been accepted by the server or not.
3976 public var isSent: Bool? {
3977 get {
3978 return snapshot["isSent"] as? Bool
3979 }
3980 set {
3981 snapshot.updateValue(newValue, forKey: "isSent")
3982 }
3983 }
3984
3985 public var recipient: Recipient? {
3986 get {
3987 return (snapshot["recipient"] as? Snapshot).flatMap { Recipient(snapshot: $0) }
3988 }
3989 set {
3990 snapshot.updateValue(newValue?.snapshot, forKey: "recipient")
3991 }
3992 }
3993
3994 public var sender: String? {
3995 get {
3996 return snapshot["sender"] as? String
3997 }
3998 set {
3999 snapshot.updateValue(newValue, forKey: "sender")
4000 }
4001 }
4002
4003 public struct Author: GraphQLSelectionSet {
4004 public static let possibleTypes = ["User"]
4005
4006 public static let selections: [GraphQLSelection] = [
4007 GraphQLField("__typename", type: .nonNull(.scalar(String.self))),
4008 GraphQLField("cognitoId", type: .nonNull(.scalar(GraphQLID.self))),
4009 GraphQLField("conversations", type: .object(Conversation.selections)),
4010 GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))),
4011 GraphQLField("messages", type: .object(Message.selections)),
4012 GraphQLField("username", type: .nonNull(.scalar(String.self))),
4013 GraphQLField("registered", type: .scalar(Bool.self)),
4014 ]
4015
4016 public var snapshot: Snapshot
4017
4018 public init(snapshot: Snapshot) {
4019 self.snapshot = snapshot
4020 }
4021
4022 public init(cognitoId: GraphQLID, conversations: Conversation? = nil, id: GraphQLID, messages: Message? = nil, username: String, registered: Bool? = nil) {
4023 self.init(snapshot: ["__typename": "User", "cognitoId": cognitoId, "conversations": conversations.flatMap { $0.snapshot }, "id": id, "messages": messages.flatMap { $0.snapshot }, "username": username, "registered": registered])
4024 }
4025
4026 public var __typename: String {
4027 get {
4028 return snapshot["__typename"]! as! String
4029 }
4030 set {
4031 snapshot.updateValue(newValue, forKey: "__typename")
4032 }
4033 }
4034
4035 /// A unique identifier for the user.
4036 public var cognitoId: GraphQLID {
4037 get {
4038 return snapshot["cognitoId"]! as! GraphQLID
4039 }
4040 set {
4041 snapshot.updateValue(newValue, forKey: "cognitoId")
4042 }
4043 }
4044
4045 /// A user's enrolled Conversations. This is an interesting case. This is an interesting pagination case.
4046 public var conversations: Conversation? {
4047 get {
4048 return (snapshot["conversations"] as? Snapshot).flatMap { Conversation(snapshot: $0) }
4049 }
4050 set {
4051 snapshot.updateValue(newValue?.snapshot, forKey: "conversations")
4052 }
4053 }
4054
4055 /// Generated id for a user. read-only
4056 public var id: GraphQLID {
4057 get {
4058 return snapshot["id"]! as! GraphQLID
4059 }
4060 set {
4061 snapshot.updateValue(newValue, forKey: "id")
4062 }
4063 }
4064
4065 /// Get a users messages by querying a GSI on the Messages table.
4066 public var messages: Message? {
4067 get {
4068 return (snapshot["messages"] as? Snapshot).flatMap { Message(snapshot: $0) }
4069 }
4070 set {
4071 snapshot.updateValue(newValue?.snapshot, forKey: "messages")
4072 }
4073 }
4074
4075 /// The username
4076 public var username: String {
4077 get {
4078 return snapshot["username"]! as! String
4079 }
4080 set {
4081 snapshot.updateValue(newValue, forKey: "username")
4082 }
4083 }
4084
4085 /// is the user registered?
4086 public var registered: Bool? {
4087 get {
4088 return snapshot["registered"] as? Bool
4089 }
4090 set {
4091 snapshot.updateValue(newValue, forKey: "registered")
4092 }
4093 }
4094
4095 public struct Conversation: GraphQLSelectionSet {
4096 public static let possibleTypes = ["UserConverstationsConnection"]
4097
4098 public static let selections: [GraphQLSelection] = [
4099 GraphQLField("__typename", type: .nonNull(.scalar(String.self))),
4100 GraphQLField("nextToken", type: .scalar(String.self)),
4101 ]
4102
4103 public var snapshot: Snapshot
4104
4105 public init(snapshot: Snapshot) {
4106 self.snapshot = snapshot
4107 }
4108
4109 public init(nextToken: String? = nil) {
4110 self.init(snapshot: ["__typename": "UserConverstationsConnection", "nextToken": nextToken])
4111 }
4112
4113 public var __typename: String {
4114 get {
4115 return snapshot["__typename"]! as! String
4116 }
4117 set {
4118 snapshot.updateValue(newValue, forKey: "__typename")
4119 }
4120 }
4121
4122 public var nextToken: String? {
4123 get {
4124 return snapshot["nextToken"] as? String
4125 }
4126 set {
4127 snapshot.updateValue(newValue, forKey: "nextToken")
4128 }
4129 }
4130 }
4131
4132 public struct Message: GraphQLSelectionSet {
4133 public static let possibleTypes = ["MessageConnection"]
4134
4135 public static let selections: [GraphQLSelection] = [
4136 GraphQLField("__typename", type: .nonNull(.scalar(String.self))),
4137 GraphQLField("nextToken", type: .scalar(String.self)),
4138 ]
4139
4140 public var snapshot: Snapshot
4141
4142 public init(snapshot: Snapshot) {
4143 self.snapshot = snapshot
4144 }
4145
4146 public init(nextToken: String? = nil) {
4147 self.init(snapshot: ["__typename": "MessageConnection", "nextToken": nextToken])
4148 }
4149
4150 public var __typename: String {
4151 get {
4152 return snapshot["__typename"]! as! String
4153 }
4154 set {
4155 snapshot.updateValue(newValue, forKey: "__typename")
4156 }
4157 }
4158
4159 public var nextToken: String? {
4160 get {
4161 return snapshot["nextToken"] as? String
4162 }
4163 set {
4164 snapshot.updateValue(newValue, forKey: "nextToken")
4165 }
4166 }
4167 }
4168 }
4169
4170 public struct Recipient: GraphQLSelectionSet {
4171 public static let possibleTypes = ["User"]
4172
4173 public static let selections: [GraphQLSelection] = [
4174 GraphQLField("__typename", type: .nonNull(.scalar(String.self))),
4175 GraphQLField("cognitoId", type: .nonNull(.scalar(GraphQLID.self))),
4176 GraphQLField("conversations", type: .object(Conversation.selections)),
4177 GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))),
4178 GraphQLField("messages", type: .object(Message.selections)),
4179 GraphQLField("username", type: .nonNull(.scalar(String.self))),
4180 GraphQLField("registered", type: .scalar(Bool.self)),
4181 ]
4182
4183 public var snapshot: Snapshot
4184
4185 public init(snapshot: Snapshot) {
4186 self.snapshot = snapshot
4187 }
4188
4189 public init(cognitoId: GraphQLID, conversations: Conversation? = nil, id: GraphQLID, messages: Message? = nil, username: String, registered: Bool? = nil) {
4190 self.init(snapshot: ["__typename": "User", "cognitoId": cognitoId, "conversations": conversations.flatMap { $0.snapshot }, "id": id, "messages": messages.flatMap { $0.snapshot }, "username": username, "registered": registered])
4191 }
4192
4193 public var __typename: String {
4194 get {
4195 return snapshot["__typename"]! as! String
4196 }
4197 set {
4198 snapshot.updateValue(newValue, forKey: "__typename")
4199 }
4200 }
4201
4202 /// A unique identifier for the user.
4203 public var cognitoId: GraphQLID {
4204 get {
4205 return snapshot["cognitoId"]! as! GraphQLID
4206 }
4207 set {
4208 snapshot.updateValue(newValue, forKey: "cognitoId")
4209 }
4210 }
4211
4212 /// A user's enrolled Conversations. This is an interesting case. This is an interesting pagination case.
4213 public var conversations: Conversation? {
4214 get {
4215 return (snapshot["conversations"] as? Snapshot).flatMap { Conversation(snapshot: $0) }
4216 }
4217 set {
4218 snapshot.updateValue(newValue?.snapshot, forKey: "conversations")
4219 }
4220 }
4221
4222 /// Generated id for a user. read-only
4223 public var id: GraphQLID {
4224 get {
4225 return snapshot["id"]! as! GraphQLID
4226 }
4227 set {
4228 snapshot.updateValue(newValue, forKey: "id")
4229 }
4230 }
4231
4232 /// Get a users messages by querying a GSI on the Messages table.
4233 public var messages: Message? {
4234 get {
4235 return (snapshot["messages"] as? Snapshot).flatMap { Message(snapshot: $0) }
4236 }
4237 set {
4238 snapshot.updateValue(newValue?.snapshot, forKey: "messages")
4239 }
4240 }
4241
4242 /// The username
4243 public var username: String {
4244 get {
4245 return snapshot["username"]! as! String
4246 }
4247 set {
4248 snapshot.updateValue(newValue, forKey: "username")
4249 }
4250 }
4251
4252 /// is the user registered?
4253 public var registered: Bool? {
4254 get {
4255 return snapshot["registered"] as? Bool
4256 }
4257 set {
4258 snapshot.updateValue(newValue, forKey: "registered")
4259 }
4260 }
4261
4262 public struct Conversation: GraphQLSelectionSet {
4263 public static let possibleTypes = ["UserConverstationsConnection"]
4264
4265 public static let selections: [GraphQLSelection] = [
4266 GraphQLField("__typename", type: .nonNull(.scalar(String.self))),
4267 GraphQLField("nextToken", type: .scalar(String.self)),
4268 ]
4269
4270 public var snapshot: Snapshot
4271
4272 public init(snapshot: Snapshot) {
4273 self.snapshot = snapshot
4274 }
4275
4276 public init(nextToken: String? = nil) {
4277 self.init(snapshot: ["__typename": "UserConverstationsConnection", "nextToken": nextToken])
4278 }
4279
4280 public var __typename: String {
4281 get {
4282 return snapshot["__typename"]! as! String
4283 }
4284 set {
4285 snapshot.updateValue(newValue, forKey: "__typename")
4286 }
4287 }
4288
4289 public var nextToken: String? {
4290 get {
4291 return snapshot["nextToken"] as? String
4292 }
4293 set {
4294 snapshot.updateValue(newValue, forKey: "nextToken")
4295 }
4296 }
4297 }
4298
4299 public struct Message: GraphQLSelectionSet {
4300 public static let possibleTypes = ["MessageConnection"]
4301
4302 public static let selections: [GraphQLSelection] = [
4303 GraphQLField("__typename", type: .nonNull(.scalar(String.self))),
4304 GraphQLField("nextToken", type: .scalar(String.self)),
4305 ]
4306
4307 public var snapshot: Snapshot
4308
4309 public init(snapshot: Snapshot) {
4310 self.snapshot = snapshot
4311 }
4312
4313 public init(nextToken: String? = nil) {
4314 self.init(snapshot: ["__typename": "MessageConnection", "nextToken": nextToken])
4315 }
4316
4317 public var __typename: String {
4318 get {
4319 return snapshot["__typename"]! as! String
4320 }
4321 set {
4322 snapshot.updateValue(newValue, forKey: "__typename")
4323 }
4324 }
4325
4326 public var nextToken: String? {
4327 get {
4328 return snapshot["nextToken"] as? String
4329 }
4330 set {
4331 snapshot.updateValue(newValue, forKey: "nextToken")
4332 }
4333 }
4334 }
4335 }
4336 }
4337 }
4338}
4339
4340public final class SubscribeToNewUCsSubscription: GraphQLSubscription {
4341 public static let operationString =
4342 "subscription SubscribeToNewUCs($userId: ID!) {\n subscribeToNewUCs(userId: $userId) {\n __typename\n associated {\n __typename\n associated {\n __typename\n conversationId\n userId\n }\n conversation {\n __typename\n createdAt\n id\n name\n }\n conversationId\n user {\n __typename\n cognitoId\n id\n username\n registered\n }\n userId\n }\n conversation {\n __typename\n createdAt\n id\n messages {\n __typename\n nextToken\n }\n name\n }\n conversationId\n user {\n __typename\n cognitoId\n conversations {\n __typename\n nextToken\n }\n id\n messages {\n __typename\n nextToken\n }\n username\n registered\n }\n userId\n }\n}"
4343
4344 public var userId: GraphQLID
4345
4346 public init(userId: GraphQLID) {
4347 self.userId = userId
4348 }
4349
4350 public var variables: GraphQLMap? {
4351 return ["userId": userId]
4352 }
4353
4354 public struct Data: GraphQLSelectionSet {
4355 public static let possibleTypes = ["Subscription"]
4356
4357 public static let selections: [GraphQLSelection] = [
4358 GraphQLField("subscribeToNewUCs", arguments: ["userId": GraphQLVariable("userId")], type: .object(SubscribeToNewUc.selections)),
4359 ]
4360
4361 public var snapshot: Snapshot
4362
4363 public init(snapshot: Snapshot) {
4364 self.snapshot = snapshot
4365 }
4366
4367 public init(subscribeToNewUCs: SubscribeToNewUc? = nil) {
4368 self.init(snapshot: ["__typename": "Subscription", "subscribeToNewUCs": subscribeToNewUCs.flatMap { $0.snapshot }])
4369 }
4370
4371 public var subscribeToNewUCs: SubscribeToNewUc? {
4372 get {
4373 return (snapshot["subscribeToNewUCs"] as? Snapshot).flatMap { SubscribeToNewUc(snapshot: $0) }
4374 }
4375 set {
4376 snapshot.updateValue(newValue?.snapshot, forKey: "subscribeToNewUCs")
4377 }
4378 }
4379
4380 public struct SubscribeToNewUc: GraphQLSelectionSet {
4381 public static let possibleTypes = ["UserConversations"]
4382
4383 public static let selections: [GraphQLSelection] = [
4384 GraphQLField("__typename", type: .nonNull(.scalar(String.self))),
4385 GraphQLField("associated", type: .list(.object(Associated.selections))),
4386 GraphQLField("conversation", type: .object(Conversation.selections)),
4387 GraphQLField("conversationId", type: .nonNull(.scalar(GraphQLID.self))),
4388 GraphQLField("user", type: .object(User.selections)),
4389 GraphQLField("userId", type: .nonNull(.scalar(GraphQLID.self))),
4390 ]
4391
4392 public var snapshot: Snapshot
4393
4394 public init(snapshot: Snapshot) {
4395 self.snapshot = snapshot
4396 }
4397
4398 public init(associated: [Associated?]? = nil, conversation: Conversation? = nil, conversationId: GraphQLID, user: User? = nil, userId: GraphQLID) {
4399 self.init(snapshot: ["__typename": "UserConversations", "associated": associated.flatMap { $0.map { $0.flatMap { $0.snapshot } } }, "conversation": conversation.flatMap { $0.snapshot }, "conversationId": conversationId, "user": user.flatMap { $0.snapshot }, "userId": userId])
4400 }
4401
4402 public var __typename: String {
4403 get {
4404 return snapshot["__typename"]! as! String
4405 }
4406 set {
4407 snapshot.updateValue(newValue, forKey: "__typename")
4408 }
4409 }
4410
4411 public var associated: [Associated?]? {
4412 get {
4413 return (snapshot["associated"] as? [Snapshot?]).flatMap { $0.map { $0.flatMap { Associated(snapshot: $0) } } }
4414 }
4415 set {
4416 snapshot.updateValue(newValue.flatMap { $0.map { $0.flatMap { $0.snapshot } } }, forKey: "associated")
4417 }
4418 }
4419
4420 public var conversation: Conversation? {
4421 get {
4422 return (snapshot["conversation"] as? Snapshot).flatMap { Conversation(snapshot: $0) }
4423 }
4424 set {
4425 snapshot.updateValue(newValue?.snapshot, forKey: "conversation")
4426 }
4427 }
4428
4429 public var conversationId: GraphQLID {
4430 get {
4431 return snapshot["conversationId"]! as! GraphQLID
4432 }
4433 set {
4434 snapshot.updateValue(newValue, forKey: "conversationId")
4435 }
4436 }
4437
4438 public var user: User? {
4439 get {
4440 return (snapshot["user"] as? Snapshot).flatMap { User(snapshot: $0) }
4441 }
4442 set {
4443 snapshot.updateValue(newValue?.snapshot, forKey: "user")
4444 }
4445 }
4446
4447 public var userId: GraphQLID {
4448 get {
4449 return snapshot["userId"]! as! GraphQLID
4450 }
4451 set {
4452 snapshot.updateValue(newValue, forKey: "userId")
4453 }
4454 }
4455
4456 public struct Associated: GraphQLSelectionSet {
4457 public static let possibleTypes = ["UserConversations"]
4458
4459 public static let selections: [GraphQLSelection] = [
4460 GraphQLField("__typename", type: .nonNull(.scalar(String.self))),
4461 GraphQLField("associated", type: .list(.object(Associated.selections))),
4462 GraphQLField("conversation", type: .object(Conversation.selections)),
4463 GraphQLField("conversationId", type: .nonNull(.scalar(GraphQLID.self))),
4464 GraphQLField("user", type: .object(User.selections)),
4465 GraphQLField("userId", type: .nonNull(.scalar(GraphQLID.self))),
4466 ]
4467
4468 public var snapshot: Snapshot
4469
4470 public init(snapshot: Snapshot) {
4471 self.snapshot = snapshot
4472 }
4473
4474 public init(associated: [Associated?]? = nil, conversation: Conversation? = nil, conversationId: GraphQLID, user: User? = nil, userId: GraphQLID) {
4475 self.init(snapshot: ["__typename": "UserConversations", "associated": associated.flatMap { $0.map { $0.flatMap { $0.snapshot } } }, "conversation": conversation.flatMap { $0.snapshot }, "conversationId": conversationId, "user": user.flatMap { $0.snapshot }, "userId": userId])
4476 }
4477
4478 public var __typename: String {
4479 get {
4480 return snapshot["__typename"]! as! String
4481 }
4482 set {
4483 snapshot.updateValue(newValue, forKey: "__typename")
4484 }
4485 }
4486
4487 public var associated: [Associated?]? {
4488 get {
4489 return (snapshot["associated"] as? [Snapshot?]).flatMap { $0.map { $0.flatMap { Associated(snapshot: $0) } } }
4490 }
4491 set {
4492 snapshot.updateValue(newValue.flatMap { $0.map { $0.flatMap { $0.snapshot } } }, forKey: "associated")
4493 }
4494 }
4495
4496 public var conversation: Conversation? {
4497 get {
4498 return (snapshot["conversation"] as? Snapshot).flatMap { Conversation(snapshot: $0) }
4499 }
4500 set {
4501 snapshot.updateValue(newValue?.snapshot, forKey: "conversation")
4502 }
4503 }
4504
4505 public var conversationId: GraphQLID {
4506 get {
4507 return snapshot["conversationId"]! as! GraphQLID
4508 }
4509 set {
4510 snapshot.updateValue(newValue, forKey: "conversationId")
4511 }
4512 }
4513
4514 public var user: User? {
4515 get {
4516 return (snapshot["user"] as? Snapshot).flatMap { User(snapshot: $0) }
4517 }
4518 set {
4519 snapshot.updateValue(newValue?.snapshot, forKey: "user")
4520 }
4521 }
4522
4523 public var userId: GraphQLID {
4524 get {
4525 return snapshot["userId"]! as! GraphQLID
4526 }
4527 set {
4528 snapshot.updateValue(newValue, forKey: "userId")
4529 }
4530 }
4531
4532 public struct Associated: GraphQLSelectionSet {
4533 public static let possibleTypes = ["UserConversations"]
4534
4535 public static let selections: [GraphQLSelection] = [
4536 GraphQLField("__typename", type: .nonNull(.scalar(String.self))),
4537 GraphQLField("conversationId", type: .nonNull(.scalar(GraphQLID.self))),
4538 GraphQLField("userId", type: .nonNull(.scalar(GraphQLID.self))),
4539 ]
4540
4541 public var snapshot: Snapshot
4542
4543 public init(snapshot: Snapshot) {
4544 self.snapshot = snapshot
4545 }
4546
4547 public init(conversationId: GraphQLID, userId: GraphQLID) {
4548 self.init(snapshot: ["__typename": "UserConversations", "conversationId": conversationId, "userId": userId])
4549 }
4550
4551 public var __typename: String {
4552 get {
4553 return snapshot["__typename"]! as! String
4554 }
4555 set {
4556 snapshot.updateValue(newValue, forKey: "__typename")
4557 }
4558 }
4559
4560 public var conversationId: GraphQLID {
4561 get {
4562 return snapshot["conversationId"]! as! GraphQLID
4563 }
4564 set {
4565 snapshot.updateValue(newValue, forKey: "conversationId")
4566 }
4567 }
4568
4569 public var userId: GraphQLID {
4570 get {
4571 return snapshot["userId"]! as! GraphQLID
4572 }
4573 set {
4574 snapshot.updateValue(newValue, forKey: "userId")
4575 }
4576 }
4577 }
4578
4579 public struct Conversation: GraphQLSelectionSet {
4580 public static let possibleTypes = ["Conversation"]
4581
4582 public static let selections: [GraphQLSelection] = [
4583 GraphQLField("__typename", type: .nonNull(.scalar(String.self))),
4584 GraphQLField("createdAt", type: .scalar(String.self)),
4585 GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))),
4586 GraphQLField("name", type: .nonNull(.scalar(String.self))),
4587 ]
4588
4589 public var snapshot: Snapshot
4590
4591 public init(snapshot: Snapshot) {
4592 self.snapshot = snapshot
4593 }
4594
4595 public init(createdAt: String? = nil, id: GraphQLID, name: String) {
4596 self.init(snapshot: ["__typename": "Conversation", "createdAt": createdAt, "id": id, "name": name])
4597 }
4598
4599 public var __typename: String {
4600 get {
4601 return snapshot["__typename"]! as! String
4602 }
4603 set {
4604 snapshot.updateValue(newValue, forKey: "__typename")
4605 }
4606 }
4607
4608 /// The Conversation's timestamp.
4609 public var createdAt: String? {
4610 get {
4611 return snapshot["createdAt"] as? String
4612 }
4613 set {
4614 snapshot.updateValue(newValue, forKey: "createdAt")
4615 }
4616 }
4617
4618 /// A unique identifier for the Conversation.
4619 public var id: GraphQLID {
4620 get {
4621 return snapshot["id"]! as! GraphQLID
4622 }
4623 set {
4624 snapshot.updateValue(newValue, forKey: "id")
4625 }
4626 }
4627
4628 /// The Conversation's name.
4629 public var name: String {
4630 get {
4631 return snapshot["name"]! as! String
4632 }
4633 set {
4634 snapshot.updateValue(newValue, forKey: "name")
4635 }
4636 }
4637 }
4638
4639 public struct User: GraphQLSelectionSet {
4640 public static let possibleTypes = ["User"]
4641
4642 public static let selections: [GraphQLSelection] = [
4643 GraphQLField("__typename", type: .nonNull(.scalar(String.self))),
4644 GraphQLField("cognitoId", type: .nonNull(.scalar(GraphQLID.self))),
4645 GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))),
4646 GraphQLField("username", type: .nonNull(.scalar(String.self))),
4647 GraphQLField("registered", type: .scalar(Bool.self)),
4648 ]
4649
4650 public var snapshot: Snapshot
4651
4652 public init(snapshot: Snapshot) {
4653 self.snapshot = snapshot
4654 }
4655
4656 public init(cognitoId: GraphQLID, id: GraphQLID, username: String, registered: Bool? = nil) {
4657 self.init(snapshot: ["__typename": "User", "cognitoId": cognitoId, "id": id, "username": username, "registered": registered])
4658 }
4659
4660 public var __typename: String {
4661 get {
4662 return snapshot["__typename"]! as! String
4663 }
4664 set {
4665 snapshot.updateValue(newValue, forKey: "__typename")
4666 }
4667 }
4668
4669 /// A unique identifier for the user.
4670 public var cognitoId: GraphQLID {
4671 get {
4672 return snapshot["cognitoId"]! as! GraphQLID
4673 }
4674 set {
4675 snapshot.updateValue(newValue, forKey: "cognitoId")
4676 }
4677 }
4678
4679 /// Generated id for a user. read-only
4680 public var id: GraphQLID {
4681 get {
4682 return snapshot["id"]! as! GraphQLID
4683 }
4684 set {
4685 snapshot.updateValue(newValue, forKey: "id")
4686 }
4687 }
4688
4689 /// The username
4690 public var username: String {
4691 get {
4692 return snapshot["username"]! as! String
4693 }
4694 set {
4695 snapshot.updateValue(newValue, forKey: "username")
4696 }
4697 }
4698
4699 /// is the user registered?
4700 public var registered: Bool? {
4701 get {
4702 return snapshot["registered"] as? Bool
4703 }
4704 set {
4705 snapshot.updateValue(newValue, forKey: "registered")
4706 }
4707 }
4708 }
4709 }
4710
4711 public struct Conversation: GraphQLSelectionSet {
4712 public static let possibleTypes = ["Conversation"]
4713
4714 public static let selections: [GraphQLSelection] = [
4715 GraphQLField("__typename", type: .nonNull(.scalar(String.self))),
4716 GraphQLField("createdAt", type: .scalar(String.self)),
4717 GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))),
4718 GraphQLField("messages", type: .object(Message.selections)),
4719 GraphQLField("name", type: .nonNull(.scalar(String.self))),
4720 ]
4721
4722 public var snapshot: Snapshot
4723
4724 public init(snapshot: Snapshot) {
4725 self.snapshot = snapshot
4726 }
4727
4728 public init(createdAt: String? = nil, id: GraphQLID, messages: Message? = nil, name: String) {
4729 self.init(snapshot: ["__typename": "Conversation", "createdAt": createdAt, "id": id, "messages": messages.flatMap { $0.snapshot }, "name": name])
4730 }
4731
4732 public var __typename: String {
4733 get {
4734 return snapshot["__typename"]! as! String
4735 }
4736 set {
4737 snapshot.updateValue(newValue, forKey: "__typename")
4738 }
4739 }
4740
4741 /// The Conversation's timestamp.
4742 public var createdAt: String? {
4743 get {
4744 return snapshot["createdAt"] as? String
4745 }
4746 set {
4747 snapshot.updateValue(newValue, forKey: "createdAt")
4748 }
4749 }
4750
4751 /// A unique identifier for the Conversation.
4752 public var id: GraphQLID {
4753 get {
4754 return snapshot["id"]! as! GraphQLID
4755 }
4756 set {
4757 snapshot.updateValue(newValue, forKey: "id")
4758 }
4759 }
4760
4761 /// The Conversation's messages.
4762 public var messages: Message? {
4763 get {
4764 return (snapshot["messages"] as? Snapshot).flatMap { Message(snapshot: $0) }
4765 }
4766 set {
4767 snapshot.updateValue(newValue?.snapshot, forKey: "messages")
4768 }
4769 }
4770
4771 /// The Conversation's name.
4772 public var name: String {
4773 get {
4774 return snapshot["name"]! as! String
4775 }
4776 set {
4777 snapshot.updateValue(newValue, forKey: "name")
4778 }
4779 }
4780
4781 public struct Message: GraphQLSelectionSet {
4782 public static let possibleTypes = ["MessageConnection"]
4783
4784 public static let selections: [GraphQLSelection] = [
4785 GraphQLField("__typename", type: .nonNull(.scalar(String.self))),
4786 GraphQLField("nextToken", type: .scalar(String.self)),
4787 ]
4788
4789 public var snapshot: Snapshot
4790
4791 public init(snapshot: Snapshot) {
4792 self.snapshot = snapshot
4793 }
4794
4795 public init(nextToken: String? = nil) {
4796 self.init(snapshot: ["__typename": "MessageConnection", "nextToken": nextToken])
4797 }
4798
4799 public var __typename: String {
4800 get {
4801 return snapshot["__typename"]! as! String
4802 }
4803 set {
4804 snapshot.updateValue(newValue, forKey: "__typename")
4805 }
4806 }
4807
4808 public var nextToken: String? {
4809 get {
4810 return snapshot["nextToken"] as? String
4811 }
4812 set {
4813 snapshot.updateValue(newValue, forKey: "nextToken")
4814 }
4815 }
4816 }
4817 }
4818
4819 public struct User: GraphQLSelectionSet {
4820 public static let possibleTypes = ["User"]
4821
4822 public static let selections: [GraphQLSelection] = [
4823 GraphQLField("__typename", type: .nonNull(.scalar(String.self))),
4824 GraphQLField("cognitoId", type: .nonNull(.scalar(GraphQLID.self))),
4825 GraphQLField("conversations", type: .object(Conversation.selections)),
4826 GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))),
4827 GraphQLField("messages", type: .object(Message.selections)),
4828 GraphQLField("username", type: .nonNull(.scalar(String.self))),
4829 GraphQLField("registered", type: .scalar(Bool.self)),
4830 ]
4831
4832 public var snapshot: Snapshot
4833
4834 public init(snapshot: Snapshot) {
4835 self.snapshot = snapshot
4836 }
4837
4838 public init(cognitoId: GraphQLID, conversations: Conversation? = nil, id: GraphQLID, messages: Message? = nil, username: String, registered: Bool? = nil) {
4839 self.init(snapshot: ["__typename": "User", "cognitoId": cognitoId, "conversations": conversations.flatMap { $0.snapshot }, "id": id, "messages": messages.flatMap { $0.snapshot }, "username": username, "registered": registered])
4840 }
4841
4842 public var __typename: String {
4843 get {
4844 return snapshot["__typename"]! as! String
4845 }
4846 set {
4847 snapshot.updateValue(newValue, forKey: "__typename")
4848 }
4849 }
4850
4851 /// A unique identifier for the user.
4852 public var cognitoId: GraphQLID {
4853 get {
4854 return snapshot["cognitoId"]! as! GraphQLID
4855 }
4856 set {
4857 snapshot.updateValue(newValue, forKey: "cognitoId")
4858 }
4859 }
4860
4861 /// A user's enrolled Conversations. This is an interesting case. This is an interesting pagination case.
4862 public var conversations: Conversation? {
4863 get {
4864 return (snapshot["conversations"] as? Snapshot).flatMap { Conversation(snapshot: $0) }
4865 }
4866 set {
4867 snapshot.updateValue(newValue?.snapshot, forKey: "conversations")
4868 }
4869 }
4870
4871 /// Generated id for a user. read-only
4872 public var id: GraphQLID {
4873 get {
4874 return snapshot["id"]! as! GraphQLID
4875 }
4876 set {
4877 snapshot.updateValue(newValue, forKey: "id")
4878 }
4879 }
4880
4881 /// Get a users messages by querying a GSI on the Messages table.
4882 public var messages: Message? {
4883 get {
4884 return (snapshot["messages"] as? Snapshot).flatMap { Message(snapshot: $0) }
4885 }
4886 set {
4887 snapshot.updateValue(newValue?.snapshot, forKey: "messages")
4888 }
4889 }
4890
4891 /// The username
4892 public var username: String {
4893 get {
4894 return snapshot["username"]! as! String
4895 }
4896 set {
4897 snapshot.updateValue(newValue, forKey: "username")
4898 }
4899 }
4900
4901 /// is the user registered?
4902 public var registered: Bool? {
4903 get {
4904 return snapshot["registered"] as? Bool
4905 }
4906 set {
4907 snapshot.updateValue(newValue, forKey: "registered")
4908 }
4909 }
4910
4911 public struct Conversation: GraphQLSelectionSet {
4912 public static let possibleTypes = ["UserConverstationsConnection"]
4913
4914 public static let selections: [GraphQLSelection] = [
4915 GraphQLField("__typename", type: .nonNull(.scalar(String.self))),
4916 GraphQLField("nextToken", type: .scalar(String.self)),
4917 ]
4918
4919 public var snapshot: Snapshot
4920
4921 public init(snapshot: Snapshot) {
4922 self.snapshot = snapshot
4923 }
4924
4925 public init(nextToken: String? = nil) {
4926 self.init(snapshot: ["__typename": "UserConverstationsConnection", "nextToken": nextToken])
4927 }
4928
4929 public var __typename: String {
4930 get {
4931 return snapshot["__typename"]! as! String
4932 }
4933 set {
4934 snapshot.updateValue(newValue, forKey: "__typename")
4935 }
4936 }
4937
4938 public var nextToken: String? {
4939 get {
4940 return snapshot["nextToken"] as? String
4941 }
4942 set {
4943 snapshot.updateValue(newValue, forKey: "nextToken")
4944 }
4945 }
4946 }
4947
4948 public struct Message: GraphQLSelectionSet {
4949 public static let possibleTypes = ["MessageConnection"]
4950
4951 public static let selections: [GraphQLSelection] = [
4952 GraphQLField("__typename", type: .nonNull(.scalar(String.self))),
4953 GraphQLField("nextToken", type: .scalar(String.self)),
4954 ]
4955
4956 public var snapshot: Snapshot
4957
4958 public init(snapshot: Snapshot) {
4959 self.snapshot = snapshot
4960 }
4961
4962 public init(nextToken: String? = nil) {
4963 self.init(snapshot: ["__typename": "MessageConnection", "nextToken": nextToken])
4964 }
4965
4966 public var __typename: String {
4967 get {
4968 return snapshot["__typename"]! as! String
4969 }
4970 set {
4971 snapshot.updateValue(newValue, forKey: "__typename")
4972 }
4973 }
4974
4975 public var nextToken: String? {
4976 get {
4977 return snapshot["nextToken"] as? String
4978 }
4979 set {
4980 snapshot.updateValue(newValue, forKey: "nextToken")
4981 }
4982 }
4983 }
4984 }
4985 }
4986 }
4987}
4988
4989public final class SubscribeToNewUsersSubscription: GraphQLSubscription {
4990 public static let operationString =
4991 "subscription SubscribeToNewUsers {\n subscribeToNewUsers {\n __typename\n cognitoId\n conversations {\n __typename\n nextToken\n userConversations {\n __typename\n conversationId\n userId\n }\n }\n id\n messages {\n __typename\n messages {\n __typename\n content\n conversationId\n createdAt\n id\n isSent\n sender\n }\n nextToken\n }\n username\n registered\n }\n}"
4992
4993 public init() {
4994 }
4995
4996 public struct Data: GraphQLSelectionSet {
4997 public static let possibleTypes = ["Subscription"]
4998
4999 public static let selections: [GraphQLSelection] = [
5000 GraphQLField("subscribeToNewUsers", type: .object(SubscribeToNewUser.selections)),
5001 ]
5002
5003 public var snapshot: Snapshot
5004
5005 public init(snapshot: Snapshot) {
5006 self.snapshot = snapshot
5007 }
5008
5009 public init(subscribeToNewUsers: SubscribeToNewUser? = nil) {
5010 self.init(snapshot: ["__typename": "Subscription", "subscribeToNewUsers": subscribeToNewUsers.flatMap { $0.snapshot }])
5011 }
5012
5013 public var subscribeToNewUsers: SubscribeToNewUser? {
5014 get {
5015 return (snapshot["subscribeToNewUsers"] as? Snapshot).flatMap { SubscribeToNewUser(snapshot: $0) }
5016 }
5017 set {
5018 snapshot.updateValue(newValue?.snapshot, forKey: "subscribeToNewUsers")
5019 }
5020 }
5021
5022 public struct SubscribeToNewUser: GraphQLSelectionSet {
5023 public static let possibleTypes = ["User"]
5024
5025 public static let selections: [GraphQLSelection] = [
5026 GraphQLField("__typename", type: .nonNull(.scalar(String.self))),
5027 GraphQLField("cognitoId", type: .nonNull(.scalar(GraphQLID.self))),
5028 GraphQLField("conversations", type: .object(Conversation.selections)),
5029 GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))),
5030 GraphQLField("messages", type: .object(Message.selections)),
5031 GraphQLField("username", type: .nonNull(.scalar(String.self))),
5032 GraphQLField("registered", type: .scalar(Bool.self)),
5033 ]
5034
5035 public var snapshot: Snapshot
5036
5037 public init(snapshot: Snapshot) {
5038 self.snapshot = snapshot
5039 }
5040
5041 public init(cognitoId: GraphQLID, conversations: Conversation? = nil, id: GraphQLID, messages: Message? = nil, username: String, registered: Bool? = nil) {
5042 self.init(snapshot: ["__typename": "User", "cognitoId": cognitoId, "conversations": conversations.flatMap { $0.snapshot }, "id": id, "messages": messages.flatMap { $0.snapshot }, "username": username, "registered": registered])
5043 }
5044
5045 public var __typename: String {
5046 get {
5047 return snapshot["__typename"]! as! String
5048 }
5049 set {
5050 snapshot.updateValue(newValue, forKey: "__typename")
5051 }
5052 }
5053
5054 /// A unique identifier for the user.
5055 public var cognitoId: GraphQLID {
5056 get {
5057 return snapshot["cognitoId"]! as! GraphQLID
5058 }
5059 set {
5060 snapshot.updateValue(newValue, forKey: "cognitoId")
5061 }
5062 }
5063
5064 /// A user's enrolled Conversations. This is an interesting case. This is an interesting pagination case.
5065 public var conversations: Conversation? {
5066 get {
5067 return (snapshot["conversations"] as? Snapshot).flatMap { Conversation(snapshot: $0) }
5068 }
5069 set {
5070 snapshot.updateValue(newValue?.snapshot, forKey: "conversations")
5071 }
5072 }
5073
5074 /// Generated id for a user. read-only
5075 public var id: GraphQLID {
5076 get {
5077 return snapshot["id"]! as! GraphQLID
5078 }
5079 set {
5080 snapshot.updateValue(newValue, forKey: "id")
5081 }
5082 }
5083
5084 /// Get a users messages by querying a GSI on the Messages table.
5085 public var messages: Message? {
5086 get {
5087 return (snapshot["messages"] as? Snapshot).flatMap { Message(snapshot: $0) }
5088 }
5089 set {
5090 snapshot.updateValue(newValue?.snapshot, forKey: "messages")
5091 }
5092 }
5093
5094 /// The username
5095 public var username: String {
5096 get {
5097 return snapshot["username"]! as! String
5098 }
5099 set {
5100 snapshot.updateValue(newValue, forKey: "username")
5101 }
5102 }
5103
5104 /// is the user registered?
5105 public var registered: Bool? {
5106 get {
5107 return snapshot["registered"] as? Bool
5108 }
5109 set {
5110 snapshot.updateValue(newValue, forKey: "registered")
5111 }
5112 }
5113
5114 public struct Conversation: GraphQLSelectionSet {
5115 public static let possibleTypes = ["UserConverstationsConnection"]
5116
5117 public static let selections: [GraphQLSelection] = [
5118 GraphQLField("__typename", type: .nonNull(.scalar(String.self))),
5119 GraphQLField("nextToken", type: .scalar(String.self)),
5120 GraphQLField("userConversations", type: .list(.object(UserConversation.selections))),
5121 ]
5122
5123 public var snapshot: Snapshot
5124
5125 public init(snapshot: Snapshot) {
5126 self.snapshot = snapshot
5127 }
5128
5129 public init(nextToken: String? = nil, userConversations: [UserConversation?]? = nil) {
5130 self.init(snapshot: ["__typename": "UserConverstationsConnection", "nextToken": nextToken, "userConversations": userConversations.flatMap { $0.map { $0.flatMap { $0.snapshot } } }])
5131 }
5132
5133 public var __typename: String {
5134 get {
5135 return snapshot["__typename"]! as! String
5136 }
5137 set {
5138 snapshot.updateValue(newValue, forKey: "__typename")
5139 }
5140 }
5141
5142 public var nextToken: String? {
5143 get {
5144 return snapshot["nextToken"] as? String
5145 }
5146 set {
5147 snapshot.updateValue(newValue, forKey: "nextToken")
5148 }
5149 }
5150
5151 public var userConversations: [UserConversation?]? {
5152 get {
5153 return (snapshot["userConversations"] as? [Snapshot?]).flatMap { $0.map { $0.flatMap { UserConversation(snapshot: $0) } } }
5154 }
5155 set {
5156 snapshot.updateValue(newValue.flatMap { $0.map { $0.flatMap { $0.snapshot } } }, forKey: "userConversations")
5157 }
5158 }
5159
5160 public struct UserConversation: GraphQLSelectionSet {
5161 public static let possibleTypes = ["UserConversations"]
5162
5163 public static let selections: [GraphQLSelection] = [
5164 GraphQLField("__typename", type: .nonNull(.scalar(String.self))),
5165 GraphQLField("conversationId", type: .nonNull(.scalar(GraphQLID.self))),
5166 GraphQLField("userId", type: .nonNull(.scalar(GraphQLID.self))),
5167 ]
5168
5169 public var snapshot: Snapshot
5170
5171 public init(snapshot: Snapshot) {
5172 self.snapshot = snapshot
5173 }
5174
5175 public init(conversationId: GraphQLID, userId: GraphQLID) {
5176 self.init(snapshot: ["__typename": "UserConversations", "conversationId": conversationId, "userId": userId])
5177 }
5178
5179 public var __typename: String {
5180 get {
5181 return snapshot["__typename"]! as! String
5182 }
5183 set {
5184 snapshot.updateValue(newValue, forKey: "__typename")
5185 }
5186 }
5187
5188 public var conversationId: GraphQLID {
5189 get {
5190 return snapshot["conversationId"]! as! GraphQLID
5191 }
5192 set {
5193 snapshot.updateValue(newValue, forKey: "conversationId")
5194 }
5195 }
5196
5197 public var userId: GraphQLID {
5198 get {
5199 return snapshot["userId"]! as! GraphQLID
5200 }
5201 set {
5202 snapshot.updateValue(newValue, forKey: "userId")
5203 }
5204 }
5205 }
5206 }
5207
5208 public struct Message: GraphQLSelectionSet {
5209 public static let possibleTypes = ["MessageConnection"]
5210
5211 public static let selections: [GraphQLSelection] = [
5212 GraphQLField("__typename", type: .nonNull(.scalar(String.self))),
5213 GraphQLField("messages", type: .list(.object(Message.selections))),
5214 GraphQLField("nextToken", type: .scalar(String.self)),
5215 ]
5216
5217 public var snapshot: Snapshot
5218
5219 public init(snapshot: Snapshot) {
5220 self.snapshot = snapshot
5221 }
5222
5223 public init(messages: [Message?]? = nil, nextToken: String? = nil) {
5224 self.init(snapshot: ["__typename": "MessageConnection", "messages": messages.flatMap { $0.map { $0.flatMap { $0.snapshot } } }, "nextToken": nextToken])
5225 }
5226
5227 public var __typename: String {
5228 get {
5229 return snapshot["__typename"]! as! String
5230 }
5231 set {
5232 snapshot.updateValue(newValue, forKey: "__typename")
5233 }
5234 }
5235
5236 public var messages: [Message?]? {
5237 get {
5238 return (snapshot["messages"] as? [Snapshot?]).flatMap { $0.map { $0.flatMap { Message(snapshot: $0) } } }
5239 }
5240 set {
5241 snapshot.updateValue(newValue.flatMap { $0.map { $0.flatMap { $0.snapshot } } }, forKey: "messages")
5242 }
5243 }
5244
5245 public var nextToken: String? {
5246 get {
5247 return snapshot["nextToken"] as? String
5248 }
5249 set {
5250 snapshot.updateValue(newValue, forKey: "nextToken")
5251 }
5252 }
5253
5254 public struct Message: GraphQLSelectionSet {
5255 public static let possibleTypes = ["Message"]
5256
5257 public static let selections: [GraphQLSelection] = [
5258 GraphQLField("__typename", type: .nonNull(.scalar(String.self))),
5259 GraphQLField("content", type: .nonNull(.scalar(String.self))),
5260 GraphQLField("conversationId", type: .nonNull(.scalar(GraphQLID.self))),
5261 GraphQLField("createdAt", type: .scalar(String.self)),
5262 GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))),
5263 GraphQLField("isSent", type: .scalar(Bool.self)),
5264 GraphQLField("sender", type: .scalar(String.self)),
5265 ]
5266
5267 public var snapshot: Snapshot
5268
5269 public init(snapshot: Snapshot) {
5270 self.snapshot = snapshot
5271 }
5272
5273 public init(content: String, conversationId: GraphQLID, createdAt: String? = nil, id: GraphQLID, isSent: Bool? = nil, sender: String? = nil) {
5274 self.init(snapshot: ["__typename": "Message", "content": content, "conversationId": conversationId, "createdAt": createdAt, "id": id, "isSent": isSent, "sender": sender])
5275 }
5276
5277 public var __typename: String {
5278 get {
5279 return snapshot["__typename"]! as! String
5280 }
5281 set {
5282 snapshot.updateValue(newValue, forKey: "__typename")
5283 }
5284 }
5285
5286 /// The message content.
5287 public var content: String {
5288 get {
5289 return snapshot["content"]! as! String
5290 }
5291 set {
5292 snapshot.updateValue(newValue, forKey: "content")
5293 }
5294 }
5295
5296 /// The id of the Conversation this message belongs to. This is the table primary key.
5297 public var conversationId: GraphQLID {
5298 get {
5299 return snapshot["conversationId"]! as! GraphQLID
5300 }
5301 set {
5302 snapshot.updateValue(newValue, forKey: "conversationId")
5303 }
5304 }
5305
5306 /// The message timestamp. This is also the table sort key.
5307 public var createdAt: String? {
5308 get {
5309 return snapshot["createdAt"] as? String
5310 }
5311 set {
5312 snapshot.updateValue(newValue, forKey: "createdAt")
5313 }
5314 }
5315
5316 /// Generated id for a message -- read-only
5317 public var id: GraphQLID {
5318 get {
5319 return snapshot["id"]! as! GraphQLID
5320 }
5321 set {
5322 snapshot.updateValue(newValue, forKey: "id")
5323 }
5324 }
5325
5326 /// Flag denoting if this message has been accepted by the server or not.
5327 public var isSent: Bool? {
5328 get {
5329 return snapshot["isSent"] as? Bool
5330 }
5331 set {
5332 snapshot.updateValue(newValue, forKey: "isSent")
5333 }
5334 }
5335
5336 public var sender: String? {
5337 get {
5338 return snapshot["sender"] as? String
5339 }
5340 set {
5341 snapshot.updateValue(newValue, forKey: "sender")
5342 }
5343 }
5344 }
5345 }
5346 }
5347 }
5348}