Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/moonwalker/gontentful
Contentful client library for Go with a command line interface
https://github.com/moonwalker/gontentful
contentful golang
Last synced: about 1 month ago
JSON representation
Contentful client library for Go with a command line interface
- Host: GitHub
- URL: https://github.com/moonwalker/gontentful
- Owner: moonwalker
- License: mit
- Created: 2017-09-25T08:35:21.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2024-04-11T10:16:25.000Z (7 months ago)
- Last Synced: 2024-04-12T16:58:19.354Z (7 months ago)
- Topics: contentful, golang
- Language: Go
- Homepage:
- Size: 38.3 MB
- Stars: 0
- Watchers: 10
- Forks: 1
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Gontentful
Contentful client library for Go with a command line interface for schema export and data sync.
## Library
### Install
```sh
$ go get -u github.com/moonwalker/gontentful
```### Usage
Create client:
```sh
import (
"github.com/moonwalker/gontentful"
)client := gontentful.NewClient(&gontentful.ClientOptions{
CdnURL: "cdn.contentful.com",
SpaceID: ,
EnvironmentID: ,
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()
```## CLI
### Install
```sh
$ go get -u github.com/moonwalker/gontentful/cmd/gfl
```### Usage
Schema export:
```sh
# generate postgres schema and print to stdout
$ gfl schema pg --space --token# generate postgres schema and execute on the specified database
$ gfl schema pg --space --token --url postgres://user:pass@host:port/db# generate graphql schema and print to stdout
$ gfl schema gql --space --token
```Data sync:
```sh
# sync data to postgres (init sync first then incremental)
$ gfl sync pg --space --token --url postgres://user:pass@host:port/db# sync data to postgres (init sync always start from scratch)
$ gfl sync pg --init --space --token --url postgres://user:pass@host:port/db
```## Dependencies
Using Go modules:
```sh
$ go mod vendor
```## License
Licensed under the [MIT License](LICENSE)
### Acknowledgements
Utilize code from [contentful-go](https://github.com/contentful-labs/contentful-go)