import "github.com/cention-sany/cention-sdk-go/cention"
cention provides the func to communicate with Cention Application through JSONAPI.
const (
ANSWER_ERRAND event = 1
)
var ( DEBUG bool ErrUnmatchEventType = errors.New("cention: event type not match") ErrSecretFail = errors.New("cention: secret check failed") ErrNoMoreAttachment = errors.New("cention: no more attachment") )
type AnswerErrand struct { ID int `mapstructure:"c3_id"` Answer struct { ID int `mapstructure:"c3_id"` Response struct { ID int `mapstructure:"c3_id"` Body string `mapstructure:"body"` HtmlBody string `mapstructure:"html_body"` Subject string `mapstructure:"subject"` To []struct { ID int `mapstructure:"c3_id"` Address string `mapstructure:"email_address"` Name string `mapstructure:"name"` } `mapstructure:"to"` } `mapstructure:"response"` } `mapstructure:"answer"` // contains filtered or unexported fields }
func (a *AnswerErrand) GetNextAttachment(ctx context.Context, ep, tk string) (*Attachment, error)
GetNextAttachment will retrieve attachment data from Cention server by providing its endpoint ep and JWT token tk. Only successfully call will advance attachment index.
func (a *AnswerErrand) MoreAttachment() (bool, error)
type Attachment struct { Id int `json:"c3_id,omitempty" mapstructure:"c3_id"` Ct string `json:"content_type" mapstructure:"content_type"` Name string `json:"name" mapstructure:"name"` B64Content string `json:"content" mapstructure:"content"` CID string `json:"content_id,omitempty" mapstructure:"content_id"` }
CreateAttachment is a helper function to create Attachment object. User can directly mutate the Attachment field. name is attachment's filename. ct is attachment content type and r is the content of attachment.
func (a *Attachment) Content() (io.Reader, error)
type CE struct { Data struct { Type string `json:"type"` Attr `json:"attributes"` } `json:"data"` }
type Callback struct { *jsonapi.OnePayload Meta *struct { Secret string `json:"api_secret"` } `json:"meta"` }
func (c *Callback) AnswerErrand() (*AnswerErrand, error)
type CreatedResponse struct { Data struct { Type string `json:"type"` ID string `json:"id"` } `json:"data"` }
func CreateErrand(ctx context.Context, ep, tk string, m *Message, ans *Answer) (*CreatedResponse, error)
type Message struct { Message_id string `json:"message_id"` Name string `json:"name"` From string `json:"from"` Subject string `json:"subject"` Body string `json:"body"` HtmlBody string `json:"html_body"` As []*Attachment `json:"attachments,omitempty"` }
Path | Synopsis |
---|---|
cmd/cce | |
cmd/cserve |
Package cention imports 13 packages (graph) and is imported by 2 packages. Updated 2017-05-14. Refresh now. Tools for package owners.