2021-06-09 08:41:25 +00:00
|
|
|
|
include "base.thrift"
|
|
|
|
|
|
|
|
|
|
namespace java com.rbkmoney.notification
|
|
|
|
|
namespace erlang notification
|
|
|
|
|
|
|
|
|
|
typedef string Base64
|
|
|
|
|
typedef string ContinuationToken
|
|
|
|
|
typedef base.ID PartyID
|
|
|
|
|
typedef base.ID NotificationTemplateId
|
|
|
|
|
|
|
|
|
|
exception NotificationTemplateNotFound {}
|
|
|
|
|
exception BadContinuationToken { 1: string reason }
|
|
|
|
|
exception BadNotificationTemplateState { 1: string reason }
|
|
|
|
|
|
|
|
|
|
struct NotificationTemplate {
|
2021-06-18 13:47:37 +00:00
|
|
|
|
1: required NotificationTemplateId template_id
|
2021-06-09 08:41:25 +00:00
|
|
|
|
2: required string title
|
|
|
|
|
3: required base.Timestamp created_at
|
|
|
|
|
4: optional base.Timestamp updated_at
|
|
|
|
|
5: required NotificationTemplateState state
|
2021-06-18 13:47:37 +00:00
|
|
|
|
6: required Base64 content,
|
|
|
|
|
7: optional NotificationTemplateDistributionDetails distribution_details
|
2021-06-09 08:41:25 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
struct NotificationTemplateDistributionDetails {
|
|
|
|
|
1: required i64 read_count
|
|
|
|
|
2: required i64 total_count
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
enum NotificationTemplateState {
|
2021-07-12 12:09:59 +00:00
|
|
|
|
/* Состояние при котором возможно производить изменения в notification template */
|
2021-06-09 08:41:25 +00:00
|
|
|
|
draft_state
|
2021-07-12 12:09:59 +00:00
|
|
|
|
/*
|
|
|
|
|
Состояние после которого невозможно модифицировать notification template.
|
|
|
|
|
К примеру, после отправки нотификаций
|
|
|
|
|
*/
|
2021-06-09 08:41:25 +00:00
|
|
|
|
final_state
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
enum NotificationStatus {
|
|
|
|
|
read
|
|
|
|
|
unread
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
struct Party {
|
2021-06-18 13:47:37 +00:00
|
|
|
|
1: required PartyID party_id
|
2021-06-09 08:41:25 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
struct PartyNotification {
|
2021-06-18 13:47:37 +00:00
|
|
|
|
1: required NotificationTemplateId template_id
|
2021-06-09 08:41:25 +00:00
|
|
|
|
2: required Party party
|
|
|
|
|
3: required NotificationStatus status
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
union DateFilter {
|
|
|
|
|
1: FixedDateFilter fixed_date_filter
|
|
|
|
|
2: RangeDateFilter range_date_filter
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
struct FixedDateFilter {
|
|
|
|
|
1: required base.Timestamp date
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
struct RangeDateFilter {
|
|
|
|
|
1: required base.Timestamp from_date
|
|
|
|
|
2: required base.Timestamp to_date
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
struct NotificationTemplatePartyRequest {
|
2021-06-28 14:38:11 +00:00
|
|
|
|
1: required NotificationTemplateId template_id
|
2021-06-09 08:41:25 +00:00
|
|
|
|
2: optional NotificationStatus status
|
|
|
|
|
3: optional ContinuationToken continuation_token
|
|
|
|
|
4: optional i32 limit
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
struct NotificationTemplatePartyResponse {
|
|
|
|
|
1: required list<PartyNotification> parties
|
|
|
|
|
2: optional ContinuationToken continuation_token
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
struct NotificationTemplateSearchRequest {
|
|
|
|
|
1: optional string title
|
2021-06-28 14:38:11 +00:00
|
|
|
|
2: optional string content
|
|
|
|
|
3: optional DateFilter date
|
|
|
|
|
4: optional ContinuationToken continuation_token
|
|
|
|
|
5: optional i32 limit
|
2021-06-09 08:41:25 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
struct NotificationTemplateSearchResponse {
|
2021-06-28 14:38:11 +00:00
|
|
|
|
1: required list<NotificationTemplate> notification_templates
|
2021-06-09 08:41:25 +00:00
|
|
|
|
2: optional ContinuationToken continuation_token
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
struct NotificationTemplateCreateRequest {
|
|
|
|
|
1: required string title
|
|
|
|
|
2: required Base64 content
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
struct NotificationTemplateModifyRequest {
|
2021-06-18 13:47:37 +00:00
|
|
|
|
1: required NotificationTemplateId template_id
|
2021-06-09 08:41:25 +00:00
|
|
|
|
2: optional string title
|
|
|
|
|
3: optional Base64 content
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
service NotificationService {
|
|
|
|
|
|
|
|
|
|
/* Создание шаблона уведомления */
|
|
|
|
|
NotificationTemplate createNotificationTemplate(1: NotificationTemplateCreateRequest notification_request)
|
|
|
|
|
throws (
|
|
|
|
|
1: base.InvalidRequest ex1
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
/* Редактирование шаблона уведомления */
|
|
|
|
|
NotificationTemplate modifyNotificationTemplate(1: NotificationTemplateModifyRequest notification_request)
|
|
|
|
|
throws (
|
|
|
|
|
1: base.InvalidRequest ex1,
|
|
|
|
|
2: NotificationTemplateNotFound ex2,
|
|
|
|
|
3: BadNotificationTemplateState ex3
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
NotificationTemplate getNotificationTemplate(1: NotificationTemplateId template_id)
|
|
|
|
|
throws (
|
|
|
|
|
1: NotificationTemplateNotFound ex1
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
/* Получение списка отправленных уведомлений для выбранного шаблона */
|
|
|
|
|
NotificationTemplatePartyResponse findNotificationTemplateParties(1: NotificationTemplatePartyRequest party_request)
|
|
|
|
|
throws (
|
|
|
|
|
1: BadContinuationToken ex1
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
/* Поиск шаблонов уведомлений */
|
|
|
|
|
NotificationTemplateSearchResponse findNotificationTemplates(1: NotificationTemplateSearchRequest notification_search_request)
|
|
|
|
|
throws (
|
|
|
|
|
1: BadContinuationToken ex1
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
/* Отправка уведомления выбранным мерчантам */
|
|
|
|
|
void sendNotification(1: NotificationTemplateId template_id, 2: list<PartyID> party_ids)
|
2021-06-28 14:38:11 +00:00
|
|
|
|
throws (
|
|
|
|
|
1: NotificationTemplateNotFound ex1,
|
|
|
|
|
)
|
2021-06-09 08:41:25 +00:00
|
|
|
|
|
|
|
|
|
/* Отправка уведомления для всех мерчантов */
|
|
|
|
|
void sendNotificationAll(1: NotificationTemplateId template_id)
|
2021-06-28 14:38:11 +00:00
|
|
|
|
throws (
|
|
|
|
|
1: NotificationTemplateNotFound ex1,
|
|
|
|
|
)
|
2021-06-09 08:41:25 +00:00
|
|
|
|
|
|
|
|
|
}
|