line

package
v0.0.0-...-adead0c Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckIfTokenValid

func CheckIfTokenValid(ctx context.Context, token string) (bool, error)

func GetMessageContent

func GetMessageContent(_ context.Context, messageID string) ([]byte, error)

func NewBot

func NewBot(ctx context.Context, useLongTermToken bool) error

func NewBotClient

func NewBotClient(at string) error

func PostChannelAccessToken

func PostChannelAccessToken(ctx context.Context) (string, error)

PostChannelAccessToken はチャンネルアクセストークンを取得する。 ChannelAccessToken の登録上限は30件。乱発は禁止。 ChannelAccessToken の上限に達すると新規の発行はできなくなるので、永続化して都度再利用、有効期限が 切れたら refresh する。 ref: https://developers.line.biz/ja/docs/messaging-api/channel-access-tokens/

func ReplyMessage

func ReplyMessage(_ context.Context, replyToken string, text string) error

Types

type LineMessage

type LineMessage struct {
	Type string `json:"type"`
	Id   string `json:"id"`
	Text string `json:"text"`
}

type LineWebhookEvent

type LineWebhookEvent struct {
	Type           string             `json:"type"`
	Message        *LineMessage       `json:"message"`
	ReplyToken     string             `json:"replyToken"`
	WebhookEventId string             `json:"webhookEventId"`
	Timestamp      int64              `json:"timestamp"`
	Source         *LineWebhookSource `json:"source"`
}

type LineWebhookRequest

type LineWebhookRequest struct {
	Destination string              `json:"destination"`
	Events      []*LineWebhookEvent `json:"events"`
}

Described at https://developers.line.biz/ja/reference/messaging-api/#webhook-event-objects

type LineWebhookSource

type LineWebhookSource struct {
	Type   string `json:"type"`
	UserId string `json:"userId"`
}

type PostChannelAccessTokenRequest

type PostChannelAccessTokenRequest struct {
	GrantType           string `json:"grant_type"`
	ClientAssertionType string `json:"client_assertion_type"`
	ClientAssertion     string `json:"client_assertion"`
}

Described at https://developers.line.biz/ja/reference/messaging-api/#issue-channel-access-token-v2-1

type PostChannelAccessTokenResponse

type PostChannelAccessTokenResponse struct {
	AccessToken string `json:"access_token"`
	TokenType   string `json:"token_type"`
	ExpiresIn   int64  `json:"expires_in"`
	KeyID       string `json:"key_id"`
}

Jump to

Keyboard shortcuts

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