Skip to content

Commit

Permalink
feat(#177-search-without-location): added support search without loca…
Browse files Browse the repository at this point in the history
…tion.
  • Loading branch information
y9Kap committed Feb 28, 2024
1 parent 903ccb4 commit f8b4165
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ internal class SearchEngine(
val response = httpClient.get(baseUrl.string) {
apiVersion(request.apiVersion)
token(request.token)
parameter("latitude", request.location.latitude)
parameter("longitude", request.location.longitude)
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 @@ -41,7 +41,7 @@ public class AuthorizedMeetacyApi @UnsafeConstructor constructor(
data = base.getMe(token),
api = this
)
public suspend fun search(location: Location, prompt: String): List<AuthorizedSearchItemRepository> =
public suspend fun search(location: Location?, prompt: String): List<AuthorizedSearchItemRepository> =
base.search(token, location, prompt).map { AuthorizedSearchItemRepository.of(it.data, api = this) }

}
2 changes: 1 addition & 1 deletion api/src/commonMain/kotlin/app/meetacy/sdk/MeetacyApi.kt
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public class MeetacyApi(

public suspend fun search(
token: Token,
location: Location,
location: Location?,
prompt: String
): List<SearchItemRepository> {
return engine.execute(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import app.meetacy.sdk.types.search.SearchItem

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

0 comments on commit f8b4165

Please sign in to comment.