Skip to content

Commit

Permalink
NoIssue: missing field in WhatsAppMessageTemplate added
Browse files Browse the repository at this point in the history
  • Loading branch information
nbartels committed Feb 9, 2022
1 parent f36addc commit fc5417e
Show file tree
Hide file tree
Showing 2 changed files with 93 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@
import lombok.Setter;

/**
* Represents the <a href="https://developers.facebook.com/docs/graph-api/reference/whats-app-business-hsm/">WhatsApp
* Represents the <a href=
* "https://developers.facebook.com/docs/graph-api/reference/whats-app-business-account/message_templates/">WhatsApp
* Message Template type </a>
*/
public class WhatsAppMessageTemplate extends NamedFacebookType {
Expand All @@ -55,11 +56,10 @@ public class WhatsAppMessageTemplate extends NamedFacebookType {
@Facebook
private String content;

// WhatsAppBusinessHSMWhatsAppHSMComponentGet is not defined in the reference
// @Getter
// @Setter
// @Facebook
// private List<WhatsAppBusinessHSMWhatsAppHSMComponentGet> components;
@Getter
@Setter
@Facebook
private List<WhatsAppMessageTemplateComponent> components;

/**
* The languages (and locale) of the element translation
Expand Down Expand Up @@ -101,7 +101,6 @@ public class WhatsAppMessageTemplate extends NamedFacebookType {
@Facebook("name_or_content")
private String nameOrContent;


@Getter
@Setter
@Facebook("quality_score")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
/*
* Copyright (c) 2010-2022 Mark Allen, Norbert Bartels.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package com.restfb.types.whatsapp;

import java.util.List;

import com.restfb.Facebook;

import lombok.Getter;
import lombok.Setter;

public class WhatsAppMessageTemplateComponent {

@Getter
@Setter
@Facebook
private Type type;

@Getter
@Setter
@Facebook
private Format format;

@Getter
@Setter
@Facebook
private String text;

@Getter
@Setter
@Facebook
private List<Button> buttons;

public enum Type {
HEADER, BODY, FOOTER, BUTTONS
}

public enum Format {
TEXT, IMAGE, DOCUMENT, VIDEO, LOCATION
}

public enum ButtonType {
QUICK_REPLY, URL, PHONE_NUMBER
}

public static class Button {

@Getter
@Setter
@Facebook
private ButtonType type;

@Getter
@Setter
@Facebook
private String text;

@Getter
@Setter
@Facebook
private String url;

@Getter
@Setter
@Facebook("phone_number")
private String phoneNumber;
}
}

0 comments on commit fc5417e

Please sign in to comment.