4.1.0 • Published 4 years ago

wrapsplash v4.1.0

Weekly downloads
31
License
MIT
Repository
github
Last release
4 years ago

wrapsplash-logo

WrapSplashJS v4.1.0

Codacy Badge license Maintenance Dependecies Status npm version Known Vulnerabilities Greenkeeper badge Travis GitHub issues GitHub forks GitHub stars Twitter

WrapSplashJS is a simple, promise-based API wrapper for the popular Unsplash platform. WrapSplashJS is a UMD module, so that it can be used across multiple javascript environments ranging from browsers to servers(nodejs). Unsplash provides beautiful high quality free images and photos that you can download and use for any project without any attribution.

Before using the Unsplash API, you need to register as a developer and read the API Guidelines.

Note: Every application must abide by the API Guidelines. Specifically, remember to hotlink images and trigger a download when appropriate.

Table of Contents

Installation

Install the package from NPM

npm install --save wrapsplash

Sample usage

//In your NodeJS app

//Require npm module
const WrapSplash = require('wrapsplash');

//OR using ES6/7 Import statement
import WrapSplash from 'wrapsplash';

//Instantiate WrapSplash
let UnsplashApi = new WrapSplash();

//Initialize with parameters
UnsplashApi.init({
    bearer_token: '<bearer-token>'
});

//List photos - Get a single page from the list of all photos.
UnsplashApi.getPhotoLink('<photo-id>')
    .then(function (result) {
        //do something with the data
        console.log(result);
    }).catch(function (e) {
        console.err(e);
    });

Response

200 OK
{
  "url": "https://images.unsplash.com/photo-1532800621406-0280a106eaa6?ixlib=rb-0.3.5&q=85&fm=jpg&crop=entropy&cs=srgb&s=70d0f9f241b88d82c7d0e52b93476e6a"
}

Dependency

This library depends on axios to make requests to the Unsplash API. Install Axios as a dependency.

Changelog

v4.1.0

  • Dependency vulnerabilities audited and fixed
  • Test suite updated

v4.0.1

  • Typos fixed
  • Dependency vulnerabilities audited and fixed

v4.0.0

  • Major refactorings
  • Updated documentation

v3.0.8

  • Dependency updates

v3.0.7

  • Library is now a UMD module, runs on client and server-side
  • Dependencies are now external
  • Compressed builds asset size reduced to 19KiB
  • AJAX migrated to Axios from fetch.
  • Tests migrated to Jest

v3.0.6

  • Compressed builds available
    • Asset size reduced to 30.7KiB

v3.0.5

  • Updated Documentation
  • Updated dependencies
  • Code Quality improved
  • Dependency security aduits enabled

v3.0.4

  • Updated Documentation
  • Updated dependecies

v3.0.3

  • Updated dependecies

v3.0.2

  • Minor bug fix.

v3.0.1

  • Minor security fixes.
  • Minor bug fixes.
  • Code cleanups.
  • Updated documentations.
  • Test environment setup using Mochajs.
  • Assertion test specs added using Chaijs.
  • Strict server response validations added.

v3.0.0

  • Completely re-written in ES6 & ES7 specifications.
  • Continuous Integrations (CI) using Travis CI.
  • Minor bug fixes.
  • Major code optimizations.
  • Updated documentaions.
  • Major refactorings.
  • Now supports Yarn package manager
    • https://yarnpkg.com/en/package/wrapsplash.
  • Now available at major CDNs:
    • unpkg - https://unpkg.com/wrapsplash@3.0.0/.
    • bundle.run - https://bundle.run/wrapsplash@3.0.0.
    • jsDelivr - https://cdn.jsdelivr.net/npm/wrapsplash@3.0.0/.

v2.0.1

  • Minor bug fix.

