Skip to content

Commit

Permalink
Fix parameter in retrofit function
Browse files Browse the repository at this point in the history
  • Loading branch information
HectorNarvaez committed May 31, 2023
1 parent ee6edd8 commit 6d3716c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,15 @@ internal interface GoogleStorageApiService {

private const val Q_VALUE = "'%s' in parents and trashed = false"

private fun getQueryValue(parentId: String) = String.format(Q_VALUE, parentId)
internal fun getQueryValue(parentId: String = "root") = String.format(Q_VALUE, parentId)

private const val QUERY_REQUESTED_FIELDS = "id,name,mimeType,modifiedTime,parents"
private const val FIELDS_VALUE = "files($QUERY_REQUESTED_FIELDS)"
}

@GET(FILES_PARTICLE)
fun getFilesListWithParentId(
parentId: String = "root",
@Query(QUERY_Q) query: String = getQueryValue(parentId),
@Query(QUERY_Q) query: String,
@Query(QUERY_FIELDS) fields: String = FIELDS_VALUE
): Call<FileListRemoteResponse>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package com.omh.android.storage.api.drive.nongms.data.source
import com.omh.android.storage.api.data.source.OmhFileRemoteDataSource
import com.omh.android.storage.api.domain.model.OmhFile
import com.omh.android.storage.api.drive.nongms.data.GoogleRetrofitImpl
import com.omh.android.storage.api.drive.nongms.data.GoogleStorageApiService
import com.omh.android.storage.api.drive.nongms.data.source.body.CreateFileRequestBody
import com.omh.android.storage.api.drive.nongms.data.source.mapper.toFile
import com.omh.android.storage.api.drive.nongms.data.source.mapper.toFileList
Expand All @@ -13,7 +14,9 @@ internal class NonGmsFileRemoteDataSourceImpl(private val retrofitImpl: GoogleRe
override fun getFilesListWithParentId(parentId: String): List<OmhFile> {
val response = retrofitImpl
.getGoogleStorageApiService()
.getFilesListWithParentId(parentId)
.getFilesListWithParentId(
query = GoogleStorageApiService.getQueryValue(parentId)
)
.execute()

return if (response.isSuccessful) {
Expand Down

0 comments on commit 6d3716c

Please sign in to comment.