Documentation ¶
Index ¶
- Constants
- Variables
- func IsValidScheme(scheme string) bool
- type URN
- func NewFacebookURN(identifier string) (URN, error)
- func NewFirebaseURN(identifier string) URN
- func NewTelURNForCountry(number string, country string) URN
- func NewTelegramURN(identifier int64, display string) URN
- func NewURNFromParts(scheme string, path string, display string) URN
- func NewWhatsAppURN(identifier string) (URN, error)
- func (u URN) Default() interface{}
- func (u URN) Display() string
- func (u URN) FacebookRef() string
- func (u URN) Format() string
- func (u URN) Identity() string
- func (u URN) IsFacebookRef() bool
- func (u URN) Localize(country string) URN
- func (u URN) Normalize(country string) URN
- func (u URN) Path() string
- func (u URN) Resolve(key string) interface{}
- func (u URN) Scheme() string
- func (u URN) String() string
- func (u URN) ToParts() (string, string, string)
- func (u URN) Validate() bool
Constants ¶
const ( // EmailScheme is the scheme used for email addresses EmailScheme string = "mailto" // ExternalScheme is the scheme used for externally defined identifiers ExternalScheme string = "ext" // FacebookScheme is the scheme used for Facebook identifiers FacebookScheme string = "facebook" // FCMScheme is the scheme used for Firebase Cloud Messaging identifiers FCMScheme string = "fcm" // JiochatScheme is the scheme used for Jiochat identifiers JiochatScheme string = "jiochat" // LineScheme is the scheme used for LINE identifiers LineScheme string = "line" // TelegramScheme is the scheme used for Telegram identifiers TelegramScheme string = "telegram" // TelScheme is the scheme used for telephone numbers TelScheme string = "tel" // TwitterIDScheme is the scheme used for Twitter user ids TwitterIDScheme string = "twitterid" // TwitterScheme is the scheme used for Twitter handles TwitterScheme string = "twitter" // ViberScheme is the scheme used for Viber identifiers ViberScheme string = "viber" // WhatsAppScheme is the scheme used for WhatsApp identifiers WhatsAppScheme string = "whatsapp" // FacebookRefPrefix is the path prefix used for facebook referral URNs FacebookRefPrefix string = "ref:" )
Variables ¶
var NilURN = URN("")
NilURN is our constant for nil URNs
var ValidSchemes = map[string]bool{ EmailScheme: true, ExternalScheme: true, FacebookScheme: true, FCMScheme: true, JiochatScheme: true, LineScheme: true, TelegramScheme: true, TelScheme: true, TwitterIDScheme: true, TwitterScheme: true, ViberScheme: true, WhatsAppScheme: true, }
ValidSchemes is the set of URN schemes understood by this library
Functions ¶
func IsValidScheme ¶
IsValidScheme checks whether the provided scheme is valid
Types ¶
type URN ¶
type URN string
URN represents a Universal Resource Name, we use this for contact identifiers like phone numbers etc..
func NewFacebookURN ¶
NewFacebookURN returns a URN for the passed in facebook identifier
func NewFirebaseURN ¶
NewFirebaseURN returns a URN for the passed in firebase identifier
func NewTelURNForCountry ¶
NewTelURNForCountry returns a URN for the passed in telephone number and country code ("US")
func NewTelegramURN ¶
NewTelegramURN returns a URN for the passed in telegram identifier
func NewURNFromParts ¶
NewURNFromParts returns a new URN for the given scheme, path and display
func NewWhatsAppURN ¶
NewWhatsAppURN returns a URN for the passed in whatsapp identifier
func (URN) Default ¶
func (u URN) Default() interface{}
Default is called when a URN is part of an excellent expression
func (URN) FacebookRef ¶
FacebookRef returns the facebook referral portion of our path, this return empty string in the case where we aren't a Facebook scheme
func (URN) IsFacebookRef ¶
IsFacebookRef returns whether this URN is a facebook referral
func (URN) Normalize ¶
Normalize normalizes the URN into it's canonical form and should be performed before URN comparisons