Skip to content

Commit

Permalink
[FEAT] #48 - GoalClient, GoalAPI 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
Seokki-Kwon committed Mar 3, 2025
1 parent 262316a commit fa80b46
Show file tree
Hide file tree
Showing 3 changed files with 81 additions and 0 deletions.
27 changes: 27 additions & 0 deletions dnd-12th-2-iOS/dnd-12th-2-iOS/Client/GoalClient.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
//
// GoalClient.swift
// dnd-12th-2-iOS
//
// Created by 권석기 on 3/3/25.
//

import Foundation
import ComposableArchitecture
import Moya

struct GoalClient {
static let provider = MoyaProvider<GoalAPI>(session: Session(interceptor: AuthIntercepter.shared), plugins: [MoyaLoggingPlugin()])
}

extension GoalClient: DependencyKey {
static let liveValue = Self (

)
}

extension DependencyValues {
var goalClient: GoalClient {
get { self[GoalClient.self] }
set { self[GoalClient.self] = newValue }
}
}
7 changes: 7 additions & 0 deletions dnd-12th-2-iOS/dnd-12th-2-iOS/Client/GuideClient.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
//
// GuideClient.swift
// dnd-12th-2-iOS
//
// Created by 권석기 on 3/3/25.
//

47 changes: 47 additions & 0 deletions dnd-12th-2-iOS/dnd-12th-2-iOS/Network/API/GoalAPI.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
//
// GoalAPI.swift
// dnd-12th-2-iOS
//
// Created by 권석기 on 3/3/25.
//

import Foundation
import Moya

enum GoalAPI {
case makeIn
}

extension GoalAPI: TargetType {
var baseURL: URL {
return URL(string: "\(SecretKey.baseUrl)/api/goals")!
}

var path: String {
switch self {
default:
return ""
}
}

var method: Moya.Method {
switch self {
default:
return .get
}
}

var task: Moya.Task {
switch self {
default:
return .requestPlain
}
}

var headers: [String : String]? {
switch self {
default:
return ["Content-type": "application/json"]
}
}
}

0 comments on commit fa80b46

Please sign in to comment.