resource

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2015 License: MIT Imports: 12 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CaseBuilder = builder.Register(jsonBuilder{}, Case{}).(jsonBuilder)
View Source
var CompanyBuilder = builder.Register(jsonBuilder{}, Company{}).(jsonBuilder)
View Source
var CustomerBuilder = builder.Register(jsonBuilder{}, Customer{}).(jsonBuilder)
View Source
var DraftBuilder = builder.Register(jsonBuilder{}, Draft{}).(jsonBuilder)
View Source
var MessageBuilder = builder.Register(jsonBuilder{}, Message{}).(jsonBuilder)
View Source
var NoteBuilder = builder.Register(jsonBuilder{}, Note{}).(jsonBuilder)
View Source
var ReplyBuilder = builder.Register(jsonBuilder{}, Reply{}).(jsonBuilder)

Functions

func ResourcePathOptionSetCollection

func ResourcePathOptionSetCollection(rp *ResourcePath)

Types

type Attachment

type Attachment struct {
	Size        *int       `json:"size,omitempty"`
	FileName    *string    `json:"file_name,omitempty"`
	ContentType *string    `json:"content_type,omitempty"`
	Content     *string    `json:"content,omitempty"`
	URL         *string    `json:"url,omitempty"`
	ErasedAt    *Timestamp `json:"erased_at,omitempty"`
	CreatedAt   *Timestamp `json:"created_at,omitempty"`
	UpdatedAt   *Timestamp `json:"updated_at,omitempty"`
	Resource
}

func NewAttachment

func NewAttachment() *Attachment

func (*Attachment) SetContent

func (r *Attachment) SetContent(fileName string) error

func (Attachment) String

func (r Attachment) String() string

type Case

type Case struct {
	ExternalID      *string                `json:"external_id,omitempty"`
	Type            *string                `json:"type,omitempty"`
	Status          *string                `json:"status,omitempty"`
	Description     *string                `json:"description,omitempty"`
	Subject         *string                `json:"subject,omitempty"`
	Blurb           *string                `json:"blurb,omitempty"`
	Language        *string                `json:"language,omitempty"`
	Priority        *int                   `json:"priority,omitempty"`
	Labels          []string               `json:"labels,omitempty"`
	LabelIDs        []int                  `json:"label_ids,omitempty"`
	SuppressRules   *bool                  `json:"suppress_rules,omitempty"`
	CustomFields    map[string]interface{} `json:"custom_fields,omitempty"`
	LockedUntil     *Timestamp             `json:"locked_until",omitempty`
	CreatedAt       *Timestamp             `json:"created_at,omitempty"`
	UpdatedAt       *Timestamp             `json:"updated_at,omitempty"`
	ChangedAt       *Timestamp             `json:"changed_at,omitempty"`
	ReceivedAt      *Timestamp             `json:"received_at,omitempty"`
	ActiveAt        *Timestamp             `json:"active_at,omitempty"`
	OpenedAt        *Timestamp             `json:"opened_at,omitempty"`
	FirstOpenedAt   *Timestamp             `json:"first_opened_at,omitempty"`
	ResolvedAt      *Timestamp             `json:"resolved_at,omitempty"`
	FirstResolvedAt *Timestamp             `json:"first_resolved_at,omitempty"`
	Message         *Message               `json:"message,omitempty"`
	Resource
}

func NewCase

func NewCase() *Case

func (Case) String

func (c Case) String() string

type CaseEvent

type CaseEvent struct {
	Type      *string                  `json:"type,omitempty"`
	Context   *string                  `json:"context,omitempty"`
	CreatedAt *Timestamp               `json:"created_at,omitempty"`
	Changes   []map[string]interface{} `json:"changes,omitempty"`
	Resource
}

func NewCaseEvent

func NewCaseEvent() *CaseEvent

func (CaseEvent) String

func (c CaseEvent) String() string

type Company

type Company struct {
	ExternalID   *string                `json:"external_id,omitempty"`
	Name         *string                `json:"name,omitempty"`
	Domains      []string               `json:"domains,omitempty"`
	CreatedAt    *Timestamp             `json:"created_at,omitempty"`
	UpdatedAt    *Timestamp             `json:"updated_at,omitempty"`
	CustomFields map[string]interface{} `json:"custom_fields,omitempty"`
	Resource
}

