Documentation ¶
Index ¶
- Constants
- Variables
- type APIError
- type AudioMessage
- type BasicResponse
- type Beacon
- type BeaconEventType
- type ButtonsTemplate
- type CarouselColumn
- type CarouselTemplate
- type Client
- func (client *Client) GetMessageContent(messageID string) *GetMessageContentCall
- func (client *Client) GetProfile(userID string) *GetProfileCall
- func (client *Client) LeaveGroup(groupID string) *LeaveGroupCall
- func (client *Client) LeaveRoom(roomID string) *LeaveRoomCall
- func (client *Client) ParseRequest(r *http.Request) ([]*Event, error)
- func (client *Client) PushMessage(to string, messages ...Message) *PushMessageCall
- func (client *Client) ReplyMessage(replyToken string, messages ...Message) *ReplyMessageCall
- type ClientOption
- type ConfirmTemplate
- type ErrorResponse
- type Event
- type EventSource
- type EventSourceType
- type EventType
- type GetMessageContentCall
- type GetProfileCall
- type ImageMessage
- type ImagemapAction
- type ImagemapActionType
- type ImagemapArea
- type ImagemapBaseSize
- type ImagemapMessage
- type LeaveGroupCall
- type LeaveRoomCall
- type LocationMessage
- type Message
- type MessageContentResponse
- type MessageImagemapAction
- type MessageTemplateAction
- type MessageType
- type Postback
- type PostbackTemplateAction
- type PushMessageCall
- type ReplyMessageCall
- type StickerMessage
- type Template
- type TemplateAction
- type TemplateActionType
- type TemplateMessage
- type TemplateType
- type TextMessage
- type URIImagemapAction
- type URITemplateAction
- type UserProfileResponse
- type VideoMessage
Constants ¶
const ( APIEndpointBase = "https://api.line.me" APIEndpointPushMessage = "/v2/bot/message/push" APIEndpointReplyMessage = "/v2/bot/message/reply" APIEndpointGetMessageContent = "/v2/bot/message/%s/content" APIEndpointLeaveGroup = "/v2/bot/group/%s/leave" APIEndpointLeaveRoom = "/v2/bot/room/%s/leave" APIEndpointGetProfile = "/v2/bot/profile/%s" )
APIEndpoint constants
Variables ¶
var (
ErrInvalidSignature = errors.New("invalid signature")
)
errors
Functions ¶
This section is empty.
Types ¶
type AudioMessage ¶
AudioMessage type
func NewAudioMessage ¶
func NewAudioMessage(originalContentURL string, duration int) *AudioMessage
NewAudioMessage function
func (*AudioMessage) MarshalJSON ¶
func (m *AudioMessage) MarshalJSON() ([]byte, error)
MarshalJSON method of AudioMessage
type Beacon ¶
type Beacon struct { Hwid string `json:"hwid"` Type BeaconEventType `json:"type"` }
Beacon type
type BeaconEventType ¶
type BeaconEventType string
BeaconEventType type
const (
BeaconEventTypeEnter BeaconEventType = "enter"
)
BeaconEventType constants
type ButtonsTemplate ¶
type ButtonsTemplate struct { ThumbnailImageURL string Title string Text string Actions []TemplateAction }
ButtonsTemplate type
func NewButtonsTemplate ¶
func NewButtonsTemplate(thumbnailImageURL, title, text string, actions ...TemplateAction) *ButtonsTemplate
NewButtonsTemplate function `thumbnailImageURL` and `title` are optional. they can be empty.
func (*ButtonsTemplate) MarshalJSON ¶
func (t *ButtonsTemplate) MarshalJSON() ([]byte, error)
MarshalJSON method of ButtonsTemplate
type CarouselColumn ¶
type CarouselColumn struct { ThumbnailImageURL string `json:"thumbnailImageUrl,omitempty"` Title string `json:"title,omitempty"` Text string `json:"text"` Actions []TemplateAction `json:"actions"` }
CarouselColumn type
func NewCarouselColumn ¶
func NewCarouselColumn(thumbnailImageURL, title, text string, actions ...TemplateAction) *CarouselColumn
NewCarouselColumn function `thumbnailImageURL` and `title` are optional. they can be empty.
type CarouselTemplate ¶
type CarouselTemplate struct {
Columns []*CarouselColumn
}
CarouselTemplate type
func NewCarouselTemplate ¶
func NewCarouselTemplate(columns ...*CarouselColumn) *CarouselTemplate
NewCarouselTemplate function
func (*CarouselTemplate) MarshalJSON ¶
func (t *CarouselTemplate) MarshalJSON() ([]byte, error)
MarshalJSON method of CarouselTemplate
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client type
func New ¶
func New(channelSecret, channelToken string, options ...ClientOption) (*Client, error)
New returns a new bot client instance.
func (*Client) GetMessageContent ¶
func (client *Client) GetMessageContent(messageID string) *GetMessageContentCall
GetMessageContent method
func (*Client) GetProfile ¶
func (client *Client) GetProfile(userID string) *GetProfileCall
GetProfile method
func (*Client) LeaveGroup ¶
func (client *Client) LeaveGroup(groupID string) *LeaveGroupCall
LeaveGroup method
func (*Client) LeaveRoom ¶
func (client *Client) LeaveRoom(roomID string) *LeaveRoomCall
LeaveRoom method
func (*Client) ParseRequest ¶
ParseRequest method
func (*Client) PushMessage ¶
func (client *Client) PushMessage(to string, messages ...Message) *PushMessageCall
PushMessage method
func (*Client) ReplyMessage ¶
func (client *Client) ReplyMessage(replyToken string, messages ...Message) *ReplyMessageCall
ReplyMessage method
type ClientOption ¶
ClientOption type
func WithEndpointBase ¶
func WithEndpointBase(endpointBase string) ClientOption
WithEndpointBase function
type ConfirmTemplate ¶
type ConfirmTemplate struct { Text string Actions []TemplateAction }
ConfirmTemplate type
func NewConfirmTemplate ¶
func NewConfirmTemplate(text string, left, right TemplateAction) *ConfirmTemplate
NewConfirmTemplate function
func (*ConfirmTemplate) MarshalJSON ¶
func (t *ConfirmTemplate) MarshalJSON() ([]byte, error)
MarshalJSON method of ConfirmTemplate
type ErrorResponse ¶
type ErrorResponse struct { Message string `json:"message"` Details []errorResponseDetail `json:"details"` }
ErrorResponse type
type Event ¶
type Event struct { ReplyToken string Type EventType Timestamp time.Time Source *EventSource Message Message Postback *Postback Beacon *Beacon }
Event type
func ParseRequest ¶
ParseRequest func
func (*Event) MarshalJSON ¶
MarshalJSON method of Event
func (*Event) UnmarshalJSON ¶
UnmarshalJSON method of Event
type EventSource ¶
type EventSource struct { Type EventSourceType `json:"type"` UserID string `json:"userId,omitempty"` GroupID string `json:"groupId,omitempty"` RoomID string `json:"roomId,omitempty"` }
EventSource type
type EventSourceType ¶
type EventSourceType string
EventSourceType type
const ( EventSourceTypeUser EventSourceType = "user" EventSourceTypeGroup EventSourceType = "group" EventSourceTypeRoom EventSourceType = "room" )
EventSourceType constants
type GetMessageContentCall ¶
type GetMessageContentCall struct {
// contains filtered or unexported fields
}
GetMessageContentCall type
func (*GetMessageContentCall) Do ¶
func (call *GetMessageContentCall) Do() (*MessageContentResponse, error)
Do method
func (*GetMessageContentCall) WithContext ¶
func (call *GetMessageContentCall) WithContext(ctx context.Context) *GetMessageContentCall
WithContext method
type GetProfileCall ¶
type GetProfileCall struct {
// contains filtered or unexported fields
}
GetProfileCall type
func (*GetProfileCall) Do ¶
func (call *GetProfileCall) Do() (*UserProfileResponse, error)
Do method
func (*GetProfileCall) WithContext ¶
func (call *GetProfileCall) WithContext(ctx context.Context) *GetProfileCall
WithContext method
type ImageMessage ¶
ImageMessage type
func NewImageMessage ¶
func NewImageMessage(originalContentURL, previewImageURL string) *ImageMessage
NewImageMessage function
func (*ImageMessage) MarshalJSON ¶
func (m *ImageMessage) MarshalJSON() ([]byte, error)
MarshalJSON method of ImageMessage
type ImagemapAction ¶
ImagemapAction type
type ImagemapActionType ¶
type ImagemapActionType string
ImagemapActionType type
const ( ImagemapActionTypeURI ImagemapActionType = "uri" ImagemapActionTypeMessage ImagemapActionType = "message" )
ImagemapActionType constants
type ImagemapArea ¶
type ImagemapArea struct { X int `json:"x"` Y int `json:"y"` Width int `json:"width"` Height int `json:"height"` }
ImagemapArea type
type ImagemapBaseSize ¶
ImagemapBaseSize type
type ImagemapMessage ¶
type ImagemapMessage struct { BaseURL string AltText string BaseSize ImagemapBaseSize Actions []ImagemapAction }
ImagemapMessage type
func NewImagemapMessage ¶
func NewImagemapMessage(baseURL, altText string, baseSize ImagemapBaseSize, actions ...ImagemapAction) *ImagemapMessage
NewImagemapMessage function
func (*ImagemapMessage) MarshalJSON ¶
func (m *ImagemapMessage) MarshalJSON() ([]byte, error)
MarshalJSON method of ImagemapMessage
type LeaveGroupCall ¶
type LeaveGroupCall struct {
// contains filtered or unexported fields
}
LeaveGroupCall type
func (*LeaveGroupCall) WithContext ¶
func (call *LeaveGroupCall) WithContext(ctx context.Context) *LeaveGroupCall
WithContext method
type LeaveRoomCall ¶
type LeaveRoomCall struct {
// contains filtered or unexported fields
}
LeaveRoomCall type
func (*LeaveRoomCall) WithContext ¶
func (call *LeaveRoomCall) WithContext(ctx context.Context) *LeaveRoomCall
WithContext method
type LocationMessage ¶
type LocationMessage struct { ID string Title string Address string Latitude float64 Longitude float64 }
LocationMessage type
func NewLocationMessage ¶
func NewLocationMessage(title, address string, latitude, longitude float64) *LocationMessage
NewLocationMessage function
func (*LocationMessage) MarshalJSON ¶
func (m *LocationMessage) MarshalJSON() ([]byte, error)
MarshalJSON method of LocationMessage
type MessageContentResponse ¶
type MessageContentResponse struct { Content io.ReadCloser ContentLength int64 ContentType string }
MessageContentResponse type
type MessageImagemapAction ¶
type MessageImagemapAction struct { Text string Area ImagemapArea }
MessageImagemapAction type
func NewMessageImagemapAction ¶
func NewMessageImagemapAction(text string, area ImagemapArea) *MessageImagemapAction
NewMessageImagemapAction function
func (*MessageImagemapAction) MarshalJSON ¶
func (a *MessageImagemapAction) MarshalJSON() ([]byte, error)
MarshalJSON method of MessageImagemapAction
type MessageTemplateAction ¶
MessageTemplateAction type
func NewMessageTemplateAction ¶
func NewMessageTemplateAction(label, text string) *MessageTemplateAction
NewMessageTemplateAction function
func (*MessageTemplateAction) MarshalJSON ¶
func (a *MessageTemplateAction) MarshalJSON() ([]byte, error)
MarshalJSON method of MessageTemplateAction
type MessageType ¶
type MessageType string
MessageType type
const ( MessageTypeText MessageType = "text" MessageTypeImage MessageType = "image" MessageTypeVideo MessageType = "video" MessageTypeAudio MessageType = "audio" MessageTypeLocation MessageType = "location" MessageTypeSticker MessageType = "sticker" MessageTypeTemplate MessageType = "template" MessageTypeImagemap MessageType = "imagemap" )
MessageType constants
type PostbackTemplateAction ¶
PostbackTemplateAction type
func NewPostbackTemplateAction ¶
func NewPostbackTemplateAction(label, data, text string) *PostbackTemplateAction
NewPostbackTemplateAction function
func (*PostbackTemplateAction) MarshalJSON ¶
func (a *PostbackTemplateAction) MarshalJSON() ([]byte, error)
MarshalJSON method of PostbackTemplateAction
type PushMessageCall ¶
type PushMessageCall struct {
// contains filtered or unexported fields
}
PushMessageCall type
func (*PushMessageCall) WithContext ¶
func (call *PushMessageCall) WithContext(ctx context.Context) *PushMessageCall
WithContext method
type ReplyMessageCall ¶
type ReplyMessageCall struct {
// contains filtered or unexported fields
}
ReplyMessageCall type
func (*ReplyMessageCall) WithContext ¶
func (call *ReplyMessageCall) WithContext(ctx context.Context) *ReplyMessageCall
WithContext method
type StickerMessage ¶
StickerMessage type
func NewStickerMessage ¶
func NewStickerMessage(packageID, stickerID string) *StickerMessage
NewStickerMessage function
func (*StickerMessage) MarshalJSON ¶
func (m *StickerMessage) MarshalJSON() ([]byte, error)
MarshalJSON method of StickerMessage
type TemplateAction ¶
TemplateAction interface
type TemplateActionType ¶
type TemplateActionType string
TemplateActionType type
const ( TemplateActionTypeURI TemplateActionType = "uri" TemplateActionTypeMessage TemplateActionType = "message" TemplateActionTypePostback TemplateActionType = "postback" )
TemplateActionType constants
type TemplateMessage ¶
TemplateMessage type
func NewTemplateMessage ¶
func NewTemplateMessage(altText string, template Template) *TemplateMessage
NewTemplateMessage function
func (*TemplateMessage) MarshalJSON ¶
func (m *TemplateMessage) MarshalJSON() ([]byte, error)
MarshalJSON method of TemplateMessage
type TemplateType ¶
type TemplateType string
TemplateType type
const ( TemplateTypeButtons TemplateType = "buttons" TemplateTypeConfirm TemplateType = "confirm" TemplateTypeCarousel TemplateType = "carousel" )
TemplateType constants
type TextMessage ¶
TextMessage type
func (*TextMessage) MarshalJSON ¶
func (m *TextMessage) MarshalJSON() ([]byte, error)
MarshalJSON method of TextMessage
type URIImagemapAction ¶
type URIImagemapAction struct { LinkURL string Area ImagemapArea }
URIImagemapAction type
func NewURIImagemapAction ¶
func NewURIImagemapAction(linkURL string, area ImagemapArea) *URIImagemapAction
NewURIImagemapAction function
func (*URIImagemapAction) MarshalJSON ¶
func (a *URIImagemapAction) MarshalJSON() ([]byte, error)
MarshalJSON method of URIImagemapAction
type URITemplateAction ¶
URITemplateAction type
func NewURITemplateAction ¶
func NewURITemplateAction(label, uri string) *URITemplateAction
NewURITemplateAction function
func (*URITemplateAction) MarshalJSON ¶
func (a *URITemplateAction) MarshalJSON() ([]byte, error)
MarshalJSON method of URITemplateAction
type UserProfileResponse ¶
type UserProfileResponse struct { UserID string `json:"userId"` DisplayName string `json:"displayName"` PictureURL string `json:"pictureUrl"` StatusMessage string `json:"statusMessage"` }
UserProfileResponse type
type VideoMessage ¶
VideoMessage type
func NewVideoMessage ¶
func NewVideoMessage(originalContentURL, previewImageURL string) *VideoMessage
NewVideoMessage function
func (*VideoMessage) MarshalJSON ¶
func (m *VideoMessage) MarshalJSON() ([]byte, error)
MarshalJSON method of VideoMessage