connect

package
v2.0.2 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package connect provides Connect REST API (Chatter) operations.

Index

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

func (s *Service) DeleteFeedElement(ctx context.Context, feedElementId string) error

DeleteFeedElement deletes a feed element.

func (*Service) GetCurrentUser

func (s *Service) GetCurrentUser(ctx context.Context) (*User, error)

GetCurrentUser retrieves the current user's info.

func (*Service) GetFeedElement

func (s *Service) GetFeedElement(ctx context.Context, feedElementId string) (*FeedElement, error)

GetFeedElement retrieves a single feed element.

func (*Service) GetFile

func (s *Service) GetFile(ctx context.Context, fileId string) (*ContentDocument, error)

GetFile retrieves file information.

func (*Service) GetGroup

func (s *Service) GetGroup(ctx context.Context, groupId string) (*Group, error)

GetGroup retrieves a Chatter group.

func (*Service) GetGroupFeed

func (s *Service) GetGroupFeed(ctx context.Context, groupId string) (*Feed, error)

GetGroupFeed retrieves a group's feed.

func (*Service) GetGroups

func (s *Service) GetGroups(ctx context.Context) (*GroupPage, error)

GetGroups retrieves Chatter groups.

func (*Service) GetMyFiles

func (s *Service) GetMyFiles(ctx context.Context) (*FilePage, error)

GetMyFiles retrieves current user's files.

func (*Service) GetNewsFeed

func (s *Service) GetNewsFeed(ctx context.Context) (*Feed, error)

GetNewsFeed retrieves the current user's news feed.

func (*Service) GetRecordFeed

func (s *Service) GetRecordFeed(ctx context.Context, recordId string) (*Feed, error)

GetRecordFeed retrieves a record's feed.

func (*Service) GetUser

func (s *Service) GetUser(ctx context.Context, userId string) (*User, error)

GetUser retrieves a user's info.

func (*Service) GetUserProfileFeed

func (s *Service) GetUserProfileFeed(ctx context.Context, userId string) (*Feed, error)

GetUserProfileFeed retrieves a user's profile feed.

func (*Service) LikeFeedElement

func (s *Service) LikeFeedElement(ctx context.Context, feedElementId string) error

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

func (s *Service) PostFeedElement(ctx context.Context, input FeedInput) (*FeedElement, error)

PostFeedElement creates a new feed element (post).

func (*Service) SearchUsers

func (s *Service) SearchUsers(ctx context.Context, query string) (*UserPage, error)

SearchUsers searches for users.

func (*Service) UnlikeFeedElement

func (s *Service) UnlikeFeedElement(ctx context.Context, feedElementId, likeId string) error

UnlikeFeedElement unlikes a feed element.

type TextBody

type TextBody struct {
	Text string `json:"text"`
}

TextBody contains text content.

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.

type UserPage

type UserPage struct {
	Users       []User `json:"users"`
	NextPageUrl string `json:"nextPageUrl,omitempty"`
	TotalCount  int    `json:"total"`
}

UserPage contains a page of users.

Jump to

Keyboard shortcuts

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