diff --git a/stytch/src/main/kotlin/com/stytch/java/b2b/StytchB2BClient.kt b/stytch/src/main/kotlin/com/stytch/java/b2b/StytchB2BClient.kt index d0f6e010..95341d00 100644 --- a/stytch/src/main/kotlin/com/stytch/java/b2b/StytchB2BClient.kt +++ b/stytch/src/main/kotlin/com/stytch/java/b2b/StytchB2BClient.kt @@ -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 = diff --git a/stytch/src/main/kotlin/com/stytch/java/b2b/api/discoveryintermediatesessions/DiscoveryIntermediateSessions.kt b/stytch/src/main/kotlin/com/stytch/java/b2b/api/discoveryintermediatesessions/DiscoveryIntermediateSessions.kt index 71ba32a0..a8d0fb32 100644 --- a/stytch/src/main/kotlin/com/stytch/java/b2b/api/discoveryintermediatesessions/DiscoveryIntermediateSessions.kt +++ b/stytch/src/main/kotlin/com/stytch/java/b2b/api/discoveryintermediatesessions/DiscoveryIntermediateSessions.kt @@ -145,8 +145,7 @@ internal class IntermediateSessionsImpl( } override fun exchangeCompletable(data: ExchangeRequest): CompletableFuture> = - coroutineScope - .async { - exchange(data) - }.asCompletableFuture() + coroutineScope.async { + exchange(data) + }.asCompletableFuture() } diff --git a/stytch/src/main/kotlin/com/stytch/java/b2b/api/discoveryorganizations/DiscoveryOrganizations.kt b/stytch/src/main/kotlin/com/stytch/java/b2b/api/discoveryorganizations/DiscoveryOrganizations.kt index f9bf29f3..c6babf48 100644 --- a/stytch/src/main/kotlin/com/stytch/java/b2b/api/discoveryorganizations/DiscoveryOrganizations.kt +++ b/stytch/src/main/kotlin/com/stytch/java/b2b/api/discoveryorganizations/DiscoveryOrganizations.kt @@ -219,10 +219,9 @@ internal class OrganizationsImpl( } override fun createCompletable(data: CreateRequest): CompletableFuture> = - coroutineScope - .async { - create(data) - }.asCompletableFuture() + coroutineScope.async { + create(data) + }.asCompletableFuture() override suspend fun list(data: ListRequest): StytchResult = withContext(Dispatchers.IO) { @@ -242,8 +241,7 @@ internal class OrganizationsImpl( } override fun listCompletable(data: ListRequest): CompletableFuture> = - coroutineScope - .async { - list(data) - }.asCompletableFuture() + coroutineScope.async { + list(data) + }.asCompletableFuture() } diff --git a/stytch/src/main/kotlin/com/stytch/java/b2b/api/idpoauth/IDPOAuth.kt b/stytch/src/main/kotlin/com/stytch/java/b2b/api/idpoauth/IDPOAuth.kt index bc774532..52fc8904 100644 --- a/stytch/src/main/kotlin/com/stytch/java/b2b/api/idpoauth/IDPOAuth.kt +++ b/stytch/src/main/kotlin/com/stytch/java/b2b/api/idpoauth/IDPOAuth.kt @@ -213,10 +213,9 @@ internal class OAuthImpl( } override fun authorizeStartCompletable(data: AuthorizeStartRequest): CompletableFuture> = - coroutineScope - .async { - authorizeStart(data) - }.asCompletableFuture() + coroutineScope.async { + authorizeStart(data) + }.asCompletableFuture() override suspend fun authorize(data: AuthorizeRequest): StytchResult = withContext(Dispatchers.IO) { @@ -236,8 +235,7 @@ internal class OAuthImpl( } override fun authorizeCompletable(data: AuthorizeRequest): CompletableFuture> = - coroutineScope - .async { - authorize(data) - }.asCompletableFuture() + coroutineScope.async { + authorize(data) + }.asCompletableFuture() } diff --git a/stytch/src/main/kotlin/com/stytch/java/b2b/api/impersonation/Impersonation.kt b/stytch/src/main/kotlin/com/stytch/java/b2b/api/impersonation/Impersonation.kt index 2b26b137..31bbcde6 100644 --- a/stytch/src/main/kotlin/com/stytch/java/b2b/api/impersonation/Impersonation.kt +++ b/stytch/src/main/kotlin/com/stytch/java/b2b/api/impersonation/Impersonation.kt @@ -82,8 +82,7 @@ internal class ImpersonationImpl( } override fun authenticateCompletable(data: AuthenticateRequest): CompletableFuture> = - coroutineScope - .async { - authenticate(data) - }.asCompletableFuture() + coroutineScope.async { + authenticate(data) + }.asCompletableFuture() } diff --git a/stytch/src/main/kotlin/com/stytch/java/b2b/api/magiclinks/MagicLinks.kt b/stytch/src/main/kotlin/com/stytch/java/b2b/api/magiclinks/MagicLinks.kt index 103a6a3c..42252c39 100644 --- a/stytch/src/main/kotlin/com/stytch/java/b2b/api/magiclinks/MagicLinks.kt +++ b/stytch/src/main/kotlin/com/stytch/java/b2b/api/magiclinks/MagicLinks.kt @@ -129,8 +129,7 @@ internal class MagicLinksImpl( } override fun authenticateCompletable(data: AuthenticateRequest): CompletableFuture> = - coroutineScope - .async { - authenticate(data) - }.asCompletableFuture() + coroutineScope.async { + authenticate(data) + }.asCompletableFuture() } diff --git a/stytch/src/main/kotlin/com/stytch/java/b2b/api/magiclinksdiscovery/MagicLinksDiscovery.kt b/stytch/src/main/kotlin/com/stytch/java/b2b/api/magiclinksdiscovery/MagicLinksDiscovery.kt index 58b55eda..98a65eb2 100644 --- a/stytch/src/main/kotlin/com/stytch/java/b2b/api/magiclinksdiscovery/MagicLinksDiscovery.kt +++ b/stytch/src/main/kotlin/com/stytch/java/b2b/api/magiclinksdiscovery/MagicLinksDiscovery.kt @@ -67,8 +67,7 @@ internal class DiscoveryImpl( } override fun authenticateCompletable(data: AuthenticateRequest): CompletableFuture> = - coroutineScope - .async { - authenticate(data) - }.asCompletableFuture() + coroutineScope.async { + authenticate(data) + }.asCompletableFuture() } diff --git a/stytch/src/main/kotlin/com/stytch/java/b2b/api/magiclinksemail/MagicLinksEmail.kt b/stytch/src/main/kotlin/com/stytch/java/b2b/api/magiclinksemail/MagicLinksEmail.kt index fe9bd68c..8b86b01c 100644 --- a/stytch/src/main/kotlin/com/stytch/java/b2b/api/magiclinksemail/MagicLinksEmail.kt +++ b/stytch/src/main/kotlin/com/stytch/java/b2b/api/magiclinksemail/MagicLinksEmail.kt @@ -137,10 +137,9 @@ internal class EmailImpl( } override fun loginOrSignupCompletable(data: LoginOrSignupRequest): CompletableFuture> = - coroutineScope - .async { - loginOrSignup(data) - }.asCompletableFuture() + coroutineScope.async { + loginOrSignup(data) + }.asCompletableFuture() override suspend fun invite( data: InviteRequest, @@ -170,8 +169,7 @@ internal class EmailImpl( data: InviteRequest, methodOptions: InviteRequestOptions?, ): CompletableFuture> = - coroutineScope - .async { - invite(data, methodOptions) - }.asCompletableFuture() + coroutineScope.async { + invite(data, methodOptions) + }.asCompletableFuture() } diff --git a/stytch/src/main/kotlin/com/stytch/java/b2b/api/magiclinksemaildiscovery/MagicLinksEmailDiscovery.kt b/stytch/src/main/kotlin/com/stytch/java/b2b/api/magiclinksemaildiscovery/MagicLinksEmailDiscovery.kt index 91a7351d..318226ab 100644 --- a/stytch/src/main/kotlin/com/stytch/java/b2b/api/magiclinksemaildiscovery/MagicLinksEmailDiscovery.kt +++ b/stytch/src/main/kotlin/com/stytch/java/b2b/api/magiclinksemaildiscovery/MagicLinksEmailDiscovery.kt @@ -64,8 +64,7 @@ internal class DiscoveryImpl( } override fun sendCompletable(data: SendRequest): CompletableFuture> = - coroutineScope - .async { - send(data) - }.asCompletableFuture() + coroutineScope.async { + send(data) + }.asCompletableFuture() } diff --git a/stytch/src/main/kotlin/com/stytch/java/b2b/api/oauth/OAuth.kt b/stytch/src/main/kotlin/com/stytch/java/b2b/api/oauth/OAuth.kt index 94a31615..beccc3f4 100644 --- a/stytch/src/main/kotlin/com/stytch/java/b2b/api/oauth/OAuth.kt +++ b/stytch/src/main/kotlin/com/stytch/java/b2b/api/oauth/OAuth.kt @@ -148,8 +148,7 @@ internal class OAuthImpl( } override fun authenticateCompletable(data: AuthenticateRequest): CompletableFuture> = - coroutineScope - .async { - authenticate(data) - }.asCompletableFuture() + coroutineScope.async { + authenticate(data) + }.asCompletableFuture() } diff --git a/stytch/src/main/kotlin/com/stytch/java/b2b/api/oauthdiscovery/OAuthDiscovery.kt b/stytch/src/main/kotlin/com/stytch/java/b2b/api/oauthdiscovery/OAuthDiscovery.kt index 6cda22a6..6beaf325 100644 --- a/stytch/src/main/kotlin/com/stytch/java/b2b/api/oauthdiscovery/OAuthDiscovery.kt +++ b/stytch/src/main/kotlin/com/stytch/java/b2b/api/oauthdiscovery/OAuthDiscovery.kt @@ -67,8 +67,7 @@ internal class DiscoveryImpl( } override fun authenticateCompletable(data: AuthenticateRequest): CompletableFuture> = - coroutineScope - .async { - authenticate(data) - }.asCompletableFuture() + coroutineScope.async { + authenticate(data) + }.asCompletableFuture() } diff --git a/stytch/src/main/kotlin/com/stytch/java/b2b/api/organizations/Organizations.kt b/stytch/src/main/kotlin/com/stytch/java/b2b/api/organizations/Organizations.kt index a648654d..183edaea 100644 --- a/stytch/src/main/kotlin/com/stytch/java/b2b/api/organizations/Organizations.kt +++ b/stytch/src/main/kotlin/com/stytch/java/b2b/api/organizations/Organizations.kt @@ -16,6 +16,9 @@ import com.stytch.java.b2b.models.organizations.ConnectedAppsRequestOptions import com.stytch.java.b2b.models.organizations.ConnectedAppsResponse import com.stytch.java.b2b.models.organizations.CreateRequest import com.stytch.java.b2b.models.organizations.CreateResponse +import com.stytch.java.b2b.models.organizations.DeleteExternalIdRequest +import com.stytch.java.b2b.models.organizations.DeleteExternalIdRequestOptions +import com.stytch.java.b2b.models.organizations.DeleteExternalIdResponse import com.stytch.java.b2b.models.organizations.DeleteRequest import com.stytch.java.b2b.models.organizations.DeleteRequestOptions import com.stytch.java.b2b.models.organizations.DeleteResponse @@ -270,6 +273,22 @@ public interface Organizations { data: GetConnectedAppRequest, methodOptions: GetConnectedAppRequestOptions? = null, ): CompletableFuture> + + public suspend fun deleteExternalId( + data: DeleteExternalIdRequest, + methodOptions: DeleteExternalIdRequestOptions? = null, + ): StytchResult + + public fun deleteExternalId( + data: DeleteExternalIdRequest, + methodOptions: DeleteExternalIdRequestOptions? = null, + callback: (StytchResult) -> Unit, + ) + + public fun deleteExternalIdCompletable( + data: DeleteExternalIdRequest, + methodOptions: DeleteExternalIdRequestOptions? = null, + ): CompletableFuture> } internal class OrganizationsImpl( @@ -298,10 +317,9 @@ internal class OrganizationsImpl( } override fun createCompletable(data: CreateRequest): CompletableFuture> = - coroutineScope - .async { - create(data) - }.asCompletableFuture() + coroutineScope.async { + create(data) + }.asCompletableFuture() override suspend fun get(data: GetRequest): StytchResult = withContext(Dispatchers.IO) { @@ -324,10 +342,9 @@ internal class OrganizationsImpl( } override fun getCompletable(data: GetRequest): CompletableFuture> = - coroutineScope - .async { - get(data) - }.asCompletableFuture() + coroutineScope.async { + get(data) + }.asCompletableFuture() override suspend fun update( data: UpdateRequest, @@ -357,10 +374,9 @@ internal class OrganizationsImpl( data: UpdateRequest, methodOptions: UpdateRequestOptions?, ): CompletableFuture> = - coroutineScope - .async { - update(data, methodOptions) - }.asCompletableFuture() + coroutineScope.async { + update(data, methodOptions) + }.asCompletableFuture() override suspend fun delete( data: DeleteRequest, @@ -389,10 +405,9 @@ internal class OrganizationsImpl( data: DeleteRequest, methodOptions: DeleteRequestOptions?, ): CompletableFuture> = - coroutineScope - .async { - delete(data, methodOptions) - }.asCompletableFuture() + coroutineScope.async { + delete(data, methodOptions) + }.asCompletableFuture() override suspend fun search(data: SearchRequest): StytchResult = withContext(Dispatchers.IO) { @@ -412,10 +427,9 @@ internal class OrganizationsImpl( } override fun searchCompletable(data: SearchRequest): CompletableFuture> = - coroutineScope - .async { - search(data) - }.asCompletableFuture() + coroutineScope.async { + search(data) + }.asCompletableFuture() override suspend fun metrics(data: MetricsRequest): StytchResult = withContext(Dispatchers.IO) { @@ -438,10 +452,9 @@ internal class OrganizationsImpl( } override fun metricsCompletable(data: MetricsRequest): CompletableFuture> = - coroutineScope - .async { - metrics(data) - }.asCompletableFuture() + coroutineScope.async { + metrics(data) + }.asCompletableFuture() override suspend fun connectedApps( data: ConnectedAppsRequest, @@ -474,10 +487,9 @@ internal class OrganizationsImpl( data: ConnectedAppsRequest, methodOptions: ConnectedAppsRequestOptions?, ): CompletableFuture> = - coroutineScope - .async { - connectedApps(data, methodOptions) - }.asCompletableFuture() + coroutineScope.async { + connectedApps(data, methodOptions) + }.asCompletableFuture() override suspend fun getConnectedApp( data: GetConnectedAppRequest, @@ -510,8 +522,38 @@ internal class OrganizationsImpl( data: GetConnectedAppRequest, methodOptions: GetConnectedAppRequestOptions?, ): CompletableFuture> = - coroutineScope - .async { - getConnectedApp(data, methodOptions) - }.asCompletableFuture() + coroutineScope.async { + getConnectedApp(data, methodOptions) + }.asCompletableFuture() + + override suspend fun deleteExternalId( + data: DeleteExternalIdRequest, + methodOptions: DeleteExternalIdRequestOptions?, + ): StytchResult = + withContext(Dispatchers.IO) { + var headers = emptyMap() + methodOptions?.let { + headers = methodOptions.addHeaders(headers) + } + + httpClient.delete("/v1/b2b/organizations/${data.organizationId}/external_id", headers) + } + + override fun deleteExternalId( + data: DeleteExternalIdRequest, + methodOptions: DeleteExternalIdRequestOptions?, + callback: (StytchResult) -> Unit, + ) { + coroutineScope.launch { + callback(deleteExternalId(data, methodOptions)) + } + } + + override fun deleteExternalIdCompletable( + data: DeleteExternalIdRequest, + methodOptions: DeleteExternalIdRequestOptions?, + ): CompletableFuture> = + coroutineScope.async { + deleteExternalId(data, methodOptions) + }.asCompletableFuture() } diff --git a/stytch/src/main/kotlin/com/stytch/java/b2b/api/organizationsmembers/OrganizationsMembers.kt b/stytch/src/main/kotlin/com/stytch/java/b2b/api/organizationsmembers/OrganizationsMembers.kt index 4a6a9d52..738363c6 100644 --- a/stytch/src/main/kotlin/com/stytch/java/b2b/api/organizationsmembers/OrganizationsMembers.kt +++ b/stytch/src/main/kotlin/com/stytch/java/b2b/api/organizationsmembers/OrganizationsMembers.kt @@ -17,6 +17,9 @@ import com.stytch.java.b2b.models.organizationsmembers.CreateRequest import com.stytch.java.b2b.models.organizationsmembers.CreateRequestOptions import com.stytch.java.b2b.models.organizationsmembers.CreateResponse import com.stytch.java.b2b.models.organizationsmembers.DangerouslyGetRequest +import com.stytch.java.b2b.models.organizationsmembers.DeleteExternalIdRequest +import com.stytch.java.b2b.models.organizationsmembers.DeleteExternalIdRequestOptions +import com.stytch.java.b2b.models.organizationsmembers.DeleteExternalIdResponse import com.stytch.java.b2b.models.organizationsmembers.DeleteMFAPhoneNumberRequest import com.stytch.java.b2b.models.organizationsmembers.DeleteMFAPhoneNumberRequestOptions import com.stytch.java.b2b.models.organizationsmembers.DeleteMFAPhoneNumberResponse @@ -566,6 +569,22 @@ public interface Members { methodOptions: GetConnectedAppsRequestOptions? = null, ): CompletableFuture> + public suspend fun deleteExternalId( + data: DeleteExternalIdRequest, + methodOptions: DeleteExternalIdRequestOptions? = null, + ): StytchResult + + public fun deleteExternalId( + data: DeleteExternalIdRequest, + methodOptions: DeleteExternalIdRequestOptions? = null, + callback: (StytchResult) -> Unit, + ) + + public fun deleteExternalIdCompletable( + data: DeleteExternalIdRequest, + methodOptions: DeleteExternalIdRequestOptions? = null, + ): CompletableFuture> + /** * Creates a Member. An `organization_id` and `email_address` are required. */ @@ -647,10 +666,9 @@ internal class MembersImpl( data: UpdateRequest, methodOptions: UpdateRequestOptions?, ): CompletableFuture> = - coroutineScope - .async { - update(data, methodOptions) - }.asCompletableFuture() + coroutineScope.async { + update(data, methodOptions) + }.asCompletableFuture() override suspend fun delete( data: DeleteRequest, @@ -679,10 +697,9 @@ internal class MembersImpl( data: DeleteRequest, methodOptions: DeleteRequestOptions?, ): CompletableFuture> = - coroutineScope - .async { - delete(data, methodOptions) - }.asCompletableFuture() + coroutineScope.async { + delete(data, methodOptions) + }.asCompletableFuture() override suspend fun reactivate( data: ReactivateRequest, @@ -712,10 +729,9 @@ internal class MembersImpl( data: ReactivateRequest, methodOptions: ReactivateRequestOptions?, ): CompletableFuture> = - coroutineScope - .async { - reactivate(data, methodOptions) - }.asCompletableFuture() + coroutineScope.async { + reactivate(data, methodOptions) + }.asCompletableFuture() override suspend fun deleteMFAPhoneNumber( data: DeleteMFAPhoneNumberRequest, @@ -744,10 +760,9 @@ internal class MembersImpl( data: DeleteMFAPhoneNumberRequest, methodOptions: DeleteMFAPhoneNumberRequestOptions?, ): CompletableFuture> = - coroutineScope - .async { - deleteMFAPhoneNumber(data, methodOptions) - }.asCompletableFuture() + coroutineScope.async { + deleteMFAPhoneNumber(data, methodOptions) + }.asCompletableFuture() override suspend fun deleteTOTP( data: DeleteTOTPRequest, @@ -776,10 +791,9 @@ internal class MembersImpl( data: DeleteTOTPRequest, methodOptions: DeleteTOTPRequestOptions?, ): CompletableFuture> = - coroutineScope - .async { - deleteTOTP(data, methodOptions) - }.asCompletableFuture() + coroutineScope.async { + deleteTOTP(data, methodOptions) + }.asCompletableFuture() override suspend fun search( data: SearchRequest, @@ -809,10 +823,9 @@ internal class MembersImpl( data: SearchRequest, methodOptions: SearchRequestOptions?, ): CompletableFuture> = - coroutineScope - .async { - search(data, methodOptions) - }.asCompletableFuture() + coroutineScope.async { + search(data, methodOptions) + }.asCompletableFuture() override suspend fun deletePassword( data: DeletePasswordRequest, @@ -841,10 +854,9 @@ internal class MembersImpl( data: DeletePasswordRequest, methodOptions: DeletePasswordRequestOptions?, ): CompletableFuture> = - coroutineScope - .async { - deletePassword(data, methodOptions) - }.asCompletableFuture() + coroutineScope.async { + deletePassword(data, methodOptions) + }.asCompletableFuture() override suspend fun dangerouslyGet(data: DangerouslyGetRequest): StytchResult = withContext(Dispatchers.IO) { @@ -867,10 +879,9 @@ internal class MembersImpl( } override fun dangerouslyGetCompletable(data: DangerouslyGetRequest): CompletableFuture> = - coroutineScope - .async { - dangerouslyGet(data) - }.asCompletableFuture() + coroutineScope.async { + dangerouslyGet(data) + }.asCompletableFuture() override suspend fun oidcProviders(data: OIDCProviderInformationRequest): StytchResult = withContext(Dispatchers.IO) { @@ -893,10 +904,9 @@ internal class MembersImpl( } override fun oidcProvidersCompletable(data: OIDCProviderInformationRequest): CompletableFuture> = - coroutineScope - .async { - oidcProviders(data) - }.asCompletableFuture() + coroutineScope.async { + oidcProviders(data) + }.asCompletableFuture() override suspend fun unlinkRetiredEmail( data: UnlinkRetiredEmailRequest, @@ -926,10 +936,9 @@ internal class MembersImpl( data: UnlinkRetiredEmailRequest, methodOptions: UnlinkRetiredEmailRequestOptions?, ): CompletableFuture> = - coroutineScope - .async { - unlinkRetiredEmail(data, methodOptions) - }.asCompletableFuture() + coroutineScope.async { + unlinkRetiredEmail(data, methodOptions) + }.asCompletableFuture() override suspend fun startEmailUpdate( data: StartEmailUpdateRequest, @@ -959,10 +968,9 @@ internal class MembersImpl( data: StartEmailUpdateRequest, methodOptions: StartEmailUpdateRequestOptions?, ): CompletableFuture> = - coroutineScope - .async { - startEmailUpdate(data, methodOptions) - }.asCompletableFuture() + coroutineScope.async { + startEmailUpdate(data, methodOptions) + }.asCompletableFuture() override suspend fun getConnectedApps( data: GetConnectedAppsRequest, @@ -995,10 +1003,40 @@ internal class MembersImpl( data: GetConnectedAppsRequest, methodOptions: GetConnectedAppsRequestOptions?, ): CompletableFuture> = - coroutineScope - .async { - getConnectedApps(data, methodOptions) - }.asCompletableFuture() + coroutineScope.async { + getConnectedApps(data, methodOptions) + }.asCompletableFuture() + + override suspend fun deleteExternalId( + data: DeleteExternalIdRequest, + methodOptions: DeleteExternalIdRequestOptions?, + ): StytchResult = + withContext(Dispatchers.IO) { + var headers = emptyMap() + methodOptions?.let { + headers = methodOptions.addHeaders(headers) + } + + httpClient.delete("/v1/b2b/organizations/${data.organizationId}/members/${data.memberId}/external_id", headers) + } + + override fun deleteExternalId( + data: DeleteExternalIdRequest, + methodOptions: DeleteExternalIdRequestOptions?, + callback: (StytchResult) -> Unit, + ) { + coroutineScope.launch { + callback(deleteExternalId(data, methodOptions)) + } + } + + override fun deleteExternalIdCompletable( + data: DeleteExternalIdRequest, + methodOptions: DeleteExternalIdRequestOptions?, + ): CompletableFuture> = + coroutineScope.async { + deleteExternalId(data, methodOptions) + }.asCompletableFuture() override suspend fun create( data: CreateRequest, @@ -1028,10 +1066,9 @@ internal class MembersImpl( data: CreateRequest, methodOptions: CreateRequestOptions?, ): CompletableFuture> = - coroutineScope - .async { - create(data, methodOptions) - }.asCompletableFuture() + coroutineScope.async { + create(data, methodOptions) + }.asCompletableFuture() override suspend fun get(data: GetRequest): StytchResult = withContext(Dispatchers.IO) { @@ -1054,8 +1091,7 @@ internal class MembersImpl( } override fun getCompletable(data: GetRequest): CompletableFuture> = - coroutineScope - .async { - get(data) - }.asCompletableFuture() + coroutineScope.async { + get(data) + }.asCompletableFuture() } diff --git a/stytch/src/main/kotlin/com/stytch/java/b2b/api/organizationsmembersconnectedapps/OrganizationsMembersConnectedApps.kt b/stytch/src/main/kotlin/com/stytch/java/b2b/api/organizationsmembersconnectedapps/OrganizationsMembersConnectedApps.kt index c3916a9c..01a742e3 100644 --- a/stytch/src/main/kotlin/com/stytch/java/b2b/api/organizationsmembersconnectedapps/OrganizationsMembersConnectedApps.kt +++ b/stytch/src/main/kotlin/com/stytch/java/b2b/api/organizationsmembersconnectedapps/OrganizationsMembersConnectedApps.kt @@ -92,8 +92,7 @@ internal class ConnectedAppsImpl( data: RevokeRequest, methodOptions: RevokeRequestOptions?, ): CompletableFuture> = - coroutineScope - .async { - revoke(data, methodOptions) - }.asCompletableFuture() + coroutineScope.async { + revoke(data, methodOptions) + }.asCompletableFuture() } diff --git a/stytch/src/main/kotlin/com/stytch/java/b2b/api/organizationsmembersoauthproviders/OrganizationsMembersOAuthProviders.kt b/stytch/src/main/kotlin/com/stytch/java/b2b/api/organizationsmembersoauthproviders/OrganizationsMembersOAuthProviders.kt index 32dca88c..b51a4137 100644 --- a/stytch/src/main/kotlin/com/stytch/java/b2b/api/organizationsmembersoauthproviders/OrganizationsMembersOAuthProviders.kt +++ b/stytch/src/main/kotlin/com/stytch/java/b2b/api/organizationsmembersoauthproviders/OrganizationsMembersOAuthProviders.kt @@ -203,10 +203,9 @@ internal class OAuthProvidersImpl( } override fun googleCompletable(data: ProviderInformationRequest): CompletableFuture> = - coroutineScope - .async { - google(data) - }.asCompletableFuture() + coroutineScope.async { + google(data) + }.asCompletableFuture() override suspend fun microsoft(data: ProviderInformationRequest): StytchResult = withContext(Dispatchers.IO) { @@ -233,10 +232,9 @@ internal class OAuthProvidersImpl( } override fun microsoftCompletable(data: ProviderInformationRequest): CompletableFuture> = - coroutineScope - .async { - microsoft(data) - }.asCompletableFuture() + coroutineScope.async { + microsoft(data) + }.asCompletableFuture() override suspend fun slack(data: SlackRequest): StytchResult = withContext(Dispatchers.IO) { @@ -259,10 +257,9 @@ internal class OAuthProvidersImpl( } override fun slackCompletable(data: SlackRequest): CompletableFuture> = - coroutineScope - .async { - slack(data) - }.asCompletableFuture() + coroutineScope.async { + slack(data) + }.asCompletableFuture() override suspend fun hubspot(data: ProviderInformationRequest): StytchResult = withContext(Dispatchers.IO) { @@ -285,10 +282,9 @@ internal class OAuthProvidersImpl( } override fun hubspotCompletable(data: ProviderInformationRequest): CompletableFuture> = - coroutineScope - .async { - hubspot(data) - }.asCompletableFuture() + coroutineScope.async { + hubspot(data) + }.asCompletableFuture() override suspend fun github(data: ProviderInformationRequest): StytchResult = withContext(Dispatchers.IO) { @@ -311,8 +307,7 @@ internal class OAuthProvidersImpl( } override fun githubCompletable(data: ProviderInformationRequest): CompletableFuture> = - coroutineScope - .async { - github(data) - }.asCompletableFuture() + coroutineScope.async { + github(data) + }.asCompletableFuture() } diff --git a/stytch/src/main/kotlin/com/stytch/java/b2b/api/otpemail/OTPEmail.kt b/stytch/src/main/kotlin/com/stytch/java/b2b/api/otpemail/OTPEmail.kt index c0303a06..d348f30c 100644 --- a/stytch/src/main/kotlin/com/stytch/java/b2b/api/otpemail/OTPEmail.kt +++ b/stytch/src/main/kotlin/com/stytch/java/b2b/api/otpemail/OTPEmail.kt @@ -165,10 +165,9 @@ internal class EmailImpl( } override fun loginOrSignupCompletable(data: LoginOrSignupRequest): CompletableFuture> = - coroutineScope - .async { - loginOrSignup(data) - }.asCompletableFuture() + coroutineScope.async { + loginOrSignup(data) + }.asCompletableFuture() override suspend fun authenticate(data: AuthenticateRequest): StytchResult = withContext(Dispatchers.IO) { @@ -188,8 +187,7 @@ internal class EmailImpl( } override fun authenticateCompletable(data: AuthenticateRequest): CompletableFuture> = - coroutineScope - .async { - authenticate(data) - }.asCompletableFuture() + coroutineScope.async { + authenticate(data) + }.asCompletableFuture() } diff --git a/stytch/src/main/kotlin/com/stytch/java/b2b/api/otpemaildiscovery/OTPEmailDiscovery.kt b/stytch/src/main/kotlin/com/stytch/java/b2b/api/otpemaildiscovery/OTPEmailDiscovery.kt index 31a4deea..f6ce2d8c 100644 --- a/stytch/src/main/kotlin/com/stytch/java/b2b/api/otpemaildiscovery/OTPEmailDiscovery.kt +++ b/stytch/src/main/kotlin/com/stytch/java/b2b/api/otpemaildiscovery/OTPEmailDiscovery.kt @@ -90,10 +90,9 @@ internal class DiscoveryImpl( } override fun sendCompletable(data: SendRequest): CompletableFuture> = - coroutineScope - .async { - send(data) - }.asCompletableFuture() + coroutineScope.async { + send(data) + }.asCompletableFuture() override suspend fun authenticate(data: AuthenticateRequest): StytchResult = withContext(Dispatchers.IO) { @@ -113,8 +112,7 @@ internal class DiscoveryImpl( } override fun authenticateCompletable(data: AuthenticateRequest): CompletableFuture> = - coroutineScope - .async { - authenticate(data) - }.asCompletableFuture() + coroutineScope.async { + authenticate(data) + }.asCompletableFuture() } diff --git a/stytch/src/main/kotlin/com/stytch/java/b2b/api/otpsms/OTPSms.kt b/stytch/src/main/kotlin/com/stytch/java/b2b/api/otpsms/OTPSms.kt index 3a24ad1e..4c0184b0 100644 --- a/stytch/src/main/kotlin/com/stytch/java/b2b/api/otpsms/OTPSms.kt +++ b/stytch/src/main/kotlin/com/stytch/java/b2b/api/otpsms/OTPSms.kt @@ -273,10 +273,9 @@ internal class SmsImpl( } override fun sendCompletable(data: SendRequest): CompletableFuture> = - coroutineScope - .async { - send(data) - }.asCompletableFuture() + coroutineScope.async { + send(data) + }.asCompletableFuture() override suspend fun authenticate(data: AuthenticateRequest): StytchResult = withContext(Dispatchers.IO) { @@ -296,8 +295,7 @@ internal class SmsImpl( } override fun authenticateCompletable(data: AuthenticateRequest): CompletableFuture> = - coroutineScope - .async { - authenticate(data) - }.asCompletableFuture() + coroutineScope.async { + authenticate(data) + }.asCompletableFuture() } diff --git a/stytch/src/main/kotlin/com/stytch/java/b2b/api/passwords/Passwords.kt b/stytch/src/main/kotlin/com/stytch/java/b2b/api/passwords/Passwords.kt index 5a136c1a..ad20792d 100644 --- a/stytch/src/main/kotlin/com/stytch/java/b2b/api/passwords/Passwords.kt +++ b/stytch/src/main/kotlin/com/stytch/java/b2b/api/passwords/Passwords.kt @@ -278,10 +278,9 @@ internal class PasswordsImpl( } override fun strengthCheckCompletable(data: StrengthCheckRequest): CompletableFuture> = - coroutineScope - .async { - strengthCheck(data) - }.asCompletableFuture() + coroutineScope.async { + strengthCheck(data) + }.asCompletableFuture() override suspend fun migrate(data: MigrateRequest): StytchResult = withContext(Dispatchers.IO) { @@ -301,10 +300,9 @@ internal class PasswordsImpl( } override fun migrateCompletable(data: MigrateRequest): CompletableFuture> = - coroutineScope - .async { - migrate(data) - }.asCompletableFuture() + coroutineScope.async { + migrate(data) + }.asCompletableFuture() override suspend fun authenticate(data: AuthenticateRequest): StytchResult = withContext(Dispatchers.IO) { @@ -324,8 +322,7 @@ internal class PasswordsImpl( } override fun authenticateCompletable(data: AuthenticateRequest): CompletableFuture> = - coroutineScope - .async { - authenticate(data) - }.asCompletableFuture() + coroutineScope.async { + authenticate(data) + }.asCompletableFuture() } diff --git a/stytch/src/main/kotlin/com/stytch/java/b2b/api/passwordsdiscovery/PasswordsDiscovery.kt b/stytch/src/main/kotlin/com/stytch/java/b2b/api/passwordsdiscovery/PasswordsDiscovery.kt index e0bdc0f5..84efbfa0 100644 --- a/stytch/src/main/kotlin/com/stytch/java/b2b/api/passwordsdiscovery/PasswordsDiscovery.kt +++ b/stytch/src/main/kotlin/com/stytch/java/b2b/api/passwordsdiscovery/PasswordsDiscovery.kt @@ -100,8 +100,7 @@ internal class DiscoveryImpl( } override fun authenticateCompletable(data: AuthenticateRequest): CompletableFuture> = - coroutineScope - .async { - authenticate(data) - }.asCompletableFuture() + coroutineScope.async { + authenticate(data) + }.asCompletableFuture() } diff --git a/stytch/src/main/kotlin/com/stytch/java/b2b/api/passwordsdiscoveryemail/PasswordsDiscoveryEmail.kt b/stytch/src/main/kotlin/com/stytch/java/b2b/api/passwordsdiscoveryemail/PasswordsDiscoveryEmail.kt index a05757cf..8f9ad3b4 100644 --- a/stytch/src/main/kotlin/com/stytch/java/b2b/api/passwordsdiscoveryemail/PasswordsDiscoveryEmail.kt +++ b/stytch/src/main/kotlin/com/stytch/java/b2b/api/passwordsdiscoveryemail/PasswordsDiscoveryEmail.kt @@ -138,10 +138,9 @@ internal class EmailImpl( } override fun resetStartCompletable(data: ResetStartRequest): CompletableFuture> = - coroutineScope - .async { - resetStart(data) - }.asCompletableFuture() + coroutineScope.async { + resetStart(data) + }.asCompletableFuture() override suspend fun reset(data: ResetRequest): StytchResult = withContext(Dispatchers.IO) { @@ -161,8 +160,7 @@ internal class EmailImpl( } override fun resetCompletable(data: ResetRequest): CompletableFuture> = - coroutineScope - .async { - reset(data) - }.asCompletableFuture() + coroutineScope.async { + reset(data) + }.asCompletableFuture() } diff --git a/stytch/src/main/kotlin/com/stytch/java/b2b/api/passwordsemail/PasswordsEmail.kt b/stytch/src/main/kotlin/com/stytch/java/b2b/api/passwordsemail/PasswordsEmail.kt index 43e38500..e9544780 100644 --- a/stytch/src/main/kotlin/com/stytch/java/b2b/api/passwordsemail/PasswordsEmail.kt +++ b/stytch/src/main/kotlin/com/stytch/java/b2b/api/passwordsemail/PasswordsEmail.kt @@ -199,10 +199,9 @@ internal class EmailImpl( } override fun resetStartCompletable(data: ResetStartRequest): CompletableFuture> = - coroutineScope - .async { - resetStart(data) - }.asCompletableFuture() + coroutineScope.async { + resetStart(data) + }.asCompletableFuture() override suspend fun reset(data: ResetRequest): StytchResult = withContext(Dispatchers.IO) { @@ -222,10 +221,9 @@ internal class EmailImpl( } override fun resetCompletable(data: ResetRequest): CompletableFuture> = - coroutineScope - .async { - reset(data) - }.asCompletableFuture() + coroutineScope.async { + reset(data) + }.asCompletableFuture() override suspend fun requireReset( data: RequireResetRequest, @@ -255,8 +253,7 @@ internal class EmailImpl( data: RequireResetRequest, methodOptions: RequireResetRequestOptions?, ): CompletableFuture> = - coroutineScope - .async { - requireReset(data, methodOptions) - }.asCompletableFuture() + coroutineScope.async { + requireReset(data, methodOptions) + }.asCompletableFuture() } diff --git a/stytch/src/main/kotlin/com/stytch/java/b2b/api/passwordsexistingpassword/PasswordsExistingPassword.kt b/stytch/src/main/kotlin/com/stytch/java/b2b/api/passwordsexistingpassword/PasswordsExistingPassword.kt index bcc816b2..aa40e404 100644 --- a/stytch/src/main/kotlin/com/stytch/java/b2b/api/passwordsexistingpassword/PasswordsExistingPassword.kt +++ b/stytch/src/main/kotlin/com/stytch/java/b2b/api/passwordsexistingpassword/PasswordsExistingPassword.kt @@ -124,8 +124,7 @@ internal class ExistingPasswordImpl( } override fun resetCompletable(data: ResetRequest): CompletableFuture> = - coroutineScope - .async { - reset(data) - }.asCompletableFuture() + coroutineScope.async { + reset(data) + }.asCompletableFuture() } diff --git a/stytch/src/main/kotlin/com/stytch/java/b2b/api/passwordssession/PasswordsSession.kt b/stytch/src/main/kotlin/com/stytch/java/b2b/api/passwordssession/PasswordsSession.kt index 57c98bf9..2e4f7933 100644 --- a/stytch/src/main/kotlin/com/stytch/java/b2b/api/passwordssession/PasswordsSession.kt +++ b/stytch/src/main/kotlin/com/stytch/java/b2b/api/passwordssession/PasswordsSession.kt @@ -79,8 +79,7 @@ internal class SessionsImpl( } override fun resetCompletable(data: ResetRequest): CompletableFuture> = - coroutineScope - .async { - reset(data) - }.asCompletableFuture() + coroutineScope.async { + reset(data) + }.asCompletableFuture() } diff --git a/stytch/src/main/kotlin/com/stytch/java/b2b/api/rbac/RBAC.kt b/stytch/src/main/kotlin/com/stytch/java/b2b/api/rbac/RBAC.kt index 145631cb..562a7faa 100644 --- a/stytch/src/main/kotlin/com/stytch/java/b2b/api/rbac/RBAC.kt +++ b/stytch/src/main/kotlin/com/stytch/java/b2b/api/rbac/RBAC.kt @@ -9,6 +9,8 @@ package com.stytch.java.b2b.api.rbac import com.squareup.moshi.JsonAdapter import com.squareup.moshi.Moshi import com.squareup.moshi.Types +import com.stytch.java.b2b.api.rbacorganizations.Organizations +import com.stytch.java.b2b.api.rbacorganizations.OrganizationsImpl import com.stytch.java.b2b.models.rbac.PolicyRequest import com.stytch.java.b2b.models.rbac.PolicyResponse import com.stytch.java.common.InstantAdapter @@ -23,6 +25,8 @@ import kotlinx.coroutines.withContext import java.util.concurrent.CompletableFuture public interface RBAC { + public val organizations: Organizations + /** * Get the active RBAC Policy for your current Stytch Project. An RBAC Policy is the canonical document that stores all * defined Resources and Roles within your RBAC permissioning model. @@ -87,6 +91,8 @@ internal class RBACImpl( ) : RBAC { private val moshi = Moshi.Builder().add(InstantAdapter()).build() + override val organizations: Organizations = OrganizationsImpl(httpClient, coroutineScope) + override suspend fun policy(data: PolicyRequest): StytchResult = withContext(Dispatchers.IO) { var headers = emptyMap() @@ -108,8 +114,7 @@ internal class RBACImpl( } override fun policyCompletable(data: PolicyRequest): CompletableFuture> = - coroutineScope - .async { - policy(data) - }.asCompletableFuture() + coroutineScope.async { + policy(data) + }.asCompletableFuture() } diff --git a/stytch/src/main/kotlin/com/stytch/java/b2b/api/rbacorganizations/RBACOrganizations.kt b/stytch/src/main/kotlin/com/stytch/java/b2b/api/rbacorganizations/RBACOrganizations.kt new file mode 100644 index 00000000..ade66031 --- /dev/null +++ b/stytch/src/main/kotlin/com/stytch/java/b2b/api/rbacorganizations/RBACOrganizations.kt @@ -0,0 +1,231 @@ +package com.stytch.java.b2b.api.rbacorganizations + +// !!! +// WARNING: This file is autogenerated +// Only modify code within MANUAL() sections +// or your changes may be overwritten later! +// !!! + +import com.squareup.moshi.JsonAdapter +import com.squareup.moshi.Moshi +import com.squareup.moshi.Types +import com.stytch.java.b2b.models.rbacorganizations.GetOrgPolicyRequest +import com.stytch.java.b2b.models.rbacorganizations.GetOrgPolicyResponse +import com.stytch.java.b2b.models.rbacorganizations.SetOrgPolicyRequest +import com.stytch.java.b2b.models.rbacorganizations.SetOrgPolicyResponse +import com.stytch.java.common.InstantAdapter +import com.stytch.java.common.StytchResult +import com.stytch.java.http.HttpClient +import kotlinx.coroutines.CoroutineScope +import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.async +import kotlinx.coroutines.future.asCompletableFuture +import kotlinx.coroutines.launch +import kotlinx.coroutines.withContext +import java.util.concurrent.CompletableFuture + +public interface Organizations { + /** + * Get the active RBAC Policy for a specific Organization within your Stytch Project. An Organization RBAC Policy contains + * the roles that have been defined specifically for that organization, allowing for organization-specific permissioning + * models. + * + * This endpoint returns the organization-scoped roles that supplement the project-level RBAC policy. Organization + * policies allow you to define custom roles that are specific to individual organizations within your project. + * + * When using the backend SDKs, the RBAC Policy will be cached to allow for local evaluations, eliminating the need for an + * extra request to Stytch. The policy will be refreshed if an authorization check is requested and the RBAC policy was + * last updated more than 5 minutes ago. + * + * Organization-specific roles can be created and managed through this API endpoint, providing fine-grained control over + * permissions at the organization level. + * + * Check out the [RBAC overview](https://stytch.com/docs/b2b/guides/rbac/overview) to learn more about Stytch's RBAC + * permissioning model and organization-scoped policies. + */ + public suspend fun getOrgPolicy(data: GetOrgPolicyRequest): StytchResult + + /** + * Get the active RBAC Policy for a specific Organization within your Stytch Project. An Organization RBAC Policy contains + * the roles that have been defined specifically for that organization, allowing for organization-specific permissioning + * models. + * + * This endpoint returns the organization-scoped roles that supplement the project-level RBAC policy. Organization + * policies allow you to define custom roles that are specific to individual organizations within your project. + * + * When using the backend SDKs, the RBAC Policy will be cached to allow for local evaluations, eliminating the need for an + * extra request to Stytch. The policy will be refreshed if an authorization check is requested and the RBAC policy was + * last updated more than 5 minutes ago. + * + * Organization-specific roles can be created and managed through this API endpoint, providing fine-grained control over + * permissions at the organization level. + * + * Check out the [RBAC overview](https://stytch.com/docs/b2b/guides/rbac/overview) to learn more about Stytch's RBAC + * permissioning model and organization-scoped policies. + */ + public fun getOrgPolicy( + data: GetOrgPolicyRequest, + callback: (StytchResult) -> Unit, + ) + + /** + * Get the active RBAC Policy for a specific Organization within your Stytch Project. An Organization RBAC Policy contains + * the roles that have been defined specifically for that organization, allowing for organization-specific permissioning + * models. + * + * This endpoint returns the organization-scoped roles that supplement the project-level RBAC policy. Organization + * policies allow you to define custom roles that are specific to individual organizations within your project. + * + * When using the backend SDKs, the RBAC Policy will be cached to allow for local evaluations, eliminating the need for an + * extra request to Stytch. The policy will be refreshed if an authorization check is requested and the RBAC policy was + * last updated more than 5 minutes ago. + * + * Organization-specific roles can be created and managed through this API endpoint, providing fine-grained control over + * permissions at the organization level. + * + * Check out the [RBAC overview](https://stytch.com/docs/b2b/guides/rbac/overview) to learn more about Stytch's RBAC + * permissioning model and organization-scoped policies. + */ + public fun getOrgPolicyCompletable(data: GetOrgPolicyRequest): CompletableFuture> + + /** + * Set the RBAC Policy for a specific Organization within your Stytch Project. An Organization RBAC Policy allows you to + * define roles that are specific to that organization, providing fine-grained control over permissions at the + * organization level. + * + * This endpoint allows you to create, update, or replace the organization-scoped roles for a given organization. + * Organization policies supplement the project-level RBAC policy with additional roles that are only applicable within + * the context of that specific organization. + * + * The organization policy consists of roles, where each role defines: + * - A unique `role_id` to identify the role + * - A human-readable `description` of the role's purpose + * - A set of `permissions` that specify which actions can be performed on which resources + * + * When you set an organization policy, it will replace any existing organization-specific roles for that organization. + * The project-level RBAC policy remains unchanged. + * + * Organization-specific roles are useful for scenarios where different organizations within your project require + * different permission structures, such as: + * - Multi-tenant applications with varying access levels per tenant + * - Organizations with custom approval workflows + * - Different organizational hierarchies requiring unique role definitions + * + * Check out the [RBAC overview](https://stytch.com/docs/b2b/guides/rbac/overview) to learn more about Stytch's RBAC + * permissioning model and organization-scoped policies. + */ + public suspend fun setOrgPolicy(data: SetOrgPolicyRequest): StytchResult + + /** + * Set the RBAC Policy for a specific Organization within your Stytch Project. An Organization RBAC Policy allows you to + * define roles that are specific to that organization, providing fine-grained control over permissions at the + * organization level. + * + * This endpoint allows you to create, update, or replace the organization-scoped roles for a given organization. + * Organization policies supplement the project-level RBAC policy with additional roles that are only applicable within + * the context of that specific organization. + * + * The organization policy consists of roles, where each role defines: + * - A unique `role_id` to identify the role + * - A human-readable `description` of the role's purpose + * - A set of `permissions` that specify which actions can be performed on which resources + * + * When you set an organization policy, it will replace any existing organization-specific roles for that organization. + * The project-level RBAC policy remains unchanged. + * + * Organization-specific roles are useful for scenarios where different organizations within your project require + * different permission structures, such as: + * - Multi-tenant applications with varying access levels per tenant + * - Organizations with custom approval workflows + * - Different organizational hierarchies requiring unique role definitions + * + * Check out the [RBAC overview](https://stytch.com/docs/b2b/guides/rbac/overview) to learn more about Stytch's RBAC + * permissioning model and organization-scoped policies. + */ + public fun setOrgPolicy( + data: SetOrgPolicyRequest, + callback: (StytchResult) -> Unit, + ) + + /** + * Set the RBAC Policy for a specific Organization within your Stytch Project. An Organization RBAC Policy allows you to + * define roles that are specific to that organization, providing fine-grained control over permissions at the + * organization level. + * + * This endpoint allows you to create, update, or replace the organization-scoped roles for a given organization. + * Organization policies supplement the project-level RBAC policy with additional roles that are only applicable within + * the context of that specific organization. + * + * The organization policy consists of roles, where each role defines: + * - A unique `role_id` to identify the role + * - A human-readable `description` of the role's purpose + * - A set of `permissions` that specify which actions can be performed on which resources + * + * When you set an organization policy, it will replace any existing organization-specific roles for that organization. + * The project-level RBAC policy remains unchanged. + * + * Organization-specific roles are useful for scenarios where different organizations within your project require + * different permission structures, such as: + * - Multi-tenant applications with varying access levels per tenant + * - Organizations with custom approval workflows + * - Different organizational hierarchies requiring unique role definitions + * + * Check out the [RBAC overview](https://stytch.com/docs/b2b/guides/rbac/overview) to learn more about Stytch's RBAC + * permissioning model and organization-scoped policies. + */ + public fun setOrgPolicyCompletable(data: SetOrgPolicyRequest): CompletableFuture> +} + +internal class OrganizationsImpl( + private val httpClient: HttpClient, + private val coroutineScope: CoroutineScope, +) : Organizations { + private val moshi = Moshi.Builder().add(InstantAdapter()).build() + + override suspend fun getOrgPolicy(data: GetOrgPolicyRequest): StytchResult = + withContext(Dispatchers.IO) { + var headers = emptyMap() + + val asJson = moshi.adapter(GetOrgPolicyRequest::class.java).toJson(data) + val type = Types.newParameterizedType(Map::class.java, String::class.java, Any::class.java) + val adapter: JsonAdapter> = moshi.adapter(type) + val asMap = adapter.fromJson(asJson) ?: emptyMap() + httpClient.get("/v1/b2b/rbac/organizations/${data.organizationId}", asMap, headers) + } + + override fun getOrgPolicy( + data: GetOrgPolicyRequest, + callback: (StytchResult) -> Unit, + ) { + coroutineScope.launch { + callback(getOrgPolicy(data)) + } + } + + override fun getOrgPolicyCompletable(data: GetOrgPolicyRequest): CompletableFuture> = + coroutineScope.async { + getOrgPolicy(data) + }.asCompletableFuture() + + override suspend fun setOrgPolicy(data: SetOrgPolicyRequest): StytchResult = + withContext(Dispatchers.IO) { + var headers = emptyMap() + + val asJson = moshi.adapter(SetOrgPolicyRequest::class.java).toJson(data) + httpClient.put("/v1/b2b/rbac/organizations/${data.organizationId}", asJson, headers) + } + + override fun setOrgPolicy( + data: SetOrgPolicyRequest, + callback: (StytchResult) -> Unit, + ) { + coroutineScope.launch { + callback(setOrgPolicy(data)) + } + } + + override fun setOrgPolicyCompletable(data: SetOrgPolicyRequest): CompletableFuture> = + coroutineScope.async { + setOrgPolicy(data) + }.asCompletableFuture() +} diff --git a/stytch/src/main/kotlin/com/stytch/java/b2b/api/recoverycodes/RecoveryCodes.kt b/stytch/src/main/kotlin/com/stytch/java/b2b/api/recoverycodes/RecoveryCodes.kt index 56e78f71..6c43f749 100644 --- a/stytch/src/main/kotlin/com/stytch/java/b2b/api/recoverycodes/RecoveryCodes.kt +++ b/stytch/src/main/kotlin/com/stytch/java/b2b/api/recoverycodes/RecoveryCodes.kt @@ -112,10 +112,9 @@ internal class RecoveryCodesImpl( } override fun recoverCompletable(data: RecoverRequest): CompletableFuture> = - coroutineScope - .async { - recover(data) - }.asCompletableFuture() + coroutineScope.async { + recover(data) + }.asCompletableFuture() override suspend fun get(data: GetRequest): StytchResult = withContext(Dispatchers.IO) { @@ -138,10 +137,9 @@ internal class RecoveryCodesImpl( } override fun getCompletable(data: GetRequest): CompletableFuture> = - coroutineScope - .async { - get(data) - }.asCompletableFuture() + coroutineScope.async { + get(data) + }.asCompletableFuture() override suspend fun rotate(data: RotateRequest): StytchResult = withContext(Dispatchers.IO) { @@ -161,8 +159,7 @@ internal class RecoveryCodesImpl( } override fun rotateCompletable(data: RotateRequest): CompletableFuture> = - coroutineScope - .async { - rotate(data) - }.asCompletableFuture() + coroutineScope.async { + rotate(data) + }.asCompletableFuture() } diff --git a/stytch/src/main/kotlin/com/stytch/java/b2b/api/scimconnection/SCIMConnection.kt b/stytch/src/main/kotlin/com/stytch/java/b2b/api/scimconnection/SCIMConnection.kt index c5435d86..3497320b 100644 --- a/stytch/src/main/kotlin/com/stytch/java/b2b/api/scimconnection/SCIMConnection.kt +++ b/stytch/src/main/kotlin/com/stytch/java/b2b/api/scimconnection/SCIMConnection.kt @@ -286,10 +286,9 @@ internal class ConnectionImpl( data: UpdateRequest, methodOptions: UpdateRequestOptions?, ): CompletableFuture> = - coroutineScope - .async { - update(data, methodOptions) - }.asCompletableFuture() + coroutineScope.async { + update(data, methodOptions) + }.asCompletableFuture() override suspend fun delete( data: DeleteRequest, @@ -318,10 +317,9 @@ internal class ConnectionImpl( data: DeleteRequest, methodOptions: DeleteRequestOptions?, ): CompletableFuture> = - coroutineScope - .async { - delete(data, methodOptions) - }.asCompletableFuture() + coroutineScope.async { + delete(data, methodOptions) + }.asCompletableFuture() override suspend fun rotateStart( data: RotateStartRequest, @@ -351,10 +349,9 @@ internal class ConnectionImpl( data: RotateStartRequest, methodOptions: RotateStartRequestOptions?, ): CompletableFuture> = - coroutineScope - .async { - rotateStart(data, methodOptions) - }.asCompletableFuture() + coroutineScope.async { + rotateStart(data, methodOptions) + }.asCompletableFuture() override suspend fun rotateComplete( data: RotateCompleteRequest, @@ -384,10 +381,9 @@ internal class ConnectionImpl( data: RotateCompleteRequest, methodOptions: RotateCompleteRequestOptions?, ): CompletableFuture> = - coroutineScope - .async { - rotateComplete(data, methodOptions) - }.asCompletableFuture() + coroutineScope.async { + rotateComplete(data, methodOptions) + }.asCompletableFuture() override suspend fun rotateCancel( data: RotateCancelRequest, @@ -417,10 +413,9 @@ internal class ConnectionImpl( data: RotateCancelRequest, methodOptions: RotateCancelRequestOptions?, ): CompletableFuture> = - coroutineScope - .async { - rotateCancel(data, methodOptions) - }.asCompletableFuture() + coroutineScope.async { + rotateCancel(data, methodOptions) + }.asCompletableFuture() override suspend fun getGroups( data: GetGroupsRequest, @@ -453,10 +448,9 @@ internal class ConnectionImpl( data: GetGroupsRequest, methodOptions: GetGroupsRequestOptions?, ): CompletableFuture> = - coroutineScope - .async { - getGroups(data, methodOptions) - }.asCompletableFuture() + coroutineScope.async { + getGroups(data, methodOptions) + }.asCompletableFuture() override suspend fun create( data: CreateRequest, @@ -486,10 +480,9 @@ internal class ConnectionImpl( data: CreateRequest, methodOptions: CreateRequestOptions?, ): CompletableFuture> = - coroutineScope - .async { - create(data, methodOptions) - }.asCompletableFuture() + coroutineScope.async { + create(data, methodOptions) + }.asCompletableFuture() override suspend fun get( data: GetRequest, @@ -522,8 +515,7 @@ internal class ConnectionImpl( data: GetRequest, methodOptions: GetRequestOptions?, ): CompletableFuture> = - coroutineScope - .async { - get(data, methodOptions) - }.asCompletableFuture() + coroutineScope.async { + get(data, methodOptions) + }.asCompletableFuture() } diff --git a/stytch/src/main/kotlin/com/stytch/java/b2b/api/sessions/Sessions.kt b/stytch/src/main/kotlin/com/stytch/java/b2b/api/sessions/Sessions.kt index 358d5bac..db30a23f 100644 --- a/stytch/src/main/kotlin/com/stytch/java/b2b/api/sessions/Sessions.kt +++ b/stytch/src/main/kotlin/com/stytch/java/b2b/api/sessions/Sessions.kt @@ -580,10 +580,9 @@ internal class SessionsImpl( } override fun getCompletable(data: GetRequest): CompletableFuture> = - coroutineScope - .async { - get(data) - }.asCompletableFuture() + coroutineScope.async { + get(data) + }.asCompletableFuture() override suspend fun authenticate(data: AuthenticateRequest): StytchResult = withContext(Dispatchers.IO) { @@ -603,10 +602,9 @@ internal class SessionsImpl( } override fun authenticateCompletable(data: AuthenticateRequest): CompletableFuture> = - coroutineScope - .async { - authenticate(data) - }.asCompletableFuture() + coroutineScope.async { + authenticate(data) + }.asCompletableFuture() override suspend fun revoke( data: RevokeRequest, @@ -636,10 +634,9 @@ internal class SessionsImpl( data: RevokeRequest, methodOptions: RevokeRequestOptions?, ): CompletableFuture> = - coroutineScope - .async { - revoke(data, methodOptions) - }.asCompletableFuture() + coroutineScope.async { + revoke(data, methodOptions) + }.asCompletableFuture() override suspend fun exchange(data: ExchangeRequest): StytchResult = withContext(Dispatchers.IO) { @@ -659,10 +656,9 @@ internal class SessionsImpl( } override fun exchangeCompletable(data: ExchangeRequest): CompletableFuture> = - coroutineScope - .async { - exchange(data) - }.asCompletableFuture() + coroutineScope.async { + exchange(data) + }.asCompletableFuture() override suspend fun exchangeAccessToken(data: ExchangeAccessTokenRequest): StytchResult = withContext(Dispatchers.IO) { @@ -684,10 +680,9 @@ internal class SessionsImpl( override fun exchangeAccessTokenCompletable( data: ExchangeAccessTokenRequest, ): CompletableFuture> = - coroutineScope - .async { - exchangeAccessToken(data) - }.asCompletableFuture() + coroutineScope.async { + exchangeAccessToken(data) + }.asCompletableFuture() override suspend fun attest(data: AttestRequest): StytchResult = withContext(Dispatchers.IO) { @@ -707,10 +702,9 @@ internal class SessionsImpl( } override fun attestCompletable(data: AttestRequest): CompletableFuture> = - coroutineScope - .async { - attest(data) - }.asCompletableFuture() + coroutineScope.async { + attest(data) + }.asCompletableFuture() override suspend fun migrate(data: MigrateRequest): StytchResult = withContext(Dispatchers.IO) { @@ -730,10 +724,9 @@ internal class SessionsImpl( } override fun migrateCompletable(data: MigrateRequest): CompletableFuture> = - coroutineScope - .async { - migrate(data) - }.asCompletableFuture() + coroutineScope.async { + migrate(data) + }.asCompletableFuture() override suspend fun getJWKS(data: GetJWKSRequest): StytchResult = withContext(Dispatchers.IO) { @@ -756,10 +749,9 @@ internal class SessionsImpl( } override fun getJWKSCompletable(data: GetJWKSRequest): CompletableFuture> = - coroutineScope - .async { - getJWKS(data) - }.asCompletableFuture() + coroutineScope.async { + getJWKS(data) + }.asCompletableFuture() // MANUAL(authenticateJWT_impl)(SERVICE_METHOD) override suspend fun authenticateJwt( diff --git a/stytch/src/main/kotlin/com/stytch/java/b2b/api/sso/SSO.kt b/stytch/src/main/kotlin/com/stytch/java/b2b/api/sso/SSO.kt index 95931576..4d1905d7 100644 --- a/stytch/src/main/kotlin/com/stytch/java/b2b/api/sso/SSO.kt +++ b/stytch/src/main/kotlin/com/stytch/java/b2b/api/sso/SSO.kt @@ -205,10 +205,9 @@ internal class SSOImpl( data: GetConnectionsRequest, methodOptions: GetConnectionsRequestOptions?, ): CompletableFuture> = - coroutineScope - .async { - getConnections(data, methodOptions) - }.asCompletableFuture() + coroutineScope.async { + getConnections(data, methodOptions) + }.asCompletableFuture() override suspend fun deleteConnection( data: DeleteConnectionRequest, @@ -237,10 +236,9 @@ internal class SSOImpl( data: DeleteConnectionRequest, methodOptions: DeleteConnectionRequestOptions?, ): CompletableFuture> = - coroutineScope - .async { - deleteConnection(data, methodOptions) - }.asCompletableFuture() + coroutineScope.async { + deleteConnection(data, methodOptions) + }.asCompletableFuture() override suspend fun authenticate(data: AuthenticateRequest): StytchResult = withContext(Dispatchers.IO) { @@ -260,8 +258,7 @@ internal class SSOImpl( } override fun authenticateCompletable(data: AuthenticateRequest): CompletableFuture> = - coroutineScope - .async { - authenticate(data) - }.asCompletableFuture() + coroutineScope.async { + authenticate(data) + }.asCompletableFuture() } diff --git a/stytch/src/main/kotlin/com/stytch/java/b2b/api/ssoexternal/SSOExternal.kt b/stytch/src/main/kotlin/com/stytch/java/b2b/api/ssoexternal/SSOExternal.kt index 28e59a75..c2fa1cd0 100644 --- a/stytch/src/main/kotlin/com/stytch/java/b2b/api/ssoexternal/SSOExternal.kt +++ b/stytch/src/main/kotlin/com/stytch/java/b2b/api/ssoexternal/SSOExternal.kt @@ -110,10 +110,9 @@ internal class ExternalImpl( data: CreateConnectionRequest, methodOptions: CreateConnectionRequestOptions?, ): CompletableFuture> = - coroutineScope - .async { - createConnection(data, methodOptions) - }.asCompletableFuture() + coroutineScope.async { + createConnection(data, methodOptions) + }.asCompletableFuture() override suspend fun updateConnection( data: UpdateConnectionRequest, @@ -143,8 +142,7 @@ internal class ExternalImpl( data: UpdateConnectionRequest, methodOptions: UpdateConnectionRequestOptions?, ): CompletableFuture> = - coroutineScope - .async { - updateConnection(data, methodOptions) - }.asCompletableFuture() + coroutineScope.async { + updateConnection(data, methodOptions) + }.asCompletableFuture() } diff --git a/stytch/src/main/kotlin/com/stytch/java/b2b/api/ssooidc/SSOOIDC.kt b/stytch/src/main/kotlin/com/stytch/java/b2b/api/ssooidc/SSOOIDC.kt index 06c146cb..f415ed74 100644 --- a/stytch/src/main/kotlin/com/stytch/java/b2b/api/ssooidc/SSOOIDC.kt +++ b/stytch/src/main/kotlin/com/stytch/java/b2b/api/ssooidc/SSOOIDC.kt @@ -179,10 +179,9 @@ internal class OIDCImpl( data: CreateConnectionRequest, methodOptions: CreateConnectionRequestOptions?, ): CompletableFuture> = - coroutineScope - .async { - createConnection(data, methodOptions) - }.asCompletableFuture() + coroutineScope.async { + createConnection(data, methodOptions) + }.asCompletableFuture() override suspend fun updateConnection( data: UpdateConnectionRequest, @@ -212,8 +211,7 @@ internal class OIDCImpl( data: UpdateConnectionRequest, methodOptions: UpdateConnectionRequestOptions?, ): CompletableFuture> = - coroutineScope - .async { - updateConnection(data, methodOptions) - }.asCompletableFuture() + coroutineScope.async { + updateConnection(data, methodOptions) + }.asCompletableFuture() } diff --git a/stytch/src/main/kotlin/com/stytch/java/b2b/api/ssosaml/SSOSAML.kt b/stytch/src/main/kotlin/com/stytch/java/b2b/api/ssosaml/SSOSAML.kt index c035217f..d43d91a0 100644 --- a/stytch/src/main/kotlin/com/stytch/java/b2b/api/ssosaml/SSOSAML.kt +++ b/stytch/src/main/kotlin/com/stytch/java/b2b/api/ssosaml/SSOSAML.kt @@ -239,10 +239,9 @@ internal class SAMLImpl( data: CreateConnectionRequest, methodOptions: CreateConnectionRequestOptions?, ): CompletableFuture> = - coroutineScope - .async { - createConnection(data, methodOptions) - }.asCompletableFuture() + coroutineScope.async { + createConnection(data, methodOptions) + }.asCompletableFuture() override suspend fun updateConnection( data: UpdateConnectionRequest, @@ -272,10 +271,9 @@ internal class SAMLImpl( data: UpdateConnectionRequest, methodOptions: UpdateConnectionRequestOptions?, ): CompletableFuture> = - coroutineScope - .async { - updateConnection(data, methodOptions) - }.asCompletableFuture() + coroutineScope.async { + updateConnection(data, methodOptions) + }.asCompletableFuture() override suspend fun updateByURL( data: UpdateByURLRequest, @@ -305,10 +303,9 @@ internal class SAMLImpl( data: UpdateByURLRequest, methodOptions: UpdateByURLRequestOptions?, ): CompletableFuture> = - coroutineScope - .async { - updateByURL(data, methodOptions) - }.asCompletableFuture() + coroutineScope.async { + updateByURL(data, methodOptions) + }.asCompletableFuture() override suspend fun deleteVerificationCertificate( data: DeleteVerificationCertificateRequest, @@ -340,10 +337,9 @@ internal class SAMLImpl( data: DeleteVerificationCertificateRequest, methodOptions: DeleteVerificationCertificateRequestOptions?, ): CompletableFuture> = - coroutineScope - .async { - deleteVerificationCertificate(data, methodOptions) - }.asCompletableFuture() + coroutineScope.async { + deleteVerificationCertificate(data, methodOptions) + }.asCompletableFuture() override suspend fun deleteEncryptionPrivateKey( data: DeleteEncryptionPrivateKeyRequest, @@ -375,8 +371,7 @@ internal class SAMLImpl( data: DeleteEncryptionPrivateKeyRequest, methodOptions: DeleteEncryptionPrivateKeyRequestOptions?, ): CompletableFuture> = - coroutineScope - .async { - deleteEncryptionPrivateKey(data, methodOptions) - }.asCompletableFuture() + coroutineScope.async { + deleteEncryptionPrivateKey(data, methodOptions) + }.asCompletableFuture() } diff --git a/stytch/src/main/kotlin/com/stytch/java/b2b/api/totps/TOTPs.kt b/stytch/src/main/kotlin/com/stytch/java/b2b/api/totps/TOTPs.kt index b9b07b76..e0094cf9 100644 --- a/stytch/src/main/kotlin/com/stytch/java/b2b/api/totps/TOTPs.kt +++ b/stytch/src/main/kotlin/com/stytch/java/b2b/api/totps/TOTPs.kt @@ -128,10 +128,9 @@ internal class TOTPsImpl( } override fun createCompletable(data: CreateRequest): CompletableFuture> = - coroutineScope - .async { - create(data) - }.asCompletableFuture() + coroutineScope.async { + create(data) + }.asCompletableFuture() override suspend fun authenticate(data: AuthenticateRequest): StytchResult = withContext(Dispatchers.IO) { @@ -151,10 +150,9 @@ internal class TOTPsImpl( } override fun authenticateCompletable(data: AuthenticateRequest): CompletableFuture> = - coroutineScope - .async { - authenticate(data) - }.asCompletableFuture() + coroutineScope.async { + authenticate(data) + }.asCompletableFuture() override suspend fun migrate(data: MigrateRequest): StytchResult = withContext(Dispatchers.IO) { @@ -174,8 +172,7 @@ internal class TOTPsImpl( } override fun migrateCompletable(data: MigrateRequest): CompletableFuture> = - coroutineScope - .async { - migrate(data) - }.asCompletableFuture() + coroutineScope.async { + migrate(data) + }.asCompletableFuture() } diff --git a/stytch/src/main/kotlin/com/stytch/java/b2b/models/organizations/Organizations.kt b/stytch/src/main/kotlin/com/stytch/java/b2b/models/organizations/Organizations.kt index 410d4495..b6c2a1a4 100644 --- a/stytch/src/main/kotlin/com/stytch/java/b2b/models/organizations/Organizations.kt +++ b/stytch/src/main/kotlin/com/stytch/java/b2b/models/organizations/Organizations.kt @@ -126,6 +126,47 @@ public data class ConnectedAppsRequestOptions } } +@JsonClass(generateAdapter = true) +public data class CustomRole + @JvmOverloads + constructor( + @Json(name = "role_id") + val roleId: String, + @Json(name = "description") + val description: String, + @Json(name = "permissions") + val permissions: List, + ) + +@JsonClass(generateAdapter = true) +public data class CustomRolePermission + @JvmOverloads + constructor( + @Json(name = "resource_id") + val resourceId: String, + @Json(name = "actions") + val actions: List, + ) + +public data class DeleteExternalIdRequestOptions + @JvmOverloads + constructor( + /** + * Optional authorization object. + * Pass in an active Stytch Member session token or session JWT and the request + * will be run using that member's permissions. + */ + val authorization: Authorization? = null, + ) { + internal fun addHeaders(headers: Map = emptyMap()): Map { + var res = mapOf() + if (authorization != null) { + res = authorization.addHeaders(res) + } + return res + headers + } + } + public data class DeleteRequestOptions @JvmOverloads constructor( @@ -832,6 +873,8 @@ public data class Organization */ @Json(name = "allowed_third_party_connected_apps") val allowedThirdPartyConnectedApps: List, + @Json(name = "custom_roles") + val customRoles: List, /** * An arbitrary JSON object for storing application-specific data or identity-provider-specific data. */ @@ -1344,6 +1387,26 @@ public data class CreateResponse val statusCode: Int, ) +@JsonClass(generateAdapter = true) +public data class DeleteExternalIdRequest + @JvmOverloads + constructor( + @Json(name = "organization_id") + val organizationId: String, + ) + +@JsonClass(generateAdapter = true) +public data class DeleteExternalIdResponse + @JvmOverloads + constructor( + @Json(name = "request_id") + val requestId: String, + @Json(name = "organization") + val organization: Organization, + @Json(name = "status_code") + val statusCode: Int, + ) + /** * Request type for `Organizations.delete`. */ diff --git a/stytch/src/main/kotlin/com/stytch/java/b2b/models/organizationsmembers/OrganizationsMembers.kt b/stytch/src/main/kotlin/com/stytch/java/b2b/models/organizationsmembers/OrganizationsMembers.kt index 748b7b64..008f7420 100644 --- a/stytch/src/main/kotlin/com/stytch/java/b2b/models/organizationsmembers/OrganizationsMembers.kt +++ b/stytch/src/main/kotlin/com/stytch/java/b2b/models/organizationsmembers/OrganizationsMembers.kt @@ -59,6 +59,25 @@ public data class CreateRequestOptions } } +public data class DeleteExternalIdRequestOptions + @JvmOverloads + constructor( + /** + * Optional authorization object. + * Pass in an active Stytch Member session token or session JWT and the request + * will be run using that member's permissions. + */ + val authorization: Authorization? = null, + ) { + internal fun addHeaders(headers: Map = emptyMap()): Map { + var res = mapOf() + if (authorization != null) { + res = authorization.addHeaders(res) + } + return res + headers + } + } + public data class DeleteMFAPhoneNumberRequestOptions @JvmOverloads constructor( @@ -387,6 +406,32 @@ public data class DangerouslyGetRequest val includeDeleted: Boolean? = null, ) +@JsonClass(generateAdapter = true) +public data class DeleteExternalIdRequest + @JvmOverloads + constructor( + @Json(name = "organization_id") + val organizationId: String, + @Json(name = "member_id") + val memberId: String, + ) + +@JsonClass(generateAdapter = true) +public data class DeleteExternalIdResponse + @JvmOverloads + constructor( + @Json(name = "request_id") + val requestId: String, + @Json(name = "member_id") + val memberId: String, + @Json(name = "member") + val member: Member, + @Json(name = "organization") + val organization: Organization, + @Json(name = "status_code") + val statusCode: Int, + ) + /** * Request type for `Members.deleteMFAPhoneNumber`. */ diff --git a/stytch/src/main/kotlin/com/stytch/java/b2b/models/rbac/RBAC.kt b/stytch/src/main/kotlin/com/stytch/java/b2b/models/rbac/RBAC.kt index 7933c580..94c2e59f 100644 --- a/stytch/src/main/kotlin/com/stytch/java/b2b/models/rbac/RBAC.kt +++ b/stytch/src/main/kotlin/com/stytch/java/b2b/models/rbac/RBAC.kt @@ -9,6 +9,17 @@ package com.stytch.java.b2b.models.rbac import com.squareup.moshi.Json import com.squareup.moshi.JsonClass +@JsonClass(generateAdapter = true) +public data class OrgPolicy + @JvmOverloads + constructor( + /** + * An array of [Role objects](https://stytch.com/docs/b2b/api/rbac-role-object). + */ + @Json(name = "roles") + val roles: List, + ) + @JsonClass(generateAdapter = true) public data class Policy @JvmOverloads diff --git a/stytch/src/main/kotlin/com/stytch/java/b2b/models/rbacorganizations/RBACOrganizations.kt b/stytch/src/main/kotlin/com/stytch/java/b2b/models/rbacorganizations/RBACOrganizations.kt new file mode 100644 index 00000000..b9cdcd6b --- /dev/null +++ b/stytch/src/main/kotlin/com/stytch/java/b2b/models/rbacorganizations/RBACOrganizations.kt @@ -0,0 +1,103 @@ +package com.stytch.java.b2b.models.rbacorganizations + +// !!! +// WARNING: This file is autogenerated +// Only modify code within MANUAL() sections +// or your changes may be overwritten later! +// !!! + +import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass +import com.stytch.java.b2b.models.rbac.OrgPolicy + +/** +* Request type for `Organizations.getOrgPolicy`. +*/ +@JsonClass(generateAdapter = true) +public data class GetOrgPolicyRequest + @JvmOverloads + constructor( + /** + * Globally unique UUID that identifies a specific Organization. The `organization_id` is critical to perform operations + * on an Organization, so be sure to preserve this value. You may also use the organization_slug or + * organization_external_id here as a convenience. + */ + @Json(name = "organization_id") + val organizationId: String, + ) + +/** +* Response type for `Organizations.getOrgPolicy`. +*/ +@JsonClass(generateAdapter = true) +public data class GetOrgPolicyResponse + @JvmOverloads + constructor( + /** + * Globally unique UUID that is returned with every API call. This value is important to log for debugging purposes; we + * may ask for this value to help identify a specific API call when helping you debug an issue. + */ + @Json(name = "request_id") + val requestId: String, + /** + * The organization-specific RBAC Policy that contains roles defined for this organization. Organization policies + * supplement the project-level RBAC policy with additional roles that are specific to the organization. + */ + @Json(name = "org_policy") + val orgPolicy: OrgPolicy, + /** + * The HTTP status code of the response. Stytch follows standard HTTP response status code patterns, e.g. 2XX values + * equate to success, 3XX values are redirects, 4XX are client errors, and 5XX are server errors. + */ + @Json(name = "status_code") + val statusCode: Int, + ) + +/** +* Request type for `Organizations.setOrgPolicy`. +*/ +@JsonClass(generateAdapter = true) +public data class SetOrgPolicyRequest + @JvmOverloads + constructor( + /** + * Globally unique UUID that identifies a specific Organization. The `organization_id` is critical to perform operations + * on an Organization, so be sure to preserve this value. You may also use the organization_slug or + * organization_external_id here as a convenience. + */ + @Json(name = "organization_id") + val organizationId: String, + /** + * The organization-specific RBAC Policy that contains roles defined for this organization. Organization policies + * supplement the project-level RBAC policy with additional roles that are specific to the organization. + */ + @Json(name = "org_policy") + val orgPolicy: OrgPolicy, + ) + +/** +* Response type for `Organizations.setOrgPolicy`. +*/ +@JsonClass(generateAdapter = true) +public data class SetOrgPolicyResponse + @JvmOverloads + constructor( + /** + * Globally unique UUID that is returned with every API call. This value is important to log for debugging purposes; we + * may ask for this value to help identify a specific API call when helping you debug an issue. + */ + @Json(name = "request_id") + val requestId: String, + /** + * The organization-specific RBAC Policy that contains roles defined for this organization. Organization policies + * supplement the project-level RBAC policy with additional roles that are specific to the organization. + */ + @Json(name = "org_policy") + val orgPolicy: OrgPolicy, + /** + * The HTTP status code of the response. Stytch follows standard HTTP response status code patterns, e.g. 2XX values + * equate to success, 3XX values are redirects, 4XX are client errors, and 5XX are server errors. + */ + @Json(name = "status_code") + val statusCode: Int, + ) diff --git a/stytch/src/main/kotlin/com/stytch/java/common/Version.kt b/stytch/src/main/kotlin/com/stytch/java/common/Version.kt index 5f131d33..a2c649d1 100644 --- a/stytch/src/main/kotlin/com/stytch/java/common/Version.kt +++ b/stytch/src/main/kotlin/com/stytch/java/common/Version.kt @@ -1,3 +1,3 @@ package com.stytch.java.common -internal const val VERSION = "9.0.0" +internal const val VERSION = "10.0.0" diff --git a/stytch/src/main/kotlin/com/stytch/java/consumer/StytchClient.kt b/stytch/src/main/kotlin/com/stytch/java/consumer/StytchClient.kt index e7d9a048..2875a223 100644 --- a/stytch/src/main/kotlin/com/stytch/java/consumer/StytchClient.kt +++ b/stytch/src/main/kotlin/com/stytch/java/consumer/StytchClient.kt @@ -50,11 +50,7 @@ import kotlinx.coroutines.SupervisorJob public class StytchClient @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 = diff --git a/stytch/src/main/kotlin/com/stytch/java/consumer/api/connectedappsclients/ConnectedAppsClients.kt b/stytch/src/main/kotlin/com/stytch/java/consumer/api/connectedappsclients/ConnectedAppsClients.kt index 05e20ba3..76e4d957 100644 --- a/stytch/src/main/kotlin/com/stytch/java/consumer/api/connectedappsclients/ConnectedAppsClients.kt +++ b/stytch/src/main/kotlin/com/stytch/java/consumer/api/connectedappsclients/ConnectedAppsClients.kt @@ -170,10 +170,9 @@ internal class ClientsImpl( } override fun getCompletable(data: GetRequest): CompletableFuture> = - coroutineScope - .async { - get(data) - }.asCompletableFuture() + coroutineScope.async { + get(data) + }.asCompletableFuture() override suspend fun update(data: UpdateRequest): StytchResult = withContext(Dispatchers.IO) { @@ -193,10 +192,9 @@ internal class ClientsImpl( } override fun updateCompletable(data: UpdateRequest): CompletableFuture> = - coroutineScope - .async { - update(data) - }.asCompletableFuture() + coroutineScope.async { + update(data) + }.asCompletableFuture() override suspend fun delete(data: DeleteRequest): StytchResult = withContext(Dispatchers.IO) { @@ -215,10 +213,9 @@ internal class ClientsImpl( } override fun deleteCompletable(data: DeleteRequest): CompletableFuture> = - coroutineScope - .async { - delete(data) - }.asCompletableFuture() + coroutineScope.async { + delete(data) + }.asCompletableFuture() override suspend fun search(data: SearchRequest): StytchResult = withContext(Dispatchers.IO) { @@ -238,10 +235,9 @@ internal class ClientsImpl( } override fun searchCompletable(data: SearchRequest): CompletableFuture> = - coroutineScope - .async { - search(data) - }.asCompletableFuture() + coroutineScope.async { + search(data) + }.asCompletableFuture() override suspend fun create(data: CreateRequest): StytchResult = withContext(Dispatchers.IO) { @@ -261,8 +257,7 @@ internal class ClientsImpl( } override fun createCompletable(data: CreateRequest): CompletableFuture> = - coroutineScope - .async { - create(data) - }.asCompletableFuture() + coroutineScope.async { + create(data) + }.asCompletableFuture() } diff --git a/stytch/src/main/kotlin/com/stytch/java/consumer/api/connectedappsclientssecrets/ConnectedAppsClientsSecrets.kt b/stytch/src/main/kotlin/com/stytch/java/consumer/api/connectedappsclientssecrets/ConnectedAppsClientsSecrets.kt index a8f4e3aa..a40400b1 100644 --- a/stytch/src/main/kotlin/com/stytch/java/consumer/api/connectedappsclientssecrets/ConnectedAppsClientsSecrets.kt +++ b/stytch/src/main/kotlin/com/stytch/java/consumer/api/connectedappsclientssecrets/ConnectedAppsClientsSecrets.kt @@ -137,10 +137,9 @@ internal class SecretsImpl( } override fun rotateStartCompletable(data: RotateStartRequest): CompletableFuture> = - coroutineScope - .async { - rotateStart(data) - }.asCompletableFuture() + coroutineScope.async { + rotateStart(data) + }.asCompletableFuture() override suspend fun rotateCancel(data: RotateCancelRequest): StytchResult = withContext(Dispatchers.IO) { @@ -160,10 +159,9 @@ internal class SecretsImpl( } override fun rotateCancelCompletable(data: RotateCancelRequest): CompletableFuture> = - coroutineScope - .async { - rotateCancel(data) - }.asCompletableFuture() + coroutineScope.async { + rotateCancel(data) + }.asCompletableFuture() override suspend fun rotate(data: RotateRequest): StytchResult = withContext(Dispatchers.IO) { @@ -183,8 +181,7 @@ internal class SecretsImpl( } override fun rotateCompletable(data: RotateRequest): CompletableFuture> = - coroutineScope - .async { - rotate(data) - }.asCompletableFuture() + coroutineScope.async { + rotate(data) + }.asCompletableFuture() } diff --git a/stytch/src/main/kotlin/com/stytch/java/consumer/api/cryptowallets/CryptoWallets.kt b/stytch/src/main/kotlin/com/stytch/java/consumer/api/cryptowallets/CryptoWallets.kt index 640043dc..cbe81ebf 100644 --- a/stytch/src/main/kotlin/com/stytch/java/consumer/api/cryptowallets/CryptoWallets.kt +++ b/stytch/src/main/kotlin/com/stytch/java/consumer/api/cryptowallets/CryptoWallets.kt @@ -108,10 +108,9 @@ internal class CryptoWalletsImpl( } override fun authenticateStartCompletable(data: AuthenticateStartRequest): CompletableFuture> = - coroutineScope - .async { - authenticateStart(data) - }.asCompletableFuture() + coroutineScope.async { + authenticateStart(data) + }.asCompletableFuture() override suspend fun authenticate(data: AuthenticateRequest): StytchResult = withContext(Dispatchers.IO) { @@ -131,8 +130,7 @@ internal class CryptoWalletsImpl( } override fun authenticateCompletable(data: AuthenticateRequest): CompletableFuture> = - coroutineScope - .async { - authenticate(data) - }.asCompletableFuture() + coroutineScope.async { + authenticate(data) + }.asCompletableFuture() } diff --git a/stytch/src/main/kotlin/com/stytch/java/consumer/api/debug/Debug.kt b/stytch/src/main/kotlin/com/stytch/java/consumer/api/debug/Debug.kt index 64db01b8..2a32ce55 100644 --- a/stytch/src/main/kotlin/com/stytch/java/consumer/api/debug/Debug.kt +++ b/stytch/src/main/kotlin/com/stytch/java/consumer/api/debug/Debug.kt @@ -60,8 +60,7 @@ internal class DebugImpl( } override fun whoamiCompletable(data: WhoamiRequest): CompletableFuture> = - coroutineScope - .async { - whoami(data) - }.asCompletableFuture() + coroutineScope.async { + whoami(data) + }.asCompletableFuture() } diff --git a/stytch/src/main/kotlin/com/stytch/java/consumer/api/fraudfingerprint/FraudFingerprint.kt b/stytch/src/main/kotlin/com/stytch/java/consumer/api/fraudfingerprint/FraudFingerprint.kt index 6cb89040..b4b9b024 100644 --- a/stytch/src/main/kotlin/com/stytch/java/consumer/api/fraudfingerprint/FraudFingerprint.kt +++ b/stytch/src/main/kotlin/com/stytch/java/consumer/api/fraudfingerprint/FraudFingerprint.kt @@ -115,8 +115,7 @@ internal class FingerprintImpl( } override fun lookupCompletable(data: LookupRequest): CompletableFuture> = - coroutineScope - .async { - lookup(data) - }.asCompletableFuture() + coroutineScope.async { + lookup(data) + }.asCompletableFuture() } diff --git a/stytch/src/main/kotlin/com/stytch/java/consumer/api/fraudrules/FraudRules.kt b/stytch/src/main/kotlin/com/stytch/java/consumer/api/fraudrules/FraudRules.kt index 936aeae9..b5486a3c 100644 --- a/stytch/src/main/kotlin/com/stytch/java/consumer/api/fraudrules/FraudRules.kt +++ b/stytch/src/main/kotlin/com/stytch/java/consumer/api/fraudrules/FraudRules.kt @@ -141,10 +141,9 @@ internal class RulesImpl( } override fun setCompletable(data: SetRequest): CompletableFuture> = - coroutineScope - .async { - set(data) - }.asCompletableFuture() + coroutineScope.async { + set(data) + }.asCompletableFuture() override suspend fun list(data: ListRequest): StytchResult = withContext(Dispatchers.IO) { @@ -164,8 +163,7 @@ internal class RulesImpl( } override fun listCompletable(data: ListRequest): CompletableFuture> = - coroutineScope - .async { - list(data) - }.asCompletableFuture() + coroutineScope.async { + list(data) + }.asCompletableFuture() } diff --git a/stytch/src/main/kotlin/com/stytch/java/consumer/api/fraudverdictreasons/FraudVerdictReasons.kt b/stytch/src/main/kotlin/com/stytch/java/consumer/api/fraudverdictreasons/FraudVerdictReasons.kt index e18a3a71..20dc495f 100644 --- a/stytch/src/main/kotlin/com/stytch/java/consumer/api/fraudverdictreasons/FraudVerdictReasons.kt +++ b/stytch/src/main/kotlin/com/stytch/java/consumer/api/fraudverdictreasons/FraudVerdictReasons.kt @@ -108,10 +108,9 @@ internal class VerdictReasonsImpl( } override fun overrideCompletable(data: OverrideRequest): CompletableFuture> = - coroutineScope - .async { - override(data) - }.asCompletableFuture() + coroutineScope.async { + override(data) + }.asCompletableFuture() override suspend fun list(data: ListRequest): StytchResult = withContext(Dispatchers.IO) { @@ -131,8 +130,7 @@ internal class VerdictReasonsImpl( } override fun listCompletable(data: ListRequest): CompletableFuture> = - coroutineScope - .async { - list(data) - }.asCompletableFuture() + coroutineScope.async { + list(data) + }.asCompletableFuture() } diff --git a/stytch/src/main/kotlin/com/stytch/java/consumer/api/idpoauth/IDPOAuth.kt b/stytch/src/main/kotlin/com/stytch/java/consumer/api/idpoauth/IDPOAuth.kt index c6aee897..b293ac71 100644 --- a/stytch/src/main/kotlin/com/stytch/java/consumer/api/idpoauth/IDPOAuth.kt +++ b/stytch/src/main/kotlin/com/stytch/java/consumer/api/idpoauth/IDPOAuth.kt @@ -213,10 +213,9 @@ internal class OAuthImpl( } override fun authorizeStartCompletable(data: AuthorizeStartRequest): CompletableFuture> = - coroutineScope - .async { - authorizeStart(data) - }.asCompletableFuture() + coroutineScope.async { + authorizeStart(data) + }.asCompletableFuture() override suspend fun authorize(data: AuthorizeRequest): StytchResult = withContext(Dispatchers.IO) { @@ -236,8 +235,7 @@ internal class OAuthImpl( } override fun authorizeCompletable(data: AuthorizeRequest): CompletableFuture> = - coroutineScope - .async { - authorize(data) - }.asCompletableFuture() + coroutineScope.async { + authorize(data) + }.asCompletableFuture() } diff --git a/stytch/src/main/kotlin/com/stytch/java/consumer/api/impersonation/Impersonation.kt b/stytch/src/main/kotlin/com/stytch/java/consumer/api/impersonation/Impersonation.kt index d10e1619..7ea42f58 100644 --- a/stytch/src/main/kotlin/com/stytch/java/consumer/api/impersonation/Impersonation.kt +++ b/stytch/src/main/kotlin/com/stytch/java/consumer/api/impersonation/Impersonation.kt @@ -82,8 +82,7 @@ internal class ImpersonationImpl( } override fun authenticateCompletable(data: AuthenticateRequest): CompletableFuture> = - coroutineScope - .async { - authenticate(data) - }.asCompletableFuture() + coroutineScope.async { + authenticate(data) + }.asCompletableFuture() } diff --git a/stytch/src/main/kotlin/com/stytch/java/consumer/api/m2mclients/M2MClients.kt b/stytch/src/main/kotlin/com/stytch/java/consumer/api/m2mclients/M2MClients.kt index 36ee778d..84fbdf5c 100644 --- a/stytch/src/main/kotlin/com/stytch/java/consumer/api/m2mclients/M2MClients.kt +++ b/stytch/src/main/kotlin/com/stytch/java/consumer/api/m2mclients/M2MClients.kt @@ -221,10 +221,9 @@ internal class ClientsImpl( } override fun getCompletable(data: GetRequest): CompletableFuture> = - coroutineScope - .async { - get(data) - }.asCompletableFuture() + coroutineScope.async { + get(data) + }.asCompletableFuture() override suspend fun search(data: SearchRequest): StytchResult = withContext(Dispatchers.IO) { @@ -244,10 +243,9 @@ internal class ClientsImpl( } override fun searchCompletable(data: SearchRequest): CompletableFuture> = - coroutineScope - .async { - search(data) - }.asCompletableFuture() + coroutineScope.async { + search(data) + }.asCompletableFuture() override suspend fun update(data: UpdateRequest): StytchResult = withContext(Dispatchers.IO) { @@ -267,10 +265,9 @@ internal class ClientsImpl( } override fun updateCompletable(data: UpdateRequest): CompletableFuture> = - coroutineScope - .async { - update(data) - }.asCompletableFuture() + coroutineScope.async { + update(data) + }.asCompletableFuture() override suspend fun delete(data: DeleteRequest): StytchResult = withContext(Dispatchers.IO) { @@ -289,10 +286,9 @@ internal class ClientsImpl( } override fun deleteCompletable(data: DeleteRequest): CompletableFuture> = - coroutineScope - .async { - delete(data) - }.asCompletableFuture() + coroutineScope.async { + delete(data) + }.asCompletableFuture() override suspend fun create(data: CreateRequest): StytchResult = withContext(Dispatchers.IO) { @@ -312,8 +308,7 @@ internal class ClientsImpl( } override fun createCompletable(data: CreateRequest): CompletableFuture> = - coroutineScope - .async { - create(data) - }.asCompletableFuture() + coroutineScope.async { + create(data) + }.asCompletableFuture() } diff --git a/stytch/src/main/kotlin/com/stytch/java/consumer/api/m2mclientssecrets/M2MClientsSecrets.kt b/stytch/src/main/kotlin/com/stytch/java/consumer/api/m2mclientssecrets/M2MClientsSecrets.kt index 1c866b93..a00de29f 100644 --- a/stytch/src/main/kotlin/com/stytch/java/consumer/api/m2mclientssecrets/M2MClientsSecrets.kt +++ b/stytch/src/main/kotlin/com/stytch/java/consumer/api/m2mclientssecrets/M2MClientsSecrets.kt @@ -152,10 +152,9 @@ internal class SecretsImpl( } override fun rotateStartCompletable(data: RotateStartRequest): CompletableFuture> = - coroutineScope - .async { - rotateStart(data) - }.asCompletableFuture() + coroutineScope.async { + rotateStart(data) + }.asCompletableFuture() override suspend fun rotateCancel(data: RotateCancelRequest): StytchResult = withContext(Dispatchers.IO) { @@ -175,10 +174,9 @@ internal class SecretsImpl( } override fun rotateCancelCompletable(data: RotateCancelRequest): CompletableFuture> = - coroutineScope - .async { - rotateCancel(data) - }.asCompletableFuture() + coroutineScope.async { + rotateCancel(data) + }.asCompletableFuture() override suspend fun rotate(data: RotateRequest): StytchResult = withContext(Dispatchers.IO) { @@ -198,8 +196,7 @@ internal class SecretsImpl( } override fun rotateCompletable(data: RotateRequest): CompletableFuture> = - coroutineScope - .async { - rotate(data) - }.asCompletableFuture() + coroutineScope.async { + rotate(data) + }.asCompletableFuture() } diff --git a/stytch/src/main/kotlin/com/stytch/java/consumer/api/magiclinks/MagicLinks.kt b/stytch/src/main/kotlin/com/stytch/java/consumer/api/magiclinks/MagicLinks.kt index f4fae76c..bb001d01 100644 --- a/stytch/src/main/kotlin/com/stytch/java/consumer/api/magiclinks/MagicLinks.kt +++ b/stytch/src/main/kotlin/com/stytch/java/consumer/api/magiclinks/MagicLinks.kt @@ -120,10 +120,9 @@ internal class MagicLinksImpl( } override fun authenticateCompletable(data: AuthenticateRequest): CompletableFuture> = - coroutineScope - .async { - authenticate(data) - }.asCompletableFuture() + coroutineScope.async { + authenticate(data) + }.asCompletableFuture() override suspend fun create(data: CreateRequest): StytchResult = withContext(Dispatchers.IO) { @@ -143,8 +142,7 @@ internal class MagicLinksImpl( } override fun createCompletable(data: CreateRequest): CompletableFuture> = - coroutineScope - .async { - create(data) - }.asCompletableFuture() + coroutineScope.async { + create(data) + }.asCompletableFuture() } diff --git a/stytch/src/main/kotlin/com/stytch/java/consumer/api/magiclinksemail/MagicLinksEmail.kt b/stytch/src/main/kotlin/com/stytch/java/consumer/api/magiclinksemail/MagicLinksEmail.kt index 851a588d..c72ebefd 100644 --- a/stytch/src/main/kotlin/com/stytch/java/consumer/api/magiclinksemail/MagicLinksEmail.kt +++ b/stytch/src/main/kotlin/com/stytch/java/consumer/api/magiclinksemail/MagicLinksEmail.kt @@ -214,10 +214,9 @@ internal class EmailImpl( } override fun sendCompletable(data: SendRequest): CompletableFuture> = - coroutineScope - .async { - send(data) - }.asCompletableFuture() + coroutineScope.async { + send(data) + }.asCompletableFuture() override suspend fun loginOrCreate(data: LoginOrCreateRequest): StytchResult = withContext(Dispatchers.IO) { @@ -237,10 +236,9 @@ internal class EmailImpl( } override fun loginOrCreateCompletable(data: LoginOrCreateRequest): CompletableFuture> = - coroutineScope - .async { - loginOrCreate(data) - }.asCompletableFuture() + coroutineScope.async { + loginOrCreate(data) + }.asCompletableFuture() override suspend fun invite(data: InviteRequest): StytchResult = withContext(Dispatchers.IO) { @@ -260,10 +258,9 @@ internal class EmailImpl( } override fun inviteCompletable(data: InviteRequest): CompletableFuture> = - coroutineScope - .async { - invite(data) - }.asCompletableFuture() + coroutineScope.async { + invite(data) + }.asCompletableFuture() override suspend fun revokeInvite(data: RevokeInviteRequest): StytchResult = withContext(Dispatchers.IO) { @@ -283,8 +280,7 @@ internal class EmailImpl( } override fun revokeInviteCompletable(data: RevokeInviteRequest): CompletableFuture> = - coroutineScope - .async { - revokeInvite(data) - }.asCompletableFuture() + coroutineScope.async { + revokeInvite(data) + }.asCompletableFuture() } diff --git a/stytch/src/main/kotlin/com/stytch/java/consumer/api/oauth/OAuth.kt b/stytch/src/main/kotlin/com/stytch/java/consumer/api/oauth/OAuth.kt index 5a4d0c9e..92bd6ab4 100644 --- a/stytch/src/main/kotlin/com/stytch/java/consumer/api/oauth/OAuth.kt +++ b/stytch/src/main/kotlin/com/stytch/java/consumer/api/oauth/OAuth.kt @@ -126,10 +126,9 @@ internal class OAuthImpl( } override fun attachCompletable(data: AttachRequest): CompletableFuture> = - coroutineScope - .async { - attach(data) - }.asCompletableFuture() + coroutineScope.async { + attach(data) + }.asCompletableFuture() override suspend fun authenticate(data: AuthenticateRequest): StytchResult = withContext(Dispatchers.IO) { @@ -149,8 +148,7 @@ internal class OAuthImpl( } override fun authenticateCompletable(data: AuthenticateRequest): CompletableFuture> = - coroutineScope - .async { - authenticate(data) - }.asCompletableFuture() + coroutineScope.async { + authenticate(data) + }.asCompletableFuture() } diff --git a/stytch/src/main/kotlin/com/stytch/java/consumer/api/otp/OTP.kt b/stytch/src/main/kotlin/com/stytch/java/consumer/api/otp/OTP.kt index 5143e70f..e57f564e 100644 --- a/stytch/src/main/kotlin/com/stytch/java/consumer/api/otp/OTP.kt +++ b/stytch/src/main/kotlin/com/stytch/java/consumer/api/otp/OTP.kt @@ -89,8 +89,7 @@ internal class OTPsImpl( } override fun authenticateCompletable(data: AuthenticateRequest): CompletableFuture> = - coroutineScope - .async { - authenticate(data) - }.asCompletableFuture() + coroutineScope.async { + authenticate(data) + }.asCompletableFuture() } diff --git a/stytch/src/main/kotlin/com/stytch/java/consumer/api/otpemail/OTPEmail.kt b/stytch/src/main/kotlin/com/stytch/java/consumer/api/otpemail/OTPEmail.kt index 822fbee0..a334c11c 100644 --- a/stytch/src/main/kotlin/com/stytch/java/consumer/api/otpemail/OTPEmail.kt +++ b/stytch/src/main/kotlin/com/stytch/java/consumer/api/otpemail/OTPEmail.kt @@ -138,10 +138,9 @@ internal class EmailImpl( } override fun sendCompletable(data: SendRequest): CompletableFuture> = - coroutineScope - .async { - send(data) - }.asCompletableFuture() + coroutineScope.async { + send(data) + }.asCompletableFuture() override suspend fun loginOrCreate(data: LoginOrCreateRequest): StytchResult = withContext(Dispatchers.IO) { @@ -161,8 +160,7 @@ internal class EmailImpl( } override fun loginOrCreateCompletable(data: LoginOrCreateRequest): CompletableFuture> = - coroutineScope - .async { - loginOrCreate(data) - }.asCompletableFuture() + coroutineScope.async { + loginOrCreate(data) + }.asCompletableFuture() } diff --git a/stytch/src/main/kotlin/com/stytch/java/consumer/api/otpsms/OTPSms.kt b/stytch/src/main/kotlin/com/stytch/java/consumer/api/otpsms/OTPSms.kt index 0260dfdf..586fd8a3 100644 --- a/stytch/src/main/kotlin/com/stytch/java/consumer/api/otpsms/OTPSms.kt +++ b/stytch/src/main/kotlin/com/stytch/java/consumer/api/otpsms/OTPSms.kt @@ -234,10 +234,9 @@ internal class SmsImpl( } override fun sendCompletable(data: SendRequest): CompletableFuture> = - coroutineScope - .async { - send(data) - }.asCompletableFuture() + coroutineScope.async { + send(data) + }.asCompletableFuture() override suspend fun loginOrCreate(data: LoginOrCreateRequest): StytchResult = withContext(Dispatchers.IO) { @@ -257,8 +256,7 @@ internal class SmsImpl( } override fun loginOrCreateCompletable(data: LoginOrCreateRequest): CompletableFuture> = - coroutineScope - .async { - loginOrCreate(data) - }.asCompletableFuture() + coroutineScope.async { + loginOrCreate(data) + }.asCompletableFuture() } diff --git a/stytch/src/main/kotlin/com/stytch/java/consumer/api/otpwhatsapp/OTPWhatsApp.kt b/stytch/src/main/kotlin/com/stytch/java/consumer/api/otpwhatsapp/OTPWhatsApp.kt index ff60c334..ecddd5c2 100644 --- a/stytch/src/main/kotlin/com/stytch/java/consumer/api/otpwhatsapp/OTPWhatsApp.kt +++ b/stytch/src/main/kotlin/com/stytch/java/consumer/api/otpwhatsapp/OTPWhatsApp.kt @@ -180,10 +180,9 @@ internal class WhatsAppImpl( } override fun sendCompletable(data: SendRequest): CompletableFuture> = - coroutineScope - .async { - send(data) - }.asCompletableFuture() + coroutineScope.async { + send(data) + }.asCompletableFuture() override suspend fun loginOrCreate(data: LoginOrCreateRequest): StytchResult = withContext(Dispatchers.IO) { @@ -203,8 +202,7 @@ internal class WhatsAppImpl( } override fun loginOrCreateCompletable(data: LoginOrCreateRequest): CompletableFuture> = - coroutineScope - .async { - loginOrCreate(data) - }.asCompletableFuture() + coroutineScope.async { + loginOrCreate(data) + }.asCompletableFuture() } diff --git a/stytch/src/main/kotlin/com/stytch/java/consumer/api/passwords/Passwords.kt b/stytch/src/main/kotlin/com/stytch/java/consumer/api/passwords/Passwords.kt index 207ca181..9d4220cb 100644 --- a/stytch/src/main/kotlin/com/stytch/java/consumer/api/passwords/Passwords.kt +++ b/stytch/src/main/kotlin/com/stytch/java/consumer/api/passwords/Passwords.kt @@ -293,10 +293,9 @@ internal class PasswordsImpl( } override fun createCompletable(data: CreateRequest): CompletableFuture> = - coroutineScope - .async { - create(data) - }.asCompletableFuture() + coroutineScope.async { + create(data) + }.asCompletableFuture() override suspend fun authenticate(data: AuthenticateRequest): StytchResult = withContext(Dispatchers.IO) { @@ -316,10 +315,9 @@ internal class PasswordsImpl( } override fun authenticateCompletable(data: AuthenticateRequest): CompletableFuture> = - coroutineScope - .async { - authenticate(data) - }.asCompletableFuture() + coroutineScope.async { + authenticate(data) + }.asCompletableFuture() override suspend fun strengthCheck(data: StrengthCheckRequest): StytchResult = withContext(Dispatchers.IO) { @@ -339,10 +337,9 @@ internal class PasswordsImpl( } override fun strengthCheckCompletable(data: StrengthCheckRequest): CompletableFuture> = - coroutineScope - .async { - strengthCheck(data) - }.asCompletableFuture() + coroutineScope.async { + strengthCheck(data) + }.asCompletableFuture() override suspend fun migrate(data: MigrateRequest): StytchResult = withContext(Dispatchers.IO) { @@ -362,8 +359,7 @@ internal class PasswordsImpl( } override fun migrateCompletable(data: MigrateRequest): CompletableFuture> = - coroutineScope - .async { - migrate(data) - }.asCompletableFuture() + coroutineScope.async { + migrate(data) + }.asCompletableFuture() } diff --git a/stytch/src/main/kotlin/com/stytch/java/consumer/api/passwordsemail/PasswordsEmail.kt b/stytch/src/main/kotlin/com/stytch/java/consumer/api/passwordsemail/PasswordsEmail.kt index 3c0f8fc1..5dca5fb1 100644 --- a/stytch/src/main/kotlin/com/stytch/java/consumer/api/passwordsemail/PasswordsEmail.kt +++ b/stytch/src/main/kotlin/com/stytch/java/consumer/api/passwordsemail/PasswordsEmail.kt @@ -111,10 +111,9 @@ internal class EmailImpl( } override fun resetStartCompletable(data: ResetStartRequest): CompletableFuture> = - coroutineScope - .async { - resetStart(data) - }.asCompletableFuture() + coroutineScope.async { + resetStart(data) + }.asCompletableFuture() override suspend fun reset(data: ResetRequest): StytchResult = withContext(Dispatchers.IO) { @@ -134,8 +133,7 @@ internal class EmailImpl( } override fun resetCompletable(data: ResetRequest): CompletableFuture> = - coroutineScope - .async { - reset(data) - }.asCompletableFuture() + coroutineScope.async { + reset(data) + }.asCompletableFuture() } diff --git a/stytch/src/main/kotlin/com/stytch/java/consumer/api/passwordsexistingpassword/PasswordsExistingPassword.kt b/stytch/src/main/kotlin/com/stytch/java/consumer/api/passwordsexistingpassword/PasswordsExistingPassword.kt index 252e2b81..d9b9d1af 100644 --- a/stytch/src/main/kotlin/com/stytch/java/consumer/api/passwordsexistingpassword/PasswordsExistingPassword.kt +++ b/stytch/src/main/kotlin/com/stytch/java/consumer/api/passwordsexistingpassword/PasswordsExistingPassword.kt @@ -70,8 +70,7 @@ internal class ExistingPasswordImpl( } override fun resetCompletable(data: ResetRequest): CompletableFuture> = - coroutineScope - .async { - reset(data) - }.asCompletableFuture() + coroutineScope.async { + reset(data) + }.asCompletableFuture() } diff --git a/stytch/src/main/kotlin/com/stytch/java/consumer/api/passwordssession/PasswordsSession.kt b/stytch/src/main/kotlin/com/stytch/java/consumer/api/passwordssession/PasswordsSession.kt index e11cf092..f9c16969 100644 --- a/stytch/src/main/kotlin/com/stytch/java/consumer/api/passwordssession/PasswordsSession.kt +++ b/stytch/src/main/kotlin/com/stytch/java/consumer/api/passwordssession/PasswordsSession.kt @@ -79,8 +79,7 @@ internal class SessionsImpl( } override fun resetCompletable(data: ResetRequest): CompletableFuture> = - coroutineScope - .async { - reset(data) - }.asCompletableFuture() + coroutineScope.async { + reset(data) + }.asCompletableFuture() } diff --git a/stytch/src/main/kotlin/com/stytch/java/consumer/api/project/Project.kt b/stytch/src/main/kotlin/com/stytch/java/consumer/api/project/Project.kt index 6df7fa3a..9a7d54d6 100644 --- a/stytch/src/main/kotlin/com/stytch/java/consumer/api/project/Project.kt +++ b/stytch/src/main/kotlin/com/stytch/java/consumer/api/project/Project.kt @@ -60,8 +60,7 @@ internal class ProjectImpl( } override fun metricsCompletable(data: MetricsRequest): CompletableFuture> = - coroutineScope - .async { - metrics(data) - }.asCompletableFuture() + coroutineScope.async { + metrics(data) + }.asCompletableFuture() } diff --git a/stytch/src/main/kotlin/com/stytch/java/consumer/api/rbac/RBAC.kt b/stytch/src/main/kotlin/com/stytch/java/consumer/api/rbac/RBAC.kt index 83800dde..d4a99f1a 100644 --- a/stytch/src/main/kotlin/com/stytch/java/consumer/api/rbac/RBAC.kt +++ b/stytch/src/main/kotlin/com/stytch/java/consumer/api/rbac/RBAC.kt @@ -111,8 +111,7 @@ internal class RBACImpl( } override fun policyCompletable(data: PolicyRequest): CompletableFuture> = - coroutineScope - .async { - policy(data) - }.asCompletableFuture() + coroutineScope.async { + policy(data) + }.asCompletableFuture() } diff --git a/stytch/src/main/kotlin/com/stytch/java/consumer/api/sessions/Sessions.kt b/stytch/src/main/kotlin/com/stytch/java/consumer/api/sessions/Sessions.kt index cca7faf6..13cda83a 100644 --- a/stytch/src/main/kotlin/com/stytch/java/consumer/api/sessions/Sessions.kt +++ b/stytch/src/main/kotlin/com/stytch/java/consumer/api/sessions/Sessions.kt @@ -11,7 +11,6 @@ import com.squareup.moshi.Moshi import com.squareup.moshi.Types import com.stytch.java.common.InstantAdapter import com.stytch.java.common.JWTAuthResponse -import com.stytch.java.common.JWTErrorResponse import com.stytch.java.common.JWTException import com.stytch.java.common.JWTNullResponse import com.stytch.java.common.JWTResponse @@ -429,10 +428,9 @@ internal class SessionsImpl( } override fun getCompletable(data: GetRequest): CompletableFuture> = - coroutineScope - .async { - get(data) - }.asCompletableFuture() + coroutineScope.async { + get(data) + }.asCompletableFuture() override suspend fun authenticate(data: AuthenticateRequest): StytchResult = withContext(Dispatchers.IO) { @@ -452,10 +450,9 @@ internal class SessionsImpl( } override fun authenticateCompletable(data: AuthenticateRequest): CompletableFuture> = - coroutineScope - .async { - authenticate(data) - }.asCompletableFuture() + coroutineScope.async { + authenticate(data) + }.asCompletableFuture() override suspend fun revoke(data: RevokeRequest): StytchResult = withContext(Dispatchers.IO) { @@ -475,10 +472,9 @@ internal class SessionsImpl( } override fun revokeCompletable(data: RevokeRequest): CompletableFuture> = - coroutineScope - .async { - revoke(data) - }.asCompletableFuture() + coroutineScope.async { + revoke(data) + }.asCompletableFuture() override suspend fun migrate(data: MigrateRequest): StytchResult = withContext(Dispatchers.IO) { @@ -498,10 +494,9 @@ internal class SessionsImpl( } override fun migrateCompletable(data: MigrateRequest): CompletableFuture> = - coroutineScope - .async { - migrate(data) - }.asCompletableFuture() + coroutineScope.async { + migrate(data) + }.asCompletableFuture() override suspend fun exchangeAccessToken(data: ExchangeAccessTokenRequest): StytchResult = withContext(Dispatchers.IO) { @@ -523,10 +518,9 @@ internal class SessionsImpl( override fun exchangeAccessTokenCompletable( data: ExchangeAccessTokenRequest, ): CompletableFuture> = - coroutineScope - .async { - exchangeAccessToken(data) - }.asCompletableFuture() + coroutineScope.async { + exchangeAccessToken(data) + }.asCompletableFuture() override suspend fun getJWKS(data: GetJWKSRequest): StytchResult = withContext(Dispatchers.IO) { @@ -549,10 +543,9 @@ internal class SessionsImpl( } override fun getJWKSCompletable(data: GetJWKSRequest): CompletableFuture> = - coroutineScope - .async { - getJWKS(data) - }.asCompletableFuture() + coroutineScope.async { + getJWKS(data) + }.asCompletableFuture() override suspend fun attest(data: AttestRequest): StytchResult = withContext(Dispatchers.IO) { @@ -572,10 +565,9 @@ internal class SessionsImpl( } override fun attestCompletable(data: AttestRequest): CompletableFuture> = - coroutineScope - .async { - attest(data) - }.asCompletableFuture() + coroutineScope.async { + attest(data) + }.asCompletableFuture() // MANUAL(authenticateJWT_impl)(SERVICE_METHOD) override suspend fun authenticateJwt( diff --git a/stytch/src/main/kotlin/com/stytch/java/consumer/api/totps/TOTPs.kt b/stytch/src/main/kotlin/com/stytch/java/consumer/api/totps/TOTPs.kt index 79deec54..ec1db76f 100644 --- a/stytch/src/main/kotlin/com/stytch/java/consumer/api/totps/TOTPs.kt +++ b/stytch/src/main/kotlin/com/stytch/java/consumer/api/totps/TOTPs.kt @@ -127,10 +127,9 @@ internal class TOTPsImpl( } override fun createCompletable(data: CreateRequest): CompletableFuture> = - coroutineScope - .async { - create(data) - }.asCompletableFuture() + coroutineScope.async { + create(data) + }.asCompletableFuture() override suspend fun authenticate(data: AuthenticateRequest): StytchResult = withContext(Dispatchers.IO) { @@ -150,10 +149,9 @@ internal class TOTPsImpl( } override fun authenticateCompletable(data: AuthenticateRequest): CompletableFuture> = - coroutineScope - .async { - authenticate(data) - }.asCompletableFuture() + coroutineScope.async { + authenticate(data) + }.asCompletableFuture() override suspend fun recoveryCodes(data: RecoveryCodesRequest): StytchResult = withContext(Dispatchers.IO) { @@ -173,10 +171,9 @@ internal class TOTPsImpl( } override fun recoveryCodesCompletable(data: RecoveryCodesRequest): CompletableFuture> = - coroutineScope - .async { - recoveryCodes(data) - }.asCompletableFuture() + coroutineScope.async { + recoveryCodes(data) + }.asCompletableFuture() override suspend fun recover(data: RecoverRequest): StytchResult = withContext(Dispatchers.IO) { @@ -196,8 +193,7 @@ internal class TOTPsImpl( } override fun recoverCompletable(data: RecoverRequest): CompletableFuture> = - coroutineScope - .async { - recover(data) - }.asCompletableFuture() + coroutineScope.async { + recover(data) + }.asCompletableFuture() } diff --git a/stytch/src/main/kotlin/com/stytch/java/consumer/api/users/Users.kt b/stytch/src/main/kotlin/com/stytch/java/consumer/api/users/Users.kt index 1c632a9c..1d8bf60c 100644 --- a/stytch/src/main/kotlin/com/stytch/java/consumer/api/users/Users.kt +++ b/stytch/src/main/kotlin/com/stytch/java/consumer/api/users/Users.kt @@ -21,6 +21,8 @@ import com.stytch.java.consumer.models.users.DeleteCryptoWalletRequest import com.stytch.java.consumer.models.users.DeleteCryptoWalletResponse import com.stytch.java.consumer.models.users.DeleteEmailRequest import com.stytch.java.consumer.models.users.DeleteEmailResponse +import com.stytch.java.consumer.models.users.DeleteExternalIdRequest +import com.stytch.java.consumer.models.users.DeleteExternalIdResponse import com.stytch.java.consumer.models.users.DeleteOAuthRegistrationRequest import com.stytch.java.consumer.models.users.DeleteOAuthRegistrationResponse import com.stytch.java.consumer.models.users.DeletePasswordRequest @@ -410,6 +412,15 @@ public interface Users { data: DeleteOAuthRegistrationRequest, ): CompletableFuture> + public suspend fun deleteExternalId(data: DeleteExternalIdRequest): StytchResult + + public fun deleteExternalId( + data: DeleteExternalIdRequest, + callback: (StytchResult) -> Unit, + ) + + public fun deleteExternalIdCompletable(data: DeleteExternalIdRequest): CompletableFuture> + /** * User Get Connected Apps retrieves a list of Connected Apps with which the User has successfully completed an * authorization flow. @@ -486,10 +497,9 @@ internal class UsersImpl( } override fun createCompletable(data: CreateRequest): CompletableFuture> = - coroutineScope - .async { - create(data) - }.asCompletableFuture() + coroutineScope.async { + create(data) + }.asCompletableFuture() override suspend fun get(data: GetRequest): StytchResult = withContext(Dispatchers.IO) { @@ -512,10 +522,9 @@ internal class UsersImpl( } override fun getCompletable(data: GetRequest): CompletableFuture> = - coroutineScope - .async { - get(data) - }.asCompletableFuture() + coroutineScope.async { + get(data) + }.asCompletableFuture() override suspend fun search(data: SearchRequest): StytchResult = withContext(Dispatchers.IO) { @@ -535,10 +544,9 @@ internal class UsersImpl( } override fun searchCompletable(data: SearchRequest): CompletableFuture> = - coroutineScope - .async { - search(data) - }.asCompletableFuture() + coroutineScope.async { + search(data) + }.asCompletableFuture() override suspend fun update(data: UpdateRequest): StytchResult = withContext(Dispatchers.IO) { @@ -558,10 +566,9 @@ internal class UsersImpl( } override fun updateCompletable(data: UpdateRequest): CompletableFuture> = - coroutineScope - .async { - update(data) - }.asCompletableFuture() + coroutineScope.async { + update(data) + }.asCompletableFuture() override suspend fun exchangePrimaryFactor(data: ExchangePrimaryFactorRequest): StytchResult = withContext(Dispatchers.IO) { @@ -583,10 +590,9 @@ internal class UsersImpl( override fun exchangePrimaryFactorCompletable( data: ExchangePrimaryFactorRequest, ): CompletableFuture> = - coroutineScope - .async { - exchangePrimaryFactor(data) - }.asCompletableFuture() + coroutineScope.async { + exchangePrimaryFactor(data) + }.asCompletableFuture() override suspend fun delete(data: DeleteRequest): StytchResult = withContext(Dispatchers.IO) { @@ -605,10 +611,9 @@ internal class UsersImpl( } override fun deleteCompletable(data: DeleteRequest): CompletableFuture> = - coroutineScope - .async { - delete(data) - }.asCompletableFuture() + coroutineScope.async { + delete(data) + }.asCompletableFuture() override suspend fun deleteEmail(data: DeleteEmailRequest): StytchResult = withContext(Dispatchers.IO) { @@ -627,10 +632,9 @@ internal class UsersImpl( } override fun deleteEmailCompletable(data: DeleteEmailRequest): CompletableFuture> = - coroutineScope - .async { - deleteEmail(data) - }.asCompletableFuture() + coroutineScope.async { + deleteEmail(data) + }.asCompletableFuture() override suspend fun deletePhoneNumber(data: DeletePhoneNumberRequest): StytchResult = withContext(Dispatchers.IO) { @@ -649,10 +653,9 @@ internal class UsersImpl( } override fun deletePhoneNumberCompletable(data: DeletePhoneNumberRequest): CompletableFuture> = - coroutineScope - .async { - deletePhoneNumber(data) - }.asCompletableFuture() + coroutineScope.async { + deletePhoneNumber(data) + }.asCompletableFuture() override suspend fun deleteWebAuthnRegistration( data: DeleteWebAuthnRegistrationRequest, @@ -675,10 +678,9 @@ internal class UsersImpl( override fun deleteWebAuthnRegistrationCompletable( data: DeleteWebAuthnRegistrationRequest, ): CompletableFuture> = - coroutineScope - .async { - deleteWebAuthnRegistration(data) - }.asCompletableFuture() + coroutineScope.async { + deleteWebAuthnRegistration(data) + }.asCompletableFuture() override suspend fun deleteBiometricRegistration( data: DeleteBiometricRegistrationRequest, @@ -701,10 +703,9 @@ internal class UsersImpl( override fun deleteBiometricRegistrationCompletable( data: DeleteBiometricRegistrationRequest, ): CompletableFuture> = - coroutineScope - .async { - deleteBiometricRegistration(data) - }.asCompletableFuture() + coroutineScope.async { + deleteBiometricRegistration(data) + }.asCompletableFuture() override suspend fun deleteTOTP(data: DeleteTOTPRequest): StytchResult = withContext(Dispatchers.IO) { @@ -723,10 +724,9 @@ internal class UsersImpl( } override fun deleteTOTPCompletable(data: DeleteTOTPRequest): CompletableFuture> = - coroutineScope - .async { - deleteTOTP(data) - }.asCompletableFuture() + coroutineScope.async { + deleteTOTP(data) + }.asCompletableFuture() override suspend fun deleteCryptoWallet(data: DeleteCryptoWalletRequest): StytchResult = withContext(Dispatchers.IO) { @@ -747,10 +747,9 @@ internal class UsersImpl( override fun deleteCryptoWalletCompletable( data: DeleteCryptoWalletRequest, ): CompletableFuture> = - coroutineScope - .async { - deleteCryptoWallet(data) - }.asCompletableFuture() + coroutineScope.async { + deleteCryptoWallet(data) + }.asCompletableFuture() override suspend fun deletePassword(data: DeletePasswordRequest): StytchResult = withContext(Dispatchers.IO) { @@ -769,10 +768,9 @@ internal class UsersImpl( } override fun deletePasswordCompletable(data: DeletePasswordRequest): CompletableFuture> = - coroutineScope - .async { - deletePassword(data) - }.asCompletableFuture() + coroutineScope.async { + deletePassword(data) + }.asCompletableFuture() override suspend fun deleteOAuthRegistration(data: DeleteOAuthRegistrationRequest): StytchResult = withContext(Dispatchers.IO) { @@ -793,10 +791,30 @@ internal class UsersImpl( override fun deleteOAuthRegistrationCompletable( data: DeleteOAuthRegistrationRequest, ): CompletableFuture> = - coroutineScope - .async { - deleteOAuthRegistration(data) - }.asCompletableFuture() + coroutineScope.async { + deleteOAuthRegistration(data) + }.asCompletableFuture() + + override suspend fun deleteExternalId(data: DeleteExternalIdRequest): StytchResult = + withContext(Dispatchers.IO) { + var headers = emptyMap() + + httpClient.delete("/v1/users/${data.userId}/external_id", headers) + } + + override fun deleteExternalId( + data: DeleteExternalIdRequest, + callback: (StytchResult) -> Unit, + ) { + coroutineScope.launch { + callback(deleteExternalId(data)) + } + } + + override fun deleteExternalIdCompletable(data: DeleteExternalIdRequest): CompletableFuture> = + coroutineScope.async { + deleteExternalId(data) + }.asCompletableFuture() override suspend fun connectedApps(data: ConnectedAppsRequest): StytchResult = withContext(Dispatchers.IO) { @@ -819,10 +837,9 @@ internal class UsersImpl( } override fun connectedAppsCompletable(data: ConnectedAppsRequest): CompletableFuture> = - coroutineScope - .async { - connectedApps(data) - }.asCompletableFuture() + coroutineScope.async { + connectedApps(data) + }.asCompletableFuture() override suspend fun revoke(data: RevokeRequest): StytchResult = withContext(Dispatchers.IO) { @@ -842,8 +859,7 @@ internal class UsersImpl( } override fun revokeCompletable(data: RevokeRequest): CompletableFuture> = - coroutineScope - .async { - revoke(data) - }.asCompletableFuture() + coroutineScope.async { + revoke(data) + }.asCompletableFuture() } diff --git a/stytch/src/main/kotlin/com/stytch/java/consumer/api/webauthn/WebAuthn.kt b/stytch/src/main/kotlin/com/stytch/java/consumer/api/webauthn/WebAuthn.kt index 380aab87..ff712fa9 100644 --- a/stytch/src/main/kotlin/com/stytch/java/consumer/api/webauthn/WebAuthn.kt +++ b/stytch/src/main/kotlin/com/stytch/java/consumer/api/webauthn/WebAuthn.kt @@ -283,10 +283,9 @@ internal class WebAuthnImpl( } override fun registerStartCompletable(data: RegisterStartRequest): CompletableFuture> = - coroutineScope - .async { - registerStart(data) - }.asCompletableFuture() + coroutineScope.async { + registerStart(data) + }.asCompletableFuture() override suspend fun register(data: RegisterRequest): StytchResult = withContext(Dispatchers.IO) { @@ -306,10 +305,9 @@ internal class WebAuthnImpl( } override fun registerCompletable(data: RegisterRequest): CompletableFuture> = - coroutineScope - .async { - register(data) - }.asCompletableFuture() + coroutineScope.async { + register(data) + }.asCompletableFuture() override suspend fun authenticateStart(data: AuthenticateStartRequest): StytchResult = withContext(Dispatchers.IO) { @@ -329,10 +327,9 @@ internal class WebAuthnImpl( } override fun authenticateStartCompletable(data: AuthenticateStartRequest): CompletableFuture> = - coroutineScope - .async { - authenticateStart(data) - }.asCompletableFuture() + coroutineScope.async { + authenticateStart(data) + }.asCompletableFuture() override suspend fun authenticate(data: AuthenticateRequest): StytchResult = withContext(Dispatchers.IO) { @@ -352,10 +349,9 @@ internal class WebAuthnImpl( } override fun authenticateCompletable(data: AuthenticateRequest): CompletableFuture> = - coroutineScope - .async { - authenticate(data) - }.asCompletableFuture() + coroutineScope.async { + authenticate(data) + }.asCompletableFuture() override suspend fun update(data: UpdateRequest): StytchResult = withContext(Dispatchers.IO) { @@ -375,10 +371,9 @@ internal class WebAuthnImpl( } override fun updateCompletable(data: UpdateRequest): CompletableFuture> = - coroutineScope - .async { - update(data) - }.asCompletableFuture() + coroutineScope.async { + update(data) + }.asCompletableFuture() override suspend fun listCredentials(data: ListCredentialsRequest): StytchResult = withContext(Dispatchers.IO) { @@ -401,8 +396,7 @@ internal class WebAuthnImpl( } override fun listCredentialsCompletable(data: ListCredentialsRequest): CompletableFuture> = - coroutineScope - .async { - listCredentials(data) - }.asCompletableFuture() + coroutineScope.async { + listCredentials(data) + }.asCompletableFuture() } diff --git a/stytch/src/main/kotlin/com/stytch/java/consumer/models/connectedapps/ConnectedApps.kt b/stytch/src/main/kotlin/com/stytch/java/consumer/models/connectedapps/ConnectedApps.kt index bf435075..6cd0a331 100644 --- a/stytch/src/main/kotlin/com/stytch/java/consumer/models/connectedapps/ConnectedApps.kt +++ b/stytch/src/main/kotlin/com/stytch/java/consumer/models/connectedapps/ConnectedApps.kt @@ -81,6 +81,8 @@ public data class ConnectedApp val logoURL: String? = null, @Json(name = "client_id_metadata_url") val clientIdMetadataURL: String? = null, + @Json(name = "creation_method") + val creationMethod: String? = null, ) @JsonClass(generateAdapter = true) diff --git a/stytch/src/main/kotlin/com/stytch/java/consumer/models/users/Users.kt b/stytch/src/main/kotlin/com/stytch/java/consumer/models/users/Users.kt index abf93547..1b31409e 100644 --- a/stytch/src/main/kotlin/com/stytch/java/consumer/models/users/Users.kt +++ b/stytch/src/main/kotlin/com/stytch/java/consumer/models/users/Users.kt @@ -687,6 +687,28 @@ public data class DeleteEmailResponse val statusCode: Int, ) +@JsonClass(generateAdapter = true) +public data class DeleteExternalIdRequest + @JvmOverloads + constructor( + @Json(name = "user_id") + val userId: String, + ) + +@JsonClass(generateAdapter = true) +public data class DeleteExternalIdResponse + @JvmOverloads + constructor( + @Json(name = "request_id") + val requestId: String, + @Json(name = "user_id") + val userId: String, + @Json(name = "user") + val user: User, + @Json(name = "status_code") + val statusCode: Int, + ) + /** * Request type for `Users.deleteOAuthRegistration`. */ diff --git a/stytch/src/main/kotlin/com/stytch/java/consumer/models/webauthn/WebAuthn.kt b/stytch/src/main/kotlin/com/stytch/java/consumer/models/webauthn/WebAuthn.kt index ec6f5ac0..ac1bc6c2 100644 --- a/stytch/src/main/kotlin/com/stytch/java/consumer/models/webauthn/WebAuthn.kt +++ b/stytch/src/main/kotlin/com/stytch/java/consumer/models/webauthn/WebAuthn.kt @@ -183,6 +183,8 @@ public data class AuthenticateStartRequest */ @Json(name = "return_passkey_credential_options") val returnPasskeyCredentialOptions: Boolean? = null, + @Json(name = "use_base64_url_encoding") + val useBase64URLEncoding: Boolean? = null, ) /** diff --git a/version.gradle.kts b/version.gradle.kts index d85606e4..2876fa4e 100644 --- a/version.gradle.kts +++ b/version.gradle.kts @@ -1 +1 @@ -version = "9.0.0" +version = "10.0.0"