verify

package
v0.0.0-...-32ef62a Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2022 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ContextOAuth2 takes an oauth2.TokenSource as authentication for the request.
	ContextOAuth2 = contextKey("token")

	// ContextBasicAuth takes BasicAuth as authentication for the request.
	ContextBasicAuth = contextKey("basic")

	// ContextAccessToken takes a string oauth2 access token as authentication for the request.
	ContextAccessToken = contextKey("accesstoken")

	// ContextAPIKey takes an APIKey as authentication for the request
	ContextAPIKey = contextKey("apikey")
)

Functions

func CacheExpires

func CacheExpires(r *http.Response) time.Time

CacheExpires helper function to determine remaining time before repeating a request.

Types

type APIClient

type APIClient struct {
	DefaultApi *DefaultApiService
	// contains filtered or unexported fields
}

APIClient manages communication with the Nexmo Verify API API v1.1.3 In most cases there should be only one, shared, APIClient.

func NewAPIClient

func NewAPIClient(cfg *Configuration) *APIClient

NewAPIClient creates a new API client. Requires a userAgent string describing your application. optionally a custom http.Client to allow for advanced features such as caching.

func (*APIClient) ChangeBasePath

func (c *APIClient) ChangeBasePath(path string)

ChangeBasePath changes base path to allow switching to mocks

func (*APIClient) GetConfig

func (c *APIClient) GetConfig() *Configuration

Allow modification of underlying config for alternate implementations and testing Caution: modifying the configuration while live can cause data races and potentially unwanted behavior

type APIKey

type APIKey struct {
	Key    string
	Prefix string
}

APIKey provides API key based authentication to a request passed via context using ContextAPIKey

type APIResponse

type APIResponse struct {
	*http.Response `json:"-"`
	Message        string `json:"message,omitempty"`
	// Operation is the name of the OpenAPI operation.
	Operation string `json:"operation,omitempty"`
	// RequestURL is the request URL. This value is always available, even if the
	// embedded *http.Response is nil.
	RequestURL string `json:"url,omitempty"`
	// Method is the HTTP method used for the request.  This value is always
	// available, even if the embedded *http.Response is nil.
	Method string `json:"method,omitempty"`
	// Payload holds the contents of the response body (which may be nil or empty).
	// This is provided here as the raw response.Body() reader will have already
	// been drained.
	Payload []byte `json:"-"`
}

APIResponse stores the API response returned by the server.

func NewAPIResponse

func NewAPIResponse(r *http.Response) *APIResponse

NewAPIResponse returns a new APIResonse object.

func NewAPIResponseWithError

func NewAPIResponseWithError(errorMessage string) *APIResponse

NewAPIResponseWithError returns a new APIResponse object with the provided error message.

type BasicAuth

type BasicAuth struct {
	UserName string `json:"userName,omitempty"`
	Password string `json:"password,omitempty"`
}

BasicAuth provides basic http authentication to a request passed via context using ContextBasicAuth

type CheckErrorResponse

type CheckErrorResponse struct {
	// The `request_id` that you received in the response to the Verify request and used in the Verify check request.
	RequestId string `json:"request_id,omitempty"`
	// Code | Text | Description -- | -- | -- 0 | Success | The request was successfully accepted by Nexmo. 1 | Throttled | You are trying to send more than the maximum of 30 requests per second. 2 | Your request is incomplete and missing the mandatory parameter `$parameter` | The stated parameter is missing. 3 | Invalid value for parameter `$parameter` | Invalid value for parameter. If you see Facility not allowed in the error text, check that you are using the correct Base URL in your request. 4 | Invalid credentials were provided | The supplied API key or secret in the request is either invalid or disabled. 5 | Internal Error | An error occurred processing this request in the Cloud Communications Platform. 6 | The Nexmo platform was unable to process this message for the following reason: `$reason` | The request could not be routed. 16 | The code inserted does not match the expected value | 17 | The wrong code was provided too many times | You can run Verify check on a specific `request_id` up to three times unless a new verification code is generated. If you check a request more than three times, it is set to FAILED and you cannot check it again.
	Status string `json:"status,omitempty"`
	// If the `status` is non-zero, this explains the error encountered.
	ErrorText string `json:"error_text,omitempty"`
}

