tipe

package module
v0.0.0-...-345fe55 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2020 License: Apache-2.0 Imports: 7 Imported by: 0

README

tipe-go

GoDoc

Tipe Golang SDK

go get github.com/Blockdaemon/tipe-go

Example

import (
	"context"
	"fmt"

	"github.com/Blockdaemon/tipe-go"
)

type Document struct {
	CreatedBy tipe.CreatedBy `json:"createdBy"`
	Fields    struct {
		Description tipe.TextField `json:"description"`
	} `json:"fields"`
	ID       string        `json:"id"`
	Template tipe.Template `json:"template"`
}

func main() {
	client := tipe.New(
		tipe.Project("test"),
		tipe.Key(""),
		tipe.Offline(true),
		tipe.Port(8000),
	)

	doc := &Document{}

	if err := client.Documents.Get(
		context.Background(),
		doc,
		tipe.GetDocumentOptions{
			SkuID: "MySkuID",
		},
	); err != nil {
		panic(err)
	}

	fmt.Println(doc.Fields.Description.Value)
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIClient

type APIClient struct {

	// Services
	Documents Documents
	// contains filtered or unexported fields
}

APIClient manages communication with the Tipe API.

func New

func New(options ...Option) *APIClient

New creates a new Tipe APIClient

type BooleanField

type BooleanField struct {
	Data  map[string]interface{} `json:"data"`
	ID    string                 `json:"id"`
	List  bool                   `json:"list"`
	Name  string                 `json:"name"`
	Type  string                 `json:"type"`
	Value bool                   `json:"value"`
}

Fields

type ButtonField

type ButtonField struct {
	Data  map[string]interface{} `json:"data"`
	ID    string                 `json:"id"`
	List  bool                   `json:"list"`
	Name  string                 `json:"name"`
	Type  string                 `json:"type"`
	Value string                 `json:"value"`
}

type CreateDocumentOptions

type CreateDocumentOptions struct {
	Fields   map[string]interface{}
	Name     string
	Refs     map[string]interface{}
	SkuID    string
	Template string
}

type CreatedBy

type CreatedBy struct {
	Email     string `json:"email"`
	FirstName string `json:"firstName"`
	LastName  string `json:"lastName"`
}

type Documents

type Documents interface {
	Create(context.Context, CreateDocumentOptions) error
	Get(context.Context, interface{}, GetDocumentOptions) error
	Update(context.Context, UpdateDocumentOptions) error
}

type GetDocumentOptions

type GetDocumentOptions struct {
	// ID of the Document
	ID string
	// SkuID of the Document
	SkuID string
}

type HTMLField

type HTMLField struct {
	Data  map[string]interface{} `json:"data"`
	ID    string                 `json:"id"`
	List  bool                   `json:"list"`
	Name  string                 `json:"name"`
	Type  string                 `json:"type"`
	Value interface{}            `json:"value"`
}

func (HTMLField) String

func (f HTMLField) String() string

func (HTMLField) StringSlice

func (f HTMLField) StringSlice() []string

type Option

type Option func(*APIClient)

func Host

func Host(host string) Option

Set the host on the client

func Key

func Key(key string) Option

Set the key on the client

func Offline

func Offline(offline bool) Option

Set offline mode

func Port

func Port(port int) Option

Set the port in offline mode

func Project

func Project(project string) Option

Set the project

type Response

type Response struct {
	Data interface{} `json:"data"`
}

type Template

type Template struct {
	ID   string `json:"id"`
	Name string `json:"name"`
}

type TextField

type TextField struct {
	Data  map[string]interface{} `json:"data"`
	ID    string                 `json:"id"`
	List  bool                   `json:"list"`
	Name  string                 `json:"name"`
	Type  string                 `json:"type"`
	Value string                 `json:"value"`
}

type UpdateDocumentOptions

type UpdateDocumentOptions struct {
	ID       string
	Fields   map[string]interface{}
	Name     string
	Refs     map[string]interface{}
	SkuID    string
	Status   string
	Template string
}

Jump to

Keyboard shortcuts

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