Rename createSend to createTextSend (#647)

This commit is contained in:
David Perez
2024-01-17 15:28:11 -06:00
committed by Álison Fernandes
parent 9ba02c67e0
commit 1db2a25f4b
6 changed files with 13 additions and 13 deletions

View File

@@ -18,10 +18,10 @@ import retrofit2.http.Path
interface SendsApi {
/**
* Create a send.
* Create a text send.
*/
@POST("sends")
suspend fun createSend(@Body body: SendJsonRequest): Result<SyncResponseJson.Send>
suspend fun createTextSend(@Body body: SendJsonRequest): Result<SyncResponseJson.Send>
/**
* Create a file send.

View File

@@ -10,9 +10,9 @@ import com.x8bit.bitwarden.data.vault.datasource.network.model.UpdateSendRespons
*/
interface SendsService {
/**
* Attempt to create a send.
* Attempt to create a text send.
*/
suspend fun createSend(
suspend fun createTextSend(
body: SendJsonRequest,
): Result<SyncResponseJson.Send>

View File

@@ -27,8 +27,8 @@ class SendsServiceImpl(
private val clock: Clock,
private val json: Json,
) : SendsService {
override suspend fun createSend(body: SendJsonRequest): Result<SyncResponseJson.Send> =
sendsApi.createSend(body = body)
override suspend fun createTextSend(body: SendJsonRequest): Result<SyncResponseJson.Send> =
sendsApi.createTextSend(body = body)
override suspend fun createFileSend(body: SendJsonRequest): Result<SendFileResponseJson> =
sendsApi.createFileSend(body = body)

View File

@@ -433,7 +433,7 @@ class VaultRepositoryImpl(
.flatMap { send ->
when (send.type) {
SendType.TEXT -> {
sendsService.createSend(body = send.toEncryptedNetworkSend())
sendsService.createTextSend(body = send.toEncryptedNetworkSend())
}
SendType.FILE -> {

View File

@@ -64,9 +64,9 @@ class SendsServiceTest : BaseServiceTest() {
}
@Test
fun `createSend should return the correct response`() = runTest {
fun `createTextSend should return the correct response`() = runTest {
server.enqueue(MockResponse().setBody(CREATE_UPDATE_SEND_SUCCESS_JSON))
val result = sendsService.createSend(
val result = sendsService.createTextSend(
body = createMockSendJsonRequest(number = 1, type = SendTypeJson.TEXT),
)
assertEquals(

View File

@@ -1589,7 +1589,7 @@ class VaultRepositoryTest {
@Test
@Suppress("MaxLineLength")
fun `createSend with TEXT and sendsService createSend failure should return CreateSendResult failure`() =
fun `createSend with TEXT and sendsService createTextSend failure should return CreateSendResult failure`() =
runTest {
fakeAuthDiskSource.userState = MOCK_USER_STATE
val userId = "mockId-1"
@@ -1598,7 +1598,7 @@ class VaultRepositoryTest {
vaultSdkSource.encryptSend(userId = userId, sendView = mockSendView)
} returns createMockSdkSend(number = 1, type = SendType.TEXT).asSuccess()
coEvery {
sendsService.createSend(
sendsService.createTextSend(
body = createMockSendJsonRequest(number = 1, type = SendTypeJson.TEXT)
.copy(fileLength = null),
)
@@ -1611,7 +1611,7 @@ class VaultRepositoryTest {
@Suppress("MaxLineLength")
@Test
fun `createSend with TEXT and sendsService createSend success should return CreateSendResult success`() =
fun `createSend with TEXT and sendsService createTextSend success should return CreateSendResult success`() =
runTest {
fakeAuthDiskSource.userState = MOCK_USER_STATE
val userId = "mockId-1"
@@ -1623,7 +1623,7 @@ class VaultRepositoryTest {
vaultSdkSource.encryptSend(userId = userId, sendView = mockSendView)
} returns mockSdkSend.asSuccess()
coEvery {
sendsService.createSend(
sendsService.createTextSend(
body = createMockSendJsonRequest(number = 1, type = SendTypeJson.TEXT)
.copy(fileLength = null),
)