All Projects → ButterCMS → buttercms-go

ButterCMS / buttercms-go

Licence: other
Golang CMS and blog engine https://buttercms.com

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to buttercms-go

psd2
API client for banks supporting PSD2 APIs with OAuth2 authentication.
Stars: ✭ 26 (-29.73%)
Mutual labels:  api-client
notion-sdk-net
A Notion SDK for .Net
Stars: ✭ 71 (+91.89%)
Mutual labels:  api-client
private-packagist-api-client
Private Packagist API Client
Stars: ✭ 28 (-24.32%)
Mutual labels:  api-client
jusibe
📲 JavaScript client for Jusibe.com SMS API service. http://jusibe.com
Stars: ✭ 24 (-35.14%)
Mutual labels:  api-client
pycloud
A Python implementation of the pCloud API
Stars: ✭ 54 (+45.95%)
Mutual labels:  api-client
google-photos-api-client-go
Google photos api client in go
Stars: ✭ 35 (-5.41%)
Mutual labels:  api-client
notion-sdk-py
Official Notion SDK rewritten in Python (sync + async)
Stars: ✭ 753 (+1935.14%)
Mutual labels:  api-client
docker
R Package For Accessing Docker via Docker APIs
Stars: ✭ 23 (-37.84%)
Mutual labels:  api-client
mercury-parserpy
python api wrapper for https://mercury.postlight.com/web-parser/
Stars: ✭ 16 (-56.76%)
Mutual labels:  api-client
SketchwareAPI
Sketchware API Multiplatform Library
Stars: ✭ 26 (-29.73%)
Mutual labels:  api-client
upcloud-python-api
Python client for UpCloud's API
Stars: ✭ 51 (+37.84%)
Mutual labels:  api-client
ninja automator
Acquire data with honour and wisdom — using the way of the ninja.
Stars: ✭ 21 (-43.24%)
Mutual labels:  api-client
HTTPCalloutFramework
HTTP Callout Framework - A light weight callout framework for apex HTTP callouts in Salesforce
Stars: ✭ 43 (+16.22%)
Mutual labels:  api-client
deepl-api-connector
Connector library for deepl.com rest translation api
Stars: ✭ 12 (-67.57%)
Mutual labels:  api-client
ebics-java-client
Java open source EBICS client - Support for French, German and Swiss banks
Stars: ✭ 30 (-18.92%)
Mutual labels:  api-client
sevenbridges-python
SevenBridges Python Api bindings
Stars: ✭ 41 (+10.81%)
Mutual labels:  api-client
pylistenbrainz
A simple ListenBrainz client library for Python
Stars: ✭ 17 (-54.05%)
Mutual labels:  api-client
platformsh-client-php
Platform.sh API client for PHP
Stars: ✭ 24 (-35.14%)
Mutual labels:  api-client
ksoftapi.py
Official API Wrapper for KSoft.Si API
Stars: ✭ 31 (-16.22%)
Mutual labels:  api-client
InstaLite
Instagram api not official easy-to-use class, minimal number of features
Stars: ✭ 72 (+94.59%)
Mutual labels:  api-client

ButterCMS Go API Wrapper

This wrapper is meant to enable Go developers to quickly and easily get up and running with ButterCMS. It is based of off the API documentation.

Versioning

Each revision of the binding is tagged and the version is updated accordingly.

It is highly recommended you use go modules for vendoring/package management, in order to ensure a newer version of the binding does not affect backwards compatibility.

Installation

go get github.com/buttercms/buttercms-go

Pages

Full list of params availble in our official API Documentation

params := map[string]string{"foo": "bar"}
ButterCMS.GetPages("news", params)
ButterCMS.GetPage("news", "another-test-page", params)

Collections

Full list of params availble in our official API Documentation

params := map[string]string{"locale": "en"}
ButterCMS.GetContentFields([]string{"collection_key"}, params)

Blog Engine

// Posts
params := map[string]string{"page": "2"}
ButterCMS.GetPosts(params)
ButterCMS.GetPost("slug")

// Authors
params = map[string]string{"include": "recent_posts"}
ButterCMS.GetAuthors(params)
ButterCMS.GetAuthor("slug", params)

// Categories
ButterCMS.GetCategories(params)
ButterCMS.GetCategory("slug", params)

// Feeds
ButterCMS.GetFeed("rss|atom|sitemap")

// Search
ButterCMS.SearchPosts("query", params)

Usage

To include this package in your Go code, simply use import "ButterCMS" at the top of your file

Example Usage

package main

import (
	"github.com/buttercms/buttercms-go"
	"fmt"
	"encoding/json"
)

func main() {
	ButterCMS.SetAuthToken("<auth_token>")

	params := map[string]string{"include": "recent_posts"}
	authorResp, err := ButterCMS.GetAuthors(params)
	if err != nil {
		panic(err.Error())
	}

	fmt.Printf("%+v\n", authorResp)

	params = map[string]string{"author_slug": "author-slug"}
	postResp, err := ButterCMS.GetPosts(params)
	if err != nil {
		panic(err.Error())
	}

	fmt.Printf("%+v\n", postResp)

	pagesResp, err := ButterCMS.GetPages("news", nil)
	if err != nil {
		panic(err.Error())
	}

	fmt.Printf("%d Results\n", pagesResp.MetaData.Count)
	for index, page := range pagesResp.PageList {
		fmt.Printf("Result %d: %s\n", index, page.Slug)

		if (len(page.Fields) > 0) {
			fmt.Println("Custom fields:")
			for fieldName, fieldValue := range page.Fields {
				switch value := fieldValue.(type) {
					case string:
						fmt.Printf("Field '%1s' has value '%2s'\n", fieldName, value)
					default:
						fmt.Println("Other type\n")
				}
			}
		}
	}

	contentParams := map[string]string{}
	contentKeys := []string{"somethings"}
	contentResp, err := ButterCMS.GetContentFields(contentKeys, contentParams)
	if err != nil {
		panic(err.Error())
	}

	j, err := json.Marshal(contentResp)
	if err != nil {
		fmt.Println(err)
	}

	fmt.Println(string(j))
}

Other

View these Go Blog engine and Full CMS for other examples of using ButterCMS with Go.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].