callingcode

package
v0.8.4 Latest Latest
Warning

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

Go to latest
Published: May 17, 2024 License: MIT Imports: 3 Imported by: 0

README

CallingCodes

Types

Overview

there are the folowing types of CallingCodes

  • site (1) | opens mainpage of site
  • page (2) | opens a given page of site
  • url (3) | opens given url
  • post (4)| performs a post request with optional parameter
  • dialog iframe (11) | opens a given url in a dialog
config

all require the following attributes

  • siteId string
  • name string
  • type number

and these ones are optional

  • appearance
    • icon hex color like #000000
    • color string
    • captionText string
  • redirectMode 0|1|2

some have additional attributes

CC type attribute type required ref
page tappId number true
url url string true
post requestUrl string true
messageFailure string true
messageBefore string false
messageSuccess string false
requestBody json string false
iframe dialog dialogIframeUrl string true
dialogIframeConfig json string false Github tobit.software

Documentation

Index

Constants

View Source
const (
	BASE_URL = "https://webapi.tobit.com/ChaynsCodeAdministration/v1.0/Chaynscode/"
	UA       = "github.com/Lukas-Nielsen/go-chayns/callingcode"

	POST   method = "POST"
	GET    method = "GET"
	PUT    method = "PUT"
	DELETE method = "DELETE"
	PATCH  method = "PATCH"

	SPACEINVADER      icon = "spaceinvader"
	PACMNAGHOST       icon = "pacmnaghost"
	BUBBLE_1          icon = "bubble1"
	BUBBLE_2          icon = "bubble2"
	EXCLAMATIONMARK_1 icon = "exclamationmark1"
	EXCLAMATIONMARK_2 icon = "exclamationmark2"
	HEART             icon = "heart"
	LOCATION_1        icon = "location1"
	LOCATION_2        icon = "location2"
	PENCIL            icon = "pencil"
	PRICETAG          icon = "pricetag"
	QUESTIONMARK_1    icon = "questionmark1"
	QUESTIONMARK_2    icon = "questionmark2"
	SMILEY_1          icon = "smiley1"
	SMILEY_2          icon = "smiley2"
	SWITCH            icon = "switch"
	THUMBSUP          icon = "thumbsup"
	THUMBSDOWN        icon = "thumbsdown"
	TABLENUMBER       icon = "tablenumber"

	SVG ccFormat = "SVG"
	PNG ccFormat = "PNG"
	JPG ccFormat = "JPG"
	PDF ccFormat = "PDF"

	CC_SITE          ccType = 1
	CC_PAGE          ccType = 2
	CC_URL           ccType = 3
	CC_POST          ccType = 4
	CC_DIALOG_IFRAME ccType = 11

	APP_WITHOUT     ccApp = 0
	APP_RECOMMENDED ccApp = 1
	APP_REQUIRED    ccApp = 2
)

Variables

This section is empty.

Functions

func GetCC

func GetCC(t ccFormat, code string, color string, text string, icon icon, tablenumber string) ([]byte, error)

Types

type CC

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

func (*CC) Send

func (c *CC) Send() (NewCC, error)

func (*CC) SetCaptionText

func (c *CC) SetCaptionText(captionText string) *CC

func (*CC) SetColor

func (c *CC) SetColor(color string) *CC

hex color

func (*CC) SetDialogIframeConfig

func (c *CC) SetDialogIframeConfig(dialogIframeConfig string) *CC

func (*CC) SetDialogIframeUrl

func (c *CC) SetDialogIframeUrl(dialogIframeUrl string) *CC

func (*CC) SetIcon

func (c *CC) SetIcon(icon icon) *CC

func (*CC) SetMessageBefore

func (c *CC) SetMessageBefore(messageBefore string) *CC

func (*CC) SetMessageFailure

func (c *CC) SetMessageFailure(messageFailure string) *CC

func (*CC) SetMessageSuccess

func (c *CC) SetMessageSuccess(messageSuccess string) *CC

func (*CC) SetName

func (c *CC) SetName(name string) *CC

func (*CC) SetRequestBody

func (c *CC) SetRequestBody(requestBody string) *CC

func (*CC) SetRequestUrl

func (c *CC) SetRequestUrl(requestUrl string) *CC

func (*CC) SetSite

func (c *CC) SetSite(sid string) *CC

func (*CC) SetTappId

func (c *CC) SetTappId(tappId int) *CC

func (*CC) SetType

func (c *CC) SetType(t ccType) *CC

func (*CC) SetUrl

func (c *CC) SetUrl(url string) *CC

type Client

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

func NewClient

func NewClient(token string, debug bool) *Client

token = chayns user token

func (*Client) AssignToGroup

func (c *Client) AssignToGroup(gid int, cid string) error

gid = id of group

cid = id of callingcode

func (*Client) ChangeCaptiontext

func (c *Client) ChangeCaptiontext(sid string, code string, captionText string) error

site id, calling code, captionText

func (*Client) ChangeColor

func (c *Client) ChangeColor(sid string, code string, color string) error

site id, calling code, color (hex)

func (*Client) ChangeIcon

func (c *Client) ChangeIcon(sid string, code string, icon icon) error

site id, calling code, icon

func (*Client) DeleteCC

func (c *Client) DeleteCC(code string) error

func (*Client) DeleteGroup

func (c *Client) DeleteGroup(gid int, deleteCodes bool) error

gid = id of group

func (*Client) NewCC

func (c *Client) NewCC(sid string, t ccType, name string) *CC

func (*Client) NewGroup

func (c *Client) NewGroup(name string, sid string) (Group, error)

name = display nameof group

sid = chayns site id

func (*Client) RenameGroup

func (c *Client) RenameGroup(gid int, name string, sid string) (Group, error)

gid = id of group

name = display nameof group

sid = chayns site id

func (*Client) SetToken

func (c *Client) SetToken(token string) *Client

token = chayns user token

func (*Client) UpdateCC

func (c *Client) UpdateCC(sid string, code string, key string, value any) error

site id, calling code, key, value

type Group

type Group struct {
	ID       int    `json:"id,omitempty"`
	SiteID   string `json:"siteId,omitempty"`
	ShowName string `json:"showName,omitempty"`
}

type NewCC

type NewCC struct {
	ID         int    `json:"id"`
	Code       string `json:"code"`
	Type       int    `json:"type"`
	TypeString string `json:"typeString"`
	SiteID     string `json:"siteId"`
	Name       string `json:"name"`
}

Jump to

Keyboard shortcuts

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