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 java.util.Collections.unmodifiableList;
026import java.util.ArrayList;
027import java.util.Date;
028import java.util.List;
029import com.restfb.Facebook;
030import com.restfb.FacebookClient;
031import com.restfb.json.JsonObject;
032
033/**
034 * <p>
035 * Represents the result of a {@link FacebookClient#debugToken(String)} inquiry.
036 * </p>
037 * See <a href="https://developers.facebook.com/docs/howtos/login/debugging-access-tokens/">Debug access tokens</a>
038 *
039 * @author Broc Seib
040 */
041public class DebugTokenInfo extends AbstractFacebookType {
042  private static final long serialVersionUID = 1L;
043  /**
044   * The ID of the application this access token is for.
045   */
046  @Facebook("app_id")
047  private String appId;
048  /**
049   * Name of the application this access token is for.
050   */
051  @Facebook
052  private String application;
053  /**
054   * Timestamp when this access token expires.
055   */
056  @Facebook("expires_at")
057  private Date expiresAt;
058  /**
059   * Timestamp when app's access to user data expires.
060   */
061  @Facebook("data_access_expires_at")
062  private Date dataAccessExpiresAt;
063  /**
064   * The date on which the access token was issued.
065   */
066  @Facebook("issued_at")
067  private Date issuedAt;
068  /**
069   * Whether the token is valid.
070   */
071  @Facebook("is_valid")
072  private boolean isValid;
073  /**
074   * The ID of the user this access token is for.
075   */
076  @Facebook("user_id")
077  private String userId;
078  /**
079   * For impersonated access tokens, the ID of the page this token contains.
080   */
081  @Facebook("profile_id")
082  private String profileId;
083  /**
084   * General metadata associated with the access token. Can contain data like 'sso', 'auth_type', 'auth_nonce'
085   */
086  @Facebook
087  private JsonObject metadata;
088  /**
089   * Any error that a request to the graph api would return due to the access token.
090   */
091  @Facebook
092  private DebugTokenError error;
093  /**
094   * List of permissions that the user has granted for the app in this access token.
095   */
096  @Facebook
097  private List<String> scopes = new ArrayList<>();
098  /**
099   * List of granular permissions that the user has granted for this app in this access token.
100   */
101  @Facebook("granular_scopes")
102  private List<GranularScope> granularScopes = new ArrayList<>();
103  @Facebook
104  private String type;
105
106  /**
107   * The date on which the access token expires.
108   *
109   * @return The date on which the access token expires.
110   */
111  public Date getExpiresAt() {
112    if (expiresAt != null && expiresAt.getTime() == 0L) {
113      return null;
114    }
115    return expiresAt;
116  }
117
118  /**
119   * List of scopes the access token 'contains'
120   *
121   * @return list of scopes
122   */
123  public List<String> getScopes() {
124    return unmodifiableList(scopes);
125  }
126
127  /**
128   * List of granular scopes the access token 'contains'
129   *
130   * @return list of granular scopes
131   */
132  public List<GranularScope> getGranularScopes() {
133    return unmodifiableList(granularScopes);
134  }
135
136  /**
137   * All Error data associated with access token debug.
138   *
139   * @return debug token error
140   */
141  public DebugTokenError getDebugTokenError() {
142    return error;
143  }
144
145  /**
146   * The ID of the application this access token is for.
147   *
148   * @return The id of the application.
149   */
150  @java.lang.SuppressWarnings("all")
151  @lombok.Generated
152  public String getAppId() {
153    return this.appId;
154  }
155
156  /**
157   * The ID of the application this access token is for.
158   */
159  @java.lang.SuppressWarnings("all")
160  @lombok.Generated
161  public void setAppId(final String appId) {
162    this.appId = appId;
163  }
164
165  /**
166   * Name of the application this access token is for.
167   *
168   * @return The name of the application.
169   */
170  @java.lang.SuppressWarnings("all")
171  @lombok.Generated
172  public String getApplication() {
173    return this.application;
174  }
175
176  /**
177   * Name of the application this access token is for.
178   */
179  @java.lang.SuppressWarnings("all")
180  @lombok.Generated
181  public void setApplication(final String application) {
182    this.application = application;
183  }
184
185  /**
186   * Timestamp when app's access to user data expires.
187   *
188   * @return The date when app's access to user data expires.
189   */
190  @java.lang.SuppressWarnings("all")
191  @lombok.Generated
192  public Date getDataAccessExpiresAt() {
193    return this.dataAccessExpiresAt;
194  }
195
196  /**
197   * Timestamp when app's access to user data expires.
198   */
199  @java.lang.SuppressWarnings("all")
200  @lombok.Generated
201  public void setDataAccessExpiresAt(final Date dataAccessExpiresAt) {
202    this.dataAccessExpiresAt = dataAccessExpiresAt;
203  }
204
205  /**
206   * The date on which the access token was issued.
207   *
208   * @return The date on which the access token was issued.
209   */
210  @java.lang.SuppressWarnings("all")
211  @lombok.Generated
212  public Date getIssuedAt() {
213    return this.issuedAt;
214  }
215
216  /**
217   * The date on which the access token was issued.
218   */
219  @java.lang.SuppressWarnings("all")
220  @lombok.Generated
221  public void setIssuedAt(final Date issuedAt) {
222    this.issuedAt = issuedAt;
223  }
224
225  /**
226   * Whether the token is valid.
227   *
228   * @return Whether the token is valid.
229   */
230  @java.lang.SuppressWarnings("all")
231  @lombok.Generated
232  public boolean isValid() {
233    return this.isValid;
234  }
235
236  /**
237   * Whether the token is valid.
238   */
239  @java.lang.SuppressWarnings("all")
240  @lombok.Generated
241  public void setValid(final boolean isValid) {
242    this.isValid = isValid;
243  }
244
245  /**
246   * The ID of the user this access token is for.
247   *
248   * @return The user id.
249   */
250  @java.lang.SuppressWarnings("all")
251  @lombok.Generated
252  public String getUserId() {
253    return this.userId;
254  }
255
256  /**
257   * The ID of the user this access token is for.
258   */
259  @java.lang.SuppressWarnings("all")
260  @lombok.Generated
261  public void setUserId(final String userId) {
262    this.userId = userId;
263  }
264
265  /**
266   * For impersonated access tokens, the ID of the page this token contains.
267   *
268   * @return the profile id
269   */
270  @java.lang.SuppressWarnings("all")
271  @lombok.Generated
272  public String getProfileId() {
273    return this.profileId;
274  }
275
276  /**
277   * For impersonated access tokens, the ID of the page this token contains.
278   */
279  @java.lang.SuppressWarnings("all")
280  @lombok.Generated
281  public void setProfileId(final String profileId) {
282    this.profileId = profileId;
283  }
284
285  /**
286   * General metadata associated with the access token. Can contain data like 'sso', 'auth_type', 'auth_nonce'
287   *
288   * @return General metadata associated with the access token
289   */
290  @java.lang.SuppressWarnings("all")
291  @lombok.Generated
292  public JsonObject getMetadata() {
293    return this.metadata;
294  }
295
296  /**
297   * General metadata associated with the access token. Can contain data like 'sso', 'auth_type', 'auth_nonce'
298   */
299  @java.lang.SuppressWarnings("all")
300  @lombok.Generated
301  public void setMetadata(final JsonObject metadata) {
302    this.metadata = metadata;
303  }
304
305  @java.lang.SuppressWarnings("all")
306  @lombok.Generated
307  public String getType() {
308    return this.type;
309  }
310
311  @java.lang.SuppressWarnings("all")
312  @lombok.Generated
313  public void setType(final String type) {
314    this.type = type;
315  }
316}