1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2024-11-22 16:23:48 +00:00

renames of EncryptedPassportElements

This commit is contained in:
InsanusMokrassar 2021-01-29 12:44:13 +06:00
parent ecc608f51a
commit 131ec4d6d5
17 changed files with 54 additions and 56 deletions

View File

@ -100,7 +100,7 @@ data class PassportElementErrorDataField(
@Required
override val source: String = dataField
}
fun WithData.createDataError(field: String, message: String) = PassportElementErrorDataField(
fun EncryptedPassportElementWithData.createDataError(field: String, message: String) = PassportElementErrorDataField(
type,
field,
hash,
@ -121,7 +121,7 @@ data class PassportElementErrorFrontSide(
@Required
override val source: String = frontSideField
}
fun WithFrontSide.createFrontSideError(message: String, unencryptedFileHash: PassportElementHash) = PassportElementErrorFrontSide(
fun EncryptedPassportElementWithFrontSide.createFrontSideError(message: String, unencryptedFileHash: PassportElementHash) = PassportElementErrorFrontSide(
type,
unencryptedFileHash,
message
@ -141,7 +141,7 @@ data class PassportElementErrorReverseSide(
@Required
override val source: String = reverseSideField
}
fun WithReverseSide.createReverseSideError(message: String, unencryptedFileHash: PassportElementHash) = PassportElementErrorReverseSide(
fun EncryptedPassportElementWithReverseSide.createReverseSideError(message: String, unencryptedFileHash: PassportElementHash) = PassportElementErrorReverseSide(
type,
unencryptedFileHash,
message
@ -160,7 +160,7 @@ data class PassportElementErrorSelfie(
@Required
override val source: String = selfieField
}
fun WithSelfie.createSelfieError(message: String, unencryptedFileHash: PassportElementHash) = PassportElementErrorSelfie(
fun EncryptedPassportElementWithSelfie.createSelfieError(message: String, unencryptedFileHash: PassportElementHash) = PassportElementErrorSelfie(
type,
unencryptedFileHash,
message
@ -181,7 +181,7 @@ data class PassportElementErrorFile(
@Required
override val source: String = fileField
}
fun FilesCollection.createFileError(message: String, unencryptedFileHash: PassportElementHash) = PassportElementErrorFile(
fun EncryptedPassportElementWithFilesCollection.createFileError(message: String, unencryptedFileHash: PassportElementHash) = PassportElementErrorFile(
type,
unencryptedFileHash,
message
@ -200,7 +200,7 @@ data class PassportElementErrorFiles(
@Required
override val source: String = filesField
}
fun FilesCollection.createFilesError(message: String, unencryptedFileHashes: List<PassportElementHash>) = PassportElementErrorFiles(
fun EncryptedPassportElementWithFilesCollection.createFilesError(message: String, unencryptedFileHashes: List<PassportElementHash>) = PassportElementErrorFiles(
type,
unencryptedFileHashes,
message
@ -221,7 +221,7 @@ data class PassportElementErrorTranslationFile(
@Required
override val source: String = translationFileField
}
fun Translatable.createFileError(message: String, unencryptedFileHash: PassportElementHash) = PassportElementErrorTranslationFile(
fun EncryptedPassportElementTranslatable.createFileError(message: String, unencryptedFileHash: PassportElementHash) = PassportElementErrorTranslationFile(
type,
unencryptedFileHash,
message
@ -239,7 +239,7 @@ data class PassportElementErrorTranslationFiles(
@Required
override val source: String = translationFilesField
}
fun Translatable.createFilesError(message: String, unencryptedFileHashes: List<PassportElementHash>) = PassportElementErrorTranslationFiles(
fun EncryptedPassportElementTranslatable.createFilesError(message: String, unencryptedFileHashes: List<PassportElementHash>) = PassportElementErrorTranslationFiles(
type,
unencryptedFileHashes,
message

View File

@ -4,7 +4,7 @@ import dev.inmo.micro_utils.serialization.base64.Base64BytesToFromStringSerializ
import dev.inmo.tgbotapi.types.emailField
import dev.inmo.tgbotapi.types.hashField
import dev.inmo.tgbotapi.types.passport.encrypted.abstracts.PassportElementHash
import dev.inmo.tgbotapi.types.passport.encrypted.abstracts.WithEmail
import dev.inmo.tgbotapi.types.passport.encrypted.abstracts.EncryptedPassportElementWithEmail
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
@ -15,5 +15,4 @@ data class Email(
@SerialName(hashField)
@Serializable(Base64BytesToFromStringSerializer::class)
override val hash: PassportElementHash
) : WithEmail {
}
) : EncryptedPassportElementWithEmail

View File

@ -4,7 +4,7 @@ import dev.inmo.micro_utils.serialization.base64.Base64BytesToFromStringSerializ
import dev.inmo.tgbotapi.types.dataField
import dev.inmo.tgbotapi.types.passport.credentials.EncryptedData
import dev.inmo.tgbotapi.types.passport.encrypted.abstracts.PassportElementHash
import dev.inmo.tgbotapi.types.passport.encrypted.abstracts.WithData
import dev.inmo.tgbotapi.types.passport.encrypted.abstracts.EncryptedPassportElementWithData
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
@ -15,4 +15,4 @@ data class EncryptedAddress(
override val data: EncryptedData,
@Serializable(Base64BytesToFromStringSerializer::class)
override val hash: PassportElementHash
) : WithData
) : EncryptedPassportElementWithData

View File

@ -7,7 +7,7 @@ import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
@Serializable(EncryptedElementSerializer::class)
sealed class TranslatableFilesCollection : Translatable, FilesCollection
sealed class EncryptedPassportElementWithTranslatableFilesCollection : EncryptedPassportElementTranslatable, EncryptedPassportElementWithFilesCollection
@Serializable
data class UtilityBill(
@ -18,7 +18,7 @@ data class UtilityBill(
@SerialName(hashField)
@Serializable(Base64BytesToFromStringSerializer::class)
override val hash: PassportElementHash
) : TranslatableFilesCollection()
) : EncryptedPassportElementWithTranslatableFilesCollection()
@Serializable
data class BankStatement(
@SerialName(filesField)
@ -28,7 +28,7 @@ data class BankStatement(
@SerialName(hashField)
@Serializable(Base64BytesToFromStringSerializer::class)
override val hash: PassportElementHash
) : TranslatableFilesCollection()
) : EncryptedPassportElementWithTranslatableFilesCollection()
@Serializable
data class RentalAgreement(
@SerialName(filesField)
@ -38,7 +38,7 @@ data class RentalAgreement(
@SerialName(hashField)
@Serializable(Base64BytesToFromStringSerializer::class)
override val hash: PassportElementHash
) : TranslatableFilesCollection()
) : EncryptedPassportElementWithTranslatableFilesCollection()
@Serializable
data class PassportRegistration(
@SerialName(filesField)
@ -48,7 +48,7 @@ data class PassportRegistration(
@SerialName(hashField)
@Serializable(Base64BytesToFromStringSerializer::class)
override val hash: PassportElementHash
) : TranslatableFilesCollection()
) : EncryptedPassportElementWithTranslatableFilesCollection()
@Serializable
data class TemporaryRegistration(
@SerialName(filesField)
@ -58,5 +58,5 @@ data class TemporaryRegistration(
@SerialName(hashField)
@Serializable(Base64BytesToFromStringSerializer::class)
override val hash: PassportElementHash
) : TranslatableFilesCollection()
) : EncryptedPassportElementWithTranslatableFilesCollection()

View File

@ -8,7 +8,7 @@ import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
@Serializable(EncryptedElementSerializer::class)
sealed class TranslatableIDDocument : WithData, WithFrontSide, WithReverseSide, WithSelfie, Translatable
sealed class EncryptedPassportElementWithTranslatableIDDocument : EncryptedPassportElementWithData, EncryptedPassportElementWithFrontSide, EncryptedPassportElementWithReverseSide, EncryptedPassportElementWithSelfie, EncryptedPassportElementTranslatable
@Serializable
data class DriverLicense(
@ -26,7 +26,7 @@ data class DriverLicense(
@SerialName(hashField)
@Serializable(Base64BytesToFromStringSerializer::class)
override val hash: PassportElementHash
) : TranslatableIDDocument()
) : EncryptedPassportElementWithTranslatableIDDocument()
@Serializable
data class IdentityCard(
@ -44,4 +44,4 @@ data class IdentityCard(
@SerialName(hashField)
@Serializable(Base64BytesToFromStringSerializer::class)
override val hash: PassportElementHash
) : TranslatableIDDocument()
) : EncryptedPassportElementWithTranslatableIDDocument()

View File

@ -4,7 +4,7 @@ import dev.inmo.micro_utils.serialization.base64.Base64BytesToFromStringSerializ
import dev.inmo.tgbotapi.types.dataField
import dev.inmo.tgbotapi.types.passport.credentials.EncryptedData
import dev.inmo.tgbotapi.types.passport.encrypted.abstracts.PassportElementHash
import dev.inmo.tgbotapi.types.passport.encrypted.abstracts.WithData
import dev.inmo.tgbotapi.types.passport.encrypted.abstracts.EncryptedPassportElementWithData
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
@ -15,4 +15,4 @@ data class EncryptedPersonalDetails(
override val data: EncryptedData,
@Serializable(Base64BytesToFromStringSerializer::class)
override val hash: PassportElementHash
) : WithData
) : EncryptedPassportElementWithData

View File

@ -8,7 +8,7 @@ import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
@Serializable(EncryptedElementSerializer::class)
sealed class Passport : WithData, WithFrontSide, WithSelfie, Translatable
sealed class Passport : EncryptedPassportElementWithData, EncryptedPassportElementWithFrontSide, EncryptedPassportElementWithSelfie, EncryptedPassportElementTranslatable
@Serializable
data class CommonPassport(

View File

@ -3,7 +3,7 @@ package dev.inmo.tgbotapi.types.passport.encrypted
import dev.inmo.micro_utils.serialization.base64.Base64BytesToFromStringSerializer
import dev.inmo.tgbotapi.types.hashField
import dev.inmo.tgbotapi.types.passport.encrypted.abstracts.PassportElementHash
import dev.inmo.tgbotapi.types.passport.encrypted.abstracts.WithPhoneNumber
import dev.inmo.tgbotapi.types.passport.encrypted.abstracts.EncryptedPassportElementWithPhoneNumber
import dev.inmo.tgbotapi.types.phoneNumberField
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
@ -15,5 +15,4 @@ data class PhoneNumber(
@SerialName(hashField)
@Serializable(Base64BytesToFromStringSerializer::class)
override val hash: PassportElementHash
) : WithPhoneNumber {
}
) : EncryptedPassportElementWithPhoneNumber

View File

@ -5,6 +5,6 @@ import dev.inmo.tgbotapi.types.passport.encrypted.PassportFile
import kotlinx.serialization.Serializable
@Serializable(EncryptedElementSerializer::class)
interface Translatable : EncryptedPassportElement {
interface EncryptedPassportElementTranslatable : EncryptedPassportElement {
val translations: List<PassportFile>
}

View File

@ -5,6 +5,6 @@ import dev.inmo.tgbotapi.types.passport.encrypted.EncryptedElementSerializer
import kotlinx.serialization.Serializable
@Serializable(EncryptedElementSerializer::class)
interface WithData : EncryptedPassportElement {
interface EncryptedPassportElementWithData : EncryptedPassportElement {
val data: EncryptedData
}

View File

@ -4,6 +4,6 @@ import dev.inmo.tgbotapi.types.passport.encrypted.EncryptedElementSerializer
import kotlinx.serialization.Serializable
@Serializable(EncryptedElementSerializer::class)
interface WithEmail : EncryptedPassportElement {
interface EncryptedPassportElementWithEmail : EncryptedPassportElement {
val email: String
}

View File

@ -5,6 +5,6 @@ import dev.inmo.tgbotapi.types.passport.encrypted.PassportFile
import kotlinx.serialization.Serializable
@Serializable(EncryptedElementSerializer::class)
interface FilesCollection : EncryptedPassportElement {
interface EncryptedPassportElementWithFilesCollection : EncryptedPassportElement {
val files: List<PassportFile>
}

View File

@ -5,6 +5,6 @@ import dev.inmo.tgbotapi.types.passport.encrypted.PassportFile
import kotlinx.serialization.Serializable
@Serializable(EncryptedElementSerializer::class)
interface WithFrontSide : EncryptedPassportElement {
interface EncryptedPassportElementWithFrontSide : EncryptedPassportElement {
val frontSide: PassportFile?
}

View File

@ -4,6 +4,6 @@ import dev.inmo.tgbotapi.types.passport.encrypted.EncryptedElementSerializer
import kotlinx.serialization.Serializable
@Serializable(EncryptedElementSerializer::class)
interface WithPhoneNumber : EncryptedPassportElement {
interface EncryptedPassportElementWithPhoneNumber : EncryptedPassportElement {
val phoneNumber: String
}

View File

@ -5,6 +5,6 @@ import dev.inmo.tgbotapi.types.passport.encrypted.PassportFile
import kotlinx.serialization.Serializable
@Serializable(EncryptedElementSerializer::class)
interface WithReverseSide : EncryptedPassportElement {
interface EncryptedPassportElementWithReverseSide : EncryptedPassportElement {
val reverseSide: PassportFile?
}

View File

@ -5,6 +5,6 @@ import dev.inmo.tgbotapi.types.passport.encrypted.PassportFile
import kotlinx.serialization.Serializable
@Serializable(EncryptedElementSerializer::class)
interface WithSelfie : EncryptedPassportElement {
interface EncryptedPassportElementWithSelfie : EncryptedPassportElement {
val selfie: PassportFile?
}

View File

@ -269,53 +269,53 @@ inline fun EncryptedPassportElement.asTemporaryRegistration(): TemporaryRegistra
@PreviewFeature
inline fun EncryptedPassportElement.requireTemporaryRegistration(): TemporaryRegistration = this as TemporaryRegistration
@PreviewFeature
inline fun EncryptedPassportElement.asTranslatableFilesCollection(): TranslatableFilesCollection? = this as? TranslatableFilesCollection
inline fun EncryptedPassportElement.asEncryptedPassportElementWithTranslatableFilesCollection(): EncryptedPassportElementWithTranslatableFilesCollection? = this as? EncryptedPassportElementWithTranslatableFilesCollection
@PreviewFeature
inline fun EncryptedPassportElement.requireTranslatableFilesCollection(): TranslatableFilesCollection = this as TranslatableFilesCollection
inline fun EncryptedPassportElement.requireEncryptedPassportElementWithTranslatableFilesCollection(): EncryptedPassportElementWithTranslatableFilesCollection = this as EncryptedPassportElementWithTranslatableFilesCollection
@PreviewFeature
inline fun EncryptedPassportElement.asTranslatableIDDocument(): TranslatableIDDocument? = this as? TranslatableIDDocument
inline fun EncryptedPassportElement.asEncryptedPassportElementWithTranslatableIDDocument(): EncryptedPassportElementWithTranslatableIDDocument? = this as? EncryptedPassportElementWithTranslatableIDDocument
@PreviewFeature
inline fun EncryptedPassportElement.requireTranslatableIDDocument(): TranslatableIDDocument = this as TranslatableIDDocument
inline fun EncryptedPassportElement.requireEncryptedPassportElementWithTranslatableIDDocument(): EncryptedPassportElementWithTranslatableIDDocument = this as EncryptedPassportElementWithTranslatableIDDocument
@PreviewFeature
inline fun EncryptedPassportElement.asUtilityBill(): UtilityBill? = this as? UtilityBill
@PreviewFeature
inline fun EncryptedPassportElement.requireUtilityBill(): UtilityBill = this as UtilityBill
@PreviewFeature
inline fun EncryptedPassportElement.asFilesCollection(): FilesCollection? = this as? FilesCollection
inline fun EncryptedPassportElement.asEncryptedPassportElementWithFilesCollection(): EncryptedPassportElementWithFilesCollection? = this as? EncryptedPassportElementWithFilesCollection
@PreviewFeature
inline fun EncryptedPassportElement.requireFilesCollection(): FilesCollection = this as FilesCollection
inline fun EncryptedPassportElement.requireEncryptedPassportElementWithFilesCollection(): EncryptedPassportElementWithFilesCollection = this as EncryptedPassportElementWithFilesCollection
@PreviewFeature
inline fun EncryptedPassportElement.asTranslatable(): Translatable? = this as? Translatable
inline fun EncryptedPassportElement.asEncryptedPassportElementTranslatable(): EncryptedPassportElementTranslatable? = this as? EncryptedPassportElementTranslatable
@PreviewFeature
inline fun EncryptedPassportElement.requireTranslatable(): Translatable = this as Translatable
inline fun EncryptedPassportElement.requireEncryptedPassportElementTranslatable(): EncryptedPassportElementTranslatable = this as EncryptedPassportElementTranslatable
@PreviewFeature
inline fun EncryptedPassportElement.asUnknownEncryptedPassportElement(): UnknownEncryptedPassportElement? = this as? UnknownEncryptedPassportElement
@PreviewFeature
inline fun EncryptedPassportElement.requireUnknownEncryptedPassportElement(): UnknownEncryptedPassportElement = this as UnknownEncryptedPassportElement
@PreviewFeature
inline fun EncryptedPassportElement.asWithData(): WithData? = this as? WithData
inline fun EncryptedPassportElement.asEncryptedPassportElementWithData(): EncryptedPassportElementWithData? = this as? EncryptedPassportElementWithData
@PreviewFeature
inline fun EncryptedPassportElement.requireWithData(): WithData = this as WithData
inline fun EncryptedPassportElement.requireEncryptedPassportElementWithData(): EncryptedPassportElementWithData = this as EncryptedPassportElementWithData
@PreviewFeature
inline fun EncryptedPassportElement.asWithEmail(): WithEmail? = this as? WithEmail
inline fun EncryptedPassportElement.asEncryptedPassportElementWithEmail(): EncryptedPassportElementWithEmail? = this as? EncryptedPassportElementWithEmail
@PreviewFeature
inline fun EncryptedPassportElement.requireWithEmail(): WithEmail = this as WithEmail
inline fun EncryptedPassportElement.requireEncryptedPassportElementWithEmail(): EncryptedPassportElementWithEmail = this as EncryptedPassportElementWithEmail
@PreviewFeature
inline fun EncryptedPassportElement.asWithFrontSide(): WithFrontSide? = this as? WithFrontSide
inline fun EncryptedPassportElement.asEncryptedPassportElementWithFrontSide(): EncryptedPassportElementWithFrontSide? = this as? EncryptedPassportElementWithFrontSide
@PreviewFeature
inline fun EncryptedPassportElement.requireWithFrontSide(): WithFrontSide = this as WithFrontSide
inline fun EncryptedPassportElement.requireEncryptedPassportElementWithFrontSide(): EncryptedPassportElementWithFrontSide = this as EncryptedPassportElementWithFrontSide
@PreviewFeature
inline fun EncryptedPassportElement.asWithPhoneNumber(): WithPhoneNumber? = this as? WithPhoneNumber
inline fun EncryptedPassportElement.asEncryptedPassportElementWithPhoneNumber(): EncryptedPassportElementWithPhoneNumber? = this as? EncryptedPassportElementWithPhoneNumber
@PreviewFeature
inline fun EncryptedPassportElement.requireWithPhoneNumber(): WithPhoneNumber = this as WithPhoneNumber
inline fun EncryptedPassportElement.requireEncryptedPassportElementWithPhoneNumber(): EncryptedPassportElementWithPhoneNumber = this as EncryptedPassportElementWithPhoneNumber
@PreviewFeature
inline fun EncryptedPassportElement.asWithReverseSide(): WithReverseSide? = this as? WithReverseSide
inline fun EncryptedPassportElement.asEncryptedPassportElementWithReverseSide(): EncryptedPassportElementWithReverseSide? = this as? EncryptedPassportElementWithReverseSide
@PreviewFeature
inline fun EncryptedPassportElement.requireWithReverseSide(): WithReverseSide = this as WithReverseSide
inline fun EncryptedPassportElement.requireEncryptedPassportElementWithReverseSide(): EncryptedPassportElementWithReverseSide = this as EncryptedPassportElementWithReverseSide
@PreviewFeature
inline fun EncryptedPassportElement.asWithSelfie(): WithSelfie? = this as? WithSelfie
inline fun EncryptedPassportElement.asEncryptedPassportElementWithSelfie(): EncryptedPassportElementWithSelfie? = this as? EncryptedPassportElementWithSelfie
@PreviewFeature
inline fun EncryptedPassportElement.requireWithSelfie(): WithSelfie = this as WithSelfie
inline fun EncryptedPassportElement.requireEncryptedPassportElementWithSelfie(): EncryptedPassportElementWithSelfie = this as EncryptedPassportElementWithSelfie
@PreviewFeature
inline fun SecureValue.asAddressSecureValue(): AddressSecureValue? = this as? AddressSecureValue
@PreviewFeature