diff --git a/generated/api.gen.go b/generated/api.gen.go index 39d53a0..916e0b5 100644 --- a/generated/api.gen.go +++ b/generated/api.gen.go @@ -161,11 +161,55 @@ type FCMTokenRequest struct { // Notification defines model for Notification. type Notification struct { + // AnalyticsLabel Firebase Analytics に記録する分析ラベル + // + // 通知の開封率計測などに利用 + AnalyticsLabel *string `json:"analyticsLabel,omitempty"` + + // AndroidChannelId Android の通知チャンネルID + // + // Android 8.0 以降、通知はチャンネル単位で管理される + AndroidChannelId *string `json:"androidChannelId,omitempty"` + + // AndroidPriority Android の通知優先度 + // + // "normal" または "high"。"high" は即時配信される + AndroidPriority *string `json:"androidPriority,omitempty"` + + // AndroidTtlSeconds Android の通知TTL(秒) + // + // FCM がメッセージを保持する最大時間。期限切れで破棄される + AndroidTtlSeconds *int `json:"androidTtlSeconds,omitempty"` + + // ApnsBadge APNs のバッジ数 + // + // アプリアイコンに表示される数値。0 でバッジを消去 + ApnsBadge *int `json:"apnsBadge,omitempty"` + + // ApnsContentAvailable APNs の content-available フラグ + // + // true でサイレントプッシュ(バックグラウンド更新)になる + ApnsContentAvailable *bool `json:"apnsContentAvailable,omitempty"` + + // ApnsSound APNs の通知音 + // + // - "default": OS 標準の通知音 + // - "" または省略: 無音 + // - 任意のファイル名(例: "alert.caf"): アプリバンドルまたは Library/Sounds/ に同梱されたカスタムサウンド + // 対応フォーマットは .caf / .aiff / .wav(Linear PCM, MA4, µ-law, a-law)、最大30秒 + ApnsSound *string `json:"apnsSound,omitempty"` + + // Body 通知本文 + Body string `json:"body"` + + // Id 通知ID Id string `json:"id"` + // ImageUrl 通知に表示する画像のURL + ImageUrl *string `json:"imageUrl,omitempty"` + // IsNotified 通知が送信されたかどうか - IsNotified bool `json:"isNotified"` - Message string `json:"message"` + IsNotified bool `json:"isNotified"` // NotifyAfter 通知送信可能になる日時(この時刻以降に送信対象となる) NotifyAfter time.Time `json:"notifyAfter"` @@ -175,21 +219,70 @@ type Notification struct { // TargetUserIds 対象ユーザーIDのリスト TargetUserIds []string `json:"targetUserIds"` - Title string `json:"title"` + + // Title 通知タイトル + Title string `json:"title"` // Url 通知をタップした時に開くURL - // アプリを開くのみの場合はnull + // アプリを開くのみの場合は未指定 Url *string `json:"url,omitempty"` + + // WebpushLink Web Push 通知をクリックした際に開くURL + WebpushLink *string `json:"webpushLink,omitempty"` } // NotificationRequest defines model for NotificationRequest. type NotificationRequest struct { - Message string `json:"message"` - NotifyAfter time.Time `json:"notifyAfter"` - NotifyBefore time.Time `json:"notifyBefore"` - TargetUserIds []string `json:"targetUserIds"` - Title string `json:"title"` - Url *string `json:"url,omitempty"` + // AnalyticsLabel Firebase Analytics に記録する分析ラベル + AnalyticsLabel *string `json:"analyticsLabel,omitempty"` + + // AndroidChannelId Android の通知チャンネルID + AndroidChannelId *string `json:"androidChannelId,omitempty"` + + // AndroidPriority Android の通知優先度("normal" または "high") + AndroidPriority *string `json:"androidPriority,omitempty"` + + // AndroidTtlSeconds Android の通知TTL(秒) + AndroidTtlSeconds *int `json:"androidTtlSeconds,omitempty"` + + // ApnsBadge APNs のバッジ数 + ApnsBadge *int `json:"apnsBadge,omitempty"` + + // ApnsContentAvailable APNs の content-available フラグ(true でサイレントプッシュ) + ApnsContentAvailable *bool `json:"apnsContentAvailable,omitempty"` + + // ApnsSound APNs の通知音 + // + // - "default": OS 標準の通知音 + // - "" または省略: 無音 + // - 任意のファイル名(例: "alert.caf"): アプリバンドルまたは Library/Sounds/ に同梱されたカスタムサウンド + // 対応フォーマットは .caf / .aiff / .wav(Linear PCM, MA4, µ-law, a-law)、最大30秒 + ApnsSound *string `json:"apnsSound,omitempty"` + + // Body 通知本文 + Body string `json:"body"` + + // ImageUrl 通知に表示する画像のURL + ImageUrl *string `json:"imageUrl,omitempty"` + + // NotifyAfter 通知送信可能になる日時(この時刻以降に送信対象となる) + NotifyAfter time.Time `json:"notifyAfter"` + + // NotifyBefore 通知送信期限日時(この時刻を過ぎた場合は送信しない) + NotifyBefore time.Time `json:"notifyBefore"` + + // TargetUserIds 対象ユーザーIDのリスト + TargetUserIds []string `json:"targetUserIds"` + + // Title 通知タイトル + Title string `json:"title"` + + // Url 通知をタップした時に開くURL + // アプリを開くのみの場合は未指定 + Url *string `json:"url,omitempty"` + + // WebpushLink Web Push 通知をクリックした際に開くURL + WebpushLink *string `json:"webpushLink,omitempty"` } // User defines model for User. diff --git a/internal/handler/converter.go b/internal/handler/converter.go index 0a16c0d..48077a2 100644 --- a/internal/handler/converter.go +++ b/internal/handler/converter.go @@ -85,7 +85,7 @@ func toAPINotification(n domain.Notification) api.Notification { return api.Notification{ Id: n.ID, Title: n.Title, - Message: n.Message, + Body: n.Message, Url: n.URL, NotifyAfter: n.NotifyAfter, NotifyBefore: n.NotifyBefore, @@ -106,7 +106,7 @@ func toDomainNotification(id string, req api.NotificationRequest) domain.Notific return domain.Notification{ ID: id, Title: req.Title, - Message: req.Message, + Message: req.Body, URL: req.Url, NotifyAfter: req.NotifyAfter, NotifyBefore: req.NotifyBefore, diff --git a/openapi/openapi.yaml b/openapi/openapi.yaml index 2dbf91e..f35fc9a 100644 --- a/openapi/openapi.yaml +++ b/openapi/openapi.yaml @@ -403,7 +403,7 @@ components: required: - id - title - - message + - body - notifyAfter - notifyBefore - isNotified @@ -411,15 +411,69 @@ components: properties: id: type: string + description: 通知ID title: type: string - message: + description: 通知タイトル + body: + type: string + description: 通知本文 + imageUrl: + type: string + description: 通知に表示する画像のURL + analyticsLabel: + type: string + description: |- + Firebase Analytics に記録する分析ラベル + + 通知の開封率計測などに利用 + apnsBadge: + type: integer + description: |- + APNs のバッジ数 + + アプリアイコンに表示される数値。0 でバッジを消去 + apnsSound: + type: string + description: |- + APNs の通知音 + + - "default": OS 標準の通知音 + - "" または省略: 無音 + - 任意のファイル名(例: "alert.caf"): アプリバンドルまたは Library/Sounds/ に同梱されたカスタムサウンド + 対応フォーマットは .caf / .aiff / .wav(Linear PCM, MA4, µ-law, a-law)、最大30秒 + apnsContentAvailable: + type: boolean + description: |- + APNs の content-available フラグ + + true でサイレントプッシュ(バックグラウンド更新)になる + androidChannelId: + type: string + description: |- + Android の通知チャンネルID + + Android 8.0 以降、通知はチャンネル単位で管理される + androidPriority: + type: string + description: |- + Android の通知優先度 + + "normal" または "high"。"high" は即時配信される + androidTtlSeconds: + type: integer + description: |- + Android の通知TTL(秒) + + FCM がメッセージを保持する最大時間。期限切れで破棄される + webpushLink: type: string + description: Web Push 通知をクリックした際に開くURL url: type: string description: |- 通知をタップした時に開くURL - アプリを開くのみの場合はnull + アプリを開くのみの場合は未指定 notifyAfter: type: string format: date-time @@ -440,27 +494,68 @@ components: type: object required: - title - - message + - body - notifyAfter - notifyBefore - targetUserIds properties: title: type: string - message: + description: 通知タイトル + body: + type: string + description: 通知本文 + imageUrl: + type: string + description: 通知に表示する画像のURL + analyticsLabel: + type: string + description: Firebase Analytics に記録する分析ラベル + apnsBadge: + type: integer + description: APNs のバッジ数 + apnsSound: + type: string + description: |- + APNs の通知音 + + - "default": OS 標準の通知音 + - "" または省略: 無音 + - 任意のファイル名(例: "alert.caf"): アプリバンドルまたは Library/Sounds/ に同梱されたカスタムサウンド + 対応フォーマットは .caf / .aiff / .wav(Linear PCM, MA4, µ-law, a-law)、最大30秒 + apnsContentAvailable: + type: boolean + description: APNs の content-available フラグ(true でサイレントプッシュ) + androidChannelId: + type: string + description: Android の通知チャンネルID + androidPriority: type: string + description: Android の通知優先度("normal" または "high") + androidTtlSeconds: + type: integer + description: Android の通知TTL(秒) + webpushLink: + type: string + description: Web Push 通知をクリックした際に開くURL url: type: string + description: |- + 通知をタップした時に開くURL + アプリを開くのみの場合は未指定 notifyAfter: type: string format: date-time + description: 通知送信可能になる日時(この時刻以降に送信対象となる) notifyBefore: type: string format: date-time + description: 通知送信期限日時(この時刻を過ぎた場合は送信しない) targetUserIds: type: array items: type: string + description: 対象ユーザーIDのリスト User: type: object required: