(kind string, surface string, threadID string, directID string)
| 1998 | } |
| 1999 | |
| 2000 | func validateNetworkSendConversationFlags(kind string, surface string, threadID string, directID string) error { |
| 2001 | if threadID != "" && directID != "" { |
| 2002 | return errors.New("cli: --thread and --direct cannot be used together") |
| 2003 | } |
| 2004 | if surface == "" { |
| 2005 | if threadID != "" || directID != "" { |
| 2006 | return errors.New("cli: --surface is required when --thread or --direct is set") |
| 2007 | } |
| 2008 | if networkKindRequiresConversation(kind) { |
| 2009 | return fmt.Errorf("cli: --surface is required for --kind %s", kind) |
| 2010 | } |
| 2011 | } else { |
| 2012 | switch surface { |
| 2013 | case networkSurfaceThread: |
| 2014 | if threadID == "" { |
| 2015 | return errors.New("cli: --thread is required when --surface thread is set") |
| 2016 | } |
| 2017 | if directID != "" { |
| 2018 | return errors.New("cli: --direct cannot be used when --surface thread is set") |
| 2019 | } |
| 2020 | case networkSurfaceDirect: |
| 2021 | if directID == "" { |
| 2022 | return errors.New("cli: --direct is required when --surface direct is set") |
| 2023 | } |
| 2024 | if threadID != "" { |
| 2025 | return errors.New("cli: --thread cannot be used when --surface direct is set") |
| 2026 | } |
| 2027 | default: |
| 2028 | return errors.New("cli: --surface must be thread or direct") |
| 2029 | } |
| 2030 | } |
| 2031 | return nil |
| 2032 | } |
| 2033 | |
| 2034 | func validateNetworkSendKindScope(kind string, surface string, threadID string, directID string, workID string) error { |
| 2035 | if networkKindForbidsConversation(kind) && (surface != "" || threadID != "" || directID != "" || workID != "") { |
no test coverage detected