com.pexip.sdk.api.infinity.internal.ConferenceStepImpl.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of sdk-api Show documentation
Show all versions of sdk-api Show documentation
A set of common classes and interfaces to build APIs.
The newest version!
/*
* Copyright 2022-2024 Pexip AS
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.pexip.sdk.api.infinity.internal
import com.pexip.sdk.api.Call
import com.pexip.sdk.api.EventSourceFactory
import com.pexip.sdk.api.infinity.IllegalLayoutTransformException
import com.pexip.sdk.api.infinity.InfinityService
import com.pexip.sdk.api.infinity.InvalidPinException
import com.pexip.sdk.api.infinity.InvalidTokenException
import com.pexip.sdk.api.infinity.MessageRequest
import com.pexip.sdk.api.infinity.NoSuchConferenceException
import com.pexip.sdk.api.infinity.NoSuchNodeException
import com.pexip.sdk.api.infinity.RefreshTokenResponse
import com.pexip.sdk.api.infinity.RequestTokenRequest
import com.pexip.sdk.api.infinity.RequestTokenResponse
import com.pexip.sdk.api.infinity.RequiredPinException
import com.pexip.sdk.api.infinity.RequiredSsoException
import com.pexip.sdk.api.infinity.SetGuestCanUnmuteRequest
import com.pexip.sdk.api.infinity.SplashScreenResponse
import com.pexip.sdk.api.infinity.SsoRedirectException
import com.pexip.sdk.api.infinity.Token
import com.pexip.sdk.api.infinity.TransformLayoutRequest
import com.pexip.sdk.infinity.BreakoutId
import com.pexip.sdk.infinity.LayoutId
import com.pexip.sdk.infinity.ParticipantId
import kotlinx.serialization.DeserializationStrategy
import kotlinx.serialization.SerializationException
import okhttp3.Request
import okhttp3.Response
internal class ConferenceStepImpl(
override val requestBuilder: RequestBuilderImpl,
override val conferenceAlias: String,
) : InfinityService.ConferenceStep,
ConferenceStepImplScope,
RequestBuilderImplScope by requestBuilder {
override fun requestToken(request: RequestTokenRequest): Call = RealCall(
client = client,
request = Request.Builder()
.post(json.encodeToRequestBody(request))
.url(url) {
conference(conferenceAlias)
addPathSegment("request_token")
}
.withTag(request.directMedia)
.build(),
mapper = ::parseRequestToken,
)
override fun requestToken(
request: RequestTokenRequest,
pin: String,
): Call = RealCall(
client = client,
request = Request.Builder()
.post(json.encodeToRequestBody(request))
.url(url) {
conference(conferenceAlias)
addPathSegment("request_token")
}
.withTag(request.directMedia)
.header("pin", if (pin.isBlank()) "none" else pin.trim())
.build(),
mapper = ::parseRequestToken,
)
override fun refreshToken(token: Token): Call = RealCall(
client = client,
request = Request.Builder()
.post(EMPTY_REQUEST)
.url(url) {
conference(conferenceAlias)
addPathSegment("refresh_token")
}
.token(token)
.build(),
mapper = { parse(it, RefreshTokenResponseSerializer) },
)
override fun releaseToken(token: Token): Call = RealCall(
client = client,
request = Request.Builder()
.post(EMPTY_REQUEST)
.url(url) {
conference(conferenceAlias)
addPathSegment("release_token")
}
.token(token)
.build(),
mapper = { parse(it, BooleanSerializer) },
)
override fun message(request: MessageRequest, token: Token): Call = RealCall(
client = client,
request = Request.Builder()
.post(json.encodeToRequestBody(request))
.url(url) {
conference(conferenceAlias)
addPathSegment("message")
}
.token(token)
.build(),
mapper = { parse(it, BooleanSerializer) },
)
override fun availableLayouts(token: Token): Call> = RealCall(
client = client,
request = Request.Builder()
.get()
.url(url) {
conference(conferenceAlias)
addPathSegment("available_layouts")
}
.token(token)
.build(),
mapper = { parse(it, AvailableLayoutsSerializer) },
)
override fun layoutSvgs(token: Token): Call
© 2015 - 2024 Weber Informatics LLC | Privacy Policy