CheckErrorResponse Error

type CheckRequest

type CheckRequest struct {
	// You can find your API key in your [account dashboard](https://dashboard.nexmo.com)
	ApiKey string `json:"api_key"`
	// You can find your API secret in your [account dashboard](https://dashboard.nexmo.com)
	ApiSecret string `json:"api_secret"`
	// The Verify request to check. This is the `request_id` you received in the response to the Verify request.
	RequestId string `json:"request_id"`
	// The verification code entered by your user.
	Code string `json:"code"`
	// (This field is no longer used)
	IpAddress string `json:"ip_address,omitempty"`
}

CheckRequest struct for CheckRequest

type CheckResponse

type CheckResponse struct {
	// The `request_id` that you received in the response to the Verify request and used in the Verify check request.
	RequestId string `json:"request_id,omitempty"`
	// The ID of the verification event, such as an SMS or TTS call.
	EventId string `json:"event_id,omitempty"`
	// A value of `0` indicates that your user entered the correct code. If it is non-zero, check the `error_text`.
	Status string `json:"status,omitempty"`
	// The cost incurred for this request.
	Price string `json:"price,omitempty"`
	// The currency code.
	Currency string `json:"currency,omitempty"`
	// This field may not be present, depending on your pricing model. The value indicates the cost (in EUR) of the calls made and messages sent for the verification process. This value may be updated during and shortly after the request completes because user input events can overlap with message/call events. When this field is present, the total cost of the verification is the sum of this field and the `price` field.
	EstimatedPriceMessagesSent string `json:"estimated_price_messages_sent,omitempty"`
}

CheckResponse Success

type Configuration

type Configuration struct {
	BasePath      string            `json:"basePath,omitempty"`
	Host          string            `json:"host,omitempty"`
	Scheme        string            `json:"scheme,omitempty"`
	DefaultHeader map[string]string `json:"defaultHeader,omitempty"`
	UserAgent     string            `json:"userAgent,omitempty"`
	Debug         bool              `json:"debug,omitempty"`
	Servers       []ServerConfiguration
	HTTPClient    *http.Client
}

Configuration stores the configuration of the API client

func NewConfiguration

func NewConfiguration() *Configuration

NewConfiguration returns a new Configuration object

func (*Configuration) AddDefaultHeader

func (c *Configuration) AddDefaultHeader(key string, value string)

AddDefaultHeader adds a new HTTP header to the default header in the request

func (*Configuration) ServerUrl

func (c *Configuration) ServerUrl(index int, variables map[string]string) (string, error)

ServerUrl returns URL based on server settings

type ControlErrorResponse

type ControlErrorResponse struct {
	// Code | Text | Description -- | -- | -- 0 | Success | The request was successfully accepted by Nexmo. 1 | Throttled | You are trying to send more than the maximum of 30 requests per second. 2 | Your request is incomplete and missing the mandatory parameter `$parameter` | The stated parameter is missing. 3 | Invalid value for parameter `$parameter` | Invalid value for parameter. If you see Facility not allowed in the error text, check that you are using the correct Base URL in your request. 4 | Invalid credentials were provided | The supplied API key or secret in the request is either invalid or disabled. 5 | Internal Error | An error occurred processing this request in the Cloud Communications Platform. 6 | The Nexmo platform was unable to process this message for the following reason: `$reason` | The request could not be routed. 8 | The api_key you supplied is for an account that has been barred from submitting messages. | 9 | Partner quota exceeded | Your account does not have sufficient credit to process this request. 19 | For `cancel`: Either you have not waited at least 30 secs after sending a Verify request before cancelling or Verify has made too many attempts to deliver the verification code for this request and you must now wait for the process to complete. For `trigger_next_event`: All attempts to deliver the verification code for this request have completed and there are no remaining events to advance to.
	Status string `json:"status,omitempty"`
	// If the `status` is non-zero, this explains the error encountered.
	ErrorText string `json:"error_text,omitempty"`
}

ControlErrorResponse Error

type ControlRequest

type ControlRequest struct {
	// You can find your API key in your [account dashboard](https://dashboard.nexmo.com)
	ApiKey string `json:"api_key"`
	// You can find your API secret in your [account dashboard](https://dashboard.nexmo.com)
	ApiSecret string `json:"api_secret"`
	// The `request_id` you received in the response to the Verify request.
	RequestId string `json:"request_id"`
	// The possible commands are `cancel` to request cancellation of the verification process, or `trigger_next_event` to advance  to the next verification event (if any). Cancellation is only possible 30 seconds after the start of the verification request and before the second event (either TTS or SMS) has taken place.
	Cmd string `json:"cmd"`
}

ControlRequest struct for ControlRequest

type ControlResponse

type ControlResponse struct {
	// `cmd` | Code | Description -- | -- | -- Any | 0 | Success
	Status string `json:"status,omitempty"`
	// The `cmd` you sent in the request.
	Command string `json:"command,omitempty"`
}

ControlResponse Success

type DefaultApiService

type DefaultApiService service

DefaultApiService DefaultApi service

func (*DefaultApiService) VerifyCheck

func (a *DefaultApiService) VerifyCheck(ctx _context.Context, format string, apiKey string, apiSecret string, requestId string, code string, localVarOptionals *VerifyCheckOpts) (CheckResponse, *_nethttp.Response, error)

VerifyCheck Verify Check Use Verify check to confirm that the PIN you received from your user matches the one sent by Nexmo in your Verify request. 1. Send the verification `code` that your user supplied, with the corresponding `request_id` from the Verify request. 2. Check the `status` of the response to determine if the code the user supplied matches the one sent by Nexmo. *Note that this endpoint is available by `GET` request as well as `POST`.*

  • @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param format The response format.
  • @param apiKey You can find your API key in your [account dashboard](https://dashboard.nexmo.com)
  • @param apiSecret You can find your API secret in your [account dashboard](https://dashboard.nexmo.com)
  • @param requestId The Verify request to check. This is the `request_id` you received in the response to the Verify request.
  • @param code The verification code entered by your user.
  • @param optional nil or *VerifyCheckOpts - Optional Parameters:
  • @param "IpAddress" (optional.String) - (This field is no longer used)

@return CheckResponse

func (*DefaultApiService) VerifyControl

func (a *DefaultApiService) VerifyControl(ctx _context.Context, format string, apiKey string, apiSecret string, requestId string, cmd string) (ControlResponse, *_nethttp.Response, error)

VerifyControl Verify Control Control the progress of your Verify requests. To cancel an existing Verify request, or to trigger the next verification event: 1. Send a Verify control request with the appropriate command (`cmd`) for what you want to achieve. 2. Check the `status` in the response. *Note that this endpoint is available by `GET` request as well as `POST`.*

  • @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param format The response format.
  • @param apiKey You can find your API key in your [account dashboard](https://dashboard.nexmo.com)
  • @param apiSecret You can find your API secret in your [account dashboard](https://dashboard.nexmo.com)
  • @param requestId The `request_id` you received in the response to the Verify request.
  • @param cmd The possible commands are `cancel` to request cancellation of the verification process, or `trigger_next_event` to advance to the next verification event (if any). Cancellation is only possible 30 seconds after the start of the verification request and before the second event (either TTS or SMS) has taken place.

@return ControlResponse

func (*DefaultApiService) VerifyRequest

func (a *DefaultApiService) VerifyRequest(ctx _context.Context, format string, apiKey string, apiSecret string, number string, brand string, localVarOptionals *VerifyRequestOpts) (RequestResponse, *_nethttp.Response, error)

VerifyRequest Request a Verification Use Verify request to generate and send a PIN to your user: 1. Create a request to send a verification code to your user. 2. Check the `status` field in the response to ensure that your request was successful (zero is success). 3. Use the `request_id` field in the response for the Verify check. *Note that this endpoint is available by `GET` request as well as `POST`.*

  • @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param format The response format.
  • @param apiKey You can find your API key in your [account dashboard](https://dashboard.nexmo.com)
  • @param apiSecret You can find your API secret in your [account dashboard](https://dashboard.nexmo.com)
  • @param number The mobile or landline phone number to verify. Unless you are setting `country` explicitly, this number must be in [E.164](https://en.wikipedia.org/wiki/E.164) format.
  • @param brand An 18-character alphanumeric string you can use to personalize the verification request SMS body, to help users identify your company or application name. For example: \\\"Your `Acme Inc` PIN is ...\\\"
  • @param optional nil or *VerifyRequestOpts - Optional Parameters:
  • @param "Country" (optional.String) - If you do not provide `number` in international format or you are not sure if `number` is correctly formatted, specify the two-character country code in `country`. Verify will then format the number for you.
  • @param "SenderId" (optional.String) - An 11-character alphanumeric string that represents the [identity of the sender](https://developer.nexmo.com/messaging/sms/guides/custom-sender-id) of the verification request. Depending on the destination of the phone number you are sending the verification SMS to, restrictions might apply.
  • @param "CodeLength" (optional.Int32) - The length of the verification code.
  • @param "Lg" (optional.String) - By default, the SMS or text-to-speech (TTS) message is generated in the locale that matches the `number`. For example, the text message or TTS message for a `33*` number is sent in French. Use this parameter to explicitly control the language used for the Verify request. A list of languages is available: <https://developer.nexmo.com/verify/guides/verify-languages>
  • @param "PinExpiry" (optional.Int32) - How long the generated verification code is valid for, in seconds. When you specify both `pin_expiry` and `next_event_wait` then `pin_expiry` must be an integer multiple of `next_event_wait` otherwise `pin_expiry` is defaulted to equal next_event_wait. See [changing the event timings](https://developer.nexmo.com/verify/guides/changing-default-timings).
  • @param "NextEventWait" (optional.Int32) - Specifies the wait time in seconds between attempts to deliver the verification code.
  • @param "WorkflowId" (optional.Int32) - Selects the predefined sequence of SMS and TTS (Text To Speech) actions to use in order to convey the PIN to your user. For example, an id of 1 identifies the workflow SMS - TTS - TTS. For a list of all workflows and their associated ids, please visit the [developer portal](https://developer.nexmo.com/verify/guides/workflows-and-events).

@return RequestResponse

func (*DefaultApiService) VerifyRequestWithPSD2

func (a *DefaultApiService) VerifyRequestWithPSD2(ctx _context.Context, format string, apiKey string, apiSecret string, number string, payee string, amount float32, localVarOptionals *VerifyRequestWithPSD2Opts) (RequestResponse, *_nethttp.Response, error)

VerifyRequestWithPSD2 PSD2 (Payment Services Directive 2) Request Use Verify request to generate and send a PIN to your user to authorize a payment: 1. Create a request to send a verification code to your user. 2. Check the &#x60;status&#x60; field in the response to ensure that your request was successful (zero is success). 3. Use the &#x60;request_id&#x60; field in the response for the Verify check. (Please note that XML format is not supported for the Payment Services Directive endpoint at this time.)

  • @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param format The response format.
  • @param apiKey You can find your API key in your [account dashboard](https://dashboard.nexmo.com)
  • @param apiSecret You can find your API secret in your [account dashboard](https://dashboard.nexmo.com)
  • @param number The mobile or landline phone number to verify. Unless you are setting `country` explicitly, this number must be in [E.164](https://en.wikipedia.org/wiki/E.164) format.
  • @param payee An alphanumeric string to indicate to the user the name of the recipient that they are confirming a payment to.
  • @param amount The decimal amount of the payment to be confirmed, in Euros
  • @param optional nil or *VerifyRequestWithPSD2Opts - Optional Parameters:
  • @param "Country" (optional.String) - If you do not provide `number` in international format or you are not sure if `number` is correctly formatted, specify the two-character country code in `country`. Verify will then format the number for you.
  • @param "CodeLength" (optional.Int32) - The length of the verification code.
  • @param "Lg" (optional.String) - By default, the SMS or text-to-speech (TTS) message is generated in the locale that matches the `number`. For example, the text message or TTS message for a `33*` number is sent in French. Use this parameter to explicitly control the language used. *Note: Voice calls in English for `bg-bg`, `ee-et`, `ga-ie`, `lv-lv`, `lt-lt`, `mt-mt`, `sk-sk`, `sk-si`
  • @param "PinExpiry" (optional.Int32) - How long the generated verification code is valid for, in seconds. When you specify both `pin_expiry` and `next_event_wait` then `pin_expiry` must be an integer multiple of `next_event_wait` otherwise `pin_expiry` is defaulted to equal next_event_wait. See [changing the event timings](https://developer.nexmo.com/verify/guides/changing-default-timings).
  • @param "NextEventWait" (optional.Int32) - Specifies the wait time in seconds between attempts to deliver the verification code.
  • @param "WorkflowId" (optional.Int32) - Selects the predefined sequence of SMS and TTS (Text To Speech) actions to use in order to convey the PIN to your user. For example, an id of 1 identifies the workflow SMS - TTS - TTS. For a list of all workflows and their associated ids, please visit the [developer portal](https://developer.nexmo.com/verify/guides/workflows-and-events).

@return RequestResponse

func (*DefaultApiService) VerifySearch

func (a *DefaultApiService) VerifySearch(ctx _context.Context, format string, apiKey string, apiSecret string, localVarOptionals *VerifySearchOpts) (SearchResponse, *_nethttp.Response, error)

VerifySearch Verify Search Use Verify search to check the status of past or current verification requests: 1. Send a Verify search request containing the &#x60;request_id&#x60;s of the verification requests you are interested in. 2. Use the &#x60;status&#x60; of each verification request in the &#x60;checks&#x60; array of the response object to determine the outcome. *Note that this endpoint is available by &#x60;POST&#x60; request as well as &#x60;GET&#x60;.*

  • @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param format The response format.
  • @param apiKey
  • @param apiSecret
  • @param optional nil or *VerifySearchOpts - Optional Parameters:
  • @param "RequestId" (optional.String) - The `request_id` you received in the Verify Request Response.
  • @param "RequestIds" (optional.Interface of []string) - More than one `request_id`. Each `request_id` is a new parameter in the Verify Search request.

@return SearchResponse

type GenericOpenAPIError

type GenericOpenAPIError struct {
	// contains filtered or unexported fields
}

GenericOpenAPIError Provides access to the body, error and model on returned errors.

func (GenericOpenAPIError) Body

func (e GenericOpenAPIError) Body() []byte

Body returns the raw bytes of the response

func (GenericOpenAPIError) Error

func (e GenericOpenAPIError) Error() string

Error returns non-empty string if there was an error.

func (GenericOpenAPIError) Model

func (e GenericOpenAPIError) Model() interface{}

Model returns the unpacked model of the error

type Psd2Request

type Psd2Request struct {
	// You can find your API key in your [account dashboard](https://dashboard.nexmo.com)
	ApiKey string `json:"api_key"`
	// You can find your API secret in your [account dashboard](https://dashboard.nexmo.com)
	ApiSecret string `json:"api_secret"`
	// The mobile or landline phone number to verify. Unless you are setting `country` explicitly, this number must be in [E.164](https://en.wikipedia.org/wiki/E.164) format.
	Number string `json:"number"`
	// If you do not provide `number` in international format or you are not sure if `number` is correctly formatted, specify the two-character country code in `country`. Verify will then format the number for you.
	Country string `json:"country,omitempty"`
	// An alphanumeric string to indicate to the user the name of the recipient that they are confirming a payment to.
	Payee string `json:"payee"`
	// The decimal amount of the payment to be confirmed, in Euros
	Amount float32 `json:"amount"`
	// The length of the verification code.
	CodeLength int32 `json:"code_length,omitempty"`
	// By default, the SMS or text-to-speech (TTS) message is generated in the locale that matches the `number`. For example, the text message or TTS message for a `33*` number is sent in French. Use this parameter to explicitly control the language used. *Note: Voice calls in English for `bg-bg`, `ee-et`, `ga-ie`, `lv-lv`, `lt-lt`, `mt-mt`, `sk-sk`, `sk-si`
	Lg string `json:"lg,omitempty"`
	// How long the generated verification code is valid for, in seconds. When you specify both `pin_expiry` and `next_event_wait` then `pin_expiry` must be an integer multiple of `next_event_wait` otherwise `pin_expiry` is defaulted to equal next_event_wait. See [changing the event timings](https://developer.nexmo.com/verify/guides/changing-default-timings).
	PinExpiry int32 `json:"pin_expiry,omitempty"`
	// Specifies the wait time in seconds between attempts to deliver the verification code.
	NextEventWait int32 `json:"next_event_wait,omitempty"`
	// Selects the predefined sequence of SMS and TTS (Text To Speech) actions to use in order to convey the PIN to your user. For example, an id of 1 identifies the workflow SMS - TTS - TTS. For a list of all workflows and their associated ids, please visit the [developer portal](https://developer.nexmo.com/verify/guides/workflows-and-events).
	WorkflowId int32 `json:"workflow_id,omitempty"`
}

Psd2Request struct for Psd2Request

type RequestErrorResponse

type RequestErrorResponse struct {
	// The unique ID of the Verify request. This may be blank in an error situation
	RequestId string `json:"request_id,omitempty"`
	// Code | Text | Description -- | -- | -- 0 | Success | The request was successfully accepted by Nexmo. 1 | Throttled | You are trying to send more than the maximum of 30 requests per second. 2 | Your request is incomplete and missing the mandatory parameter `$parameter` | The stated parameter is missing. 3 | Invalid value for parameter `$parameter` | Invalid value for parameter. If you see Facility not allowed in the error text, check that you are using the correct Base URL in your request. 4 | Invalid credentials were provided | The supplied API key or secret in the request is either invalid or disabled. 5 | Internal Error | An error occurred processing this request in the Cloud Communications Platform. 6 | The Nexmo platform was unable to process this message for the following reason: `$reason` | The request could not be routed. 7 | The number you are trying to verify is blacklisted for verification. | 8 | The api_key you supplied is for an account that has been barred from submitting messages. | 9 | Partner quota exceeded | Your account does not have sufficient credit to process this request. 10 | Concurrent verifications to the same number are not allowed | 15 | The destination number is not in a supported network | The request has been rejected. Find out more about this error in the [Knowledge Base](https://help.nexmo.com/hc/en-us/articles/360018406532-Verify-On-demand-Service-to-High-Risk-Countries) 20 | This account does not support the parameter: pin_code. | Only certain accounts have the ability to set the `pin_code`. Please contact your account manager for more information.
	Status string `json:"status,omitempty"`
	// If `status` is non-zero, this explains the error encountered.
	ErrorText string `json:"error_text,omitempty"`
}

RequestErrorResponse Error

type RequestResponse

type RequestResponse struct {
	// The unique ID of the Verify request. You need this `request_id` for the Verify check.
	RequestId string `json:"request_id,omitempty"`
	// Indicates the outcome of the request; zero is success
	Status string `json:"status,omitempty"`
}

RequestResponse Success

type SearchErrorResponse

type SearchErrorResponse struct {
	// The `request_id` that you received in the response to the Verify request and used in the Verify search request. May be empty in an error situation.
	RequestId string `json:"request_id,omitempty"`
	// Code | Description -- | -- IN PROGRESS | The search is still in progress. SUCCESS | Your user entered a correct verification code. FAILED | Your user entered an incorrect code more than three times. EXPIRED | Your user did not enter a code before the `pin_expiry` time elapsed. CANCELLED | The verification process was cancelled by a Verify control request. 101 | You supplied an invalid `request_id`, or the data is not available. Note that for recently-completed requests, there can be a delay of up to 1 minute before the results are available in search.
	Status string `json:"status,omitempty"`
	// If `status` is not `SUCCESS`, this message explains the issue encountered.
	ErrorText string `json:"error_text,omitempty"`
}

SearchErrorResponse Error

type SearchResponse

type SearchResponse struct {
	// The `request_id` that you received in the response to the Verify request and used in the Verify search request.
	RequestId string `json:"request_id,omitempty"`
	// The Nexmo account ID the request was for.
	AccountId string `json:"account_id,omitempty"`
	// Code | Description -- | -- IN PROGRESS | The search is still in progress. SUCCESS | Your user entered a correct verification code. FAILED | Your user entered an incorrect code more than three times. EXPIRED | Your user did not enter a code before the `pin_expiry` time elapsed. CANCELLED | The verification process was cancelled by a Verify control request.
	Status string `json:"status,omitempty"`
	// The phone number this verification request was used for.
	Number string `json:"number,omitempty"`
	// The cost incurred for this verification request.
	Price string `json:"price,omitempty"`
	// The currency code.
	Currency string `json:"currency,omitempty"`
	// The `sender_id` you provided in the Verify request.
	SenderId string `json:"sender_id,omitempty"`
	// The date and time the verification request was submitted, in the following format YYYY-MM-DD HH:MM:SS.
	DateSubmitted string `json:"date_submitted,omitempty"`
	// The date and time the verification request was completed. This response parameter is in the following format YYYY-MM-DD HH:MM:SS.
	DateFinalized string `json:"date_finalized,omitempty"`
	// The time the first verification attempt was made, in the following format YYYY-MM-DD HH:MM:SS.
	FirstEventDate string `json:"first_event_date,omitempty"`
	// The time the last verification attempt was made, in the following format YYYY-MM-DD HH:MM:SS.
	LastEventDate string `json:"last_event_date,omitempty"`
	// The list of checks made for this verification and their outcomes.
	Checks []SearchResponseChecks `json:"checks,omitempty"`
	// The events that have taken place to verify this number, and their unique identifiers.
	Events []SearchResponseEvents `json:"events,omitempty"`
	// This field may not be present, depending on your pricing model. The value indicates the cost (in EUR) of the calls made and messages sent for the verification process. This value may be updated during and shortly after the request completes because user input events can overlap with message/call events. When this field is present, the total cost of the verification is the sum of this field and the `price` field.
	EstimatedPriceMessagesSent string `json:"estimated_price_messages_sent,omitempty"`
}

SearchResponse Success

type SearchResponseChecks

type SearchResponseChecks struct {
	// The date and time this check was received (in the format YYYY-MM-DD HH:MM:SS)
	DateReceived string `json:"date_received,omitempty"`
	// The code supplied with this check request
	Code   string `json:"code,omitempty"`
	Status string `json:"status,omitempty"`
	// The IP address, if available (this field is no longer used).
	IpAddress string `json:"ip_address,omitempty"`
}

SearchResponseChecks struct for SearchResponseChecks

type SearchResponseEvents

type SearchResponseEvents struct {
	Type string `json:"type,omitempty"`
	Id   string `json:"id,omitempty"`
}

SearchResponseEvents struct for SearchResponseEvents

type ServerConfiguration

type ServerConfiguration struct {
	Url         string
	Description string
	Variables   map[string]ServerVariable
}

ServerConfiguration stores the information about a server

type ServerVariable

type ServerVariable struct {
	Description  string
	DefaultValue string
	EnumValues   []string
}

ServerVariable stores the information about a server variable

type VerifyCheckOpts

type VerifyCheckOpts struct {
	IpAddress optional.String
}

VerifyCheckOpts Optional parameters for the method 'VerifyCheck'

type VerifyRequest

type VerifyRequest struct {
	// You can find your API key in your [account dashboard](https://dashboard.nexmo.com)
	ApiKey string `json:"api_key"`
	// You can find your API secret in your [account dashboard](https://dashboard.nexmo.com)
	ApiSecret string `json:"api_secret"`
	// The mobile or landline phone number to verify. Unless you are setting `country` explicitly, this number must be in [E.164](https://en.wikipedia.org/wiki/E.164) format.
	Number string `json:"number"`
	// If you do not provide `number` in international format or you are not sure if `number` is correctly formatted, specify the two-character country code in `country`. Verify will then format the number for you.
	Country string `json:"country,omitempty"`
	// An 18-character alphanumeric string you can use to personalize the verification request SMS body, to help users identify your company or application name. For example: \"Your `Acme Inc` PIN is ...\"
	Brand string `json:"brand"`
	// An 11-character alphanumeric string that represents the [identity of the sender](https://developer.nexmo.com/messaging/sms/guides/custom-sender-id) of the verification request. Depending on the destination of the phone number you are sending the verification SMS to, restrictions might apply.
	SenderId string `json:"sender_id,omitempty"`
	// The length of the verification code.
	CodeLength int32 `json:"code_length,omitempty"`
	// By default, the SMS or text-to-speech (TTS) message is generated in the locale that matches the `number`. For example, the text message or TTS message for a `33*` number is sent in French. Use this parameter to explicitly control the language used for the Verify request. A list of languages is available: <https://developer.nexmo.com/verify/guides/verify-languages>
	Lg string `json:"lg,omitempty"`
	// How long the generated verification code is valid for, in seconds. When you specify both `pin_expiry` and `next_event_wait` then `pin_expiry` must be an integer multiple of `next_event_wait` otherwise `pin_expiry` is defaulted to equal next_event_wait. See [changing the event timings](https://developer.nexmo.com/verify/guides/changing-default-timings).
	PinExpiry int32 `json:"pin_expiry,omitempty"`
	// Specifies the wait time in seconds between attempts to deliver the verification code.
	NextEventWait int32 `json:"next_event_wait,omitempty"`
	// Selects the predefined sequence of SMS and TTS (Text To Speech) actions to use in order to convey the PIN to your user. For example, an id of 1 identifies the workflow SMS - TTS - TTS. For a list of all workflows and their associated ids, please visit the [developer portal](https://developer.nexmo.com/verify/guides/workflows-and-events).
	WorkflowId int32 `json:"workflow_id,omitempty"`
}

VerifyRequest struct for VerifyRequest

type VerifyRequestOpts

type VerifyRequestOpts struct {
	Country       optional.String
	SenderId      optional.String
	CodeLength    optional.Int32
	Lg            optional.String
	PinExpiry     optional.Int32
	NextEventWait optional.Int32
	WorkflowId    optional.Int32
}

VerifyRequestOpts Optional parameters for the method 'VerifyRequest'

type VerifyRequestWithPSD2Opts

type VerifyRequestWithPSD2Opts struct {
	Country       optional.String
	CodeLength    optional.Int32
	Lg            optional.String
	PinExpiry     optional.Int32
	NextEventWait optional.Int32
	WorkflowId    optional.Int32
}

VerifyRequestWithPSD2Opts Optional parameters for the method 'VerifyRequestWithPSD2'

type VerifySearchOpts

type VerifySearchOpts struct {
	RequestId  optional.String
	RequestIds optional.Interface
}

VerifySearchOpts Optional parameters for the method 'VerifySearch'

Jump to

Keyboard shortcuts

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