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 java.util.List; 026import java.util.stream.Collectors; 027import com.restfb.Facebook; 028import com.restfb.JsonMapper; 029import com.restfb.Version; 030 031/** 032 * Represents the <a href="https://developers.facebook.com/docs/graph-api/reference/app/subscriptions">App Subscription 033 * type</a>. 034 * 035 * @author <a href="http://restfb.com">Norbert Bartels</a> 036 * @since 1.5 037 */ 038public class Subscription extends AbstractFacebookType { 039 private static final long serialVersionUID = 1L; 040 /** 041 * Indicates the object type that this subscription applies to. 042 * 043 * type: user, page, permissions, payments 044 */ 045 @Facebook 046 private String object; 047 /** 048 * The URL that will receive the POST request when an update is triggered. 049 */ 050 @Facebook("callback_url") 051 private String callbackUrl; 052 /** 053 * One or more of the set of valid fields in this object to subscribe to. 054 * 055 * The set of valid fields is defined here: 056 * https://developers.facebook.com/docs/graph-api/real-time-updates/v2.3#subscribefields 057 */ 058 @Facebook 059 private List<SubscriptionField> fields; 060 @Facebook("fields") 061 private List<String> compatFields; 062 /** 063 * Indicates whether or not the subscription is active. 064 */ 065 @Facebook 066 private Boolean active; 067 068 @JsonMapper.JsonMappingCompleted 069 private void convertCompatFields() { 070 if (compatFields != null && fields == null) { 071 fields = compatFields.stream().map(SubscriptionField::new).collect(Collectors.toList()); 072 } 073 } 074 075 076 public static class SubscriptionField extends AbstractFacebookType { 077 public SubscriptionField() { 078 // nothing to do 079 } 080 081 private SubscriptionField(String name) { 082 this.name = name; 083 this.version = Version.UNVERSIONED; 084 } 085 086 private static final long serialVersionUID = 1L; 087 @Facebook 088 private String name; 089 private Version version; 090 @Facebook("version") 091 private String versionAsString; 092 093 @JsonMapper.JsonMappingCompleted 094 public void convertVersion() { 095 version = Version.getVersionFromString(versionAsString); 096 } 097 098 @java.lang.SuppressWarnings("all") 099 @lombok.Generated 100 public String getName() { 101 return this.name; 102 } 103 104 @java.lang.SuppressWarnings("all") 105 @lombok.Generated 106 public void setName(final String name) { 107 this.name = name; 108 } 109 110 @java.lang.SuppressWarnings("all") 111 @lombok.Generated 112 public Version getVersion() { 113 return this.version; 114 } 115 116 @java.lang.SuppressWarnings("all") 117 @lombok.Generated 118 public void setVersion(final Version version) { 119 this.version = version; 120 } 121 } 122 123 /** 124 * Indicates the object type that this subscription applies to. 125 * 126 * type: user, page, permissions, payments 127 * 128 * @return the object type that this subscription applies to 129 */ 130 @java.lang.SuppressWarnings("all") 131 @lombok.Generated 132 public String getObject() { 133 return this.object; 134 } 135 136 /** 137 * Indicates the object type that this subscription applies to. 138 * 139 * type: user, page, permissions, payments 140 */ 141 @java.lang.SuppressWarnings("all") 142 @lombok.Generated 143 public void setObject(final String object) { 144 this.object = object; 145 } 146 147 /** 148 * The URL that will receive the POST request when an update is triggered. 149 * 150 * @return the URL that will receive the POST request 151 */ 152 @java.lang.SuppressWarnings("all") 153 @lombok.Generated 154 public String getCallbackUrl() { 155 return this.callbackUrl; 156 } 157 158 /** 159 * The URL that will receive the POST request when an update is triggered. 160 */ 161 @java.lang.SuppressWarnings("all") 162 @lombok.Generated 163 public void setCallbackUrl(final String callbackUrl) { 164 this.callbackUrl = callbackUrl; 165 } 166 167 /** 168 * One or more of the set of valid fields in this object to subscribe to. 169 * 170 * The set of valid fields is defined here: 171 * https://developers.facebook.com/docs/graph-api/real-time-updates/v2.3#subscribefields 172 * 173 * @return set of fields 174 */ 175 @java.lang.SuppressWarnings("all") 176 @lombok.Generated 177 public List<SubscriptionField> getFields() { 178 return this.fields; 179 } 180 181 /** 182 * One or more of the set of valid fields in this object to subscribe to. 183 * 184 * The set of valid fields is defined here: 185 * https://developers.facebook.com/docs/graph-api/real-time-updates/v2.3#subscribefields 186 */ 187 @java.lang.SuppressWarnings("all") 188 @lombok.Generated 189 public void setFields(final List<SubscriptionField> fields) { 190 this.fields = fields; 191 } 192 193 /** 194 * Indicates whether or not the subscription is active. 195 * 196 * @return if the subscription is active 197 */ 198 @java.lang.SuppressWarnings("all") 199 @lombok.Generated 200 public Boolean getActive() { 201 return this.active; 202 } 203 204 /** 205 * Indicates whether or not the subscription is active. 206 */ 207 @java.lang.SuppressWarnings("all") 208 @lombok.Generated 209 public void setActive(final Boolean active) { 210 this.active = active; 211 } 212}