Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

request result #8

Closed
2 tasks done
jeonghomoon opened this issue Sep 9, 2022 · 0 comments · Fixed by #10
Closed
2 tasks done

request result #8

jeonghomoon opened this issue Sep 9, 2022 · 0 comments · Fixed by #10
Assignees
Labels
feat 기능 추가

Comments

@jeonghomoon
Copy link
Owner

jeonghomoon commented Sep 9, 2022

Description

요청에 대한 응답값을 decoding 하기위해 특정 객체가 필요합니다.
본 프로젝트가 Boilerplate 임을 고려하여 관련 값을 제네릭하게 처리하려고 합니다.

요구사항

  1. 응답에 대한 오류와 성공적으로 받아온 응답을 처리하기 위해 두 경우를 Result 열거형을 이용하여 작성합니다.
  2. 응답 자체가 성공하더라도, 요청 성공, 실패에 따라 다른 값을 내려주기 때문에, 두 값을 제네릭하게 처리하는 Reponse enum을 작성합니다.

TODO

RequestResult

  • Result
  • Response

Environment

macOS: Monterey 12.5.1, Apple M1
iOS: 15.5, iPhone 13 mini
IDE: Xcode 13.4.1

Related: #

@jeonghomoon jeonghomoon added the feat 기능 추가 label Sep 9, 2022
@jeonghomoon jeonghomoon self-assigned this Sep 9, 2022
@jeonghomoon jeonghomoon changed the title request result add request result Sep 9, 2022
@jeonghomoon jeonghomoon changed the title add request result request result Sep 10, 2022
jeonghomoon added a commit that referenced this issue Sep 10, 2022
요청에 대한 응답을 처리하기 위해 RequestResult enum을 작성하였습니다.
요청 자체가 실패한 경우 나오는 에러를 처리하기 위해 Result 형태의 enum을 이용하였고,
이와 별개로 응답 자체의 성공, 실패를 처리하기위해 Response enum을 작성하였습니다.

Response enum의 경우 성공과 실패에 대해 각각을 Codable 타입으로 제한한 제네릭 타입을 받습니다.
응답 처리 뿐만아니라 요청시 dto를 사용하는 경우를 생각해 Decodable이 아닌 Codable로 제한하였습니다.

Refs: #8
jeonghomoon added a commit that referenced this issue Sep 10, 2022
요청에 대한 응답을 처리하기 위해 RequestResult enum을 작성하였습니다.
요청 자체가 실패한 경우 나오는 에러를 처리하기 위해 Result 형태의 enum을 이용하였고,
이와 별개로 응답 자체의 성공, 실패를 처리하기위해 Response enum을 작성하였습니다.

Response enum의 경우 성공과 실패에 대해 각각을 Codable 타입으로 제한한 제네릭 타입을 받습니다.
응답 처리 뿐만아니라 요청시 dto를 사용하는 경우를 생각해 Decodable이 아닌 Codable로 제한하였습니다.

Refs: #8
This was referenced Sep 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat 기능 추가
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant