forked from go-fed/activity
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgen_note.go
2142 lines (1699 loc) · 58.9 KB
/
gen_note.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
//
package streams
import (
"github.com/go-fed/activity/vocab"
"net/url"
"time"
)
// Represents a short written work typically less than a single paragraph in length. This is a convenience wrapper of a type with the same name in the vocab package. Accessing it with the Raw function allows direct manipulaton of the object, and does not provide the same integrity guarantees as this package.
type Note struct {
// The raw type from the vocab package
raw *vocab.Note
}
// Raw returns the vocab type for manaual manipulation. Note that manipulating the underlying type to be in an inconsistent state may cause this convenience type's methods to later fail.
func (t *Note) Raw() (n *vocab.Note) {
return t.raw
}
// Serialize turns this object into a map[string]interface{}.
func (t *Note) Serialize() (m map[string]interface{}, err error) {
return t.raw.Serialize()
}
// IsPublic returns true if the 'to', 'bto', 'cc', or 'bcc' properties address the special Public ActivityPub collection
func (t *Note) IsPublic() (b bool) {
return t.raw.IsPublic()
}
// GetAltitude attempts to get this 'altitude' property as a float64. It returns a Resolution appropriate for clients to determine whether it would be necessary to do raw handling.
func (t *Note) GetAltitude() (r Resolution, k float64) {
r = Unresolved
handled := false
if t.raw.IsAltitude() {
k = t.raw.GetAltitude()
if handled {
r = Resolved
}
} else if t.raw.IsAltitudeIRI() {
r = RawResolutionNeeded
}
return
}
// HasAltitude returns a Presence appropriate for clients to determine whether it would be necessary to do raw handling, if desired.
func (t *Note) HasAltitude() (p Presence) {
p = NoPresence
if t.raw.IsAltitude() {
p = ConvenientPresence
} else if t.raw.IsAltitudeIRI() {
p = RawPresence
}
return
}
// SetAltitude sets the value for property 'altitude'.
func (t *Note) SetAltitude(k float64) {
t.raw.SetAltitude(k)
}
// LenAttachment returns the number of values this property contains. Each index be used with HasAttachment to determine if ResolveAttachment is safe to call or if raw handling would be needed.
func (t *Note) LenAttachment() (idx int) {
return t.raw.AttachmentLen()
}
// ResolveAttachment passes the actual concrete type to the resolver for handing property attachment. It returns a Resolution appropriate for clients to determine whether it would be necessary to do raw handling, if desired.
func (t *Note) ResolveAttachment(r *Resolver, idx int) (s Resolution, err error) {
s = Unresolved
handled := false
if t.raw.IsAttachmentObject(idx) {
handled, err = r.dispatch(t.raw.GetAttachmentObject(idx))
if handled {
s = Resolved
}
} else if t.raw.IsAttachmentLink(idx) {
handled, err = r.dispatch(t.raw.GetAttachmentLink(idx))
if handled {
s = Resolved
}
} else if t.raw.IsAttachmentIRI(idx) {
s = RawResolutionNeeded
}
return
}
// HasAttachment returns a Presence appropriate for clients to determine whether it would be necessary to do raw handling, if desired.
func (t *Note) HasAttachment(idx int) (p Presence) {
p = NoPresence
if t.raw.IsAttachmentObject(idx) {
p = ConvenientPresence
} else if t.raw.IsAttachmentLink(idx) {
p = ConvenientPresence
} else if t.raw.IsAttachmentIRI(idx) {
p = RawPresence
}
return
}
// AppendAttachment appends an 'Object' typed value.
func (t *Note) AppendAttachment(i vocab.ObjectType) {
t.raw.AppendAttachmentObject(i)
}
// PrependAttachment prepends an 'Object' typed value.
func (t *Note) PrependAttachment(i vocab.ObjectType) {
t.raw.PrependAttachmentObject(i)
}
// AppendAttachmentLink appends a 'Link' typed value.
func (t *Note) AppendAttachmentLink(i vocab.LinkType) {
t.raw.AppendAttachmentLink(i)
}
// PrependAttachmentLink prepends a 'Link' typed value.
func (t *Note) PrependAttachmentLink(i vocab.LinkType) {
t.raw.PrependAttachmentLink(i)
}
// LenAttributedTo returns the number of values this property contains. Each index be used with HasAttributedTo to determine if GetAttributedTo is safe to call or if raw handling would be needed.
func (t *Note) LenAttributedTo() (idx int) {
return t.raw.AttributedToLen()
}
// GetAttributedTo attempts to get this 'attributedTo' property as a *url.URL. It returns a Resolution appropriate for clients to determine whether it would be necessary to do raw handling.
func (t *Note) GetAttributedTo(idx int) (r Resolution, k *url.URL) {
r = Unresolved
handled := false
if t.raw.IsAttributedToIRI(idx) {
k = t.raw.GetAttributedToIRI(idx)
if handled {
r = Resolved
}
} else if t.raw.IsAttributedToObject(idx) {
r = RawResolutionNeeded
} else if t.raw.IsAttributedToLink(idx) {
r = RawResolutionNeeded
}
return
}
// AppendAttributedTo appends the value for property 'attributedTo'.
func (t *Note) AppendAttributedTo(k *url.URL) {
t.raw.AppendAttributedToIRI(k)
}
// PrependAttributedTo prepends the value for property 'attributedTo'.
func (t *Note) PrependAttributedTo(k *url.URL) {
t.raw.PrependAttributedToIRI(k)
}
// RemoveAttributedTo deletes the value from the specified index for property 'attributedTo'.
func (t *Note) RemoveAttributedTo(idx int) {
t.raw.RemoveAttributedToIRI(idx)
}
// HasAttributedTo returns a Presence appropriate for clients to determine whether it would be necessary to do raw handling, if desired.
func (t *Note) HasAttributedTo(idx int) (p Presence) {
p = NoPresence
if t.raw.IsAttributedToIRI(idx) {
p = ConvenientPresence
} else if t.raw.IsAttributedToLink(idx) {
p = RawPresence
} else if t.raw.IsAttributedToIRI(idx) {
p = RawPresence
}
return
}
// LenAudience returns the number of values this property contains. Each index be used with HasAudience to determine if GetAudience is safe to call or if raw handling would be needed.
func (t *Note) LenAudience() (idx int) {
return t.raw.AudienceLen()
}
// GetAudience attempts to get this 'audience' property as a *url.URL. It returns a Resolution appropriate for clients to determine whether it would be necessary to do raw handling.
func (t *Note) GetAudience(idx int) (r Resolution, k *url.URL) {
r = Unresolved
handled := false
if t.raw.IsAudienceIRI(idx) {
k = t.raw.GetAudienceIRI(idx)
if handled {
r = Resolved
}
} else if t.raw.IsAudienceObject(idx) {
r = RawResolutionNeeded
} else if t.raw.IsAudienceLink(idx) {
r = RawResolutionNeeded
}
return
}
// AppendAudience appends the value for property 'audience'.
func (t *Note) AppendAudience(k *url.URL) {
t.raw.AppendAudienceIRI(k)
}
// PrependAudience prepends the value for property 'audience'.
func (t *Note) PrependAudience(k *url.URL) {
t.raw.PrependAudienceIRI(k)
}
// RemoveAudience deletes the value from the specified index for property 'audience'.
func (t *Note) RemoveAudience(idx int) {
t.raw.RemoveAudienceIRI(idx)
}
// HasAudience returns a Presence appropriate for clients to determine whether it would be necessary to do raw handling, if desired.
func (t *Note) HasAudience(idx int) (p Presence) {
p = NoPresence
if t.raw.IsAudienceIRI(idx) {
p = ConvenientPresence
} else if t.raw.IsAudienceLink(idx) {
p = RawPresence
} else if t.raw.IsAudienceIRI(idx) {
p = RawPresence
}
return
}
// LenContent returns the number of values this property contains. Each index be used with HasContent to determine if GetContent is safe to call or if raw handling would be needed.
func (t *Note) LenContent() (idx int) {
return t.raw.ContentLen()
}
// GetContent attempts to get this 'content' property as a string. It returns a Resolution appropriate for clients to determine whether it would be necessary to do raw handling.
func (t *Note) GetContent(idx int) (r Resolution, k string) {
r = Unresolved
handled := false
if t.raw.IsContentString(idx) {
k = t.raw.GetContentString(idx)
if handled {
r = Resolved
}
} else if t.raw.IsContentLangString(idx) {
r = RawResolutionNeeded
} else if t.raw.IsContentIRI(idx) {
r = RawResolutionNeeded
}
return
}
// AppendContent appends the value for property 'content'.
func (t *Note) AppendContent(k string) {
t.raw.AppendContentString(k)
}
// PrependContent prepends the value for property 'content'.
func (t *Note) PrependContent(k string) {
t.raw.PrependContentString(k)
}
// RemoveContent deletes the value from the specified index for property 'content'.
func (t *Note) RemoveContent(idx int) {
t.raw.RemoveContentString(idx)
}
// HasContent returns a Presence appropriate for clients to determine whether it would be necessary to do raw handling, if desired.
func (t *Note) HasContent(idx int) (p Presence) {
p = NoPresence
if t.raw.IsContentString(idx) {
p = ConvenientPresence
} else if t.raw.IsContentLangString(idx) {
p = RawPresence
} else if t.raw.IsContentIRI(idx) {
p = RawPresence
}
return
}
// ContentLanguages returns all languages for this property's language mapping, or nil if there are none.
func (t *Note) ContentLanguages() (l []string) {
return t.raw.ContentMapLanguages()
}
// GetContentMap retrieves the value of 'content' for the specified language, or an empty string if it does not exist
func (t *Note) GetContentForLanguage(l string) (v string) {
return t.raw.GetContentMap(l)
}
// SetContentForLanguage sets the value of 'content' for the specified language
func (t *Note) SetContentForLanguage(l string, v string) {
t.raw.SetContentMap(l, v)
}
// LenContext returns the number of values this property contains. Each index be used with HasContext to determine if ResolveContext is safe to call or if raw handling would be needed.
func (t *Note) LenContext() (idx int) {
return t.raw.ContextLen()
}
// ResolveContext passes the actual concrete type to the resolver for handing property context. It returns a Resolution appropriate for clients to determine whether it would be necessary to do raw handling, if desired.
func (t *Note) ResolveContext(r *Resolver, idx int) (s Resolution, err error) {
s = Unresolved
handled := false
if t.raw.IsContextObject(idx) {
handled, err = r.dispatch(t.raw.GetContextObject(idx))
if handled {
s = Resolved
}
} else if t.raw.IsContextLink(idx) {
handled, err = r.dispatch(t.raw.GetContextLink(idx))
if handled {
s = Resolved
}
} else if t.raw.IsContextIRI(idx) {
s = RawResolutionNeeded
}
return
}
// HasContext returns a Presence appropriate for clients to determine whether it would be necessary to do raw handling, if desired.
func (t *Note) HasContext(idx int) (p Presence) {
p = NoPresence
if t.raw.IsContextObject(idx) {
p = ConvenientPresence
} else if t.raw.IsContextLink(idx) {
p = ConvenientPresence
} else if t.raw.IsContextIRI(idx) {
p = RawPresence
}
return
}
// AppendContext appends an 'Object' typed value.
func (t *Note) AppendContext(i vocab.ObjectType) {
t.raw.AppendContextObject(i)
}
// PrependContext prepends an 'Object' typed value.
func (t *Note) PrependContext(i vocab.ObjectType) {
t.raw.PrependContextObject(i)
}
// AppendContextLink appends a 'Link' typed value.
func (t *Note) AppendContextLink(i vocab.LinkType) {
t.raw.AppendContextLink(i)
}
// PrependContextLink prepends a 'Link' typed value.
func (t *Note) PrependContextLink(i vocab.LinkType) {
t.raw.PrependContextLink(i)
}
// LenName returns the number of values this property contains. Each index be used with HasName to determine if GetName is safe to call or if raw handling would be needed.
func (t *Note) LenName() (idx int) {
return t.raw.NameLen()
}
// GetName attempts to get this 'name' property as a string. It returns a Resolution appropriate for clients to determine whether it would be necessary to do raw handling.
func (t *Note) GetName(idx int) (r Resolution, k string) {
r = Unresolved
handled := false
if t.raw.IsNameString(idx) {
k = t.raw.GetNameString(idx)
if handled {
r = Resolved
}
} else if t.raw.IsNameLangString(idx) {
r = RawResolutionNeeded
} else if t.raw.IsNameIRI(idx) {
r = RawResolutionNeeded
}
return
}
// AppendName appends the value for property 'name'.
func (t *Note) AppendName(k string) {
t.raw.AppendNameString(k)
}
// PrependName prepends the value for property 'name'.
func (t *Note) PrependName(k string) {
t.raw.PrependNameString(k)
}
// RemoveName deletes the value from the specified index for property 'name'.
func (t *Note) RemoveName(idx int) {
t.raw.RemoveNameString(idx)
}
// HasName returns a Presence appropriate for clients to determine whether it would be necessary to do raw handling, if desired.
func (t *Note) HasName(idx int) (p Presence) {
p = NoPresence
if t.raw.IsNameString(idx) {
p = ConvenientPresence
} else if t.raw.IsNameLangString(idx) {
p = RawPresence
} else if t.raw.IsNameIRI(idx) {
p = RawPresence
}
return
}
// NameLanguages returns all languages for this property's language mapping, or nil if there are none.
func (t *Note) NameLanguages() (l []string) {
return t.raw.NameMapLanguages()
}
// GetNameMap retrieves the value of 'name' for the specified language, or an empty string if it does not exist
func (t *Note) GetNameForLanguage(l string) (v string) {
return t.raw.GetNameMap(l)
}
// SetNameForLanguage sets the value of 'name' for the specified language
func (t *Note) SetNameForLanguage(l string, v string) {
t.raw.SetNameMap(l, v)
}
// GetEndTime attempts to get this 'endTime' property as a time.Time. It returns a Resolution appropriate for clients to determine whether it would be necessary to do raw handling.
func (t *Note) GetEndTime() (r Resolution, k time.Time) {
r = Unresolved
handled := false
if t.raw.IsEndTime() {
k = t.raw.GetEndTime()
if handled {
r = Resolved
}
} else if t.raw.IsEndTimeIRI() {
r = RawResolutionNeeded
}
return
}
// HasEndTime returns a Presence appropriate for clients to determine whether it would be necessary to do raw handling, if desired.
func (t *Note) HasEndTime() (p Presence) {
p = NoPresence
if t.raw.IsEndTime() {
p = ConvenientPresence
} else if t.raw.IsEndTimeIRI() {
p = RawPresence
}
return
}
// SetEndTime sets the value for property 'endTime'.
func (t *Note) SetEndTime(k time.Time) {
t.raw.SetEndTime(k)
}
// LenGenerator returns the number of values this property contains. Each index be used with HasGenerator to determine if ResolveGenerator is safe to call or if raw handling would be needed.
func (t *Note) LenGenerator() (idx int) {
return t.raw.GeneratorLen()
}
// ResolveGenerator passes the actual concrete type to the resolver for handing property generator. It returns a Resolution appropriate for clients to determine whether it would be necessary to do raw handling, if desired.
func (t *Note) ResolveGenerator(r *Resolver, idx int) (s Resolution, err error) {
s = Unresolved
handled := false
if t.raw.IsGeneratorObject(idx) {
handled, err = r.dispatch(t.raw.GetGeneratorObject(idx))
if handled {
s = Resolved
}
} else if t.raw.IsGeneratorLink(idx) {
handled, err = r.dispatch(t.raw.GetGeneratorLink(idx))
if handled {
s = Resolved
}
} else if t.raw.IsGeneratorIRI(idx) {
s = RawResolutionNeeded
}
return
}
// HasGenerator returns a Presence appropriate for clients to determine whether it would be necessary to do raw handling, if desired.
func (t *Note) HasGenerator(idx int) (p Presence) {
p = NoPresence
if t.raw.IsGeneratorObject(idx) {
p = ConvenientPresence
} else if t.raw.IsGeneratorLink(idx) {
p = ConvenientPresence
} else if t.raw.IsGeneratorIRI(idx) {
p = RawPresence
}
return
}
// AppendGenerator appends an 'Object' typed value.
func (t *Note) AppendGenerator(i vocab.ObjectType) {
t.raw.AppendGeneratorObject(i)
}
// PrependGenerator prepends an 'Object' typed value.
func (t *Note) PrependGenerator(i vocab.ObjectType) {
t.raw.PrependGeneratorObject(i)
}
// AppendGeneratorLink appends a 'Link' typed value.
func (t *Note) AppendGeneratorLink(i vocab.LinkType) {
t.raw.AppendGeneratorLink(i)
}
// PrependGeneratorLink prepends a 'Link' typed value.
func (t *Note) PrependGeneratorLink(i vocab.LinkType) {
t.raw.PrependGeneratorLink(i)
}
// LenIcon returns the number of values this property contains. Each index be used with HasIcon to determine if ResolveIcon is safe to call or if raw handling would be needed.
func (t *Note) LenIcon() (idx int) {
return t.raw.IconLen()
}
// ResolveIcon passes the actual concrete type to the resolver for handing property icon. It returns a Resolution appropriate for clients to determine whether it would be necessary to do raw handling, if desired.
func (t *Note) ResolveIcon(r *Resolver, idx int) (s Resolution, err error) {
s = Unresolved
handled := false
if t.raw.IsIconImage(idx) {
handled, err = r.dispatch(t.raw.GetIconImage(idx))
if handled {
s = Resolved
}
} else if t.raw.IsIconLink(idx) {
s = RawResolutionNeeded
} else if t.raw.IsIconIRI(idx) {
s = RawResolutionNeeded
}
return
}
// AppendIcon appends the value for property 'icon'.
func (t *Note) AppendIcon(i vocab.ImageType) {
t.raw.AppendIconImage(i)
}
// PrependIcon prepends the value for property 'icon'.
func (t *Note) PrependIcon(i vocab.ImageType) {
t.raw.PrependIconImage(i)
}
// RemoveIcon deletes the value from the specified index for property 'icon'.
func (t *Note) RemoveIcon(idx int) {
t.raw.RemoveIconImage(idx)
}
// HasIcon returns a Presence appropriate for clients to determine whether it would be necessary to do raw handling, if desired.
func (t *Note) HasIcon(idx int) (p Presence) {
p = NoPresence
if t.raw.IsIconImage(idx) {
p = ConvenientPresence
} else if t.raw.IsIconLink(idx) {
p = RawPresence
} else if t.raw.IsIconIRI(idx) {
p = RawPresence
}
return
}
// GetId attempts to get this 'id' property as a *url.URL. It returns a Resolution appropriate for clients to determine whether it would be necessary to do raw handling.
func (t *Note) GetId() (r Resolution, k *url.URL) {
r = Unresolved
handled := false
if t.raw.HasId() {
k = t.raw.GetId()
if handled {
r = Resolved
}
}
return
}
// HasId returns a Presence appropriate for clients to determine whether it would be necessary to do raw handling, if desired.
func (t *Note) HasId() (p Presence) {
p = NoPresence
if t.raw.HasId() {
p = ConvenientPresence
}
return
}
// SetId sets the value for property 'id'.
func (t *Note) SetId(k *url.URL) {
t.raw.SetId(k)
}
// LenImage returns the number of values this property contains. Each index be used with HasImage to determine if ResolveImage is safe to call or if raw handling would be needed.
func (t *Note) LenImage() (idx int) {
return t.raw.ImageLen()
}
// ResolveImage passes the actual concrete type to the resolver for handing property image. It returns a Resolution appropriate for clients to determine whether it would be necessary to do raw handling, if desired.
func (t *Note) ResolveImage(r *Resolver, idx int) (s Resolution, err error) {
s = Unresolved
handled := false
if t.raw.IsImageImage(idx) {
handled, err = r.dispatch(t.raw.GetImageImage(idx))
if handled {
s = Resolved
}
} else if t.raw.IsImageLink(idx) {
s = RawResolutionNeeded
} else if t.raw.IsImageIRI(idx) {
s = RawResolutionNeeded
}
return
}
// AppendImage appends the value for property 'image'.
func (t *Note) AppendImage(i vocab.ImageType) {
t.raw.AppendImageImage(i)
}
// PrependImage prepends the value for property 'image'.
func (t *Note) PrependImage(i vocab.ImageType) {
t.raw.PrependImageImage(i)
}
// RemoveImage deletes the value from the specified index for property 'image'.
func (t *Note) RemoveImage(idx int) {
t.raw.RemoveImageImage(idx)
}
// HasImage returns a Presence appropriate for clients to determine whether it would be necessary to do raw handling, if desired.
func (t *Note) HasImage(idx int) (p Presence) {
p = NoPresence
if t.raw.IsImageImage(idx) {
p = ConvenientPresence
} else if t.raw.IsImageLink(idx) {
p = RawPresence
} else if t.raw.IsImageIRI(idx) {
p = RawPresence
}
return
}
// LenInReplyTo returns the number of values this property contains. Each index be used with HasInReplyTo to determine if GetInReplyTo is safe to call or if raw handling would be needed.
func (t *Note) LenInReplyTo() (idx int) {
return t.raw.InReplyToLen()
}
// GetInReplyTo attempts to get this 'inReplyTo' property as a *url.URL. It returns a Resolution appropriate for clients to determine whether it would be necessary to do raw handling.
func (t *Note) GetInReplyTo(idx int) (r Resolution, k *url.URL) {
r = Unresolved
handled := false
if t.raw.IsInReplyToIRI(idx) {
k = t.raw.GetInReplyToIRI(idx)
if handled {
r = Resolved
}
} else if t.raw.IsInReplyToObject(idx) {
r = RawResolutionNeeded
} else if t.raw.IsInReplyToLink(idx) {
r = RawResolutionNeeded
}
return
}
// AppendInReplyTo appends the value for property 'inReplyTo'.
func (t *Note) AppendInReplyTo(k *url.URL) {
t.raw.AppendInReplyToIRI(k)
}
// PrependInReplyTo prepends the value for property 'inReplyTo'.
func (t *Note) PrependInReplyTo(k *url.URL) {
t.raw.PrependInReplyToIRI(k)
}
// RemoveInReplyTo deletes the value from the specified index for property 'inReplyTo'.
func (t *Note) RemoveInReplyTo(idx int) {
t.raw.RemoveInReplyToIRI(idx)
}
// HasInReplyTo returns a Presence appropriate for clients to determine whether it would be necessary to do raw handling, if desired.
func (t *Note) HasInReplyTo(idx int) (p Presence) {
p = NoPresence
if t.raw.IsInReplyToIRI(idx) {
p = ConvenientPresence
} else if t.raw.IsInReplyToLink(idx) {
p = RawPresence
} else if t.raw.IsInReplyToIRI(idx) {
p = RawPresence
}
return
}
// LenLocation returns the number of values this property contains. Each index be used with HasLocation to determine if ResolveLocation is safe to call or if raw handling would be needed.
func (t *Note) LenLocation() (idx int) {
return t.raw.LocationLen()
}
// ResolveLocation passes the actual concrete type to the resolver for handing property location. It returns a Resolution appropriate for clients to determine whether it would be necessary to do raw handling, if desired.
func (t *Note) ResolveLocation(r *Resolver, idx int) (s Resolution, err error) {
s = Unresolved
handled := false
if t.raw.IsLocationObject(idx) {
handled, err = r.dispatch(t.raw.GetLocationObject(idx))
if handled {
s = Resolved
}
} else if t.raw.IsLocationLink(idx) {
handled, err = r.dispatch(t.raw.GetLocationLink(idx))
if handled {
s = Resolved
}
} else if t.raw.IsLocationIRI(idx) {
s = RawResolutionNeeded
}
return
}
// HasLocation returns a Presence appropriate for clients to determine whether it would be necessary to do raw handling, if desired.
func (t *Note) HasLocation(idx int) (p Presence) {
p = NoPresence
if t.raw.IsLocationObject(idx) {
p = ConvenientPresence
} else if t.raw.IsLocationLink(idx) {
p = ConvenientPresence
} else if t.raw.IsLocationIRI(idx) {
p = RawPresence
}
return
}
// AppendLocation appends an 'Object' typed value.
func (t *Note) AppendLocation(i vocab.ObjectType) {
t.raw.AppendLocationObject(i)
}
// PrependLocation prepends an 'Object' typed value.
func (t *Note) PrependLocation(i vocab.ObjectType) {
t.raw.PrependLocationObject(i)
}
// AppendLocationLink appends a 'Link' typed value.
func (t *Note) AppendLocationLink(i vocab.LinkType) {
t.raw.AppendLocationLink(i)
}
// PrependLocationLink prepends a 'Link' typed value.
func (t *Note) PrependLocationLink(i vocab.LinkType) {
t.raw.PrependLocationLink(i)
}
// LenPreview returns the number of values this property contains. Each index be used with HasPreview to determine if ResolvePreview is safe to call or if raw handling would be needed.
func (t *Note) LenPreview() (idx int) {
return t.raw.PreviewLen()
}
// ResolvePreview passes the actual concrete type to the resolver for handing property preview. It returns a Resolution appropriate for clients to determine whether it would be necessary to do raw handling, if desired.
func (t *Note) ResolvePreview(r *Resolver, idx int) (s Resolution, err error) {
s = Unresolved
handled := false
if t.raw.IsPreviewObject(idx) {
handled, err = r.dispatch(t.raw.GetPreviewObject(idx))
if handled {
s = Resolved
}
} else if t.raw.IsPreviewLink(idx) {
handled, err = r.dispatch(t.raw.GetPreviewLink(idx))
if handled {
s = Resolved
}
} else if t.raw.IsPreviewIRI(idx) {
s = RawResolutionNeeded
}
return
}
// HasPreview returns a Presence appropriate for clients to determine whether it would be necessary to do raw handling, if desired.
func (t *Note) HasPreview(idx int) (p Presence) {
p = NoPresence
if t.raw.IsPreviewObject(idx) {
p = ConvenientPresence
} else if t.raw.IsPreviewLink(idx) {
p = ConvenientPresence
} else if t.raw.IsPreviewIRI(idx) {
p = RawPresence
}
return
}
// AppendPreview appends an 'Object' typed value.
func (t *Note) AppendPreview(i vocab.ObjectType) {
t.raw.AppendPreviewObject(i)
}
// PrependPreview prepends an 'Object' typed value.
func (t *Note) PrependPreview(i vocab.ObjectType) {
t.raw.PrependPreviewObject(i)
}
// AppendPreviewLink appends a 'Link' typed value.
func (t *Note) AppendPreviewLink(i vocab.LinkType) {
t.raw.AppendPreviewLink(i)
}
// PrependPreviewLink prepends a 'Link' typed value.
func (t *Note) PrependPreviewLink(i vocab.LinkType) {
t.raw.PrependPreviewLink(i)
}
// GetPublished attempts to get this 'published' property as a time.Time. It returns a Resolution appropriate for clients to determine whether it would be necessary to do raw handling.
func (t *Note) GetPublished() (r Resolution, k time.Time) {
r = Unresolved
handled := false
if t.raw.IsPublished() {
k = t.raw.GetPublished()
if handled {
r = Resolved
}
} else if t.raw.IsPublishedIRI() {
r = RawResolutionNeeded
}
return
}
// HasPublished returns a Presence appropriate for clients to determine whether it would be necessary to do raw handling, if desired.
func (t *Note) HasPublished() (p Presence) {
p = NoPresence
if t.raw.IsPublished() {
p = ConvenientPresence
} else if t.raw.IsPublishedIRI() {
p = RawPresence
}
return
}
// SetPublished sets the value for property 'published'.
func (t *Note) SetPublished(k time.Time) {
t.raw.SetPublished(k)
}
// ResolveReplies passes the actual concrete type to the resolver for handing property replies. It returns a Resolution appropriate for clients to determine whether it would be necessary to do raw handling, if desired.
func (t *Note) ResolveReplies(r *Resolver) (s Resolution, err error) {
s = Unresolved
handled := false
if t.raw.IsReplies() {
handled, err = r.dispatch(t.raw.GetReplies())
if handled {
s = Resolved
}
} else if t.raw.IsRepliesIRI() {
s = RawResolutionNeeded
}
return
}
// HasReplies returns a Presence appropriate for clients to determine whether it would be necessary to do raw handling, if desired.
func (t *Note) HasReplies() (p Presence) {
p = NoPresence
if t.raw.IsReplies() {
p = ConvenientPresence
} else if t.raw.IsRepliesIRI() {
p = RawPresence
}
return
}
// SetReplies sets this value to be a 'Collection' type.
func (t *Note) SetReplies(i vocab.CollectionType) {
t.raw.SetReplies(i)
}
// GetStartTime attempts to get this 'startTime' property as a time.Time. It returns a Resolution appropriate for clients to determine whether it would be necessary to do raw handling.
func (t *Note) GetStartTime() (r Resolution, k time.Time) {
r = Unresolved
handled := false
if t.raw.IsStartTime() {
k = t.raw.GetStartTime()
if handled {
r = Resolved
}
} else if t.raw.IsStartTimeIRI() {
r = RawResolutionNeeded
}
return
}
// HasStartTime returns a Presence appropriate for clients to determine whether it would be necessary to do raw handling, if desired.
func (t *Note) HasStartTime() (p Presence) {
p = NoPresence
if t.raw.IsStartTime() {
p = ConvenientPresence
} else if t.raw.IsStartTimeIRI() {
p = RawPresence
}
return
}
// SetStartTime sets the value for property 'startTime'.
func (t *Note) SetStartTime(k time.Time) {
t.raw.SetStartTime(k)
}
// LenSummary returns the number of values this property contains. Each index be used with HasSummary to determine if GetSummary is safe to call or if raw handling would be needed.
func (t *Note) LenSummary() (idx int) {
return t.raw.SummaryLen()
}
// GetSummary attempts to get this 'summary' property as a string. It returns a Resolution appropriate for clients to determine whether it would be necessary to do raw handling.
func (t *Note) GetSummary(idx int) (r Resolution, k string) {
r = Unresolved
handled := false
if t.raw.IsSummaryString(idx) {
k = t.raw.GetSummaryString(idx)
if handled {
r = Resolved