mirror of
https://github.com/bitwarden/android.git
synced 2025-12-10 09:56:45 -06:00
[PM-25826] Update folderRelationships type for cipher import (#5885)
This commit is contained in:
parent
ff03f49f43
commit
0f899df83c
@ -41,7 +41,7 @@ class CredentialExchangeImportManagerImpl(
|
||||
)
|
||||
},
|
||||
folders = emptyList(),
|
||||
folderRelationships = emptyMap(),
|
||||
folderRelationships = emptyList(),
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
@ -8,9 +8,8 @@ import kotlinx.serialization.Serializable
|
||||
*
|
||||
* @property folders A list of folders to import.
|
||||
* @property ciphers A list of ciphers to import.
|
||||
* @property folderRelationships A map of cipher folder relationships to import. Key correlates to
|
||||
* the index of the cipher in the ciphers list. Value correlates to the index of the folder in the
|
||||
* folders list.
|
||||
* @property folderRelationships A list of cipher-folder relationships to import. Each entry maps a
|
||||
* cipher index (Key) to a folder index (Value).
|
||||
*/
|
||||
@Serializable
|
||||
data class ImportCiphersJsonRequest(
|
||||
@ -19,7 +18,7 @@ data class ImportCiphersJsonRequest(
|
||||
@SerialName("ciphers")
|
||||
val ciphers: List<CipherJsonRequest>,
|
||||
@SerialName("folderRelationships")
|
||||
val folderRelationships: Map<Int, Int>,
|
||||
val folderRelationships: List<Int32Int32KeyValuePairJson>,
|
||||
) {
|
||||
/**
|
||||
* Represents a folder request with an optional [id] if the folder already exists.
|
||||
@ -34,4 +33,18 @@ data class ImportCiphersJsonRequest(
|
||||
@SerialName("id")
|
||||
val id: String?,
|
||||
)
|
||||
|
||||
/**
|
||||
* A key-value pair of 32-bit integers, used for mapping relationships.
|
||||
*
|
||||
* @property key The key, typically an index.
|
||||
* @property value The value, typically an index.
|
||||
*/
|
||||
@Serializable
|
||||
data class Int32Int32KeyValuePairJson(
|
||||
@SerialName("key")
|
||||
val key: Int,
|
||||
@SerialName("value")
|
||||
val value: Int,
|
||||
)
|
||||
}
|
||||
|
||||
@ -350,7 +350,7 @@ class CiphersServiceTest : BaseServiceTest() {
|
||||
request = ImportCiphersJsonRequest(
|
||||
ciphers = listOf(createMockCipherJsonRequest(number = 1)),
|
||||
folders = emptyList(),
|
||||
folderRelationships = emptyMap(),
|
||||
folderRelationships = emptyList(),
|
||||
),
|
||||
)
|
||||
assertEquals(ImportCiphersResponseJson.Success, result.getOrThrow())
|
||||
@ -363,7 +363,7 @@ class CiphersServiceTest : BaseServiceTest() {
|
||||
request = ImportCiphersJsonRequest(
|
||||
ciphers = listOf(createMockCipherJsonRequest(number = 1)),
|
||||
folders = emptyList(),
|
||||
folderRelationships = emptyMap(),
|
||||
folderRelationships = emptyList(),
|
||||
),
|
||||
)
|
||||
assertTrue(result.isFailure)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user