v2

package
v2.1.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2019 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	APIVersion = "v2"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Access

type Access struct {
	Unopened          int `json:"unopened"`
	UnopenedExcludeDM int `json:"unopenedExcludeDM"`
}

type Account

type Account struct {
	ID         int        `json:"id"`
	Name       string     `json:"name"`
	FullName   string     `json:"fullName"`
	Suggestion string     `json:"suggestion"`
	ImageURL   string     `json:"imageUrl"`
	IsBot      bool       `json:"isBot"`
	CreatedAt  *time.Time `json:"createdAt"`
	UpdatedAt  *time.Time `json:"updatedAt"`
}

type AttachmentFile

type AttachmentFile struct {
	ContentType string `json:"contentType"`
	FileKey     string `json:"fileKey"`
	FileName    string `json:"fileName"`
	FileSize    int    `json:"fileSize"`
}

type Bookmark

type Bookmark struct {
	PostID    int       `json:"postId"`
	UpdatedAt time.Time `json:"updatedAt"`
}

type Client

type Client struct {
	Topics        *TopicsService
	Likes         *LikesService
	Mentions      *MentionsService
	Notifications *NotificationsService
	Messages      *MessagesService
	// contains filtered or unexported fields
}

func NewClient

func NewClient(httpClient *http.Client) *Client

func (*Client) SetTypetalkToken

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

type DirectMessage

type DirectMessage struct {
	Account *Account `json:"account"`
	Status  *Status  `json:"status"`
}

type DirectMessageTopic

type DirectMessageTopic struct {
	Topic         *Topic         `json:"topic"`
	Unread        *Unread        `json:"unread"`
	DirectMessage *DirectMessage `json:"directMessage"`
}

type DirectMessages

type DirectMessages struct {
	Topic         *Topic         `json:"topic"`
	DirectMessage *DirectMessage `json:"directMessage"`
	Bookmark      *Bookmark      `json:"bookmark"`
	Posts         []*Post        `json:"posts"`
	HasNext       bool           `json:"hasNext"`
}

type DiscoverLikedPost

type DiscoverLikedPost struct {
	*LikedPost
}

type DoNotDisturb

type DoNotDisturb struct {
	IsSuppressed bool       `json:"isSuppressed"`
	Manual       *Manual    `json:"manual"`
	Scheduled    *Scheduled `json:"scheduled"`
}

type FavoriteTopicWithUnread

type FavoriteTopicWithUnread struct {
	Topic    Topic  `json:"topic"`
	Favorite bool   `json:"favorite"`
	Unread   Unread `json:"unread"`
}

type GetLikesOptions

type GetLikesOptions struct {
	From int `json:"from,omitempty"`
}

type GetMentionListOptions

type GetMentionListOptions struct {
	From   int  `json:"from,omitempty"`
	Unread bool `json:"unread,omitempty"`
}

type GetMessagesOptions

type GetMessagesOptions struct {
	Count     int    `json:"count,omitempty"`
	From      int    `json:"from,omitempty"`
	Direction string `json:"direction,omitempty"`
}

type GiveLikedPost

type GiveLikedPost struct {
	*ReceiveLikedPost
	MyLike *MyLike `json:"myLike"`
}

type Like

type Like struct {
	ID        int        `json:"id"`
	PostID    int        `json:"postId"`
	TopicID   int        `json:"topicId"`
	Comment   string     `json:"comment"`
	Account   *Account   `json:"account"`
	CreatedAt *time.Time `json:"createdAt"`
}

type LikedPost

type LikedPost struct {
	Post          *Post          `json:"post"`
	Likes         []*Like        `json:"likes"`
	DirectMessage *DirectMessage `json:"directMessage"`
}

type LikesService

type LikesService service

func (*LikesService) GetLikesDiscover

func (s *LikesService) GetLikesDiscover(ctx context.Context, spaceKey string, opt *GetLikesOptions) ([]*DiscoverLikedPost, *shared.Response, error)

GetLikesDiscover fetches given likes list. Those likes are given by other accounts.

Typetalk API docs: https://developer.nulab-inc.com/docs/typetalk/api/2/get-likes-discover/

func (*LikesService) GetLikesGive

func (s *LikesService) GetLikesGive(ctx context.Context, spaceKey string, opt *GetLikesOptions) ([]*GiveLikedPost, *shared.Response, error)

GetLikesGive fetches given likes list. Those likes are given by your accounts.

Typetalk API docs: https://developer.nulab-inc.com/docs/typetalk/api/2/get-likes-give/

func (*LikesService) GetLikesReceive

func (s *LikesService) GetLikesReceive(ctx context.Context, spaceKey string, opt *GetLikesOptions) ([]*ReceiveLikedPost, *shared.Response, error)

GetLikesReceive fetches received likes list.

Typetalk API docs: https://developer.nulab-inc.com/docs/typetalk/api/2/get-likes-receive/

func (*LikesService) ReadReceivedLikes

ReadReceivedLikes marks likes as read.

Typetalk API docs: https://developer.nulab-inc.com/docs/typetalk/api/2/save-read-likes/

type Manual

type Manual struct {
	RemainingTimeInMinutes interface{} `json:"remainingTimeInMinutes"`
}

type Mention

type Mention struct {
	ID     int        `json:"id"`
	ReadAt *time.Time `json:"readAt"`
	Post   *Post      `json:"post"`
}

type MentionsService

type MentionsService service

func (*MentionsService) GetMentionList

func (s *MentionsService) GetMentionList(ctx context.Context, spaceKey string, opt *GetMentionListOptions) ([]*Mention, *shared.Response, error)

GetMentionList fetches mentions list.

Typetalk API docs: https://developer.nulab-inc.com/docs/typetalk/api/2/get-mentions

type MessagesService

type MessagesService service

func (*MessagesService) GetDirectMessages

func (s *MessagesService) GetDirectMessages(ctx context.Context, spaceKey, accountName string, opt *GetMessagesOptions) (*DirectMessages, *shared.Response, error)

GetDirectMessages fetches direct messages.

Typetalk API docs: https://developer.nulab-inc.com/docs/typetalk/api/2/get-direct-messages

func (*MessagesService) GetMyDirectMessageTopics

func (s *MessagesService) GetMyDirectMessageTopics(ctx context.Context, spaceKey string) ([]*DirectMessageTopic, *shared.Response, error)

GetMyDirectMessageTopics fetches direct message topics list.

Typetalk API docs: https://developer.nulab-inc.com/docs/typetalk/api/2/get-dm-topics

func (*MessagesService) PostDirectMessage

func (s *MessagesService) PostDirectMessage(ctx context.Context, spaceKey, accountName, message string, opt *PostMessageOptions) (*PostedMessageResult, *shared.Response, error)

PostDirectMessage posts direct message.

Typetalk API docs: https://developer.nulab-inc.com/docs/typetalk/api/2/post-direct-message

func (*MessagesService) SearchMessages

func (s *MessagesService) SearchMessages(ctx context.Context, spaceKey, q string, opt *SearchMessagesOptions) (*SearchMessagesResult, *shared.Response, error)

SearchMessages searches messages.

Typetalk API docs: https://developer.nulab-inc.com/docs/typetalk/api/2/search-messages/

type MyLike

type MyLike struct {
	ID        int       `json:"id"`
	Comment   string    `json:"comment"`
	CreatedAt time.Time `json:"createdAt"`
}

type MyPlan

type MyPlan struct {
	Plan                *Plan       `json:"plan"`
	Enabled             bool        `json:"enabled"`
	Trial               interface{} `json:"trial"`
	NumberOfUsers       int         `json:"numberOfUsers"`
	TotalAttachmentSize int         `json:"totalAttachmentSize"`
	CreatedAt           *time.Time  `json:"createdAt"`
	UpdatedAt           *time.Time  `json:"updatedAt"`
}

type MySpace

type MySpace struct {
	Space          *Space   `json:"space"`
	MyRole         string   `json:"myRole"`
	IsPaymentAdmin bool     `json:"isPaymentAdmin"`
	InvitableRoles []string `json:"invitableRoles"`
	MyPlan         MyPlan   `json:"myPlan"`
}

type NotificationCount

type NotificationCount struct {
	Statuses []*struct {
		MySpace *MySpace `json:"mySpace"`
		Space   *Space   `json:"space"`
		Access  *Access  `json:"access"`
		Like    *struct {
			Receive *struct {
				HasUnread  bool `json:"hasUnread"`
				ReadLikeID int  `json:"readLikeId"`
			} `json:"receive"`
		} `json:"like"`
		DirectMessage *struct {
			UnreadTopics int `json:"unreadTopics"`
		} `json:"directMessage"`
	} `json:"statuses"`
	DoNotDisturb *DoNotDisturb `json:"doNotDisturb"`
}

type NotificationsService

type NotificationsService service

func (*NotificationsService) GetNotificationCount

func (s *NotificationsService) GetNotificationCount(ctx context.Context) (*NotificationCount, *shared.Response, error)

GetNotificationCount fetches notification counts.

Typetalk API docs: https://developer.nulab-inc.com/docs/typetalk/api/2/get-notification-status

func (*NotificationsService) ReadNotification deprecated

ReadNotification marks notifications as read.

Deprecated: Use ReadNotification in github.com/nulab/go-typetalk/typetalk/v3

type Plan

type Plan struct {
	Key                      string `json:"key"`
	Name                     string `json:"name"`
	LimitNumberOfUsers       int    `json:"limitNumberOfUsers"`
	LimitTotalAttachmentSize int    `json:"limitTotalAttachmentSize"`
}

type Post

type Post struct {
	ID            int               `json:"id"`
	TopicID       int               `json:"topicId"`
	Topic         Topic             `json:"topic"`
	ReplyTo       int               `json:"replyTo"`
	Message       string            `json:"message"`
	Account       Account           `json:"account"`
	Attachments   []*AttachmentFile `json:"attachments"`
	Links         []interface{}     `json:"links"`
	DirectMessage *DirectMessage    `json:"directMessage"`
	CreatedAt     time.Time         `json:"createdAt"`
	UpdatedAt     time.Time         `json:"updatedAt"`
}

type PostMessageOptions

type PostMessageOptions struct {
	ReplyTo      int      `json:"replyTo,omitempty"`
	ShowLinkMeta bool     `json:"showLinkMeta,omitempty"`
	FileKeys     []string `json:"fileKeys[%d],omitempty"`
	TalkIds      []int    `json:"talkIds[%d],omitempty"`
	FileUrls     []string `json:"attachments[%d].fileUrl,omitempty"`
	FileNames    []string `json:"attachments[%d].fileName,omitempty"`
}

type PostedMessageResult

type PostedMessageResult struct {
	Space                  *Space         `json:"space"`
	Topic                  *Topic         `json:"topic"`
	Post                   *Post          `json:"post"`
	Mentions               []*Mention     `json:"mentions"`
	ExceedsAttachmentLimit bool           `json:"exceedsAttachmentLimit"`
	DirectMessage          *DirectMessage `json:"directMessage"`
}

type ReadNotificationResult

type ReadNotificationResult struct {
	Space  *Space  `json:"space"`
	Access *Access `json:"access"`
}

type ReadReceivedLikesOptions

type ReadReceivedLikesOptions struct {
	LikeID int `json:"likeId,omitempty"`
}

type ReadReceivedLikesResult

type ReadReceivedLikesResult struct {
	Like struct {
		Receive struct {
			HasUnread  bool `json:"hasUnread"`
			ReadLikeID int  `json:"readLikeId"`
		} `json:"receive"`
	} `json:"like"`
}

type ReceiveLikedPost

type ReceiveLikedPost struct {
	*LikedPost
}

type Scheduled

type Scheduled struct {
	Enabled bool   `json:"enabled"`
	Start   string `json:"start"`
	End     string `json:"end"`
}

type SearchMessagesOptions

type SearchMessagesOptions struct {
	TopicIDs       []int      `json:"topicIds,omitempty"`
	HasAttachments bool       `json:"hasAttachments,omitempty"`
	AccountIDs     []int      `json:"accountIds,omitempty"`
	From           *time.Time `json:"from,omitempty"`
	To             *time.Time `json:"to,omitempty"`
}

type SearchMessagesResult

type SearchMessagesResult struct {
	Count     int     `json:"count"`
	Posts     []*Post `json:"posts"`
	IsLimited bool    `json:"isLimited"`
}

type Space

type Space struct {
	Key      string `json:"key"`
	Name     string `json:"name"`
	Enabled  bool   `json:"enabled"`
	ImageURL string `json:"imageUrl"`
}

type Status

type Status struct {
	Presence *string     `json:"presence"`
	Web      interface{} `json:"web"`
	Mobile   interface{} `json:"mobile"`
}

type Topic

type Topic struct {
	ID              int       `json:"id"`
	Name            string    `json:"name"`
	Description     string    `json:"description"`
	Suggestion      string    `json:"suggestion"`
	IsDirectMessage bool      `json:"isDirectMessage"`
	LastPostedAt    time.Time `json:"lastPostedAt"`
	CreatedAt       time.Time `json:"createdAt"`
	UpdatedAt       time.Time `json:"updatedAt"`
}

type TopicsService

type TopicsService service

func (*TopicsService) GetMyTopics

func (s *TopicsService) GetMyTopics(ctx context.Context, spaceKey string) ([]*FavoriteTopicWithUnread, *shared.Response, error)

GetMyTopics fetches topics list.

Typetalk API docs: https://developer.nulab-inc.com/docs/typetalk/api/2/get-topics/

type Unread

type Unread struct {
	TopicID          int  `json:"topicId"`
	PostID           int  `json:"postId"`
	Count            int  `json:"count"`
	IsOverCountLimit bool `json:"isOverCountLimit"`
}

Jump to

Keyboard shortcuts

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