导航菜单

页面标题

页面副标题

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

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

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


package com.qiniu.rtc;

import com.google.gson.Gson;
import com.qiniu.common.QiniuException;
import com.qiniu.http.Client;
import com.qiniu.http.Response;
import com.qiniu.rtc.model.RoomAccess;
import com.qiniu.util.Auth;

public class RtcRoomManager {
    private final Auth auth;
    private final Client client;
    private Gson gson;
    private final String host;

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

    private String getLink(String str, String str2, String str3) {
        StringBuilder sb = new StringBuilder();
        sb.append(this.host);
        sb.append("/v3/apps/");
        sb.append(str);
        sb.append("/rooms");
        if (str2 != null) {
            sb.append("/");
            sb.append(str2);
            sb.append("/");
        }
        sb.append(str3);
        return sb.toString();
    }

    public String getRoomToken(String str, String str2, String str3, long j8, String str4) throws Exception {
        return this.auth.signRoomToken(this.gson.toJson(new RoomAccess(str, str2, str3, j8, str4)));
    }

    public Response kickUser(String str, String str2, String str3) throws QiniuException {
        String link = getLink(str, str2, "users/" + str3);
        return this.client.delete(link, this.auth.authorizationV2(link, "DELETE", null, null));
    }

    public Response listActiveRooms(String str, String str2, int i8, int i9) throws QiniuException {
        String link = getLink(str, null, "?prefix=" + str2 + "&offset=" + i8 + "&limit=" + i9);
        return this.client.get(link, this.auth.authorizationV2(link));
    }

    public Response listUser(String str, String str2) throws QiniuException {
        String link = getLink(str, str2, "users");
        return this.client.get(link, this.auth.authorizationV2(link));
    }

    public RtcRoomManager(Auth auth, String str) {
        this.auth = auth;
        this.host = str;
        this.client = new Client();
        this.gson = new Gson();
    }
}