NIMSDK-AOS  9.19.0
InviteParamBuilder.java
浏览该文件的文档.
1 package com.netease.nimlib.sdk.avsignalling.builder;
2 
3 import android.text.TextUtils;
4 
5 import com.netease.nimlib.avsignalling.model.InviteParam;
9 
10 /**
11  * 构造邀请相关操作的参数 ,其中channelId、accountId、requestId 这3个参数必须设置
12  */
13 public class InviteParamBuilder {
14 
15  private String channelId;
16  private String accountId;
17  private String requestId;
18  private String customInfo;
19  private SignallingPushConfig pushConfig;
20  private boolean offlineEnabled;
21 
22  /**
23  * @param channelId 频道id
24  * @param accountId 对方帐号id。
25  * eg : 邀请与取消邀请时填被邀请人id ,拒绝邀请与接受邀请时填邀请人id
26  * @param requestId 对本次邀请的唯一标识。<br/>
27  * 发起邀请者需要自行生成(要保证唯一性,不同的邀不能用同一个id),取消邀请时需要传入同一个requestId。<br/>
28  * 对于接收方 , requestId可以在收到相应通知时获取,参考{@link InvitedEvent#getRequestId()}和{@link CanceledInviteEvent#getRequestId()}
29  */
30  public InviteParamBuilder(String channelId, String accountId, String requestId) {
31  this.channelId = channelId;
32  this.accountId = accountId;
33  this.requestId = requestId;
34  }
35 
36  /**
37  * @param customInfo 自定义扩展字段,透传给接收方
38  * @return InviteParamBuilder
39  */
40  public InviteParamBuilder customInfo(String customInfo) {
41  this.customInfo = customInfo;
42  return this;
43  }
44 
45  /**
46  * @param signallingPushConfig 推送配置 ,仅在发出邀请时有效
47  * @return InviteParamBuilder
48  */
49  public InviteParamBuilder pushConfig(SignallingPushConfig signallingPushConfig) {
50  this.pushConfig = signallingPushConfig;
51  return this;
52  }
53 
54  /**
55  * @param offlineEnabled 相应的通知事件是否存离线 , 默认不离线
56  * @return InviteParamBuilder
57  */
58  public InviteParamBuilder offlineEnabled(boolean offlineEnabled) {
59  this.offlineEnabled = offlineEnabled;
60  return this;
61  }
62 
63  public InviteParam build() {
64  if (TextUtils.isEmpty(channelId) || TextUtils.isEmpty(accountId) || TextUtils.isEmpty(requestId)) {
65  throw new IllegalArgumentException("InviteParamBuilder illegal , (channelId , accountId , requestId) parameters must not null");
66  }
67  return new InviteParam(channelId, accountId, requestId, customInfo, offlineEnabled, pushConfig);
68  }
69 
70 
71 }
72 
InviteParamBuilder offlineEnabled(boolean offlineEnabled)
InviteParamBuilder(String channelId, String accountId, String requestId)
InviteParamBuilder pushConfig(SignallingPushConfig signallingPushConfig)
构造邀请相关操作的参数 ,其中channelId、accountId、requestId 这3个参数必须设置