cloudcms

package module
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2022 License: Apache-2.0 Imports: 15 Imported by: 0

README

cloudcms-go-driver

HTTP Driver for the for the Cloud CMS API

Installation

In your module directory, run:

go get github.com/gitana/cloudcms-go-driver

Examples

Below are some examples of how you might use this driver:

package main

import (
	"github.com/gitana/cloudcms-go-driver"
)

func main() {
    // Connect to CloudCMS using gitana.json in working directory
    session, err := cloudcms.ConnectDefault()
	if err != nil {
		fmt.Println(err)
        return
	}

    var repositoryId string


    // List branches
    branches, _ := session.ListBranches(repositoryId, nil)

    // Read branch
    branchId := "master"
    branch, _ := session.ReadBranch(repositoryId, branchId)

    // Read Node
    node, _ := session.ReadNode(repositoryId, branchId, nodeId)

    // Create Node
    nodeObj := cloudcms.JsonObject{
        "title": "Twelfth Night",
        "description": "An old play",
    }
    nodeId, _ := session.createNode(repositoryId, branchId, nodeObj, nil)

    // Query Nodes
    query := cloudcms.JsonObject{
        "_type": "store:book",
    }
    pagination := cloudcms.JsonObject{
        "limit": 1,
    }
    queriedNodes, _ session.QueryNodes(repositoryId, branchId, query, pagination)

    // Find Nodes
    find := cloudcms.JsonObject{
        "search": "Shakespeare",
        "query": JsonObject{
            "_type": "store:book",
        }
    }
    findNodes, _ := session.FindNodes(repositoryId, branchId, find ,nil)
}

Resources

Support

For information or questions about the Go Driver, please contact Cloud CMS at support@cloudcms.com.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractId

func ExtractId(obj *JsonObject) string

func ExtractTitle

func ExtractTitle(obj *JsonObject) string

func MapToReader

func MapToReader(obj JsonObject) io.Reader

func ToParams

func ToParams(objs ...JsonObject) url.Values

Types

type CloudCmsSession

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

func Connect

func Connect(cloudcmsConfig *CloudcmsConfig) (*CloudCmsSession, error)

func ConnectDefault

func ConnectDefault() (*CloudCmsSession, error)

func (*CloudCmsSession) AddNodeFeature

func (session *CloudCmsSession) AddNodeFeature(repositoryId string, branchId string, nodeId string, featureId string, config JsonObject) error

func (*CloudCmsSession) Associate

func (session *CloudCmsSession) Associate(repositoryId string, branchId string, nodeId string, otherNodeId string, associationTypeQName string, associationDirection string, obj JsonObject) (JsonObject, error)

func (*CloudCmsSession) AssociateChild

func (session *CloudCmsSession) AssociateChild(repositoryId string, branchId string, nodeId string, otherNodeId string, obj JsonObject) (JsonObject, error)

func (*CloudCmsSession) ChangeNodeQName

func (session *CloudCmsSession) ChangeNodeQName(repositoryId string, branchId string, nodeId string, newQName string) error

func (*CloudCmsSession) CreateBranch

func (session *CloudCmsSession) CreateBranch(repositoryId string, parentBranchId string, changesetId string, obj JsonObject) (JsonObject, error)

func (*CloudCmsSession) CreateNode

func (session *CloudCmsSession) CreateNode(repositoryId string, branchId string, obj JsonObject, opts map[string]string) (string, error)

func (*CloudCmsSession) CreateRepository

func (session *CloudCmsSession) CreateRepository(obj JsonObject) (JsonObject, error)

func (*CloudCmsSession) Delete

func (session *CloudCmsSession) Delete(url string, params url.Values) (JsonObject, error)

func (*CloudCmsSession) DeleteAttachment

func (session *CloudCmsSession) DeleteAttachment(repositoryId string, branchId string, nodeId string, attachmentId string) error

func (*CloudCmsSession) DeleteBranch

func (session *CloudCmsSession) DeleteBranch(repositoryId string, branchId string) error

func (*CloudCmsSession) DeleteNode

func (session *CloudCmsSession) DeleteNode(repositoryId string, branchId string, nodeId string) error

func (*CloudCmsSession) DeleteNodes

func (session *CloudCmsSession) DeleteNodes(repositoryId string, branchId string, nodeIds []string) ([]string, error)

func (*CloudCmsSession) DeleteRepository

func (session *CloudCmsSession) DeleteRepository(repositoryId string) error

func (*CloudCmsSession) Download

func (session *CloudCmsSession) Download(url string, params url.Values) (io.ReadCloser, error)

func (*CloudCmsSession) DownloadAttachment

func (session *CloudCmsSession) DownloadAttachment(repositoryId string, branchId string, nodeId string, attachmentId string) (io.ReadCloser, error)