v2.0.0

  • Documentation updated.
  • Added support for Collections APIs.
    • Get a single page from the list of all collections - GET /collections.
    • Get a single page from the list of featured collections - GET /collections/featured.
    • Get a single page from the list of curated collections - GET /collections/curated.
    • Retrieve a single collection - GET /collections/:id.
    • Retrieve a curated collection - GET /collections/curated/:id.
    • Retrieve a collection’s photos - GET /collections/:id/photos.
    • Retrieve a curated collection’s photos - GET /collections/curated/:id/photos.
    • Retrieve a list of collections - GET /collections/:id/related.
    • Create a new collection - POST /collections.
    • Update an existing collection belonging to the logged-in user - PUT /collections/:id.
    • Delete a collection belonging to the logged-in user - DELETE /collections/:id.
    • Add a photo to one of the logged-in user’s collections - POST /collections/:collection_id/add.
    • Remove a photo from one of the logged-in user’s collections - DELETE /collections/:collection_id/remove.
  • Added support for Current User APIs
    • Get the user’s profile - GET /me.
    • Update the current user’s profile - PUT /me.
  • Added support for Stats APIs
    • Get a list of counts for all of Unsplash - GET /stats/total.
    • Get the overall Unsplash stats for the past 30 days - GET /stats/month.
  • Major refactorings.

v1.1.0

  • Documentation updated.
  • Added support for Authorization.
  • Added support for Bearer Token.
  • Added support for private data Read Write Access.
  • Added support for full Photos APIs
    • Get a single page from the list of all photos - GET /photos.
    • Get a single page from the list of the curated photos - GET /photos/curated.
    • Retrieve a single photo - GET /photos/:id.
    • Retrieve a single random photo, given optional filters - GET /photos/random.
    • Retrieve statistics of a photo in a specific timeframe - GET /photos/:id/statistics.
    • Retrieve a single photo’s download link - GET /photos/:id/download.
    • Update a photo on behalf of the logged-in user - PUT /photos/:id.
    • Like a photo on behalf of the logged-in user - POST /photos/:id/like.
    • Remove a user’s like of a photo - DELETE /photos/:id/like.
  • Major refactorings.

v1.0.10

  • Documentation patch.

v1.0.9

  • Now supports full Search APIs.
  • Added support for new API endpoints.
    • Get a single page of photo results for a query - GET /search/photos.
    • Get a single page of collection results for a query - GET /search/collections.
    • Get a single page of user results for a query - GET /search/users.

v1.0.8

  • Now supports full Users APIs.
  • Added support for new API endpoints.
    • Get a list of collections created by the user - GET /users/:username/collections.
    • Get a user's account statistics - GET /users/:username/statistics.
  • Major refactorings.

v1.0.7

  • Added support for new API endpoint.
    • Get a list of photos liked by a user - GET /users/:username/likes.
  • Minor refactorings.

API Documentation

Schema

Location

The API we are using is https://api.unsplash.com/. Responses are sent as JSON.

Summary objects

When retrieving a list of objects, an abbreviated or summary version of that object is returned - i.e., a subset of its attributes. To get a full detailed version of that object, fetch it individually.

Error messages

If an error occurs, whether on the server or client side, the error message(s) will be returned in an errors array. For example:

422 Unprocessable Entity
{
  "errors": ["Username is missing", "Password cannot be blank"]
}

Authorization

Public Actions

Many actions can be performed without requiring authentication from a specific user. For example, downloading a photo does not require a user to log in. To authenticate requests in this way, pass your application’s access key via the HTTP Authorization header:

Authorization: Client-ID YOUR_ACCESS_KEY

You can also pass this value using a client_id query parameter:

https://api.unsplash.com/photos/?client_id=YOUR_ACCESS_KEY

If only your access key is sent, attempting to perform non-public actions that require user authorization will result in a 401 Unauthorized response.

User Authentication

The Unsplash API uses OAuth2 to authenticate and authorize Unsplash users. Unsplash’s OAuth2 paths live at https://unsplash.com/oauth/.

