Skip to content

Commit ff2840a

Browse files
committed
code cleanup
1 parent 65ac25b commit ff2840a

File tree

2 files changed

+21
-9
lines changed

2 files changed

+21
-9
lines changed

.idea/misc.xml

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/main/kotlin/io/livekit/server/SipServiceClient.kt

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ import java.util.function.Supplier
4040
*/
4141
class SipServiceClient(
4242
private val service: SipService,
43-
private val apiKey: String,
44-
private val secret: String,
43+
apiKey: String,
44+
secret: String,
4545
) : ServiceClientBase(apiKey, secret) {
4646

4747
/**
@@ -50,6 +50,7 @@ class SipServiceClient(
5050
* See: [SIP Inbound Trunk](https://docs.livekit.io/sip/trunk-inbound/)
5151
*/
5252
@JvmOverloads
53+
@Suppress("unused")
5354
fun createSipInboundTrunk(
5455
name: String,
5556
numbers: List<String>,
@@ -82,6 +83,7 @@ class SipServiceClient(
8283
* See: [SIP Outbound Trunk](https://docs.livekit.io/sip/trunk-outbound/)
8384
*/
8485
@JvmOverloads
86+
@Suppress("unused")
8587
fun createSipOutboundTrunk(
8688
name: String,
8789
address: String,
@@ -115,6 +117,7 @@ class SipServiceClient(
115117
* UpdateSIPInboundTrunk updates an existing SIP Inbound Trunk.
116118
*/
117119
@JvmOverloads
120+
@Suppress("unused")
118121
fun updateSipInboundTrunk(
119122
sipTrunkId: String,
120123
options: UpdateSipInboundTrunkOptions? = null
@@ -145,6 +148,7 @@ class SipServiceClient(
145148
* UpdateSIPOutboundTrunk updates an existing SIP Outbound Trunk.
146149
*/
147150
@JvmOverloads
151+
@Suppress("unused")
148152
fun updateSipOutboundTrunk(
149153
sipTrunkId: String,
150154
options: UpdateSipOutboundTrunkOptions? = null,
@@ -178,6 +182,7 @@ class SipServiceClient(
178182
* See: [SIP Inbound Trunk](https://docs.livekit.io/sip/trunk-inbound/)
179183
*/
180184
@JvmOverloads
185+
@Suppress("unused")
181186
fun listSipInboundTrunk(): Call<List<LivekitSip.SIPInboundTrunkInfo>> {
182187
val request = LivekitSip.ListSIPInboundTrunkRequest.newBuilder().build()
183188

@@ -192,6 +197,7 @@ class SipServiceClient(
192197
* See: [SIP Outbound Trunk](https://docs.livekit.io/sip/trunk-outbound/)
193198
*/
194199
@JvmOverloads
200+
@Suppress("unused")
195201
fun listSipOutboundTrunk(): Call<List<LivekitSip.SIPOutboundTrunkInfo>> {
196202
val request = LivekitSip.ListSIPOutboundTrunkRequest.newBuilder().build()
197203

@@ -204,6 +210,7 @@ class SipServiceClient(
204210
* Deletes a trunk.
205211
*/
206212
@JvmOverloads
213+
@Suppress("unused")
207214
fun deleteSipTrunk(sipTrunkId: String): Call<SIPTrunkInfo> {
208215
val request = with(LivekitSip.DeleteSIPTrunkRequest.newBuilder()) {
209216
this.sipTrunkId = sipTrunkId
@@ -220,6 +227,7 @@ class SipServiceClient(
220227
* See: [Dispatch Rules](https://docs.livekit.io/sip/dispatch-rule/)
221228
*/
222229
@JvmOverloads
230+
@Suppress("unused")
223231
fun createSipDispatchRule(
224232
rule: SipDispatchRule,
225233
options: CreateSipDispatchRuleOptions? = null
@@ -261,6 +269,7 @@ class SipServiceClient(
261269
* UpdateSIPDispatchRule updates an existing SIP Dispatch Rule.
262270
*/
263271
@JvmOverloads
272+
@Suppress("unused")
264273
fun updateSipDispatchRule(
265274
sipDispatchRuleId: String,
266275
options: UpdateSipDispatchRuleOptions? = null
@@ -272,21 +281,21 @@ class SipServiceClient(
272281
opt.name?.let { this.name = it }
273282
opt.metadata?.let { this.metadata = it }
274283
opt.trunkIds?.let { this.trunkIds = buildListUpdate(it) }
275-
opt.rule?.let {
284+
opt.rule?.let { optRule ->
276285
this.rule = with(SIPDispatchRule.newBuilder()) {
277-
when (it) {
286+
when (optRule) {
278287
is SipDispatchRuleDirect -> {
279288
dispatchRuleDirect = with(SIPDispatchRuleDirect.newBuilder()) {
280-
roomName = it.roomName
281-
it.pin?.let { this.pin = it }
289+
roomName = optRule.roomName
290+
optRule.pin?.let { this.pin = it }
282291
build()
283292
}
284293
}
285294

286295
is SipDispatchRuleIndividual -> {
287296
dispatchRuleIndividual = with(SIPDispatchRuleIndividual.newBuilder()) {
288-
roomPrefix = it.roomPrefix
289-
it.pin?.let { this.pin = it }
297+
roomPrefix = optRule.roomPrefix
298+
optRule.pin?.let { this.pin = it }
290299
build()
291300
}
292301
}
@@ -309,6 +318,7 @@ class SipServiceClient(
309318
*
310319
* See: [Dispatch Rules](https://docs.livekit.io/sip/dispatch-rule/)
311320
*/
321+
@Suppress("unused")
312322
fun listSipDispatchRule(): Call<List<SIPDispatchRuleInfo>> {
313323
val request = LivekitSip.ListSIPDispatchRuleRequest.newBuilder().build()
314324
val credentials = authHeader(emptyList(), listOf(SIPAdmin()))
@@ -321,6 +331,7 @@ class SipServiceClient(
321331
*
322332
* See: [Dispatch Rules](https://docs.livekit.io/sip/dispatch-rule/)
323333
*/
334+
@Suppress("unused")
324335
fun deleteSipDispatchRule(sipDispatchRuleId: String): Call<SIPDispatchRuleInfo> {
325336
val request = with(LivekitSip.DeleteSIPDispatchRuleRequest.newBuilder()) {
326337
this.sipDispatchRuleId = sipDispatchRuleId
@@ -335,6 +346,7 @@ class SipServiceClient(
335346
*
336347
* See: [SIP Participant](https://docs.livekit.io/sip/sip-participant/)
337348
*/
349+
@Suppress("unused")
338350
fun createSipParticipant(
339351
sipTrunkId: String,
340352
number: String,
@@ -378,6 +390,7 @@ class SipServiceClient(
378390
*
379391
* See: [SIP Participant](https://docs.livekit.io/sip/sip-participant/)
380392
*/
393+
@Suppress("unused")
381394
fun transferSipParticipant(
382395
roomName: String,
383396
participantIdentity: String,

0 commit comments

Comments
 (0)