Phone

world.id.phone$package.Phone
object Phone

Parsing, presentation, and the mobile-range advisory for Phone.

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type
Phone.type

Members list

Type members

Classlikes

sealed abstract class Invalid(message: String) extends WorldError

Why a number was refused, each case carrying the input as typed. Parsing gates on the character set, the calling code and the lengths the plan admits, and on nothing else: a number in a range that is unallocated today, or that this library's data has not caught up with, is still accepted, because refusing a real number costs a customer while accepting an unreachable one costs one failed call.

Why a number was refused, each case carrying the input as typed. Parsing gates on the character set, the calling code and the lengths the plan admits, and on nothing else: a number in a range that is unallocated today, or that this library's data has not caught up with, is still accepted, because refusing a real number costs a customer while accepting an unreachable one costs one failed call.

Attributes

Companion
object
Supertypes
class WorldError
class TypedError
trait NoStackTrace
class Exception
class Throwable
trait Serializable
class Object
trait Matchable
class Any
Show all
Known subtypes
class Characters
class Code
class TooLong
class TooShort
object Invalid

Attributes

Companion
class
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type
Invalid.type

Value members

Concrete methods

def parse(raw: String): Either[Invalid, Phone]

Parses a number written in international form, + or 00 prefixed.

Parses a number written in international form, + or 00 prefixed.

Attributes

def parse(raw: String, home: Territory): Either[Invalid, Phone]

Parses a number written either way, reading a national one as home dials it.

Parses a number written either way, reading a national one as home dials it.

Attributes

Concrete fields

val vintage: String

The upstream release the numbering data was compiled from, for a support trail to record beside whatever Phone.mobile answered.

The upstream release the numbering data was compiled from, for a support trail to record beside whatever Phone.mobile answered.

Attributes

Givens

Givens

given given_Ordering_Phone: Ordering[Phone]

Extensions

Extensions

extension (p: Phone)
def code: Int

The country calling code.

The country calling code.

Attributes

def international: String

The number as it is written for an international audience, +254 712 345678.

The number as it is written for an international audience, +254 712 345678.

Attributes

def mobile: Boolean

Whether the number falls in a mobile range at the data's Phone.vintage - what to ask before offering an SMS or mobile-money rail. Treat it as advice and not proof: ranges move, and where a plan publishes its mobile and fixed ranges as one, as the North American plan does, every number answers true.

Whether the number falls in a mobile range at the data's Phone.vintage - what to ask before offering an SMS or mobile-money rail. Treat it as advice and not proof: ranges move, and where a plan publishes its mobile and fixed ranges as one, as the North American plan does, every number answers true.

Attributes

def national: String

The number as it is dialled inside its own country, 0712 345678. A length the plan admits but no presentation rule covers falls back to the trunk prefix and the digits, which still dials.

The number as it is dialled inside its own country, 0712 345678. A length the plan admits but no presentation rule covers falls back to the trunk prefix and the digits, which still dials.

Attributes

def territory: Option[Territory]

The territory the number belongs to, or None where its calling code spans several - naming one of the forty in the North American plan would be invention.

The territory the number belongs to, or None where its calling code spans several - naming one of the forty in the North American plan would be invention.

Attributes

def value: String

The E.164 string: what to store, send and index on.

The E.164 string: what to store, send and index on.

Attributes