uri

package
v0.0.0-...-3bed8bd Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2024 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	POIntlNumber ParsingOption = 1 << iota
	POAlphanumericSenderID
	POShortcodes
	POEmail
	PONationalNumber
	POGroupUUID
	POGroupParticipantHash

	// ParseIncomingSMSForward allows parsing user identifiers that are valid senders of incoming SMS.
	ParseIncomingSMSForward = POIntlNumber | POAlphanumericSenderID | POShortcodes | POEmail
	// ParseOutgoingSMSForward allows parsing user identifiers that can be sent SMS. Emails are intentionally excluded.
	ParseOutgoingSMSForward = POIntlNumber | POShortcodes
	// ParseiMessageDM allows parsing user identifiers that can be sent messages on iMessage.
	ParseiMessageDM = POIntlNumber | POEmail
	// ParseiMessageGroup allows parsing iMessage group identifiers.
	ParseiMessageGroup = POGroupUUID | POGroupParticipantHash
	// ParseAnyChat parses any reasonably normal identifier in a chat,
	// i.e. all parsing options except international without prefix
	ParseAnyChat = ParseiMessageDM | ParseiMessageGroup | POAlphanumericSenderID | POShortcodes
)

Variables

View Source
var ErrMissingColon = errors.New("invalid URI (missing `:`)")

Functions

func Compare

func Compare(a, b ParsedURI) int

func IsOnlyNumbers

func IsOnlyNumbers(s string) bool

func ToIdentifierStringSlice

func ToIdentifierStringSlice(handles []ParsedURI) []string

func ToStringSlice

func ToStringSlice(handles []ParsedURI) []string

func ToZerologArray

func ToZerologArray(handles []ParsedURI) *zerolog.Array

Types

type ParsedURI

type ParsedURI struct {
	Scheme     Scheme
	Identifier string
}
var EmptyURI ParsedURI

func ParseIdentifier

func ParseIdentifier(identifier string, opts ParsingOption) (ParsedURI, error)

func ParseIdentifierWithLocalNumbers

func ParseIdentifierWithLocalNumbers(identifier string, opts ParsingOption, nationalNumberRegion string) (ParsedURI, error)

func ParseURI

func ParseURI(uri string) (ParsedURI, error)

func ParseURIBytes

func ParseURIBytes(uri []byte) (ParsedURI, error)

func Sort

func Sort(handles []ParsedURI) []ParsedURI

func (*ParsedURI) IsEmpty

func (pu *ParsedURI) IsEmpty() bool

func (*ParsedURI) IsShortcode

func (uri *ParsedURI) IsShortcode() bool

func (*ParsedURI) MarshalPlist

func (pu *ParsedURI) MarshalPlist() (any, error)

func (*ParsedURI) MarshalText

func (pu *ParsedURI) MarshalText() ([]byte, error)

func (*ParsedURI) Scan

func (pu *ParsedURI) Scan(i interface{}) error

func (*ParsedURI) String

func (pu *ParsedURI) String() string

func (*ParsedURI) StringPtr

func (pu *ParsedURI) StringPtr() *string

func (*ParsedURI) UnmarshalPlist

func (pu *ParsedURI) UnmarshalPlist(unmarshal func(any) error) error

func (*ParsedURI) UnmarshalText

func (pu *ParsedURI) UnmarshalText(text []byte) (err error)

func (ParsedURI) Value

func (pu ParsedURI) Value() (driver.Value, error)

type ParsingOption

type ParsingOption uint

type PlainURI

type PlainURI string

func (PlainURI) Parse

func (uri PlainURI) Parse() (ParsedURI, error)

type Scheme

type Scheme string
const (
	SchemeTel               Scheme = "tel"
	SchemeMailto            Scheme = "mailto"
	SchemeGroup             Scheme = "group"
	SchemeGroupParticipants Scheme = "group-participants"
)

func (Scheme) Order

func (s Scheme) Order() int

Jump to

Keyboard shortcuts

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