( scopeRaw string, workspaceID string, platform string, extensionName string, displayName string, enabled bool, includePeer bool, includeThread bool, includeGroup bool, notificationSuppress bool, providerConfig string, deliveryDefaults string, )
| 208 | } |
| 209 | |
| 210 | func buildBridgeCreatePayload( |
| 211 | scopeRaw string, |
| 212 | workspaceID string, |
| 213 | platform string, |
| 214 | extensionName string, |
| 215 | displayName string, |
| 216 | enabled bool, |
| 217 | includePeer bool, |
| 218 | includeThread bool, |
| 219 | includeGroup bool, |
| 220 | notificationSuppress bool, |
| 221 | providerConfig string, |
| 222 | deliveryDefaults string, |
| 223 | ) (CreateBridgeRequest, error) { |
| 224 | scope, err := parseBridgeScope(scopeRaw) |
| 225 | if err != nil { |
| 226 | return CreateBridgeRequest{}, err |
| 227 | } |
| 228 | if scope == bridgepkg.ScopeWorkspace && strings.TrimSpace(workspaceID) == "" { |
| 229 | return CreateBridgeRequest{}, errors.New( |
| 230 | "cli: --workspace-id is required when --scope=workspace", |
| 231 | ) |
| 232 | } |
| 233 | |
| 234 | payload := CreateBridgeRequest{ |
| 235 | Scope: scope, |
| 236 | WorkspaceID: strings.TrimSpace(workspaceID), |
| 237 | Platform: strings.TrimSpace(platform), |
| 238 | ExtensionName: strings.TrimSpace(extensionName), |
| 239 | DisplayName: strings.TrimSpace(displayName), |
| 240 | Enabled: enabled, |
| 241 | RoutingPolicy: bridgepkg.RoutingPolicy{ |
| 242 | IncludePeer: includePeer, |
| 243 | IncludeThread: includeThread, |
| 244 | IncludeGroup: includeGroup, |
| 245 | }, |
| 246 | NotificationSuppress: notificationSuppress, |
| 247 | } |
| 248 | |
| 249 | providerRaw, err := parseOptionalBridgeJSONWithLabel(providerConfig, "provider config") |
| 250 | if err != nil { |
| 251 | return CreateBridgeRequest{}, err |
| 252 | } |
| 253 | if providerRaw != nil { |
| 254 | payload.ProviderConfig = contract.BridgeProviderConfigPayload(*providerRaw) |
| 255 | } |
| 256 | raw, err := parseOptionalBridgeJSON(deliveryDefaults) |
| 257 | if err != nil { |
| 258 | return CreateBridgeRequest{}, err |
| 259 | } |
| 260 | if raw != nil { |
| 261 | payload.DeliveryDefaults = contract.BridgeDeliveryDefaultsPayload(*raw) |
| 262 | } |
| 263 | if err := validateBridgeCreatePayload(payload); err != nil { |
| 264 | return CreateBridgeRequest{}, err |
| 265 | } |
| 266 | return payload, nil |
| 267 | } |
no test coverage detected