-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
154 additions
and
0 deletions.
There are no files selected for viewing
70 changes: 70 additions & 0 deletions
70
SOPT-iOS/Projects/Modules/Networks/Sources/API/CoreAuthAPI.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} | ||
} | ||
|
||
|
21 changes: 21 additions & 0 deletions
21
SOPT-iOS/Projects/Modules/Networks/Sources/Entity/CoreAuth/SendVerificationCodeEntity.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
SOPT-iOS/Projects/Modules/Networks/Sources/Entity/CoreAuth/VerifyCodeEntity.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
SOPT-iOS/Projects/Modules/Networks/Sources/Entity/CoreAuth/VerifyResultEntity.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
SOPT-iOS/Projects/Modules/Networks/Sources/Entity/CoreAuth/VerifyType.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters