Documentation
¶
Overview ¶
Package handler v1 API의 HTTP 요청 핸들러를 제공합니다.
이 패키지는 HTTP 요청을 받아 검증하고, 비즈니스 로직을 호출한 후, 적절한 HTTP 응답을 반환하는 핸들러 함수들을 포함합니다.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler v1 API 요청을 처리하고 비즈니스 로직을 연결하는 핸들러입니다.
이 구조체는 다음 역할을 수행합니다:
- HTTP 요청 바인딩 및 검증
- 애플리케이션 인증 처리
- 비즈니스 로직(알림 전송) 호출
- HTTP 응답 생성
Handler는 의존성 주입을 통해 생성되며, 인증 관리자와 알림 전송 서비스를 주입받습니다.
func NewHandler ¶
func NewHandler(applicationManager *auth.ApplicationManager, notificationSender notification.Sender) *Handler
NewHandler Handler 인스턴스를 생성합니다.
매개변수:
- applicationManager: 애플리케이션 인증을 담당하는 매니저
- notificationSender: 알림 전송을 담당하는 Sender 구현체
반환값:
- 초기화된 Handler 인스턴스
func (*Handler) PublishNotificationHandler ¶
PublishNotificationHandler godoc @Summary 알림 메시지 게시 @Description 외부 애플리케이션에서 텔레그램 등의 메신저로 알림 메시지를 전송합니다. @Description @Description 이 API를 사용하려면 사전에 등록된 애플리케이션 ID와 App Key가 필요합니다. @Description 설정 파일(notify-server.json)의 notify_api.applications에 애플리케이션을 등록해야 합니다. @Description @Description ## 사용 예시 (로컬 환경) @Description ```bash @Description curl -X POST "http://localhost:2443/api/v1/notifications?app_key=your-app-key" \ @Description -H "Content-Type: application/json" \ @Description -d '{"application_id":"my-app","message":"테스트 메시지","error_occurred":false}' @Description ``` @Tags Notification @Accept json @Produce json @Param app_key query string true "Application Key (인증용)" example(your-app-key-here) @Param message body request.NotificationRequest true "알림 메시지 정보" @Success 200 {object} response.SuccessResponse "성공" @Failure 400 {object} response.ErrorResponse "잘못된 요청 (필수 필드 누락, JSON 형식 오류 등)" @Failure 401 {object} response.ErrorResponse "인증 실패 (잘못된 App Key 또는 미등록 애플리케이션)" @Failure 500 {object} response.ErrorResponse "서버 내부 오류" @Security ApiKeyAuth @Router /api/v1/notifications [post]