Skip to content

SigNoz is an open-source, OpenTelemetry-native observability platform for your team and their AI agents. Get logs, metrics, and traces in one tool with features like APM, distributed tracing, log management, infra monitoring, etc. Combined with SigNoz MCP and a native AI teammate (in SigNoz Cloud) it helps you build more resilient apps.

772 B
Raw Blame
package subscriptiontypes

import (
	"encoding/json"

	"github.com/SigNoz/signoz/pkg/errors"
)

type PostableSubscription struct {
	SuccessURL string `json:"url" required:"true"`
}

func (postableSubscription *PostableSubscription) UnmarshalJSON(data []byte) error {
	var raw struct {
		SuccessURL string `json:"url"`
	}

	if err := json.Unmarshal(data, &raw); err != nil {
		return errors.Newf(errors.TypeInvalidInput, errors.CodeInvalidInput, "failed to unmarshal payload")
	}

	if raw.SuccessURL == "" {
		return errors.Newf(errors.TypeInvalidInput, errors.CodeInvalidInput, "success url cannot be empty")
	}

	postableSubscription.SuccessURL = raw.SuccessURL
	return nil
}

type GettableSubscription struct {
	RedirectURL string `json:"redirectURL" required:"true"`
}