Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

unsplash-js

Package Overview
Dependencies
Maintainers
2
Versions
53
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

unsplash-js - npm Package Versions

13
6

7.0.9

Diff

unsplash
published 7.0.8 •

unsplash
published 7.0.7 •

unsplash
published 7.0.6 •

unsplash
published 7.0.5 •

unsplash
published 7.0.4 •

unsplash
published 7.0.3 •

Changelog

Source

7.0.3

  • Adds response types to all endpoints.
unsplash
published 7.0.2 •

unsplash
published 7.0.1 •

unsplash
published 7.0.0 •

Changelog

Source

7.0.0

This version includes a total TypeScript rewrite of the library, with many breaking changes. If upgrading from a previous version, read carefully. You will not be able to upgrade to v7 without making the necessary adjustments.

Breaking Changes

  • Replaces the Unsplash class with a named createApi function:
// before
import Unsplash from 'unsplash-js';
const unsplash = new Unsplash({ accessKey: 'MY_ACCESS_KEY' });

// after
import { createApi } from 'unsplash-js';
const unsplash = createApi({ accessKey: 'MY_ACCESS_KEY' });
// or
import Unsplash from 'unsplash-js';
const unsplash = Unsplash.createApi({ accessKey: 'MY_ACCESS_KEY' });
  • Removes user authentication features from the library. This means that the createApi function does not recieve secret, callbackUrl or bearerToken.
  • Removes the following API methods (primarily due to removal of user authentication):

    • photos:
      • likePhoto
      • unlikePhoto
      • downloadPhoto (deprecated in 6.3, replaced with trackDownload)
    • users:
      • statistics
    • collections:
      • createCollection
      • updateCollection
      • deleteCollection
      • addPhotoToCollection
      • removePhotoFromCollection
    • auth:
      • getAuthenticationUrl
      • userAuthentication
      • setBearerToken
    • currentUser:
      • profile
      • updateProfile
    • stats:
      • total
    • toJson (the library now takes care of converting the response to JSON).
  • Renames all of the remaining API methods:

    • search:
      • ⚠️ photos --> getPhotos
      • ⚠️ users --> getUsers
      • ⚠️ collections --> getCollections
    • photos:
      • ⚠️ listPhotos --> list
      • ⚠️ getPhoto --> get
      • ⚠️ getRandomPhoto --> getRandom
      • ⚠️ getPhotoStats --> getStats
    • users:
      • ⚠️ profile --> get
      • ⚠️ photos --> getPhotos
      • ⚠️ likes --> getLikes
      • ⚠️ collections --> getCollections
    • collections:
      • ⚠️ listCollections --> list
      • ⚠️ getCollection --> get
      • ⚠️ getCollectionPhotos --> getPhotos
      • ⚠️ listRelatedCollections --> listRelated
  • Changes the format of the parameters for all API methods. They are now all named parameters within the first argument, instead of multiple arguments. Check the TypeScript types and the Arguments section of the docs for the new parameters format.
  • Changes the format of the responses for all API methods. The JSON is now parsed and returned, removing the need for the toJson helper. Feeds have the "x-total" header added to the response. The library now also performs error-handling: expected errors are returned instead of thrown, along with a description of their source. Check the TypeScript types and the Response section of the docs for the new response format.

Changes

  • TypeScript support! Everything is now accurately typed (except responses which we plan to add types for soon).
  • You can now provide fetch options on a per-call basis using the second parameter. See Arguments.
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc