-
-
Notifications
You must be signed in to change notification settings - Fork 81
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #63 from Bindambc/40-message-template
Changes to message template creation and changes to message template sending.
- Loading branch information
Showing
63 changed files
with
3,052 additions
and
409 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
src/main/java/com/whatsapp/api/domain/messages/BodyComponent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package com.whatsapp.api.domain.messages; | ||
|
||
import com.fasterxml.jackson.annotation.JsonInclude; | ||
import com.whatsapp.api.domain.messages.type.ComponentType; | ||
|
||
|
||
/** | ||
* The type Body component, to send template messages | ||
*/ | ||
@JsonInclude(JsonInclude.Include.NON_NULL) | ||
public class BodyComponent extends Component<BodyComponent> { | ||
|
||
|
||
/** | ||
* Instantiates a new Body component, to send template messages | ||
*/ | ||
public BodyComponent() { | ||
super(ComponentType.BODY); | ||
} | ||
|
||
|
||
} |
79 changes: 79 additions & 0 deletions
79
src/main/java/com/whatsapp/api/domain/messages/ButtonComponent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
package com.whatsapp.api.domain.messages; | ||
|
||
import com.fasterxml.jackson.annotation.JsonInclude; | ||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import com.whatsapp.api.domain.messages.type.ButtonSubType; | ||
import com.whatsapp.api.domain.messages.type.ComponentType; | ||
|
||
/** | ||
* The type Button component. | ||
*/ | ||
@JsonInclude(JsonInclude.Include.NON_NULL) | ||
public class ButtonComponent extends Component<ButtonComponent> { | ||
@JsonProperty("index") | ||
private int index; | ||
@JsonProperty("sub_type") | ||
private ButtonSubType subType; | ||
|
||
|
||
/** | ||
* Instantiates a new Button component. | ||
*/ | ||
public ButtonComponent() { | ||
super(ComponentType.BUTTON); | ||
} | ||
|
||
/** | ||
* Instantiates a new Button component. | ||
* | ||
* @param index the index | ||
* @param subType the sub type | ||
*/ | ||
public ButtonComponent(int index, ButtonSubType subType) { | ||
super(ComponentType.BUTTON); | ||
this.index = index; | ||
this.subType = subType; | ||
} | ||
|
||
/** | ||
* Gets index. | ||
* | ||
* @return the index | ||
*/ | ||
public int getIndex() { | ||
return index; | ||
} | ||
|
||
/** | ||
* Sets index. Required when type=button. Not used for the other types. Only used for Cloud API. | ||
* Position index of the button. You can have up to 3 buttons using index values of 0 to 2. | ||
* | ||
* @param index the index | ||
* @return the index | ||
*/ | ||
public ButtonComponent setIndex(int index) { | ||
this.index = index; | ||
return this; | ||
} | ||
|
||
/** | ||
* Gets sub type. | ||
* | ||
* @return the sub type | ||
*/ | ||
public ButtonSubType getSubType() { | ||
return subType; | ||
} | ||
|
||
/** | ||
* Sets sub type. Required when type=button. Not used for the other types. | ||
* Type of button to create. | ||
* | ||
* @param subType the sub type | ||
* @return the sub type | ||
*/ | ||
public ButtonComponent setSubType(ButtonSubType subType) { | ||
this.subType = subType; | ||
return this; | ||
} | ||
} |
56 changes: 56 additions & 0 deletions
56
src/main/java/com/whatsapp/api/domain/messages/ButtonPayloadParameter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
package com.whatsapp.api.domain.messages; | ||
|
||
import com.fasterxml.jackson.annotation.JsonInclude; | ||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import com.whatsapp.api.domain.messages.type.ParameterType; | ||
|
||
/** | ||
* The type Button payload parameter. | ||
* | ||
* @see <a href="https://developers.facebook.com/docs/whatsapp/cloud-api/reference/messages#button-parameter-object">Api reference</a> | ||
*/ | ||
@JsonInclude(JsonInclude.Include.NON_NULL) | ||
public class ButtonPayloadParameter extends Parameter { | ||
@JsonProperty("payload") | ||
private String payload; | ||
|
||
|
||
/** | ||
* Instantiates a new Button payload parameter. | ||
*/ | ||
public ButtonPayloadParameter() { | ||
super(ParameterType.PAYLOAD); | ||
} | ||
|
||
/** | ||
* Instantiates a new Button payload parameter. | ||
* | ||
* @param payload the payload - Required for quick_reply buttons. | ||
* Developer-defined payload that is returned when the button is clicked in addition to the display text on the button. | ||
*/ | ||
public ButtonPayloadParameter(String payload) { | ||
super(ParameterType.PAYLOAD); | ||
this.payload = payload; | ||
} | ||
|
||
/** | ||
* Gets payload. | ||
* | ||
* @return the payload | ||
*/ | ||
public String getPayload() { | ||
return payload; | ||
} | ||
|
||
/** | ||
* Sets payload. Required for quick_reply buttons. | ||
* Developer-defined payload that is returned when the button is clicked in addition to the display text on the button. | ||
* | ||
* @param payload the payload | ||
* @return the payload | ||
*/ | ||
public ButtonPayloadParameter setPayload(String payload) { | ||
this.payload = payload; | ||
return this; | ||
} | ||
} |
55 changes: 55 additions & 0 deletions
55
src/main/java/com/whatsapp/api/domain/messages/ButtonTextParameter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
package com.whatsapp.api.domain.messages; | ||
|
||
import com.fasterxml.jackson.annotation.JsonInclude; | ||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import com.whatsapp.api.domain.messages.type.ParameterType; | ||
|
||
/** | ||
* The type Button text parameter. | ||
* Required for URL buttons. | ||
* Developer-provided suffix that is appended to the predefined prefix URL in the template. | ||
* | ||
* @see <a href="https://developers.facebook.com/docs/whatsapp/cloud-api/reference/messages#button-parameter-object">Api reference</a> | ||
*/ | ||
@JsonInclude(JsonInclude.Include.NON_NULL) | ||
public class ButtonTextParameter extends Parameter { | ||
@JsonProperty("text") | ||
private String text; | ||
|
||
/** | ||
* Instantiates a new Button text parameter. | ||
*/ | ||
public ButtonTextParameter() { | ||
super(ParameterType.TEXT); | ||
} | ||
|
||
/** | ||
* Instantiates a new Button text parameter. | ||
* | ||
* @param text the text. <b>Required for URL buttons</b>. Developer-provided suffix that is appended to the predefined prefix URL in the template. | ||
*/ | ||
public ButtonTextParameter(String text) { | ||
super(ParameterType.TEXT); | ||
this.text = text; | ||
} | ||
|
||
/** | ||
* Gets text. | ||
* | ||
* @return the text | ||
*/ | ||
public String getText() { | ||
return text; | ||
} | ||
|
||
/** | ||
* Sets text. | ||
* | ||
* @param text the text. <b>Required for URL buttons</b>. Developer-provided suffix that is appended to the predefined prefix URL in the template. | ||
* @return the text | ||
*/ | ||
public ButtonTextParameter setText(String text) { | ||
this.text = text; | ||
return this; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.