Skip to content

Commit

Permalink
[Feat] #466 - PhoneVerify 관련 엔티티 구현
Browse files Browse the repository at this point in the history
  • Loading branch information
meltsplit committed Dec 30, 2024
1 parent 3c6345a commit 0d0b3a3
Show file tree
Hide file tree
Showing 6 changed files with 154 additions and 0 deletions.
70 changes: 70 additions & 0 deletions SOPT-iOS/Projects/Modules/Networks/Sources/API/CoreAuthAPI.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
//
// CoreAuthAPI.swift
// Networks
//
// Created by 장석우 on 12/30/24.
// Copyright © 2024 SOPT-iOS. All rights reserved.
//

import Moya
import Core

public enum CoreAuthAPI {
case sendVerifyCode(phone: )
case verfiyCode(entity: )
case signUp
case signIn
}

extension CoreAuthAPI: BaseAPI {

public static var apiType: APIType = .coreAuth

// MARK: - Header
public var headers: [String: String]? {
switch self {
default:
return HeaderType.json.value
}
}

// MARK: - Path
public var path: String {
switch self {
case .sendVerifyCode(phone: let phone):
<#code#>
case .verfiyCode(entity: let entity):
<#code#>
case .signUp:
<#code#>
case .signIn:
<#code#>
}
}

// MARK: - Method
public var method: Moya.Method {
switch self {
case .getSocialAccount:
return .get
case .changeSocialAccount:
return .patch
}
}


public var task: Task {
switch self {
case let .getSocialAccount(phone):
return .requestParameters(parameters: ["phone": phone], encoding: URLEncoding.queryString)
case let .changeSocialAccount(entity):
return .requestJSONEncodable(entity)
}
}

public var validationType: ValidationType {
return .none
}
}


Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
//
// SendVerificationCodeEntity.swift
// Networks
//
// Created by 장석우 on 12/30/24.
// Copyright © 2024 SOPT-iOS. All rights reserved.
//

import Foundation

public struct SendVerificationCodeEntity: Encodable {
let name: String
let phone: String
let type: VerifyType

public init(name: String, phone: String, type: VerifyType) {
self.name = name
self.phone = phone
self.type = type
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
//
// VerifyCodeEntity.swift
// Networks
//
// Created by 장석우 on 12/30/24.
// Copyright © 2024 SOPT-iOS. All rights reserved.
//

import Foundation

public struct VerifyCodeEntity: Encodable {
let name: String
let phone: String
let type: VerifyType
let code: String

public init(name: String, phone: String, type: VerifyType, code: String) {
self.name = name
self.phone = phone
self.type = type
self.code = code
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
//
// VerifyResultEntity.swift
// Networks
//
// Created by 장석우 on 12/30/24.
// Copyright © 2024 SOPT-iOS. All rights reserved.
//

import Foundation

public struct VerifyResultEntity: Decodable {
let isVerified: Bool
let name: String
let phone: String

public init(isVerified: Bool, name: String, phone: String) {
self.isVerified = isVerified
self.name = name
self.phone = phone
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
//
// VerifyType.swift
// Networks
//
// Created by 장석우 on 12/30/24.
// Copyright © 2024 SOPT-iOS. All rights reserved.
//

import Foundation


public enum VerifyType: String, Encodable {
case register = "REGISTER"
case change = "CHANGE"
case search = "SEARCH"
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ public enum APIType {
case poke
case s3
case fortune
case coreAuth
case social
}

Expand Down Expand Up @@ -65,6 +66,8 @@ extension BaseAPI {
base += "/s3"
case .fortune:
base += "/fortune"
case .coreAuth:
base = coreAuthBaseURL + "/auth"
case .social:
base = coreAuthBaseURL + "/social"
}
Expand Down

0 comments on commit 0d0b3a3

Please sign in to comment.