Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,7 @@ import kotlinx.coroutines.SupervisorJob

public class StytchB2BClient
@JvmOverloads
constructor(
projectId: String,
secret: String,
clientConfig: OptionalClientConfig = OptionalClientConfig(),
) {
constructor(projectId: String, secret: String, clientConfig: OptionalClientConfig = OptionalClientConfig()) {
private val coroutineScope = CoroutineScope(SupervisorJob())
private val baseUrl = getBaseUrl(projectId, clientConfig)
private val httpClient: HttpClient =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,7 @@ internal class IntermediateSessionsImpl(
}

override fun exchangeCompletable(data: ExchangeRequest): CompletableFuture<StytchResult<ExchangeResponse>> =
coroutineScope
.async {
exchange(data)
}.asCompletableFuture()
coroutineScope.async {
exchange(data)
}.asCompletableFuture()
}
Original file line number Diff line number Diff line change
Expand Up @@ -219,10 +219,9 @@ internal class OrganizationsImpl(
}

override fun createCompletable(data: CreateRequest): CompletableFuture<StytchResult<CreateResponse>> =
coroutineScope
.async {
create(data)
}.asCompletableFuture()
coroutineScope.async {
create(data)
}.asCompletableFuture()

override suspend fun list(data: ListRequest): StytchResult<ListResponse> =
withContext(Dispatchers.IO) {
Expand All @@ -242,8 +241,7 @@ internal class OrganizationsImpl(
}

override fun listCompletable(data: ListRequest): CompletableFuture<StytchResult<ListResponse>> =
coroutineScope
.async {
list(data)
}.asCompletableFuture()
coroutineScope.async {
list(data)
}.asCompletableFuture()
}
Original file line number Diff line number Diff line change
Expand Up @@ -213,10 +213,9 @@ internal class OAuthImpl(
}

override fun authorizeStartCompletable(data: AuthorizeStartRequest): CompletableFuture<StytchResult<AuthorizeStartResponse>> =
coroutineScope
.async {
authorizeStart(data)
}.asCompletableFuture()
coroutineScope.async {
authorizeStart(data)
}.asCompletableFuture()

override suspend fun authorize(data: AuthorizeRequest): StytchResult<AuthorizeResponse> =
withContext(Dispatchers.IO) {
Expand All @@ -236,8 +235,7 @@ internal class OAuthImpl(
}

override fun authorizeCompletable(data: AuthorizeRequest): CompletableFuture<StytchResult<AuthorizeResponse>> =
coroutineScope
.async {
authorize(data)
}.asCompletableFuture()
coroutineScope.async {
authorize(data)
}.asCompletableFuture()
}
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,7 @@ internal class ImpersonationImpl(
}

override fun authenticateCompletable(data: AuthenticateRequest): CompletableFuture<StytchResult<AuthenticateResponse>> =
coroutineScope
.async {
authenticate(data)
}.asCompletableFuture()
coroutineScope.async {
authenticate(data)
}.asCompletableFuture()
}
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,7 @@ internal class MagicLinksImpl(
}

override fun authenticateCompletable(data: AuthenticateRequest): CompletableFuture<StytchResult<AuthenticateResponse>> =
coroutineScope
.async {
authenticate(data)
}.asCompletableFuture()
coroutineScope.async {
authenticate(data)
}.asCompletableFuture()
}
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,7 @@ internal class DiscoveryImpl(
}

override fun authenticateCompletable(data: AuthenticateRequest): CompletableFuture<StytchResult<AuthenticateResponse>> =
coroutineScope
.async {
authenticate(data)
}.asCompletableFuture()
coroutineScope.async {
authenticate(data)
}.asCompletableFuture()
}
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,9 @@ internal class EmailImpl(
}

override fun loginOrSignupCompletable(data: LoginOrSignupRequest): CompletableFuture<StytchResult<LoginOrSignupResponse>> =
coroutineScope
.async {
loginOrSignup(data)
}.asCompletableFuture()
coroutineScope.async {
loginOrSignup(data)
}.asCompletableFuture()

override suspend fun invite(
data: InviteRequest,
Expand Down Expand Up @@ -170,8 +169,7 @@ internal class EmailImpl(
data: InviteRequest,
methodOptions: InviteRequestOptions?,
): CompletableFuture<StytchResult<InviteResponse>> =
coroutineScope
.async {
invite(data, methodOptions)
}.asCompletableFuture()
coroutineScope.async {
invite(data, methodOptions)
}.asCompletableFuture()
}
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,7 @@ internal class DiscoveryImpl(
}

override fun sendCompletable(data: SendRequest): CompletableFuture<StytchResult<SendResponse>> =
coroutineScope
.async {
send(data)
}.asCompletableFuture()
coroutineScope.async {
send(data)
}.asCompletableFuture()
}
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,7 @@ internal class OAuthImpl(
}

