func (t *TimeseriesRequestStyle) HasLineType() bool {
	if t != nil && t.LineType != nil {
		return true
	}

	return false
}

func ( t * TimeseriesRequestStyle ) HasLineType ( ) bool { if t != nil && t . LineType != nil { return true } return false }

// HasLineType returns a boolean if a field has been set.

HasLineType returns a boolean if a field has been set .


func (t *TimeseriesRequestStyle) GetLineWidth() string {
	if t == nil || t.LineWidth == nil {
		return ""
	}
	return *t.LineWidth
}

func ( t * TimeseriesRequestStyle ) GetLineWidth ( ) string { if t == nil || t . LineWidth == nil { return " " } return * t . LineWidth }

// GetLineWidth returns the LineWidth field if non-nil, zero value otherwise.

GetLineWidth returns the LineWidth field if non - nil zero value otherwise .


func (t *TimeseriesRequestStyle) GetLineWidthOk() (string, bool) {
	if t == nil || t.LineWidth == nil {
		return "", false
	}
	return *t.LineWidth, true
}

func ( t * TimeseriesRequestStyle ) GetLineWidthOk ( ) ( string , bool ) { if t == nil || t . LineWidth == nil { return " " , false } return * t . LineWidth , true }

// GetLineWidthOk returns a tuple with the LineWidth field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.

GetLineWidthOk returns a tuple with the LineWidth field if it s non - nil zero value otherwise and a boolean to check if the value has been set .


func (t *TimeseriesRequestStyle) HasLineWidth() bool {
	if t != nil && t.LineWidth != nil {
		return true
	}

	return false
}

func ( t * TimeseriesRequestStyle ) HasLineWidth ( ) bool { if t != nil && t . LineWidth != nil { return true } return false }

// HasLineWidth returns a boolean if a field has been set.

HasLineWidth returns a boolean if a field has been set .


func (t *ToggleStatus) GetNewStatus() string {
	if t == nil || t.NewStatus == nil {
		return ""
	}
	return *t.NewStatus
}

func ( t * ToggleStatus ) GetNewStatus ( ) string { if t == nil || t . NewStatus == nil { return " " } return * t . NewStatus }

// GetNewStatus returns the NewStatus field if non-nil, zero value otherwise.

GetNewStatus returns the NewStatus field if non - nil zero value otherwise .


func (t *ToggleStatus) GetNewStatusOk() (string, bool) {
	if t == nil || t.NewStatus == nil {
		return "", false
	}
	return *t.NewStatus, true
}

func ( t * ToggleStatus ) GetNewStatusOk ( ) ( string , bool ) { if t == nil || t . NewStatus == nil { return " " , false } return * t . NewStatus , true }

// GetNewStatusOk returns a tuple with the NewStatus field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.

GetNewStatusOk returns a tuple with the NewStatus field if it s non - nil zero value otherwise and a boolean to check if the value has been set .


func (t *ToggleStatus) HasNewStatus() bool {
	if t != nil && t.NewStatus != nil {
		return true
	}

	return false
}

func ( t * ToggleStatus ) HasNewStatus ( ) bool { if t != nil && t . NewStatus != nil { return true } return false }

// HasNewStatus returns a boolean if a field has been set.

HasNewStatus returns a boolean if a field has been set .


func (t *TraceServiceDefinition) GetService() string {
	if t == nil || t.Service == nil {
		return ""
	}
	return *t.Service
}

func ( t * TraceServiceDefinition ) GetService ( ) string { if t == nil || t . Service == nil { return " " } return * t . Service }

// GetService returns the Service field if non-nil, zero value otherwise.

GetService returns the Service field if non - nil zero value otherwise .


func (t *TraceServiceDefinition) GetServiceOk() (string, bool) {
	if t == nil || t.Service == nil {
		return "", false
	}
	return *t.Service, true
}

func ( t * TraceServiceDefinition ) GetServiceOk ( ) ( string , bool ) { if t == nil || t . Service == nil { return " " , false } return * t . Service , true }

// GetServiceOk returns a tuple with the Service field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.

GetServiceOk returns a tuple with the Service field if it s non - nil zero value otherwise and a boolean to check if the value has been set .


func (t *TraceServiceDefinition) HasService() bool {
	if t != nil && t.Service != nil {
		return true
	}

	return false
}

func ( t * TraceServiceDefinition ) HasService ( ) bool { if t != nil && t . Service != nil { return true } return false }

// HasService returns a boolean if a field has been set.

HasService returns a boolean if a field has been set .


func (t *TraceServiceDefinition) GetShowBreakdown() bool {
	if t == nil || t.ShowBreakdown == nil {
		return false
	}
	return *t.ShowBreakdown
}

func ( t * TraceServiceDefinition ) GetShowBreakdown ( ) bool { if t == nil || t . ShowBreakdown == nil { return false } return * t . ShowBreakdown }

// GetShowBreakdown returns the ShowBreakdown field if non-nil, zero value otherwise.

GetShowBreakdown returns the ShowBreakdown field if non - nil zero value otherwise .


func (t *TraceServiceDefinition) GetShowBreakdownOk() (bool, bool) {
	if t == nil || t.ShowBreakdown == nil {
		return false, false
	}
	return *t.ShowBreakdown, true
}

func ( t * TraceServiceDefinition ) GetShowBreakdownOk ( ) ( bool , bool ) { if t == nil || t . ShowBreakdown == nil { return false , false } return * t . ShowBreakdown , true }

// GetShowBreakdownOk returns a tuple with the ShowBreakdown field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.

GetShowBreakdownOk returns a tuple with the ShowBreakdown field if it s non - nil zero value otherwise and a boolean to check if the value has been set .


func (t *TraceServiceDefinition) HasShowBreakdown() bool {
	if t != nil && t.ShowBreakdown != nil {
		return true
	}

	return false
}

func ( t * TraceServiceDefinition ) HasShowBreakdown ( ) bool { if t != nil && t . ShowBreakdown != nil { return true } return false }

// HasShowBreakdown returns a boolean if a field has been set.

HasShowBreakdown returns a boolean if a field has been set .


func (t *TraceServiceDefinition) GetShowDistribution() bool {
	if t == nil || t.ShowDistribution == nil {
		return false
	}
	return *t.ShowDistribution
}

func ( t * TraceServiceDefinition ) GetShowDistribution ( ) bool { if t == nil || t . ShowDistribution == nil { return false } return * t . ShowDistribution }

// GetShowDistribution returns the ShowDistribution field if non-nil, zero value otherwise.

GetShowDistribution returns the ShowDistribution field if non - nil zero value otherwise .


func (t *TraceServiceDefinition) GetShowDistributionOk() (bool, bool) {
	if t == nil || t.ShowDistribution == nil {
		return false, false
	}
	return *t.ShowDistribution, true
}

func ( t * TraceServiceDefinition ) GetShowDistributionOk ( ) ( bool , bool ) { if t == nil || t . ShowDistribution == nil { return false , false } return * t . ShowDistribution , true }

// GetShowDistributionOk returns a tuple with the ShowDistribution field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.

GetShowDistributionOk returns a tuple with the ShowDistribution field if it s non - nil zero value otherwise and a boolean to check if the value has been set .


func (t *TraceServiceDefinition) HasShowDistribution() bool {
	if t != nil && t.ShowDistribution != nil {
		return true
	}

	return false
}

func ( t * TraceServiceDefinition ) HasShowDistribution ( ) bool { if t != nil && t . ShowDistribution != nil { return true } return false }

// HasShowDistribution returns a boolean if a field has been set.

HasShowDistribution returns a boolean if a field has been set .


func (t *TraceServiceDefinition) GetShowErrors() bool {
	if t == nil || t.ShowErrors == nil {
		return false
	}
	return *t.ShowErrors
}

func ( t * TraceServiceDefinition ) GetShowErrors ( ) bool { if t == nil || t . ShowErrors == nil { return false } return * t . ShowErrors }

// GetShowErrors returns the ShowErrors field if non-nil, zero value otherwise.

GetShowErrors returns the ShowErrors field if non - nil zero value otherwise .


func (t *TraceServiceDefinition) GetShowErrorsOk() (bool, bool) {
	if t == nil || t.ShowErrors == nil {
		return false, false
	}
	return *t.ShowErrors, true
}

func ( t * TraceServiceDefinition ) GetShowErrorsOk ( ) ( bool , bool ) { if t == nil || t . ShowErrors == nil { return false , false } return * t . ShowErrors , true }

// GetShowErrorsOk returns a tuple with the ShowErrors field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.

GetShowErrorsOk returns a tuple with the ShowErrors field if it s non - nil zero value otherwise and a boolean to check if the value has been set .


func (t *TraceServiceDefinition) HasShowErrors() bool {
	if t != nil && t.ShowErrors != nil {
		return true
	}

	return false
}

func ( t * TraceServiceDefinition ) HasShowErrors ( ) bool { if t != nil && t . ShowErrors != nil { return true } return false }

// HasShowErrors returns a boolean if a field has been set.

HasShowErrors returns a boolean if a field has been set .


func (t *TraceServiceDefinition) GetShowHits() bool {
	if t == nil || t.ShowHits == nil {
		return false
	}
	return *t.ShowHits
}

func ( t * TraceServiceDefinition ) GetShowHits ( ) bool { if t == nil || t . ShowHits == nil { return false } return * t . ShowHits }

// GetShowHits returns the ShowHits field if non-nil, zero value otherwise.

GetShowHits returns the ShowHits field if non - nil zero value otherwise .


func (t *TraceServiceDefinition) GetShowHitsOk() (bool, bool) {
	if t == nil || t.ShowHits == nil {
		return false, false
	}
	return *t.ShowHits, true
}

func ( t * TraceServiceDefinition ) GetShowHitsOk ( ) ( bool , bool ) { if t == nil || t . ShowHits == nil { return false , false } return * t . ShowHits , true }

// GetShowHitsOk returns a tuple with the ShowHits field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.

GetShowHitsOk returns a tuple with the ShowHits field if it s non - nil zero value otherwise and a boolean to check if the value has been set .


func (t *TraceServiceDefinition) HasShowHits() bool {
	if t != nil && t.ShowHits != nil {
		return true
	}

	return false
}

func ( t * TraceServiceDefinition ) HasShowHits ( ) bool { if t != nil && t . ShowHits != nil { return true } return false }

// HasShowHits returns a boolean if a field has been set.

HasShowHits returns a boolean if a field has been set .


func (t *TraceServiceDefinition) GetShowLatency() bool {
	if t == nil || t.ShowLatency == nil {
		return false
	}
	return *t.ShowLatency
}

func ( t * TraceServiceDefinition ) GetShowLatency ( ) bool { if t == nil || t . ShowLatency == nil { return false } return * t . ShowLatency }

// GetShowLatency returns the ShowLatency field if non-nil, zero value otherwise.

GetShowLatency returns the ShowLatency field if non - nil zero value otherwise .


func (t *TraceServiceDefinition) GetShowLatencyOk() (bool, bool) {
	if t == nil || t.ShowLatency == nil {
		return false, false
	}
	return *t.ShowLatency, true
}

func ( t * TraceServiceDefinition ) GetShowLatencyOk ( ) ( bool , bool ) { if t == nil || t . ShowLatency == nil { return false , false } return * t . ShowLatency , true }

// GetShowLatencyOk returns a tuple with the ShowLatency field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.

GetShowLatencyOk returns a tuple with the ShowLatency field if it s non - nil zero value otherwise and a boolean to check if the value has been set .


func (t *TraceServiceDefinition) HasShowLatency() bool {
	if t != nil && t.ShowLatency != nil {
		return true
	}

	return false
}

func ( t * TraceServiceDefinition ) HasShowLatency ( ) bool { if t != nil && t . ShowLatency != nil { return true } return false }

// HasShowLatency returns a boolean if a field has been set.

HasShowLatency returns a boolean if a field has been set .


func (t *TraceServiceDefinition) GetShowResourceList() bool {
	if t == nil || t.ShowResourceList == nil {
		return false
	}
	return *t.ShowResourceList
}

func ( t * TraceServiceDefinition ) GetShowResourceList ( ) bool { if t == nil || t . ShowResourceList == nil { return false } return * t . ShowResourceList }

// GetShowResourceList returns the ShowResourceList field if non-nil, zero value otherwise.

GetShowResourceList returns the ShowResourceList field if non - nil zero value otherwise .


func (t *TraceServiceDefinition) GetShowResourceListOk() (bool, bool) {
	if t == nil || t.ShowResourceList == nil {
		return false, false
	}
	return *t.ShowResourceList, true
}

func ( t * TraceServiceDefinition ) GetShowResourceListOk ( ) ( bool , bool ) { if t == nil || t . ShowResourceList == nil { return false , false } return * t . ShowResourceList , true }

// GetShowResourceListOk returns a tuple with the ShowResourceList field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.

GetShowResourceListOk returns a tuple with the ShowResourceList field if it s non - nil zero value otherwise and a boolean to check if the value has been set .


func (t *TraceServiceDefinition) HasShowResourceList() bool {
	if t != nil && t.ShowResourceList != nil {
		return true
	}

	return false
}

func ( t * TraceServiceDefinition ) HasShowResourceList ( ) bool { if t != nil && t . ShowResourceList != nil { return true } return false }

// HasShowResourceList returns a boolean if a field has been set.

HasShowResourceList returns a boolean if a field has been set .


func (t *TraceServiceDefinition) GetSizeFormat() string {
	if t == nil || t.SizeFormat == nil {
		return ""
	}
	return *t.SizeFormat
}

func ( t * TraceServiceDefinition ) GetSizeFormat ( ) string { if t == nil || t . SizeFormat == nil { return " " } return * t . SizeFormat }

// GetSizeFormat returns the SizeFormat field if non-nil, zero value otherwise.

GetSizeFormat returns the SizeFormat field if non - nil zero value otherwise .


func (t *TraceServiceDefinition) GetSizeFormatOk() (string, bool) {
	if t == nil || t.SizeFormat == nil {
		return "", false
	}
	return *t.SizeFormat, true
}

func ( t * TraceServiceDefinition ) GetSizeFormatOk ( ) ( string , bool ) { if t == nil || t . SizeFormat == nil { return " " , false } return * t . SizeFormat , true }

// GetSizeFormatOk returns a tuple with the SizeFormat field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.

GetSizeFormatOk returns a tuple with the SizeFormat field if it s non - nil zero value otherwise and a boolean to check if the value has been set .


func (t *TraceServiceDefinition) HasSizeFormat() bool {
	if t != nil && t.SizeFormat != nil {
		return true
	}

	return false
}

func ( t * TraceServiceDefinition ) HasSizeFormat ( ) bool { if t != nil && t . SizeFormat != nil { return true } return false }

// HasSizeFormat returns a boolean if a field has been set.

HasSizeFormat returns a boolean if a field has been set .


func (t *TraceServiceDefinition) GetSpanName() string {
	if t == nil || t.SpanName == nil {
		return ""
	}
	return *t.SpanName
}

func ( t * TraceServiceDefinition ) GetSpanName ( ) string { if t == nil || t . SpanName == nil { return " " } return * t . SpanName }

// GetSpanName returns the SpanName field if non-nil, zero value otherwise.

GetSpanName returns the SpanName field if non - nil zero value otherwise .


func (t *TraceServiceDefinition) GetSpanNameOk() (string, bool) {
	if t == nil || t.SpanName == nil {
		return "", false
	}
	return *t.SpanName, true
}

func ( t * TraceServiceDefinition ) GetSpanNameOk ( ) ( string , bool ) { if t == nil || t . SpanName == nil { return " " , false } return * t . SpanName , true }

// GetSpanNameOk returns a tuple with the SpanName field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.

GetSpanNameOk returns a tuple with the SpanName field if it s non - nil zero value otherwise and a boolean to check if the value has been set .


func (t *TraceServiceDefinition) HasSpanName() bool {
	if t != nil && t.SpanName != nil {
		return true
	}

	return false
}

func ( t * TraceServiceDefinition ) HasSpanName ( ) bool { if t != nil && t . SpanName != nil { return true } return false }

// HasSpanName returns a boolean if a field has been set.

HasSpanName returns a boolean if a field has been set .


func (t *TriggeringValue) GetFromTs() int {
	if t == nil || t.FromTs == nil {
		return 0
	}
	return *t.FromTs
}

func ( t * TriggeringValue ) GetFromTs ( ) int { if t == nil || t . FromTs == nil { return 0 } return * t . FromTs }

// GetFromTs returns the FromTs field if non-nil, zero value otherwise.

GetFromTs returns the FromTs field if non - nil zero value otherwise .


func (t *TriggeringValue) GetFromTsOk() (int, bool) {
	if t == nil || t.FromTs == nil {
		return 0, false
	}
	return *t.FromTs, true
}

func ( t * TriggeringValue ) GetFromTsOk ( ) ( int , bool ) { if t == nil || t . FromTs == nil { return 0 , false } return * t . FromTs , true }

// GetFromTsOk returns a tuple with the FromTs field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.

GetFromTsOk returns a tuple with the FromTs field if it s non - nil zero value otherwise and a boolean to check if the value has been set .


func (t *TriggeringValue) HasFromTs() bool {
	if t != nil && t.FromTs != nil {
		return true
	}

	return false
}

func ( t * TriggeringValue ) HasFromTs ( ) bool { if t != nil && t . FromTs != nil { return true } return false }

// HasFromTs returns a boolean if a field has been set.

HasFromTs returns a boolean if a field has been set .


func (t *TriggeringValue) GetToTs() int {
	if t == nil || t.ToTs == nil {
		return 0
	}
	return *t.ToTs
}

func ( t * TriggeringValue ) GetToTs ( ) int { if t == nil || t . ToTs == nil { return 0 } return * t . ToTs }

// GetToTs returns the ToTs field if non-nil, zero value otherwise.

GetToTs returns the ToTs field if non - nil zero value otherwise .


func (t *TriggeringValue) GetToTsOk() (int, bool) {
	if t == nil || t.ToTs == nil {
		return 0, false
	}
	return *t.ToTs, true
}

func ( t * TriggeringValue ) GetToTsOk ( ) ( int , bool ) { if t == nil || t . ToTs == nil { return 0 , false } return * t . ToTs , true }

// GetToTsOk returns a tuple with the ToTs field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.

GetToTsOk returns a tuple with the ToTs field if it s non - nil zero value otherwise and a boolean to check if the value has been set .


func (t *TriggeringValue) HasToTs() bool {
	if t != nil && t.ToTs != nil {
		return true
	}

	return false
}

func ( t * TriggeringValue ) HasToTs ( ) bool { if t != nil && t . ToTs != nil { return true } return false }

// HasToTs returns a boolean if a field has been set.

HasToTs returns a boolean if a field has been set .


func (w *Widget) GetAlertID() int {
	if w == nil || w.AlertID == nil {
		return 0
	}
	return *w.AlertID
}

func ( w * Widget ) GetAlertID ( ) int { if w == nil || w . AlertID == nil { return 0 } return * w . AlertID }

// GetAlertID returns the AlertID field if non-nil, zero value otherwise.

GetAlertID returns the AlertID field if non - nil zero value otherwise .


func (w *Widget) GetAlertIDOk() (int, bool) {
	if w == nil || w.AlertID == nil {
		return 0, false
	}
	return *w.AlertID, true
}

func ( w * Widget ) GetAlertIDOk ( ) ( int , bool ) { if w == nil || w . AlertID == nil { return 0 , false } return * w . AlertID , true }

// GetAlertIDOk returns a tuple with the AlertID field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.

GetAlertIDOk returns a tuple with the AlertID field if it s non - nil zero value otherwise and a boolean to check if the value has been set .


func (w *Widget) HasAlertID() bool {
	if w != nil && w.AlertID != nil {
		return true
	}

	return false
}

func ( w * Widget ) HasAlertID ( ) bool { if w != nil && w . AlertID != nil { return true } return false }

// HasAlertID returns a boolean if a field has been set.

HasAlertID returns a boolean if a field has been set .


func (w *Widget) GetAutoRefresh() bool {
	if w == nil || w.AutoRefresh == nil {
		return false
	}
	return *w.AutoRefresh
}

func ( w * Widget ) GetAutoRefresh ( ) bool { if w == nil || w . AutoRefresh == nil { return false } return * w . AutoRefresh }

// GetAutoRefresh returns the AutoRefresh field if non-nil, zero value otherwise.

GetAutoRefresh returns the AutoRefresh field if non - nil zero value otherwise .


func (w *Widget) GetAutoRefreshOk() (bool, bool) {
	if w == nil || w.AutoRefresh == nil {
		return false, false
	}
	return *w.AutoRefresh, true
}

func ( w * Widget ) GetAutoRefreshOk ( ) ( bool , bool ) { if w == nil || w . AutoRefresh == nil { return false , false } return * w . AutoRefresh , true }

// GetAutoRefreshOk returns a tuple with the AutoRefresh field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.

GetAutoRefreshOk returns a tuple with the AutoRefresh field if it s non - nil zero value otherwise and a boolean to check if the value has been set .


func (w *Widget) HasAutoRefresh() bool {
	if w != nil && w.AutoRefresh != nil {
		return true
	}

	return false
}

func ( w * Widget ) HasAutoRefresh ( ) bool { if w != nil && w . AutoRefresh != nil { return true } return false }

// HasAutoRefresh returns a boolean if a field has been set.

HasAutoRefresh returns a boolean if a field has been set .


func (w *Widget) GetBgcolor() string {
	if w == nil || w.Bgcolor == nil {
		return ""
	}
	return *w.Bgcolor
}

func ( w * Widget ) GetBgcolor ( ) string { if w == nil || w . Bgcolor == nil { return " " } return * w . Bgcolor }

// GetBgcolor returns the Bgcolor field if non-nil, zero value otherwise.

GetBgcolor returns the Bgcolor field if non - nil zero value otherwise .


func (w *Widget) GetBgcolorOk() (string, bool) {
	if w == nil || w.Bgcolor == nil {
		return "", false
	}
	return *w.Bgcolor, true
}

func ( w * Widget ) GetBgcolorOk ( ) ( string , bool ) { if w == nil || w . Bgcolor == nil { return " " , false } return * w . Bgcolor , true }

// GetBgcolorOk returns a tuple with the Bgcolor field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.

GetBgcolorOk returns a tuple with the Bgcolor field if it s non - nil zero value otherwise and a boolean to check if the value has been set .


func (w *Widget) HasBgcolor() bool {
	if w != nil && w.Bgcolor != nil {
		return true
	}

	return false
}

func ( w * Widget ) HasBgcolor ( ) bool { if w != nil && w . Bgcolor != nil { return true } return false }

// HasBgcolor returns a boolean if a field has been set.

HasBgcolor returns a boolean if a field has been set .


func (w *Widget) GetColumns() string {
	if w == nil || w.Columns == nil {
		return ""
	}
	return *w.Columns
}

func ( w * Widget ) GetColumns ( ) string { if w == nil || w . Columns == nil { return " " } return * w . Columns }

// GetColumns returns the Columns field if non-nil, zero value otherwise.

GetColumns returns the Columns field if non - nil zero value otherwise .


func (w *Widget) GetColumnsOk() (string, bool) {
	if w == nil || w.Columns == nil {
		return "", false
	}
	return *w.Columns, true
}

func ( w * Widget ) GetColumnsOk ( ) ( string , bool ) { if w == nil || w . Columns == nil { return " " , false } return * w . Columns , true }

// GetColumnsOk returns a tuple with the Columns field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.

GetColumnsOk returns a tuple with the Columns field if it s non - nil zero value otherwise and a boolean to check if the value has been set .


func (w *Widget) HasColumns() bool {
	if w != nil && w.Columns != nil {
		return true
	}

	return false
}

func ( w * Widget ) HasColumns ( ) bool { if w != nil && w . Columns != nil { return true } return false }

// HasColumns returns a boolean if a field has been set.

HasColumns returns a boolean if a field has been set .


func (w *Widget) GetHTML() string {
	if w == nil || w.HTML == nil {
		return ""
	}
	return *w.HTML
}

func ( w * Widget ) GetHTML ( ) string { if w == nil || w . HTML == nil { return " " } return * w . HTML }

// GetHTML returns the HTML field if non-nil, zero value otherwise.

GetHTML returns the HTML field if non - nil zero value otherwise .


func (w *Widget) GetHTMLOk() (string, bool) {
	if w == nil || w.HTML == nil {
		return "", false
	}
	return *w.HTML, true
}

func ( w * Widget ) GetHTMLOk ( ) ( string , bool ) { if w == nil || w . HTML == nil { return " " , false } return * w . HTML , true }

// GetHTMLOk returns a tuple with the HTML field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.

GetHTMLOk returns a tuple with the HTML field if it s non - nil zero value otherwise and a boolean to check if the value has been set .


func (w *Widget) HasHTML() bool {
	if w != nil && w.HTML != nil {
		return true
	}

	return false
}

func ( w * Widget ) HasHTML ( ) bool { if w != nil && w . HTML != nil { return true } return false }

// HasHTML returns a boolean if a field has been set.

HasHTML returns a boolean if a field has been set .


func (w *Widget) GetLayoutVersion() string {
	if w == nil || w.LayoutVersion == nil {
		return ""
	}
	return *w.LayoutVersion
}

func ( w * Widget ) GetLayoutVersion ( ) string { if w == nil || w . LayoutVersion == nil { return " " } return * w . LayoutVersion }

// GetLayoutVersion returns the LayoutVersion field if non-nil, zero value otherwise.

GetLayoutVersion returns the LayoutVersion field if non - nil zero value otherwise .


func (w *Widget) GetLayoutVersionOk() (string, bool) {
	if w == nil || w.LayoutVersion == nil {
		return "", false
	}
	return *w.LayoutVersion, true
}

func ( w * Widget ) GetLayoutVersionOk ( ) ( string , bool ) { if w == nil || w . LayoutVersion == nil { return " " , false } return * w . LayoutVersion , true }

// GetLayoutVersionOk returns a tuple with the LayoutVersion field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.

GetLayoutVersionOk returns a tuple with the LayoutVersion field if it s non - nil zero value otherwise and a boolean to check if the value has been set .


func (w *Widget) HasLayoutVersion() bool {
	if w != nil && w.LayoutVersion != nil {
		return true
	}

	return false
}

func ( w * Widget ) HasLayoutVersion ( ) bool { if w != nil && w . LayoutVersion != nil { return true } return false }

// HasLayoutVersion returns a boolean if a field has been set.

HasLayoutVersion returns a boolean if a field has been set .


func (w *Widget) GetLegend() bool {
	if w == nil || w.Legend == nil {
		return false
	}
	return *w.Legend
}

func ( w * Widget ) GetLegend ( ) bool { if w == nil || w . Legend == nil { return false } return * w . Legend }

// GetLegend returns the Legend field if non-nil, zero value otherwise.

GetLegend returns the Legend field if non - nil zero value otherwise .


func (w *Widget) GetLegendOk() (bool, bool) {
	if w == nil || w.Legend == nil {
		return false, false
	}
	return *w.Legend, true
}

func ( w * Widget ) GetLegendOk ( ) ( bool , bool ) { if w == nil || w . Legend == nil { return false , false } return * w . Legend , true }

// GetLegendOk returns a tuple with the Legend field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.

GetLegendOk returns a tuple with the Legend field if it s non - nil zero value otherwise and a boolean to check if the value has been set .


func (w *Widget) HasLegend() bool {
	if w != nil && w.Legend != nil {
		return true
	}

	return false
}

func ( w * Widget ) HasLegend ( ) bool { if w != nil && w . Legend != nil { return true } return false }

// HasLegend returns a boolean if a field has been set.

HasLegend returns a boolean if a field has been set .


func (w *Widget) GetManageStatusShowTitle() bool {
	if w == nil || w.ManageStatusShowTitle == nil {
		return false
	}
	return *w.ManageStatusShowTitle
}

func ( w * Widget ) GetManageStatusShowTitle ( ) bool { if w == nil || w . ManageStatusShowTitle == nil { return false } return * w . ManageStatusShowTitle }

// GetManageStatusShowTitle returns the ManageStatusShowTitle field if non-nil, zero value otherwise.

GetManageStatusShowTitle returns the ManageStatusShowTitle field if non - nil zero value otherwise .


func (w *Widget) GetManageStatusShowTitleOk() (bool, bool) {
	if w == nil || w.ManageStatusShowTitle == nil {
		return false, false
	}
	return *w.ManageStatusShowTitle, true
}

func ( w * Widget ) GetManageStatusShowTitleOk ( ) ( bool , bool ) { if w == nil || w . ManageStatusShowTitle == nil { return false , false } return * w . ManageStatusShowTitle , true }

// GetManageStatusShowTitleOk returns a tuple with the ManageStatusShowTitle field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.

GetManageStatusShowTitleOk returns a tuple with the ManageStatusShowTitle field if it s non - nil zero value otherwise and a boolean to check if the value has been set .


func (w *Widget) HasManageStatusShowTitle() bool {
	if w != nil && w.ManageStatusShowTitle != nil {
		return true
	}

	return false
}

func ( w * Widget ) HasManageStatusShowTitle ( ) bool { if w != nil && w . ManageStatusShowTitle != nil { return true } return false }

// HasManageStatusShowTitle returns a boolean if a field has been set.

HasManageStatusShowTitle returns a boolean if a field has been set .


func (w *Widget) GetManageStatusTitleAlign() string {
	if w == nil || w.ManageStatusTitleAlign == nil {
		return ""
	}
	return *w.ManageStatusTitleAlign
}

func ( w * Widget ) GetManageStatusTitleAlign ( ) string { if w == nil || w . ManageStatusTitleAlign == nil { return " " } return * w . ManageStatusTitleAlign }

// GetManageStatusTitleAlign returns the ManageStatusTitleAlign field if non-nil, zero value otherwise.

GetManageStatusTitleAlign returns the ManageStatusTitleAlign field if non - nil zero value otherwise .


func (w *Widget) GetManageStatusTitleAlignOk() (string, bool) {
	if w == nil || w.ManageStatusTitleAlign == nil {
		return "", false
	}
	return *w.ManageStatusTitleAlign, true
}

func ( w * Widget ) GetManageStatusTitleAlignOk ( ) ( string , bool ) { if w == nil || w . ManageStatusTitleAlign == nil { return " " , false } return * w . ManageStatusTitleAlign , true }

// GetManageStatusTitleAlignOk returns a tuple with the ManageStatusTitleAlign field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.

GetManageStatusTitleAlignOk returns a tuple with the ManageStatusTitleAlign field if it s non - nil zero value otherwise and a boolean to check if the value has been set .


func (w *Widget) HasManageStatusTitleAlign() bool {
	if w != nil && w.ManageStatusTitleAlign != nil {
		return true
	}

	return false
}

func ( w * Widget ) HasManageStatusTitleAlign ( ) bool { if w != nil && w . ManageStatusTitleAlign != nil { return true } return false }

// HasManageStatusTitleAlign returns a boolean if a field has been set.

HasManageStatusTitleAlign returns a boolean if a field has been set .


func (w *Widget) GetManageStatusTitleSize() string {
	if w == nil || w.ManageStatusTitleSize == nil {
		return ""
	}
	return *w.ManageStatusTitleSize
}

func ( w * Widget ) GetManageStatusTitleSize ( ) string { if w == nil || w . ManageStatusTitleSize == nil { return " " } return * w . ManageStatusTitleSize }

// GetManageStatusTitleSize returns the ManageStatusTitleSize field if non-nil, zero value otherwise.

GetManageStatusTitleSize returns the ManageStatusTitleSize field if non - nil zero value otherwise .


func (w *Widget) GetManageStatusTitleSizeOk() (string, bool) {
	if w == nil || w.ManageStatusTitleSize == nil {
		return "", false
	}
	return *w.ManageStatusTitleSize, true
}

func ( w * Widget ) GetManageStatusTitleSizeOk ( ) ( string , bool ) { if w == nil || w . ManageStatusTitleSize == nil { return " " , false } return * w . ManageStatusTitleSize , true }

// GetManageStatusTitleSizeOk returns a tuple with the ManageStatusTitleSize field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.

GetManageStatusTitleSizeOk returns a tuple with the ManageStatusTitleSize field if it s non - nil zero value otherwise and a boolean to check if the value has been set .


func (w *Widget) HasManageStatusTitleSize() bool {
	if w != nil && w.ManageStatusTitleSize != nil {
		return true
	}

	return false
}

func ( w * Widget ) HasManageStatusTitleSize ( ) bool { if w != nil && w . ManageStatusTitleSize != nil { return true } return false }

// HasManageStatusTitleSize returns a boolean if a field has been set.

HasManageStatusTitleSize returns a boolean if a field has been set .


func (w *Widget) GetManageStatusTitleText() string {
	if w == nil || w.ManageStatusTitleText == nil {
		return ""
	}
	return *w.ManageStatusTitleText
}

func ( w * Widget ) GetManageStatusTitleText ( ) string { if w == nil || w . ManageStatusTitleText == nil { return " " } return * w . ManageStatusTitleText }

// GetManageStatusTitleText returns the ManageStatusTitleText field if non-nil, zero value otherwise.

GetManageStatusTitleText returns the ManageStatusTitleText field if non - nil zero value otherwise .


func (w *Widget) GetManageStatusTitleTextOk() (string, bool) {
	if w == nil || w.ManageStatusTitleText == nil {
		return "", false
	}
	return *w.ManageStatusTitleText, true
}

func ( w * Widget ) GetManageStatusTitleTextOk ( ) ( string , bool ) { if w == nil || w . ManageStatusTitleText == nil { return " " , false } return * w . ManageStatusTitleText , true }

// GetManageStatusTitleTextOk returns a tuple with the ManageStatusTitleText field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.

GetManageStatusTitleTextOk returns a tuple with the ManageStatusTitleText field if it s non - nil zero value otherwise and a boolean to check if the value has been set .


func (w *Widget) HasManageStatusTitleText() bool {
	if w != nil && w.ManageStatusTitleText != nil {
		return true
	}

	return false
}

func ( w * Widget ) HasManageStatusTitleText ( ) bool { if w != nil && w . ManageStatusTitleText != nil { return true } return false }

// HasManageStatusTitleText returns a boolean if a field has been set.

HasManageStatusTitleText returns a boolean if a field has been set .


func (w *Widget) GetMonitor() ScreenboardMonitor {
	if w == nil || w.Monitor == nil {
		return ScreenboardMonitor{}
	}
	return *w.Monitor
}

func ( w * Widget ) GetMonitor ( ) ScreenboardMonitor { if w == nil || w . Monitor == nil { return ScreenboardMonitor { } } return * w . Monitor }

// GetMonitor returns the Monitor field if non-nil, zero value otherwise.

GetMonitor returns the Monitor field if non - nil zero value otherwise .


func (w *Widget) GetMonitorOk() (ScreenboardMonitor, bool) {
	if w == nil || w.Monitor == nil {
		return ScreenboardMonitor{}, false
	}
	return *w.Monitor, true
}

func ( w * Widget ) GetMonitorOk ( ) ( ScreenboardMonitor , bool ) { if w == nil || w . Monitor == nil { return ScreenboardMonitor { } , false } return * w . Monitor , true }

// GetMonitorOk returns a tuple with the Monitor field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.

GetMonitorOk returns a tuple with the Monitor field if it s non - nil zero value otherwise and a boolean to check if the value has been set .


func (w *Widget) HasMonitor() bool {
	if w != nil && w.Monitor != nil {
		return true
	}

	return false
}

func ( w * Widget ) HasMonitor ( ) bool { if w != nil && w . Monitor != nil { return true } return false }

// HasMonitor returns a boolean if a field has been set.

HasMonitor returns a boolean if a field has been set .


func (w *Widget) GetMustShowBreakdown() bool {
	if w == nil || w.MustShowBreakdown == nil {
		return false
	}
	return *w.MustShowBreakdown
}

func ( w * Widget ) GetMustShowBreakdown ( ) bool { if w == nil || w . MustShowBreakdown == nil { return false } return * w . MustShowBreakdown }

// GetMustShowBreakdown returns the MustShowBreakdown field if non-nil, zero value otherwise.

GetMustShowBreakdown returns the MustShowBreakdown field if non - nil zero value otherwise .


func (w *Widget) GetMustShowBreakdownOk() (bool, bool) {
	if w == nil || w.MustShowBreakdown == nil {
		return false, false
	}
	return *w.MustShowBreakdown, true
}

func ( w * Widget ) GetMustShowBreakdownOk ( ) ( bool , bool ) { if w == nil || w . MustShowBreakdown == nil { return false , false } return * w . MustShowBreakdown , true }

// GetMustShowBreakdownOk returns a tuple with the MustShowBreakdown field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.

GetMustShowBreakdownOk returns a tuple with the MustShowBreakdown field if it s non - nil zero value otherwise and a boolean to check if the value has been set .


func (w *Widget) HasMustShowBreakdown() bool {
	if w != nil && w.MustShowBreakdown != nil {
		return true
	}

	return false
}

func ( w * Widget ) HasMustShowBreakdown ( ) bool { if w != nil && w . MustShowBreakdown != nil { return true } return false }

// HasMustShowBreakdown returns a boolean if a field has been set.

HasMustShowBreakdown returns a boolean if a field has been set .


func (w *Widget) GetMustShowDistribution() bool {
	if w == nil || w.MustShowDistribution == nil {
		return false
	}
	return *w.MustShowDistribution
}

func ( w * Widget ) GetMustShowDistribution ( ) bool { if w == nil || w . MustShowDistribution == nil { return false } return * w . MustShowDistribution }

// GetMustShowDistribution returns the MustShowDistribution field if non-nil, zero value otherwise.

GetMustShowDistribution returns the MustShowDistribution field if non - nil zero value otherwise .


func (w *Widget) GetMustShowDistributionOk() (bool, bool) {
	if w == nil || w.MustShowDistribution == nil {
		return false, false
	}
	return *w.MustShowDistribution, true
}

func ( w * Widget ) GetMustShowDistributionOk ( ) ( bool , bool ) { if w == nil || w . MustShowDistribution == nil { return false , false } return * w . MustShowDistribution , true }

// GetMustShowDistributionOk returns a tuple with the MustShowDistribution field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.

GetMustShowDistributionOk returns a tuple with the MustShowDistribution field if it s non - nil zero value otherwise and a boolean to check if the value has been set .


func (w *Widget) HasMustShowDistribution() bool {
	if w != nil && w.MustShowDistribution != nil {
		return true
	}

	return false
}

func ( w * Widget ) HasMustShowDistribution ( ) bool { if w != nil && w . MustShowDistribution != nil { return true } return false }

// HasMustShowDistribution returns a boolean if a field has been set.

HasMustShowDistribution returns a boolean if a field has been set .


func (w *Widget) GetMustShowErrors() bool {
	if w == nil || w.MustShowErrors == nil {
		return false
	}
	return *w.MustShowErrors
}

func ( w * Widget ) GetMustShowErrors ( ) bool { if w == nil || w . MustShowErrors == nil { return false } return * w . MustShowErrors }

// GetMustShowErrors returns the MustShowErrors field if non-nil, zero value otherwise.

GetMustShowErrors returns the MustShowErrors field if non - nil zero value otherwise .


func (w *Widget) GetMustShowErrorsOk() (bool, bool) {
	if w == nil || w.MustShowErrors == nil {
		return false, false
	}
	return *w.MustShowErrors, true
}

func ( w * Widget ) GetMustShowErrorsOk ( ) ( bool , bool ) { if w == nil || w . MustShowErrors == nil { return false , false } return * w . MustShowErrors , true }

// GetMustShowErrorsOk returns a tuple with the MustShowErrors field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.

GetMustShowErrorsOk returns a tuple with the MustShowErrors field if it s non - nil zero value otherwise and a boolean to check if the value has been set .


func (w *Widget) HasMustShowErrors() bool {
	if w != nil && w.MustShowErrors != nil {
		return true
	}

	return false
}

func ( w * Widget ) HasMustShowErrors ( ) bool { if w != nil && w . MustShowErrors != nil { return true } return false }

// HasMustShowErrors returns a boolean if a field has been set.

HasMustShowErrors returns a boolean if a field has been set .


func (w *Widget) GetMustShowHits() bool {
	if w == nil || w.MustShowHits == nil {
		return false
	}
	return *w.MustShowHits
}

func ( w * Widget ) GetMustShowHits ( ) bool { if w == nil || w . MustShowHits == nil { return false } return * w . MustShowHits }

// GetMustShowHits returns the MustShowHits field if non-nil, zero value otherwise.

GetMustShowHits returns the MustShowHits field if non - nil zero value otherwise .


func (w *Widget) GetMustShowHitsOk() (bool, bool) {
	if w == nil || w.MustShowHits == nil {
		return false, false
	}
	return *w.MustShowHits, true
}

func ( w * Widget ) GetMustShowHitsOk ( ) ( bool , bool ) { if w == nil || w . MustShowHits == nil { return false , false } return * w . MustShowHits , true }

// GetMustShowHitsOk returns a tuple with the MustShowHits field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.

GetMustShowHitsOk returns a tuple with the MustShowHits field if it s non - nil zero value otherwise and a boolean to check if the value has been set .


func (w *Widget) HasMustShowHits() bool {
	if w != nil && w.MustShowHits != nil {
		return true
	}

	return false
}

func ( w * Widget ) HasMustShowHits ( ) bool { if w != nil && w . MustShowHits != nil { return true } return false }

// HasMustShowHits returns a boolean if a field has been set.

HasMustShowHits returns a boolean if a field has been set .


func (w *Widget) GetMustShowLatency() bool {
	if w == nil || w.MustShowLatency == nil {
		return false
	}
	return *w.MustShowLatency
}

func ( w * Widget ) GetMustShowLatency ( ) bool { if w == nil || w . MustShowLatency == nil { return false } return * w . MustShowLatency }

// GetMustShowLatency returns the MustShowLatency field if non-nil, zero value otherwise.

GetMustShowLatency returns the MustShowLatency field if non - nil zero value otherwise .


func (w *Widget) GetMustShowLatencyOk() (bool, bool) {
	if w == nil || w.MustShowLatency == nil {
		return false, false
	}
	return *w.MustShowLatency, true
}

func ( w * Widget ) GetMustShowLatencyOk ( ) ( bool , bool ) { if w == nil || w . MustShowLatency == nil { return false , false } return * w . MustShowLatency , true }

// GetMustShowLatencyOk returns a tuple with the MustShowLatency field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.

GetMustShowLatencyOk returns a tuple with the MustShowLatency field if it s non - nil zero value otherwise and a boolean to check if the value has been set .


func (w *Widget) HasMustShowLatency() bool {
	if w != nil && w.MustShowLatency != nil {
		return true
	}

	return false
}

func ( w * Widget ) HasMustShowLatency ( ) bool { if w != nil && w . MustShowLatency != nil { return true } return false }

// HasMustShowLatency returns a boolean if a field has been set.

HasMustShowLatency returns a boolean if a field has been set .


func (w *Widget) GetMustShowResourceList() bool {
	if w == nil || w.MustShowResourceList == nil {
		return false
	}
	return *w.MustShowResourceList
}

func ( w * Widget ) GetMustShowResourceList ( ) bool { if w == nil || w . MustShowResourceList == nil { return false } return * w . MustShowResourceList }

// GetMustShowResourceList returns the MustShowResourceList field if non-nil, zero value otherwise.

GetMustShowResourceList returns the MustShowResourceList field if non - nil zero value otherwise .


func (w *Widget) GetMustShowResourceListOk() (bool, bool) {
	if w == nil || w.MustShowResourceList == nil {
		return false, false
	}
	return *w.MustShowResourceList, true
}

func ( w * Widget ) GetMustShowResourceListOk ( ) ( bool , bool ) { if w == nil || w . MustShowResourceList == nil { return false , false } return * w . MustShowResourceList , true }

// GetMustShowResourceListOk returns a tuple with the MustShowResourceList field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.

GetMustShowResourceListOk returns a tuple with the MustShowResourceList field if it s non - nil zero value otherwise and a boolean to check if the value has been set .


func (w *Widget) HasMustShowResourceList() bool {
	if w != nil && w.MustShowResourceList != nil {
		return true
	}

	return false
}

func ( w * Widget ) HasMustShowResourceList ( ) bool { if w != nil && w . MustShowResourceList != nil { return true } return false }

// HasMustShowResourceList returns a boolean if a field has been set.

HasMustShowResourceList returns a boolean if a field has been set .


func (w *Widget) GetParams() Params {
	if w == nil || w.Params == nil {
		return Params{}
	}
	return *w.Params
}

func ( w * Widget ) GetParams ( ) Params { if w == nil || w . Params == nil { return Params { } } return * w . Params }

// GetParams returns the Params field if non-nil, zero value otherwise.

GetParams returns the Params field if non - nil zero value otherwise .


func (w *Widget) GetParamsOk() (Params, bool) {
	if w == nil || w.Params == nil {
		return Params{}, false
	}
	return *w.Params, true
}

func ( w * Widget ) GetParamsOk ( ) ( Params , bool ) { if w == nil || w . Params == nil { return Params { } , false } return * w . Params , true }

// GetParamsOk returns a tuple with the Params field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.

GetParamsOk returns a tuple with the Params field if it s non - nil zero value otherwise and a boolean to check if the value has been set .


func (w *Widget) HasParams() bool {
	if w != nil && w.Params != nil {
		return true
	}

	return false
}

func ( w * Widget ) HasParams ( ) bool { if w != nil && w . Params != nil { return true } return false }

// HasParams returns a boolean if a field has been set.

HasParams returns a boolean if a field has been set .


func (w *Widget) GetServiceService() string {
	if w == nil || w.ServiceService == nil {
		return ""
	}
	return *w.ServiceService
}

func ( w * Widget ) GetServiceService ( ) string { if w == nil || w . ServiceService == nil { return " " } return * w . ServiceService }

// GetServiceService returns the ServiceService field if non-nil, zero value otherwise.

GetServiceService returns the ServiceService field if non - nil zero value otherwise .


func (w *Widget) GetServiceServiceOk() (string, bool) {
	if w == nil || w.ServiceService == nil {
		return "", false
	}
	return *w.ServiceService, true
}

func ( w * Widget ) GetServiceServiceOk ( ) ( string , bool ) { if w == nil || w . ServiceService == nil { return " " , false } return * w . ServiceService , true }

// GetServiceServiceOk returns a tuple with the ServiceService field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.

GetServiceServiceOk returns a tuple with the ServiceService field if it s non - nil zero value otherwise and a boolean to check if the value has been set .


func (w *Widget) HasServiceService() bool {
	if w != nil && w.ServiceService != nil {
		return true
	}

	return false
}

func ( w * Widget ) HasServiceService ( ) bool { if w != nil && w . ServiceService != nil { return true } return false }

// HasServiceService returns a boolean if a field has been set.

HasServiceService returns a boolean if a field has been set .


func (w *Widget) GetSizeVersion() string {
	if w == nil || w.SizeVersion == nil {
		return ""
	}
	return *w.SizeVersion
}

func ( w * Widget ) GetSizeVersion ( ) string { if w == nil || w . SizeVersion == nil { return " " } return * w . SizeVersion }

// GetSizeVersion returns the SizeVersion field if non-nil, zero value otherwise.

GetSizeVersion returns the SizeVersion field if non - nil zero value otherwise .


func (w *Widget) GetSizeVersionOk() (string, bool) {
	if w == nil || w.SizeVersion == nil {
		return "", false
	}
	return *w.SizeVersion, true
}

func ( w * Widget ) GetSizeVersionOk ( ) ( string , bool ) { if w == nil || w . SizeVersion == nil { return " " , false } return * w . SizeVersion , true }

// GetSizeVersionOk returns a tuple with the SizeVersion field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.

GetSizeVersionOk returns a tuple with the SizeVersion field if it s non - nil zero value otherwise and a boolean to check if the value has been set .


func (w *Widget) HasSizeVersion() bool {
	if w != nil && w.SizeVersion != nil {
		return true
	}

	return false
}

func ( w * Widget ) HasSizeVersion ( ) bool { if w != nil && w . SizeVersion != nil { return true } return false }

// HasSizeVersion returns a boolean if a field has been set.

HasSizeVersion returns a boolean if a field has been set .


func (w *Widget) GetTextSize() string {
	if w == nil || w.TextSize == nil {
		return ""
	}
	return *w.TextSize
}

func ( w * Widget ) GetTextSize ( ) string { if w == nil || w . TextSize == nil { return " " } return * w . TextSize }

// GetTextSize returns the TextSize field if non-nil, zero value otherwise.

GetTextSize returns the TextSize field if non - nil zero value otherwise .


func (w *Widget) GetTextSizeOk() (string, bool) {
	if w == nil || w.TextSize == nil {
		return "", false
	}
	return *w.TextSize, true
}

func ( w * Widget ) GetTextSizeOk ( ) ( string , bool ) { if w == nil || w . TextSize == nil { return " " , false } return * w . TextSize , true }

// GetTextSizeOk returns a tuple with the TextSize field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.

GetTextSizeOk returns a tuple with the TextSize field if it s non - nil zero value otherwise and a boolean to check if the value has been set .


func (w *Widget) HasTextSize() bool {
	if w != nil && w.TextSize != nil {
		return true
	}

	return false
}

func ( w * Widget ) HasTextSize ( ) bool { if w != nil && w . TextSize != nil { return true } return false }

// HasTextSize returns a boolean if a field has been set.

HasTextSize returns a boolean if a field has been set .


func (w *Widget) GetTick() bool {
	if w == nil || w.Tick == nil {
		return false
	}
	return *w.Tick
}

func ( w * Widget ) GetTick ( ) bool { if w == nil || w . Tick == nil { return false } return * w . Tick }

// GetTick returns the Tick field if non-nil, zero value otherwise.

GetTick returns the Tick field if non - nil zero value otherwise .


func (w *Widget) GetTickOk() (bool, bool) {
	if w == nil || w.Tick == nil {
		return false, false
	}
	return *w.Tick, true
}

func ( w * Widget ) GetTickOk ( ) ( bool , bool ) { if w == nil || w . Tick == nil { return false , false } return * w . Tick , true }

// GetTickOk returns a tuple with the Tick field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.

GetTickOk returns a tuple with the Tick field if it s non - nil zero value otherwise and a boolean to check if the value has been set .


func (w *Widget) HasTick() bool {
	if w != nil && w.Tick != nil {
		return true
	}

	return false
}

func ( w * Widget ) HasTick ( ) bool { if w != nil && w . Tick != nil { return true } return false }

// HasTick returns a boolean if a field has been set.

HasTick returns a boolean if a field has been set .


func (w *Widget) GetTileDef() TileDef {
	if w == nil || w.TileDef == nil {
		return TileDef{}
	}
	return *w.TileDef
}

func ( w * Widget ) GetTileDef ( ) TileDef { if w == nil || w . TileDef == nil { return TileDef { } } return * w . TileDef }

// GetTileDef returns the TileDef field if non-nil, zero value otherwise.

GetTileDef returns the TileDef field if non - nil zero value otherwise .


func (w *Widget) GetTileDefOk() (TileDef, bool) {
	if w == nil || w.TileDef == nil {
		return TileDef{}, false
	}
	return *w.TileDef, true
}

func ( w * Widget ) GetTileDefOk ( ) ( TileDef , bool ) { if w == nil || w . TileDef == nil { return TileDef { } , false } return * w . TileDef , true }

// GetTileDefOk returns a tuple with the TileDef field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.

GetTileDefOk returns a tuple with the TileDef field if it s non - nil zero value otherwise and a boolean to check if the value has been set .


func (w *Widget) HasTileDef() bool {
	if w != nil && w.TileDef != nil {
		return true
	}

	return false
}

func ( w * Widget ) HasTileDef ( ) bool { if w != nil && w . TileDef != nil { return true } return false }

// HasTileDef returns a boolean if a field has been set.

HasTileDef returns a boolean if a field has been set .


func (w *Widget) GetTitleText() string {
	if w == nil || w.TitleText == nil {
		return ""
	}
	return *w.TitleText
}

func ( w * Widget ) GetTitleText ( ) string { if w == nil || w . TitleText == nil { return " " } return * w . TitleText }

// GetTitleText returns the TitleText field if non-nil, zero value otherwise.

GetTitleText returns the TitleText field if non - nil zero value otherwise .


func (w *Widget) GetTitleTextOk() (string, bool) {
	if w == nil || w.TitleText == nil {
		return "", false
	}
	return *w.TitleText, true
}

func ( w * Widget ) GetTitleTextOk ( ) ( string , bool ) { if w == nil || w . TitleText == nil { return " " , false } return * w . TitleText , true }

// GetTitleTextOk returns a tuple with the TitleText field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.

GetTitleTextOk returns a tuple with the TitleText field if it s non - nil zero value otherwise and a boolean to check if the value has been set .


func (w *Widget) HasTitleText() bool {
	if w != nil && w.TitleText != nil {
		return true
	}

	return false
}

func ( w * Widget ) HasTitleText ( ) bool { if w != nil && w . TitleText != nil { return true } return false }

// HasTitleText returns a boolean if a field has been set.

HasTitleText returns a boolean if a field has been set .


func (w *Widget) GetURL() string {
	if w == nil || w.URL == nil {
		return ""
	}
	return *w.URL
}

func ( w * Widget ) GetURL ( ) string { if w == nil || w . URL == nil { return " " } return * w . URL }

// GetURL returns the URL field if non-nil, zero value otherwise.

GetURL returns the URL field if non - nil zero value otherwise .


func (w *Widget) GetURLOk() (string, bool) {
	if w == nil || w.URL == nil {
		return "", false
	}
	return *w.URL, true
}

func ( w * Widget ) GetURLOk ( ) ( string , bool ) { if w == nil || w . URL == nil { return " " , false } return * w . URL , true }

// GetURLOk returns a tuple with the URL field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.

GetURLOk returns a tuple with the URL field if it s non - nil zero value otherwise and a boolean to check if the value has been set .


func (w *Widget) HasURL() bool {
	if w != nil && w.URL != nil {
		return true
	}

	return false
}

func ( w * Widget ) HasURL ( ) bool { if w != nil && w . URL != nil { return true } return false }

// HasURL returns a boolean if a field has been set.

HasURL returns a boolean if a field has been set .


func (w *WidgetApmOrLogQuery) GetCompute() ApmOrLogQueryCompute {
	if w == nil || w.Compute == nil {
		return ApmOrLogQueryCompute{}
	}
	return *w.Compute
}

func ( w * WidgetApmOrLogQuery ) GetCompute ( ) ApmOrLogQueryCompute { if w == nil || w . Compute == nil { return ApmOrLogQueryCompute { } } return * w . Compute }

// GetCompute returns the Compute field if non-nil, zero value otherwise.

GetCompute returns the Compute field if non - nil zero value otherwise .


func (w *WidgetApmOrLogQuery) GetComputeOk() (ApmOrLogQueryCompute, bool) {
	if w == nil || w.Compute == nil {
		return ApmOrLogQueryCompute{}, false
	}
	return *w.Compute, true
}

func ( w * WidgetApmOrLogQuery ) GetComputeOk ( ) ( ApmOrLogQueryCompute , bool ) { if w == nil || w . Compute == nil { return ApmOrLogQueryCompute { } , false } return * w . Compute , true }

// GetComputeOk returns a tuple with the Compute field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.

GetComputeOk returns a tuple with the Compute field if it s non - nil zero value otherwise and a boolean to check if the value has been set .


func (w *WidgetApmOrLogQuery) HasCompute() bool {
	if w != nil && w.Compute != nil {
		return true
	}

	return false
}

func ( w * WidgetApmOrLogQuery ) HasCompute ( ) bool { if w != nil && w . Compute != nil { return true } return false }

// HasCompute returns a boolean if a field has been set.

HasCompute returns a boolean if a field has been set .


func (w *WidgetApmOrLogQuery) GetIndex() string {
	if w == nil || w.Index == nil {
		return ""
	}
	return *w.Index
}

func ( w * WidgetApmOrLogQuery ) GetIndex ( ) string { if w == nil || w . Index == nil { return " " } return * w . Index }

// GetIndex returns the Index field if non-nil, zero value otherwise.

GetIndex returns the Index field if non - nil zero value otherwise .


func (w *WidgetApmOrLogQuery) GetIndexOk() (string, bool) {
	if w == nil || w.Index == nil {
		return "", false
	}
	return *w.Index, true
}

func ( w * WidgetApmOrLogQuery ) GetIndexOk ( ) ( string , bool ) { if w == nil || w . Index == nil { return " " , false } return * w . Index , true }

// GetIndexOk returns a tuple with the Index field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.

GetIndexOk returns a tuple with the Index field if it s non - nil zero value otherwise and a boolean to check if the value has been set .


func (w *WidgetApmOrLogQuery) HasIndex() bool {
	if w != nil && w.Index != nil {
		return true
	}

	return false
}

func ( w * WidgetApmOrLogQuery ) HasIndex ( ) bool { if w != nil && w . Index != nil { return true } return false }

// HasIndex returns a boolean if a field has been set.

HasIndex returns a boolean if a field has been set .


func (w *WidgetApmOrLogQuery) GetSearch() ApmOrLogQuerySearch {
	if w == nil || w.Search == nil {
		return ApmOrLogQuerySearch{}
	}
	return *w.Search
}

func ( w * WidgetApmOrLogQuery ) GetSearch ( ) ApmOrLogQuerySearch { if w == nil || w . Search == nil { return ApmOrLogQuerySearch { } } return * w . Search }

// GetSearch returns the Search field if non-nil, zero value otherwise.

GetSearch returns the Search field if non - nil zero value otherwise .


func (w *WidgetApmOrLogQuery) GetSearchOk() (ApmOrLogQuerySearch, bool) {
	if w == nil || w.Search == nil {
		return ApmOrLogQuerySearch{}, false
	}
	return *w.Search, true
}

func ( w * WidgetApmOrLogQuery ) GetSearchOk ( ) ( ApmOrLogQuerySearch , bool ) { if w == nil || w . Search == nil { return ApmOrLogQuerySearch { } , false } return * w . Search , true }

// GetSearchOk returns a tuple with the Search field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.

GetSearchOk returns a tuple with the Search field if it s non - nil zero value otherwise and a boolean to check if the value has been set .


func (w *WidgetApmOrLogQuery) HasSearch() bool {
	if w != nil && w.Search != nil {
		return true
	}

	return false
}

func ( w * WidgetApmOrLogQuery ) HasSearch ( ) bool { if w != nil && w . Search != nil { return true } return false }

// HasSearch returns a boolean if a field has been set.

HasSearch returns a boolean if a field has been set .


func (w *WidgetConditionalFormat) GetHideValue() bool {
	if w == nil || w.HideValue == nil {
		return false
	}
	return *w.HideValue
}

func ( w * WidgetConditionalFormat ) GetHideValue ( ) bool { if w == nil || w . HideValue == nil { return false } return * w . HideValue }

// GetHideValue returns the HideValue field if non-nil, zero value otherwise.

GetHideValue returns the HideValue field if non - nil zero value otherwise .


func (w *WidgetConditionalFormat) GetHideValueOk() (bool, bool) {
	if w == nil || w.HideValue == nil {
		return false, false
	}
	return *w.HideValue, true
}

func ( w * WidgetConditionalFormat ) GetHideValueOk ( ) ( bool , bool ) { if w == nil || w . HideValue == nil { return false , false } return * w . HideValue , true }

// GetHideValueOk returns a tuple with the HideValue field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.

GetHideValueOk returns a tuple with the HideValue field if it s non - nil zero value otherwise and a boolean to check if the value has been set .


func (w *WidgetConditionalFormat) HasHideValue() bool {
	if w != nil && w.HideValue != nil {
		return true
	}

	return false
}

func ( w * WidgetConditionalFormat ) HasHideValue ( ) bool { if w != nil && w . HideValue != nil { return true } return false }

// HasHideValue returns a boolean if a field has been set.

HasHideValue returns a boolean if a field has been set .


func (w *WidgetConditionalFormat) GetImageUrl() string {
	if w == nil || w.ImageUrl == nil {
		return ""
	}
	return *w.ImageUrl
}

func ( w * WidgetConditionalFormat ) GetImageUrl ( ) string { if w == nil || w . ImageUrl == nil { return " " } return * w . ImageUrl }

// GetImageUrl returns the ImageUrl field if non-nil, zero value otherwise.

GetImageUrl returns the ImageUrl field if non - nil zero value otherwise .


func (w *WidgetConditionalFormat) GetImageUrlOk() (string, bool) {
	if w == nil || w.ImageUrl == nil {
		return "", false
	}
	return *w.ImageUrl, true
}

func ( w * WidgetConditionalFormat ) GetImageUrlOk ( ) ( string , bool ) { if w == nil || w . ImageUrl == nil { return " " , false } return * w . ImageUrl , true }

// GetImageUrlOk returns a tuple with the ImageUrl field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.

GetImageUrlOk returns a tuple with the ImageUrl field if it s non - nil zero value otherwise and a boolean to check if the value has been set .


func (w *WidgetConditionalFormat) HasImageUrl() bool {
	if w != nil && w.ImageUrl != nil {
		return true
	}

	return false
}

func ( w * WidgetConditionalFormat ) HasImageUrl ( ) bool { if w != nil && w . ImageUrl != nil { return true } return false }

// HasImageUrl returns a boolean if a field has been set.

HasImageUrl returns a boolean if a field has been set .


func (w *WidgetMetadata) GetAliasName() string {
	if w == nil || w.AliasName == nil {
		return ""
	}
	return *w.AliasName
}

func ( w * WidgetMetadata ) GetAliasName ( ) string { if w == nil || w . AliasName == nil { return " " } return * w . AliasName }

// GetAliasName returns the AliasName field if non-nil, zero value otherwise.

GetAliasName returns the AliasName field if non - nil zero value otherwise .


func (w *WidgetMetadata) GetAliasNameOk() (string, bool) {
	if w == nil || w.AliasName == nil {
		return "", false
	}
	return *w.AliasName, true
}

func ( w * WidgetMetadata ) GetAliasNameOk ( ) ( string , bool ) { if w == nil || w . AliasName == nil { return " " , false } return * w . AliasName , true }

// GetAliasNameOk returns a tuple with the AliasName field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.

