From 429ad775a7b684fca1712f1154028507c510c6f6 Mon Sep 17 00:00:00 2001 From: "daiyuquan.greenty" Date: Mon, 12 Oct 2020 10:56:24 +0800 Subject: [PATCH 1/2] protocol.ConfigForm add new field EnableForward Change-Id: I9e345cf4f0d19f103baa922ea1e947c59d82ed27 --- SDK/auth/authorization_test.go | 1 + SDK/message/card_builder_test.go | 8 ++++++++ SDK/message/message_test.go | 5 ++++- SDK/protocol/card_element.go | 1 + .../bot_receive_and_response.go | 2 ++ demo/send_card/send_card.go | 1 + docs/us/send_card.md | 8 +++++--- docs/us/webhook_card.md | 14 ++++++++------ docs/zh/send_card.md | 15 +++++++++------ docs/zh/webhook_card.md | 14 ++++++++------ 10 files changed, 47 insertions(+), 22 deletions(-) diff --git a/SDK/auth/authorization_test.go b/SDK/auth/authorization_test.go index ebb4e25..bbc4816 100644 --- a/SDK/auth/authorization_test.go +++ b/SDK/auth/authorization_test.go @@ -249,6 +249,7 @@ func TestAutoDisableTenantToken(t *testing.T) { config := protocol.ConfigForm{ MinVersion: protocol.VersionForm{}, WideScreenMode: true, + EnableForward: false, } builder.SetConfig(config) diff --git a/SDK/message/card_builder_test.go b/SDK/message/card_builder_test.go index 9108458..9c4c3d8 100644 --- a/SDK/message/card_builder_test.go +++ b/SDK/message/card_builder_test.go @@ -31,6 +31,7 @@ func TestCardAsyncButton(t *testing.T) { config := protocol.ConfigForm{ MinVersion: protocol.VersionForm{}, WideScreenMode: true, + EnableForward: false, } builder.SetConfig(config) //add block @@ -81,6 +82,7 @@ func TestCardSyncButton(t *testing.T) { config := protocol.ConfigForm{ MinVersion: protocol.VersionForm{}, WideScreenMode: true, + EnableForward: false, } builder.SetConfig(config) @@ -132,6 +134,7 @@ func TestCardJumpButton(t *testing.T) { config := protocol.ConfigForm{ MinVersion: protocol.VersionForm{}, WideScreenMode: true, + EnableForward: false, } builder.SetConfig(config) //add block @@ -172,6 +175,7 @@ func TestCardImage(t *testing.T) { config := protocol.ConfigForm{ MinVersion: protocol.VersionForm{}, WideScreenMode: true, + EnableForward: false, } builder.SetConfig(config) //add block @@ -215,6 +219,7 @@ func TestCardSelectStaticMenu(t *testing.T) { config := protocol.ConfigForm{ MinVersion: protocol.VersionForm{}, WideScreenMode: true, + EnableForward: false, } builder.SetConfig(config) //add block @@ -265,6 +270,7 @@ func TestCardSelectPersonMenu(t *testing.T) { config := protocol.ConfigForm{ MinVersion: protocol.VersionForm{}, WideScreenMode: true, + EnableForward: false, } builder.SetConfig(config) //add block @@ -308,6 +314,7 @@ func TestCardOverFlowMenu(t *testing.T) { config := protocol.ConfigForm{ MinVersion: protocol.VersionForm{}, WideScreenMode: true, + EnableForward: false, } builder.SetConfig(config) //add block @@ -356,6 +363,7 @@ func TestCardDatePicker(t *testing.T) { config := protocol.ConfigForm{ MinVersion: protocol.VersionForm{}, WideScreenMode: true, + EnableForward: false, } builder.SetConfig(config) //add block diff --git a/SDK/message/message_test.go b/SDK/message/message_test.go index a05a67e..e8c1919 100644 --- a/SDK/message/message_test.go +++ b/SDK/message/message_test.go @@ -152,6 +152,7 @@ func TestSendCardMessage(t *testing.T) { config := protocol.ConfigForm{ MinVersion: protocol.VersionForm{}, WideScreenMode: true, + EnableForward: false, } builder.SetConfig(config) @@ -356,9 +357,11 @@ func TestBatchSendCardMessage(t *testing.T) { url := "https://www.google.com" content := "card message test" card := protocol.CardForm{ - Config: &protocol.ConfigForm{MinVersion: protocol.VersionForm{Version: "1.0"}, + Config: &protocol.ConfigForm{ + MinVersion: protocol.VersionForm{Version: "1.0"}, Debug: true, WideScreenMode: true, + EnableForward: false, }, CardLink: &protocol.URLForm{ Url: &url, diff --git a/SDK/protocol/card_element.go b/SDK/protocol/card_element.go index 2ecdee8..a8d37fc 100644 --- a/SDK/protocol/card_element.go +++ b/SDK/protocol/card_element.go @@ -341,6 +341,7 @@ type ConfigForm struct { MinVersion VersionForm `json:"min_version,omitempty" validate:"omitempty"` Debug bool `json:"debug,omitempty" validate:"omitempty"` WideScreenMode bool `json:"wide_screen_mode,omitempty" validate:"omitempty"` + EnableForward bool `json:"enable_forward,omitempty" validate:"omitempty"` } type VersionForm struct { diff --git a/demo/bot_receive_and_response/bot_receive_and_response.go b/demo/bot_receive_and_response/bot_receive_and_response.go index 865a059..78aa6de 100644 --- a/demo/bot_receive_and_response/bot_receive_and_response.go +++ b/demo/bot_receive_and_response/bot_receive_and_response.go @@ -142,6 +142,7 @@ func BotRecvMsgCard(ctx context.Context, msg *protocol.BotRecvMsg) error { config := protocol.ConfigForm{ MinVersion: protocol.VersionForm{}, WideScreenMode: true, + EnableForward: false, } builder.SetConfig(config) @@ -192,6 +193,7 @@ func ActionClickButton(ctx context.Context, callback *protocol.CardCallbackForm) config := protocol.ConfigForm{ MinVersion: protocol.VersionForm{}, WideScreenMode: true, + EnableForward: false, } builder.SetConfig(config) diff --git a/demo/send_card/send_card.go b/demo/send_card/send_card.go index c3102da..9cd7506 100644 --- a/demo/send_card/send_card.go +++ b/demo/send_card/send_card.go @@ -54,6 +54,7 @@ func sendCard(chatID, tenantKey, appID string) error { config := protocol.ConfigForm{ MinVersion: protocol.VersionForm{}, WideScreenMode: true, + EnableForward: false, } builder.SetConfig(config) diff --git a/docs/us/send_card.md b/docs/us/send_card.md index 35c33b9..0b88d31 100644 --- a/docs/us/send_card.md +++ b/docs/us/send_card.md @@ -21,6 +21,7 @@ builder := &message.CardBuilder{} config := protocol.ConfigForm{ MinVersion: protocol.VersionForm{}, WideScreenMode: true, + EnableForward: false, } builder.SetConfig(config) ``` @@ -250,9 +251,10 @@ func UpdateCard(token, tenantkey, appid string, openid []string) error { builder := &message.CardBuilder{} //add config config := protocol.ConfigForm{ - MinVersion: protocol.VersionForm{}, - WideScreenMode: true, - } + MinVersion: protocol.VersionForm{}, + WideScreenMode: true, + EnableForward: false, +} builder.SetConfig(config) //add header diff --git a/docs/us/webhook_card.md b/docs/us/webhook_card.md index 878e17d..7e69cec 100644 --- a/docs/us/webhook_card.md +++ b/docs/us/webhook_card.md @@ -75,9 +75,10 @@ func BotRecvMsgCard(ctx context.Context, msg *protocol.BotRecvMsg) error { builder := &message.CardBuilder{} //add config config := protocol.ConfigForm{ - MinVersion: protocol.VersionForm{}, - WideScreenMode: true, - } + MinVersion: protocol.VersionForm{}, + WideScreenMode: true, + EnableForward: false, +} builder.SetConfig(config) //add header @@ -131,9 +132,10 @@ func ActionClickButton(ctx context.Context, callback *protocol.CardCallbackForm) //add config config := protocol.ConfigForm{ - MinVersion: protocol.VersionForm{}, - WideScreenMode: true, - } + MinVersion: protocol.VersionForm{}, + WideScreenMode: true, + EnableForward: false, +} builder.SetConfig(config) //add header diff --git a/docs/zh/send_card.md b/docs/zh/send_card.md index a2c3d2f..b8bb57b 100644 --- a/docs/zh/send_card.md +++ b/docs/zh/send_card.md @@ -17,9 +17,11 @@ builder := &message.CardBuilder{} 2. 添加和配置 config ```go //add config -config := protocol.ConfigForm{ - MinVersion: protocol.VersionForm{}, - WideScreenMode: true, +type ConfigForm struct { + MinVersion VersionForm `json:"min_version,omitempty" validate:"omitempty"` + Debug bool `json:"debug,omitempty" validate:"omitempty"` + WideScreenMode bool `json:"wide_screen_mode,omitempty" validate:"omitempty"` + EnableForward bool `json:"enable_forward,omitempty" validate:"omitempty"` } builder.SetConfig(config) ``` @@ -236,9 +238,10 @@ func UpdateCard(token, tenantkey, appid string, openid []string) error { builder := &message.CardBuilder{} //add config config := protocol.ConfigForm{ - MinVersion: protocol.VersionForm{}, - WideScreenMode: true, - } + MinVersion: protocol.VersionForm{}, + WideScreenMode: true, + EnableForward: false, +} builder.SetConfig(config) //add header diff --git a/docs/zh/webhook_card.md b/docs/zh/webhook_card.md index 38bb090..7c60f9b 100644 --- a/docs/zh/webhook_card.md +++ b/docs/zh/webhook_card.md @@ -86,9 +86,10 @@ func BotRecvMsgCard(ctx context.Context, msg *protocol.BotRecvMsg) error { builder := &message.CardBuilder{} //add config config := protocol.ConfigForm{ - MinVersion: protocol.VersionForm{}, - WideScreenMode: true, - } + MinVersion: protocol.VersionForm{}, + WideScreenMode: true, + EnableForward: false, +} builder.SetConfig(config) //add header @@ -144,9 +145,10 @@ func ActionClickButton(ctx context.Context, callback *protocol.CardCallbackForm) //add config config := protocol.ConfigForm{ - MinVersion: protocol.VersionForm{}, - WideScreenMode: true, - } + MinVersion: protocol.VersionForm{}, + WideScreenMode: true, + EnableForward: false, +} builder.SetConfig(config) //add header From 7a38fcbf5f89914c331baab1be6847bda70902ba Mon Sep 17 00:00:00 2001 From: "daiyuquan.greenty" Date: Mon, 12 Oct 2020 11:06:23 +0800 Subject: [PATCH 2/2] protocol.ConfigForm add new field EnableForward Change-Id: I80e30ece7f6c91302c1a8061c40eb3f24b6cd0aa --- docs/us/send_card.md | 8 ++++---- docs/us/webhook_card.md | 16 ++++++++-------- docs/zh/send_card.md | 8 ++++---- docs/zh/webhook_card.md | 16 ++++++++-------- 4 files changed, 24 insertions(+), 24 deletions(-) diff --git a/docs/us/send_card.md b/docs/us/send_card.md index 0b88d31..56296cc 100644 --- a/docs/us/send_card.md +++ b/docs/us/send_card.md @@ -251,10 +251,10 @@ func UpdateCard(token, tenantkey, appid string, openid []string) error { builder := &message.CardBuilder{} //add config config := protocol.ConfigForm{ - MinVersion: protocol.VersionForm{}, - WideScreenMode: true, - EnableForward: false, -} + MinVersion: protocol.VersionForm{}, + WideScreenMode: true, + EnableForward: false, + } builder.SetConfig(config) //add header diff --git a/docs/us/webhook_card.md b/docs/us/webhook_card.md index 7e69cec..7d679a5 100644 --- a/docs/us/webhook_card.md +++ b/docs/us/webhook_card.md @@ -75,10 +75,10 @@ func BotRecvMsgCard(ctx context.Context, msg *protocol.BotRecvMsg) error { builder := &message.CardBuilder{} //add config config := protocol.ConfigForm{ - MinVersion: protocol.VersionForm{}, - WideScreenMode: true, - EnableForward: false, -} + MinVersion: protocol.VersionForm{}, + WideScreenMode: true, + EnableForward: false, + } builder.SetConfig(config) //add header @@ -132,10 +132,10 @@ func ActionClickButton(ctx context.Context, callback *protocol.CardCallbackForm) //add config config := protocol.ConfigForm{ - MinVersion: protocol.VersionForm{}, - WideScreenMode: true, - EnableForward: false, -} + MinVersion: protocol.VersionForm{}, + WideScreenMode: true, + EnableForward: false, + } builder.SetConfig(config) //add header diff --git a/docs/zh/send_card.md b/docs/zh/send_card.md index b8bb57b..b85da64 100644 --- a/docs/zh/send_card.md +++ b/docs/zh/send_card.md @@ -238,10 +238,10 @@ func UpdateCard(token, tenantkey, appid string, openid []string) error { builder := &message.CardBuilder{} //add config config := protocol.ConfigForm{ - MinVersion: protocol.VersionForm{}, - WideScreenMode: true, - EnableForward: false, -} + MinVersion: protocol.VersionForm{}, + WideScreenMode: true, + EnableForward: false, + } builder.SetConfig(config) //add header diff --git a/docs/zh/webhook_card.md b/docs/zh/webhook_card.md index 7c60f9b..e4b7d12 100644 --- a/docs/zh/webhook_card.md +++ b/docs/zh/webhook_card.md @@ -86,10 +86,10 @@ func BotRecvMsgCard(ctx context.Context, msg *protocol.BotRecvMsg) error { builder := &message.CardBuilder{} //add config config := protocol.ConfigForm{ - MinVersion: protocol.VersionForm{}, - WideScreenMode: true, - EnableForward: false, -} + MinVersion: protocol.VersionForm{}, + WideScreenMode: true, + EnableForward: false, + } builder.SetConfig(config) //add header @@ -145,10 +145,10 @@ func ActionClickButton(ctx context.Context, callback *protocol.CardCallbackForm) //add config config := protocol.ConfigForm{ - MinVersion: protocol.VersionForm{}, - WideScreenMode: true, - EnableForward: false, -} + MinVersion: protocol.VersionForm{}, + WideScreenMode: true, + EnableForward: false, + } builder.SetConfig(config) //add header