override fun authenticateCompletable(data: AuthenticateRequest): CompletableFuture<StytchResult<AuthenticateResponse>> =
coroutineScope
.async {
authenticate(data)
}.asCompletableFuture()
coroutineScope.async {
authenticate(data)
}.asCompletableFuture()
}
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,7 @@ internal class DiscoveryImpl(
}

override fun authenticateCompletable(data: AuthenticateRequest): CompletableFuture<StytchResult<AuthenticateResponse>> =
coroutineScope
.async {
authenticate(data)
}.asCompletableFuture()
coroutineScope.async {
authenticate(data)
}.asCompletableFuture()
}
Original file line number Diff line number Diff line change
Expand Up @@ -317,10 +317,9 @@ internal class OrganizationsImpl(
}

override fun createCompletable(data: CreateRequest): CompletableFuture<StytchResult<CreateResponse>> =
coroutineScope
.async {
create(data)
}.asCompletableFuture()
coroutineScope.async {
create(data)
}.asCompletableFuture()

override suspend fun get(data: GetRequest): StytchResult<GetResponse> =
withContext(Dispatchers.IO) {
Expand All @@ -343,10 +342,9 @@ internal class OrganizationsImpl(
}

override fun getCompletable(data: GetRequest): CompletableFuture<StytchResult<GetResponse>> =
coroutineScope
.async {
get(data)
}.asCompletableFuture()
coroutineScope.async {
get(data)
}.asCompletableFuture()

override suspend fun update(
data: UpdateRequest,
Expand Down Expand Up @@ -376,10 +374,9 @@ internal class OrganizationsImpl(
data: UpdateRequest,
methodOptions: UpdateRequestOptions?,
): CompletableFuture<StytchResult<UpdateResponse>> =
coroutineScope
.async {
update(data, methodOptions)
}.asCompletableFuture()
coroutineScope.async {
update(data, methodOptions)
}.asCompletableFuture()

override suspend fun delete(
data: DeleteRequest,
Expand Down Expand Up @@ -408,10 +405,9 @@ internal class OrganizationsImpl(
data: DeleteRequest,
methodOptions: DeleteRequestOptions?,
): CompletableFuture<StytchResult<DeleteResponse>> =
coroutineScope
.async {
delete(data, methodOptions)
}.asCompletableFuture()
coroutineScope.async {
delete(data, methodOptions)
}.asCompletableFuture()

override suspend fun search(data: SearchRequest): StytchResult<SearchResponse> =
withContext(Dispatchers.IO) {
Expand All @@ -431,10 +427,9 @@ internal class OrganizationsImpl(
}

override fun searchCompletable(data: SearchRequest): CompletableFuture<StytchResult<SearchResponse>> =
coroutineScope
.async {
search(data)
}.asCompletableFuture()
coroutineScope.async {
search(data)
}.asCompletableFuture()

override suspend fun metrics(data: MetricsRequest): StytchResult<MetricsResponse> =
withContext(Dispatchers.IO) {
Expand All @@ -457,10 +452,9 @@ internal class OrganizationsImpl(
}

override fun metricsCompletable(data: MetricsRequest): CompletableFuture<StytchResult<MetricsResponse>> =
coroutineScope
.async {
metrics(data)
}.asCompletableFuture()
coroutineScope.async {
metrics(data)
}.asCompletableFuture()

override suspend fun connectedApps(
data: ConnectedAppsRequest,
Expand Down Expand Up @@ -493,10 +487,9 @@ internal class OrganizationsImpl(
data: ConnectedAppsRequest,
methodOptions: ConnectedAppsRequestOptions?,
): CompletableFuture<StytchResult<ConnectedAppsResponse>> =
coroutineScope
.async {
connectedApps(data, methodOptions)
}.asCompletableFuture()
coroutineScope.async {
connectedApps(data, methodOptions)
}.asCompletableFuture()

override suspend fun getConnectedApp(
data: GetConnectedAppRequest,
Expand Down Expand Up @@ -529,10 +522,9 @@ internal class OrganizationsImpl(
data: GetConnectedAppRequest,
methodOptions: GetConnectedAppRequestOptions?,
): CompletableFuture<StytchResult<GetConnectedAppResponse>> =
coroutineScope
.async {
getConnectedApp(data, methodOptions)
}.asCompletableFuture()
coroutineScope.async {
getConnectedApp(data, methodOptions)
}.asCompletableFuture()

override suspend fun deleteExternalId(
data: DeleteExternalIdRequest,
Expand Down Expand Up @@ -561,8 +553,7 @@ internal class OrganizationsImpl(
data: DeleteExternalIdRequest,
methodOptions: DeleteExternalIdRequestOptions?,
): CompletableFuture<StytchResult<DeleteExternalIdResponse>> =
coroutineScope
.async {
deleteExternalId(data, methodOptions)
}.asCompletableFuture()
coroutineScope.async {
deleteExternalId(data, methodOptions)
}.asCompletableFuture()
}
Loading
Loading