func NewCompany

func NewCompany() *Company

func (*Company) AddDomain

func (c *Company) AddDomain(domain string)

func (Company) String

func (c Company) String() string

type Customer

type Customer struct {
	ExternalID   *string                `json:"external_id,omitempty"`
	FirstName    *string                `json:"first_name,omitempty"`
	LastName     *string                `json:"last_name,omitempty"`
	Company      *string                `json:"company,omitempty"`
	Title        *string                `json:"title,omitempty"`
	Avatar       *string                `json:"avatar,omitempty"`
	Background   *string                `json:"background,omitempty"`
	Language     *string                `json:"language,omitempty"`
	LockedUntil  *Timestamp             `json:"locked_until,omitempty"`
	CreatedAt    *Timestamp             `json:"created_at,omitempty"`
	UpdatedAt    *Timestamp             `json:"updated_at,omitempty"`
	CustomFields map[string]interface{} `json:"custom_fields,omitempty"`
	Emails       []map[string]string    `json:"emails,omitempty"`
	PhoneNumbers []map[string]string    `json:"phone_numbers,omitempty"`
	Addresses    []map[string]string    `json:"addresses,omitempty"`
	Resource
}

func NewCustomer

func NewCustomer() *Customer

func (*Customer) AddAddress

func (c *Customer) AddAddress(address string, addressType string)

func (*Customer) AddEmail

func (c *Customer) AddEmail(email string, emailType string)

func (*Customer) AddPhoneNumber

func (c *Customer) AddPhoneNumber(phone string, phoneType string)

func (*Customer) AddToSlice

func (c *Customer) AddToSlice(slice []map[string]string, value string, valueType string) []map[string]string

func (Customer) String

func (c Customer) String() string

type Draft

type Draft struct {
	Direction        *string    `json:"direction,omitempty"`
	Body             *string    `json:"body,omitempty"`
	BodyText         *string    `json:"body_text,omitempty"`
	BodyHtml         *string    `json:"body_html,omitempty"`
	Headers          *string    `json:"headers,omitempty"`
	HeadersRaw       *string    `json:"headers_raw,omitempty"`
	Status           *string    `json:"status,omitempty"`
	Subject          *string    `json:"subject,omitempty"`
	To               *string    `json:"to,omitempty"`
	From             *string    `json:"from,omitempty"`
	Type             *string    `json:"type,omitempty"`
	Cc               *string    `json:"cc,omitempty"`
	Bcc              *string    `json:"bcc,omitempty"`
	ClientType       *string    `json:"client_type,omitempty"`
	FromFacebookName *string    `json:"from_facebook_name,omitempty"`
	PublicUrl        *string    `json:"public_url,omitempty"`
	IsBestAnswer     *string    `json:"is_best_answer,omitempty"`
	Rating           *float32   `json:"rating,omitempty"`
	RatingCount      *int       `json:"rating_count,omitempty"`
	RatingScore      *int       `json:"rating_score,omitempty"`
	EnteredAt        *Timestamp `json:"entered_at,omitempty"`
	HiddentAt        *Timestamp `json:"hidden_at,omitempty"`
	CreatedAt        *Timestamp `json:"created_at,omitempty"`
	UpdatedAt        *Timestamp `json:"updated_at,omitempty"`
	Resource
}

func NewDraft

func NewDraft() *Draft

func (Draft) String

func (c Draft) String() string

type EntryCollection

type EntryCollection struct {
	RawEntries *json.RawMessage `json:"entries,omitempty"`
	Entries    []interface{}
}

EntryCollection holds the raw json data for embedded resources. The RawEntries field is used internally and not something an API user would typically want to access.

Once the EntryCollection has been unmarshaled these resources become available as typed GO objects in the Entries field, which contains the data you probably want to get at.

type Group

type Group struct {
	Name *string `json:"name,omitempty"`
	Resource
}

func NewGroup

func NewGroup() *Group

func (Group) String

func (c Group) String() string

type Hal

type Hal struct {
	Id    *int                              `json:"id,int,omitempty"`
	Links map[string]map[string]interface{} `json:"_links,omitempty"`
	// contains filtered or unexported fields
}

func NewHal

func NewHal() *Hal
func (c *Hal) AddHrefLink(class string, href string)

func (*Hal) AddLinkSubItemStringValue

func (c *Hal) AddLinkSubItemStringValue(link string, subitem string, value string)
func (c *Hal) GetHrefLink(class string) string

func (*Hal) GetId

func (c *Hal) GetId() int

func (*Hal) GetLinkSubItemStringValue

func (c *Hal) GetLinkSubItemStringValue(link string, subitem string) string

func (*Hal) GetResourceId

func (c *Hal) GetResourceId() string

func (*Hal) GetResourcePath

func (c *Hal) GetResourcePath(resource Resourceful, options ...func(*ResourcePath)) ResourcePath
func (c *Hal) HasLink(name string) bool

func (*Hal) HasLinkAndSubItem

func (c *Hal) HasLinkAndSubItem(name string, subitem string) bool

func (*Hal) SetId

func (c *Hal) SetId(id int)

func (*Hal) SetResourceId

func (c *Hal) SetResourceId(id string)

func (Hal) String

func (c Hal) String() string

type Label

type Label struct {
	Name        *string  `json:"name,omitempty"`
	Description *string  `json:"description,omitempty"`
	Color       *string  `json:"color,omitempty"`
	Enabled     *bool    `json:"enabled,omitempty"`
	Active      *bool    `json:"active,omitempty"`
	Postion     *int     `json:"position,omitempty"`
	Types       []string `json:"types,omitempty"`
	Resource
}

func NewLabel

func NewLabel() *Label

func (Label) String

func (c Label) String() string

type Message

type Message struct {
	Direction        *string    `json:"direction,omitempty"`
	Body             *string    `json:"body,omitempty"`
	BodyText         *string    `json:"body_text,omitempty"`
	BodyHtml         *string    `json:"body_html,omitempty"`
	Headers          *string    `json:"headers,omitempty"`
	HeadersRaw       *string    `json:"headers_raw,omitempty"`
	Status           *string    `json:"status,omitempty"`
	Subject          *string    `json:"subject,omitempty"`
	To               *string    `json:"to,omitempty"`
	From             *string    `json:"from,omitempty"`
	Cc               *string    `json:"cc,omitempty"`
	Bcc              *string    `json:"bcc,omitempty"`
	ClientType       *string    `json:"client_type,omitempty"`
	FromFacebookName *string    `json:"from_facebook_name,omitempty"`
	CreatedAt        *Timestamp `json:"created_at,omitempty"`
	UpdatedAt        *Timestamp `json:"updated_at,omitempty"`
	Resource
}

func NewMessage

func NewMessage() *Message

func (Message) String

func (c Message) String() string

type Naming

type Naming struct {
	ResourceName string `json:"-"`
}

func (*Naming) GetResourceName

func (n *Naming) GetResourceName() string

func (*Naming) Pluralize

func (n *Naming) Pluralize()

func (*Naming) SetResourceName

func (n *Naming) SetResourceName(thing interface{})

func (*Naming) Singularize

func (n *Naming) Singularize()

type Note

type Note struct {
	Body          *string    `json:"body,omitempty"`
	SuppressRules *bool      `json:"supress_rules,omitempty"`
	ErasedAt      *Timestamp `json:"erased_at,omitempty"`
	CreatedAt     *Timestamp `json:"created_at,omitempty"`
	UpdatedAt     *Timestamp `json:"updated_at,omitempty"`
	Resource
}

func NewNote

func NewNote() *Note

func (Note) String

func (c Note) String() string

type Page

type Page struct {
	PageNumber   *int                              `json:"page,omitempty"`
	TotalEntries *int                              `json:"total_entries,omitempty"`
	Embedded     *EntryCollection                  `json:"_embedded,omitempty"`
	Links        map[string]map[string]interface{} `json:"_links,omitempty"`
}

Page represents a single page of results, typically from a search or list API method. A page has an embedded collection of resources which, contains the data you probably want to get at. See Desk API (http://dev.desk.com/API/using-the-api/#embedding)

func (Page) String

func (c Page) String() string

type Reply

type Reply struct {
	Direction        *string    `json:"direction,omitempty"`
	Body             *string    `json:"body,omitempty"`
	BodyText         *string    `json:"body_text,omitempty"`
	BodyHtml         *string    `json:"body_html,omitempty"`
	Headers          *string    `json:"headers,omitempty"`
	HeadersRaw       *string    `json:"headers_raw,omitempty"`
	Status           *string    `json:"status,omitempty"`
	Subject          *string    `json:"subject,omitempty"`
	To               *string    `json:"to,omitempty"`
	From             *string    `json:"from,omitempty"`
	Type             *string    `json:"type,omitempty"`
	Cc               *string    `json:"cc,omitempty"`
	Bcc              *string    `json:"bcc,omitempty"`
	ClientType       *string    `json:"client_type,omitempty"`
	FromFacebookName *string    `json:"from_facebook_name,omitempty"`
	PublicUrl        *string    `json:"public_url,omitempty"`
	IsBestAnswer     *bool      `json:"is_best_answer,omitempty"`
	Rating           *float32   `json:"rating,omitempty"`
	RatingCount      *int       `json:"rating_count,omitempty"`
	RatingScore      *int       `json:"rating_score,omitempty"`
	EnteredAt        *Timestamp `json:"entered_at,omitempty"`
	HiddentAt        *Timestamp `json:"hidden_at,omitempty"`
	CreatedAt        *Timestamp `json:"created_at,omitempty"`
	UpdatedAt        *Timestamp `json:"updated_at,omitempty"`
	Resource
}

func NewReply

func NewReply() *Reply

func (Reply) String

func (c Reply) String() string

type Resource

type Resource struct {
	Hal
	Naming
}

func (*Resource) InitializeResource

func (r *Resource) InitializeResource(model interface{})

type ResourcePath

type ResourcePath struct {
	Target Resourceful
	Nested Resourceful
	Member bool
	Action string
	Prefix string
	Suffix string
	// contains filtered or unexported fields
}

func NewIdentityResourcePath

func NewIdentityResourcePath(id string, target Resourceful) *ResourcePath

func NewResourcePath

func NewResourcePath(target Resourceful) *ResourcePath

func (*ResourcePath) AppendPath

func (p *ResourcePath) AppendPath(rp *ResourcePath) *ResourcePath

func (*ResourcePath) Path

func (p *ResourcePath) Path() string

func (*ResourcePath) SetAction

func (p *ResourcePath) SetAction(action string) *ResourcePath

func (*ResourcePath) SetCollection

func (p *ResourcePath) SetCollection() *ResourcePath

func (*ResourcePath) SetMember

func (p *ResourcePath) SetMember() *ResourcePath

func (*ResourcePath) SetNested

func (p *ResourcePath) SetNested(resource Resourceful) *ResourcePath

func (*ResourcePath) SetPrefix

func (p *ResourcePath) SetPrefix(prefix string) *ResourcePath

func (*ResourcePath) SetSuffix

func (p *ResourcePath) SetSuffix(suffix string) *ResourcePath

func (*ResourcePath) SetTarget

func (p *ResourcePath) SetTarget(resource Resourceful) *ResourcePath

func (ResourcePath) String

func (p ResourcePath) String() string

type Resourceful

type Resourceful interface {
	InitializeResource(model interface{})
	GetResourceId() (id string)
	SetResourceId(id string)
	GetResourceName() (name string)
	GetResourcePath(resource Resourceful, options ...func(*ResourcePath)) (path ResourcePath)
}

type User

type User struct {
	Name           *string    `json:"name,omitempty"`
	PublicName     *string    `json:"public_name,omitempty"`
	Email          *string    `json:"email,omitempty"`
	EmailVerified  *bool      `json:"email_verified,omitempty"`
	Available      *bool      `json:"available,omitempty"`
	Avatar         *string    `json:"avatar,omitempty"`
	Level          *string    `json:"level,omitempty"`
	CreatedAt      *Timestamp `json:"created_at,omitempty"`
	UpdatedAt      *Timestamp `json:"updated_at,omitempty"`
	CurrentLoginAt *Timestamp `json:"current_login_at,omitempty"`
	LastLoginAt    *Timestamp `json:"last_login_at,omitempty"`
	Resource
}

func NewUser

func NewUser() *User

func (User) String

func (c User) String() string

Jump to

Keyboard shortcuts

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