Skip to content

Commit

Permalink
[Feat] #473 - home/employment 네트워크 레이어 구현
Browse files Browse the repository at this point in the history
  • Loading branch information
dlwogus0128 committed Jan 20, 2025
1 parent 30d4b30 commit 0dc4e01
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 2 deletions.
7 changes: 5 additions & 2 deletions SOPT-iOS/Projects/Modules/Networks/Sources/API/HomeAPI.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public enum HomeAPI {
case getInsightPosts
case getGroupAll
case getCoffeeChat
case getEmployment
}

extension HomeAPI: BaseAPI {
Expand All @@ -35,19 +36,21 @@ extension HomeAPI: BaseAPI {
return "/meeting/all"
case .getCoffeeChat:
return "/coffeechat"
case .getEmployment:
return "/employment"
}
}

public var method: Moya.Method {
switch self {
case .getDescription, .getAppServiceAccessStatus, .getInsightPosts, .getGroupAll, .getCoffeeChat:
case .getDescription, .getAppServiceAccessStatus, .getInsightPosts, .getGroupAll, .getCoffeeChat, .getEmployment:
return .get
}
}

public var task: Moya.Task {
switch self {
case .getDescription, .getAppServiceAccessStatus, .getInsightPosts, .getCoffeeChat:
case .getDescription, .getAppServiceAccessStatus, .getInsightPosts, .getCoffeeChat, .getEmployment:
return .requestPlain
case .getGroupAll:
return .requestParameters(parameters: ["page": 1, "take": 10, "category": "행사,세미나"], encoding: URLEncoding.queryString)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
//
// HomeEmploymentEntity.swift
// Networks
//
// Created by Jae Hyun Lee on 1/20/25.
// Copyright © 2025 SOPT-iOS. All rights reserved.
//

import Foundation

// MARK: - HomeEmploymentEntity

public struct HomeEmploymentEntity: Codable {
public let id: Int
public let categoryName, title, profileImage, name: String
public let content: String
public let images: [String]
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ public protocol HomeService {
func getInsightPosts() -> AnyPublisher<[HomeInsightPostsEntity], Error>
func getGroupAll() -> AnyPublisher<[HomeGroupEntity], Error>
func getCoffeeChat() -> AnyPublisher<[HomeCoffeeChatEntity], Error>
func getHomeEmploymentEntity() -> AnyPublisher<[HomeEmploymentEntity], Error>
}

extension DefaultHomeService: HomeService {
Expand All @@ -41,4 +42,8 @@ extension DefaultHomeService: HomeService {
public func getCoffeeChat() -> AnyPublisher<[HomeCoffeeChatEntity], any Error> {
requestObjectInCombine(.getCoffeeChat)
}

public func getHomeEmploymentEntity() -> AnyPublisher<[HomeEmploymentEntity], any Error> {
requestObjectInCombine(.getEmployment)
}
}

0 comments on commit 0dc4e01

Please sign in to comment.