Skip to content

Commit

Permalink
Rename imageId to avatarId in AvatarService to match with other funct…
Browse files Browse the repository at this point in the history
…ions (#487)
  • Loading branch information
AdamGrzybkowski authored Dec 11, 2024
1 parent 58419b7 commit 0e74c09
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ class AvatarRepositoryTest {
val imageId = "imageId"
coEvery { tokenStorage.getToken(any()) } returns "token"
coEvery {
avatarService.deleteAvatarCatching(imageId = "imageId", oauthToken = "token")
avatarService.deleteAvatarCatching(avatarId = "imageId", oauthToken = "token")
} returns GravatarResult.Success(Unit)

val result = avatarRepository.deleteAvatar(email, imageId)
Expand All @@ -182,7 +182,7 @@ class AvatarRepositoryTest {
coEvery { tokenStorage.getToken(any()) } returns "token"
coEvery {
avatarService.deleteAvatarCatching(
imageId = "imageId",
avatarId = "imageId",
oauthToken = "token",
)
} returns GravatarResult.Failure(ErrorType.Server)
Expand Down
12 changes: 6 additions & 6 deletions gravatar/src/main/java/com/gravatar/services/AvatarService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -174,14 +174,14 @@ public class AvatarService(private val okHttpClient: OkHttpClient? = null) {
/**
* Deletes the avatar with the given ID.
*
* @param imageId The ID of the avatar to delete
* @param avatarId The ID of the avatar to delete
* @param oauthToken The OAuth token to use for authentication
*/
public suspend fun deleteAvatar(imageId: String, oauthToken: String): Unit = runThrowingExceptionRequest {
public suspend fun deleteAvatar(avatarId: String, oauthToken: String): Unit = runThrowingExceptionRequest {
withContext(GravatarSdkDI.dispatcherIO) {
val service = GravatarSdkDI.getGravatarV3Service(okHttpClient, oauthToken)

val response = service.deleteAvatar(imageId)
val response = service.deleteAvatar(avatarId)

if (response.isSuccessful) {
Unit
Expand All @@ -201,12 +201,12 @@ public class AvatarService(private val okHttpClient: OkHttpClient? = null) {
* This method will catch any exception that occurs during
* the execution and return it as a [GravatarResult.Failure].
*
* @param imageId The ID of the avatar to delete
* @param avatarId The ID of the avatar to delete
* @param oauthToken The OAuth token to use for authentication
* @return The result of the operation
*/
public suspend fun deleteAvatarCatching(imageId: String, oauthToken: String): GravatarResult<Unit, ErrorType> =
public suspend fun deleteAvatarCatching(avatarId: String, oauthToken: String): GravatarResult<Unit, ErrorType> =
runCatchingRequest {
deleteAvatar(imageId, oauthToken)
deleteAvatar(avatarId, oauthToken)
}
}

0 comments on commit 0e74c09

Please sign in to comment.