Skip to content
4 changes: 3 additions & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,8 @@ Many files are auto-generated (marked with `// WARNING: This file is auto-genera
- Filter classes in `filters/`
- Wrapper code in `ts-wrapper/`, `python-wrapper/`, `dart-wrapper/`

The code generation is a two steps process: JSON files that describe the syntax and semantics of the entities and APIs are maintained in `build/generated/ksp/jvm/jvmMain/resources/.../Class.json` and then the `sdk-codegen` tool generates the actual Kotlin/JS/Python/Dart code.

**Do not manually edit auto-generated files.** Generation is done by the external `sdk-codegen` tool.

### Key Annotations
Expand All @@ -134,4 +136,4 @@ Many files are auto-generated (marked with `// WARNING: This file is auto-genera
- Max line length: 140
- Trailing commas: enabled
- Wildcard imports: allowed
- Style: ktlint_official
- Style: ktlint_official
2 changes: 1 addition & 1 deletion cardinal-sdk/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ val mavenReleasesRepository: String by project

group = "com.icure"

val version = "2.1.2"
val version = "2.1.3"
project.version = version

val generateSdkVersion by tasks.registering {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ public interface RawFormApi {
groupId: String,
userId: String,
loadLayout: Boolean? = null,
raw: Boolean? = null,
): HttpResponse<List<FormTemplate>>

suspend fun createFormTemplateInGroup(
Expand Down Expand Up @@ -280,11 +281,13 @@ public interface RawFormApi {
suspend fun getFormTemplatesInGroup(
groupId: String,
formTemplateIds: ListOfIds,
raw: Boolean? = null,
): HttpResponse<List<FormTemplate>>

suspend fun getFormTemplateInGroup(
groupId: String,
formTemplateId: String,
raw: Boolean? = null,
): HttpResponse<FormTemplate>

suspend fun matchFormTemplatesInGroupBy(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -706,12 +706,14 @@ class RawFormApiImpl(
groupId: String,
userId: String,
loadLayout: Boolean?,
raw: Boolean?,
): HttpResponse<List<FormTemplate>> =
get(authProvider, groupId) {
url {
takeFrom(apiUrl)
appendPathSegments("rest", "v2", "form", "template", "inGroup", groupId, "byUser", userId)
parameter("loadLayout", loadLayout)
parameter("raw", raw)
parameter("ts", GMTDate().timestamp)
}
accept(Application.Json)
Expand Down Expand Up @@ -884,11 +886,13 @@ class RawFormApiImpl(
override suspend fun getFormTemplatesInGroup(
groupId: String,
formTemplateIds: ListOfIds,
raw: Boolean?,
): HttpResponse<List<FormTemplate>> =
post(authProvider, groupId) {
url {
takeFrom(apiUrl)
appendPathSegments("rest", "v2", "form", "template", "inGroup", groupId, "byIds")
parameter("raw", raw)
}
contentType(Application.Json)
accept(Application.Json)
Expand All @@ -898,11 +902,13 @@ class RawFormApiImpl(
override suspend fun getFormTemplateInGroup(
groupId: String,
formTemplateId: String,
raw: Boolean?,
): HttpResponse<FormTemplate> =
get(authProvider, groupId) {
url {
takeFrom(apiUrl)
appendPathSegments("rest", "v2", "form", "template", "inGroup", groupId, formTemplateId)
parameter("raw", raw)
parameter("ts", GMTDate().timestamp)
}
accept(Application.Json)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ sealed interface AuthSecretDetails {
* @param secret the token or another secret that will be used for authentication.
* @param minimumAuthenticationClass only consider configurations that can provide at least this authentication class. The actual
* authentication class obtained for the token may be higher.
* @param doNotUseProjectIdForGroupSelection only use the project id specified in the initialize method to choose the configuration of
* the external token, but not the group where to log in.
* @param doNotUseProjectIdForGroupSelection (INTERNAL USE ONLY) only use the project id specified in the initialize method to choose the configuration of
* the external token, but not the group where to log in. This is probably not the option you are looking for.
*/
data class ConfiguredExternalAuthenticationDetails(
val configId: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ data class ExternalAuthenticationToken(
*/
val minimumAuthenticationClass: AuthenticationClass = AuthenticationClass.ExternalAuthentication,
/**
* If set to true, the project id specified in the initialize method will be used to find the external configuration for the external
* token but not to restrict the group where to log in.
* (INTERNAL USE ONLY) only use the project id specified in the initialize method to choose the configuration of
* the external token, but not the group where to log in. This is probably not the option you are looking for.
*/
val doNotUseProjectIdForGroupSelection: Boolean = false
) : Credentials
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import com.icure.cardinal.sdk.model.base.StoredDocument
import com.icure.cardinal.sdk.model.embed.DecryptedValorisation
import com.icure.cardinal.sdk.model.embed.LetterValue
import com.icure.cardinal.sdk.model.embed.Periodicity
import com.icure.cardinal.sdk.model.embed.PricingDomain
import com.icure.cardinal.sdk.utils.DefaultValue
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
Expand Down Expand Up @@ -63,6 +64,10 @@ data class Tarification(
* The version of the tarification. Must be lexicographically searchable.
*/
override val version: String? = null,
/**
* The pricing domain for this tarification (ambulatory, hospital, or both).
*/
public val domain: PricingDomain? = null,
/**
* The author of the tarification.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,6 @@ data class ByteArray(
public val `data`: kotlin.ByteArray,
) {
// region ByteArray-ByteArray

// endregion
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,6 @@ data class LabelledOccurence(
public val occurence: Long,
) {
// region LabelledOccurence-LabelledOccurence

// endregion
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// WARNING: This file is auto-generated. If you change it manually, your changes will be lost.
// If you want to change the way this class is generated, see [this repo](https://github.com/icure/sdk-codegen).
package com.icure.cardinal.sdk.model.embed

import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
import kotlin.String

/**
*
* Enumerates the pricing domains for tarifications.
*/
@Serializable
enum class PricingDomain(
internal val dtoSerialName: String,
) {
@SerialName("ambulatory")
Ambulatory("ambulatory"),

@SerialName("hospital")
Hospital("hospital"),

@SerialName("both")
Both("both"),
}
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ sealed interface AuthenticationMethod {
@Serializable
data class LongLivedToken(val token: String) : InitialSecret
@Serializable
data class ExternalAuthenticationToken(val token: String, val configId: String) : InitialSecret
data class ExternalAuthenticationToken(val token: String, val configId: String, val doNotUseProjectIdForGroupSelection: Boolean?) : InitialSecret
}
}
}
Expand Down Expand Up @@ -175,7 +175,7 @@ suspend fun AuthenticationMethod.getAuthProvider(
is AuthenticationMethod.UsingSecretProvider.InitialSecret.LongLivedToken ->
AuthSecretDetails.LongLivedTokenDetails(initialSecret.token)
is AuthenticationMethod.UsingSecretProvider.InitialSecret.ExternalAuthenticationToken ->
AuthSecretDetails.ConfiguredExternalAuthenticationDetails(initialSecret.configId, initialSecret.token)
AuthSecretDetails.ConfiguredExternalAuthenticationDetails(initialSecret.configId, initialSecret.token, AuthenticationClass.ExternalAuthentication, initialSecret.doNotUseProjectIdForGroupSelection ?: false)
is AuthenticationMethod.UsingSecretProvider.InitialSecret.Password ->
AuthSecretDetails.PasswordDetails(initialSecret.password)
null -> null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.await
import kotlinx.coroutines.promise
import kotlin.js.Promise
import kotlin.js.json


@OptIn(InternalIcureApi::class)
Expand Down Expand Up @@ -85,7 +86,8 @@ private fun InitialSecretJs.toKt(): AuthenticationMethod.UsingSecretProvider.Ini
is ExternalAuthenticationTokenJs ->
AuthenticationMethod.UsingSecretProvider.InitialSecret.ExternalAuthenticationToken(
token = token,
configId = configId
configId = configId,
doNotUseProjectIdForGroupSelection = doNotUseProjectIdForGroupSelection
)
is InitialSecretLongLivedTokenJs ->
AuthenticationMethod.UsingSecretProvider.InitialSecret.LongLivedToken(token)
Expand Down Expand Up @@ -125,20 +127,28 @@ private fun AuthSecretDetailsJs.toKt(): AuthSecretDetails = when (this) {
else -> throw IllegalArgumentException("Unrecognised auth secret details: ${this::class.simpleName}")
}
private fun AuthSecretDetails.toJs(): AuthSecretDetailsJs = when (this) {
is AuthSecretDetails.ConfiguredExternalAuthenticationDetails ->
is AuthSecretDetails.ConfiguredExternalAuthenticationDetails -> {
ConfiguredExternalAuthenticationDetailsJs(
secret = secret,
configId = configId,
minimumAuthenticationClass = minimumAuthenticationClass.name
props = json(
"minimumAuthenticationClass" to minimumAuthenticationClass.name,
"doNotUseProjectIdForGroupSelection" to doNotUseProjectIdForGroupSelection
)
)
is AuthSecretDetails.LongLivedTokenDetails ->
}
is AuthSecretDetails.LongLivedTokenDetails -> {
LongLivedTokenDetailsJs(secret = secret)
is AuthSecretDetails.PasswordDetails ->
}
is AuthSecretDetails.PasswordDetails -> {
PasswordDetailsJs(secret = secret)
is AuthSecretDetails.ShortLivedTokenDetails ->
}
is AuthSecretDetails.ShortLivedTokenDetails -> {
ShortLivedTokenDetailsJs(secret = secret, authenticationProcessInfo = authenticationProcessInfo.toJs())
is AuthSecretDetails.TwoFactorAuthTokenDetails ->
}
is AuthSecretDetails.TwoFactorAuthTokenDetails -> {
TwoFactorAuthTokenDetailsJs(secret = secret)
}
}
@OptIn(InternalIcureApi::class)
private fun AuthenticationProcessRequest.toJs(): AuthenticationProcessRequestJs = AuthenticationProcessRequestJs(
Expand Down Expand Up @@ -181,4 +191,4 @@ internal fun AuthenticationProcessTemplateParametersJs.toKt() =
AuthenticationProcessTemplateParameters(
firstName = this.firstName,
lastName = this.lastName
)
)
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,12 @@ external class LongLivedTokenDetailsJs(
external class ConfiguredExternalAuthenticationDetailsJs(
configId: String,
secret: String,
minimumAuthenticationClass: String?,
// minimumAuthenticationClass: String?,
// doNotUseProjectIdForGroupSelection: Boolean?,
props: dynamic
) : AuthSecretDetailsJs {
val configId: String
val secret: String
val minimumAuthenticationClass: String?
val doNotUseProjectIdForGroupSelection: Boolean?
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@ external class InitialSecretLongLivedTokenJs : InitialSecretJs {
external class ExternalAuthenticationTokenJs : InitialSecretJs {
val token: String
val configId: String
val doNotUseProjectIdForGroupSelection: Boolean?
}
52 changes: 40 additions & 12 deletions ts-wrapper/src/jsMain/typescript/options/AuthenticationMethod.mts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,17 @@ export namespace AuthenticationMethod {
}

export class ExternalAuthenticationToken {

/**
* During login consider only configurations that can provide at least this authentication class
*/
readonly minimumAuthenticationClass: AuthenticationClass | undefined
/**
* (INTERNAL USE ONLY) only use the project id specified in the initialize method to choose the configuration of
* the external token, but not the group where to log in. This is probably not the option you are looking for.
*/
readonly doNotUseProjectIdForGroupSelection: boolean | undefined

constructor(
/**
* The id of the configuration that specifies how the token should be validated and how it should be used to find
Expand All @@ -63,11 +74,14 @@ export namespace AuthenticationMethod {
* A token used to perform the external authentication
*/
readonly token: string,
/**
* During login consider only configurations that can provide at least this authentication class
*/
readonly minimumAuthenticationClass?: AuthenticationClass,
) {}
props: {
minimumAuthenticationClass?: AuthenticationClass,
doNotUseProjectIdForGroupSelection?: boolean
} = {},
) {
this.minimumAuthenticationClass = props.minimumAuthenticationClass
this.doNotUseProjectIdForGroupSelection = props.doNotUseProjectIdForGroupSelection
}
}

export class JwtCredentials {
Expand Down Expand Up @@ -154,7 +168,13 @@ export namespace SecretProviderAuthenticationOptions {
export namespace InitialSecret {
export class Password { constructor(readonly password: string) {} }
export class LongLivedToken { constructor(readonly token: string) {} }
export class ExternalAuthenticationToken { constructor(readonly token: string, readonly configId: string) {} }
export class ExternalAuthenticationToken {
readonly doNotUseProjectIdForGroupSelection: boolean | undefined

constructor(readonly token: string, readonly configId: string, props: { doNotUseProjectIdForGroupSelection?: boolean } = {}) {
this.doNotUseProjectIdForGroupSelection = props.doNotUseProjectIdForGroupSelection
}
}
}

export type InitialSecret = InitialSecret.Password | InitialSecret.LongLivedToken | InitialSecret.ExternalAuthenticationToken
Expand Down Expand Up @@ -212,7 +232,7 @@ export namespace AuthSecretDetails {
*/
constructor (readonly secret: String) {}
}

export class TwoFactorAuthTokenDetails {
/**
* @param secret the current two-factor authentication token of the user.
Expand All @@ -227,15 +247,17 @@ export namespace AuthSecretDetails {
*/
constructor(readonly secret: String, readonly authenticationProcessInfo: AuthenticationProcessRequest) {}
}

export class LongLivedTokenDetails {
/**
* @param secret a long-lived token of the user.
*/
constructor (readonly secret: String) {}
}

export class ConfiguredExternalAuthenticationDetails {
readonly minimumAuthenticationClass: AuthenticationClass | undefined
readonly doNotUseProjectIdForGroupSelection: boolean | undefined
/**
* Login using a token or other secret provided by another authentication service configured for your project.
*
Expand All @@ -245,10 +267,16 @@ export namespace AuthSecretDetails {
*
* @param configId id of the configuration to use for authentication.
* @param secret the token or another secret that will be used for authentication.
* @param minimumAuthenticationClass only consider configurations that can provide at least this authentication class. The actual
* @param props
* - minimumAuthenticationClass only consider configurations that can provide at least this authentication class. The actual
* authentication class obtained for the token may be higher.
* - doNotUseProjectIdForGroupSelection (INTERNAL USE ONLY) only use the project id specified in the initialize method to choose the configuration of
* the external token, but not the group where to log in. This is probably not the option you are looking for.
*/
constructor (readonly configId: string, readonly secret: string, readonly minimumAuthenticationClass?: AuthenticationClass) {}
constructor (readonly configId: string, readonly secret: string, props: { minimumAuthenticationClass?: AuthenticationClass, doNotUseProjectIdForGroupSelection?: boolean } = {}) {
this.minimumAuthenticationClass = props.minimumAuthenticationClass
this.doNotUseProjectIdForGroupSelection = props.doNotUseProjectIdForGroupSelection
}
}
}
export type AuthSecretDetails =
Expand Down Expand Up @@ -312,4 +340,4 @@ export class AuthenticationProcessRequest {
readonly specId: String,
readonly requestId: String
) {}
}
}
Loading