GetAliasNameOk returns a tuple with the AliasName field if it s non - nil zero value otherwise and a boolean to check if the value has been set .


func (w *WidgetMetadata) HasAliasName() bool {
	if w != nil && w.AliasName != nil {
		return true
	}

	return false
}

func ( w * WidgetMetadata ) HasAliasName ( ) bool { if w != nil && w . AliasName != nil { return true } return false }

// HasAliasName returns a boolean if a field has been set.

HasAliasName returns a boolean if a field has been set .


func (w *WidgetProcessQuery) GetSearchBy() string {
	if w == nil || w.SearchBy == nil {
		return ""
	}
	return *w.SearchBy
}

func ( w * WidgetProcessQuery ) GetSearchBy ( ) string { if w == nil || w . SearchBy == nil { return " " } return * w . SearchBy }

// GetSearchBy returns the SearchBy field if non-nil, zero value otherwise.

GetSearchBy returns the SearchBy field if non - nil zero value otherwise .


func (w *WidgetProcessQuery) GetSearchByOk() (string, bool) {
	if w == nil || w.SearchBy == nil {
		return "", false
	}
	return *w.SearchBy, true
}

func ( w * WidgetProcessQuery ) GetSearchByOk ( ) ( string , bool ) { if w == nil || w . SearchBy == nil { return " " , false } return * w . SearchBy , true }

// GetSearchByOk returns a tuple with the SearchBy field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.

GetSearchByOk returns a tuple with the SearchBy field if it s non - nil zero value otherwise and a boolean to check if the value has been set .


func (w *WidgetProcessQuery) HasSearchBy() bool {
	if w != nil && w.SearchBy != nil {
		return true
	}

	return false
}

func ( w * WidgetProcessQuery ) HasSearchBy ( ) bool { if w != nil && w . SearchBy != nil { return true } return false }

// HasSearchBy returns a boolean if a field has been set.

HasSearchBy returns a boolean if a field has been set .


func (y *Yaxis) GetIncludeUnits() bool {
	if y == nil || y.IncludeUnits == nil {
		return false
	}
	return *y.IncludeUnits
}

func ( y * Yaxis ) GetIncludeUnits ( ) bool { if y == nil || y . IncludeUnits == nil { return false } return * y . IncludeUnits }

// GetIncludeUnits returns the IncludeUnits field if non-nil, zero value otherwise.

GetIncludeUnits returns the IncludeUnits field if non - nil zero value otherwise .


func (y *Yaxis) GetIncludeUnitsOk() (bool, bool) {
	if y == nil || y.IncludeUnits == nil {
		return false, false
	}
	return *y.IncludeUnits, true
}

func ( y * Yaxis ) GetIncludeUnitsOk ( ) ( bool , bool ) { if y == nil || y . IncludeUnits == nil { return false , false } return * y . IncludeUnits , true }

// GetIncludeUnitsOk returns a tuple with the IncludeUnits field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.

GetIncludeUnitsOk returns a tuple with the IncludeUnits field if it s non - nil zero value otherwise and a boolean to check if the value has been set .


func (y *Yaxis) HasIncludeUnits() bool {
	if y != nil && y.IncludeUnits != nil {
		return true
	}

	return false
}

func ( y * Yaxis ) HasIncludeUnits ( ) bool { if y != nil && y . IncludeUnits != nil { return true } return false }

// HasIncludeUnits returns a boolean if a field has been set.

HasIncludeUnits returns a boolean if a field has been set .


func (t *templateData) dump() error {
	if len(t.Accessors) == 0 {
		logf("No accessors for %v; skipping.", t.Filename)
		return nil
	}

	// Sort accessors by ReceiverType.FieldName
	sort.Sort(byName(t.Accessors))

	var buf bytes.Buffer
	if err := sourceTmpl.Execute(&buf, t); err != nil {
		return err
	}
	clean, err := format.Source(buf.Bytes())
	if err != nil {
		return err
	}

	outFile := filepath.Join(filepath.Dir(t.sourceFile), t.Filename)
	logf("Writing %v...", outFile)
	return ioutil.WriteFile(outFile, clean, 0644)
}

// dump sorts the results, and writes the generated code to a file

dump sorts the results and writes the generated code to a file


func newAccessor(receiverType, fieldName, fieldType, zeroValue string) *accessor {
	return &accessor{
		sortVal:      strings.ToLower(receiverType) + "." + strings.ToLower(fieldName),
		ReceiverVar:  strings.ToLower(receiverType[:1]),
		ReceiverType: receiverType,
		FieldName:    fieldName,
		FieldType:    fieldType,
		ZeroValue:    zeroValue,
	}
}

func newAccessor ( receiverType , fieldName , fieldType , zeroValue string ) * accessor { return & accessor { sortVal : strings . ToLower ( receiverType ) + " " + strings . ToLower ( fieldName ) , ReceiverVar : strings . ToLower ( receiverType [ : 1 ] ) , ReceiverType : receiverType , FieldName : fieldName , FieldType : fieldType , ZeroValue : zeroValue , } }

// newAccessor returns a new accessor to be processed later


func (t *templateData) addIdent(x *ast.Ident, receiverType, fieldName string) {
	var zeroValue string
	switch x.String() {
	case "int":
		zeroValue = "0"
	case "string":
		zeroValue = `""`
	case "bool":
		zeroValue = "false"
	case "float64":
		zeroValue = "0"
	case "Status":
		zeroValue = "0"
	case "PrecisionT":
		zeroValue = `""`
	default:
		zeroValue = fmt.Sprintf("%s{}", x.String())
	}

	t.Accessors = append(t.Accessors, newAccessor(receiverType, fieldName, x.String(), zeroValue))
}

func ( t * templateData ) addIdent ( x * ast . Ident , receiverType , fieldName string ) { var zeroValue string switch x . String ( ) { case " " : zeroValue = " " case " " : zeroValue = `""` case " " : zeroValue = " " case " " : zeroValue = " " case " " : zeroValue = " " case " " : zeroValue = `""` default : zeroValue = fmt . Sprintf ( " " , x . String ( ) ) } t . Accessors = append ( t . Accessors , newAccessor ( receiverType , fieldName , x . String ( ) , zeroValue ) ) }

// addIdent adds an accessor for an identifier, for a given receiver and field

addIdent adds an accessor for an identifier for a given receiver and field


func (t *templateData) addSelectorExpr(x *ast.SelectorExpr, receiverType, fieldName string) {
	if strings.ToLower(fieldName[:1]) == fieldName[:1] { // non-exported field
		return
	}

	var xX string
	if xx, ok := x.X.(*ast.Ident); ok {
		xX = xx.String()
	}

	switch xX {
	case "time", "json":
		if xX == "json" {
			t.Imports["encoding/json"] = "encoding/json"
		} else {
			t.Imports[xX] = xX
		}
		fieldType := fmt.Sprintf("%v.%v", xX, x.Sel.Name)
		zeroValue := fmt.Sprintf("%v.%v{}", xX, x.Sel.Name)
		if xX == "json" && x.Sel.Name == "Number" {
			zeroValue = `""`
		}
		if xX == "time" && x.Sel.Name == "Duration" {
			zeroValue = "0"
		}
		t.Accessors = append(t.Accessors, newAccessor(receiverType, fieldName, fieldType, zeroValue))
	default:
		logf("addSelectorExpr: xX %q, type %q, field %q: unknown x=%+v; skipping.", xX, receiverType, fieldName, x)
	}
}

func
(
t
*
templateData
)
addSelectorExpr
(
x
*
ast
.
SelectorExpr
,
receiverType
,
fieldName
string
)
{
if
strings
.
ToLower
(
fieldName
[
:
1
]
)
==
fieldName
[
:
1
]
{
// non-exported field
return
}
var
xX
string
if
xx
,
ok
:=
x
.
X
.
(
*
ast
.
Ident
)
;
ok
{
xX
=
xx
.
String
(
)
}
switch
xX
{
case
"
"
,
"
"
:
if
xX
==
"
"
{
t
.
Imports
[
"
"
]
=
"
"
}
else
{
t
.
Imports
[
xX
]
=
xX
}
fieldType
:=
fmt
.
Sprintf
(
"
"
,
xX
,
x
.
Sel
.
Name
)
zeroValue
:=
fmt
.
Sprintf
(
"
"
,
xX
,
x
.
Sel
.
Name
)
if
xX
==
"
"
&&
x
.
Sel
.
Name
==
"
"
{
zeroValue
=
`""`
}
if
xX
==
"
"
&&
x
.
Sel
.
Name
==
"
"
{
zeroValue
=
"
"
}
t
.
Accessors
=
append
(
t
.
Accessors
,
newAccessor
(
receiverType
,
fieldName
,
fieldType
,
zeroValue
)
)
default
:
logf
(
"
"
,
xX
,
receiverType
,
fieldName
,
x
)
}
}

// addSelectorExpr adds an accessor for an identifier selector expression, for a given receiver and field

addSelectorExpr adds an accessor for an identifier selector expression for a given receiver and field


func (t *templateData) addMapType(x *ast.MapType, receiverType, fieldName string) {
	// TODO: should we make this dynamic? Could handle more cases than string only
	var keyType string
	switch key := x.Key.(type) {
	case *ast.Ident:
		keyType = key.String()
	default:
		logf("addMapType: type %q, field %q: unknown key type: %T %+v; skipping.", receiverType, fieldName, key, key)
		return
	}

	var valueType string
	switch value := x.Value.(type) {
	case *ast.Ident:
		valueType = value.String()
	default:
		logf("addMapType: type %q, field %q: unknown value type: %T %+v; skipping.", receiverType, fieldName, value, value)
		return
	}

	fieldType := fmt.Sprintf("map[%v]%v", keyType, valueType)
	zeroValue := fmt.Sprintf("map[%v]%v{}", keyType, valueType)
	t.Accessors = append(t.Accessors, newAccessor(receiverType, fieldName, fieldType, zeroValue))
}

// addMypType adds an accessor for a map type, for a given receiver and field

addMypType adds an accessor for a map type for a given receiver and field


func (t *templateData) addArrayType(x *ast.ArrayType, receiverType, fieldName string) {
	// TODO: should we make this dynamic? Could handle more cases than string only
	var eltType string
	switch elt := x.Elt.(type) {
	case *ast.Ident:
		eltType = elt.String()
	default:
		logf("addArrayType: type %q, field %q: unknown element type: %T %+v; skipping.", receiverType, fieldName, elt, elt)
		return
	}

	t.Accessors = append(t.Accessors, newAccessor(receiverType, fieldName, "[]"+eltType, "nil"))
}

// addArrayType adds an accessor for a array type for a given receiver and field


func (client *Client) CreateDowntime(downtime *Downtime) (*Downtime, error) {
	var out Downtime
	if err := client.doJsonRequest("POST", "/v1/downtime", downtime, &out); err != nil {
		return nil, err
	}
	return &out, nil
}

func ( client * Client ) CreateDowntime ( downtime * Downtime ) ( * Downtime , error ) { var out Downtime if err := client . doJsonRequest ( " " , " " , downtime , & out ) ; err != nil { return nil , err } return & out , nil }

// CreateDowntime adds a new downtme to the system. This returns a pointer
// to a Downtime so you can pass that to UpdateDowntime or CancelDowntime
// later if needed.

CreateDowntime adds a new downtme to the system . This returns a pointer to a Downtime so you can pass that to UpdateDowntime or CancelDowntime later if needed .


func (client *Client) UpdateDowntime(downtime *Downtime) error {
	return client.doJsonRequest("PUT", fmt.Sprintf("/v1/downtime/%d", *downtime.Id),
		downtime, nil)
}

func ( client * Client ) UpdateDowntime ( downtime * Downtime ) error { return client . doJsonRequest ( " " , fmt . Sprintf ( " " , * downtime . Id ) , downtime , nil ) }

// UpdateDowntime takes a downtime that was previously retrieved through some method
// and sends it back to the server.

UpdateDowntime takes a downtime that was previously retrieved through some method and sends it back to the server .


func (client *Client) GetDowntime(id int) (*Downtime, error) {
	var out Downtime
	if err := client.doJsonRequest("GET", fmt.Sprintf("/v1/downtime/%d", id), nil, &out); err != nil {
		return nil, err
	}
	return &out, nil
}

func ( client * Client ) GetDowntime ( id int ) ( * Downtime , error ) { var out Downtime if err := client . doJsonRequest ( " " , fmt . Sprintf ( " " , id ) , nil , & out ) ; err != nil { return nil , err } return & out , nil }

// Getdowntime retrieves an downtime by identifier.

Getdowntime retrieves an downtime by identifier .