func (*CloudCmsSession) FindNodes

func (session *CloudCmsSession) FindNodes(repositoryId string, branchId string, config JsonObject, pagination JsonObject) (*ResultMap, error)

func (*CloudCmsSession) Get

func (session *CloudCmsSession) Get(url string, params url.Values) (JsonObject, error)

func (*CloudCmsSession) GraphQLQuery

func (session *CloudCmsSession) GraphQLQuery(repositoryId string, branchId string, query string, operationName string, variables JsonObject) (JsonObject, error)

func (*CloudCmsSession) GraphQLSchema

func (session *CloudCmsSession) GraphQLSchema(repositoryId string, branchId string) (string, error)

func (*CloudCmsSession) ListAttachments

func (session *CloudCmsSession) ListAttachments(repositoryId string, branchId string, nodeId string) (*ResultMap, error)

func (*CloudCmsSession) ListBranches

func (session *CloudCmsSession) ListBranches(repositoryId string, pagination JsonObject) (*ResultMap, error)

func (*CloudCmsSession) ListIncomingAssociations

func (session *CloudCmsSession) ListIncomingAssociations(repositoryId string, branchId string, nodeId string, associationTypeQName string, pagination JsonObject) (*ResultMap, error)

func (*CloudCmsSession) ListNodeAssociations

func (session *CloudCmsSession) ListNodeAssociations(repositoryId string, branchId string, nodeId string, associationTypeQName string, associationDirection string, pagination JsonObject) (*ResultMap, error)

func (*CloudCmsSession) ListOutgoingAssociations

func (session *CloudCmsSession) ListOutgoingAssociations(repositoryId string, branchId string, nodeId string, associationTypeQName string, pagination JsonObject) (*ResultMap, error)

func (*CloudCmsSession) ListVersions

func (session *CloudCmsSession) ListVersions(repositoryId string, branchId string, nodeId string, options JsonObject, pagination JsonObject) (*ResultMap, error)

func (*CloudCmsSession) MultipartPost

func (session *CloudCmsSession) MultipartPost(url string, params url.Values, formContentType string, body io.Reader) (io.ReadCloser, error)

func (*CloudCmsSession) NodeTree

func (session *CloudCmsSession) NodeTree(repositoryId string, branchId string, nodeId string, config JsonObject) (JsonObject, error)

func (*CloudCmsSession) Patch

func (session *CloudCmsSession) Patch(url string, params url.Values, body io.Reader) (JsonObject, error)

func (*CloudCmsSession) PatchNode

func (session *CloudCmsSession) PatchNode(repositoryId string, branchId string, nodeId string, patchObj JsonObject) (JsonObject, error)

func (*CloudCmsSession) Post

func (session *CloudCmsSession) Post(url string, params url.Values, body io.Reader) (JsonObject, error)

func (*CloudCmsSession) Put

func (session *CloudCmsSession) Put(url string, params url.Values, body io.Reader) (JsonObject, error)

func (*CloudCmsSession) QueryBranches

func (session *CloudCmsSession) QueryBranches(repositoryId string, query JsonObject, pagination JsonObject) (*ResultMap, error)

func (*CloudCmsSession) QueryNodeChildren

func (session *CloudCmsSession) QueryNodeChildren(repositoryId string, branchId string, nodeId string, query JsonObject, pagination JsonObject) (*ResultMap, error)

func (*CloudCmsSession) QueryNodeRelatives

func (session *CloudCmsSession) QueryNodeRelatives(repositoryId string, branchId string, nodeId string, associationTypeQName string, associationDirection string, query JsonObject, pagination JsonObject) (*ResultMap, error)

func (*CloudCmsSession) QueryNodes

func (session *CloudCmsSession) QueryNodes(repositoryId string, branchId string, query JsonObject, pagination JsonObject) (*ResultMap, error)

func (*CloudCmsSession) QueryOneNode

func (session *CloudCmsSession) QueryOneNode(repositoryId string, branchId string, query JsonObject) (JsonObject, error)

func (*CloudCmsSession) QueryRepositories

func (session *CloudCmsSession) QueryRepositories(query JsonObject, pagination JsonObject) (*ResultMap, error)

func (*CloudCmsSession) ReadBranch

func (session *CloudCmsSession) ReadBranch(repositoryId string, branchId string) (JsonObject, error)

func (*CloudCmsSession) ReadJob

func (session *CloudCmsSession) ReadJob(jobId string) (JsonObject, error)

func (*CloudCmsSession) ReadNode

func (session *CloudCmsSession) ReadNode(repositoryId string, branchId string, nodeId string) (JsonObject, error)

func (*CloudCmsSession) ReadPlatform

func (session *CloudCmsSession) ReadPlatform() (JsonObject, error)

func (*CloudCmsSession) ReadProject

func (session *CloudCmsSession) ReadProject(projectId string) (JsonObject, error)

func (*CloudCmsSession) ReadRepository

func (session *CloudCmsSession) ReadRepository(repositoryId string) (JsonObject, error)

func (*CloudCmsSession) ReadVersion

func (session *CloudCmsSession) ReadVersion(repositoryId string, branchId string, nodeId string, changesetId string, options JsonObject) (JsonObject, error)

func (*CloudCmsSession) RefreshNode

func (session *CloudCmsSession) RefreshNode(repositoryId string, branchId string, node JsonObject) error

func (*CloudCmsSession) RemoveNodeFeature

func (session *CloudCmsSession) RemoveNodeFeature(repositoryId string, branchId string, nodeId string, featureId string) error

func (*CloudCmsSession) Request

func (session *CloudCmsSession) Request(req *http.Request) (*http.Response, error)

func (*CloudCmsSession) RequestJson

func (session *CloudCmsSession) RequestJson(method string, uri string, params url.Values, body io.Reader) (JsonObject, error)

func (*CloudCmsSession) ResolveNodePath

func (session *CloudCmsSession) ResolveNodePath(repositoryId string, branchId string, nodeId string) (string, error)

func (*CloudCmsSession) ResolveNodePaths

func (session *CloudCmsSession) ResolveNodePaths(repositoryId string, branchId string, nodeId string) (map[string]string, error)

func (*CloudCmsSession) RestoreVersion

func (session *CloudCmsSession) RestoreVersion(repositoryId string, branchId string, nodeId string, changesetId string) (JsonObject, error)

func (*CloudCmsSession) SearchNodes

func (session *CloudCmsSession) SearchNodes(repositoryId string, branchId string, text string, pagination JsonObject) (*ResultMap, error)

func (*CloudCmsSession) StartChangesetHistory

func (session *CloudCmsSession) StartChangesetHistory(repositoryId string, branchId string, config JsonObject) (string, error)

func (*CloudCmsSession) StartCreateProject

func (session *CloudCmsSession) StartCreateProject(obj JsonObject) (string, error)

func (*CloudCmsSession) StartResetBranch

func (session *CloudCmsSession) StartResetBranch(repositoryId string, branchId string, changesetId string) (string, error)

func (*CloudCmsSession) TraverseNode

func (session *CloudCmsSession) TraverseNode(repositoryId string, branchId string, nodeId string, config JsonObject) (JsonObject, error)

func (*CloudCmsSession) Unassociate

func (session *CloudCmsSession) Unassociate(repositoryId string, branchId string, nodeId string, otherNodeId string, associationTypeQName string, associationDirection string) error

func (*CloudCmsSession) UnassociateChild

func (session *CloudCmsSession) UnassociateChild(repositoryId string, branchId string, nodeId string, otherNodeId string) error

func (*CloudCmsSession) UpdateBranch

func (session *CloudCmsSession) UpdateBranch(repositoryId string, branchObj JsonObject) (JsonObject, error)

func (*CloudCmsSession) UpdateNode

func (session *CloudCmsSession) UpdateNode(repositoryId string, branchId string, node JsonObject) (JsonObject, error)

func (*CloudCmsSession) UploadAttachment

func (session *CloudCmsSession) UploadAttachment(repositoryId string, branchId string, nodeId string, attachmentId string, file io.Reader, mimeType string, filename string) error

func (*CloudCmsSession) WaitForJob

func (session *CloudCmsSession) WaitForJob(jobId string) error

type CloudcmsConfig

type CloudcmsConfig struct {
	Client_id     string `json:"clientKey"`
	Client_secret string `json:"clientSecret"`
	Username      string `json:"username"`
	Password      string `json:"password"`
	BaseURL       string `json:"baseURL"`
	Debug         bool   `json:"debug"`
}

func LoadConfig

func LoadConfig() *CloudcmsConfig

func ReadConfig

func ReadConfig(path string) *CloudcmsConfig

type JsonObject

type JsonObject map[string]interface{}

func (*JsonObject) GetArray

func (obj *JsonObject) GetArray(key string) []interface{}

func (*JsonObject) GetObject

func (obj *JsonObject) GetObject(key string) JsonObject

func (*JsonObject) GetObjectArray

func (obj *JsonObject) GetObjectArray(key string) []JsonObject

func (*JsonObject) GetString

func (obj *JsonObject) GetString(key string) string

type LoggingRoundTripper

type LoggingRoundTripper struct {
	Proxied http.RoundTripper
}

This type implements the http.RoundTripper interface

func (LoggingRoundTripper) RoundTrip

func (lrt LoggingRoundTripper) RoundTrip(req *http.Request) (res *http.Response, e error)

type ResultMap

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

func ToResultMap

func ToResultMap(obj JsonObject) *ResultMap

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL