Documentation
¶
Overview ¶
Package connect provides Connect REST API (Chatter) operations.
Index ¶
- type Actor
- type Capabilities
- type Comment
- type CommentPage
- type CommentsCapability
- type ContentDocument
- type Feed
- type FeedElement
- type FeedInput
- type FilePage
- type FilesCapability
- type Group
- type GroupPage
- type HTTPClient
- type LikeCapability
- type MessageBody
- type MessageBodyInput
- type MessageSegment
- type MessageSegmentInput
- type Photo
- type PollCapability
- type PollChoice
- type Service
- func (s *Service) DeleteFeedElement(ctx context.Context, feedElementId string) error
- func (s *Service) GetCurrentUser(ctx context.Context) (*User, error)
- func (s *Service) GetFeedElement(ctx context.Context, feedElementId string) (*FeedElement, error)
- func (s *Service) GetFile(ctx context.Context, fileId string) (*ContentDocument, error)
- func (s *Service) GetGroup(ctx context.Context, groupId string) (*Group, error)
- func (s *Service) GetGroupFeed(ctx context.Context, groupId string) (*Feed, error)
- func (s *Service) GetGroups(ctx context.Context) (*GroupPage, error)
- func (s *Service) GetMyFiles(ctx context.Context) (*FilePage, error)
- func (s *Service) GetNewsFeed(ctx context.Context) (*Feed, error)
- func (s *Service) GetRecordFeed(ctx context.Context, recordId string) (*Feed, error)
- func (s *Service) GetUser(ctx context.Context, userId string) (*User, error)
- func (s *Service) GetUserProfileFeed(ctx context.Context, userId string) (*Feed, error)
- func (s *Service) LikeFeedElement(ctx context.Context, feedElementId string) error
- func (s *Service) PostComment(ctx context.Context, feedElementId string, body MessageBodyInput) (*Comment, error)
- func (s *Service) PostFeedElement(ctx context.Context, input FeedInput) (*FeedElement, error)
- func (s *Service) SearchUsers(ctx context.Context, query string) (*UserPage, error)
- func (s *Service) UnlikeFeedElement(ctx context.Context, feedElementId, likeId string) error
- type TextBody
- type User
- type UserPage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Actor ¶
type Actor struct {
ID string `json:"id"`
Type string `json:"type"`
Name string `json:"name"`
DisplayName string `json:"displayName,omitempty"`
Photo Photo `json:"photo,omitempty"`
URL string `json:"url,omitempty"`
}
Actor represents a user or entity.
type Capabilities ¶
type Capabilities struct {
Comments CommentsCapability `json:"comments,omitempty"`
Files FilesCapability `json:"files,omitempty"`
Like LikeCapability `json:"like,omitempty"`
Poll PollCapability `json:"poll,omitempty"`
}
Capabilities contains feed element capabilities.
type Comment ¶
type Comment struct {
ID string `json:"id"`
Body MessageBody `json:"body"`
CreatedDate string `json:"createdDate"`
User User `json:"user"`
URL string `json:"url"`
}
Comment represents a comment.
type CommentPage ¶
type CommentPage struct {
Items []Comment `json:"items"`
TotalCount int `json:"total"`
NextPageUrl string `json:"nextPageUrl,omitempty"`
}
CommentPage contains comments.
type CommentsCapability ¶
type CommentsCapability struct {
Page CommentPage `json:"page"`
}
CommentsCapability contains comment capability info.
type ContentDocument ¶
type ContentDocument struct {
ID string `json:"id"`
Title string `json:"title"`
FileType string `json:"fileType"`
ContentSize int `json:"contentSize"`
DownloadUrl string `json:"downloadUrl"`
RenditionUrl string `json:"renditionUrl,omitempty"`
VersionId string `json:"versionId"`
}
ContentDocument represents a file.
type Feed ¶
type Feed struct {
Elements []FeedElement `json:"elements"`
NextPageUrl string `json:"nextPageUrl,omitempty"`
CurrentPageUrl string `json:"currentPageUrl"`
}
Feed represents a Chatter feed.
type FeedElement ¶
type FeedElement struct {
ID string `json:"id"`
Type string `json:"type"`
URL string `json:"url"`
CreatedDate string `json:"createdDate"`
ModifiedDate string `json:"modifiedDate,omitempty"`
Body MessageBody `json:"body"`
Actor Actor `json:"actor"`
Capabilities Capabilities `json:"capabilities,omitempty"`
Header TextBody `json:"header,omitempty"`
}
FeedElement represents a feed element (post).
type FeedInput ¶
type FeedInput struct {
Body MessageBodyInput `json:"body"`
SubjectId string `json:"subjectId"`
FeedElementType string `json:"feedElementType,omitempty"`
Visibility string `json:"visibility,omitempty"`
}
FeedInput represents input for creating a feed element.
type FilePage ¶
type FilePage struct {
Files []ContentDocument `json:"files"`
NextPageUrl string `json:"nextPageUrl,omitempty"`
TotalCount int `json:"total"`
}
FilePage contains a page of files.
type FilesCapability ¶
type FilesCapability struct {
Items []ContentDocument `json:"items"`
}
FilesCapability contains file capability info.
type Group ¶
type Group struct {
ID string `json:"id"`
Name string `json:"name"`
Description string `json:"description,omitempty"`
MemberCount int `json:"memberCount"`
Owner User `json:"owner"`
Visibility string `json:"visibility"`
CanHaveChatterGuests bool `json:"canHaveChatterGuests"`
URL string `json:"url"`
Photo Photo `json:"photo,omitempty"`
}
Group represents a Chatter group.
type GroupPage ¶
type GroupPage struct {
Groups []Group `json:"groups"`
NextPageUrl string `json:"nextPageUrl,omitempty"`
TotalCount int `json:"total"`
}
GroupPage contains a page of groups.
type HTTPClient ¶
type HTTPClient interface {
Get(ctx context.Context, path string) ([]byte, error)
Post(ctx context.Context, path string, body interface{}) ([]byte, error)
Patch(ctx context.Context, path string, body interface{}) ([]byte, error)
Delete(ctx context.Context, path string) ([]byte, error)
}
HTTPClient interface for dependency injection.
type LikeCapability ¶
type LikeCapability struct {
IsLikedByCurrentUser bool `json:"isLikedByCurrentUser"`
LikesMessage TextBody `json:"likesMessage,omitempty"`
}
LikeCapability contains like capability info.
type MessageBody ¶
type MessageBody struct {
MessageSegments []MessageSegment `json:"messageSegments"`
Text string `json:"text"`
}
MessageBody contains feed element body.
type MessageBodyInput ¶
type MessageBodyInput struct {
MessageSegments []MessageSegmentInput `json:"messageSegments"`
}
MessageBodyInput represents input for message body.
type MessageSegment ¶
type MessageSegment struct {
Type string `json:"type"`
Text string `json:"text,omitempty"`
Name string `json:"name,omitempty"`
URL string `json:"url,omitempty"`
RecordId string `json:"recordId,omitempty"`
MentionedUser *User `json:"user,omitempty"`
}
MessageSegment represents a segment of a message.
type MessageSegmentInput ¶
type MessageSegmentInput struct {
Type string `json:"type"`
Text string `json:"text,omitempty"`
Id string `json:"id,omitempty"`
}
MessageSegmentInput represents input for a message segment.
type Photo ¶
type Photo struct {
SmallPhotoUrl string `json:"smallPhotoUrl"`
MediumPhotoUrl string `json:"mediumPhotoUrl,omitempty"`
LargePhotoUrl string `json:"largePhotoUrl,omitempty"`
FullEmailPhotoUrl string `json:"fullEmailPhotoUrl,omitempty"`
}
Photo contains photo URLs.
type PollCapability ¶
type PollCapability struct {
Choices []PollChoice `json:"choices"`
TotalVotes int `json:"totalVoteCount"`
}
PollCapability contains poll capability info.
type PollChoice ¶
type PollChoice struct {
ID string `json:"id"`
Position int `json:"position"`
Text string `json:"text"`
VoteCount int `json:"voteCount"`
}
PollChoice represents a poll choice.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service provides Connect REST API operations.
func NewService ¶
func NewService(client HTTPClient, apiVersion string) *Service
NewService creates a new Connect service.
func (*Service) DeleteFeedElement ¶
DeleteFeedElement deletes a feed element.
func (*Service) GetCurrentUser ¶
GetCurrentUser retrieves the current user's info.
func (*Service) GetFeedElement ¶
GetFeedElement retrieves a single feed element.
func (*Service) GetGroupFeed ¶
GetGroupFeed retrieves a group's feed.
func (*Service) GetMyFiles ¶
GetMyFiles retrieves current user's files.
func (*Service) GetNewsFeed ¶
GetNewsFeed retrieves the current user's news feed.
func (*Service) GetRecordFeed ¶
GetRecordFeed retrieves a record's feed.
func (*Service) GetUserProfileFeed ¶
GetUserProfileFeed retrieves a user's profile feed.
func (*Service) LikeFeedElement ¶
LikeFeedElement likes a feed element.
func (*Service) PostComment ¶
func (s *Service) PostComment(ctx context.Context, feedElementId string, body MessageBodyInput) (*Comment, error)
PostComment adds a comment to a feed element.
func (*Service) PostFeedElement ¶
PostFeedElement creates a new feed element (post).
func (*Service) SearchUsers ¶
SearchUsers searches for users.
type User ¶
type User struct {
ID string `json:"id"`
Name string `json:"name"`
DisplayName string `json:"displayName,omitempty"`
Title string `json:"title,omitempty"`
Email string `json:"email,omitempty"`
CompanyName string `json:"companyName,omitempty"`
Username string `json:"username,omitempty"`
Photo Photo `json:"photo,omitempty"`
URL string `json:"url,omitempty"`
Type string `json:"type,omitempty"`
IsActive bool `json:"isActive"`
UserType string `json:"userType,omitempty"`
}
User represents a Chatter user.