Skip to content

Commit

Permalink
refactor: notifier APIs pattern
Browse files Browse the repository at this point in the history
  • Loading branch information
guqing committed Sep 27, 2023
1 parent 84cdc89 commit 8418b42
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public class ConsoleNotifierEndpoint implements CustomEndpoint {
public RouterFunction<ServerResponse> endpoint() {
var tag = "api.console.halo.run/v1alpha1/Notifier";
return SpringdocRouteBuilder.route()
.GET("/notifiers/{name}/senderConfig", this::fetchSenderConfig,
.GET("/notifiers/{name}/sender-config", this::fetchSenderConfig,
builder -> builder.operationId("FetchSenderConfig")
.description("Fetch sender config of notifier")
.tag(tag)
Expand All @@ -48,7 +48,7 @@ public RouterFunction<ServerResponse> endpoint() {
)
.response(responseBuilder().implementation(ObjectNode.class))
)
.POST("/notifiers/{name}/senderConfig", this::saveSenderConfig,
.POST("/notifiers/{name}/sender-config", this::saveSenderConfig,
builder -> builder.operationId("SaveSenderConfig")
.description("Save sender config of notifier")
.tag(tag)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public class UserNotifierEndpoint implements CustomEndpoint {
public RouterFunction<ServerResponse> endpoint() {
var tag = "api.notification.halo.run/v1alpha1/Notifier";
return SpringdocRouteBuilder.route()
.GET("/notifiers/{name}/receiverConfig", this::fetchReceiverConfig,
.GET("/notifiers/{name}/receiver-config", this::fetchReceiverConfig,
builder -> builder.operationId("FetchReceiverConfig")
.description("Fetch receiver config of notifier")
.tag(tag)
Expand All @@ -49,7 +49,7 @@ public RouterFunction<ServerResponse> endpoint() {
)
.response(responseBuilder().implementation(ObjectNode.class))
)
.POST("/notifiers/{name}/receiverConfig", this::saveReceiverConfig,
.POST("/notifiers/{name}/receiver-config", this::saveReceiverConfig,
builder -> builder.operationId("SaveReceiverConfig")
.description("Save receiver config of notifier")
.tag(tag)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,5 +127,5 @@ rules:
resources: [ "notifications/mark-as-read", "notifications/mark-specified-as-read" ]
verbs: [ "update" ]
- apiGroups: [ "api.notification.halo.run" ]
resources: [ "notifiers/receiverConfig" ]
resources: [ "notifiers/receiver-config" ]
verbs: [ "get", "update" ]
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ metadata:
["system:notifier:configuration"]
rules:
- apiGroups: [ "api.console.halo.run" ]
resources: [ "notifiers/senderConfig" ]
resources: [ "notifiers/sender-config" ]
verbs: [ "get", "update" ]
8 changes: 4 additions & 4 deletions docs/notification/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -248,13 +248,13 @@ spec:

管理员获取和保存通知器发送配置的 APIs:

1. 获取通知器发送方配置:`GET /apis/api.console.halo.run/v1alpha1/notifiers/{name}/senderConfig`
2. 保存通知器发送方配置:`POST /apis/api.console.halo.run/v1alpha1/notifiers/{name}/senderConfig`
1. 获取通知器发送方配置:`GET /apis/api.console.halo.run/v1alpha1/notifiers/{name}/sender-config`
2. 保存通知器发送方配置:`POST /apis/api.console.halo.run/v1alpha1/notifiers/{name}/sender-config`

个人中心用户获取和保存对应通知器接收消息配置的 APIs:

1. 获取通知器接收消息配置:`GET /apis/api.notification.halo.run/v1alpha1/notifiers/{name}/receiverConfig`
2. 获取通知器接收消息配置:`POST /apis/api.notification.halo.run/v1alpha1/notifiers/{name}/receiverConfig`
1. 获取通知器接收消息配置:`GET /apis/api.notification.halo.run/v1alpha1/notifiers/{name}/receiver-config`
2. 获取通知器接收消息配置:`POST /apis/api.notification.halo.run/v1alpha1/notifiers/{name}/receiver-config`

通知器扩展点用于实现发送通知的方式:

Expand Down

0 comments on commit 8418b42

Please sign in to comment.