Skip to content

Commit

Permalink
update version to 5.0.7.
Browse files Browse the repository at this point in the history
  • Loading branch information
wicked-tc130 committed Apr 23, 2024
1 parent bd4896a commit 04204ee
Show file tree
Hide file tree
Showing 13 changed files with 236 additions and 7 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@
## 1. 集成
引入sdk包
```xml
<!--以5.0.6版本为例-->
<!--以5.0.7版本为例-->
<dependencies>
<!-- jiguang-sdk -->
<dependency>
<groupId>io.github.jpush</groupId>
<artifactId>jiguang-sdk</artifactId>
<version>5.0.6</version>
<version>5.0.7</version>
</dependency>
</dependencies>
```
Expand Down
4 changes: 2 additions & 2 deletions example-for-spring/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

<groupId>io.github.jpush</groupId>
<artifactId>example-for-spring</artifactId>
<version>5.0.6</version>
<version>5.0.7</version>

<properties>
<maven.compiler.source>8</maven.compiler.source>
Expand All @@ -26,7 +26,7 @@
<dependency>
<groupId>io.github.jpush</groupId>
<artifactId>jiguang-sdk</artifactId>
<version>5.0.6</version>
<version>5.0.7</version>
</dependency>
<!-- lombok -->
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,15 @@ public void send() {
// 或者发送所有平台
// param.setPlatform(ApiConstants.Platform.ALL);

// Android厂商
// param.setThirdNotificationMessage();

// 短信补充
// param.setSmsMessage();

// 回调
// param.setCallback();

// 发送
PushSendResult result = pushApi.send(param);
log.info("result:{}", result);
Expand Down
20 changes: 20 additions & 0 deletions example-for-spring/target/classes/application.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
spring:
application:
name: jiguang-sdk

server:
port: 9876

logging:
level:
root: debug

jiguang:
api:
# 此为演示数据,请替换成真实数据
app-key: a266cd5c8544ba09b23733e1
master-secret: bcf3b3327000abce4764f862
dev-key: c2dc75e97486529205528b23
dev-secret: d219e2f001df2fe4f08b6754


4 changes: 2 additions & 2 deletions jiguang-sdk/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
<parent>
<groupId>io.github.jpush</groupId>
<artifactId>jiguang-sdk-java</artifactId>
<version>5.0.6</version>
<version>5.0.7</version>
<relativePath>../pom.xml</relativePath>
</parent>

<groupId>io.github.jpush</groupId>
<artifactId>jiguang-sdk</artifactId>
<version>5.0.6</version>
<version>5.0.7</version>
<packaging>jar</packaging>

<properties>
Expand Down
18 changes: 18 additions & 0 deletions jiguang-sdk/src/main/java/cn/jiguang/sdk/api/PushApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,24 @@ public ImageFileUpdateResult updateImageFile(@NonNull String mediaId, @NonNull I
return pushClient.updateImageFile(mediaId, param);
}

// ********************* 如果遇到此api没有及时补充字段的情况,可以自行构建json,调用下面的接口 *********************

public PushSendResult send(Object param) {
return pushClient.send(param);
}

public SchedulePushSendResult scheduleSend(Object param) {
return pushClient.scheduleSend(param);
}

public PushSendResult validateSend(Object param) {
return pushClient.validateSend(param);
}

public PushSendResult sendByFile(Object param) {
return pushClient.sendByFile(param);
}

public static class Builder {

private String host = "https://api.jpush.cn";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
package cn.jiguang.sdk.bean.push;

import cn.jiguang.sdk.bean.push.audience.Audience;
import cn.jiguang.sdk.bean.push.callback.Callback;
import cn.jiguang.sdk.bean.push.message.custom.CustomMessage;
import cn.jiguang.sdk.bean.push.message.inapp.InAppMessage;
import cn.jiguang.sdk.bean.push.message.liveactivity.LiveActivityMessage;
import cn.jiguang.sdk.bean.push.message.notification.NotificationMessage;
import cn.jiguang.sdk.bean.push.message.notification.ThirdNotificationMessage;
import cn.jiguang.sdk.bean.push.message.sms.SmsMessage;
import cn.jiguang.sdk.bean.push.options.Options;
import cn.jiguang.sdk.enums.platform.Platform;
import com.fasterxml.jackson.annotation.JsonInclude;
Expand Down Expand Up @@ -54,4 +57,16 @@ public class PushSendParam {
@JsonInclude(JsonInclude.Include.NON_NULL)
private InAppMessage inApp;

@JsonProperty("notification_3rd")
@JsonInclude(JsonInclude.Include.NON_NULL)
private ThirdNotificationMessage thirdNotificationMessage;

@JsonProperty("sms_message")
@JsonInclude(JsonInclude.Include.NON_NULL)
private SmsMessage smsMessage;

@JsonProperty("callback")
@JsonInclude(JsonInclude.Include.NON_NULL)
private Callback callback;

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package cn.jiguang.sdk.bean.push.callback;

import cn.jiguang.sdk.enums.callback.CallbackType;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;

import java.util.Map;

@Data
@JsonIgnoreProperties(ignoreUnknown = true)
public class Callback {

@JsonProperty("url")
private String url;

/**
* 取值参考:{@link CallbackType}
*/
@JsonProperty("type")
@JsonInclude(JsonInclude.Include.NON_NULL)
private Integer type;

@JsonProperty("params")
@JsonInclude(JsonInclude.Include.NON_NULL)
private Map<String, Object> params;

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
package cn.jiguang.sdk.bean.push.message.notification;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;

import java.util.Map;

@Data
@JsonIgnoreProperties(ignoreUnknown = true)
public class ThirdNotificationMessage {

@JsonProperty("title")
@JsonInclude(JsonInclude.Include.NON_NULL)
private String title;

@JsonProperty("content")
private String content;

@JsonProperty("intent")
@JsonInclude(JsonInclude.Include.NON_NULL)
private Intent intent;

@JsonProperty("uri_activity")
@JsonInclude(JsonInclude.Include.NON_NULL)
private String uriActivity;

@JsonProperty("uri_action")
@JsonInclude(JsonInclude.Include.NON_NULL)
private String uriAction;

@JsonProperty("badge_class")
@JsonInclude(JsonInclude.Include.NON_NULL)
private String badgeClass;

@JsonProperty("badge_add_num")
@JsonInclude(JsonInclude.Include.NON_NULL)
private Integer badgeAddNumber;

@JsonProperty("badge_set_num")
@JsonInclude(JsonInclude.Include.NON_NULL)
private Integer badgeSetNumber;

@JsonProperty("sound")
@JsonInclude(JsonInclude.Include.NON_NULL)
private String sound;

@JsonProperty("channel_id")
@JsonInclude(JsonInclude.Include.NON_NULL)
private String channelId;

@JsonProperty("extras")
@JsonInclude(JsonInclude.Include.NON_NULL)
private Map<String, Object> extras;

@Data
public static class Intent {
@JsonProperty("url")
@JsonInclude(JsonInclude.Include.NON_NULL)
private String url;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package cn.jiguang.sdk.bean.push.message.sms;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;

import java.util.Map;

@Data
@JsonIgnoreProperties(ignoreUnknown = true)
public class SmsMessage {

@JsonProperty("temp_id")
@JsonInclude(JsonInclude.Include.NON_NULL)
private Integer tempId;

@JsonProperty("signid")
@JsonInclude(JsonInclude.Include.NON_NULL)
private Integer signId;

@JsonProperty("delay_time")
@JsonInclude(JsonInclude.Include.NON_NULL)
private Integer delayTime;

@JsonProperty("active_filter")
@JsonInclude(JsonInclude.Include.NON_NULL)
private Boolean activeFilter;

@JsonProperty("temp_para")
@JsonInclude(JsonInclude.Include.NON_NULL)
private Map<String, Object> tempParams;

}
18 changes: 18 additions & 0 deletions jiguang-sdk/src/main/java/cn/jiguang/sdk/client/PushClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -88,4 +88,22 @@ public interface PushClient {
@Headers("Content-Type: multipart/form-data")
ImageFileUpdateResult updateImageFile(@Param("media_id") String mediaId, ImageFileUpdateParam param);

// ********************* 如果遇到此api没有及时补充字段的情况,可以自行构建json,调用下面的接口 *********************

@RequestLine("POST /v3/push")
@Headers("Content-Type: application/json; charset=utf-8")
PushSendResult send(Object param);

@RequestLine("POST /v3/schedules")
@Headers("Content-Type: application/json; charset=utf-8")
SchedulePushSendResult scheduleSend(Object param);

@RequestLine("POST /v3/push/validate")
@Headers("Content-Type: application/json; charset=utf-8")
PushSendResult validateSend(Object param);

@RequestLine("POST /v3/push/file")
@Headers("Content-Type: application/json; charset=utf-8")
PushSendResult sendByFile(Object param);

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package cn.jiguang.sdk.enums.callback;

public enum CallbackType {

RECEIVED(0b1, "送达回执,值为1"),
CLICKED(0b10, "点击回执,值为2"),
RECEIVED_AND_CLICKED(0b11, "送达和点击回执,值为3"),
PUSH(0b1000, "推送成功回执,值为8"),
PUSH_AND_RECEIVED(0b1001, "推送成功和送达回执,值为9"),
PUSH_AND_CLICKED(0b1010, "推送成功和点击回执,值为10"),
PUSH_AND_RECEIVED_AND_CLICKED(0b1011, "推送成功和送达和点击回执,值为11"),
;

private int value;
private String description;

CallbackType(int value, String description) {
this.value = value;
this.description = description;
}

}
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>io.github.jpush</groupId>
<artifactId>jiguang-sdk-java</artifactId>
<version>5.0.6</version>
<version>5.0.7</version>
<packaging>pom</packaging>

<name>Jiguang SDK For Rest Api</name>
Expand Down

0 comments on commit 04204ee

Please sign in to comment.