embedopen

package
v0.92.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 16, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package embedopen implements the "rill_open" param of open links in emails from reports and alerts created from an embed. The runtime appends the param to the embedder's open URL. The embedder forwards it to the admin service's GetIFrame API without reading it, and the admin service decodes it to open the report or alert in the embed.

The param is an unpadded base64url encoding of a JSON object. It isn't signed: it only identifies a resource, and the embed access token decides access.

Index

Constants

View Source
const QueryParam = "rill_open"

QueryParam is the name of the query param that Rill appends to the embedder's open URL.

Variables

This section is empty.

Functions

func Encode

func Encode(p *Payload) (string, error)

Encode encodes the payload as the value of the param.

func Link(openURL string, p *Payload) (string, error)

Link returns the open URL with the encoded payload appended as the last param of its query string. The rest of the open URL is kept as-is, including the order and encoding of its query params. The param is always added to the query string before any fragment, also for apps that route with the fragment, since a fragment can't reliably be told apart from an anchor.

func ValidateOpenURL

func ValidateOpenURL(openURL string) error

ValidateOpenURL returns an error if the URL is not an absolute http(s) URL, or if it already has the param.

Types

type Kind

type Kind string

Kind is the kind of resource that an open link points to.

const (
	KindReport Kind = "report"
	KindAlert  Kind = "alert"
)

type Payload

type Payload struct {
	Kind Kind   `json:"kind"`
	Name string `json:"name"`
	// ExecutionTime is the time of the run, used to resolve relative time ranges; optional.
	ExecutionTime time.Time `json:"execution_time,omitzero"`
}

Payload is the information encoded in the param.

func Decode

func Decode(s string) (*Payload, error)

Decode decodes and validates a value of the param.

func (*Payload) Validate

func (p *Payload) Validate() error

Validate returns an error if the payload is not valid.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL