001// Generated by delombok at Thu Aug 13 13:56:44 UTC 2026
002/*
003 * Copyright (c) 2010-2026 Mark Allen, Norbert Bartels.
004 *
005 * Permission is hereby granted, free of charge, to any person obtaining a copy
006 * of this software and associated documentation files (the "Software"), to deal
007 * in the Software without restriction, including without limitation the rights
008 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
009 * copies of the Software, and to permit persons to whom the Software is
010 * furnished to do so, subject to the following conditions:
011 *
012 * The above copyright notice and this permission notice shall be included in
013 * all copies or substantial portions of the Software.
014 *
015 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
016 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
017 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
018 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
019 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
020 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
021 * THE SOFTWARE.
022 */
023package com.restfb.types;
024
025import static com.restfb.util.DateUtils.toDateFromLongFormat;
026import static com.restfb.util.DateUtils.toDateFromShortFormat;
027import static java.util.Collections.unmodifiableList;
028import java.util.ArrayList;
029import java.util.Date;
030import java.util.List;
031import com.restfb.Facebook;
032import com.restfb.JsonMapper;
033import com.restfb.JsonMapper.JsonMappingCompleted;
034import com.restfb.annotation.GraphAPI;
035import com.restfb.types.features.HasCover;
036import com.restfb.types.features.HasProfilePicture;
037
038/**
039 * Represents the <a href="http://developers.facebook.com/docs/reference/api/event">Event Graph API type</a>.
040 *
041 * @author <a href="http://restfb.com">Mark Allen</a>
042 * @since 1.5
043 */
044public class Event extends NamedFacebookType implements HasProfilePicture, HasCover {
045  /**
046   * The user who owns the event.
047   */
048  @Facebook
049  private Owner owner;
050  /**
051   * The category of the event.
052   */
053  @Facebook
054  @GraphAPI(since = "2.4")
055  private String category;
056  /**
057   * Can guests invite friends.
058   */
059  @Facebook("can_guests_invite")
060  private Boolean canGuestsInvite;
061  /**
062   * Can see guest list.
063   */
064  @Facebook("guest_list_enabled")
065  private Boolean guestListEnabled;
066  /**
067   * The long-form HTML description of the event.
068   */
069  @Facebook
070  private String description;
071  @Facebook("start_time")
072  private transient String rawStartTime;
073  @Facebook("end_time")
074  private transient String rawEndTime;
075  /**
076   * The start time of the event.
077   */
078  private Date startTime;
079  /**
080   * The end time of the event.
081   */
082  private Date endTime;
083  /**
084   * Whether the event has been marked as canceled
085   */
086  @Facebook("is_canceled")
087  private Boolean isCanceled;
088  /**
089   * The RSVP status of this event.
090   */
091  @Facebook("rsvp_status")
092  private String rsvpStatus;
093  /**
094   * Number of people interested in the event.
095   */
096  @Facebook("interested_count")
097  @GraphAPI(since = "2.1")
098  private Long interestedCount;
099  /**
100   * Whether the event is created by page or not.
101   */
102  @Facebook("is_page_owned")
103  private Boolean isPageOwned;
104  /**
105   * The visibility of this event. Can be 'OPEN', 'CLOSED', or 'SECRET'.
106   */
107  @Facebook
108  private String privacy;
109  /**
110   * The last time the event was updated.
111   */
112  @Facebook("updated_time")
113  private Date updatedTime;
114  /**
115   * The URL to a location to buy tickets for this event (on Events for Pages only).
116   *
117   * @since 1.6.13
118   */
119  @Facebook("ticket_uri")
120  private String ticketUri;
121  /**
122   * The event's picture.
123   *
124   * @since 1.6.13
125   */
126  private ProfilePictureSource picture;
127  @Facebook("picture")
128  private transient String rawPicture;
129  /**
130   * The group the event belongs to, if any.
131   */
132  @Facebook("parent_group")
133  private Group parentGroup;
134  /**
135   * Location associated with the event, if any.
136   */
137  @Facebook
138  @GraphAPI(since = "2.3")
139  private Place place;
140  /**
141   * Should the time information be ignored in the dates for this event?
142   *
143   * @since 1.6.13
144   */
145  @Facebook("is_date_only")
146  private Boolean isDateOnly;
147  /**
148   * the timezone of the event
149   */
150  @Facebook
151  private String timezone;
152  /**
153   * Cover picture
154   */
155  @Facebook
156  private CoverPhoto cover;
157  /**
158   * Number of people attending the event
159   */
160  @Facebook("attending_count")
161  @GraphAPI(since = "2.1")
162  private Integer attendingCount;
163  /**
164   * Number of people who declined the event
165   */
166  @Facebook("declined_count")
167  @GraphAPI(since = "2.1")
168  private Integer declinedCount;
169  /**
170   * Number of people who maybe going to the event
171   */
172  @Facebook("maybe_count")
173  @GraphAPI(since = "2.1")
174  private Integer maybeCount;
175  /**
176   * Number of people who did not reply to the event
177   */
178  @Facebook("noreply_count")
179  @GraphAPI(since = "2.1")
180  private Integer noreplyCount;
181  private static final long serialVersionUID = 2L;
182
183
184  /**
185   * Represents the <a href="http://developers.facebook.com/docs/reference/api/event">Event Owner Graph API type</a>.
186   *
187   * @author <a href="http://restfb.com">Mark Allen</a>
188   * @since 1.6.13
189   */
190  public static class Owner extends AbstractFacebookType {
191    /**
192     * The unique identifier for this owner.
193     */
194    @Facebook
195    private String id;
196    /**
197     * The name of this owner.
198     */
199    @Facebook
200    private String name;
201    /**
202     * The category for this owner.
203     */
204    @Facebook
205    private String category;
206    @Facebook("category_list")
207    private List<Category> categoryList = new ArrayList<>();
208    private static final long serialVersionUID = 1L;
209
210    public boolean addCategory(Category category) {
211      return categoryList.add(category);
212    }
213
214    public boolean removeCategory(Category category) {
215      return categoryList.remove(category);
216    }
217
218    /**
219     * List of other categories for this owner.
220     *
221     * @return List of other categories for this owner.
222     */
223    public List<Category> getCategoryList() {
224      return unmodifiableList(categoryList);
225    }
226
227    /**
228     * The unique identifier for this owner.
229     *
230     * @return The unique identifier for this owner.
231     */
232    @java.lang.SuppressWarnings("all")
233    @lombok.Generated
234    public String getId() {
235      return this.id;
236    }
237
238    /**
239     * The unique identifier for this owner.
240     */
241    @java.lang.SuppressWarnings("all")
242    @lombok.Generated
243    public void setId(final String id) {
244      this.id = id;
245    }
246
247    /**
248     * The name of this owner.
249     *
250     * @return The name of this owner.
251     */
252    @java.lang.SuppressWarnings("all")
253    @lombok.Generated
254    public String getName() {
255      return this.name;
256    }
257
258    /**
259     * The name of this owner.
260     */
261    @java.lang.SuppressWarnings("all")
262    @lombok.Generated
263    public void setName(final String name) {
264      this.name = name;
265    }
266
267    /**
268     * The category for this owner.
269     *
270     * @return The category for this owner.
271     */
272    @java.lang.SuppressWarnings("all")
273    @lombok.Generated
274    public String getCategory() {
275      return this.category;
276    }
277
278    /**
279     * The category for this owner.
280     */
281    @java.lang.SuppressWarnings("all")
282    @lombok.Generated
283    public void setCategory(final String category) {
284      this.category = category;
285    }
286  }
287
288
289  /**
290   * Represents the <a href="http://developers.facebook.com/docs/reference/api/event">Event Owner Category Graph API
291   * type</a>.
292   *
293   * @author <a href="http://restfb.com">Mark Allen</a>
294   * @since 1.6.13
295   */
296  public static class Category extends AbstractFacebookType {
297    /**
298     * The unique identifier for this category.
299     */
300    @Facebook
301    private String id;
302    /**
303     * The name of this category.
304     */
305    @Facebook
306    private String name;
307    private static final long serialVersionUID = 1L;
308
309    /**
310     * The unique identifier for this category.
311     *
312     * @return The unique identifier for this category.
313     */
314    @java.lang.SuppressWarnings("all")
315    @lombok.Generated
316    public String getId() {
317      return this.id;
318    }
319
320    /**
321     * The unique identifier for this category.
322     */
323    @java.lang.SuppressWarnings("all")
324    @lombok.Generated
325    public void setId(final String id) {
326      this.id = id;
327    }
328
329    /**
330     * The name of this category.
331     *
332     * @return The name of this category.
333     */
334    @java.lang.SuppressWarnings("all")
335    @lombok.Generated
336    public String getName() {
337      return this.name;
338    }
339
340    /**
341     * The name of this category.
342     */
343    @java.lang.SuppressWarnings("all")
344    @lombok.Generated
345    public void setName(final String name) {
346      this.name = name;
347    }
348  }
349
350  @JsonMappingCompleted
351  void convertTime() {
352    // Sometimes the date comes back in short form - if long form parsing
353    // failed, try short instead
354    Date dateEnd = toDateFromLongFormat(rawEndTime);
355    endTime = dateEnd == null ? toDateFromShortFormat(rawEndTime) : dateEnd;
356    Date dateStart = toDateFromLongFormat(rawStartTime);
357    startTime = dateStart == null ? toDateFromShortFormat(rawStartTime) : dateStart;
358  }
359
360  @JsonMappingCompleted
361  protected void fillProfilePicture(JsonMapper jsonMapper) {
362    picture = convertPicture(jsonMapper, rawPicture);
363  }
364
365  /**
366   * The user who owns the event.
367   *
368   * @return The user who owns the event.
369   */
370  @java.lang.SuppressWarnings("all")
371  @lombok.Generated
372  public Owner getOwner() {
373    return this.owner;
374  }
375
376  /**
377   * The user who owns the event.
378   */
379  @java.lang.SuppressWarnings("all")
380  @lombok.Generated
381  public void setOwner(final Owner owner) {
382    this.owner = owner;
383  }
384
385  /**
386   * The category of the event.
387   *
388   * @return The category of the event
389   */
390  @GraphAPI(since = "2.4")
391  @java.lang.SuppressWarnings("all")
392  @lombok.Generated
393  public String getCategory() {
394    return this.category;
395  }
396
397  /**
398   * The category of the event.
399   */
400  @java.lang.SuppressWarnings("all")
401  @lombok.Generated
402  public void setCategory(final String category) {
403    this.category = category;
404  }
405
406  /**
407   * Can guests invite friends.
408   *
409   * @return Can guests invite friends
410   */
411  @java.lang.SuppressWarnings("all")
412  @lombok.Generated
413  public Boolean getCanGuestsInvite() {
414    return this.canGuestsInvite;
415  }
416
417  /**
418   * Can guests invite friends.
419   */
420  @java.lang.SuppressWarnings("all")
421  @lombok.Generated
422  public void setCanGuestsInvite(final Boolean canGuestsInvite) {
423    this.canGuestsInvite = canGuestsInvite;
424  }
425
426  /**
427   * Can see guest list.
428   *
429   * @return Can see guest list
430   */
431  @java.lang.SuppressWarnings("all")
432  @lombok.Generated
433  public Boolean getGuestListEnabled() {
434    return this.guestListEnabled;
435  }
436
437  /**
438   * Can see guest list.
439   */
440  @java.lang.SuppressWarnings("all")
441  @lombok.Generated
442  public void setGuestListEnabled(final Boolean guestListEnabled) {
443    this.guestListEnabled = guestListEnabled;
444  }
445
446  /**
447   * The long-form HTML description of the event.
448   *
449   * @return The long-form HTML description of the event.
450   */
451  @java.lang.SuppressWarnings("all")
452  @lombok.Generated
453  public String getDescription() {
454    return this.description;
455  }
456
457  /**
458   * The long-form HTML description of the event.
459   */
460  @java.lang.SuppressWarnings("all")
461  @lombok.Generated
462  public void setDescription(final String description) {
463    this.description = description;
464  }
465
466  /**
467   * The start time of the event.
468   *
469   * @return The start time of the event.
470   */
471  @java.lang.SuppressWarnings("all")
472  @lombok.Generated
473  public Date getStartTime() {
474    return this.startTime;
475  }
476
477  /**
478   * The start time of the event.
479   */
480  @java.lang.SuppressWarnings("all")
481  @lombok.Generated
482  public void setStartTime(final Date startTime) {
483    this.startTime = startTime;
484  }
485
486  /**
487   * The end time of the event.
488   *
489   * @return The end time of the event.
490   */
491  @java.lang.SuppressWarnings("all")
492  @lombok.Generated
493  public Date getEndTime() {
494    return this.endTime;
495  }
496
497  /**
498   * The end time of the event.
499   */
500  @java.lang.SuppressWarnings("all")
501  @lombok.Generated
502  public void setEndTime(final Date endTime) {
503    this.endTime = endTime;
504  }
505
506  /**
507   * Whether the event has been marked as canceled
508   *
509   * @return Whether the event has been marked as canceled
510   */
511  @java.lang.SuppressWarnings("all")
512  @lombok.Generated
513  public Boolean getIsCanceled() {
514    return this.isCanceled;
515  }
516
517  /**
518   * Whether the event has been marked as canceled
519   */
520  @java.lang.SuppressWarnings("all")
521  @lombok.Generated
522  public void setIsCanceled(final Boolean isCanceled) {
523    this.isCanceled = isCanceled;
524  }
525
526  /**
527   * The RSVP status of this event.
528   *
529   * @return The RSVP status of this event.
530   */
531  @java.lang.SuppressWarnings("all")
532  @lombok.Generated
533  public String getRsvpStatus() {
534    return this.rsvpStatus;
535  }
536
537  /**
538   * The RSVP status of this event.
539   */
540  @java.lang.SuppressWarnings("all")
541  @lombok.Generated
542  public void setRsvpStatus(final String rsvpStatus) {
543    this.rsvpStatus = rsvpStatus;
544  }
545
546  /**
547   * Number of people interested in the event.
548   *
549   * @return Number of people interested in the event
550   */
551  @GraphAPI(since = "2.1")
552  @java.lang.SuppressWarnings("all")
553  @lombok.Generated
554  public Long getInterestedCount() {
555    return this.interestedCount;
556  }
557
558  /**
559   * Number of people interested in the event.
560   */
561  @java.lang.SuppressWarnings("all")
562  @lombok.Generated
563  public void setInterestedCount(final Long interestedCount) {
564    this.interestedCount = interestedCount;
565  }
566
567  /**
568   * Whether the event is created by page or not.
569   *
570   * @return Whether the event is created by page or not
571   */
572  @java.lang.SuppressWarnings("all")
573  @lombok.Generated
574  public Boolean getIsPageOwned() {
575    return this.isPageOwned;
576  }
577
578  /**
579   * Whether the event is created by page or not.
580   */
581  @java.lang.SuppressWarnings("all")
582  @lombok.Generated
583  public void setIsPageOwned(final Boolean isPageOwned) {
584    this.isPageOwned = isPageOwned;
585  }
586
587  /**
588   * The visibility of this event. Can be 'OPEN', 'CLOSED', or 'SECRET'.
589   *
590   * @return The visibility of this event. Can be 'OPEN', 'CLOSED', or 'SECRET'.
591   */
592  @java.lang.SuppressWarnings("all")
593  @lombok.Generated
594  public String getPrivacy() {
595    return this.privacy;
596  }
597
598  /**
599   * The visibility of this event. Can be 'OPEN', 'CLOSED', or 'SECRET'.
600   */
601  @java.lang.SuppressWarnings("all")
602  @lombok.Generated
603  public void setPrivacy(final String privacy) {
604    this.privacy = privacy;
605  }
606
607  /**
608   * The last time the event was updated.
609   *
610   * @return The last time the event was updated.
611   */
612  @java.lang.SuppressWarnings("all")
613  @lombok.Generated
614  public Date getUpdatedTime() {
615    return this.updatedTime;
616  }
617
618  /**
619   * The last time the event was updated.
620   */
621  @java.lang.SuppressWarnings("all")
622  @lombok.Generated
623  public void setUpdatedTime(final Date updatedTime) {
624    this.updatedTime = updatedTime;
625  }
626
627  /**
628   * The URL to a location to buy tickets for this event (on Events for Pages only).
629   *
630   * @return The URL to a location to buy tickets for this event (on Events for Pages only).
631   * @since 1.6.13
632   */
633  @java.lang.SuppressWarnings("all")
634  @lombok.Generated
635  public String getTicketUri() {
636    return this.ticketUri;
637  }
638
639  /**
640   * The URL to a location to buy tickets for this event (on Events for Pages only).
641   *
642   * @since 1.6.13
643   */
644  @java.lang.SuppressWarnings("all")
645  @lombok.Generated
646  public void setTicketUri(final String ticketUri) {
647    this.ticketUri = ticketUri;
648  }
649
650  /**
651   * The event's picture.
652   *
653   * @return The event's picture (only returned if you explicitly include picture in the fields param; example:
654   *         ?fields=id,name,picture)
655   * @since 1.6.13
656   */
657  @Override
658  @java.lang.SuppressWarnings("all")
659  @lombok.Generated
660  public ProfilePictureSource getPicture() {
661    return this.picture;
662  }
663
664  /**
665   * The event's picture.
666   *
667   * @since 1.6.13
668   */
669  @java.lang.SuppressWarnings("all")
670  @lombok.Generated
671  public void setPicture(final ProfilePictureSource picture) {
672    this.picture = picture;
673  }
674
675  /**
676   * The group the event belongs to, if any.
677   *
678   * @return The group the event belongs to, if any.
679   */
680  @java.lang.SuppressWarnings("all")
681  @lombok.Generated
682  public Group getParentGroup() {
683    return this.parentGroup;
684  }
685
686  /**
687   * The group the event belongs to, if any.
688   */
689  @java.lang.SuppressWarnings("all")
690  @lombok.Generated
691  public void setParentGroup(final Group parentGroup) {
692    this.parentGroup = parentGroup;
693  }
694
695  /**
696   * Location associated with the event, if any.
697   *
698   * @return Location associated with the event, if any
699   */
700  @GraphAPI(since = "2.3")
701  @java.lang.SuppressWarnings("all")
702  @lombok.Generated
703  public Place getPlace() {
704    return this.place;
705  }
706
707  /**
708   * Location associated with the event, if any.
709   */
710  @java.lang.SuppressWarnings("all")
711  @lombok.Generated
712  public void setPlace(final Place place) {
713    this.place = place;
714  }
715
716  /**
717   * Should the time information be ignored in the dates for this event?
718   *
719   * @return <tt>true</tt> if the time information be ignored in the dates for this event, <tt>false</tt> otherwise.
720   * @since 1.6.13
721   */
722  @java.lang.SuppressWarnings("all")
723  @lombok.Generated
724  public Boolean getIsDateOnly() {
725    return this.isDateOnly;
726  }
727
728  /**
729   * Should the time information be ignored in the dates for this event?
730   *
731   * @since 1.6.13
732   */
733  @java.lang.SuppressWarnings("all")
734  @lombok.Generated
735  public void setIsDateOnly(final Boolean isDateOnly) {
736    this.isDateOnly = isDateOnly;
737  }
738
739  /**
740   * the timezone of the event
741   */
742  @java.lang.SuppressWarnings("all")
743  @lombok.Generated
744  public String getTimezone() {
745    return this.timezone;
746  }
747
748  /**
749   * the timezone of the event
750   */
751  @java.lang.SuppressWarnings("all")
752  @lombok.Generated
753  public void setTimezone(final String timezone) {
754    this.timezone = timezone;
755  }
756
757  /**
758   * Cover picture
759   *
760   * @return Cover picture
761   */
762  @Override
763  @java.lang.SuppressWarnings("all")
764  @lombok.Generated
765  public CoverPhoto getCover() {
766    return this.cover;
767  }
768
769  /**
770   * Cover picture
771   */
772  @java.lang.SuppressWarnings("all")
773  @lombok.Generated
774  public void setCover(final CoverPhoto cover) {
775    this.cover = cover;
776  }
777
778  /**
779   * Number of people attending the event
780   *
781   * @return Number of people attending the event
782   */
783  @GraphAPI(since = "2.1")
784  @java.lang.SuppressWarnings("all")
785  @lombok.Generated
786  public Integer getAttendingCount() {
787    return this.attendingCount;
788  }
789
790  /**
791   * Number of people attending the event
792   */
793  @java.lang.SuppressWarnings("all")
794  @lombok.Generated
795  public void setAttendingCount(final Integer attendingCount) {
796    this.attendingCount = attendingCount;
797  }
798
799  /**
800   * Number of people who declined the event
801   *
802   * @return Number of people who declined the event
803   */
804  @GraphAPI(since = "2.1")
805  @java.lang.SuppressWarnings("all")
806  @lombok.Generated
807  public Integer getDeclinedCount() {
808    return this.declinedCount;
809  }
810
811  /**
812   * Number of people who declined the event
813   */
814  @java.lang.SuppressWarnings("all")
815  @lombok.Generated
816  public void setDeclinedCount(final Integer declinedCount) {
817    this.declinedCount = declinedCount;
818  }
819
820  /**
821   * Number of people who maybe going to the event
822   *
823   * @return Number of people who maybe going to the event
824   */
825  @GraphAPI(since = "2.1")
826  @java.lang.SuppressWarnings("all")
827  @lombok.Generated
828  public Integer getMaybeCount() {
829    return this.maybeCount;
830  }
831
832  /**
833   * Number of people who maybe going to the event
834   */
835  @java.lang.SuppressWarnings("all")
836  @lombok.Generated
837  public void setMaybeCount(final Integer maybeCount) {
838    this.maybeCount = maybeCount;
839  }
840
841  /**
842   * Number of people who did not reply to the event
843   *
844   * @return Number of people who did not reply to the event
845   */
846  @GraphAPI(since = "2.1")
847  @java.lang.SuppressWarnings("all")
848  @lombok.Generated
849  public Integer getNoreplyCount() {
850    return this.noreplyCount;
851  }
852
853  /**
854   * Number of people who did not reply to the event
855   */
856  @java.lang.SuppressWarnings("all")
857  @lombok.Generated
858  public void setNoreplyCount(final Integer noreplyCount) {
859    this.noreplyCount = noreplyCount;
860  }
861}