Skip to content

Commit

Permalink
Merge pull request #21 from larksuite/new_service
Browse files Browse the repository at this point in the history
delete gin
  • Loading branch information
Mingqiang Zhao authored Apr 13, 2021
2 parents d3150b5 + 981d200 commit 9cdc673
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 146 deletions.
13 changes: 0 additions & 13 deletions card/http/gin/handler.go

This file was deleted.

13 changes: 0 additions & 13 deletions event/http/gin/handler.go

This file was deleted.

6 changes: 4 additions & 2 deletions sample/card/gin.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"fmt"
"github.com/gin-gonic/gin"
"github.com/larksuite/oapi-sdk-go/card"
cardginserver "github.com/larksuite/oapi-sdk-go/card/http/gin"
cardtttp "github.com/larksuite/oapi-sdk-go/card/http"
"github.com/larksuite/oapi-sdk-go/card/model"
"github.com/larksuite/oapi-sdk-go/core"
"github.com/larksuite/oapi-sdk-go/core/constants"
Expand All @@ -26,7 +26,9 @@ func main() {
})

g := gin.Default()
cardginserver.Register("/webhook/card", conf, g)
g.POST("/webhook/card", func(context *gin.Context) {
cardtttp.Handle(conf, context.Request, context.Writer)
})
err := g.Run(":8089")
if err != nil {
panic(err)
Expand Down
36 changes: 0 additions & 36 deletions sample/card/gin2.go

This file was deleted.

31 changes: 12 additions & 19 deletions sample/event/gin.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@ import (
"github.com/larksuite/oapi-sdk-go/core/constants"
"github.com/larksuite/oapi-sdk-go/core/tools"
"github.com/larksuite/oapi-sdk-go/event"
eventginserver "github.com/larksuite/oapi-sdk-go/event/http/gin"
eventhttp "github.com/larksuite/oapi-sdk-go/event/http"
"github.com/larksuite/oapi-sdk-go/sample/configs"
application "github.com/larksuite/oapi-sdk-go/service/application/v1"
)

func main() {
// for redis store and logrus
// var conf = configs.TestConfigWithLogrusAndRedisStore(constants.DomainFeiShu)
// var conf = configs.TestConfig("https://open.feishu.cn")
var conf = configs.TestConfig(constants.DomainFeiShu)

// for redis store and logrus
// var conf = configs.TestConfigWithLogrusAndRedisStore(constants.DomainFeiShu)
// var conf = configs.TestConfig("https://open.feishu.cn")
var conf = configs.TestConfig(constants.DomainFeiShu)
func main() {

application.SetAppOpenEventHandler(conf, func(ctx *core.Context, appOpenEvent *application.AppOpenEvent) error {
fmt.Println(ctx.GetRequestID())
Expand Down Expand Up @@ -49,22 +49,15 @@ func main() {
return nil
})

application.SetAppUninstalledEventHandler(conf, func(ctx *core.Context, appUninstalledEvent *application.AppUninstalledEvent) error {
fmt.Println(ctx.GetRequestID())
fmt.Println(tools.Prettify(appUninstalledEvent))
return nil
})

application.SetOrderPaidEventHandler(conf, func(ctx *core.Context, orderPaidEvent *application.OrderPaidEvent) error {
fmt.Println(ctx.GetRequestID())
fmt.Println(tools.Prettify(orderPaidEvent))
return nil
})

g := gin.Default()
eventginserver.Register("/webhook/event", conf, g)

g.POST("/webhook/event", webhookEventHandle)
err := g.Run(":8089")
if err != nil {
panic(err)
}
}

func webhookEventHandle(context *gin.Context) {
eventhttp.Handle(conf, context.Request, context.Writer)
}
63 changes: 0 additions & 63 deletions sample/event/gin2.go

This file was deleted.

0 comments on commit 9cdc673

Please sign in to comment.