contentful
Advanced tools
Comparing version 4.1.2 to 4.2.0
{ | ||
"name": "contentful", | ||
"description": "Client for Contentful's Content Delivery API", | ||
"version": "4.1.2", | ||
"version": "4.2.0", | ||
"homepage": "https://www.contentful.com/developers/documentation/content-delivery-api/", | ||
@@ -60,3 +60,3 @@ "main": "./dist/contentful.node.js", | ||
"axios": "~0.15.3", | ||
"contentful-sdk-core": "^3.8.0", | ||
"contentful-sdk-core": "^3.9.0", | ||
"es6-promise": "^4.0.5" | ||
@@ -63,0 +63,0 @@ }, |
@@ -28,3 +28,4 @@ [![npm](https://img.shields.io/npm/v/contentful.svg)](https://www.npmjs.com/package/contentful) | ||
- Firefox | ||
- IE11 / Edge | ||
- Edge | ||
- IE11 (with [es6-promise](https://github.com/stefanpenner/es6-promise) polyfill applied) | ||
- Safari | ||
@@ -41,2 +42,3 @@ - node.js (4.x, 6.x) | ||
- [Authentication](#authentication) | ||
- [Using ES6 import](#using-es6-import) | ||
- [Your first request](#your-first-request) | ||
@@ -80,3 +82,28 @@ - [Using this SDK with the Preview API](#using-this-SDK-with-the-Preview-API) | ||
For more information, check the Contentful's REST API reference on [Authentication](https://www.contentful.com/developers/docs/references/authentication/). | ||
## Using ES6 import | ||
You can use the es6 import with the SDK as follow | ||
```js | ||
// import createClient directly | ||
import {createClient} from 'contentful' | ||
var client = createClient({ | ||
// This is the space ID. A space is like a project folder in Contentful terms | ||
space: 'developer_bookshelf', | ||
// This is the access token for this space. Normally you get both ID and the token in the Contentful web app | ||
accessToken: '0b7f6x59a0' | ||
}) | ||
//.... | ||
``` | ||
OR | ||
```js | ||
// import everything from contentful | ||
import * as contentful from 'contentful' | ||
var client = contentful.createClient({ | ||
// This is the space ID. A space is like a project folder in Contentful terms | ||
space: 'developer_bookshelf', | ||
// This is the access token for this space. Normally you get both ID and the token in the Contentful web app | ||
accessToken: '0b7f6x59a0' | ||
}) | ||
// .... | ||
``` | ||
## Your first request | ||
@@ -132,3 +159,3 @@ | ||
Please note that the link resolution is only possible when requesting records from the collection endpoint using `client.getEntries()` or by performing and initial sync `client.sync({initial: true})`. In case you want to request one entry and benefit from the link resolution you can use the collection end point with the following query parameter `'sys.id': '<your-entry-id>'`. | ||
Please note that the link resolution is only possible when requesting records from the collection endpoint using `client.getEntries()` or by performing an initial sync `client.sync({initial: true})`. In case you want to request one entry and benefit from the link resolution you can use the collection end point with the following query parameter `'sys.id': '<your-entry-id>'`. | ||
@@ -145,4 +172,4 @@ **e.g.** assuming that you have a contentType `post` that has a reference field `author` | ||
client.getEntries({'sys.id': '<entry-id>'}).then((response) => { | ||
// output the author name | ||
console.log(response.items[0].fields.author.fields.name) | ||
// output the author name | ||
console.log(response.items[0].fields.author.fields.name) | ||
}) | ||
@@ -166,4 +193,4 @@ ``` | ||
client.sync({initial: true}).then((response) => { | ||
// You should save the `nextSyncToken` to use in the following sync | ||
console.log(response.nextSyncToken) | ||
// You should save the `nextSyncToken` to use in the following sync | ||
console.log(response.nextSyncToken) | ||
}) | ||
@@ -187,4 +214,4 @@ ``` | ||
client.getEntries({'sys.id': '<entry-id>'}).then((response) => { | ||
// output the author name | ||
console.log(response.items[0].fields.author.fields.name) | ||
// output the author name | ||
console.log(response.items[0].fields.author.fields.name) | ||
}) | ||
@@ -191,0 +218,0 @@ |
@@ -1,1 +0,1 @@ | ||
module.exports = '4.1.2' | ||
module.exports = '4.2.0' |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
823058
19683
289
25
Updatedcontentful-sdk-core@^3.9.0