Skip to content

Contentful client library for Go with a command line interface

License

Notifications You must be signed in to change notification settings

moonwalker/gontentful

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Gontentful

Contentful client library for Go with a command line interface for schema export and data sync.

Library

Install

$ go get -u github.com/moonwalker/gontentful

Usage

Create client:

import (
	"github.com/moonwalker/gontentful"
)

client := gontentful.NewClient(&gontentful.ClientOptions{
	CdnURL:        "cdn.contentful.com",
	SpaceID:       <spaceid>,
	EnvironmentID: <environmentid>,
	CdnToken:      <cdntoken>,
})

// get entries
query := url.Values{}
query.Set("content_type", "foo")
query.Set("locale", "en")
entries, err := client.Entries.GetEntries(query)

// get entry
entry, err := client.Entries.GetSingle(<entryid>)

CLI

Install

$ go get -u github.com/moonwalker/gontentful/cmd/gfl

Usage

Schema export:

# generate postgres schema and print to stdout
$ gfl schema pg --space <spaceid> --token <token>

# generate postgres schema and execute on the specified database
$ gfl schema pg --space <spaceid> --token <token> --url postgres://user:pass@host:port/db

# generate graphql schema and print to stdout
$ gfl schema gql --space <spaceid> --token <token>

Data sync:

# sync data to postgres (init sync first then incremental)
$ gfl sync pg --space <spaceid> --token <token> --url postgres://user:pass@host:port/db

# sync data to postgres (init sync always start from scratch)
$ gfl sync pg --init --space <spaceid> --token <token> --url postgres://user:pass@host:port/db

Dependencies

Using Go modules:

$ go mod vendor

License

Licensed under the MIT License

Acknowledgements

Utilize code from contentful-go

About

Contentful client library for Go with a command line interface

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages