Skip to content

Commit a147b43

Browse files
Merge pull request #57 from boostcampwm-2022/52-feature-get-seoul-subway-last-time
지하철 막차 시간 구하기, 경기도 버스 막차 시간 구하기
2 parents f49bcdf + f4cfe41 commit a147b43

File tree

56 files changed

+1020
-422
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+1020
-422
lines changed

data/src/main/java/com/stop/data/remote/model/route/gyeonggi/GetGyeonggiBusStationIdResponse.kt

Lines changed: 0 additions & 16 deletions
This file was deleted.
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
package com.stop.data.remote.model.route.gyeonggi
2+
3+
import com.tickaroo.tikxml.annotation.PropertyElement
4+
import com.tickaroo.tikxml.annotation.Xml
5+
6+
@Xml(name = "busRouteInfoItem")
7+
internal data class GyeonggiBusLastTime(
8+
@PropertyElement(name = "upLastTime")
9+
val upLastTime: String, // 평일 기점에서 출발하는 막차 시간
10+
@PropertyElement(name = "startStationId")
11+
val startStationId: String, // 기점 정류소 아이디
12+
@PropertyElement(name = "startStationName")
13+
val startStationName: String, // 기점 정류소 이름
14+
@PropertyElement(name = "downLastTime")
15+
val downLastTime: String, // 평일 종점에서 출발하는 막차 시간
16+
@PropertyElement(name = "endStationId")
17+
val endStationId: String, // 종점 정류소 아이디
18+
@PropertyElement(name = "endStationName")
19+
val endStationName: String, // 종점 정류소 이름
20+
@PropertyElement(name = "peekAlloc")
21+
val minTerm: String, // 최소 배차시간
22+
@PropertyElement(name = "nPeekAlloc")
23+
val maxTerm: String, // 최대 배차시간
24+
) {
25+
fun toDomain() = com.stop.domain.model.route.gyeonggi.GyeonggiBusLastTime(
26+
upLastTime = upLastTime,
27+
startStationId = startStationId,
28+
startStationName = startStationName,
29+
downLastTime = downLastTime,
30+
endStationId = endStationId,
31+
endStationName = endStationName,
32+
minTerm = minTerm,
33+
maxTerm = maxTerm,
34+
)
35+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package com.stop.data.remote.model.route.gyeonggi
2+
3+
import com.tickaroo.tikxml.annotation.Element
4+
import com.tickaroo.tikxml.annotation.Path
5+
import com.tickaroo.tikxml.annotation.Xml
6+
7+
@Xml(name = "response")
8+
internal data class GyeonggiBusLastTimeResponse(
9+
@Path("msgBody")
10+
@Element(name = "busRouteInfoItem")
11+
val lastTimes: List<GyeonggiBusLastTime>
12+
)
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package com.stop.data.remote.model.route.gyeonggi
2+
3+
import com.tickaroo.tikxml.annotation.PropertyElement
4+
import com.tickaroo.tikxml.annotation.Xml
5+
6+
@Xml(name = "busRouteList")
7+
internal data class GyeonggiBusRoute(
8+
@PropertyElement(name = "routeId")
9+
val routeId: String,
10+
@PropertyElement(name = "routeName")
11+
val busName: String,
12+
) {
13+
fun toDomain() = com.stop.domain.model.route.gyeonggi.GyeonggiBusRoute(
14+
routeId = routeId,
15+
busName = busName,
16+
)
17+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package com.stop.data.remote.model.route.gyeonggi
2+
3+
import com.tickaroo.tikxml.annotation.Element
4+
import com.tickaroo.tikxml.annotation.Path
5+
import com.tickaroo.tikxml.annotation.Xml
6+
7+
@Xml(name = "response")
8+
internal data class GyeonggiBusRouteIdResponse(
9+
@Path("msgBody")
10+
@Element(name = "busRouteList")
11+
val routes: List<GyeonggiBusRoute>
12+
)
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package com.stop.data.remote.model.route.gyeonggi
2+
3+
import com.tickaroo.tikxml.annotation.Element
4+
import com.tickaroo.tikxml.annotation.Path
5+
import com.tickaroo.tikxml.annotation.Xml
6+
7+
@Xml(name = "response")
8+
internal data class GyeonggiBusRouteStationsResponse(
9+
@Path("msgBody")
10+
@Element(name = "busRouteStationList")
11+
val stations: List<GyeonggiBusStation>
12+
)

data/src/main/java/com/stop/data/remote/model/route/gyeonggi/GyeonggiBusStation.kt

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,10 @@ internal data class GyeonggiBusStation(
1414
@PropertyElement(name = "y")
1515
val latitude: String,
1616
) {
17-
fun toDomain(): com.stop.domain.model.route.gyeonggi.GyeonggiBusStation {
18-
return com.stop.domain.model.route.gyeonggi.GyeonggiBusStation(
19-
stationId = stationId,
20-
stationName = stationName,
21-
longitude = longitude,
22-
latitude = latitude,
23-
)
24-
}
17+
fun toDomain() = com.stop.domain.model.route.gyeonggi.GyeonggiBusStation(
18+
stationId = stationId,
19+
stationName = stationName,
20+
longitude = longitude,
21+
latitude = latitude,
22+
)
2523
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package com.stop.data.remote.model.route.gyeonggi
2+
3+
import com.tickaroo.tikxml.annotation.Element
4+
import com.tickaroo.tikxml.annotation.Path
5+
import com.tickaroo.tikxml.annotation.Xml
6+
7+
@Xml(name = "response")
8+
internal data class GyeonggiBusStationIdResponse(
9+
@Path("msgBody")
10+
@Element(name = "busStationList")
11+
val busStations: List<GyeonggiBusStation>
12+
)

data/src/main/java/com/stop/data/remote/model/route/gyeonggi/MsgBody.kt

Lines changed: 0 additions & 16 deletions
This file was deleted.

data/src/main/java/com/stop/data/remote/network/ApisDataService.kt

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@ package com.stop.data.remote.network
22

33
import com.stop.data.BuildConfig
44
import com.stop.data.remote.model.NetworkResult
5-
import com.stop.data.remote.model.route.gyeonggi.GetGyeonggiBusStationIdResponse
5+
import com.stop.data.remote.model.route.gyeonggi.GyeonggiBusLastTimeResponse
6+
import com.stop.data.remote.model.route.gyeonggi.GyeonggiBusRouteIdResponse
7+
import com.stop.data.remote.model.route.gyeonggi.GyeonggiBusRouteStationsResponse
8+
import com.stop.data.remote.model.route.gyeonggi.GyeonggiBusStationIdResponse
69
import retrofit2.http.GET
710
import retrofit2.http.Query
811

@@ -12,9 +15,30 @@ internal interface ApisDataService {
1215
suspend fun getBusStationId(
1316
@Query("keyword") stationName: String,
1417
@Query("serviceKey") key: String = BuildConfig.BUS_KEY
15-
): NetworkResult<GetGyeonggiBusStationIdResponse>
18+
): NetworkResult<GyeonggiBusStationIdResponse>
19+
20+
@GET(GET_GYEONGGI_BUS_ROUTE_ID_URL)
21+
suspend fun getBusRouteId(
22+
@Query("stationId") stationId: String,
23+
@Query("serviceKey") key: String = BuildConfig.BUS_KEY
24+
): NetworkResult<GyeonggiBusRouteIdResponse>
25+
26+
@GET(GET_GYEONGGI_BUS_LAST_TIME_URL)
27+
suspend fun getBusLastTime(
28+
@Query("routeId") lineId: String,
29+
@Query("serviceKey") key: String = BuildConfig.BUS_KEY
30+
): NetworkResult<GyeonggiBusLastTimeResponse>
31+
32+
@GET(GET_GYEONGGI_BUS_ROUTE_STATION_URL)
33+
suspend fun getBusRouteStations(
34+
@Query("routeId") lineId: String,
35+
@Query("serviceKey") key: String = BuildConfig.BUS_KEY
36+
): NetworkResult<GyeonggiBusRouteStationsResponse>
1637

1738
companion object {
1839
private const val GET_GYEONGGI_BUS_STATION_ID_URL = "busstationservice/getBusStationList"
40+
private const val GET_GYEONGGI_BUS_ROUTE_ID_URL = "busstationservice/getBusStationViaRouteList"
41+
private const val GET_GYEONGGI_BUS_LAST_TIME_URL = "busrouteservice/getBusRouteInfoItem"
42+
private const val GET_GYEONGGI_BUS_ROUTE_STATION_URL = "busrouteservice/getBusRouteStationList"
1943
}
2044
}

0 commit comments

Comments
 (0)