Skip to content

Commit

Permalink
Merge pull request #79 from Bindambc/70-the-header-object-in-the-inte…
Browse files Browse the repository at this point in the history
…ractive-message-type-is-incomplete

Added support to send images, videos and documents in interactive messages
  • Loading branch information
Bindambc authored Apr 3, 2023
2 parents 3828523 + 012f66d commit 71710b6
Show file tree
Hide file tree
Showing 18 changed files with 599 additions and 137 deletions.
1 change: 0 additions & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

# Please see the documentation for all configuration options:
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

Expand Down
12 changes: 6 additions & 6 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
tests:
- src/test/**/*
- src/test/**/*
java:
- '**/*.java'
- '**/*.java'
documentation:
- '**/*.md'
- '**/*.md'
markdown:
- '**/*.md'
- '**/*.md'
github-actions:
- .github/**/*
- .github/**/*
dependencies:
- pom.xml
- pom.xml

70 changes: 35 additions & 35 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,46 +38,46 @@ jobs:
# Learn more about CodeQL language support at https://git.io/codeql-language-support

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Checkout repository
uses: actions/checkout@v3

- uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'


- uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main

# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2

#- run: |
# make bootstrap
# make release
# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
with:
category: "/language:${{matrix.language}}"
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language

#- run: |
# make bootstrap
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
with:
category: "/language:${{matrix.language}}"
12 changes: 6 additions & 6 deletions .github/workflows/greetings.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Greetings

on: [pull_request_target, issues]
on: [ pull_request_target, issues ]

jobs:
greeting:
Expand All @@ -9,8 +9,8 @@ jobs:
issues: write
pull-requests: write
steps:
- uses: actions/first-interaction@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
issue-message: "Hello and welcome! We're glad to see that you've opened your first issue. We appreciate your contribution and would love to hear more about the problem you're experiencing. Our team is actively monitoring this repository and we will do our best to respond to your issue as soon as possible. Thank you for using our project and we look forward to working with you!"
pr-message: "Hello and welcome! We are excited to see your first pull request and appreciate your contribution to our project. Our team is reviewing your changes and we will provide feedback as soon as possible. Thank you for taking the time to improve our project and we look forward to working with you!"
- uses: actions/first-interaction@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
issue-message: "Hello and welcome! We're glad to see that you've opened your first issue. We appreciate your contribution and would love to hear more about the problem you're experiencing. Our team is actively monitoring this repository and we will do our best to respond to your issue as soon as possible. Thank you for using our project and we look forward to working with you!"
pr-message: "Hello and welcome! We are excited to see your first pull request and appreciate your contribution to our project. Our team is reviewing your changes and we will provide feedback as soon as possible. Thank you for taking the time to improve our project and we look forward to working with you!"
2 changes: 1 addition & 1 deletion .github/workflows/javadoc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
ref: javadoc
persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal access token.
fetch-depth: 0 # otherwise, there would be errors pushing refs to the destination repository.
- name: merge changes
- name: merge changes
run: |
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/label.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# https://github.com/actions/labeler

name: Labeler
on: [pull_request_target]
on: [ pull_request_target ]

jobs:
label:
Expand All @@ -17,6 +17,6 @@ jobs:
pull-requests: write

steps:
- uses: actions/labeler@v4
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
- uses: actions/labeler@v4
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
24 changes: 12 additions & 12 deletions .github/workflows/maven-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
cache: maven
- name: Build with Maven
run: mvn -B package --file pom.xml
#coverage
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
- uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
cache: maven
- name: Build with Maven
run: mvn -B package --file pom.xml
#coverage
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
4 changes: 2 additions & 2 deletions .github/workflows/maven-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ name: Maven Package

on:
release:
types: [created]
types: [ created ]

workflow_dispatch:

jobs:
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,5 @@ hs_err_pid*
/target/
/src/test/java/com/whatsapp/api/TestConstants.java
/src/test/java/com/whatsapp/api/TestConstants.java
/htmlReport
/machinet.conf
121 changes: 112 additions & 9 deletions src/main/java/com/whatsapp/api/domain/messages/Header.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.whatsapp.api.domain.messages.type.HeaderType;
//TODO: Header is incomplete

/**
* <p>Header content displayed on top of a message. You cannot set a header if your interactive object is of product type</p>
*/
Expand All @@ -14,17 +14,55 @@ public class Header {
* The Type.
*/
@JsonProperty("type")
public HeaderType type;
private HeaderType type;
/**
* The Text.
*/
@JsonProperty("text")
public String text;
private String text;

/**
* <b>Required</b> if type is set to document.
* Contains the media object for this document.
*/
@JsonProperty("document")
private Document document;

/**
* <b>Required</b> if type is set to image.
* Contains the media object for this image.
*/
@JsonProperty("image")
private Image image;

/**
* <b>Required</b> if type is set to video.
* Contains the media object for this video.
*/
@JsonProperty("video")
private Video video;


/**
* Instantiates a new Header.
*
* @param type <b>Allways Required</b>. The header type you would like to use
*/
public Header(HeaderType type) {
this.type = type;
}


/**
* Instantiates a new Header.
*/
public Header() {
}

/**
* Gets type.
*
* @return the type
* @return the Header
*/
public HeaderType getType() {
return type;
Expand All @@ -33,8 +71,8 @@ public HeaderType getType() {
/**
* Sets type.
*
* @param type the type
* @return the type
* @param type <b>Required</b>. The header type you would like to us
* @return the Header
*/
public Header setType(HeaderType type) {
this.type = type;
Expand All @@ -44,7 +82,7 @@ public Header setType(HeaderType type) {
/**
* Gets text.
*
* @return the text
* @return the Header
*/
public String getText() {
return text;
Expand All @@ -53,11 +91,76 @@ public String getText() {
/**
* Sets text.
*
* @param text the text
* @return the text
* @param text <b>Required</b> if type is set to text. Text for the header.
* <br>Formatting allows emojis, but not markdown.
* <br>Maximum length is 60 characters.
* @return the Header
*/
public Header setText(String text) {
this.text = text;
return this;
}

/**
* Gets document.
*
* @return the Header
*/
public Document getDocument() {
return document;
}

/**
* Sets document.
*
* @param document <b>Required</b> if type is set to document.
* <br>Contains the media object for this document.
* @return the Header
*/
public Header setDocument(Document document) {
this.document = document;
return this;
}

/**
* Gets image.
*
* @return the Header
*/
public Image getImage() {
return image;
}

/**
* Sets image.
*
* @param image <b>Required</b> if type is set to image.
* <br>Contains the media object for this image.
* @return the Header
*/
public Header setImage(Image image) {
this.image = image;
return this;
}

/**
* Gets video.
*
* @return the Header
*/
public Video getVideo() {
return video;
}

/**
* Sets video.
*
* @param video <b>Required</b> if type is set to video.
* <br>Contains the media object for this video.
* @return the Header
*/
public Header setVideo(Video video) {
this.video = video;
return this;
}
}
Loading

0 comments on commit 71710b6

Please sign in to comment.