Skip to content

Elixir client library for Sanity CMS.

License

Notifications You must be signed in to change notification settings

balexand/sanity

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sanity

Package Documentation CI

A client library for the Sanity CMS API.

Installation

The package can be installed by adding sanity to your list of dependencies in mix.exs:

def deps do
  [
    {:sanity, "~> 2.0"}
  ]
end

Examples

request_opts = [project_id: "abc", dataset: "production", token: "secret"]

Request all published pages using Sanity.query/3:

Sanity.query(~S'*[_type == "page"]', %{}, perspective: "published")
|> Sanity.request!(request_opts)

Make the same request with Sanity.stream/1:

Sanity.stream(query: ~S'_type == "page"', request_opts: request_opts)
|> Enum.to_list()

Related Projects

Supported endpoints

  • Assets
  • Doc
  • Export
  • History
  • Listen (see #74)
  • Mutate
  • Projects
  • Query

About

Elixir client library for Sanity CMS.

Resources

License

Stars

Watchers

Forks

Packages

No packages published