Request


new Request(opts)

Snapchat wrapper for HTTP requests

Parameters:
Name Type Description
opts Object
Source:

Methods


<static> get(endpoint, cb) → {Request}

Parameters:
Name Type Description
endpoint string

The endpoint of the request relative to the base URL.

cb function
Source:
Returns:

new Request wrapping this HTTP GET request

Type
Request

<static> post(endpoint, params, gauth, token, opts, cb) → {Request}

Parameters:
Name Type Argument Description
endpoint string <optional>

Optional endpoint of the request relative to the base URL.

params Object <optional>

Optional parameters for the request.

gauth string <optional>

Optional parameter set to the X-Snapchat-Client-Auth-Token header field.

token string <optional>

Optional snapchat auth token returned from logging in.

opts Object <optional>

Optional custom options.

cb function
Source:
Returns:

new Request wrapping this HTTP POST request.

Type
Request

<static> postCustom(endpoint, params, headers, token, opts, cb) → {Request}

Parameters:
Name Type Argument Description
endpoint string

endpoint of the request relative to the base URL.

params Object

parameters for the request.

headers Object

Custom HTTP headers for this request.

token string

snapchat auth token returned from logging in.

opts Object <optional>

Optional custom options.

cb function
Source:
Returns:

new Request wrapping this HTTP POST request.

Type
Request

<static> sendEvents(eventData, cb) → {Request}

Parameters:
Name Type Description
eventData Object
cb function
Source:
Returns:

new Request wrapping this events HTTP POST request

Type
Request

_initGET()

Automatically adds HTTP header fields:

  • User-Agent
  • Accept-Language
  • Accept-Locale
  • Content-Type
Source:

_initPOST()

Automatically adds query parameters:

  • timestamp
  • req_token Automatically adds HTTP header fields:
  • User-Agent
  • Accept-Language
  • Accept-Locale
  • Content-Type
Source:

start(cb)

Initiates the underlying HTTP request Request.httpRequest.

Parameters:
Name Type Description
cb function
Source: