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 Compare versions

Comparing version 7.0.2 to 7.0.3

dist/methods/collections/types.d.ts

4

CHANGELOG.md
# Changelog
## 7.0.3
- Adds response types to all endpoints.
## 7.0.0

@@ -4,0 +8,0 @@

30

dist/index.d.ts

@@ -19,5 +19,5 @@ import * as search from './methods/search';

photoId: string;
}, additionalFetchOptions?: Pick<RequestInit, "body" | "cache" | "credentials" | "headers" | "integrity" | "keepalive" | "mode" | "redirect" | "referrer" | "referrerPolicy" | "signal" | "window"> | undefined) => Promise<import("./helpers/response").ApiResponse<any>>;
}, additionalFetchOptions?: Pick<RequestInit, "body" | "cache" | "credentials" | "headers" | "integrity" | "keepalive" | "mode" | "redirect" | "referrer" | "referrerPolicy" | "signal" | "window"> | undefined) => Promise<import("./helpers/response").ApiResponse<import("./methods/photos/types").Full>>;
list: (a: import("./types/request").PaginationParams | undefined, additionalFetchOptions?: Pick<RequestInit, "body" | "cache" | "credentials" | "headers" | "integrity" | "keepalive" | "mode" | "redirect" | "referrer" | "referrerPolicy" | "signal" | "window"> | undefined) => Promise<import("./helpers/response").ApiResponse<{
results: any[];
results: import("./methods/photos/types").Basic[];
total: number;

@@ -27,3 +27,3 @@ }>>;

photoId: string;
}, additionalFetchOptions?: Pick<RequestInit, "body" | "cache" | "credentials" | "headers" | "integrity" | "keepalive" | "mode" | "redirect" | "referrer" | "referrerPolicy" | "signal" | "window"> | undefined) => Promise<import("./helpers/response").ApiResponse<any>>;
}, additionalFetchOptions?: Pick<RequestInit, "body" | "cache" | "credentials" | "headers" | "integrity" | "keepalive" | "mode" | "redirect" | "referrer" | "referrerPolicy" | "signal" | "window"> | undefined) => Promise<import("./helpers/response").ApiResponse<import("./methods/photos/types").Stats>>;
getRandom: (a: ({

@@ -35,6 +35,8 @@ collectionIds?: string[] | undefined;

count?: number | undefined;
} & import("./types/request").OrientationParam) | undefined, additionalFetchOptions?: Pick<RequestInit, "body" | "cache" | "credentials" | "headers" | "integrity" | "keepalive" | "mode" | "redirect" | "referrer" | "referrerPolicy" | "signal" | "window"> | undefined) => Promise<import("./helpers/response").ApiResponse<any>>;
} & import("./types/request").OrientationParam) | undefined, additionalFetchOptions?: Pick<RequestInit, "body" | "cache" | "credentials" | "headers" | "integrity" | "keepalive" | "mode" | "redirect" | "referrer" | "referrerPolicy" | "signal" | "window"> | undefined) => Promise<import("./helpers/response").ApiResponse<import("./methods/photos/types").Random>>;
trackDownload: (a: {
downloadLocation: string;
}, additionalFetchOptions?: Pick<RequestInit, "body" | "cache" | "credentials" | "headers" | "integrity" | "keepalive" | "mode" | "redirect" | "referrer" | "referrerPolicy" | "signal" | "window"> | undefined) => Promise<import("./helpers/response").ApiResponse<any>>;
}, additionalFetchOptions?: Pick<RequestInit, "body" | "cache" | "credentials" | "headers" | "integrity" | "keepalive" | "mode" | "redirect" | "referrer" | "referrerPolicy" | "signal" | "window"> | undefined) => Promise<import("./helpers/response").ApiResponse<{
url: string;
}>>;
};

@@ -47,3 +49,3 @@ users: {

} & import("./types/request").PaginationParams, additionalFetchOptions?: Pick<RequestInit, "body" | "cache" | "credentials" | "headers" | "integrity" | "keepalive" | "mode" | "redirect" | "referrer" | "referrerPolicy" | "signal" | "window"> | undefined) => Promise<import("./helpers/response").ApiResponse<{
results: any[];
results: import("./methods/photos/types").Basic[];
total: number;

@@ -54,3 +56,3 @@ }>>;

} & import("./types/request").PaginationParams, additionalFetchOptions?: Pick<RequestInit, "body" | "cache" | "credentials" | "headers" | "integrity" | "keepalive" | "mode" | "redirect" | "referrer" | "referrerPolicy" | "signal" | "window"> | undefined) => Promise<import("./helpers/response").ApiResponse<{
results: any[];
results: import("./methods/collections/types").Basic[];
total: number;

@@ -61,3 +63,3 @@ }>>;

} & import("./types/request").PaginationParams, additionalFetchOptions?: Pick<RequestInit, "body" | "cache" | "credentials" | "headers" | "integrity" | "keepalive" | "mode" | "redirect" | "referrer" | "referrerPolicy" | "signal" | "window"> | undefined) => Promise<import("./helpers/response").ApiResponse<{
results: any[];
results: import("./methods/photos/types").Basic[];
total: number;

@@ -67,6 +69,6 @@ }>>;

username: string;
}, additionalFetchOptions?: Pick<RequestInit, "body" | "cache" | "credentials" | "headers" | "integrity" | "keepalive" | "mode" | "redirect" | "referrer" | "referrerPolicy" | "signal" | "window"> | undefined) => Promise<import("./helpers/response").ApiResponse<any>>;
}, additionalFetchOptions?: Pick<RequestInit, "body" | "cache" | "credentials" | "headers" | "integrity" | "keepalive" | "mode" | "redirect" | "referrer" | "referrerPolicy" | "signal" | "window"> | undefined) => Promise<import("./helpers/response").ApiResponse<import("./methods/users/types").Full>>;
};
search: {
getCollections: (a: search.SearchParams, additionalFetchOptions?: Pick<RequestInit, "body" | "cache" | "credentials" | "headers" | "integrity" | "keepalive" | "mode" | "redirect" | "referrer" | "referrerPolicy" | "signal" | "window"> | undefined) => Promise<import("./helpers/response").ApiResponse<any>>;
getCollections: (a: search.SearchParams, additionalFetchOptions?: Pick<RequestInit, "body" | "cache" | "credentials" | "headers" | "integrity" | "keepalive" | "mode" | "redirect" | "referrer" | "referrerPolicy" | "signal" | "window"> | undefined) => Promise<import("./helpers/response").ApiResponse<import("./methods/search/types/response").Collections>>;
getPhotos: (a: {

@@ -77,7 +79,7 @@ query: string;

color?: "white" | "black" | "yellow" | "orange" | "red" | "purple" | "magenta" | "green" | "teal" | "blue" | "black_and_white" | undefined;
lang?: import("./methods/search/types").Language | undefined;
lang?: import("./methods/search/types/request").Language | undefined;
contentFilter?: "high" | "low" | undefined;
collectionIds?: string[] | undefined;
}, additionalFetchOptions?: Pick<RequestInit, "body" | "cache" | "credentials" | "headers" | "integrity" | "keepalive" | "mode" | "redirect" | "referrer" | "referrerPolicy" | "signal" | "window"> | undefined) => Promise<import("./helpers/response").ApiResponse<any>>;
getUsers: (a: search.SearchParams, additionalFetchOptions?: Pick<RequestInit, "body" | "cache" | "credentials" | "headers" | "integrity" | "keepalive" | "mode" | "redirect" | "referrer" | "referrerPolicy" | "signal" | "window"> | undefined) => Promise<import("./helpers/response").ApiResponse<any>>;
}, additionalFetchOptions?: Pick<RequestInit, "body" | "cache" | "credentials" | "headers" | "integrity" | "keepalive" | "mode" | "redirect" | "referrer" | "referrerPolicy" | "signal" | "window"> | undefined) => Promise<import("./helpers/response").ApiResponse<import("./methods/search/types/response").Photos>>;
getUsers: (a: search.SearchParams, additionalFetchOptions?: Pick<RequestInit, "body" | "cache" | "credentials" | "headers" | "integrity" | "keepalive" | "mode" | "redirect" | "referrer" | "referrerPolicy" | "signal" | "window"> | undefined) => Promise<import("./helpers/response").ApiResponse<import("./methods/search/types/response").Users>>;
};

