1
0
mirror of synced 2024-11-22 04:56:06 +03:00

add name field to channel

This commit is contained in:
Alex Lushpai 2018-09-10 11:33:42 +03:00
parent f6a7652f40
commit 0789e72134
4 changed files with 13 additions and 9 deletions

View File

@ -28,6 +28,7 @@ func main() {
var client = v1.New("https://token.url", "cb8ccf05e38a47543ad8477d49bcba99be73bff503ea6")
ch := Channel{
Type: "telegram",
Name: "Telegram"
Settings: ChannelSettings{
SpamAllowed: false,
Status: Status{

View File

@ -26,6 +26,7 @@ func New(url string, token string) *MgClient {
//
// request := ActivateRequest{
// Type: "telegram",
// Name: "Telegram",
// Settings: ChannelSettings{
// SpamAllowed: false,
// Status: Status{
@ -77,6 +78,7 @@ func (c *MgClient) ActivateTransportChannel(request Channel) (ActivateResponse,
// request := ActivateRequest{
// ID: 3053450384,
// Type: "telegram",
// Name: "Telegram",
// Settings: ChannelSettings{
// SpamAllowed: false,
// Status: Status{

View File

@ -24,6 +24,7 @@ func TestMgClient_ActivateTransportChannel(t *testing.T) {
ch := Channel{
ID: channelId,
Type: "telegram",
Name: "Telegram",
Settings: ChannelSettings{
SpamAllowed: false,
Status: Status{
@ -52,6 +53,7 @@ func TestMgClient_ActivateNewTransportChannel(t *testing.T) {
c := client()
ch := Channel{
Type: "telegram",
Name: "Telegram",
Settings: ChannelSettings{
SpamAllowed: false,
Status: Status{
@ -92,6 +94,7 @@ func TestMgClient_UpdateTransportChannel(t *testing.T) {
c := client()
ch := Channel{
ID: channelId,
Name: "Somename",
Settings: ChannelSettings{
SpamAllowed: false,
Status: Status{
@ -121,14 +124,11 @@ func TestMgClient_Messages(t *testing.T) {
t.Logf("%v", ext)
snd := SendData{
Message: SendMessage{
Message{
Message: Message{
ExternalID: ext,
Type: "text",
Text: "hello!",
},
time.Now(),
},
User: User{
ExternalID: "6",
Nickname: "octopus",

View File

@ -24,6 +24,7 @@ type MgClient struct {
type Channel struct {
ID uint64 `json:"id,omitempty"`
Type string `json:"type,omitempty"`
Name string `json:"name,omitempty"`
Settings ChannelSettings `json:"settings,omitempty,brackets"`
}
@ -101,7 +102,7 @@ type UpdateMessage struct {
// SendData struct
type SendData struct {
Message SendMessage `json:"message"`
Message Message `json:"message"`
User User `json:"user"`
Channel uint64 `json:"channel"`
ExternalChatID string `json:"external_chat_id"`