deeplink

package
v0.42.0-alpha.1 Latest Latest
Warning

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

Go to latest
Published: May 23, 2021 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.

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 a 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}
	//
	Join Type = "join"
)

Jump to

Keyboard shortcuts

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