Skip to content

API Client and CLI app for numverify.com to verify phone number and list countries.

License

Notifications You must be signed in to change notification settings

grokify/gophonenumbers

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GoPhoneNumbers

Build Status Go Report Card Docs License

This library provides phone number information functionality including ability to access number look up APIs. It includes a Go client and CLI app for the Numverify API, and Twilio API.

https://numverify.com/documentation

Installation

Install Command
SDK only $ go get github.com/grokify/gophonenumbers
CLI only $ go get github.com/grokify/gophonenumbers/apps/numverify
SDK and CLI $ go get github.com/grokify/gophonenumbers/...

Usage

CLI App

Options Long Short Example
.env File --env -e -e=/path/to/.env
Access Token --token -t -t=<myToken>
Validate Number --number -n -n=<number>
List Countries --countries -c -c

Example Commands

$ numverify -e=/path/to/.env -n=+16505550100
$ numverify -t=<myToken> -n=+16505550100
$ numverify -e=/path/to/.env -c
$ numverify -t=<myToken> -c

SDK

Validate Number

import(
	nv "github.com/grokify/gophonenumbers/numverify"
)

func main() {
	client := nv.NumverifyClient{AccessKey: "myAccessKey"}

	apiSuccessInfo, apiErrorInfo, resp, err := client.Validate(
		nv.NumverifyParams{Number: number})

	[...]
}

Get Countries

import(
	nv "github.com/grokify/gophonenumbers/numverify"
)

func main() {
	client := nv.NumverifyClient{AccessKey: "myAccessKey"}

	countries, apiErrorInfo, resp, err := client.Countries()

	[...]
}