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

Jun 13, 2024
49389a0 · Jun 13, 2024
Apr 2, 2019
Jun 13, 2024
Apr 16, 2020
Apr 11, 2023
Apr 5, 2024
Oct 26, 2017
May 24, 2023
Apr 9, 2019
Jun 22, 2021
Apr 16, 2024
Apr 10, 2024
Apr 10, 2024
Apr 10, 2024
Apr 16, 2024
Jun 15, 2023
May 13, 2024
Feb 8, 2024
Apr 11, 2024
Oct 15, 2019
Jun 22, 2021
Mar 1, 2018
Apr 5, 2024
Feb 7, 2022
Mar 22, 2024
Apr 5, 2024
Apr 5, 2024
Aug 16, 2023
Sep 27, 2023
May 10, 2023
Mar 20, 2024
Apr 8, 2024
Apr 3, 2024
Apr 16, 2024
Apr 8, 2024
May 9, 2022
Feb 7, 2024
Apr 10, 2024
Oct 20, 2023
Apr 16, 2024
Apr 16, 2024
Apr 4, 2019
Mar 22, 2024
Apr 16, 2024
Mar 28, 2022
Apr 8, 2024
Apr 5, 2024
Feb 7, 2024
Apr 1, 2019
Apr 8, 2024
Oct 22, 2019
Apr 3, 2024
Mar 27, 2018
Jul 24, 2020

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