From b02097ec258a4bbde337cedd1e8462f5f8dac722 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Lamarque?= Date: Tue, 27 Aug 2024 08:11:09 +0200 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Add=20`EmailAddressAsStringSerializ?= =?UTF-8?q?er`=20type=20(#691)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/api/types-kotlinx-serialization.api | 4 +++ .../EmailAddressAsStringSerializer.kt | 26 +++++++++++++++++++ ...ilAddressAsStringSerializerCommonSample.kt | 12 +++++++++ 3 files changed, 42 insertions(+) create mode 100644 subprojects/kotlinx-serialization/src/commonMain/kotlin/org/kotools/types/kotlinx/serialization/EmailAddressAsStringSerializer.kt create mode 100644 subprojects/kotlinx-serialization/src/commonSample/kotlin/org/kotools/types/kotlinx/serialization/EmailAddressAsStringSerializerCommonSample.kt diff --git a/subprojects/kotlinx-serialization/src/api/types-kotlinx-serialization.api b/subprojects/kotlinx-serialization/src/api/types-kotlinx-serialization.api index c4f79095c..5d40af38a 100644 --- a/subprojects/kotlinx-serialization/src/api/types-kotlinx-serialization.api +++ b/subprojects/kotlinx-serialization/src/api/types-kotlinx-serialization.api @@ -1,3 +1,7 @@ +public final class org/kotools/types/kotlinx/serialization/EmailAddressAsStringSerializer { + public fun ()V +} + public final class org/kotools/types/kotlinx/serialization/KotoolsTypesSerializers { public static final field INSTANCE Lorg/kotools/types/kotlinx/serialization/KotoolsTypesSerializers; public final fun getAll ()Lkotlinx/serialization/modules/SerializersModule; diff --git a/subprojects/kotlinx-serialization/src/commonMain/kotlin/org/kotools/types/kotlinx/serialization/EmailAddressAsStringSerializer.kt b/subprojects/kotlinx-serialization/src/commonMain/kotlin/org/kotools/types/kotlinx/serialization/EmailAddressAsStringSerializer.kt new file mode 100644 index 000000000..912786e8d --- /dev/null +++ b/subprojects/kotlinx-serialization/src/commonMain/kotlin/org/kotools/types/kotlinx/serialization/EmailAddressAsStringSerializer.kt @@ -0,0 +1,26 @@ +package org.kotools.types.kotlinx.serialization + +import kotools.types.experimental.ExperimentalKotoolsTypesApi +import org.kotools.types.EmailAddress +import org.kotools.types.internal.ExperimentalSince +import org.kotools.types.internal.KotoolsTypesVersion + +/** + * Class responsible for serializing the [EmailAddress] type as [String]. + * + * @constructor Creates an instance of [EmailAddressAsStringSerializer]. + * + *
+ *
+ * + * Calling from Kotlin + * + * + * Here's an example of calling this constructor from Kotlin code: + * + * SAMPLE: [org.kotools.types.kotlinx.serialization.EmailAddressAsStringSerializerCommonSample.primaryConstructor] + *
+ */ +@ExperimentalKotoolsTypesApi +@ExperimentalSince(KotoolsTypesVersion.Unreleased) +public class EmailAddressAsStringSerializer diff --git a/subprojects/kotlinx-serialization/src/commonSample/kotlin/org/kotools/types/kotlinx/serialization/EmailAddressAsStringSerializerCommonSample.kt b/subprojects/kotlinx-serialization/src/commonSample/kotlin/org/kotools/types/kotlinx/serialization/EmailAddressAsStringSerializerCommonSample.kt new file mode 100644 index 000000000..c11c45757 --- /dev/null +++ b/subprojects/kotlinx-serialization/src/commonSample/kotlin/org/kotools/types/kotlinx/serialization/EmailAddressAsStringSerializerCommonSample.kt @@ -0,0 +1,12 @@ +package org.kotools.types.kotlinx.serialization + +import kotools.types.experimental.ExperimentalKotoolsTypesApi +import kotlin.test.Test + +@OptIn(ExperimentalKotoolsTypesApi::class) +internal class EmailAddressAsStringSerializerCommonSample { + @Test + fun primaryConstructor() { + EmailAddressAsStringSerializer() + } +}