@@ -103,4 +105,4 @@ collections: {

};
export { Language, ColorId, ContentFilter, SearchOrderBy } from './methods/search/types';
export { Language, ColorId, ContentFilter, SearchOrderBy } from './methods/search/types/request';
export { OrderBy, Orientation } from './types/request';
export { _internals };
import { OrientationParam, PaginationParams } from '../../types/request';
import * as Photo from './types';
declare type PhotoId = {

@@ -8,3 +9,3 @@ photoId: string;

handleResponse: import("../../helpers/response").HandleResponse<{
results: any[];
results: Photo.Basic[];
total: number;

@@ -15,7 +16,7 @@ }>;

handleRequest: (a: PhotoId, additionalFetchOptions?: Pick<RequestInit, "headers" | "body" | "cache" | "credentials" | "integrity" | "keepalive" | "mode" | "redirect" | "referrer" | "referrerPolicy" | "signal" | "window"> | undefined) => import("../../helpers/request").CompleteRequestParams;
handleResponse: import("../../helpers/response").HandleResponse<any>;
handleResponse: import("../../helpers/response").HandleResponse<Photo.Full>;
};
export declare const getStats: {
handleRequest: (a: PhotoId, additionalFetchOptions?: Pick<RequestInit, "headers" | "body" | "cache" | "credentials" | "integrity" | "keepalive" | "mode" | "redirect" | "referrer" | "referrerPolicy" | "signal" | "window"> | undefined) => import("../../helpers/request").CompleteRequestParams;
handleResponse: import("../../helpers/response").HandleResponse<any>;
handleResponse: import("../../helpers/response").HandleResponse<Photo.Stats>;
};

@@ -30,3 +31,3 @@ export declare const getRandom: {

} & OrientationParam) | undefined, additionalFetchOptions?: Pick<RequestInit, "headers" | "body" | "cache" | "credentials" | "integrity" | "keepalive" | "mode" | "redirect" | "referrer" | "referrerPolicy" | "signal" | "window"> | undefined) => import("../../helpers/request").CompleteRequestParams;
handleResponse: import("../../helpers/response").HandleResponse<any>;
handleResponse: import("../../helpers/response").HandleResponse<Photo.Random>;
};

