This object offers several helper methods for working with the response from the API. Every time an API request is completed (successfully or erroneously) a new Result
object is created.
response
This property contains the object returned by the API.
getResult()
This method returns the text based result code returned by the API. The same as doing this.response.result
.
getNumericCode()
This method returns the integer code for the result returned by the API.
getTransactionId()
This will return the transaction id for this request. It can be used to confirm the data was verified with the confirm endpoint.
getConfirmationToken()
This will return the confirmation token for this request. It can be used to confirm the data was verified with the confirm endpoint.
getFlags()
This will return the array of flags contained in the API response.
hasFlag(flag)
This will return true if the given flag is present in the API response.
isError()
This method will return true if the request failed or if the API returned an error. Otherwise, this method will return false.
isThrottled()
This method will return true if the verification request was throttled.
isFreemail()
This will return true if the free_email_host flag is present
isRoleAccount()
This will return if the role_account flag is present
is(codes)
This method will return true if the verification result is equal to the specified code(s). It accepts both text and numeric result codes either as a single code or as an array of codes.
result.is('valid'); // Returns true if the result is 'valid'
result.is(0); // Returns true if the result is 'valid'
result.is(['valid','catchall']); // Returns true if the result is either 'valid' or 'catchall'
result.is([0,3]); // Returns true if the result is either 'valid' or 'catchall'
not(codes)
This method will return true if the verification result differs than the specified code(s). It accepts both text and numeric result codes either as a single code or as an array of codes.
result.not('invalid'); // Returns true if result anything but 'invalid'
result.not(1); // Returns true if result anything but 'invalid'
result.not(['invalid','disposable']); // Returns true if result anything other than 'invalid' or 'disposable'
result.not([1,2]); // Returns true if result anything other than 'invalid' or 'disposable'