You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

callback.go 1.9 kB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. // Copyright © 2023 OpenIM open source community. All rights reserved.
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. package api
  15. import (
  16. "fmt"
  17. "net/http"
  18. "github.com/gin-gonic/gin"
  19. "github.com/OpenIMSDK/OpenKF/server/internal/common"
  20. "github.com/OpenIMSDK/OpenKF/server/internal/common/response"
  21. "github.com/OpenIMSDK/OpenKF/server/internal/param"
  22. )
  23. // OpenIMCallback
  24. // @Tags openim
  25. // @Summary OpenIMCallback
  26. // @Description Support OpenIM callback
  27. // @Produce application/json
  28. // @Success 200 {object} response.Response{msg=string} "Success"
  29. // @Router /api/v1/openim/callback [post].
  30. func OpenIMCallback(c *gin.Context) {
  31. param := &param.OpenIMCallbackCommand{}
  32. err := c.ShouldBindQuery(param)
  33. if err != nil {
  34. // todo
  35. response.FailWithCode(common.INVALID_PARAMS, c)
  36. return
  37. }
  38. // redirect to the corresponding router
  39. callbackURL := fmt.Sprintf("%s%s", c.Request.URL.Path, param.Command)
  40. c.Request.URL.Path = callbackURL
  41. c.Redirect(http.StatusTemporaryRedirect, callbackURL)
  42. }
  43. // BeforeSendSingleMsg.
  44. func BeforeSendSingleMsg(c *gin.Context) {
  45. }
  46. // AfterSendSingleMsg.
  47. func AfterSendSingleMsg(c *gin.Context) {
  48. }
  49. // MsgModify.
  50. func MsgModify(c *gin.Context) {
  51. }
  52. // UserOnline.
  53. func UserOnline(c *gin.Context) {
  54. }
  55. // UserOffline.
  56. func UserOffline(c *gin.Context) {
  57. }
  58. // OfflinePush.
  59. func OfflinePush(c *gin.Context) {
  60. }
  61. // OnlinePush.
  62. func OnlinePush(c *gin.Context) {
  63. }