Properties

$callbackUrl

$callbackUrl : string

Type

string — the oauth callback url

$consumerKey

$consumerKey : string

Type

string — the oauth consumer key

$consumerSecret

$consumerSecret : string

Type

string — the oauth consumer key

$_client

$_client : string

Type

string — the \OAuth client instance

$oauthToken

$oauthToken : string

Type

string — the oauth token used for requests

$oauthSecret

$oauthSecret : string

Type

string — the oauth token used for requests

$baseUrl

$baseUrl : string

Type

string — the api base url used to generate api urls

$apiVersion

$apiVersion : string

Type

string — the api version used to generate api urls

Methods

__construct()

__construct(string $consumerKey, string $consumerSecret, string|null $callbackUrl, string|null $oauthToken, string|null $oauthSecret)

Create a new \Shapeways\Client

Parameters

string $consumerKey

your app consumer key

string $consumerSecret

your app consumer secret

string|null $callbackUrl

your app callback url

string|null $oauthToken

a users oauth token if it is already known

string|null $oauthSecret

a users oauth secret if it is already known

connect()

connect() : string|bool

Get request token and authentication url to send user to

Returns

string|bool —

the authentication url or false if it failed

verify()

verify(string $token, string $verifier) : bool

Get an access token from the oauth authentication callback

Parameters

string $token

the oauth_token in the auth callback query string

string $verifier

the oauth_verifier in the auth callback query string

Returns

bool

verifyUrl()

verifyUrl(string $url) : bool

Get an access token from the raw oauth authentication callback uri this method will parse the oauth_token and oauth_verifier from the query string for you.

Parameters

string $url

the raw auth callback uri (e.g. $_SERVER['REQUEST_URI'])

Returns

bool

url()

url(string $path) : string

Generate a correct full api url from just the api part.

Parameters

string $path

the api path (e.g. '/orders/cart/')

Returns

string

addModelPhoto()

addModelPhoto(int $modelId, array $params) : array

Upload a new photo for the model

https://developers.shapeways.com/docs#POST_-models-modelId-photos-v1

Parameters

int $modelId

the modelId for the model to associate the photo with

array $params

the photo data to upload

Returns

array —

the json response from the api call

getPrice()

getPrice(array $params) : array

Calculate the price from the provided parameters

https://developers.shapeways.com/docs#POST_-price-v1

Parameters

array $params

the parameters used to calculate the price

Returns

array —

the json response from the api call

getModelFile()

getModelFile(int $modelId, int $fileVersion, bool $includeFile) : array

Get a model's file

https://developers.shapeways.com/docs#GET_-models-modelId-files-fileVersion-v1

Parameters

int $modelId

the modelId which the file belongs to

int $fileVersion

the file version

bool $includeFile

whether or not to include the raw file in the response (default: False)

Returns

array —

the json response from the api call

_get()

_get(string $url, array $params) : array

Make a GET request to the api server

Parameters

string $url

the api url to request

array $params

the parameters to send with the request

Returns

array —

the json response from the api call

_put()

_put(string $url, array $params) : array

Make a PUT request to the api server

Parameters

string $url

the api url to request

array $params

the parameters to send with the request

Returns

array —

the json response from the api call

_post()

_post(string $url, array $params) : array

Make a POST request to the api server

Parameters

string $url

the api url to request

array $params

the parameters to send with the request

Returns

array —

the json response from the api call

_delete()

_delete(string $url, array $params) : array

Make a DELETE request to the api server

Parameters

string $url

the api url to request

array $params

the parameters to send with the request

Returns

array —

the json response from the api call