@@ -37,4 +38,6 @@ export declare const trackDownload: {

}, additionalFetchOptions?: Pick<RequestInit, "headers" | "body" | "cache" | "credentials" | "integrity" | "keepalive" | "mode" | "redirect" | "referrer" | "referrerPolicy" | "signal" | "window"> | undefined) => import("../../helpers/request").CompleteRequestParams;
handleResponse: import("../../helpers/response").HandleResponse<any>;
handleResponse: import("../../helpers/response").HandleResponse<{
url: string;
}>;
};
export {};
import { OrientationParam, PaginationParams } from '../../types/request';
import { ColorId, ContentFilter, Language, SearchOrderBy } from './types';
import { ColorId, ContentFilter, Language, SearchOrderBy } from './types/request';
import * as SearchResponse from './types/response';
export declare type SearchParams = {

@@ -24,12 +25,12 @@ query: string;

handleRequest: (a: SearchPhotosParams, additionalFetchOptions?: Pick<RequestInit, "headers" | "body" | "cache" | "credentials" | "integrity" | "keepalive" | "mode" | "redirect" | "referrer" | "referrerPolicy" | "signal" | "window"> | undefined) => import("../../helpers/request").CompleteRequestParams;
handleResponse: import("../../helpers/response").HandleResponse<any>;
handleResponse: import("../../helpers/response").HandleResponse<SearchResponse.Photos>;
};
export declare const getCollections: {
handleRequest: (a: SearchParams, additionalFetchOptions?: Pick<RequestInit, "headers" | "body" | "cache" | "credentials" | "integrity" | "keepalive" | "mode" | "redirect" | "referrer" | "referrerPolicy" | "signal" | "window"> | undefined) => import("../../helpers/request").CompleteRequestParams;
handleResponse: import("../../helpers/response").HandleResponse<any>;
handleResponse: import("../../helpers/response").HandleResponse<SearchResponse.Collections>;
};
export declare const getUsers: {
handleRequest: (a: SearchParams, additionalFetchOptions?: Pick<RequestInit, "headers" | "body" | "cache" | "credentials" | "integrity" | "keepalive" | "mode" | "redirect" | "referrer" | "referrerPolicy" | "signal" | "window"> | undefined) => import("../../helpers/request").CompleteRequestParams;
handleResponse: import("../../helpers/response").HandleResponse<any>;
handleResponse: import("../../helpers/response").HandleResponse<SearchResponse.Users>;
};
export {};
import { OrientationParam, PaginationParams } from '../../types/request';
import * as User from './types';
import * as Photo from '../photos/types';
import * as Collection from '../collections/types';
declare type UserName = {

@@ -7,3 +10,3 @@ username: string;

handleRequest: (a: UserName, additionalFetchOptions?: Pick<RequestInit, "headers" | "body" | "cache" | "credentials" | "integrity" | "keepalive" | "mode" | "redirect" | "referrer" | "referrerPolicy" | "signal" | "window"> | undefined) => import("../../helpers/request").CompleteRequestParams;
handleResponse: import("../../helpers/response").HandleResponse<any>;
handleResponse: import("../../helpers/response").HandleResponse<User.Full>;
};

