Unsplash
This is not a Low Code extension, but a library. |
About
Unsplash is a third-party service that provides stock image assets. This extension implements an SDK to access the service.
To use the Unsplash client in production, you will need a production-ready Unsplash account. |
Configuration
To use the Unsplash extension:
-
Obtain the UnsplashAPI production
accessKey
andsecret
. -
Place the extensions in a directory where it can be imported into an automation script.
-
Initialize the Unsplash client.
Usage
// To use the Unsplash client, first import the client into the desired automation script
import Unsplash from 'unsplash/lib/'
// Next step is to initialize the Unsplash client with the `accessKey` and `secret`
const unsplashClient = new UnsplashClient(accessKey, secret)
// The client is now ready to accept querries, for example
const images = await unsplashClient.search({ query: 'Example', perPage: 10, page: 1 })
Available queries
- search(query: '', perPage: 10, page: 1)
-
Fetches images that match the query base on the provided pagination data.
- getPhotoByID(photoID: '')
-
Fetches the image under the provided Unsplash photoID.
Example response for images
{
// Unsplash image ID
id,
preview: {
// URL to original image
original,
// URL to regular sized image
regular,
// URL to large size image
large,
// URL to the thumbnail size image
thumbnail,
},
author: {
// Image author name
name,
// URL to the Unsplash author profile
url,
},
// Origin of the image
origin: 'Unsplash',
}