NeutrinoAPI-GoLang

module
v3.4.5+incompatible Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2019 License: MIT

README

Getting started

The general-purpose API

Initialization

Authentication

In order to setup authentication of the API client, you need the following information.

Parameter Description
userId Your user ID
apiKey Your API key

To configure these for your generated code, open the file "Configuration.go" and edit it's contents.

Class Reference

List of Controllers

imaging_pkg

Get instance

Factory for the IMAGING interface can be accessed from the package imaging_pkg.

imaging := imaging_pkg.NewIMAGING()
ImageResize

Resize an image and output as either JPEG or PNG. See: https://www.neutrinoapi.com/api/image-resize/

func (me *IMAGING_IMPL) ImageResize(
            imageUrl string,
            width int64,
            height int64,
            format *string)([]byte,error)
Parameters
Parameter Tags Description
imageUrl Required The URL to the source image
width Required The width to resize to (in px) while preserving aspect ratio
height Required The height to resize to (in px) while preserving aspect ratio
format Optional DefaultValue The output image format, can be either png or jpg
Example Usage
imageUrl := "image-url"
width,_ := strconv.ParseInt("214", 10, 8)
height,_ := strconv.ParseInt("214", 10, 8)
format := "png"

var result []byte
result,_ = imaging.ImageResize(imageUrl, width, height, format)

QRCode

Generate a QR code as a PNG image. See: https://www.neutrinoapi.com/api/qr-code/

func (me *IMAGING_IMPL) QRCode(
            content string,
            width *int64,
            height *int64,
            fgColor *string,
            bgColor *string)([]byte,error)
Parameters
Parameter Tags Description
content Required The content to encode into the QR code (e.g. a URL or a phone number)
width Optional DefaultValue The width of the QR code (in px)
height Optional DefaultValue The height of the QR code (in px)
fgColor Optional DefaultValue The QR code foreground color
bgColor Optional DefaultValue The QR code background color
Example Usage
content := "content"
width,_ := strconv.ParseInt("256", 10, 8)
height,_ := strconv.ParseInt("256", 10, 8)
fgColor := "#000000"
bgColor := "#ffffff"

var result []byte
result,_ = imaging.QRCode(content, width, height, fgColor, bgColor)

ImageWatermark

Watermark one image with another image. See: https://www.neutrinoapi.com/api/image-watermark/

func (me *IMAGING_IMPL) ImageWatermark(
            imageUrl string,
            watermarkUrl string,
            opacity *int64,
            format *string,
            position *string,
            width *int64,
            height *int64)([]byte,error)
Parameters
Parameter Tags Description
imageUrl Required The URL to the source image
watermarkUrl Required The URL to the watermark image
opacity Optional DefaultValue The opacity of the watermark (0 to 100)
format Optional DefaultValue The output image format, can be either png or jpg
position Optional DefaultValue The position of the watermark image, possible values are: center, top-left, top-center, top-right, bottom-left, bottom-center, bottom-right
width Optional If set resize the resulting image to this width (in px) while preserving aspect ratio
height Optional If set resize the resulting image to this height (in px) while preserving aspect ratio
Example Usage
imageUrl := "image-url"
watermarkUrl := "watermark-url"
opacity,_ := strconv.ParseInt("50", 10, 8)
format := "png"
position := "center"
width,_ := strconv.ParseInt("214", 10, 8)
height,_ := strconv.ParseInt("214", 10, 8)

var result []byte
result,_ = imaging.ImageWatermark(imageUrl, watermarkUrl, opacity, format, position, width, height)

HTML5Render

Render HTML content to PDF, JPG or PNG. See: https://www.neutrinoapi.com/api/html5-render/

func (me *IMAGING_IMPL) HTML5Render(
            content string,
            format *string,
            pageSize *string,
            title *string,
            margin *int64,
            marginLeft *int64,
            marginRight *int64,
            marginTop *int64,
            marginBottom *int64,
            landscape *bool,
            zoom *int64,
            grayscale *bool,
            mediaPrint *bool,
            mediaQueries *bool,
            forms *bool,
            css *string,
            imageWidth *int64,
            imageHeight *int64,
            renderDelay *int64,
            headerTextLeft *string,
            headerTextCenter *string,
            headerTextRight *string,
            headerSize *int64,
            headerFont *string,
            headerFontSize *int64,
            headerLine *bool,
            footerTextLeft *string,
            footerTextCenter *string,
            footerTextRight *string,
            footerSize *int64,
            footerFont *string,
            footerFontSize *int64,
            footerLine *bool,
            pageWidth *int64,
            pageHeight *int64)([]byte,error)
Parameters
Parameter Tags Description
content Required The HTML content. This can be either a URL to load HTML from or an actual HTML content string
format Optional DefaultValue Which format to output, available options are: PDF, PNG, JPG
pageSize Optional DefaultValue Set the document page size, can be one of: A0 - A9, B0 - B10, Comm10E, DLE or Letter
title Optional The document title
margin Optional DefaultValue The document margin (in mm)
marginLeft Optional DefaultValue The document left margin (in mm)
marginRight Optional DefaultValue The document right margin (in mm)
marginTop Optional DefaultValue The document top margin (in mm)
marginBottom Optional DefaultValue The document bottom margin (in mm)
landscape Optional DefaultValue Set the document to lanscape orientation
zoom Optional DefaultValue Set the zoom factor when rendering the page (2.0 for double size, 0.5 for half size)
grayscale Optional DefaultValue Render the final document in grayscale
mediaPrint Optional DefaultValue Use @media print CSS styles to render the document
mediaQueries Optional DefaultValue Activate all @media queries before rendering. This can be useful if you wan't to render the mobile version of a responsive website
forms Optional DefaultValue Generate real (fillable) PDF forms from HTML forms
css Optional Inject custom CSS into the HTML. e.g. 'body { background-color: red;}'
imageWidth Optional DefaultValue If rendering to an image format (PNG or JPG) use this image width (in pixels)
imageHeight Optional If rendering to an image format (PNG or JPG) use this image height (in pixels). The default is automatic which dynamically sets the image height based on the content
renderDelay Optional DefaultValue Number of milliseconds to wait before rendering the page (can be useful for pages with animations etc)
headerTextLeft Optional Text to print to the left-hand side header of each page. e.g. 'My header - Page {page_number} of {total_pages}'
headerTextCenter Optional Text to print to the center header of each page
headerTextRight Optional Text to print to the right-hand side header of each page
headerSize Optional DefaultValue The height of your header (in mm)
headerFont Optional DefaultValue Set the header font. Fonts available: Times, Courier, Helvetica, Arial
headerFontSize Optional DefaultValue Set the header font size (in pt)
headerLine Optional DefaultValue Draw a full page width horizontal line under your header
footerTextLeft Optional Text to print to the left-hand side footer of each page. e.g. 'My footer - Page {page_number} of {total_pages}'
footerTextCenter Optional Text to print to the center header of each page
footerTextRight Optional Text to print to the right-hand side header of each page
footerSize Optional DefaultValue The height of your footer (in mm)
footerFont Optional DefaultValue Set the footer font. Fonts available: Times, Courier, Helvetica, Arial
footerFontSize Optional DefaultValue Set the footer font size (in pt)
footerLine Optional DefaultValue Draw a full page width horizontal line above your footer
pageWidth Optional Set the PDF page width explicitly (in mm)
pageHeight Optional Set the PDF page height explicitly (in mm)
Example Usage
content := "content"
format := "PDF"
pageSize := "A4"
title := "title"
margin,_ := strconv.ParseInt("0", 10, 8)
marginLeft,_ := strconv.ParseInt("0", 10, 8)
marginRight,_ := strconv.ParseInt("0", 10, 8)
marginTop,_ := strconv.ParseInt("0", 10, 8)
marginBottom,_ := strconv.ParseInt("0", 10, 8)
landscape := false
zoom,_ := strconv.ParseInt("1", 10, 8)
grayscale := false
mediaPrint := false
mediaQueries := false
forms := false
css := "css"
imageWidth,_ := strconv.ParseInt("1024", 10, 8)
imageHeight,_ := strconv.ParseInt("214", 10, 8)
renderDelay,_ := strconv.ParseInt("0", 10, 8)
headerTextLeft := "header-text-left"
headerTextCenter := "header-text-center"
headerTextRight := "header-text-right"
headerSize,_ := strconv.ParseInt("9", 10, 8)
headerFont := "Courier"
headerFontSize,_ := strconv.ParseInt("11", 10, 8)
headerLine := false
footerTextLeft := "footer-text-left"
footerTextCenter := "footer-text-center"
footerTextRight := "footer-text-right"
footerSize,_ := strconv.ParseInt("9", 10, 8)
footerFont := "Courier"
footerFontSize,_ := strconv.ParseInt("11", 10, 8)
footerLine := false
pageWidth,_ := strconv.ParseInt("214", 10, 8)
pageHeight,_ := strconv.ParseInt("214", 10, 8)

var result []byte
result,_ = imaging.HTML5Render(content, format, pageSize, title, margin, marginLeft, marginRight, marginTop, marginBottom, landscape, zoom, grayscale, mediaPrint, mediaQueries, forms, css, imageWidth, imageHeight, renderDelay, headerTextLeft, headerTextCenter, headerTextRight, headerSize, headerFont, headerFontSize, headerLine, footerTextLeft, footerTextCenter, footerTextRight, footerSize, footerFont, footerFontSize, footerLine, pageWidth, pageHeight)

Back to List of Controllers

telephony_pkg

Get instance

Factory for the TELEPHONY interface can be accessed from the package telephony_pkg.

telephony := telephony_pkg.NewTELEPHONY()
VerifySecurityCode

Check if a security code from one of the verify APIs is valid. See: https://www.neutrinoapi.com/api/verify-security-code/

func (me *TELEPHONY_IMPL) VerifySecurityCode(securityCode string)(*models_pkg.VerifySecurityCodeResponse,error)
Parameters
Parameter Tags Description
securityCode Required The security code to verify
Example Usage
securityCode := "security-code"

var result *models_pkg.VerifySecurityCodeResponse
result,_ = telephony.VerifySecurityCode(securityCode)

HLRLookup

Connect to the global mobile cellular network and retrieve the status of a mobile device. See: https://www.neutrinoapi.com/api/hlr-lookup/

func (me *TELEPHONY_IMPL) HLRLookup(
            number string,
            countryCode *string)(*models_pkg.HLRLookupResponse,error)
Parameters
Parameter Tags Description
number Required A phone number
countryCode Optional ISO 2-letter country code, assume numbers are based in this country. If not set numbers are assumed to be in international format (with or without the leading + sign)
Example Usage
number := "number"
countryCode := "country-code"

var result *models_pkg.HLRLookupResponse
result,_ = telephony.HLRLookup(number, countryCode)

PhonePlayback

Make an automated call to any valid phone number and playback an audio message. See: https://www.neutrinoapi.com/api/phone-playback/

func (me *TELEPHONY_IMPL) PhonePlayback(
            number string,
            audioUrl string)(*models_pkg.PhonePlaybackResponse,error)
Parameters
Parameter Tags Description
number Required The phone number to call. Must be in valid international format
audioUrl Required A URL to a valid audio file. Accepted audio formats are:
  • MP3
  • WAV
  • OGG
You can use the following MP3 URL for testing: https://www.neutrinoapi.com/test-files/test1.mp3
Example Usage
number := "number"
audioUrl := "audio-url"

var result *models_pkg.PhonePlaybackResponse
result,_ = telephony.PhonePlayback(number, audioUrl)

SMSVerify

Send a unique security code to any mobile device via SMS. See: https://www.neutrinoapi.com/api/sms-verify/

func (me *TELEPHONY_IMPL) SMSVerify(
            number string,
            codeLength *int64,
            securityCode *int64,
            countryCode *string,
            languageCode *string)(*models_pkg.SMSVerifyResponse,error)
Parameters
Parameter Tags Description
number Required The phone number to send a verification code to
codeLength Optional DefaultValue The number of digits to use in the security code (must be between 4 and 12)
securityCode Optional Pass in your own security code. This is useful if you have implemented TOTP or similar 2FA methods. If not set then we will generate a secure random code
countryCode Optional ISO 2-letter country code, assume numbers are based in this country. If not set numbers are assumed to be in international format (with or without the leading + sign)
languageCode Optional DefaultValue The language to send the verification code in, available languages are:
  • de - German
  • en - English
  • es - Spanish
  • fr - French
  • it - Italian
  • pt - Portuguese
  • ru - Russian
Example Usage
number := "number"
codeLength,_ := strconv.ParseInt("5", 10, 8)
securityCode,_ := strconv.ParseInt("214", 10, 8)
countryCode := "country-code"
languageCode := "en"

var result *models_pkg.SMSVerifyResponse
result,_ = telephony.SMSVerify(number, codeLength, securityCode, countryCode, languageCode)

SMSMessage

Send a free-form message to any mobile device via SMS. See: https://www.neutrinoapi.com/api/sms-message/

func (me *TELEPHONY_IMPL) SMSMessage(
            number string,
            message string,
            countryCode *string)(*models_pkg.SMSMessageResponse,error)
Parameters
Parameter Tags Description
number Required The phone number to send a message to
message Required The SMS message to send. Messages are truncated to a maximum of 150 characters for ASCII content OR 70 characters for UTF content
countryCode Optional ISO 2-letter country code, assume numbers are based in this country. If not set numbers are assumed to be in international format (with or without the leading + sign)
Example Usage
number := "number"
message := "message"
countryCode := "country-code"

var result *models_pkg.SMSMessageResponse
result,_ = telephony.SMSMessage(number, message, countryCode)

PhoneVerify

Make an automated call to any valid phone number and playback a unique security code. See: https://www.neutrinoapi.com/api/phone-verify/

func (me *TELEPHONY_IMPL) PhoneVerify(
            number string,
            codeLength *int64,
            securityCode *int64,
            playbackDelay *int64,
            countryCode *string,
            languageCode *string)(*models_pkg.PhoneVerifyResponse,error)
Parameters
Parameter Tags Description
number Required The phone number to send the verification code to
codeLength Optional DefaultValue The number of digits to use in the security code (between 4 and 12)
securityCode Optional Pass in your own security code. This is useful if you have implemented TOTP or similar 2FA methods. If not set then we will generate a secure random code
playbackDelay Optional DefaultValue The delay in milliseconds between the playback of each security code
countryCode Optional ISO 2-letter country code, assume numbers are based in this country. If not set numbers are assumed to be in international format (with or without the leading + sign)
languageCode Optional DefaultValue The language to playback the verification code in, available languages are:
  • de - German
  • en - English
  • es - Spanish
  • fr - French
  • it - Italian
  • pt - Portuguese
  • ru - Russian
Example Usage
number := "number"
codeLength,_ := strconv.ParseInt("6", 10, 8)
securityCode,_ := strconv.ParseInt("214", 10, 8)
playbackDelay,_ := strconv.ParseInt("800", 10, 8)
countryCode := "country-code"
languageCode := "en"

var result *models_pkg.PhoneVerifyResponse
result,_ = telephony.PhoneVerify(number, codeLength, securityCode, playbackDelay, countryCode, languageCode)

Back to List of Controllers

datatools_pkg

Get instance

Factory for the DATATOOLS interface can be accessed from the package datatools_pkg.

dataTools := datatools_pkg.NewDATATOOLS()
EmailValidate

Parse, validate and clean an email address. See: https://www.neutrinoapi.com/api/email-validate/

func (me *DATATOOLS_IMPL) EmailValidate(
            email string,
            fixTypos *bool)(*models_pkg.EmailValidateResponse,error)
Parameters
Parameter Tags Description
email Required An email address
fixTypos Optional DefaultValue Automatically attempt to fix typos in the address
Example Usage
email := "email"
fixTypos := false

var result *models_pkg.EmailValidateResponse
result,_ = dataTools.EmailValidate(email, fixTypos)

UserAgentInfo

Parse, validate and get detailed user-agent information from a user agent string. See: https://www.neutrinoapi.com/api/user-agent-info/

func (me *DATATOOLS_IMPL) UserAgentInfo(userAgent string)(*models_pkg.UserAgentInfoResponse,error)
Parameters
Parameter Tags Description
userAgent Required A user agent string
Example Usage
userAgent := "user-agent"

var result *models_pkg.UserAgentInfoResponse
result,_ = dataTools.UserAgentInfo(userAgent)

BadWordFilter

Detect bad words, swear words and profanity in a given text. See: https://www.neutrinoapi.com/api/bad-word-filter/

func (me *DATATOOLS_IMPL) BadWordFilter(
            content string,
            censorCharacter *string)(*models_pkg.BadWordFilterResponse,error)
Parameters
Parameter Tags Description
content Required The content to scan. This can be either a URL to load content from or an actual content string
censorCharacter Optional The character to use to censor out the bad words found
Example Usage
content := "content"
censorCharacter := "censor-character"

var result *models_pkg.BadWordFilterResponse
result,_ = dataTools.BadWordFilter(content, censorCharacter)

Convert

A powerful unit conversion tool. See: https://www.neutrinoapi.com/api/convert/

func (me *DATATOOLS_IMPL) Convert(
            fromValue string,
            fromType string,
            toType string)(*models_pkg.ConvertResponse,error)
Parameters
Parameter Tags Description
fromValue Required The value to convert from (e.g. 10.95)
fromType Required The type of the value to convert from (e.g. USD)
toType Required The type to convert to (e.g. EUR)
Example Usage
fromValue := "from-value"
fromType := "from-type"
toType := "to-type"

var result *models_pkg.ConvertResponse
result,_ = dataTools.Convert(fromValue, fromType, toType)

PhoneValidate

Parse, validate and get location information about a phone number. See: https://www.neutrinoapi.com/api/phone-validate/

func (me *DATATOOLS_IMPL) PhoneValidate(
            number string,
            countryCode *string,
            ip *string)(*models_pkg.PhoneValidateResponse,error)
Parameters
Parameter Tags Description
number Required A phone number. This can be in international format (E.164) or local format. If passing local format you should use the 'country-code' or 'ip' options as well
countryCode Optional ISO 2-letter country code, assume numbers are based in this country. If not set numbers are assumed to be in international format (with or without the leading + sign)
ip Optional Pass in a users IP address and we will assume numbers are based in the country of the IP address
Example Usage
number := "number"
countryCode := "country-code"
ip := "ip"

var result *models_pkg.PhoneValidateResponse
result,_ = dataTools.PhoneValidate(number, countryCode, ip)

Back to List of Controllers

securityandnetworking_pkg

Get instance

Factory for the SECURITYANDNETWORKING interface can be accessed from the package securityandnetworking_pkg.

securityAndNetworking := securityandnetworking_pkg.NewSECURITYANDNETWORKING()
IPProbe

Analyze and extract provider information for an IP address. See: https://www.neutrinoapi.com/api/ip-probe/

func (me *SECURITYANDNETWORKING_IMPL) IPProbe(ip string)(*models_pkg.IPProbeResponse,error)
Parameters
Parameter Tags Description
ip Required IPv4 or IPv6 address
Example Usage
ip := "ip"

var result *models_pkg.IPProbeResponse
result,_ = securityAndNetworking.IPProbe(ip)

EmailVerify

SMTP based email address verification. See: https://www.neutrinoapi.com/api/email-verify/

func (me *SECURITYANDNETWORKING_IMPL) EmailVerify(
            email string,
            fixTypos *bool)(*models_pkg.EmailVerifyResponse,error)
Parameters
Parameter Tags Description
email Required An email address
fixTypos Optional DefaultValue Automatically attempt to fix typos in the address
Example Usage
email := "email"
fixTypos := false

var result *models_pkg.EmailVerifyResponse
result,_ = securityAndNetworking.EmailVerify(email, fixTypos)

IPBlocklist

The IP Blocklist API will detect potentially malicious or dangerous IP addresses. See: https://www.neutrinoapi.com/api/ip-blocklist/

func (me *SECURITYANDNETWORKING_IMPL) IPBlocklist(ip string)(*models_pkg.IPBlocklistResponse,error)
Parameters
Parameter Tags Description
ip Required An IPv4 or IPv6 address
Example Usage
ip := "ip"

var result *models_pkg.IPBlocklistResponse
result,_ = securityAndNetworking.IPBlocklist(ip)

HostReputation

Check the reputation of an IP address, domain name, FQDN or URL against a comprehensive list of blacklists and blocklists. See: https://www.neutrinoapi.com/api/host-reputation/

func (me *SECURITYANDNETWORKING_IMPL) HostReputation(
            host string,
            listRating *int64)(*models_pkg.HostReputationResponse,error)
Parameters
Parameter Tags Description
host Required An IP address, domain name, FQDN or URL. If you supply a domain/URL it will be checked against the URI DNSBL lists
listRating Optional DefaultValue Only check lists with this rating or better
Example Usage
host := "host"
listRating,_ := strconv.ParseInt("3", 10, 8)

var result *models_pkg.HostReputationResponse
result,_ = securityAndNetworking.HostReputation(host, listRating)

Back to List of Controllers

geolocation_pkg

Get instance

Factory for the GEOLOCATION interface can be accessed from the package geolocation_pkg.

geolocation := geolocation_pkg.NewGEOLOCATION()
GeocodeReverse

Convert a geographic coordinate (latitude and longitude) into a real world address. See: https://www.neutrinoapi.com/api/geocode-reverse/

func (me *GEOLOCATION_IMPL) GeocodeReverse(
            latitude string,
            longitude string,
            languageCode *string,
            zoom *string)(*models_pkg.GeocodeReverseResponse,error)
Parameters
Parameter Tags Description
latitude Required The location latitude in decimal degrees format
longitude Required The location longitude in decimal degrees format
languageCode Optional DefaultValue The language to display results in, available languages are:
  • de, en, es, fr, it, pt, ru
zoom Optional DefaultValue The zoom level to respond with:
  • address - the most precise address available
  • street - the street level
  • city - the city level
  • state - the state level
  • country - the country level
Example Usage
latitude := "latitude"
longitude := "longitude"
languageCode := "en"
zoom := "address"

var result *models_pkg.GeocodeReverseResponse
result,_ = geolocation.GeocodeReverse(latitude, longitude, languageCode, zoom)

IPInfo

Get location information about an IP address and do reverse DNS (PTR) lookups. See: https://www.neutrinoapi.com/api/ip-info/

func (me *GEOLOCATION_IMPL) IPInfo(
            ip string,
            reverseLookup *bool)(*models_pkg.IPInfoResponse,error)
Parameters
Parameter Tags Description
ip Required IPv4 or IPv6 address
reverseLookup Optional DefaultValue Do a reverse DNS (PTR) lookup. This option can add extra delay to the request so only use it if you need it
Example Usage
ip := "ip"
reverseLookup := false

var result *models_pkg.IPInfoResponse
result,_ = geolocation.IPInfo(ip, reverseLookup)

GeocodeAddress

Geocode an address, partial address or just the name of a place. See: https://www.neutrinoapi.com/api/geocode-address/

func (me *GEOLOCATION_IMPL) GeocodeAddress(
            address string,
            countryCode *string,
            languageCode *string,
            fuzzySearch *bool)(*models_pkg.GeocodeAddressResponse,error)
Parameters
Parameter Tags Description
address Required The address, partial address or name of a place to try and locate
countryCode Optional The ISO 2-letter country code to be biased towards (the default is no country bias)
languageCode Optional DefaultValue The language to display results in, available languages are:
  • de, en, es, fr, it, pt, ru
fuzzySearch Optional DefaultValue If no matches are found for the given address, start performing a recursive fuzzy search until a geolocation is found. This option is recommended for processing user input or implementing auto-complete. We use a combination of approximate string matching and data cleansing to find possible location matches
Example Usage
address := "address"
countryCode := "country-code"
languageCode := "en"
fuzzySearch := false

var result *models_pkg.GeocodeAddressResponse
result,_ = geolocation.GeocodeAddress(address, countryCode, languageCode, fuzzySearch)

Back to List of Controllers

e-commerce_pkg

Get instance

Factory for the E-COMMERCE interface can be accessed from the package e-commerce_pkg.

eCommerce := e-commerce_pkg.NewE-COMMERCE()
BINLookup

Perform a BIN (Bank Identification Number) or IIN (Issuer Identification Number) lookup. See: https://www.neutrinoapi.com/api/bin-lookup/

func (me *ECOMMERCE_IMPL) BINLookup(
            binNumber string,
            customerIp *string)(*models_pkg.BINLookupResponse,error)
Parameters
Parameter Tags Description
binNumber Required The BIN or IIN number (the first 6 digits of a credit card number)
customerIp Optional Pass in the customers IP address and we will return some extra information about them
Example Usage
binNumber := "bin-number"
customerIp := "customer-ip"

var result *models_pkg.BINLookupResponse
result,_ = eCommerce.BINLookup(binNumber, customerIp)

Back to List of Controllers

www_pkg

Get instance

Factory for the WWW interface can be accessed from the package www_pkg.

wWW := www_pkg.NewWWW()
URLInfo

Parse, analyze and retrieve content from the supplied URL. See: https://www.neutrinoapi.com/api/url-info/

func (me *WWW_IMPL) URLInfo(
            url string,
            fetchContent *bool,
            ignoreCertificateErrors *bool,
            timeout *int64)(*models_pkg.URLInfoResponse,error)
Parameters
Parameter Tags Description
url Required The URL to probe
fetchContent Optional DefaultValue If this URL responds with html, text, json or xml then return the response. This option is useful if you want to perform further processing on the URL content (e.g. with the HTML Extract or HTML Clean APIs)
ignoreCertificateErrors Optional DefaultValue Ignore any TLS/SSL certificate errors and load the URL anyway
timeout Optional DefaultValue Timeout in seconds. Give up if still trying to load the URL after this number of seconds
Example Usage
url := "url"
fetchContent := false
ignoreCertificateErrors := false
timeout,_ := strconv.ParseInt("20", 10, 8)

var result *models_pkg.URLInfoResponse
result,_ = wWW.URLInfo(url, fetchContent, ignoreCertificateErrors, timeout)

HTMLClean

Clean and sanitize untrusted HTML. See: https://www.neutrinoapi.com/api/html-clean/

func (me *WWW_IMPL) HTMLClean(
            content string,
            outputType string)([]byte,error)
Parameters
Parameter Tags Description
content Required The HTML content. This can be either a URL to load HTML from or an actual HTML content string
outputType Required The level of sanitization, possible values are: plain-text: reduce the content to plain text only (no HTML tags at all) simple-text: allow only very basic text formatting tags like b, em, i, strong, u basic-html: allow advanced text formatting and hyper links basic-html-with-images: same as basic html but also allows image tags advanced-html: same as basic html with images but also allows many more common HTML tags like table, ul, dl, pre
Example Usage
content := "content"
outputType := "output-type"

var result []byte
result,_ = wWW.HTMLClean(content, outputType)

BrowserBot

Browser bot can extract content, interact with keyboard and mouse events, and execute JavaScript on a website. See: https://www.neutrinoapi.com/api/browser-bot/

func (me *WWW_IMPL) BrowserBot(
            url string,
            timeout *int64,
            delay *int64,
            selector *string,
            exec []string,
            userAgent *string,
            ignoreCertificateErrors *bool)(*models_pkg.BrowserBotResponse,error)
Parameters
Parameter Tags Description
url Required The URL to load
timeout Optional DefaultValue Timeout in seconds. Give up if still trying to load the page after this number of seconds
delay Optional DefaultValue Delay in seconds to wait before capturing any page data, executing selectors or JavaScript
selector Optional Extract content from the page DOM using this selector. Commonly known as a CSS selector, you can find a good reference here
exec Optional Collection Execute JavaScript on the page. Each array element should contain a valid JavaScript statement in string form. If a statement returns any kind of value it will be returned in the 'exec-results' response. For your convenience you can also use the following special shortcut functions:
sleep(seconds); Just wait/sleep for the specified number of seconds. click('selector'); Click on the first element matching the given selector. focus('selector'); Focus on the first element matching the given selector. keys('characters'); Send the specified keyboard characters. Use click() or focus() first to send keys to a specific element. enter(); Send the Enter key. tab(); Send the Tab key.
Example:
[ "click('#button-id')", "sleep(1)", "click('.field-class')", "keys('1234')", "enter()" ]
userAgent Optional Override the browsers default user-agent string with this one
ignoreCertificateErrors Optional DefaultValue Ignore any TLS/SSL certificate errors and load the page anyway
Example Usage
url := "url"
timeout,_ := strconv.ParseInt("30", 10, 8)
delay,_ := strconv.ParseInt("3", 10, 8)
selector := "selector"
exec := []string{"exec"}
userAgent := "user-agent"
ignoreCertificateErrors := false

var result *models_pkg.BrowserBotResponse
result,_ = wWW.BrowserBot(url, timeout, delay, selector, exec, userAgent, ignoreCertificateErrors)

Back to List of Controllers

Jump to

Keyboard shortcuts

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