Skip to content

Commit

Permalink
fix(#93-add-getSubscriptions-and-getSubscribers-methods): promt in fi…
Browse files Browse the repository at this point in the history
…rst place in search request
  • Loading branch information
y9Kap committed Mar 7, 2024
1 parent 2bdbdb4 commit 58487fa
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ internal class SearchEngine(
val response = httpClient.get(baseUrl.string) {
apiVersion(request.apiVersion)
token(request.token)
parameter("prompt", request.prompt)
parameter("latitude", request.location?.latitude)
parameter("longitude", request.location?.longitude)
parameter("prompt", request.prompt)
}.bodyAsSuccess<List<SearchItemSerializable>>()
return SearchRequest.Response(response.map { it.type() })
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import app.meetacy.sdk.types.auth.Token
import app.meetacy.sdk.types.location.Location
import app.meetacy.sdk.updates.AuthorizedUpdatesApi
import app.meetacy.sdk.users.AuthorizedSelfUserDetailsRepository
import app.meetacy.sdk.users.AuthorizedSelfUserRepository
import app.meetacy.sdk.users.AuthorizedUsersApi

/**
Expand Down Expand Up @@ -44,6 +43,6 @@ public class AuthorizedMeetacyApi @UnsafeConstructor constructor(
)

public suspend fun search(location: Location?, prompt: String): List<AuthorizedSearchItemRepository> =
base.search(token, location, prompt).map { AuthorizedSearchItemRepository.of(it.data, api = this) }
base.search(prompt, token, location).map { AuthorizedSearchItemRepository.of(it.data, api = this) }

}
8 changes: 3 additions & 5 deletions api/src/commonMain/kotlin/app/meetacy/sdk/MeetacyApi.kt
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ import app.meetacy.sdk.search.SearchItemRepository
import app.meetacy.sdk.types.annotation.UnsafeConstructor
import app.meetacy.sdk.types.auth.Token
import app.meetacy.sdk.types.location.Location
import app.meetacy.sdk.types.user.SelfUser
import app.meetacy.sdk.types.user.SelfUserDetails
import app.meetacy.sdk.updates.UpdatesApi
import app.meetacy.sdk.users.SelfUserDetailsRepository
import app.meetacy.sdk.users.UsersApi
Expand All @@ -40,13 +38,13 @@ public class MeetacyApi(
}

public suspend fun search(
prompt: String,
token: Token,
location: Location?,
prompt: String
location: Location?
): List<SearchItemRepository> {
return engine.execute(
request = SearchRequest(
token, location, prompt
prompt, token, location
)
).items.map { searchItem ->
SearchItemRepository.of(searchItem, api = this)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import app.meetacy.sdk.types.location.Location
import app.meetacy.sdk.types.search.SearchItem

public data class SearchRequest(
val prompt: String,
val token: Token,
val location: Location?,
val prompt: String
val location: Location?
) : MeetacyRequest<SearchRequest.Response> {
public data class Response(val items: List<SearchItem>)
}

0 comments on commit 58487fa

Please sign in to comment.