Skip to main content

setDataToPanel

Introduction

The setDataToPanel methods allow you to override the data source URL of any configured panel at runtime. This is primarily intended for debugging and testing purposes.

Methods

setDataToPanel(_:)

Applies a single structured override to a panel.

nonisolated func setDataToPanel(_ override: MaestroPanelOverride) async -> Result<Void, MaestroPanelOverrideError>

Parameters

ParameterTypeDescription
overrideMaestroPanelOverrideThe structured override to apply.

Return Value

A Result<Void, MaestroPanelOverrideError> indicating success or the specific error encountered.


setDataToPanels(_:)

Applies multiple structured overrides in a single call.

nonisolated func setDataToPanels(_ overrides: [MaestroPanelOverride]) async -> [Result<Void, MaestroPanelOverrideError>]

Parameters

ParameterTypeDescription
overrides[MaestroPanelOverride]An array of overrides to apply.

Return Value

An array of Result<Void, MaestroPanelOverrideError>, one per override in the same order.


setDataToPanel(panelName:interfaceName:overwriteUrl:)

A backward-compatible convenience method using string parameters.

nonisolated func setDataToPanel(panelName: String, interfaceName: String, overwriteUrl: String) async -> String

Parameters

ParameterTypeDescription
panelNameStringThe panel identifier (rawValue or display name).
interfaceNameStringThe interface to override (e.g., "overrideUrl").
overwriteUrlStringThe URL to use as the data source.

Return Value

A String"Success" or a description of the error.


Types

MaestroPanelOverride

A structured override describing how to replace the data source of a panel.

public struct MaestroPanelOverride: Sendable {
public var panelIdentifier: String
public var interfaceName: String
public var url: String

public init(panelIdentifier: String, interfaceName: String, url: String)
}
PropertyTypeDescription
panelIdentifierStringThe panel to target. Accepts the canonical rawValue or the display name.
interfaceNameStringThe sub-interface to override (currently "overrideUrl" is supported).
urlStringThe URL to use as the override data source.

MaestroPanelOverrideError

Errors returned when applying a panel override.

public enum MaestroPanelOverrideError: Error, Sendable {
case noActiveEvent
case unsupportedPanelIdentifier(String)
case panelNotConfigured(MaestroPanelType)
case emptyURL
case unknown
case interfaceUnsupported(String)
}
CaseDescription
noActiveEventNo event is currently active.
unsupportedPanelIdentifierThe provided panel identifier is not recognized.
panelNotConfiguredThe panel is not configured for the current event.
emptyURLThe provided URL is empty.
interfaceUnsupportedThe provided interface name is not supported.
unknownAn unknown error occurred.

Code Example

// Override the Stats panel data source
let override = MaestroPanelOverride(
panelIdentifier: "stats",
interfaceName: "overrideUrl",
url: "https://api.npoint.io/your-json-slug"
)

let result = await MaestroManager.shared.setDataToPanel(override)
switch result {
case .success:
print("Stats endpoint overridden successfully")
case .failure(let error):
print("Failed to override: \(error.description)")
}

Notes

  • An active event must be open before applying overrides.
  • The target panel must be configured for the current event.
  • Currently only the "overrideUrl" interface is supported.