@@ -15,3 +18,3 @@ export declare const getPhotos: {

handleResponse: import("../../helpers/response").HandleResponse<{
results: any[];
results: Photo.Basic[];
total: number;

@@ -23,3 +26,3 @@ }>;

handleResponse: import("../../helpers/response").HandleResponse<{
results: any[];
results: Photo.Basic[];
total: number;

@@ -31,3 +34,3 @@ }>;

handleResponse: import("../../helpers/response").HandleResponse<{
results: any[];
results: Collection.Basic[];
total: number;

@@ -34,0 +37,0 @@ }>;

{
"name": "unsplash-js",
"version": "7.0.2",
"version": "7.0.3",
"description": "Official JavaScript wrapper for the Unsplash API",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

@@ -8,2 +8,3 @@ # Unsplash

Key Links:
- Before using the Unsplash API, [register as a developer](https://unsplash.com/developers).

@@ -14,3 +15,5 @@ - Before using the Unsplash API, read the [API Guidelines](https://help.unsplash.com/api-guidelines/unsplash-api-guidelines). Specifically, you _must_:

- [trigger a download when appropriate](https://help.unsplash.com/api-guidelines/more-on-each-guideline/guideline-triggering-a-download)
- Once you create an application and have an access key, go try the [demo](https://stackblitz.com/edit/unsplash-js-example?file=index.tsx)!
- Once you create an application and have an access key, go try the demos:
- [javascript](https://stackblitz.com/edit/unsplash-js-javascript?file=src%2Findex.js)
- [typescript](https://stackblitz.com/edit/unsplash-js-typescript?file=index.tsx)

@@ -79,3 +82,3 @@ ## Documentation

Note: Make sure to polyfill this interface if targetting older environments that do not implement it (i.e. Internet Explorer or Node < v8).
Note: Make sure to polyfill this interface if targetting older environments that do not implement it (i.e. Internet Explorer or Node < v8).

@@ -213,5 +216,11 @@ Note 2: For Node, the URL interface exists under `require('url').URL` since [v8](https://nodejs.org/es/blog/release/v8.0.0/#say-hello-to-the-whatwg-url-parser) but was only added to the global scope as of [v10.0.0](https://nodejs.org/docs/latest/api/globals.html#globals_url). If you are using a version between v8.0.0 and v10.0.0, you need to add the class to the global scope before using `unsplash-js`:

### Function arguments
![](./vscode-screenshot2.png)
![](./vscode-screenshot.png)
### Response Types
![](./vscode-response-types.png)
## Instance Methods

@@ -218,0 +227,0 @@

@@ -37,4 +37,4 @@ import { flow } from './helpers/fp';

export { Language, ColorId, ContentFilter, SearchOrderBy } from './methods/search/types';
export { Language, ColorId, ContentFilter, SearchOrderBy } from './methods/search/types/request';
export { OrderBy, Orientation } from './types/request';
export { _internals };

@@ -9,2 +9,3 @@ import { handleFeedResponse } from '../../helpers/feed';

import { OrientationParam, PaginationParams } from '../../types/request';
import * as Photo from './types';

@@ -22,3 +23,3 @@ type PhotoId = {

})),
handleResponse: handleFeedResponse<any>(),
handleResponse: handleFeedResponse<Photo.Basic>(),
};

@@ -31,3 +32,3 @@

})),
handleResponse: castResponse<any>(),
handleResponse: castResponse<Photo.Full>(),
};

@@ -40,3 +41,3 @@

})),
handleResponse: castResponse<any>(),
handleResponse: castResponse<Photo.Stats>(),
};

@@ -69,3 +70,3 @@

),
handleResponse: castResponse<any>(),
handleResponse: castResponse<Photo.Random>(),
};

@@ -82,3 +83,3 @@

}),
handleResponse: castResponse<any>(),
handleResponse: castResponse<{ url: string }>(),
};

@@ -6,3 +6,4 @@ import { compactDefined } from '../../helpers/fp';

import { OrientationParam, PaginationParams } from '../../types/request';
import { ColorId, ContentFilter, Language, SearchOrderBy } from './types';
import { ColorId, ContentFilter, Language, SearchOrderBy } from './types/request';
import * as SearchResponse from './types/response';

@@ -57,3 +58,3 @@ export type SearchParams = {

),
handleResponse: castResponse<any>(),
handleResponse: castResponse<SearchResponse.Photos>(),
};

@@ -66,3 +67,3 @@

})),
handleResponse: castResponse<any>(),
handleResponse: castResponse<SearchResponse.Collections>(),
};

@@ -75,3 +76,3 @@

})),
handleResponse: castResponse<any>(),
handleResponse: castResponse<SearchResponse.Users>(),
};

@@ -7,2 +7,5 @@ import { handleFeedResponse } from '../../helpers/feed';

import { OrientationParam, PaginationParams } from '../../types/request';
import * as User from './types';
import * as Photo from '../photos/types';
import * as Collection from '../collections/types';

@@ -20,3 +23,3 @@ type UserName = {

})),
handleResponse: castResponse<any>(),
handleResponse: castResponse<User.Full>(),
};

@@ -44,3 +47,3 @@

),
handleResponse: handleFeedResponse<any>(),
handleResponse: handleFeedResponse<Photo.Basic>(),
};

@@ -62,3 +65,3 @@

),
handleResponse: handleFeedResponse<any>(),
handleResponse: handleFeedResponse<Photo.Basic>(),
};

@@ -72,3 +75,3 @@ export const getCollections = {

),
handleResponse: handleFeedResponse<any>(),
handleResponse: handleFeedResponse<Collection.Basic>(),
};

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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