add name field to channel
This commit is contained in:
parent
f6a7652f40
commit
0789e72134
@ -28,6 +28,7 @@ func main() {
|
|||||||
var client = v1.New("https://token.url", "cb8ccf05e38a47543ad8477d49bcba99be73bff503ea6")
|
var client = v1.New("https://token.url", "cb8ccf05e38a47543ad8477d49bcba99be73bff503ea6")
|
||||||
ch := Channel{
|
ch := Channel{
|
||||||
Type: "telegram",
|
Type: "telegram",
|
||||||
|
Name: "Telegram"
|
||||||
Settings: ChannelSettings{
|
Settings: ChannelSettings{
|
||||||
SpamAllowed: false,
|
SpamAllowed: false,
|
||||||
Status: Status{
|
Status: Status{
|
||||||
|
@ -26,6 +26,7 @@ func New(url string, token string) *MgClient {
|
|||||||
//
|
//
|
||||||
// request := ActivateRequest{
|
// request := ActivateRequest{
|
||||||
// Type: "telegram",
|
// Type: "telegram",
|
||||||
|
// Name: "Telegram",
|
||||||
// Settings: ChannelSettings{
|
// Settings: ChannelSettings{
|
||||||
// SpamAllowed: false,
|
// SpamAllowed: false,
|
||||||
// Status: Status{
|
// Status: Status{
|
||||||
@ -77,6 +78,7 @@ func (c *MgClient) ActivateTransportChannel(request Channel) (ActivateResponse,
|
|||||||
// request := ActivateRequest{
|
// request := ActivateRequest{
|
||||||
// ID: 3053450384,
|
// ID: 3053450384,
|
||||||
// Type: "telegram",
|
// Type: "telegram",
|
||||||
|
// Name: "Telegram",
|
||||||
// Settings: ChannelSettings{
|
// Settings: ChannelSettings{
|
||||||
// SpamAllowed: false,
|
// SpamAllowed: false,
|
||||||
// Status: Status{
|
// Status: Status{
|
||||||
|
@ -24,6 +24,7 @@ func TestMgClient_ActivateTransportChannel(t *testing.T) {
|
|||||||
ch := Channel{
|
ch := Channel{
|
||||||
ID: channelId,
|
ID: channelId,
|
||||||
Type: "telegram",
|
Type: "telegram",
|
||||||
|
Name: "Telegram",
|
||||||
Settings: ChannelSettings{
|
Settings: ChannelSettings{
|
||||||
SpamAllowed: false,
|
SpamAllowed: false,
|
||||||
Status: Status{
|
Status: Status{
|
||||||
@ -52,6 +53,7 @@ func TestMgClient_ActivateNewTransportChannel(t *testing.T) {
|
|||||||
c := client()
|
c := client()
|
||||||
ch := Channel{
|
ch := Channel{
|
||||||
Type: "telegram",
|
Type: "telegram",
|
||||||
|
Name: "Telegram",
|
||||||
Settings: ChannelSettings{
|
Settings: ChannelSettings{
|
||||||
SpamAllowed: false,
|
SpamAllowed: false,
|
||||||
Status: Status{
|
Status: Status{
|
||||||
@ -92,6 +94,7 @@ func TestMgClient_UpdateTransportChannel(t *testing.T) {
|
|||||||
c := client()
|
c := client()
|
||||||
ch := Channel{
|
ch := Channel{
|
||||||
ID: channelId,
|
ID: channelId,
|
||||||
|
Name: "Somename",
|
||||||
Settings: ChannelSettings{
|
Settings: ChannelSettings{
|
||||||
SpamAllowed: false,
|
SpamAllowed: false,
|
||||||
Status: Status{
|
Status: Status{
|
||||||
@ -121,14 +124,11 @@ func TestMgClient_Messages(t *testing.T) {
|
|||||||
t.Logf("%v", ext)
|
t.Logf("%v", ext)
|
||||||
|
|
||||||
snd := SendData{
|
snd := SendData{
|
||||||
Message: SendMessage{
|
Message: Message{
|
||||||
Message{
|
|
||||||
ExternalID: ext,
|
ExternalID: ext,
|
||||||
Type: "text",
|
Type: "text",
|
||||||
Text: "hello!",
|
Text: "hello!",
|
||||||
},
|
},
|
||||||
time.Now(),
|
|
||||||
},
|
|
||||||
User: User{
|
User: User{
|
||||||
ExternalID: "6",
|
ExternalID: "6",
|
||||||
Nickname: "octopus",
|
Nickname: "octopus",
|
||||||
|
@ -24,6 +24,7 @@ type MgClient struct {
|
|||||||
type Channel struct {
|
type Channel struct {
|
||||||
ID uint64 `json:"id,omitempty"`
|
ID uint64 `json:"id,omitempty"`
|
||||||
Type string `json:"type,omitempty"`
|
Type string `json:"type,omitempty"`
|
||||||
|
Name string `json:"name,omitempty"`
|
||||||
Settings ChannelSettings `json:"settings,omitempty,brackets"`
|
Settings ChannelSettings `json:"settings,omitempty,brackets"`
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -101,7 +102,7 @@ type UpdateMessage struct {
|
|||||||
|
|
||||||
// SendData struct
|
// SendData struct
|
||||||
type SendData struct {
|
type SendData struct {
|
||||||
Message SendMessage `json:"message"`
|
Message Message `json:"message"`
|
||||||
User User `json:"user"`
|
User User `json:"user"`
|
||||||
Channel uint64 `json:"channel"`
|
Channel uint64 `json:"channel"`
|
||||||
ExternalChatID string `json:"external_chat_id"`
|
ExternalChatID string `json:"external_chat_id"`
|
||||||
|
Loading…
Reference in New Issue
Block a user