-
Notifications
You must be signed in to change notification settings - Fork 0
SOLAPI Elixir SDK 0.1.1 #1
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
Conversation
- Updated the message service to include `faxOptions` and `voiceOptions` fields. - Added tests for sending fax and voice messages, verifying the correct structure and response.
Summary of ChangesHello @Palbahngmiyine, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request enhances the Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
이 PR은 Solapi.Message.Service에 faxOptions와 voiceOptions를 추가하여 팩스 및 음성 메시지 발송 기능을 지원하는 변경 사항을 담고 있습니다. 전반적으로 기능 추가와 관련 테스트 코드는 잘 작성되었습니다.
다만, Elixir 코드의 일관성과 가독성을 높이기 위해 몇 가지 개선점을 제안합니다. 새로 추가된 옵션(faxOptions, voiceOptions)의 내부 키로 카멜 케이스(camelCase) 원자(atom)를 사용하고 있는데, Elixir 커뮤니티의 표준 컨벤션은 스네이크 케이스(snake_case)를 사용하는 것입니다.
따라서 테스트 코드에서는 :file_ids, :voice_type과 같이 스네이크 케이스를 사용하고, Service 모듈에서 API 요청을 생성할 때 이 키들을 카멜 케이스 문자열로 변환하는 로직을 추가하는 방향으로 리팩토링하는 것을 권장합니다. 자세한 내용은 각 파일의 리뷰 코멘트를 참고해 주세요.
| |> maybe_add("faxOptions", get_field(message, :fax_options, "faxOptions")) | ||
| |> maybe_add("voiceOptions", get_field(message, :voice_options, "voiceOptions")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
테스트 코드에서 제안된 스네이크 케이스 원자 키(:file_ids, :voice_type)를 API가 요구하는 카멜 케이스 문자열 키(fileIds, voiceType)로 변환하기 위해, 옵션 맵의 키를 변환하는 로직을 추가해야 합니다. 이렇게 하면 Elixir 코드베이스에서는 일관된 스네이크 케이스를 유지하면서 외부 API와의 연동을 원활하게 할 수 있습니다.
아래와 같이 키를 변환하는 함수를 호출하도록 변경하고, 해당 함수를 모듈 내에 비공개 함수로 추가하는 것을 제안합니다.
추가할 헬퍼 함수 예시:
defp transform_option_keys(nil), do: nil
defp transform_option_keys(map) when is_map(map) do
for {key, val} <- map, into: %{} do
{key |> Atom.to_string() |> to_camel_case(), val}
end
end
defp to_camel_case(string) do
[first | rest] = String.split(string, "_")
first <> Enum.map_join(rest, "", &String.capitalize/1)
endtransform_option_keys/1 함수는 kakaoOptions, rcsOptions 등 다른 옵션에도 일관되게 적용하여 라이브러리 전반의 일관성을 높일 수 있습니다.
|> maybe_add("faxOptions", get_field(message, :fax_options, "faxOptions") |> transform_option_keys())
|> maybe_add("voiceOptions", get_field(message, :voice_options, "voiceOptions") |> transform_option_keys())
| Service.send(client, %{ | ||
| to: "0212345678", | ||
| from: "0312345678", | ||
| fax_options: %{fileIds: ["file_id_123", "file_id_456"]} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Elixir에서는 원자(atom) 키에 대해 스네이크 케이스(snake_case)를 사용하는 것이 일반적인 컨벤션입니다. :fileIds 대신 :file_ids를 사용하도록 변경하는 것이 좋겠습니다. 이 변경에 맞춰 Solapi.Message.Service.normalize_message/1 함수에서 중첩된 맵의 키를 카멜 케이스(camelCase)로 변환하는 로직 추가가 필요합니다. 이는 라이브러리 전체의 일관성을 높이고 Elixir 개발자에게 더 친숙한 인터페이스를 제공할 것입니다.
fax_options: %{file_ids: ["file_id_123", "file_id_456"]}
| to: "01012345678", | ||
| from: "0212345678", | ||
| text: "음성 메시지 테스트입니다.", | ||
| voice_options: %{voiceType: "FEMALE"} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
faxOptionsandvoiceOptionsfields.