deeplink

package
v0.113.0 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package deeplink contains deeplink parsing helpers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsDeeplinkLike

func IsDeeplinkLike(link string) bool

IsDeeplinkLike returns true if string may be a valid deeplink.

func ValidateDomain

func ValidateDomain(domain string) error

ValidateDomain validate given domain (user) name

Types

type DeepLink struct {
	Type Type
	Args url.Values
}

DeepLink represents Telegram deeplink.

func Expect

func Expect(link string, typ Type) (DeepLink, error)

Expect parses deeplink and check type its type.

func Parse

func Parse(link string) (DeepLink, error)

Parse parses and returns deeplink.

type Type

type Type string

Type is an enum type of Telegram deeplinks types.

const (
	// Resolve is deeplink like
	//
	// 	tg:resolve?domain={domain}
	// 	tg://resolve?domain={domain}
	// 	https://t.me/{domain}
	// 	https://telegram.me/{domain}
	//
	Resolve Type = "resolve"

	// Join is deeplink like
	//
	// 	tg:join?invite={hash}
	// 	tg://join?invite={hash}
	// 	https://t.me/joinchat/{hash}
	// 	https://telegram.me/joinchat/{hash}
	// 	t.me/+{hash}
	//
	Join Type = "join"
)

Jump to

Keyboard shortcuts

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