api.bm.go 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. // Code generated by protoc-gen-bm v0.1, DO NOT EDIT.
  2. // source: api.proto
  3. /*
  4. Package v1 is a generated blademaster stub package.
  5. This code was generated with go-common/app/tool/bmgen/protoc-gen-bm v0.1.
  6. package 命名使用 {discovery_id}.{version} 的方式, version 形如 v1, v2, v1beta ..
  7. NOTE: 不知道的 discovery_id 请询问大佬, 新项目找大佬申请 discovery_id,先到先得抢注
  8. e.g. account.service.v1
  9. It is generated from these files:
  10. api.proto
  11. */
  12. package v1
  13. import (
  14. "context"
  15. bm "go-common/library/net/http/blademaster"
  16. "go-common/library/net/http/blademaster/binding"
  17. )
  18. // to suppressed 'imported but not used warning'
  19. var _ *bm.Context
  20. var _ context.Context
  21. var _ binding.StructValidator
  22. var PathRtcJoinChannel = "/live.rtc.v1.Rtc/JoinChannel"
  23. var PathRtcLeaveChannel = "/live.rtc.v1.Rtc/LeaveChannel"
  24. var PathRtcPublishStream = "/live.rtc.v1.Rtc/PublishStream"
  25. var PathRtcTerminateStream = "/live.rtc.v1.Rtc/TerminateStream"
  26. var PathRtcChannel = "/live.rtc.v1.Rtc/Channel"
  27. var PathRtcStream = "/live.rtc.v1.Rtc/Stream"
  28. var PathRtcSetRtcConfig = "/live.rtc.v1.Rtc/SetRtcConfig"
  29. var PathRtcVerifyToken = "/live.rtc.v1.Rtc/VerifyToken"
  30. // =============
  31. // Rtc Interface
  32. // =============
  33. type RtcBMServer interface {
  34. // `method:"POST"`
  35. JoinChannel(ctx context.Context, req *JoinChannelRequest) (resp *JoinChannelResponse, err error)
  36. // `method:"POST"`
  37. LeaveChannel(ctx context.Context, req *LeaveChannelRequest) (resp *LeaveChannelResponse, err error)
  38. // `method:"POST"`
  39. PublishStream(ctx context.Context, req *PublishStreamRequest) (resp *PublishStreamResponse, err error)
  40. // `method:"POST"`
  41. TerminateStream(ctx context.Context, req *TerminateStreamRequest) (resp *TerminateStreamResponse, err error)
  42. // `method:"GET"`
  43. Channel(ctx context.Context, req *ChannelRequest) (resp *ChannelResponse, err error)
  44. // `method:"GET"`
  45. Stream(ctx context.Context, req *StreamRequest) (resp *StreamResponse, err error)
  46. // `method:"POST"`
  47. SetRtcConfig(ctx context.Context, req *SetRtcConfigRequest) (resp *SetRtcConfigResponse, err error)
  48. // `method:"GET"`
  49. VerifyToken(ctx context.Context, req *VerifyTokenRequest) (resp *VerifyTokenResponse, err error)
  50. }
  51. var v1RtcSvc RtcBMServer
  52. func rtcJoinChannel(c *bm.Context) {
  53. p := new(JoinChannelRequest)
  54. if err := c.BindWith(p, binding.Default(c.Request.Method, c.Request.Header.Get("Content-Type"))); err != nil {
  55. return
  56. }
  57. resp, err := v1RtcSvc.JoinChannel(c, p)
  58. c.JSON(resp, err)
  59. }
  60. func rtcLeaveChannel(c *bm.Context) {
  61. p := new(LeaveChannelRequest)
  62. if err := c.BindWith(p, binding.Default(c.Request.Method, c.Request.Header.Get("Content-Type"))); err != nil {
  63. return
  64. }
  65. resp, err := v1RtcSvc.LeaveChannel(c, p)
  66. c.JSON(resp, err)
  67. }
  68. func rtcPublishStream(c *bm.Context) {
  69. p := new(PublishStreamRequest)
  70. if err := c.BindWith(p, binding.Default(c.Request.Method, c.Request.Header.Get("Content-Type"))); err != nil {
  71. return
  72. }
  73. resp, err := v1RtcSvc.PublishStream(c, p)
  74. c.JSON(resp, err)
  75. }
  76. func rtcTerminateStream(c *bm.Context) {
  77. p := new(TerminateStreamRequest)
  78. if err := c.BindWith(p, binding.Default(c.Request.Method, c.Request.Header.Get("Content-Type"))); err != nil {
  79. return
  80. }
  81. resp, err := v1RtcSvc.TerminateStream(c, p)
  82. c.JSON(resp, err)
  83. }
  84. func rtcChannel(c *bm.Context) {
  85. p := new(ChannelRequest)
  86. if err := c.BindWith(p, binding.Default(c.Request.Method, c.Request.Header.Get("Content-Type"))); err != nil {
  87. return
  88. }
  89. resp, err := v1RtcSvc.Channel(c, p)
  90. c.JSON(resp, err)
  91. }
  92. func rtcStream(c *bm.Context) {
  93. p := new(StreamRequest)
  94. if err := c.BindWith(p, binding.Default(c.Request.Method, c.Request.Header.Get("Content-Type"))); err != nil {
  95. return
  96. }
  97. resp, err := v1RtcSvc.Stream(c, p)
  98. c.JSON(resp, err)
  99. }
  100. func rtcSetRtcConfig(c *bm.Context) {
  101. p := new(SetRtcConfigRequest)
  102. if err := c.BindWith(p, binding.Default(c.Request.Method, c.Request.Header.Get("Content-Type"))); err != nil {
  103. return
  104. }
  105. resp, err := v1RtcSvc.SetRtcConfig(c, p)
  106. c.JSON(resp, err)
  107. }
  108. func rtcVerifyToken(c *bm.Context) {
  109. p := new(VerifyTokenRequest)
  110. if err := c.BindWith(p, binding.Default(c.Request.Method, c.Request.Header.Get("Content-Type"))); err != nil {
  111. return
  112. }
  113. resp, err := v1RtcSvc.VerifyToken(c, p)
  114. c.JSON(resp, err)
  115. }
  116. // RegisterRtcBMServer Register the blademaster route
  117. func RegisterRtcBMServer(e *bm.Engine, server RtcBMServer) {
  118. v1RtcSvc = server
  119. e.POST("/live.rtc.v1.Rtc/JoinChannel", rtcJoinChannel)
  120. e.POST("/live.rtc.v1.Rtc/LeaveChannel", rtcLeaveChannel)
  121. e.POST("/live.rtc.v1.Rtc/PublishStream", rtcPublishStream)
  122. e.POST("/live.rtc.v1.Rtc/TerminateStream", rtcTerminateStream)
  123. e.GET("/live.rtc.v1.Rtc/Channel", rtcChannel)
  124. e.GET("/live.rtc.v1.Rtc/Stream", rtcStream)
  125. e.POST("/live.rtc.v1.Rtc/SetRtcConfig", rtcSetRtcConfig)
  126. e.GET("/live.rtc.v1.Rtc/VerifyToken", rtcVerifyToken)
  127. }