Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/houseme/bytedance
Byte Mini Program,Douyin Mini Program bytedance microapp sdk
https://github.com/houseme/bytedance
bytedance bytedance-microapp douyin douyin-microapp microapp microapp-sdk
Last synced: 24 days ago
JSON representation
Byte Mini Program,Douyin Mini Program bytedance microapp sdk
- Host: GitHub
- URL: https://github.com/houseme/bytedance
- Owner: houseme
- License: apache-2.0
- Created: 2023-07-31T07:32:45.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-02-19T10:13:26.000Z (9 months ago)
- Last Synced: 2024-02-19T11:33:55.476Z (9 months ago)
- Topics: bytedance, bytedance-microapp, douyin, douyin-microapp, microapp, microapp-sdk
- Language: Go
- Homepage: https://houseme.github.io/bytedance/
- Size: 160 KB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# Bytedance Open Platform SDK
[![Go Report Card](https://goreportcard.com/badge/github.com/houseme/bytedance)](https://goreportcard.com/report/github.com/houseme/bytedance)
[![Go Reference](https://pkg.go.dev/badge/github.com/houseme/bytedance.svg)](https://pkg.go.dev/github.com/houseme/bytedance)
[![Bytedance CI](https://github.com/houseme/bytedance/actions/workflows/go.yml/badge.svg)](https://github.com/houseme/bytedance/actions/workflows/go.yml)
[![License](https://img.shields.io/github/license/houseme/bytedance.svg?style=flat)](https://github.com/houseme/bytedance)
![GitHub go.mod Go version (branch)](https://img.shields.io/github/go-mod/go-version/houseme/bytedance/main)Bytedance Mini Program Douyin Mini Program bytedance microapp SDK
### Installation
Enter your repo. directory and execute following command:
```bash
go get -u -v github.com/houseme/bytedance@main
```### Limitation
```
golang version >= 1.20
```### Usage
```go
package mainimport (
"context"
"fmt"
"github.com/houseme/bytedance"
"github.com/houseme/bytedance/config"
"github.com/houseme/bytedance/credential"
"github.com/houseme/bytedance/utility/cache"
"github.com/houseme/bytedance/utility/logger"
"github.com/houseme/bytedance/utility/request"
)func main() {
var ctx = context.Background()
wc := bytedance.New(ctx)
cfg := config.New(
ctx,
config.WithClientKey(""),
config.WithClientSecret(""),
config.WithRedirectURL(""),
config.WithLogger(logger.NewDefaultLogger()),
config.WithRequest(request.NewDefaultRequest()),
config.WithCache(cache.NewRedis(ctx, cache.NewDefaultRedisOpts())),
config.WithScopes(""),
config.WithSalt(""),
)
// 获取小程序实例
miniProgram, err := wc.MiniProgram(ctx, cfg)
if err != nil {
panic(err)
}
auth := miniProgram.GetAuthorize()
// 获取用户授权
var accessToken credential.AccessToken
if accessToken, err = auth.GetAccessToken(ctx, "code"); err != nil {
panic(err)
}
fmt.Println(accessToken)
// 创建二维码
qrcode := miniProgram.GetQrcode()
// 获取小程序码
schema := miniProgram.GetSchema()
// 获取链接
link := miniProgram.GetLink()}
```
### License
`Bytedance` is licensed under the [Apache License Version 2.0](LICENSE), 100% free and open-source, forever.