Giter VIP home page Giter VIP logo

contentful.ex's Introduction

Contentful Delivery SDK

Elixir client for the Contentful Content Delivery API.

Contentful is a content management platform for web applications, mobile apps and connected devices. It allows you to create, edit & manage content in the cloud and publish it anywhere via powerful API. Contentful offers tools for managing editorial teams and enabling cooperation between organizations.

Installation

If available in Hex, the package can be installed as:

  1. Add contentful to your list of dependencies in mix.exs:

    def deps do [{:contentful, "~> 0.1.0"}] end

  2. Ensure contentful is started before your application:

    def application do [applications: [:contentful]] end

Usage

All request accept an extra parameter for request parameters.

Entries

  • All Entries:
SPACE_ID = "my_space_id"
ACCESS_TOKEN = "my_access_token"

entries = Contentful.Delivery.entries(SPACE_ID, ACCESS_TOKEN)

# Printing Content Type ID for every entry
Enum.each(entries, fn (entry) -> IO.puts(entry["sys"]["contentType"]["sys"]["id"]) end)
  • Single Entry:
SPACE_ID = "my_space_id"
ACCESS_TOKEN = "my_access_token"
ENTRY_ID = "my_entry_id"

entry = Contentful.Delivery.entry(SPACE_ID, ACCESS_TOKEN, ENTRY_ID)
  • Search Parameters
SPACE_ID = "my_space_id"
ACCESS_TOKEN = "my_access_token"
SEARCH_PARAMS = %{
  "query" => "Some Fancy Text",
  "content_type" => "cat"
}

entries = Contentful.Delivery.entries(SPACE_ID, ACCESS_TOKEN, SEARCH_PARAMS)

Assets

  • All Assets:
SPACE_ID = "my_space_id"
ACCESS_TOKEN = "my_access_token"

assets = Contentful.Delivery.assets(SPACE_ID, ACCESS_TOKEN)
  • Single Asset:
SPACE_ID = "my_space_id"
ACCESS_TOKEN = "my_access_token"
ASSET_ID = "my_asset_id"

asset = Contentful.Delivery.asset(SPACE_ID, ACCESS_TOKEN, ASSET_ID)

Content Types

  • All Content Types:
SPACE_ID = "my_space_id"
ACCESS_TOKEN = "my_access_token"

content_types = Contentful.Delivery.content_types(SPACE_ID, ACCESS_TOKEN)
  • Single Content Type:
SPACE_ID = "my_space_id"
ACCESS_TOKEN = "my_access_token"
CONTENT_TYPE_ID = "my_content_type_id"

content_type = Contentful.Delivery.content_type(SPACE_ID, ACCESS_TOKEN, CONTENT_TYPE_ID)

Space

SPACE_ID = "my_space_id"
ACCESS_TOKEN = "my_access_token"

space = Contentful.Delivery.space(SPACE_ID, ACCESS_TOKEN)

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

contentful.ex's People

Contributors

nicocharlery avatar dlitvakb avatar andrew-bednarz-isobar avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.