Go client for MG transport API
5edb649366
Bumps [golang.org/x/net](https://github.com/golang/net) from 0.17.0 to 0.23.0. - [Commits](https://github.com/golang/net/compare/v0.17.0...v0.23.0) --- updated-dependencies: - dependency-name: golang.org/x/net dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> |
||
---|---|---|
.github/workflows | ||
examples | ||
v1 | ||
.gitignore | ||
.golangci.yml | ||
go.mod | ||
go.sum | ||
LICENSE | ||
README.md |
Message Gateway Transport API Go client
Install
go get -u -v github.com/retailcrm/mg-transport-api-client-go
Usage
package main
import (
"fmt"
"net/http"
"github.com/retailcrm/mg-transport-api-client-go/v1"
)
func main() {
var client = v1.New("https://token.url", "cb8ccf05e38a47543ad8477d49bcba99be73bff503ea6")
ch := Channel{
Type: "telegram",
Name: "@my_shopping_bot",
Settings: ChannelSettings{
Status: Status{
Delivered: ChannelFeatureNone,
Read: ChannelFeatureReceive,
},
Text: ChannelSettingsText{
Creating: ChannelFeatureBoth,
Editing: ChannelFeatureSend,
Quoting: ChannelFeatureReceive,
Deleting: ChannelFeatureBoth,
},
Product: Product{
Creating: ChannelFeatureSend,
Deleting: ChannelFeatureSend,
},
Order: Order{
Creating: ChannelFeatureBoth,
Deleting: ChannelFeatureSend,
},
},
}
data, status, err := c.ActivateTransportChannel(ch)
if err != nil {
t.Errorf("%d %v", status, err)
}
fmt.Printf("%v", data.ChannelID)
}