new client(options, callback)
Represents an API Client
Parameters:
| Name | Type | Argument | Default | Description |
|---|---|---|---|---|
options |
object |
<optional> |
{} | setup options |
callback |
client~connectCallback |
<optional> |
call client.connect immediately after setup, passing it callback |
Methods
-
addModel(params, callback)
-
Make an API call POST /models/v1 The `file` parameter is base64 + URI encoded before sending to server
Parameters:
Name Type Argument Description paramsobject the model data to use callbackclient~resultsCallback <optional>
function to call when finished -
addModelFile(modelId, params, callback)
-
Make an API call POST /models/{modelId}/files/v1 The `file` parameter is base64 + URI encoded before sending to server
Parameters:
Name Type Argument Description modelIdnumber the model the file belongs to paramsobject the file information callbackclient~resultsCallback <optional>
function to call when finished -
addModelPhoto(modelId, params, callback)
-
Make an API call POST /models/{modelId}/photos/v1 The `file` parameter is base64 + URI encoded before sending to server
Parameters:
Name Type Argument Description modelIdnumber the model the photo belongs to paramsobject the photo information callbackclient~resultsCallback <optional>
function to call when finished -
addToCart(params, callback)
-
Make an API call POST /orders/cart/v1
Parameters:
Name Type Argument Description paramsobject parameters to send with the query callbackclient~resultsCallback <optional>
function to call when finished -
connect(callback)
-
Connect to API server and get OAuth request token and authentication url
Parameters:
Name Type Argument Description callbackclient~connectCallback <optional>
function to call when finished -
delete(url, callback)
-
Make a HTTP DELETE request to the url using the OAuth credentials
Parameters:
Name Type Argument Description urlstring the url to make the request to callbackclient~resultsCallback <optional>
function to call when finished -
deleteModel(modelId, callback)
-
Make an API call DELETE /models/{modelId}/v1
Parameters:
Name Type Argument Description modelIdnumber the model to delete callbackclient~resultsCallback <optional>
function to call when finished -
gePrice(params, callback)
-
Make an API call POST /price/v1
Parameters:
Name Type Argument Description paramsobject the pricing information to get pricing for callbackclient~resultsCallback <optional>
function to call when finished -
get(url, callback)
-
Make a HTTP GET request to the url using the OAuth credentials
Parameters:
Name Type Argument Description urlstring the url to make the request to callbackclient~resultsCallback <optional>
function to call when finished -
getApiInfo(callback)
-
Make an API call GET /api/v1
Parameters:
Name Type Argument Description callbackclient~resultsCallback <optional>
function to call when finished -
getCart(callback)
-
Make an API call GET /orders/cart/v1
Parameters:
Name Type Argument Description callbackclient~resultsCallback <optional>
function to call when finished -
getCategories(callback)
-
Make an API call GET /categories/v1
Parameters:
Name Type Argument Description callbackclient~resultsCallback <optional>
function to call when finished -
getCategory(catId, callback)
-
Make an API call GET /categories/{categoryId}/v1
Parameters:
Name Type Argument Description catIdnumber the category id to fetch callbackclient~resultsCallback <optional>
function to call when finished -
getMaterial(materialId, callback)
-
Make an API call GET /materials/{materialId}/v1
Parameters:
Name Type Argument Description materialIdnumber material id of the material to get callbackclient~resultsCallback <optional>
function to call when finished -
getMaterials(callback)
-
Make an API call GET /materials/v1
Parameters:
Name Type Argument Description callbackclient~resultsCallback <optional>
function to call when finished -
getModel(modelId, callback)
-
Make an API call GET /models/{modelId}/v1
Parameters:
Name Type Argument Description modelIdnumber the model to fetch callbackclient~resultsCallback <optional>
function to call when finished -
getModelFile(modelId, fileVersion, includeFile, callback)
-
Make an API call GET /models/{modelId}/files/{fileVersion}/v1
Parameters:
Name Type Argument Default Description modelIdnumber the model the file belongs to fileVersionint the version of the file to get includeFileboolean <optional>
false whether or not to include the raw file data with the response callbackclient~resultsCallback <optional>
function to call when finished -
getModelInfo(modelId, callback)
-
Make an API call GET /models/{modelId}/info/v1
Parameters:
Name Type Argument Description modelIdnumber the model to fetch information for callbackclient~resultsCallback <optional>
function to call when finished -
getModels(page, callback)
-
Make an API call GET /models/v1
Parameters:
Name Type Argument Description pagenumber <optional>
which page to fetch callbackclient~resultsCallback <optional>
function to call when finished -
getPrinters(printerId, callback)
-
Make an API call GET /printers/{printerId}/v1
Parameters:
Name Type Argument Description printerIdnumber the printer id to get information for callbackclient~resultsCallback <optional>
function to call when finished -
getPrinters(callback)
-
Make an API call GET /printers/v1
Parameters:
Name Type Argument Description callbackclient~resultsCallback <optional>
function to call when finished -
post(url, body, callback)
-
Make a HTTP POST request to the url using the OAuth credentials
Parameters:
Name Type Argument Description urlstring the url to make the request to bodystring <optional>
the POST body data to send with the request callbackclient~resultsCallback <optional>
function to call when finished -
put(url, body, callback)
-
Make a HTTP PUT request to the url using the OAuth credentials
Parameters:
Name Type Argument Description urlstring the url to make the request to bodystring <optional>
the PUT body data to send with the request callbackclient~resultsCallback <optional>
function to call when finished -
updateModelInfo(modelId, params, callback)
-
Make an API call PUT /models/{modelId}/info/v1
Parameters:
Name Type Argument Description modelIdnumber the model to update paramsobject model data to update with callbackclient~resultsCallback <optional>
function to call when finished -
url(path, params) → {string}
-
Build a full API url from the portion that is given
Parameters:
Name Type Argument Description pathstring the api path portion to build paramsobject <optional>
Object of query string parameters to use Returns:
Returns full API url from path and params- Type
- string
-
verify(token, verifier, callback)
-
Request an OAuth access token with the provided oauth_token and oauth_verifier parameters
Parameters:
Name Type Argument Description tokenstring oauth_token from authentication response query string verifierstring oauth_verifier from authentication response query string callbackclient~verifyCallback <optional>
function to call when finished -
verifyUrl(callback)
-
Parse the required parameters from OAuth authentication response url and pass to client.verify
Parameters:
Name Type Argument Description callbackclient~verifyCallback <optional>
function to call when finished
Type Definitions
-
connectCallback(error, authentication_url)
-
Parameters:
Name Type Description errorstring | null error message or null authentication_urlstring | null the oauth authentication url or null -
resultsCallback(error, results)
-
Parameters:
Name Type Description errorstring | null error message or null resultsobject | null the results from the api call -
verifyCallback(error)
-
Parameters:
Name Type Description errorstring | null error message or null