func (client *Client) GetDowntimes() ([]Downtime, error) {
	var out reqDowntimes
	if err := client.doJsonRequest("GET", "/v1/downtime", nil, &out.Downtimes); err != nil {
		return nil, err
	}
	return out.Downtimes, nil
}

func ( client * Client ) GetDowntimes ( ) ( [ ] Downtime , error ) { var out reqDowntimes if err := client . doJsonRequest ( " " , " " , nil , & out . Downtimes ) ; err != nil { return nil , err } return out . Downtimes , nil }

// GetDowntimes returns a slice of all downtimes.

GetDowntimes returns a slice of all downtimes .


func (k APIKey) MarshalJSON() ([]byte, error) {
	// Approach for custom (un)marshalling borrowed from http://choly.ca/post/go-json-marshalling/
	type Alias APIKey
	return json.Marshal(&struct {
		Created *string `json:"created,omitempty"`
		*Alias
	}{
		Created: String(k.Created.Format(createdTimeLayout)),
		Alias:   (*Alias)(&k),
	})
}

// MarshalJSON is a custom method for handling datetime marshalling


func (k *APIKey) UnmarshalJSON(data []byte) error {
	type Alias APIKey
	aux := &struct {
		Created *string `json:"created,omitempty"`
		*Alias
	}{
		Alias: (*Alias)(k),
	}
	if err := json.Unmarshal(data, &aux); err != nil {
		return err
	}

	if created, err := time.Parse(createdTimeLayout, *aux.Created); err != nil {
		return err
	} else {
		k.Created = &created
	}

	return nil
}

func ( k * APIKey ) UnmarshalJSON ( data [ ] byte ) error { type Alias APIKey aux := & struct { Created * string `json:"created,omitempty"` * Alias } { Alias : ( * Alias ) ( k ) , } if err := json . Unmarshal ( data , & aux ) ; err != nil { return err } if created , err := time . Parse ( createdTimeLayout , * aux . Created ) ; err != nil { return err } else { k . Created = & created } return nil }

// UnmarshalJSON is a custom method for handling datetime unmarshalling


func (client *Client) GetAPIKeys() ([]APIKey, error) {
	var out reqAPIKeys
	if err := client.doJsonRequest("GET", "/v1/api_key", nil, &out); err != nil {
		return nil, err
	}

	return out.APIKeys, nil
}

func ( client * Client ) GetAPIKeys ( ) ( [ ] APIKey , error ) { var out reqAPIKeys if err := client . doJsonRequest ( " " , " " , nil , & out ) ; err != nil { return nil , err } return out . APIKeys , nil }

// GetAPIKeys returns all API keys or error on failure


func (client *Client) GetAPIKey(key string) (*APIKey, error) {
	var out reqAPIKey
	if err := client.doJsonRequest("GET", fmt.Sprintf("/v1/api_key/%s", key), nil, &out); err != nil {
		return nil, err
	}

	return out.APIKey, nil
}

func ( client * Client ) GetAPIKey ( key string ) ( * APIKey , error ) { var out reqAPIKey if err := client . doJsonRequest ( " " , fmt . Sprintf ( " " , key ) , nil , & out ) ; err != nil { return nil , err } return out . APIKey , nil }

// GetAPIKey returns a single API key or error on failure


func (client *Client) CreateAPIKey(name string) (*APIKey, error) {
	toPost := struct {
		Name *string `json:"name,omitempty"`
	}{
		&name,
	}
	var out reqAPIKey
	if err := client.doJsonRequest("POST", "/v1/api_key", toPost, &out); err != nil {
		return nil, err
	}
	return out.APIKey, nil
}

func ( client * Client ) CreateAPIKey ( name string ) ( * APIKey , error ) { toPost := struct { Name * string `json:"name,omitempty"` } { & name , } var out reqAPIKey if err := client . doJsonRequest ( " " , " " , toPost , & out ) ; err != nil { return nil , err } return out . APIKey , nil }

// CreateAPIKey creates an API key from given struct and fills the rest of its
// fields, or returns an error on failure

CreateAPIKey creates an API key from given struct and fills the rest of its fields or returns an error on failure


func (client *Client) DeleteAPIKey(key string) error {
	return client.doJsonRequest("DELETE", fmt.Sprintf("/v1/api_key/%s", key), nil, nil)
}

func ( client * Client ) DeleteAPIKey ( key string ) error { return client . doJsonRequest ( " " , fmt . Sprintf ( " " , key ) , nil , nil ) }

// DeleteAPIKey deletes API key given by key, returns an error

DeleteAPIKey deletes API key given by key returns an error


func (client *Client) PostMetrics(series []Metric) error {
	return client.doJsonRequest("POST", "/v1/series",
		reqPostSeries{Series: series}, nil)
}

func ( client * Client ) PostMetrics ( series [ ] Metric ) error { return client . doJsonRequest ( " " , " " , reqPostSeries { Series : series } , nil ) }

// PostMetrics takes as input a slice of metrics and then posts them up to the
// server for posting data.

PostMetrics takes as input a slice of metrics and then posts them up to the server for posting data .


func (client *Client) GetScreenboard(id interface{}) (*Screenboard, error) {
	stringId, err := GetStringId(id)
	if err != nil {
		return nil, err
	}

	out := &Screenboard{}
	if err := client.doJsonRequest("GET", fmt.Sprintf("/v1/screen/%s", stringId), nil, out); err != nil {
		return nil, err
	}
	return out, nil
}

func ( client * Client ) GetScreenboard ( id interface { } ) ( * Screenboard , error ) { stringId , err := GetStringId ( id ) if err != nil { return nil , err } out := & Screenboard { } if err := client . doJsonRequest ( " " , fmt . Sprintf ( " " , stringId ) , nil , out ) ; err != nil { return nil , err } return out , nil }

// GetScreenboard returns a single screenboard created on this account.

GetScreenboard returns a single screenboard created on this account .


func (client *Client) GetScreenboards() ([]*ScreenboardLite, error) {
	var out reqGetScreenboards
	if err := client.doJsonRequest("GET", "/v1/screen", nil, &out); err != nil {
		return nil, err
	}
	return out.Screenboards, nil
}

func ( client * Client ) GetScreenboards ( ) ( [ ] * ScreenboardLite , error ) { var out reqGetScreenboards if err := client . doJsonRequest ( " " , " " , nil , & out ) ; err != nil { return nil , err } return out . Screenboards , nil }

// GetScreenboards returns a list of all screenboards created on this account.

GetScreenboards returns a list of all screenboards created on this account .


func (client *Client) CreateScreenboard(board *Screenboard) (*Screenboard, error) {
	out := &Screenboard{}
	if err := client.doJsonRequest("POST", "/v1/screen", board, out); err != nil {
		return nil, err
	}
	return out, nil
}

func ( client * Client ) CreateScreenboard ( board * Screenboard ) ( * Screenboard , error ) { out := & Screenboard { } if err := client . doJsonRequest ( " " , " " , board , out ) ; err != nil { return nil , err } return out , nil }

// CreateScreenboard creates a new screenboard when given a Screenboard struct. Note
// that the Id, Resource, Url and similar elements are not used in creation.

CreateScreenboard creates a new screenboard when given a Screenboard struct . Note that the Id Resource Url and similar elements are not used in creation .


func (client *Client) UpdateScreenboard(board *Screenboard) error {
	return client.doJsonRequest("PUT", fmt.Sprintf("/v1/screen/%d", *board.Id), board, nil)
}

func ( client * Client ) UpdateScreenboard ( board * Screenboard ) error { return client . doJsonRequest ( " " , fmt . Sprintf ( " " , * board . Id ) , board , nil ) }

// UpdateScreenboard in essence takes a Screenboard struct and persists it back to
// the server. Use this if you've updated your local and need to push it back.

UpdateScreenboard in essence takes a Screenboard struct and persists it back to the server . Use this if you ve updated your local and need to push it back .


func (client *Client) ShareScreenboard(id int, response *ScreenShareResponse) error {
	return client.doJsonRequest("POST", fmt.Sprintf("/v1/screen/share/%d", id), nil, response)
}

func ( client * Client ) ShareScreenboard ( id int , response * ScreenShareResponse ) error { return client . doJsonRequest ( " " , fmt . Sprintf ( " " , id ) , nil , response ) }

// ShareScreenboard shares an existing screenboard, it takes and updates ScreenShareResponse

ShareScreenboard shares an existing screenboard it takes and updates ScreenShareResponse


func (client *Client) RevokeScreenboard(id int) error {
	return client.doJsonRequest("DELETE", fmt.Sprintf("/v1/screen/share/%d", id), nil, nil)
}

func ( client * Client ) RevokeScreenboard ( id int ) error { return client . doJsonRequest ( " " , fmt . Sprintf ( " " , id ) , nil , nil ) }

// RevokeScreenboard revokes a currently shared screenboard


func (client *Client) GetTags(source string) (TagMap, error) {
	var out reqGetTags
	uri := "/v1/tags/hosts"
	if source != "" {
		uri += "?source=" + source
	}
	if err := client.doJsonRequest("GET", uri, nil, &out); err != nil {
		return nil, err
	}
	return *out.Tags, nil
}

func ( client * Client ) GetTags ( source string ) ( TagMap , error ) { var out reqGetTags uri := " " if source != " " { uri += " " + source } if err := client . doJsonRequest ( " " , uri , nil , & out ) ; err != nil { return nil , err } return * out . Tags , nil }


func (client *Client) GetHostTags(host, source string) ([]string, error) {
	var out reqGetHostTags
	uri := "/v1/tags/hosts/" + host
	if source != "" {
		uri += "?source=" + source
	}
	if err := client.doJsonRequest("GET", uri, nil, &out); err != nil {
		return nil, err
	}
	return out.Tags, nil
}

func ( client * Client ) GetHostTags ( host , source string ) ( [ ] string , error ) { var out reqGetHostTags uri := " " + host if source != " " { uri += " " + source } if err := client . doJsonRequest ( " " , uri , nil , & out ) ; err != nil { return nil , err } return out . Tags , nil }

// GetHostTags returns a slice of tags for a given host and source.

GetHostTags returns a slice of tags for a given host and source .


func (client *Client) AddTagsToHost(host, source string, tags []string) error {
	uri := "/v1/tags/hosts/" + host
	if source != "" {
		uri += "?source=" + source
	}
	return client.doJsonRequest("POST", uri, reqGetHostTags{Tags: tags}, nil)
}

func ( client * Client ) AddTagsToHost ( host , source string , tags [ ] string ) error { uri := " " + host if source != " " { uri += " " + source } return client . doJsonRequest ( " " , uri , reqGetHostTags { Tags : tags } , nil ) }

// AddTagsToHost does exactly what it says on the tin. Given a list of tags,
// add them to the host. The source is optionally specified, and defaults to
// "users" as per the API documentation.

AddTagsToHost does exactly what it says on the tin . Given a list of tags add them to the host . The source is optionally specified and defaults to users as per the API documentation .


func (client *Client) RemoveHostTags(host, source string) error {
	uri := "/v1/tags/hosts/" + host
	if source != "" {
		uri += "?source=" + source
	}
	return client.doJsonRequest("DELETE", uri, nil, nil)
}

func ( client * Client ) RemoveHostTags ( host , source string ) error { uri := " " + host if source != " " { uri += " " + source } return client . doJsonRequest ( " " , uri , nil , nil ) }

// RemoveHostTags removes all tags from a host for the given source. If none is
// given, the API defaults to "users".

RemoveHostTags removes all tags from a host for the given source . If none is given the API defaults to users .


func (client *Client) redactError(err error) error {
	if err == nil {
		return nil
	}
	errString := err.Error()

	if len(client.apiKey) > 0 {
		errString = strings.Replace(errString, client.apiKey, "redacted", -1)
	}
	if len(client.appKey) > 0 {
		errString = strings.Replace(errString, client.appKey, "redacted", -1)
	}

	// Return original error if no replacements were made to keep the original,
	// probably more useful error type information.
	if errString == err.Error() {
		return err
	}
	return fmt.Errorf("%s", errString)
}

// redactError removes api and application keys from error strings


func (client *Client) doRequestWithRetries(req *http.Request, maxTime time.Duration) (*http.Response, error) {
	var (
		err  error
		resp *http.Response
		bo   = backoff.NewExponentialBackOff()
		body []byte
	)

	bo.MaxElapsedTime = maxTime

	// Save the body for retries
	if req.Body != nil {
		body, err = ioutil.ReadAll(req.Body)
		if err != nil {
			return resp, err
		}
	}

	operation := func() error {
		if body != nil {
			r := bytes.NewReader(body)
			req.Body = ioutil.NopCloser(r)
		}

		resp, err = client.HttpClient.Do(req)
		if err != nil {
			return err
		}

		if resp.StatusCode >= 200 && resp.StatusCode < 300 {
			// 2xx all done
			return nil
		} else if resp.StatusCode >= 400 && resp.StatusCode < 500 {
			// 4xx are not retryable
			return nil
		}

		return fmt.Errorf("Received HTTP status code %d", resp.StatusCode)
	}

	err = backoff.Retry(operation, bo)

	return resp, err
}

func
(
client
*
Client
)
doRequestWithRetries
(
req
*
http
.
Request
,
maxTime
time
.
Duration
)
(
*
http
.
Response
,
error
)
{
var
(
err
error
resp
*
http
.
Response
bo
=
backoff
.
NewExponentialBackOff
(
)
body
[
]
byte
)
bo
.
MaxElapsedTime
=
maxTime
// Save the body for retries
if
req
.
Body
!=
{
body
,
err
=
ioutil
.
ReadAll
(
req
.
Body
)
if
err
!=
{
return
resp
,
err
}
}
operation
:=
func
(
)
error
{
if
body
!=
{
r
:=
bytes
.
NewReader
(
body
)
req
.
Body
=
ioutil
.
NopCloser
(
r
)
}
resp
,
err
=
client
.
HttpClient
.
Do
(
req
)
if
err
!=
{
return
err
}
if
resp
.
StatusCode
>=
200
&&
resp
.
StatusCode
<
300
{
// 2xx all done
return
}
else
if
resp
.
StatusCode
>=
400
&&
resp
.
StatusCode
<
500
{
// 4xx are not retryable
return
}
return
fmt
.
Errorf
(
"
"
,
resp
.
StatusCode
)
}
err
=
backoff
.
Retry
(
operation
,
bo
)
return
resp
,
err
}

// doRequestWithRetries performs an HTTP request repeatedly for maxTime or until
// no error and no acceptable HTTP response code was returned.

doRequestWithRetries performs an HTTP request repeatedly for maxTime or until no error and no acceptable HTTP response code was returned .


func (client *Client) PostEvent(event *Event) (*Event, error) {
	var out reqGetEvent
	if err := client.doJsonRequest("POST", "/v1/events", event, &out); err != nil {
		return nil, err
	}
	return out.Event, nil
}

func ( client * Client ) PostEvent ( event * Event ) ( * Event , error ) { var out reqGetEvent if err := client . doJsonRequest ( " " , " " , event , & out ) ; err != nil { return nil , err } return out . Event , nil }

// PostEvent takes as input an event and then posts it to the server.

PostEvent takes as input an event and then posts it to the server .


func (client *Client) GetEvent(id int) (*Event, error) {
	var out reqGetEvent
	if err := client.doJsonRequest("GET", fmt.Sprintf("/v1/events/%d", id), nil, &out); err != nil {
		return nil, err
	}
	return out.Event, nil
}

func ( client * Client ) GetEvent ( id int ) ( * Event , error ) { var out reqGetEvent if err := client . doJsonRequest ( " " , fmt . Sprintf ( " " , id ) , nil , & out ) ; err != nil { return nil , err } return out . Event , nil }

// GetEvent gets a single event given an identifier.

GetEvent gets a single event given an identifier .


func (client *Client) GetEvents(start, end int,
	priority, sources, tags string) ([]Event, error) {
	// Since this is a GET request, we need to build a query string.
	vals := url.Values{}
	vals.Add("start", strconv.Itoa(start))
	vals.Add("end", strconv.Itoa(end))
	if priority != "" {
		vals.Add("priority", priority)
	}
	if sources != "" {
		vals.Add("sources", sources)
	}
	if tags != "" {
		vals.Add("tags", tags)
	}

	// Now the request and response.
	var out reqGetEvents
	if err := client.doJsonRequest("GET",
		fmt.Sprintf("/v1/events?%s", vals.Encode()), nil, &out); err != nil {
		return nil, err
	}
	return out.Events, nil
}

// GetEvents returns a slice of events from the query stream.

GetEvents returns a slice of events from the query stream .


func (client *Client) ViewMetricMetadata(mn string) (*MetricMetadata, error) {
	var out MetricMetadata
	if err := client.doJsonRequest("GET", fmt.Sprintf("/v1/metrics/%s", mn), nil, &out); err != nil {
		return nil, err
	}
	return &out, nil
}

func ( client * Client ) ViewMetricMetadata ( mn string ) ( * MetricMetadata , error ) { var out MetricMetadata if err := client . doJsonRequest ( " " , fmt . Sprintf ( " " , mn ) , nil , & out ) ; err != nil { return nil , err } return & out , nil }

// ViewMetricMetadata allows you to get metadata about a specific metric.

ViewMetricMetadata allows you to get metadata about a specific metric .


func (client *Client) PostCheck(check Check) error {
	return client.doJsonRequest("POST", "/v1/check_run",
		check, nil)
}

func ( client * Client ) PostCheck ( check Check ) error { return client . doJsonRequest ( " " , " " , check , nil ) }

// PostCheck posts the result of a check run to the server


func (t *bufferedObjectStream) WriteObject(obj interface{}) error {
	t.mu.Lock()
	defer t.mu.Unlock()
	if err := t.codec.WriteObject(t.w, obj); err != nil {
		return err
	}
	return t.w.Flush()
}

func ( t * bufferedObjectStream ) WriteObject ( obj interface { } ) error { t . mu . Lock ( ) defer t . mu . Unlock ( ) if err := t . codec . WriteObject ( t . w , obj ) ; err != nil { return err } return t . w . Flush ( ) }


func (t *bufferedObjectStream) ReadObject(v interface{}) error {
	return t.codec.ReadObject(t.r, v)
}

func ( t * bufferedObjectStream ) ReadObject ( v interface { } ) error { return t . codec . ReadObject ( t . r , v ) }


func (r *Request) SetParams(v interface{}) error {
	b, err := json.Marshal(v)
	if err != nil {
		return err
	}
	r.Params = (*json.RawMessage)(&b)
	return nil
}

func ( r * Request ) SetParams ( v interface { } ) error { b , err := json . Marshal ( v ) if err != nil { return err } r . Params = ( * json . RawMessage ) ( & b ) return nil }

// SetParams sets r.Params to the JSON representation of v. If JSON
// marshaling fails, it returns an error.

SetParams sets r . Params to the JSON representation of v . If JSON marshaling fails it returns an error .


func (r *Request) SetMeta(v interface{}) error {
	b, err := json.Marshal(v)
	if err != nil {
		return err
	}
	r.Meta = (*json.RawMessage)(&b)
	return nil
}

func ( r * Request ) SetMeta ( v interface { } ) error { b , err := json . Marshal ( v ) if err != nil { return err } r . Meta = ( * json . RawMessage ) ( & b ) return nil }

// SetMeta sets r.Meta to the JSON representation of v. If JSON
// marshaling fails, it returns an error.

SetMeta sets r . Meta to the JSON representation of v . If JSON marshaling fails it returns an error .


func (r *Response) SetResult(v interface{}) error {
	b, err := json.Marshal(v)
	if err != nil {
		return err
	}
	r.Result = (*json.RawMessage)(&b)
	return nil
}

func ( r * Response ) SetResult ( v interface { } ) error { b , err := json . Marshal ( v ) if err != nil { return err } r . Result = ( * json . RawMessage ) ( & b ) return nil }

// SetResult sets r.Result to the JSON representation of v. If JSON
// marshaling fails, it returns an error.

SetResult sets r . Result to the JSON representation of v . If JSON marshaling fails it returns an error .


func (e *Error) SetError(v interface{}) {
	b, err := json.Marshal(v)
	if err != nil {
		panic("Error.SetData: " + err.Error())
	}
	e.Data = (*json.RawMessage)(&b)
}

func ( e * Error ) SetError ( v interface { } ) { b , err := json . Marshal ( v ) if err != nil { panic ( " " + err . Error ( ) ) } e . Data = ( * json . RawMessage ) ( & b ) }

// SetError sets e.Error to the JSON representation of v. If JSON
// marshaling fails, it panics.

SetError sets e . Error to the JSON representation of v . If JSON marshaling fails it panics .


func (c *Conn) Close() error {
	c.mu.Lock()
	if c.shutdown || c.closing {
		c.mu.Unlock()
		return ErrClosed
	}
	c.closing = true
	c.mu.Unlock()
	return c.stream.Close()
}

func ( c * Conn ) Close ( ) error { c . mu . Lock ( ) if c . shutdown || c . closing { c . mu . Unlock ( ) return ErrClosed } c . closing = true c . mu . Unlock ( ) return c . stream . Close ( ) }

// Close closes the JSON-RPC connection. The connection may not be
// used after it has been closed.

Close closes the JSON - RPC connection . The connection may not be used after it has been closed .


func (c *Conn) Reply(ctx context.Context, id ID, result interface{}) error {
	resp := &Response{ID: id}
	if err := resp.SetResult(result); err != nil {
		return err
	}
	_, err := c.send(ctx, &anyMessage{response: resp}, false)
	return err
}

func ( c * Conn ) Reply ( ctx context . Context , id ID , result interface { } ) error { resp := & Response { ID : id } if err := resp . SetResult ( result ) ; err != nil { return err } _ , err := c . send ( ctx , & anyMessage { response : resp } , false ) return err }

// Reply sends a successful response with a result.

Reply sends a successful response with a result .


func (c *Conn) ReplyWithError(ctx context.Context, id ID, respErr *Error) error {
	_, err := c.send(ctx, &anyMessage{response: &Response{ID: id, Error: respErr}}, false)
	return err
}

func ( c * Conn ) ReplyWithError ( ctx context . Context , id ID , respErr * Error ) error { _ , err := c . send ( ctx , & anyMessage { response : & Response { ID : id , Error : respErr } } , false ) return err }

// ReplyWithError sends a response with an error.

ReplyWithError sends a response with an error .


func LogMessages(log Logger) ConnOpt {
	return func(c *Conn) {
		// Remember reqs we have received so we can helpfully show the
		// request method in OnSend for responses.
		var (
			mu         sync.Mutex
			reqMethods = map[ID]string{}
		)

		OnRecv(func(req *Request, resp *Response) {
			switch {
			case req != nil && resp == nil:
				mu.Lock()
				reqMethods[req.ID] = req.Method
				mu.Unlock()

				params, _ := json.Marshal(req.Params)
				if req.Notif {
					log.Printf("--> notif: %s: %s", req.Method, params)
				} else {
					log.Printf("--> request #%s: %s: %s", req.ID, req.Method, params)
				}

			case resp != nil:
				var method string
				if req != nil {
					method = req.Method
				} else {
					method = "(no matching request)"
				}
				switch {
				case resp.Result != nil:
					result, _ := json.Marshal(resp.Result)
					log.Printf("--> result #%s: %s: %s", resp.ID, method, result)
				case resp.Error != nil:
					err, _ := json.Marshal(resp.Error)
					log.Printf("--> error #%s: %s: %s", resp.ID, method, err)
				}
			}
		})(c)
		OnSend(func(req *Request, resp *Response) {
			switch {
			case req != nil:
				params, _ := json.Marshal(req.Params)
				if req.Notif {
					log.Printf("<-- notif: %s: %s", req.Method, params)
				} else {
					log.Printf("<-- request #%s: %s: %s", req.ID, req.Method, params)
				}

			case resp != nil:
				mu.Lock()
				method := reqMethods[resp.ID]
				delete(reqMethods, resp.ID)
				mu.Unlock()
				if method == "" {
					method = "(no previous request)"
				}

				if resp.Result != nil {
					result, _ := json.Marshal(resp.Result)
					log.Printf("<-- result #%s: %s: %s", resp.ID, method, result)
				} else {
					err, _ := json.Marshal(resp.Error)
					log.Printf("<-- error #%s: %s: %s", resp.ID, method, err)
				}
			}
		})(c)
	}
}

// LogMessages causes all messages sent and received on conn to be
// logged using the provided logger.

LogMessages causes all messages sent and received on conn to be logged using the provided logger .


func HandlerWithError(handleFunc func(context.Context, *Conn, *Request) (result interface{}, err error)) *HandlerWithErrorConfigurer {
	return &HandlerWithErrorConfigurer{handleFunc: handleFunc}
}

func HandlerWithError ( handleFunc func ( context . Context , * Conn , * Request ) ( result interface { } , err error ) ) * HandlerWithErrorConfigurer { return & HandlerWithErrorConfigurer { handleFunc : handleFunc } }

// HandlerWithError implements Handler by calling the func for each
// request and handling returned errors and results.

HandlerWithError implements Handler by calling the func for each request and handling returned errors and results .