Fliplet.Content()

(Returns Promise)

The fliplet-content package contains helpers to create and manage content using data sources.

When content is created using Fliplet.Content(), a record is stored in the specified data source. This can be used to aggregate all the content being created via different users, screens and apps.

Contents created with Fliplet.Content() can be used to create features such as:

To build these features, create an instance with Fliplet.Content() and use the returned object in the promise resolving function to call the available methods.

Fliplet.Content(dataSourceId)
Fliplet.Content(options)

Examples

Share a page with a URL

Fliplet.Content({dataSourceId: 2}).then(function (content) {
  content.create({
    pageId: 3
  }, {
    public: true
  }).then(function(entry){
    entry.data.publicSlug; // return the slug that can be used for sharing via a http://apps.fliplet.com/r/ URL
  });  
});

Count number of times a directory entry is tagged

Fliplet.Content({dataSourceId: 2}).then(function (content) {
  content.query({
    content: {
      pageId: 3282,
      dataSourceEntryId: 5234,
    }
  }).then(function(rows){
    rows; // returns all the data source entries related to the specified content
  });
});

Methods

.create()

(Returns Promise)

Create a content entry in the data source. The created entry is passed as the first parameter to the promise resolving function.

.create(content [, options ])

.query()

(Returns Promise)

Query for content entries. The result entries are passed as the first parameter to the promise resolving function.

.query([ options ])

.update()

(Returns Promise)

Update existing entries with new data.

Notes

.update(data, options)

.delete()

(Returns Promise)

Delete existing entries.

.delete(options)

Back to API documentation