Before using wrapsplash:

  • Developers are required to create a developer account from Unsplash.
  • Create a new App from Your Apps page.
  • Get the Access Key, Secret key, Callback URLs, and Authorization code.
  • If you have a Bearer Token, then its super, or else you can generate it using wrapsplash.

    Note: Authorization code can be obtained by clicking the Authorize link next to Callback URLs. Also Authorization code is a one-time use code, you have to generate it again, if the action fails!.

Wrapsplash init()

Wrapsplash instance has to be initialized with your credentials obtained from Unsplash developer account for programatic access.These credentials information are passed in to the init() function as options. The following example shows all the available options.

UnsplashApi.init({
    access_key: '<api-key>',
    secret_key: '<secret-key>',
    redirect_uri: '<callback-url>',
    code: '<authorization-code>',
    bearer_token: '<bearer-token>'
});

If you have a bearer_token, then only bearer token has to be passed in.

UnsplashApi.init({
    bearer_token: '<bearer-token>'
});

Generate Bearer Token

A Promise factory to generate a Bearer Token for write_access to private data. The init() method in this case requires access_key, secret_key, redirect_uri, and code to generate bearer token.

Note: No Parameters are required for this function.

const WrapSplash = require('wrapsplash');

let UnsplashApi = new WrapSplash();

UnsplashApi.init({
    access_key: '<api-key>',
    secret_key: '<secret-key>',
    redirect_uri: '<callback-url>',
    code: '<authorization-code>',
});

UnsplashApi.generateBearerToken()
    .then(function (result) {
        console.log(result);
    }).catch(function (e) {
        console.err(e);
    });

If successful, the response body will be a JSON representation of your user’s access token a.k.a bearer token:

{
   "access_token": "091343ce13c8ae780065ecb3b13dc903475dd22cb78a05503c2e0c69c5e98044",
   "token_type": "bearer",
   "scope": "public read_photos write_photos",
   "created_at": 1436544465
 }

and once you have your bearer_token you can use it in your app like this:

UnsplashApi.init({
    bearer_token: '<bearer-token>'
});

Users APIs

Get User's Public Profile

A Promise factory to retrieve public details on a given user.

GET /users/:username
Parameters
ParameterTypeDescriptionOptionalDefault
usernamestringThe username of the particular userno
widthnumberWidth of the profile picture in pixelsyes
heightnumberHeight of the profile picture in pixelsyes

Note: When optional height & width are specified the profile image will be included in the "profile_image" object as "custom".

UnsplashApi.getPublicProfile('<username>', 600, 600);

Get User's Portfolio Link

A Promise factory to retrieve a single user’s portfolio link.

GET /users/:username/portfolio
Parameters
ParameterTypeDescriptionOptionalDefault
usernamestringThe username of the particular userno
UnsplashApi.getUserPortfolio('<username>');

Get User's Photos

A Promise factory to get a list of photos uploaded by a particular user.

GET /users/:username/photos
Parameters
ParameterTypeDescriptionOptionalDefault
usernamestringThe username of the particular userno
pagenumberPage number to retrieveyes1
per_pagenumberNumber of items per pageyes10
statsbooleanShow the stats for each user’s photoyesfalse
resolutionstringThe frequency of the statsyesdays
quantitynumberThe amount of for each statyes30
order_bystringHow to sort the photos.(Valid values: latest, oldest, popular)yeslatest
UnsplashApi.getUserPhotos('<username>', 1, 10, false, 'days', 30, 'latest');

Get User Liked Photos

A Promise factory to get a list of photos liked by a user.

GET /users/:username/likes
Parameters
ParameterTypeDescriptionOptionalDefault
usernamestringThe username of the particular userno
pagenumberPage number to retrieveyes1
per_pagenumberNumber of items per pageyes10
order_bystringHow to sort the photos.(Valid values: latest, oldest, popular)yeslatest
UnsplashApi.getUserLikedPhotos('<username>', 1, 10, 'latest');

Get User's Collections

A Promise factory to get a list of collections created by the user.

GET /users/:username/collections
Parameters
ParameterTypeDescriptionOptionalDefault
usernamestringThe username of the particular userno
pagenumberPage number to retrieveyes1
per_pagenumberNumber of items per pageyes10
UnsplashApi.getUserCollections('<username>', 1, 10);

Get User's Statistics

A Promise factory to get a user's account statistics.

GET /users/:username/statistics
Parameters
ParameterTypeDescriptionOptionalDefault
usernamestringThe username of the particular userno
resolutionstringThe frequency of the statsyesdays
quantitynumberThe amount of for each statyes30
UnsplashApi.getUserStatistics('<username>', 'days', 30);

Photos APIs

List Photos

A Promise factory to get a single page from the list of all photos.

GET /photos
Parameters
ParameterTypeDescriptionOptionalDefault
pagenumberPage number to retrieveyes1
per_pagenumberNumber of items per pageyes10
order_bystringHow to sort the photos.(Valid values: latest, oldest, popular)yeslatest
UnsplashApi.listPhotos(1, 10, 'latest');

List Curated Photos

A Promise factory to get a single page from the list of the curated photos.

GET /photos/curated
Parameters
ParameterTypeDescriptionOptionalDefault
pagenumberPage number to retrieveyes1
per_pagenumberNumber of items per pageyes10
order_bystringHow to sort the photos.(Valid values: latest, oldest, popular)yeslatest
UnsplashApi.listCuratedPhotos(1, 10, 'latest');

Get a Photo by Id

A Promise factory to retrieve a single photo.

GET /photos/:id
Parameters
ParameterTypeDescriptionOptionalDefault
idstringThe photo’s IDno
widthnumberImage width in pixelsyes
heightnumberImage height in pixelsyes
rectstring4 comma-separated integers representing x, y, width, height of the cropped rectangleyes

Note: Supplying the optional width or height parameters will result in the custom photo URL being added to the urls object:

UnsplashApi.getAPhoto('<id of the photo>', 500, 500, 'x, y, width, height');

Get a Random Photo

A Promise factory to retrieve a single random photo, given optional filters.

GET /photos/random
Parameters

Note: All parameters are optional, and can be combined to narrow the pool of photos from which a random one will be chosen.

ParameterTypeDescriptionOptionalDefault
collectionStringThe public collection ID(‘s) to filter selection. If multiple, comma-separatedyes
featuredBooleanLimit selection to featured photosyesfalse
usernameStringLimit selection to a single useryes
queryStringLimit selection to photos matching a search termyes
widthNumberThe Image width in pixelsyes
heightNumberThe Image height in pixelsyes
orientationStringFilter search results by photo orientation. (Valid values are landscape, portrait, and squarish)yeslandscape
countNumberThe number of photos to return. (max: 30)yes1

Note: You can’t use the collections and query parameters in the same request. When supplying a count parameter - and only then - the response will be an array of photos, even if the value of count is 1.

UnsplashApi.getARandomPhoto();

Get a Photo's Statistics

A Promise factory to retrieve total number of downloads, views and likes of a single photo, as well as the historical breakdown of these stats in a specific timeframe (default is 30 days).

GET /photos/:id/statistics
Parameters
ParameterTypeDescriptionOptionalDefault
idstringThe photo’s IDno
resolutionstringThe frequency of the statsyesdays
quantitynumberThe amount of for each statyes30

Note: Currently, the only resolution param supported is “days”. The quantity param can be any number between 1 and 30.

UnsplashApi.getPhotoStatistics('<photo-id>', 'days', 10);

Get a Photo's Download Link

A Promise factory to retrieve a single photo’s download link. Preferably hit this endpoint if a photo is downloaded in your application for use (example: to be displayed on a blog article, to be shared on social media, to be remixed, etc).

GET /photos/:id/download
Parameters
ParameterTypeDescriptionOptionalDefault
idstringThe photo’s IDno

Note: This is different than the concept of a view, which is tracked automatically when you hotlink an image.

UnsplashApi.getPhotoLink('<photo-id>');

Update a Photo

A Promise factory to update a photo on behalf of the logged-in user. This requires the write_photos scope and bearer_token.

PUT /photos/:id
Parameters
ParameterTypeDescriptionOptionalDefault
idstringThe photo’s IDno
locationobjectThe location object holding location datayes
exifobjectThe exif object holding exif datayes

Note: Exchangeable image file format (officially Exif, according to JEIDA/JEITA/CIPA specifications) is a standard that specifies the formats for images, sound, and ancillary tags used by digital cameras (including smartphones), scanners and other systems handling image and sound files recorded by digital cameras. Readmore

location & exif objects
objectkeyDescription
locationlatitudeThe photo location’s latitude (Optional)
locationlongitudeThe photo location’s longitude (Optional)
locationnameThe photo location’s name (Optional)
locationcityThe photo location’s city (Optional)
locationcountryThe photo location’s country (Optional)
locationconfidentialThe photo location’s confidentiality (Optional)
exifmakeCamera’s brand (Optional)
exifmodelCamera’s model (Optional)
exifexposure_timeCamera’s exposure time (Optional)
exifaperture_valueCamera’s aperture value (Optional)
exiffocal_lengthCamera’s focal length (Optional)
exifiso_speed_ratingsCamera’s iso (Optional)
UnsplashApi.updatePhoto('<photo-id>', {country: 'INDIA'}, {make: 'Redmi Note 3'});

Like a Photo

A Promise factory to like a photo on behalf of the logged-in user. This requires the write_likes scope.

POST /photos/:id/like
Parameters
ParameterTypeDescriptionOptionalDefault
idstringThe photo’s IDno

Note: This action is idempotent; sending the POST request to a single photo multiple times has no additional effect.

UnsplashApi.likePhoto('<photo-id>');

Unlike a Photo

A Promise factory to remove a user’s like of a photo.

DELETE /photos/:id/like
Parameters
ParameterTypeDescriptionOptionalDefault
idstringThe photo’s IDno

Note: This action is idempotent; sending the DELETE request to a single photo multiple times has no additional effect.

UnsplashApi.unlikePhoto('<photo-id>');

Search APIs

Search Photos

A Promise factory to get a single page of photo results for a particular query.

GET /search/photos
Parameters
ParameterTypeDescriptionOptionalDefault
querystringThe search queryno
pagenumberPage number to retrieveyes1
per_pagenumberNumber of items per pageyes10
collectionsnumberCollection ID(‘s) to narrow search. If multiple, comma-separated.yes
orientationstringFilter search results by photo orientation. (Valid values are landscape, portrait, and squarish.)yeslandscape
UnsplashApi.search('cars', 1, 10, '', 'landscape');

Search Collections

A Promise factory to get a single page of collection results for a query.

GET /search/collections
Parameters
ParameterTypeDescriptionOptionalDefault
querystringThe search queryno
pagenumberPage number to retrieveyes1
per_pagenumberNumber of items per pageyes10
UnsplashApi.searchCollections('cars', 1, 10);

Search Users

A Promise factory to get a single page of user results for a query.

GET /search/users
Parameters
ParameterTypeDescriptionOptionalDefault
querystringThe search queryno
pagenumberPage number to retrieveyes1
per_pagenumberNumber of items per pageyes10
UnsplashApi.searchUsers('<search-keyword>', 1, 10);

Current User APIs

Get User’s Profile

A Promise factory to get the current User's profile. To access a user’s private data, the user is required to authorize the read_user scope. Without it, this request will return a 403 Forbidden response.

GET /me

Note: No Parameters are required.

Note: Without a Bearer token (i.e. using a Client-ID token) this request will return a 401 Unauthorized response.

UnsplashApi.getCurrentUserProfile();

Update User’s Profile

A Promise factory to update the current User's profile.

