CharacterDetailView에 갤러리 탭을 추가하고, 갤러리 화면/상태 관리/네트워킹을 구현했습니다. 소유/미소유 UI, 페이지네이션, 이미지 뷰어, 오류 토스트를 포함합니다. TODO: 이미지 구매 API 연동
		
			
				
	
	
		
			56 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			Swift
		
	
	
	
	
	
			
		
		
	
	
			56 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			Swift
		
	
	
	
	
	
//
 | 
						|
//  CharacterApi.swift
 | 
						|
//  SodaLive
 | 
						|
//
 | 
						|
//  Created by klaus on 8/29/25.
 | 
						|
//
 | 
						|
 | 
						|
import Foundation
 | 
						|
import Moya
 | 
						|
 | 
						|
enum CharacterApi {
 | 
						|
    case getCharacterHome
 | 
						|
    case getCharacterDetail(characterId: Int)
 | 
						|
    case getCharacterImageList(characterId: Int, page: Int, size: Int)
 | 
						|
}
 | 
						|
 | 
						|
extension CharacterApi: TargetType {
 | 
						|
    var baseURL: URL { URL(string: BASE_URL)! }
 | 
						|
    
 | 
						|
    var path: String {
 | 
						|
        switch self {
 | 
						|
        case .getCharacterHome:
 | 
						|
            return "/api/chat/character/main"
 | 
						|
            
 | 
						|
        case .getCharacterDetail(let characterId):
 | 
						|
            return "/api/chat/character/\(characterId)"
 | 
						|
            
 | 
						|
        case .getCharacterImageList:
 | 
						|
            return "/api/chat/character/image/list"
 | 
						|
        }
 | 
						|
    }
 | 
						|
    
 | 
						|
    var method: Moya.Method { .get }
 | 
						|
    
 | 
						|
    var task: Moya.Task {
 | 
						|
        switch self {
 | 
						|
        case .getCharacterHome, .getCharacterDetail:
 | 
						|
            return .requestPlain
 | 
						|
            
 | 
						|
        case .getCharacterImageList(let characterId, let page, let size):
 | 
						|
            return .requestParameters(
 | 
						|
                parameters: [
 | 
						|
                    "characterId": characterId,
 | 
						|
                    "page": page,
 | 
						|
                    "size": size
 | 
						|
                ],
 | 
						|
                encoding: URLEncoding.queryString
 | 
						|
            )
 | 
						|
        }
 | 
						|
    }
 | 
						|
    
 | 
						|
    var headers: [String : String]? {
 | 
						|
        ["Authorization": "Bearer \(UserDefaults.string(forKey: UserDefaultsKey.token))"]
 | 
						|
    }
 | 
						|
}
 |