@@ -3,6 +3,7 @@ package me.chanjar.weixin.open.api; | |||
import cn.binarywang.wx.miniapp.api.WxMaService; | |||
import me.chanjar.weixin.common.error.WxErrorException; | |||
import me.chanjar.weixin.open.bean.ma.WxMaOpenCommitExtInfo; | |||
import me.chanjar.weixin.open.bean.ma.WxOpenMaApplyInterface; | |||
import me.chanjar.weixin.open.bean.message.WxOpenMaSubmitAuditMessage; | |||
import me.chanjar.weixin.open.bean.result.*; | |||
@@ -230,6 +231,20 @@ public interface WxOpenMaService extends WxMaService { | |||
String API_SPEED_AUDIT = "https://api.weixin.qq.com/wxa/speedupaudit"; | |||
/** | |||
* 从2022年4月18日开始,部分小程序前端api需申请后,方可使用。该接口用于获取“需申请并审核通过”后才可使用的接口列表。 | |||
* | |||
*/ | |||
String API_GET_PRIVACY_INTERFACE = "https://api.weixin.qq.com/wxa/security/get_privacy_interface"; | |||
/** | |||
* 从2022年4月18日开始,部分小程序前端api需申请后,方可使用。该接口用于发起申请使用部分小程序前端api。发起申请后可通过get_privacy_interface查看审核状态。 | |||
* 每个接口都有类目要求,申请之前建议先阅读api原文,详细查看类目要求。 | |||
* | |||
*/ | |||
String API_APPLY_PRIVACY_INTERFACE = "https://api.weixin.qq.com/wxa/security/apply_privacy_interface"; | |||
/** | |||
* 获得小程序的域名配置信息 | |||
*/ | |||
@@ -483,4 +498,18 @@ public interface WxOpenMaService extends WxMaService { | |||
* @return 小程序用户隐私保护指引服务 | |||
*/ | |||
WxOpenMaPrivacyService getPrivacyService(); | |||
/** | |||
*从2022年4月18日开始,部分小程序前端api需申请后,方可使用。该接口用于获取“需申请并审核通过”后才可使用的接口列表。 | |||
* | |||
*/ | |||
WxOpenMaInterfaceListResult getPrivacyInterface() throws WxErrorException; | |||
/** | |||
* 申请接口 | |||
* 从2022年4月18日开始,部分小程序前端api需申请后,方可使用。该接口用于发起申请使用部分小程序前端api。发起申请后可通过get_privacy_interface查看审核状态。 | |||
* 每个接口都有类目要求,申请之前建议先阅读api原文,详细查看类目要求。 | |||
* | |||
*/ | |||
WxOpenResult addCategory(WxOpenMaApplyInterface applyInterface) throws WxErrorException; | |||
} |
@@ -13,6 +13,7 @@ import me.chanjar.weixin.open.api.WxOpenMaPrivacyService; | |||
import me.chanjar.weixin.open.api.WxOpenMaService; | |||
import me.chanjar.weixin.open.bean.ma.WxMaOpenCommitExtInfo; | |||
import me.chanjar.weixin.open.bean.ma.WxMaQrcodeParam; | |||
import me.chanjar.weixin.open.bean.ma.WxOpenMaApplyInterface; | |||
import me.chanjar.weixin.open.bean.message.WxOpenMaSubmitAuditMessage; | |||
import me.chanjar.weixin.open.bean.result.*; | |||
import me.chanjar.weixin.open.executor.MaQrCodeRequestExecutor; | |||
@@ -630,6 +631,18 @@ public class WxOpenMaServiceImpl extends WxMaServiceImpl implements WxOpenMaServ | |||
return WxMaGsonBuilder.create().fromJson(response, WxOpenResult.class); | |||
} | |||
@Override | |||
public WxOpenMaInterfaceListResult getPrivacyInterface() throws WxErrorException { | |||
String response = get(API_GET_PRIVACY_INTERFACE, null); | |||
return WxMaGsonBuilder.create().fromJson(response, WxOpenMaInterfaceListResult.class); | |||
} | |||
@Override | |||
public WxOpenResult addCategory(WxOpenMaApplyInterface applyPrivacyInterface) throws WxErrorException { | |||
String response = post(API_APPLY_PRIVACY_INTERFACE, applyPrivacyInterface); | |||
return WxMaGsonBuilder.create().fromJson(response, WxOpenResult.class); | |||
} | |||
/** | |||
* 将字符串对象转化为GsonArray对象 | |||
* | |||
@@ -0,0 +1,40 @@ | |||
package me.chanjar.weixin.open.bean.ma; | |||
import com.google.gson.annotations.SerializedName; | |||
import lombok.Data; | |||
import me.chanjar.weixin.open.util.json.WxOpenGsonBuilder; | |||
import java.io.Serializable; | |||
import java.util.List; | |||
/** | |||
* 微信小程序前段API. | |||
* | |||
* @author yqx | |||
* @date 2018/9/13 | |||
*/ | |||
@Data | |||
public class WxOpenMaApplyInterface implements Serializable { | |||
private static final long serialVersionUID = -2054964740942100351L; | |||
@SerializedName("api_name") | |||
private Integer apiName; | |||
@SerializedName("owner_setting") | |||
private String content; | |||
@SerializedName("url_list") | |||
private List<String> urlList; | |||
@SerializedName("pic_list") | |||
private List<String> picList; | |||
@SerializedName("video_list") | |||
private List<String> videoList; | |||
@Override | |||
public String toString() { | |||
return WxOpenGsonBuilder.create().toJson(this); | |||
} | |||
} |
@@ -0,0 +1,59 @@ | |||
package me.chanjar.weixin.open.bean.ma; | |||
import com.google.gson.annotations.SerializedName; | |||
import lombok.Data; | |||
import me.chanjar.weixin.open.util.json.WxOpenGsonBuilder; | |||
import java.io.Serializable; | |||
/** | |||
* 微信小程序前段API. | |||
* | |||
* @author yqx | |||
* @date 2018/9/13 | |||
*/ | |||
@Data | |||
public class WxOpenMaInterface implements Serializable { | |||
private static final long serialVersionUID = 5144162852271559768L; | |||
@SerializedName("api_name") | |||
private String apiName; | |||
@SerializedName("api_ch_name") | |||
private String apiChName; | |||
@SerializedName("api_desc") | |||
private String apiDesc; | |||
@SerializedName("apply_time") | |||
private Long applyTime; | |||
/** | |||
* 状态码 说明 | |||
* 1 待申请开通 | |||
* 2 无权限 | |||
* 3 申请中 | |||
* 4 申请失败 | |||
* 5 已开通 | |||
*/ | |||
@SerializedName("status") | |||
private Integer status; | |||
@SerializedName("audit_id") | |||
private Long auditId; | |||
@SerializedName("fail_reason") | |||
private String failReason; | |||
@SerializedName("api_link") | |||
private String apiLink; | |||
@SerializedName("group_name") | |||
private String groupName; | |||
@Override | |||
public String toString() { | |||
return WxOpenGsonBuilder.create().toJson(this); | |||
} | |||
} |
@@ -0,0 +1,31 @@ | |||
package me.chanjar.weixin.open.bean.result; | |||
import com.google.gson.annotations.SerializedName; | |||
import lombok.Data; | |||
import lombok.EqualsAndHashCode; | |||
import me.chanjar.weixin.open.bean.ma.WxOpenMaInterface; | |||
import me.chanjar.weixin.open.util.json.WxOpenGsonBuilder; | |||
import java.util.List; | |||
/** | |||
* 微信开放平台小程序前段API.列表返回 | |||
* | |||
* @author yqx | |||
* @date 2018/9/12 | |||
*/ | |||
@Data | |||
@EqualsAndHashCode(callSuper = true) | |||
public class WxOpenMaInterfaceListResult extends WxOpenResult { | |||
private static final long serialVersionUID = 1794866720881151955L; | |||
@SerializedName("interface_list") | |||
List<WxOpenMaInterface> interfaceList; | |||
@Override | |||
public String toString() { | |||
return WxOpenGsonBuilder.create().toJson(this); | |||
} | |||
} |