PUT /me
Parameters
ParameterTypeDescriptionOptionalDefault
usernameStringThe username of the current useryes
first_nameStringThe first name of the current useryes
last_nameStringThe last name of the current useryes
emailStringThe email id of the current useryes
urlStringThe Portfolio/personal URL of the current useryes
locationStringThe location of the current useryes
bioStringThe About/bio of the current useryes
instagram_usernameStringThe Instagram username of the current useryes

Note: This action requires the write_user scope. Without it, it will return a 403 Forbidden response.

UnsplashApi.updateCurrentUserProfile('<username>', '<first_name>', '<last_name>', '<email>', '<url>', '<location>', '<bio>', '<instagram_username>');

Stats APIs

Stats Totals

A Promise factory to get a list of counts for all of Unsplash.

GET /stats/total
UnsplashApi.getStatsTotals();

Response

200 OK
{
  total_stats = {
    "photos" => 10000,
    "downloads" => 2000,
    "views" => 5000,
    "likes" => 800,
    "photographers" => 100,
    "pixels" => 200000,
    "downloads_per_second" => 10, // average number of downloads per second for the past 7 days
    "views_per_second" => 20,  // average number of views per second for the past 7 days
    "developers" => 20,
    "applications" => 50,
    "requests" => 8000
  }
}

Stats Month

A Promise factory to get the overall Unsplash stats for the past 30 days.

GET /stats/month
UnsplashApi.getStatsMonth();

Response

200 OK
{
  month_stats = {
    "downloads" => 20,
    "views" => 200,
    "likes" => 60,
    "new_photos" => 10,
    "new_photographers" => 5,
    "new_pixels" => 2000,
    "new_developers" => 8,
    "new_applications" => 5,
    "new_requests" => 100
  }
}

Collections APIs

Link Relations

Collections have the following link relations:

relDescription
selfAPI location of this collection
htmlHTML location of this collection
photosAPI location of this collection’s photos
relatedAPI location of this collection’s related collections (Non-curated collections only)
downloadDownload location of this collection’s zip file (Curated collections only)

List Collections

A Promise factory to get a single page from the list of all collections.

GET /collections
Parameters
ParameterTypeDescriptionOptionalDefault
pagenumberPage number to retrieveyes1
per_pagenumberNumber of items per pageyes10
UnsplashApi.listCollections();

List Featured Collections

A Promise factory to get a single page from the list of featured collections.

GET /collections/featured
Parameters
ParameterTypeDescriptionOptionalDefault
pagenumberPage number to retrieveyes1
per_pagenumberNumber of items per pageyes10
UnsplashApi.listFeaturedCollections();

List Curated Collections

A Promise factory to get a single page from the list of curated collections.

GET /collections/curated
Parameters
ParameterTypeDescriptionOptionalDefault
pagenumberPage number to retrieveyes1
per_pagenumberNumber of items per pageyes10
UnsplashApi.listCuratedCollections();

Get a Collection

A Promise factory to retrieve a single collection. To view a user’s private collections, the read_collections scope is required.

GET /collections/:id
Parameters
ParameterTypeDescriptionOptionalDefault
idstringThe Collection IDno
UnsplashApi.getCollection('<collection-id>');

Get a Curated Collection

A Promise factory to retrieve a single curated collection. To view a user’s private collections, the read_collections scope is required.

GET /collections/curated/:id
Parameters
ParameterTypeDescriptionOptionalDefault
idstringThe Collection IDno
UnsplashApi.getCuratedCollection('<curated-collection-id>');

Get a Collection's Photos

A Promise factory to retrieve a collection’s photos.

GET /collections/:id/photos
Parameters
ParameterTypeDescriptionOptionalDefault
idstringThe Collection IDno
pagenumberPage number to retrieveyes1
per_pagenumberNumber of items per pageyes10
UnsplashApi.getCollectionPhotos('<collection-id>', 1, 10);

Get a Curated Collection's Photos

A Promise factory to retrieve a curated collection’s photos.

GET /collections/curated/:id/photos
Parameters
ParameterTypeDescriptionOptionalDefault
idstringThe Collection IDno
pagenumberPage number to retrieveyes1
per_pagenumberNumber of items per pageyes10
UnsplashApi.getCuratedCollectionPhotos('<curated-collection-id>', 1, 10);

