chat

package
v2.0.10 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2023 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ProductionEndpoint = "https://chat-api.one.th"

	TemplateTypeWebView = "webview"
	TemplateTypeLink    = "link"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Chat

type Chat struct {
	BotId       string
	Token       string
	TokenType   string
	ApiEndpoint string
}

func NewChatBot

func NewChatBot(botId string, token string, tokenType string, apiEndpoint *string) Chat

func (*Chat) CloseWebView

func (c *Chat) CloseWebView(to string) error

func (*Chat) FindFriend

func (c *Chat) FindFriend(keyword string) (Friend, error)

func (*Chat) GetFriendList

func (c *Chat) GetFriendList() ([]Friend, error)

func (*Chat) GetOneChatAccessToken

func (c *Chat) GetOneChatAccessToken(oneChatToken string) (string, error)

func (*Chat) GetProfile

func (c *Chat) GetProfile(oneChatToken string) (Profile, error)

func (*Chat) GetSharedToken

func (c *Chat) GetSharedToken(oneChatToken string) (string, error)

func (*Chat) PushBroadcastFromByte

func (c *Chat) PushBroadcastFromByte(to []string, file []byte) error

func (*Chat) PushBroadcastFromFile

func (c *Chat) PushBroadcastFromFile(to []string, filename string) error

func (*Chat) PushBroadcastMessage

func (c *Chat) PushBroadcastMessage(to []string, msg string) error

func (*Chat) PushLinkTemplate

func (c *Chat) PushLinkTemplate(to string, title string, detail string, img string, choices []Choice, customNotify *string) error

func (*Chat) PushQuickReplyTextType

func (c *Chat) PushQuickReplyTextType(to string, message string, quickReplies []QuickReplyTextType) error

func (*Chat) PushTextMessage

func (c *Chat) PushTextMessage(to string, msg string, customNotify *string) error

func (*Chat) PushWebView

func (c *Chat) PushWebView(to string, title string, detail string, img string, choices []Choice, customNotify *string) error

type Choice

type Choice struct {
	Label        string `json:"label"`
	Type         string `json:"type"`
	Url          string `json:"url"`
	Size         string `json:"size"`
	Sign         string `json:"sign"`
	OneChatToken string `json:"onechat_token"`
}

type Elements

type Elements struct {
	Image   string   `json:"image"`
	Title   string   `json:"title"`
	Detail  string   `json:"detail"`
	Choices []Choice `json:"choice"`
}

type Friend

type Friend struct {
	OneEmail    string `json:"one_email"`
	UserId      string `json:"user_id"`
	AccountId   string `json:"one_id"`
	DisplayName string `json:"display_name"`
	Type        string `json:"type"`
}

type FriendList

type FriendList struct {
	Status                string        `json:"status"`
	ListRequestFriend     []interface{} `json:"list_request_friend"`
	ListFriend            []Friend      `json:"list_friend"`
	ListSendRequestFriend []interface{} `json:"list_send_request_friend"`
	ListGroup             []Group       `json:"list_group"`
}

type Group

type Group struct {
	IsActive  string `json:"is_active"`
	GroupId   string `json:"group_id"`
	Type      string `json:"type"`
	GroupName string `json:"group_name"`
}

type LoginOneChatAccount

type LoginOneChatAccount struct {
	Profile struct {
		AccessToken     string `json:"access_token"`
		AccountTitleEng string `json:"account_title_eng"`
		AccountTitleTh  string `json:"account_title_th"`
		Email           string `json:"email"`
		FirstNameEng    string `json:"first_name_eng"`
		FirstNameTh     string `json:"first_name_th"`
		IdCardNum       string `json:"id_card_num"`
		IdCardType      string `json:"id_card_type"`
		Ip              string `json:"ip"`
		LastNameEng     string `json:"last_name_eng"`
		LastNameTh      string `json:"last_name_th"`
		Loa             string `json:"loa"`
		Name            string `json:"name"`
		NickName        string `jaon:"nickname"`
		OneId           string `json:"one_id"`
		Phone           string `json:"phone"`
		Status          string `json:"status"`
		TokenService    string `json:"tokenservice"`
		TokenUser       string `json:"tokenuser"`
		Type            string `json:"type"`
		Username        string `json:"username"`
	} `json:"profile"`
}

type LoginOneChatResult

type LoginOneChatResult struct {
	Account    LoginOneChatAccount `json:"account"`
	Business   []string            `json:"business"`
	Government []string            `json:"goverment"`
	Message    string              `json:"message"`
	Status     string              `json:"status"`
}

type Profile

type Profile struct {
	Email          string `json:"email"`
	Nickname       string `json:"nickname"`
	AccountId      string `json:"one_id"`
	Telephone      string `json:"telephone"`
	ProfilePicture string `json:"profilepicture"`
}

type QuickReplyTextType

type QuickReplyTextType struct {
	Label   string `json:"label"`
	Type    string `json:"type"`
	Message string `json:"message"`
	Payload string `json:"payload"`
}

Jump to

Keyboard shortcuts

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