NIMSDK-AOS  9.19.0
CallParamBuilder.java
浏览该文件的文档.
1 package com.netease.nimlib.sdk.avsignalling.builder;
2 
3 import android.text.TextUtils;
4 import com.netease.nimlib.avsignalling.model.DirectCallParam;
7 
8 
9 /**
10  * 直接呼叫对方参数构建帮助类
11  */
12 public class CallParamBuilder {
13 
14  private ChannelType channelType;
15  private String accountId;
16  private String requestId;
17 
18 
19  private String channelName;
20  private String channelExt;
21  private long selfUid;
22  private boolean offlineEnable;
23  private String customInfo;
24  private SignallingPushConfig pushConfig;
25  private String nertcChannelName;
26  private Long nertcTokenTtl;
27 
28 
29  /***
30  * @param channelType 频道类型
31  * @param accountId 对方的accid
32  * @param requestId 邀请id ,发起邀请者自行生成(要保证唯一性)
33  */
34  public CallParamBuilder(ChannelType channelType, String accountId, String requestId) {
35  this.channelType = channelType;
36  this.accountId = accountId;
37  this.requestId = requestId;
38  }
39 
40  /**
41  * 指定频道名
42  */
43  public CallParamBuilder channelName(String channelName) {
44  this.channelName = channelName;
45  return this;
46  }
47 
48  /**
49  * 指定频道扩展字段
50  */
51  public CallParamBuilder channelExt(String channelExt) {
52  this.channelExt = channelExt;
53  return this;
54  }
55 
56  /**
57  * 指定自己的uid , 不指定的话,服务端会自动生成。如果指定请保持维一性
58  */
59  public CallParamBuilder selfUid(long selfUid) {
60  this.selfUid = selfUid;
61  return this;
62  }
63 
64  /**
65  * 相应的通知是否存离线
66  */
68  this.offlineEnable = offlineEnabled;
69  return this;
70  }
71 
72  /**
73  * 邀请者附加的自定义信息,透传给被邀请者
74  */
75  public CallParamBuilder customInfo(String customInfo) {
76  this.customInfo = customInfo;
77  return this;
78  }
79 
80  /**
81  * 推送配置
82  */
84  this.pushConfig = pushConfig;
85  return this;
86  }
87 
88  /**
89  * 云信G2-RTC的房间名
90  * @param nertcChannelName 如果填了该字段,则会返回token
91  * @return
92  */
93  public CallParamBuilder nertcChannelName(String nertcChannelName) {
94  this.nertcChannelName = nertcChannelName;
95  return this;
96  }
97 
98  /**
99  * 云信G2-RTC的token的有效期
100  * @param nertcTokenTtl 过期时间,单位秒,选填,默认10分钟
101  * @return
102  */
103  public CallParamBuilder nertcTokenTtl(Long nertcTokenTtl) {
104  this.nertcTokenTtl = nertcTokenTtl;
105  return this;
106  }
107 
108  public DirectCallParam build() {
109  if (channelType == null || TextUtils.isEmpty(accountId) || TextUtils.isEmpty(requestId)) {
110  throw new IllegalArgumentException("CallParamBuilder illegal , (channelType , accountId , requestId) parameters must not null");
111  }
112 
113  return new DirectCallParam(channelType, accountId, requestId, channelName, channelExt, selfUid, offlineEnable, customInfo, pushConfig,nertcChannelName,nertcTokenTtl);
114  }
115 
116 
117 }
CallParamBuilder nertcTokenTtl(Long nertcTokenTtl)
云信G2-RTC的token的有效期
CallParamBuilder offlineEnabled(boolean offlineEnabled)
相应的通知是否存离线
CallParamBuilder channelExt(String channelExt)
指定频道扩展字段
CallParamBuilder nertcChannelName(String nertcChannelName)
云信G2-RTC的房间名
CallParamBuilder customInfo(String customInfo)
邀请者附加的自定义信息,透传给被邀请者
CallParamBuilder selfUid(long selfUid)
指定自己的uid , 不指定的话,服务端会自动生成。如果指定请保持维一性
CallParamBuilder pushConfig(SignallingPushConfig pushConfig)
推送配置
CallParamBuilder channelName(String channelName)
指定频道名
CallParamBuilder(ChannelType channelType, String accountId, String requestId)