001// Generated by delombok at Wed Jan 31 21:27:42 UTC 2024
002/*
003 * Copyright (c) 2010-2024 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.send;
024
025import java.util.ArrayList;
026import java.util.List;
027import com.restfb.Facebook;
028import com.restfb.annotation.GraphAPI;
029
030/**
031 * implementation of the Open Graph Template
032 * (https://developers.facebook.com/docs/messenger-platform/send-messages/template/open-graph)
033 *
034 * @deprecated with Graph API 4.0 this is no longer supported
035 */
036@Deprecated
037@GraphAPI(until = "4.0")
038public class OpenGraphTemplatePayload extends TemplatePayload {
039  @Facebook
040  private List<Element> elements;
041
042  public OpenGraphTemplatePayload() {
043    setTemplateType("open_graph");
044  }
045
046  public boolean addElement(Element element) {
047    if (elements == null) {
048      elements = new ArrayList<>();
049    }
050    return elements.add(element);
051  }
052
053
054  public static class Element {
055    public Element(String url) {
056      this.url = url;
057    }
058
059    @Facebook
060    private String url;
061    @Facebook
062    private List<AbstractButton> buttons;
063
064    public boolean addButton(WebButton button) {
065      if (buttons == null) {
066        buttons = new ArrayList<>();
067      }
068      return buttons.add(button);
069    }
070
071    @java.lang.SuppressWarnings("all")
072    public String getUrl() {
073      return this.url;
074    }
075
076    @java.lang.SuppressWarnings("all")
077    public List<AbstractButton> getButtons() {
078      return this.buttons;
079    }
080  }
081
082  @java.lang.SuppressWarnings("all")
083  public List<Element> getElements() {
084    return this.elements;
085  }
086}