All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.i2soft.common.v20240819.Notifications Maven / Gradle / Ivy

The newest version!
package com.i2soft.common.v20240819;

import com.i2soft.http.I2Req;
import com.i2soft.http.I2Rs;
import com.i2soft.http.I2softException;
import com.i2soft.http.Response;
import com.i2soft.common.Auth;
import com.i2soft.util.StringMap;

import java.util.Map;

public final class Notifications {
    /**
     * Auth 对象
     */
    private final Auth auth;

    /**
     * 构建一个新对象
     *
     * @param auth Auth对象
     */
    public Notifications(Auth auth) {
        this.auth = auth;
    }

    /**
     * 消息接收管理-更新更多配置
     *
     * @param args: 参数详见 API 手册
     * @return code, message
     * @throws I2softException:
     */
    public I2Rs.I2SmpRs updateNotifyConf(StringMap args) throws I2softException {
        String url = String.format("%s/sys/settings/notify_conf", auth.cc_url);
        Response r = auth.client.post(url, args);
        return r.jsonToObject(I2Rs.I2SmpRs.class);
    }

    /**
     * 消息接收管理-获取配置
     *
     * @param args: 参数详见 API 手册
     * @return 参数详见 API 手册
     * @throws I2softException:
     */
    public Map listNotifyConf(StringMap args) throws I2softException {
        String url = String.format("%s/sys/settings/notify_conf", auth.cc_url);
        Response r = auth.client.get(url, args);
        return r.jsonToMap();
    }

    /**
     * 消息 添加
     *
     * @param args: 参数详见 API 手册
     * @return code, message
     * @throws I2softException:
     */
    public I2Rs.I2SmpRs addNotifications(StringMap args) throws I2softException {
        String url = String.format("%s/notifications", auth.cc_url);
        Response r = auth.client.post(url, args);
        return r.jsonToObject(I2Rs.I2SmpRs.class);
    }

    /**
     * 消息 列表
     *
     * @param args: 参数详见 API 手册
     * @return 参数详见 API 手册
     * @throws I2softException:
     */
    public Map listNotifications(StringMap args) throws I2softException {
        String url = String.format("%s/notifications", auth.cc_url);
        Response r = auth.client.get(url, args);
        return r.jsonToMap();
    }

    /**
     * 消息 单个
     *
     * @param uuid: uuid
     * @return 参数详见 API 手册
     * @throws I2softException:
     */
    public Map describeNotifications(String uuid) throws I2softException {
        String url = String.format("%s/notifications/%s", auth.cc_url, uuid);
        Response r = auth.client.get(url, new StringMap());
        return r.jsonToMap();
    }

    /**
     * 消息 数量
     *
     * @return 参数详见 API 手册
     * @throws I2softException:
     */
    public Map describeNotificationsCount() throws I2softException {
        String url = String.format("%s/notifications/count", auth.cc_url);
        Response r = auth.client.get(url, new StringMap());
        return r.jsonToMap();
    }

    /**
     * 消息 操作
     *
     * @param args: 参数详见 API 手册
     * @return code, message
     * @throws I2softException:
     */
    public I2Rs.I2SmpRs readNotifications(StringMap args) throws I2softException {
        String url = String.format("%s/notifications/operate", auth.cc_url);
        Response r = auth.client.post(url, args);
        return r.jsonToObject(I2Rs.I2SmpRs.class);
    }

    /**
     * 消息 操作
     *
     * @param args: 参数详见 API 手册
     * @return code, message
     * @throws I2softException:
     */
    public I2Rs.I2SmpRs playNotifications(StringMap args) throws I2softException {
        String url = String.format("%s/notifications/operate", auth.cc_url);
        Response r = auth.client.post(url, args);
        return r.jsonToObject(I2Rs.I2SmpRs.class);
    }

    /**
     * 消息 删除
     *
     * @param args: 参数详见 API 手册
     * @return code, message
     * @throws I2softException:
     */
    public I2Rs.I2SmpRs deleteNotifications(StringMap args) throws I2softException {
        String url = String.format("%s/notifications", auth.cc_url);
        Response r = auth.client.delete(url, args);
        return r.jsonToObject(I2Rs.I2SmpRs.class);
    }

    /**
     * 配置 获取
     *
     * @return 参数详见 API 手册
     * @throws I2softException:
     */
    public Map describeNotificationsConfig() throws I2softException {
        String url = String.format("%s/notifications/config", auth.cc_url);
        Response r = auth.client.get(url, new StringMap());
        return r.jsonToMap();
    }

    /**
     * 配置 更新
     *
     * @param args: 参数详见 API 手册
     * @return code, message
     * @throws I2softException:
     */
    public I2Rs.I2SmpRs updateNotificationsConfig(StringMap args) throws I2softException {
        String url = String.format("%s/notifications/config", auth.cc_url);
        Response r = auth.client.put(url, args);
        return r.jsonToObject(I2Rs.I2SmpRs.class);
    }

    /**
     * 短信测试
     *
     * @param args: 参数详见 API 手册
     * @return code, message
     * @throws I2softException:
     */
    public I2Rs.I2SmpRs testNotificationsSms(StringMap args) throws I2softException {
        String url = String.format("%s/notifications/sms_test", auth.cc_url);
        Response r = auth.client.post(url, args);
        return r.jsonToObject(I2Rs.I2SmpRs.class);
    }

    /**
     * 邮件测试
     *
     * @param args: 参数详见 API 手册
     * @return 参数详见 API 手册
     * @throws I2softException:
     */
    public Map testNotificationsEmail(StringMap args) throws I2softException {
        String url = String.format("%s/notifications/email_test", auth.cc_url);
        Response r = auth.client.get(url, args);
        return r.jsonToMap();
    }

    /**
     * 重置通知次数
     *
     * @return 参数详见 API 手册
     * @throws I2softException:
     */
    public Map resetNotificationsTimes() throws I2softException {
        String url = String.format("%s/notifications/reset_notify_times", auth.cc_url);
        Response r = auth.client.get(url, new StringMap());
        return r.jsonToMap();
    }

    /**
     * 邮件模板 列表
     *
     * @param args: 参数详见 API 手册
     * @return 参数详见 API 手册
     * @throws I2softException:
     */
    public Map listEmailTemplate(StringMap args) throws I2softException {
        String url = String.format("%s/notifications/template", auth.cc_url);
        Response r = auth.client.get(url, args);
        return r.jsonToMap();
    }

    /**
     * 邮件模板 修改
     *
     * @param uuid: uuid
     * @param args: 参数详见 API 手册
     * @return 参数详见 API 手册
     * @throws I2softException:
     */
    public Map modifyEmailTemplate(String uuid, StringMap args) throws I2softException {
        String url = String.format("%s/notifications/template/%s", auth.cc_url, uuid);
        Response r = auth.client.put(url, args);
        return r.jsonToMap();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy