The endpoint of the API to use, default is https://api.PreferredPictures/
The identity that should be used for API calls generated
The maximum number of choices to allow, default 35
The secret key of the identity that should be used to generated signatures
Build a URL for a call to /choose
of the PreferredPictures API,
using the passed parameters.
A list of choices from which a selection should be made. Typically these are URLs.
An optional prefix to prepend to all of the choices
An optional suffix to append to all of the choices
An optional list of destination URLs which are paired with each choice
An optional prefix to prepend to all of the destination URLs
An optional suffix to append to all of the destination URLs
The amount of time in seconds that the request signature is valid
Indicate that the user should be redirected to the destination URL from a previously chosen option associated with the same tournament and unique id.
Indicate that the result should be returned as JSON, rather than a HTTP redirect
Produce a limited signature over all fields except uid, expiration, json, go.
The tournament of which this API call is a member
The amount of time in seconds after a choice is made that an action can be recorded.
An optional unique identifier that is used to correlate choices and actions.
If it is not specified a UUID v4 will be generated.
A URL that when requested will return the result of the API call.
Example:
// A simple example of choosing between three different
// URLs.
const simpleChoiceUrl = pp.createChooseUrl({
choices: [
"https://example.com/image-red.jpg",
"https://example.com/image-green.jpg",
"https://example.com/image-blue.jpg",
],
// Change the tournament as necessary to represent
// different needs.
tournament: "testing",
});
Generated using TypeDoc
Create a new PreferredPicturesClient instance using an identity and the secret API key associated with that identity.
Example:
import PreferredPicturesClient from '@preferred-pictures/client'; const pp = new PreferredPicturesClient({ // Obtain your account's values by // signing into PreferredPictures. identity: "test-identity", secretKey: "secret123456", });