Skip to content

Commit

Permalink
Merge pull request #10 from gggmwei/develop
Browse files Browse the repository at this point in the history
update DocumentParameter、ImageParameter、VideoParameter
  • Loading branch information
harmonyzhang authored May 12, 2023
2 parents fa4ad30 + 98c8274 commit 98cc801
Show file tree
Hide file tree
Showing 4 changed files with 74 additions and 53 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,37 +10,25 @@
@JsonInclude(JsonInclude.Include.NON_NULL)
public class DocumentParameter extends Parameter {

@JsonProperty("link")
private String link;
@JsonProperty("caption")
private String caption;
@JsonProperty("filename")
private String filename;
@JsonProperty("document")
private Media document;


/**
* Instantiates a new Document parameter.
*
* @param link the link
* @param caption the caption
* @param filename the filename
* @param document document
*/
public DocumentParameter(String link, String caption, String filename) {
super(ParameterType.IMAGE);
this.link = link;
this.caption = caption;
this.filename = filename;
public DocumentParameter(Media document) {
super(ParameterType.DOCUMENT);
this.document = document;
}

public String getLink() {
return link;
public Media getDocument() {
return document;
}

public String getCaption() {
return caption;
}

public String getFilename() {
return filename;
public void setDocument(Media document) {
this.document = document;
}
}
24 changes: 9 additions & 15 deletions src/main/java/com/whatsapp/api/domain/messages/ImageParameter.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,30 +10,24 @@
@JsonInclude(JsonInclude.Include.NON_NULL)
public class ImageParameter extends Parameter {

@JsonProperty("link")
private String link;
@JsonProperty("caption")
private String caption;

@JsonProperty("image")
private Media image;

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

public String getLink() {
return link;
public Media getImage() {
return image;
}

public String getCaption() {
return caption;
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;
}
26 changes: 10 additions & 16 deletions src/main/java/com/whatsapp/api/domain/messages/VideoParameter.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,30 +10,24 @@
@JsonInclude(JsonInclude.Include.NON_NULL)
public class VideoParameter extends Parameter {

@JsonProperty("link")
private String link;
@JsonProperty("caption")
private String caption;

@JsonProperty("video")
private Media video;

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

public String getLink() {
return link;
public Media getVideo() {
return video;
}

public String getCaption() {
return caption;
public void setVideo(Media video) {
this.video = video;
}

}

0 comments on commit 98cc801

Please sign in to comment.