List a Collection’s Related Collections

A Promise factory to retrieve a list of collections related to this one.

GET /collections/:id/related
Parameters
ParameterTypeDescriptionOptionalDefault
idstringThe Collection IDno
UnsplashApi.listRelatedCollections('<collection-id>');

Create a New Collection

A Promise factory to create a new collection. This requires the write_collections scope.

POST /collections
Parameters
ParameterTypeDescriptionOptionalDefault
titlestringThe title of the collectionno
descriptionstringThe collection’s descriptionyes
privatebooleanWhether to make this collection privateyesfalse
UnsplashApi.createNewColection('<collection-name>', '<description>', false);

Update an Existing Ccollection

A Promise factory to update an existing collection belonging to the logged-in user. This requires the write_collections scope.

PUT /collections/:id
Parameters
ParameterTypeDescriptionOptionalDefault
idstringThe collection idno
titlestringThe title of the collectionyes
descriptionstringThe collection’s descriptionyes
privatebooleanWhether to make this collection privateyesfalse
UnsplashApi.updateExistingCollection('<collection-id>','<collection-name>', '<description>', false);

Delete a Collection

A Promise factory to delete a collection belonging to the logged-in user. This requires the write_collections scope.

DELETE /collections/:id
Parameters
ParameterTypeDescriptionOptionalDefault
idstringThe Collection IDno
UnsplashApi.deleteCollection('<collection-id>');

Add a Photo to a Collection

A Promise factory to add a photo to one of the logged-in user’s collections. Requires the write_collections scope.

POST /collections/:collection_id/add
Parameters
ParameterTypeDescriptionOptionalDefault
collection_idstringThe Collection IDno
photo_idstringThe Photo IDno

Note: If the photo is already in the collection, this acion has no effect.

UnsplashApi.addPhotoToCollection('<collection-id>', '<photo-id>');

Remove a Photo from a Collection

A Promise factory to remove a photo from one of the logged-in user’s collections. Requires the write_collections scope.

DELETE  /collections/:collection_id/remove
Parameters
ParameterTypeDescriptionOptionalDefault
collection_idstringThe Collection IDno
photo_idstringThe Photo IDno
UnsplashApi.removePhotoFromCollection('<collection-id>', '<photo-id>');

Continuous Integration (CI)

Continuous Integration services monitor repositories for changes, then automatically run unit tests on your behalf, typically in a containerized environment. To test this setup works in a continuous integration environment, an integration was done with Travis CI. According to the Travis Node.js Documentation, Travis automatically runs npm install and npm test. The only additional thing I had to add to the Travis configuration was to run npm run build before running the tests. The working Travis config looks like this:

language: node_js

node_js:
  - stable

install:
  - npm install

script:
  - npm run build
  - npm test

Here's the Travis build page for this project, which shows the tests passing.

Tests

WrapSplashJS uses Jest as the testing environment. All the test spec files are available in the test folder. For more information read the README file from the test folder.

License

The MIT License

Copyright (c) 2018- Sandeep Vattapparambil, http://www.sandeepv.in

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Acknowledgements

Thanks, and Kudos to team Unsplash for creating a wonderful platform for sharing beautiful high quality free images and photos.

Made with :heart: by Sandeep Vattapparambil.

4.1.0

4 years ago

4.0.1

5 years ago

4.0.0

6 years ago

3.0.8

6 years ago

3.0.7

6 years ago

3.0.6

6 years ago

3.0.5

6 years ago

3.0.4

6 years ago

3.0.3

6 years ago

3.0.2

6 years ago

3.0.1

6 years ago

3.0.0

6 years ago

2.0.1

6 years ago

2.0.0

6 years ago

1.1.0

6 years ago

1.0.10

6 years ago

1.0.9

6 years ago

1.0.8

6 years ago

1.0.7

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago