number

package
v0.0.0-...-421306c Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2024 License: BSD-2-Clause Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateBackorderDocument

func CreateBackorderDocument(c messagebird.Client, backOrderID string, req *CreateBackorderDocumentRequest) error

func CreateBackorderEndUserDetail

func CreateBackorderEndUserDetail(c messagebird.Client, backOrderID string, req *CreateBackorderEndUserDetailRequest) error

func Delete

func Delete(c messagebird.Client, phoneNumber string) error

Delete a purchased phone number

func DeleteNumberFromPool

func DeleteNumberFromPool(c messagebird.Client, poolName string, numbers []string) error

func DeletePool

func DeletePool(c messagebird.Client, poolName string) error

Types

type AddNumberToPollResult

type AddNumberToPollResult struct {
	Success []string
	Fail    []FailResult
}

func AddNumberToPool

func AddNumberToPool(c messagebird.Client, poolName string, numbers []string) (*AddNumberToPollResult, error)

type BackOrderID

type BackOrderID string

type Backorder

type Backorder struct {
	ID          string
	ProductID   int
	Country     string
	Prefix      string
	Status      string
	ReasonCodes []string
}

func ReadBackorder

func ReadBackorder(c messagebird.Client, backOrderID string) (*Backorder, error)

type BackorderDocument

type BackorderDocument struct {
	ID          int
	Name        string
	Description string
	Status      string
}

type BackorderDocuments

type BackorderDocuments struct {
	Limit, Count int
	Items        []*BackorderDocument
}

func ListBackorderDocuments

func ListBackorderDocuments(c messagebird.Client, backOrderID string) (*BackorderDocuments, error)

type CreateBackorderDocumentRequest

type CreateBackorderDocumentRequest struct {
	ID       int    `json:"id"`
	Name     string `json:"name"`
	MimeType string `json:"mimeType"`
	Content  string `json:"content"`
}

type CreateBackorderEndUserDetailRequest

type CreateBackorderEndUserDetailRequest struct {
	CompanyName  string
	Street       string
	StreetNumber string
	ZipCode      string
	City         string
	Country      string
}

type CreatePoolRequest

type CreatePoolRequest struct {
	PoolName      string             `json:"poolName"`
	Service       string             `json:"service"`
	Configuration *PoolConfiguration `json:"configuration"`
}

type EndUserDetail

type EndUserDetail struct {
	ID    string
	Label string
}

type EndUserDetails

type EndUserDetails struct {
	Items []*EndUserDetail
}

func ListBackorderEndUserDetails

func ListBackorderEndUserDetails(c messagebird.Client, backOrderID string) (*EndUserDetails, error)

type FailResult

type FailResult struct {
	Number, Error string
}

type Feature

type Feature string
const (
	FeatureSMS   Feature = "sms"
	FeatureVoice Feature = "voice"
	FeatureMMS   Feature = "mms"
)

type ListPoolNumbersRequest

type ListPoolNumbersRequest struct {
	Number string `json:"number,omitempty"`
	Limit  int    `json:"limit,omitempty"`
	Offset int    `json:"offset,omitempty"`
}

type ListPoolRequest

type ListPoolRequest struct {
	PoolName string `json:"poolName,omitempty"` // new pool name
	Service  string `json:"service,omitempty"`
	Limit    int    `json:"limit,omitempty"`
	Offset   int    `json:"offset,omitempty"`
}

type ListRequest

type ListRequest struct {
	Limit    int
	Offset   int
	Features []string // Possible values: sms, voice, mms.
	Tags     []string
	Number   string
	Region   string
	Locality string
	Type     string // Possible values: landline, mobile, premium_rate and toll_free.
}

ListRequest can be used to set query params in List().

func (*ListRequest) QueryParams

func (lr *ListRequest) QueryParams() string

type Number

type Number struct {
	Number                  string
	Country                 string
	Region                  string
	Locality                string
	Features                []Feature
	Tags                    []string
	Type                    Type
	Status                  string
	VerificationRequired    bool
	InitialContractDuration int
	InboundCallsOnly        bool
	MonthlyPrice            float64
	Currency                string
	Conditions              []string
	CreatedAt               *time.Time
	RenewalAt               *time.Time
}

Number represents a specific phone number.

func Purchase

func Purchase(c messagebird.Client, numberPurchaseRequest *PurchaseRequest) (*Number, error)

Purchase purchases a phone number.

func Read

func Read(c messagebird.Client, phoneNumber string) (*Number, error)

Read get a purchased phone number

func Update

func Update(c messagebird.Client, phoneNumber string, req *UpdateRequest) (*Number, error)

Update updates a purchased phone number. Only updating *tags* is supported at the moment.

type Numbers

type Numbers struct {
	Offset     int
	Limit      int
	Count      int
	TotalCount int
	Items      []*Number
}

Numbers provide a list of all purchased phone numbers.

func List

func List(c messagebird.Client, params *ListRequest) (*Numbers, error)

List fetches all purchased phone numbers

type NumbersSearching

type NumbersSearching struct {
	Items []*Number
	Limit int
	Count int
}

NumbersSearching provide a list of all phone numbers. that are available for purchase.

func Search(c messagebird.Client, countryCode string, params *SearchRequest) (*NumbersSearching, error)

Search for phone numbers available for purchase, countryCode needs to be in Alpha-2 country code (example: NL)

type PlaceBackorderRequest

type PlaceBackorderRequest struct {
	ProductID int    `json:"productID"`
	Prefix    string `json:"prefix"`
	Quantity  int    `json:"quantity"`
}

type Pool

type Pool struct {
	ID            string
	Name          string
	Service       string
	Configuration *PoolConfiguration
	NumbersCount  int
	CreatedAt     *time.Time
	UpdatedAt     *time.Time
}

func CreatePool

func CreatePool(c messagebird.Client, req *CreatePoolRequest) (*Pool, error)

func ReadPool

func ReadPool(c messagebird.Client, poolName string) (*Pool, error)

func UpdatePool

func UpdatePool(c messagebird.Client, poolName string, req *UpdatePoolRequest) (*Pool, error)

type PoolConfiguration

type PoolConfiguration struct {
	ByCountry bool `json:"byCountry"`
}

type PoolNumbers

type PoolNumbers struct {
	Limit, Offset, Count, TotalCount int
	Numbers                          []string
}

func ListPoolNumbers

func ListPoolNumbers(c messagebird.Client, poolName string, req *ListPoolNumbersRequest) (*PoolNumbers, error)

type Pools

type Pools struct {
	Limit, Offset, Count, TotalCount int
	Items                            []*Pool
}

func ListPool

func ListPool(c messagebird.Client, req *ListPoolRequest) (*Pools, error)

type Prefix

type Prefix struct {
	Prefix     string
	City       string
	StateProv  string
	PrefixType string
}

type Product

type Product struct {
	Country                     string
	NumberType                  string
	BackOrderLeadTime           string
	ReachableFromNationalFixed  bool
	ReachableFromNationalMobile bool
	ReachableFromPayPhone       bool
	VerificationRequired        bool
	InitialContractDuration     string
	Prefixes                    []*Prefix
	Remarks                     []string
	Conditions                  []string
	EndUserData                 []string
	ForbiddenContent            []string
}

func ReadProduct

func ReadProduct(c messagebird.Client, productID string) (*Product, error)

ReadProduct get a purchased phone number

type Products

type Products struct {
	Items []*ShortProduct
	Count int
	Limit int
}

func SearchProducts

func SearchProducts(c messagebird.Client, params *ProductsRequest) (*Products, error)

SearchProducts searches for unified communication phone numbers that are available for you to back order.

type ProductsRequest

type ProductsRequest struct {
	CountryCode string   `json:"countryCode"`
	Limit       int      `json:"limit"`
	Features    []string `json:"features"`
	Type        string   `json:"type"`
	Prefix      string   `json:"prefix"`
}

ProductsRequest can be used to set query params in SearchProducts().

func (*ProductsRequest) QueryParams

func (req *ProductsRequest) QueryParams() string

type PurchaseRequest

type PurchaseRequest struct {
	Number                string `json:"number"`
	Country               string `json:"countryCode"`
	BillingIntervalMonths int    `json:"billingIntervalMonths"`
}

PurchaseRequest can be used to purchase a number.

type SearchPattern

type SearchPattern string
const (
	// SearchPatternStart force phone numbers to start with the provided fragment.
	SearchPatternStart SearchPattern = "start"

	// SearchPatternEnd phone numbers can be somewhere within the provided fragment.
	SearchPatternEnd SearchPattern = "end"

	// SearchPatternAnyWhere force phone numbers to end with the provided fragment.
	SearchPatternAnyWhere SearchPattern = "anywhere"
)

type SearchRequest

type SearchRequest struct {
	Limit                             int
	Offset                            int
	Number                            string
	Country                           string
	Region                            string
	Locality                          string
	Features                          []string // Possible values: sms, voice, mms.
	Tags                              []string
	Type                              string // Possible values: landline, mobile, premium_rate and toll_free.
	Status                            string
	SearchPattern                     SearchPattern
	ExcludeNumbersRequireVerification bool // exclude_numbers_require_verification
	Prices                            bool
}

SearchRequest can be used to set query params in Search().

func (*SearchRequest) QueryParams

func (sr *SearchRequest) QueryParams() string

type ShortProduct

type ShortProduct struct {
	NumberType           string
	VerificationRequired bool
	Country              string
	ID                   int
	Currency             string
	Price                int
}

type Type

type Type string
const (
	TypeLandline    Type = "landline"
	TypeMobile      Type = "mobile"
	TypePremiumRate Type = "premium_rate"
	TypeTollFree    Type = "toll_free"
)

type UpdatePoolRequest

type UpdatePoolRequest struct {
	PoolName      string             `json:"poolName"` // new pool name
	Configuration *PoolConfiguration `json:"configuration"`
}

type UpdateRequest

type UpdateRequest struct {
	Tags []string `json:"tags"`
}

UpdateRequest can be used to set tags update.

Jump to

Keyboard shortcuts

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