Skip to content

Commit

Permalink
Merge pull request #13 from harmonyzhang/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
harmonyzhang authored May 31, 2023
2 parents ae2f45c + 98cc801 commit 1bbb09f
Show file tree
Hide file tree
Showing 5 changed files with 157 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
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 Document parameter.
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
public class DocumentParameter extends Parameter {

@JsonProperty("document")
private Media document;


/**
* Instantiates a new Document parameter.
*
* @param document document
*/
public DocumentParameter(Media document) {
super(ParameterType.DOCUMENT);
this.document = document;
}

public Media getDocument() {
return document;
}

public void setDocument(Media document) {
this.document = document;
}
}
33 changes: 33 additions & 0 deletions src/main/java/com/whatsapp/api/domain/messages/ImageParameter.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
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 Image parameter.
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
public class ImageParameter extends Parameter {

@JsonProperty("image")
private Media image;

/**
* Instantiates a new Image parameter.
*
* @param image image
*/
public ImageParameter(Media image) {
super(ParameterType.IMAGE);
this.image = image;
}

public Media getImage() {
return image;
}

public void setImage(Media image) {
this.image = image;
}
}
45 changes: 45 additions & 0 deletions src/main/java/com/whatsapp/api/domain/messages/Media.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package com.whatsapp.api.domain.messages;

import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.*;

import static com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL;

@NoArgsConstructor
@AllArgsConstructor
@Getter
@Setter
@Builder
@JsonInclude(NON_NULL)
public class Media {
/**
* Required when type is an image, audio, document, or video and you are not using a link.
* The media object ID. For more information, see Get Media ID.
* */
private String id;
/**
* Required when type is audio, document, image, sticker, or video and you are not using an uploaded media ID.
* The protocol and URL of the media to be sent. Use only with HTTP/HTTPS URLs. caption Optional.
*/
private String link;

/**
* Describes the specified image, video, or document media. Do not use it with audio media.
*/
private String caption;

/**
* Describes the filename for the specific document. Use only with document media.
*/
private String filename;

/**
* 是否是语音
*/
private Boolean voice;

/**
* 文件类型
*/
private String mimeType;
}
33 changes: 33 additions & 0 deletions src/main/java/com/whatsapp/api/domain/messages/VideoParameter.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
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 Video parameter.
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
public class VideoParameter extends Parameter {

@JsonProperty("video")
private Media video;

/**
* Instantiates a new Video parameter.
*
* @param video video
*/
public VideoParameter(Media video) {
super(ParameterType.VIDEO);
this.video = video;
}

public Media getVideo() {
return video;
}

public void setVideo(Media video) {
this.video = video;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,18 @@ public enum ParameterType {
* Text parameter type.
*/
TEXT("text"),
/**
* Image parameter type.
*/
IMAGE("image"),
/**
* Video parameter type.
*/
VIDEO("video"),
/**
* Document parameter type.
*/
DOCUMENT("document"),
/**
* Currency parameter type.
*/
Expand Down

0 comments on commit 1bbb09f

Please sign in to comment.