slackadapter

package
v0.0.0-...-72a4bb2 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2021 License: CC-BY-4.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IterateCursor

func IterateCursor(ctx context.Context, iter CursorIterator) error

IterateCursor iterates CursorIterator until returning empty cursor.

func Timestamp

func Timestamp(t *time.Time) string

Timestamp converts time.Time to timestamp formed for Slack API (<UNIX seconds>.<microseconds>)

func Users

func Users(ctx context.Context, token string) ([]*slacklog.User, error)

Users gets users.

Types

type ConversationsHistoryParams

type ConversationsHistoryParams struct {
	Cursor    Cursor     `json:"cursor,omitempty"`
	Inclusive bool       `json:"inclusive,omitempty"`
	Latest    *time.Time `json:"latest,omitempty"`
	Limit     int        `json:"limit,omitempty"`
	Oldest    *time.Time `json:"oldest,omitempty"`
}

ConversationsHistoryParams is optional parameters for ConversationsHistory

type ConversationsHistoryResponse

type ConversationsHistoryResponse struct {
	Ok               bool                `json:"ok"`
	Messages         []*slacklog.Message `json:"messages,omitempty"`
	HasMore          bool                `json:"has_more"`
	PinCount         int                 `json:"pin_count"`
	ResponseMetadata *NextCursor         `json:"response_metadata"`
}

ConversationsHistoryResponse is response for ConversationsHistory

func ConversationsHistory

func ConversationsHistory(ctx context.Context, token, channel string, params ConversationsHistoryParams) (*ConversationsHistoryResponse, error)

ConversationsHistory gets conversation messages in a channel.

type ConversationsParams

type ConversationsParams struct {
	Cursor          Cursor   `json:"cursor,omitempty"`
	Limit           int      `json:"limit,omitempty"`
	ExcludeArchived bool     `json:"excludeArchived,omitempty"`
	Types           []string `json:"types,omitempty"`
}

ConversationsParams is optional parameters for Conversations

type ConversationsResponse

type ConversationsResponse struct {
	Ok               bool                `json:"ok"`
	Channels         []*slacklog.Channel `json:"channels,omitempty"`
	ResponseMetadata *NextCursor         `json:"response_metadata"`
}

ConversationsResponse is response for Conversations

func Conversations

func Conversations(ctx context.Context, token string, params ConversationsParams) (*ConversationsResponse, error)

Conversations gets conversation channels in a channel.

type Cursor

type Cursor string

Cursor is type of cursor of Slack API.

type CursorIterator

type CursorIterator interface {
	Iterate(context.Context, Cursor) (Cursor, error)
}

CursorIterator is requirements of IterateCursor iterates with cursor.

type CursorIteratorFunc

type CursorIteratorFunc func(context.Context, Cursor) (Cursor, error)

CursorIteratorFunc is a function which implements CursorIterator.

func (CursorIteratorFunc) Iterate

func (fn CursorIteratorFunc) Iterate(ctx context.Context, c Cursor) (Cursor, error)

Iterate is an implementation for CursorIterator.

type Error

type Error struct {
	Ok  bool   `json:"ok"`
	Err string `json:"error"`
}

Error represents error response of Slack.

func (*Error) Error

func (err *Error) Error() string

Error returns error message.

type NextCursor

type NextCursor struct {
	NextCursor Cursor `json:"next_cursor"`
}

NextCursor is cursor for next request.

type UsersResponse

type UsersResponse struct {
	Ok    bool             `json:"ok"`
	Users []*slacklog.User `json:"users,omitempty"`
}

UsersResponse is response for Conversations

Jump to

Keyboard shortcuts

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