导航菜单

页面标题

页面副标题

新暖心缘 v8.1.1 - RtcAppManager.java 源代码

正在查看: 新暖心缘 v8.1.1 应用的 RtcAppManager.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package com.qiniu.rtc;

import com.qiniu.common.Constants;
import com.qiniu.common.QiniuException;
import com.qiniu.http.Client;
import com.qiniu.http.Response;
import com.qiniu.util.Auth;
import com.qiniu.util.Json;
import com.qiniu.util.StringMap;

public class RtcAppManager {
    private final Auth auth;
    private final Client client;
    private final String host;
    private StringMap params;

    public RtcAppManager(Auth auth) {
        this(auth, "http://rtc.qiniuapi.com");
    }

    public Response createApp(String str, String str2, int i8, boolean z7) throws QiniuException {
        if (str != null) {
            this.params.put("hub", str);
        }
        if (str2 != null) {
            this.params.put("title", str2);
        }
        if (str != null) {
            this.params.put("maxUsers", Integer.valueOf(i8));
        }
        this.params.put("noAutoKickUser", Boolean.valueOf(z7));
        String format = String.format("%s%s", this.host, "/v3/apps");
        byte[] bytes = Json.encode(this.params).getBytes(Constants.UTF_8);
        return this.client.post(format, bytes, this.auth.authorizationV2(format, "POST", bytes, "application/json"), "application/json");
    }

    public Response deleteApp(String str) throws QiniuException {
        String format = String.format("%s%s%s", this.host, "/v3/apps/", str);
        return this.client.delete(format, this.auth.authorizationV2(format, "DELETE", null, null));
    }

    public Response getApp(String str) throws QiniuException {
        String format = String.format("%s%s%s", this.host, "/v3/apps/", str);
        return this.client.get(format, this.auth.authorizationV2(format));
    }

    public Response updateApp(String str, String str2, String str3, int i8, boolean z7) throws QiniuException {
        if (str2 != null) {
            this.params.put("hub", str2);
        }
        if (str3 != null) {
            this.params.put("title", str3);
        }
        if (str2 != null) {
            this.params.put("maxUsers", Integer.valueOf(i8));
        }
        this.params.put("noAutoKickUser", Boolean.valueOf(z7));
        String format = String.format("%s%s%s", this.host, "/v3/apps/", str);
        byte[] bytes = Json.encode(this.params).getBytes(Constants.UTF_8);
        return this.client.post(format, bytes, this.auth.authorizationV2(format, "POST", bytes, "application/json"), "application/json");
    }

    public RtcAppManager(Auth auth, String str) {
        this.auth = auth;
        this.host = str;
        this.client = new Client();
        this.params = new StringMap();
    }

    public RtcAppManager(Auth auth, String str, Client client) {
        this.auth = auth;
        this.host = str;
        this.client = client;
        this.params = new StringMap();
    }
}