Documentation
¶
Overview ¶
Package articles provides services for managing Intercom help center articles.
The Service handles public article CRUD and search. The InternalService manages internal-only articles for teammate knowledge bases.
Index ¶
- func ParseDeleteResult(r *api.Result) (*api.Deleted, error)
- func ParseInternalListResult(r *api.Result) (*api.PagedResult[InternalArticle], error)
- func ParseListResult(r *api.Result) (*api.PagedResult[Article], error)
- type Article
- type CreateInternalRequest
- type CreateRequest
- type HighlightedTextPart
- type InternalArticle
- type InternalDeleted
- type InternalSearchData
- type InternalSearchOptions
- type InternalSearchResponse
- type InternalService
- func (s *InternalService) Create(ctx context.Context, body *CreateInternalRequest) (*InternalArticle, error)
- func (s *InternalService) CreateRaw(ctx context.Context, body *CreateInternalRequest) (*api.Result, error)
- func (s *InternalService) Delete(ctx context.Context, id string) (*InternalDeleted, error)
- func (s *InternalService) DeleteRaw(ctx context.Context, id string) (*api.Result, error)
- func (s *InternalService) Get(ctx context.Context, id string) (*InternalArticle, error)
- func (s *InternalService) GetRaw(ctx context.Context, id string) (*api.Result, error)
- func (s *InternalService) List(ctx context.Context, opts *api.ListOptions) (*api.PagedResult[InternalArticle], error)
- func (s *InternalService) ListAll(ctx context.Context, opts *api.ListOptions) *api.Iter[InternalArticle]
- func (s *InternalService) ListRaw(ctx context.Context, opts *api.ListOptions) (*api.Result, error)
- func (s *InternalService) Search(ctx context.Context, opts *InternalSearchOptions) (*InternalSearchResponse, error)
- func (s *InternalService) SearchRaw(ctx context.Context, opts *InternalSearchOptions) (*api.Result, error)
- func (s *InternalService) Update(ctx context.Context, id string, body *UpdateInternalRequest) (*InternalArticle, error)
- func (s *InternalService) UpdateRaw(ctx context.Context, id string, body *UpdateInternalRequest) (*api.Result, error)
- type SearchData
- type SearchHighlight
- type SearchOptions
- type SearchResponse
- type Service
- func (s *Service) Create(ctx context.Context, body *CreateRequest) (*Article, error)
- func (s *Service) CreateRaw(ctx context.Context, body *CreateRequest) (*api.Result, error)
- func (s *Service) Delete(ctx context.Context, id string) (*api.Deleted, error)
- func (s *Service) DeleteRaw(ctx context.Context, id string) (*api.Result, error)
- func (s *Service) Get(ctx context.Context, id string) (*Article, error)
- func (s *Service) GetRaw(ctx context.Context, id string) (*api.Result, error)
- func (s *Service) List(ctx context.Context, opts *api.ListOptions) (*api.PagedResult[Article], error)
- func (s *Service) ListAll(ctx context.Context, opts *api.ListOptions) *api.Iter[Article]
- func (s *Service) ListRaw(ctx context.Context, opts *api.ListOptions) (*api.Result, error)
- func (s *Service) Search(ctx context.Context, opts *SearchOptions) (*SearchResponse, error)
- func (s *Service) SearchRaw(ctx context.Context, opts *SearchOptions) (*api.Result, error)
- func (s *Service) Update(ctx context.Context, id string, body *UpdateRequest) (*Article, error)
- func (s *Service) UpdateRaw(ctx context.Context, id string, body *UpdateRequest) (*api.Result, error)
- type Statistics
- type UpdateInternalRequest
- type UpdateRequest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ParseDeleteResult ¶
ParseDeleteResult decodes a Result into a Deleted.
func ParseInternalListResult ¶
func ParseInternalListResult(r *api.Result) (*api.PagedResult[InternalArticle], error)
ParseInternalListResult decodes a Result into a PagedResult[InternalArticle].
func ParseListResult ¶
ParseListResult decodes a Result into a PagedResult[Article].
Types ¶
type Article ¶
type Article struct {
Type string `json:"type"`
ID string `json:"id"`
WorkspaceID string `json:"workspace_id,omitempty"`
Title string `json:"title,omitempty"`
Description string `json:"description,omitempty"`
Body string `json:"body,omitempty"`
AuthorID int `json:"author_id,omitempty"`
State string `json:"state,omitempty"`
CreatedAt int64 `json:"created_at,omitempty"`
UpdatedAt int64 `json:"updated_at,omitempty"`
URL string `json:"url,omitempty"`
ParentID *int `json:"parent_id,omitempty"`
ParentIDs []int `json:"parent_ids,omitempty"`
ParentType *string `json:"parent_type,omitempty"`
DefaultLocale string `json:"default_locale,omitempty"`
TranslatedContent *api.ArticleTranslatedContent `json:"translated_content,omitempty"`
Statistics *Statistics `json:"statistics,omitempty"`
}
Article represents an Intercom help center article.
func ParseCreateResult ¶
ParseCreateResult decodes a Result into an Article.
func ParseGetResult ¶
ParseGetResult decodes a Result into an Article.
type CreateInternalRequest ¶
type CreateInternalRequest struct {
Title string `json:"title"`
Body string `json:"body,omitempty"`
AuthorID int `json:"author_id"`
OwnerID int `json:"owner_id"`
}
CreateInternalRequest represents the request body for creating an internal article.
type CreateRequest ¶
type CreateRequest struct {
Title string `json:"title"`
AuthorID int `json:"author_id"`
Description string `json:"description,omitempty"`
Body string `json:"body,omitempty"`
State string `json:"state,omitempty"`
ParentID *int `json:"parent_id,omitempty"`
ParentType string `json:"parent_type,omitempty"`
TranslatedContent *api.ArticleTranslatedContent `json:"translated_content,omitempty"`
}
CreateRequest represents the request body for creating an article.
type HighlightedTextPart ¶
HighlightedTextPart represents a segment of highlighted text.
type InternalArticle ¶
type InternalArticle struct {
Type string `json:"type"`
ID string `json:"id"`
Title string `json:"title,omitempty"`
Body string `json:"body,omitempty"`
OwnerID int `json:"owner_id,omitempty"`
AuthorID int `json:"author_id,omitempty"`
Locale string `json:"locale,omitempty"`
CreatedAt int64 `json:"created_at,omitempty"`
UpdatedAt int64 `json:"updated_at,omitempty"`
}
InternalArticle represents an Intercom internal (team-only) article.
func ParseInternalCreateResult ¶
func ParseInternalCreateResult(r *api.Result) (*InternalArticle, error)
ParseInternalCreateResult decodes a Result into an InternalArticle.
func ParseInternalGetResult ¶
func ParseInternalGetResult(r *api.Result) (*InternalArticle, error)
ParseInternalGetResult decodes a Result into an InternalArticle.
func ParseInternalUpdateResult ¶
func ParseInternalUpdateResult(r *api.Result) (*InternalArticle, error)
ParseInternalUpdateResult decodes a Result into an InternalArticle.
type InternalDeleted ¶
type InternalDeleted struct {
ID string `json:"id"`
Object string `json:"object"`
Deleted bool `json:"deleted"`
}
InternalDeleted represents the response from deleting an internal article.
func ParseInternalDeleteResult ¶
func ParseInternalDeleteResult(r *api.Result) (*InternalDeleted, error)
ParseInternalDeleteResult decodes a Result into an InternalDeleted.
type InternalSearchData ¶
type InternalSearchData struct {
InternalArticles []InternalArticle `json:"internal_articles"`
}
InternalSearchData contains the internal articles from a search.
type InternalSearchOptions ¶
type InternalSearchOptions struct {
FolderID string `url:"folder_id,omitempty"`
}
InternalSearchOptions specifies the query parameters for searching internal articles.
type InternalSearchResponse ¶
type InternalSearchResponse struct {
Type string `json:"type"`
TotalCount int `json:"total_count"`
Data InternalSearchData `json:"data"`
Pages *api.CursorPages `json:"pages,omitempty"`
}
InternalSearchResponse represents the response from searching internal articles.
func ParseInternalSearchResult ¶
func ParseInternalSearchResult(r *api.Result) (*InternalSearchResponse, error)
ParseInternalSearchResult decodes a Result into an InternalSearchResponse.
type InternalService ¶
type InternalService struct {
// contains filtered or unexported fields
}
InternalService handles communication with the internal article related methods of the Intercom API.
func NewInternalService ¶
func NewInternalService(c api.Caller) *InternalService
NewInternalService creates a new internal articles InternalService.
func (*InternalService) Create ¶
func (s *InternalService) Create(ctx context.Context, body *CreateInternalRequest) (*InternalArticle, error)
Create creates a new internal article.
func (*InternalService) CreateRaw ¶
func (s *InternalService) CreateRaw(ctx context.Context, body *CreateInternalRequest) (*api.Result, error)
CreateRaw creates a new internal article with the full HTTP result.
func (*InternalService) Delete ¶
func (s *InternalService) Delete(ctx context.Context, id string) (*InternalDeleted, error)
Delete deletes an internal article by ID.
func (*InternalService) DeleteRaw ¶
DeleteRaw deletes an internal article by ID with the full HTTP result.
func (*InternalService) Get ¶
func (s *InternalService) Get(ctx context.Context, id string) (*InternalArticle, error)
Get retrieves an internal article by ID.
func (*InternalService) GetRaw ¶
GetRaw retrieves an internal article by ID with the full HTTP result.
func (*InternalService) List ¶
func (s *InternalService) List(ctx context.Context, opts *api.ListOptions) (*api.PagedResult[InternalArticle], error)
List returns a single page of internal articles.
func (*InternalService) ListAll ¶
func (s *InternalService) ListAll(ctx context.Context, opts *api.ListOptions) *api.Iter[InternalArticle]
ListAll returns an iterator over all internal articles, handling pagination automatically.
func (*InternalService) ListRaw ¶
func (s *InternalService) ListRaw(ctx context.Context, opts *api.ListOptions) (*api.Result, error)
ListRaw returns a single page of internal articles with the full HTTP result.
func (*InternalService) Search ¶
func (s *InternalService) Search(ctx context.Context, opts *InternalSearchOptions) (*InternalSearchResponse, error)
Search searches for internal articles using query parameters.
func (*InternalService) SearchRaw ¶
func (s *InternalService) SearchRaw(ctx context.Context, opts *InternalSearchOptions) (*api.Result, error)
SearchRaw searches for internal articles using query parameters with the full HTTP result.
func (*InternalService) Update ¶
func (s *InternalService) Update(ctx context.Context, id string, body *UpdateInternalRequest) (*InternalArticle, error)
Update updates an existing internal article by ID.
func (*InternalService) UpdateRaw ¶
func (s *InternalService) UpdateRaw(ctx context.Context, id string, body *UpdateInternalRequest) (*api.Result, error)
UpdateRaw updates an existing internal article by ID with the full HTTP result.
type SearchData ¶
type SearchData struct {
Articles []Article `json:"articles"`
Highlights []SearchHighlight `json:"highlights,omitempty"`
}
SearchData contains the articles and highlights from a search.
type SearchHighlight ¶
type SearchHighlight struct {
ArticleID string `json:"article_id"`
HighlightedTitle []HighlightedTextPart `json:"highlighted_title,omitempty"`
}
SearchHighlight contains highlighted text for a search result.
type SearchOptions ¶
type SearchOptions struct {
Phrase string `url:"phrase,omitempty"`
State string `url:"state,omitempty"`
HelpCenterID int `url:"help_center_id,omitempty"`
Highlight *bool `url:"highlight,omitempty"`
}
SearchOptions specifies the query parameters for searching articles.
type SearchResponse ¶
type SearchResponse struct {
Type string `json:"type"`
TotalCount int `json:"total_count"`
Data SearchData `json:"data"`
Pages *api.CursorPages `json:"pages,omitempty"`
}
SearchResponse represents the response from searching articles.
func ParseSearchResult ¶
func ParseSearchResult(r *api.Result) (*SearchResponse, error)
ParseSearchResult decodes a Result into a SearchResponse.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service handles communication with the article related methods of the Intercom API.
func (*Service) Create ¶
Create creates a new article.
See: https://developers.intercom.com/docs/references/rest-api/api.intercom.io/articles/createarticle
func (*Service) CreateRaw ¶
CreateRaw creates a new article and returns the full HTTP result.
See: https://developers.intercom.com/docs/references/rest-api/api.intercom.io/articles/createarticle
func (*Service) Delete ¶
Delete deletes an article by ID.
See: https://developers.intercom.com/docs/references/rest-api/api.intercom.io/articles/deletearticle
func (*Service) DeleteRaw ¶
DeleteRaw deletes an article by ID and returns the full HTTP result.
See: https://developers.intercom.com/docs/references/rest-api/api.intercom.io/articles/deletearticle
func (*Service) Get ¶
Get retrieves an article by ID.
See: https://developers.intercom.com/docs/references/rest-api/api.intercom.io/articles/retrievearticle
func (*Service) GetRaw ¶
GetRaw retrieves an article by ID and returns the full HTTP result.
See: https://developers.intercom.com/docs/references/rest-api/api.intercom.io/articles/retrievearticle
func (*Service) List ¶
func (s *Service) List(ctx context.Context, opts *api.ListOptions) (*api.PagedResult[Article], error)
List returns a single page of articles.
See: https://developers.intercom.com/docs/references/rest-api/api.intercom.io/articles/listarticles
func (*Service) ListAll ¶
ListAll returns an iterator over all articles, handling pagination automatically.
func (*Service) ListRaw ¶
ListRaw returns a single page of articles with the full HTTP result.
See: https://developers.intercom.com/docs/references/rest-api/api.intercom.io/articles/listarticles
func (*Service) Search ¶
func (s *Service) Search(ctx context.Context, opts *SearchOptions) (*SearchResponse, error)
Search searches for articles using query parameters.
See: https://developers.intercom.com/docs/references/rest-api/api.intercom.io/articles/searcharticles
func (*Service) SearchRaw ¶
SearchRaw searches for articles using query parameters and returns the full HTTP result.
See: https://developers.intercom.com/docs/references/rest-api/api.intercom.io/articles/searcharticles
func (*Service) Update ¶
Update updates an existing article by ID.
See: https://developers.intercom.com/docs/references/rest-api/api.intercom.io/articles/updatearticle
func (*Service) UpdateRaw ¶
func (s *Service) UpdateRaw(ctx context.Context, id string, body *UpdateRequest) (*api.Result, error)
UpdateRaw updates an existing article by ID and returns the full HTTP result.
See: https://developers.intercom.com/docs/references/rest-api/api.intercom.io/articles/updatearticle
type Statistics ¶
type Statistics struct {
Type string `json:"type"`
Views int `json:"views"`
Conversations int `json:"conversations"`
Reactions int `json:"reactions"`
HappyReactionPercentage float64 `json:"happy_reaction_percentage"`
NeutralReactionPercentage float64 `json:"neutral_reaction_percentage"`
SadReactionPercentage float64 `json:"sad_reaction_percentage"`
}
Statistics represents engagement statistics for an article.
type UpdateInternalRequest ¶
type UpdateInternalRequest struct {
Title string `json:"title,omitempty"`
Body string `json:"body,omitempty"`
AuthorID int `json:"author_id,omitempty"`
OwnerID int `json:"owner_id,omitempty"`
}
UpdateInternalRequest represents the request body for updating an internal article.
type UpdateRequest ¶
type UpdateRequest struct {
Title string `json:"title,omitempty"`
Description string `json:"description,omitempty"`
Body string `json:"body,omitempty"`
AuthorID int `json:"author_id,omitempty"`
State string `json:"state,omitempty"`
ParentID string `json:"parent_id,omitempty"`
ParentType string `json:"parent_type,omitempty"`
TranslatedContent *api.ArticleTranslatedContent `json:"translated_content,omitempty"`
}
UpdateRequest represents the request body for updating an article.