microcms

package module
Version: v0.0.0-...-ce649c8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 25, 2021 License: Apache-2.0 Imports: 3 Imported by: 0

README

microCMS Golang SDK

It helps you to use microCMS from Golang applications.

Getting Started

Install

Install package.

$ go get github.com/microcmsio/microcms-go-sdk 
How to use

First, create client.

package main

import (
	"fmt"
	"github.com/microcmsio/microcms-go-sdk"
)

func main() {
	serviceDomain := "YOUR_DOMAIN" // YOUR_DOMAIN is the XXXX part of XXXX.microcms.io
	apiKey := "YOUR_API_KEY"
  globalDraftKey: "YOUR_GLOBAL_DRAFT_KEY", // If need 

  // If you specify globalDraftKey, please use microcms.GlobalDraftKey
	c := microcms.CreateClient(serviceDomain, apiKey, microcms.GlobalDraftKey(globalDraftKey))
}

After, How to use it below.

  endpoint := "endpoint"
  contenttId := "contenttId" 

	data, _ := c.Get(endpoint, microcms.ContentId(contentId))

Documentation

Index

Constants

View Source
const (
	BASE_DOMAIN = "microcms.io"
	API_VERSION = "v1"
)

Base API endpoint

View Source
const (
	GET = "GET"
)

Support HTTP request

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

func CreateClient

func CreateClient(serviceDomain, apiKey string, params ...ClientParams) *Client

func (*Client) Get

func (c *Client) Get(endpoint string, params ...RequestParams) (interface{}, error)

type ClientParams

type ClientParams func(*Client)

func GlobalDraftKey

func GlobalDraftKey(v string) ClientParams

type Params

type Params struct {
	// contains filtered or unexported fields
}

type RequestParams

type RequestParams func(*Params)

func ContentId

func ContentId(v string) RequestParams

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL