TourAPIManger - TravelMateSSU/Android GitHub Wiki

TourAPI

Android

TourAPIManager ํด๋ž˜์Šค๋Š” ํˆฌ์–ด API๋ฅผ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋Š” ํด๋ž˜์Šค์ž…๋‹ˆ๋‹ค.

์‚ฌ์šฉํ•˜๊ธฐ์— ์•ž์„œ TourAPIManager ํด๋ž˜์Šค๋ฅผ ์‚ฌ์šฉํ•˜๋Š” class๋Š” ๋ฐ˜๋“œ์‹œ TourAPIHandler๋ฅผ ์ƒ์†๋ฐ›์•„์•ผ ํ•ฉ๋‹ˆ๋‹ค.

func querySearchByKeyword(String keyword) ํ•จ์ˆ˜๋Š” ๊ด€๊ด‘์ง€๋ฅผ ํ‚ค์›Œ๋“œ๋กœ ๊ฒ€์ƒ‰ํ•ฉ๋‹ˆ๋‹ค.

params

  • keyword ๊ฒ€์ƒ‰ํ•  ํ‚ค์›Œ๋“œ

return

์ง์ ‘์ ์ธ ๋ฆฌํ„ด๊ฐ’์€ ์—†์ง€๋งŒ TourAPIHandler์˜ searchByKeyword(List<Tourist> touristList)๋ฅผ ํ†ตํ•ด ํ‚ค์›Œ๋“œ๋ฅผ ๊ฐ€์ง„ ๊ด€๊ด‘์ง€ ๋ฆฌ์ŠคํŠธ๋ฅผ ๋„˜๊ฒจ์ค๋‹ˆ๋‹ค.

์ฟผ๋ฆฌ์— ์‹คํŒจํ–ˆ์„ ๊ฒฝ์šฐ TourAPIHandler์˜ searchByKeywordFailed()ํ•จ์ˆ˜๊ฐ€ ํ˜ธ์ถœ๋˜๊ฒŒ ๋ฉ๋‹ˆ๋‹ค.

func querySearchById(Tourist tourist) ํ•จ์ˆ˜๋Š” ๊ด€๊ด‘์ง€ ์ƒ์„ธ์ •๋ณด๋ฅผ ๊ณ ์œ  Id๋กœ ๊ฒ€์ƒ‰ํ•ฉ๋‹ˆ๋‹ค.

params

  • tourist ๊ฒ€์ƒ‰ํ•  ๊ด€๊ด‘์ง€ ์ •๋ณด๊ฐ€ ๋‹ด๊ธด ๊ฐ์ฒด .contentId, .contentTypeId ์†์„ฑ ๊ฐ’๋งŒ ๋“ค์–ด์žˆ์œผ๋ฉด ๋ฉ๋‹ˆ๋‹ค.

return

์ง์ ‘์ ์ธ ๋ฆฌํ„ด๊ฐ’์€ ์—†์ง€๋งŒ TourAPIHandler์˜ searchById(Tourist tourist)๋ฅผ ํ†ตํ•ด ํ‚ค์›Œ๋“œ๋ฅผ ๊ฐ€์ง„ ๊ด€๊ด‘์ง€๋ฅผ ๋„˜๊ฒจ์ค๋‹ˆ๋‹ค.

์ฟผ๋ฆฌ์— ์‹คํŒจํ–ˆ์„ ๊ฒฝ์šฐ TourAPIHandler์˜ searchByIdFailed()ํ•จ์ˆ˜๊ฐ€ ํ˜ธ์ถœ๋˜๊ฒŒ ๋ฉ๋‹ˆ๋‹ค.

โš ๏ธ **GitHub.com Fallback** โš ๏ธ