api

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: May 5, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DocsPaginateAll

func DocsPaginateAll(ctx context.Context, fn DocsListFunc, params url.Values, wrapperKey string, noPaginate bool) ([]json.RawMessage, *types.DocsPageInfo, error)

DocsPaginateAll fetches all pages using the given Docs list function. Docs API wraps results as {"<key>":{"page":1,"pages":5,"count":100,"items":[...]}}. If noPaginate is false, only the specified page is returned.

func ExtractDocsItems

func ExtractDocsItems(data json.RawMessage, key string) (json.RawMessage, *types.DocsPageInfo, error)

ExtractDocsItems extracts the items array and page info from a Docs API response. Format: {"<key>":{"page":1,"pages":5,"count":100,"items":[...]}}

func ExtractEmbedded

func ExtractEmbedded(data json.RawMessage, key string) (json.RawMessage, *types.PageInfo, error)

ExtractEmbedded extracts the named array from _embedded.

func PaginateAll

func PaginateAll(ctx context.Context, fn ListFunc, params url.Values, embeddedKey string, noPaginate bool) ([]json.RawMessage, *types.PageInfo, error)

PaginateAll fetches all pages using the given list function and embedded key. If noPaginate is false, only the specified page is returned.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

func New

func New(ctx context.Context, clientID, clientSecret string, debug bool) *Client

func NewForTest

func NewForTest(httpClient *http.Client) *Client

NewForTest creates a Client with a custom http.Client and no rate limiter. Used by httptest-based tests only.

func (*Client) CreateAttachment

func (c *Client) CreateAttachment(ctx context.Context, convID string, threadID string, body any) error

func (*Client) CreateChatThread

func (c *Client) CreateChatThread(ctx context.Context, convID string, body any) error

func (*Client) CreateConversation

func (c *Client) CreateConversation(ctx context.Context, body any) (string, error)

func (*Client) CreateCustomer

func (c *Client) CreateCustomer(ctx context.Context, body any) (string, error)

func (*Client) CreateCustomerThread

func (c *Client) CreateCustomerThread(ctx context.Context, convID string, body any) error

func (*Client) CreateNote

func (c *Client) CreateNote(ctx context.Context, convID string, body any) error

func (*Client) CreateOrganization

func (c *Client) CreateOrganization(ctx context.Context, body any) (string, error)

func (*Client) CreateOrganizationProperty

func (c *Client) CreateOrganizationProperty(ctx context.Context, body any) (string, error)

func (*Client) CreatePhoneThread

func (c *Client) CreatePhoneThread(ctx context.Context, convID string, body any) error

func (*Client) CreateReply

func (c *Client) CreateReply(ctx context.Context, convID string, body any) error

func (*Client) CreateSavedReply

func (c *Client) CreateSavedReply(ctx context.Context, body any) (string, error)

func (*Client) CreateWebhook

func (c *Client) CreateWebhook(ctx context.Context, body any) (string, error)

func (*Client) DeleteAttachment

func (c *Client) DeleteAttachment(ctx context.Context, convID string, attachmentID string) error

func (*Client) DeleteConversation

func (c *Client) DeleteConversation(ctx context.Context, id string) error

func (*Client) DeleteConversationSnooze

func (c *Client) DeleteConversationSnooze(ctx context.Context, id string) error

func (*Client) DeleteCustomer

func (c *Client) DeleteCustomer(ctx context.Context, id string, params url.Values) error

func (*Client) DeleteOrganization

func (c *Client) DeleteOrganization(ctx context.Context, id string) error

func (*Client) DeleteOrganizationProperty

func (c *Client) DeleteOrganizationProperty(ctx context.Context, id string) error

func (*Client) DeleteSavedReply

func (c *Client) DeleteSavedReply(ctx context.Context, id string) error

func (*Client) DeleteUser

func (c *Client) DeleteUser(ctx context.Context, id string) error

func (*Client) DeleteWebhook

func (c *Client) DeleteWebhook(ctx context.Context, id string) error

func (*Client) GetAttachmentData

func (c *Client) GetAttachmentData(ctx context.Context, convID string, attachmentID string) (json.RawMessage, error)

func (*Client) GetConversation

func (c *Client) GetConversation(ctx context.Context, id string, params url.Values) (json.RawMessage, error)

func (*Client) GetConversationProperty

func (c *Client) GetConversationProperty(ctx context.Context, id string) (json.RawMessage, error)

func (*Client) GetCustomer

func (c *Client) GetCustomer(ctx context.Context, id string, params url.Values) (json.RawMessage, error)

func (*Client) GetCustomerProperty

func (c *Client) GetCustomerProperty(ctx context.Context, id string) (json.RawMessage, error)

func (*Client) GetMailbox

func (c *Client) GetMailbox(ctx context.Context, id string) (json.RawMessage, error)

func (*Client) GetMailboxRouting

func (c *Client) GetMailboxRouting(ctx context.Context, mailboxID string) (json.RawMessage, error)

func (*Client) GetOrganization

func (c *Client) GetOrganization(ctx context.Context, id string) (json.RawMessage, error)

func (*Client) GetOrganizationProperty

func (c *Client) GetOrganizationProperty(ctx context.Context, id string) (json.RawMessage, error)

func (*Client) GetRating

func (c *Client) GetRating(ctx context.Context, id string) (json.RawMessage, error)

func (*Client) GetReport

func (c *Client) GetReport(ctx context.Context, family string, params url.Values) (json.RawMessage, error)

func (*Client) GetResourceOwner

func (c *Client) GetResourceOwner(ctx context.Context) (json.RawMessage, error)

func (*Client) GetSavedReply

func (c *Client) GetSavedReply(ctx context.Context, id string) (json.RawMessage, error)

func (*Client) GetTag

func (c *Client) GetTag(ctx context.Context, id string) (json.RawMessage, error)

func (*Client) GetThreadSource

func (c *Client) GetThreadSource(ctx context.Context, convID string, threadID string) (json.RawMessage, error)

func (*Client) GetThreadSourceRFC822

func (c *Client) GetThreadSourceRFC822(ctx context.Context, convID string, threadID string) ([]byte, error)

func (*Client) GetUser

func (c *Client) GetUser(ctx context.Context, id string) (json.RawMessage, error)

func (*Client) GetUserStatus

func (c *Client) GetUserStatus(ctx context.Context, id string) (json.RawMessage, error)

func (*Client) GetWebhook

func (c *Client) GetWebhook(ctx context.Context, id string) (json.RawMessage, error)

func (*Client) ListConversationProperties

func (c *Client) ListConversationProperties(ctx context.Context, params url.Values) (json.RawMessage, error)

func (*Client) ListConversations

func (c *Client) ListConversations(ctx context.Context, params url.Values) (json.RawMessage, error)

func (*Client) ListCustomerProperties

func (c *Client) ListCustomerProperties(ctx context.Context, params url.Values) (json.RawMessage, error)

func (*Client) ListCustomers

func (c *Client) ListCustomers(ctx context.Context, params url.Values) (json.RawMessage, error)

func (*Client) ListMailboxCustomFields

func (c *Client) ListMailboxCustomFields(ctx context.Context, mailboxID string, params url.Values) (json.RawMessage, error)

func (*Client) ListMailboxFolders

func (c *Client) ListMailboxFolders(ctx context.Context, mailboxID string, params url.Values) (json.RawMessage, error)

func (*Client) ListMailboxes

func (c *Client) ListMailboxes(ctx context.Context, params url.Values) (json.RawMessage, error)

ListMailboxes returns the raw JSON for mailboxes list.

func (*Client) ListOrganizationConversations

func (c *Client) ListOrganizationConversations(ctx context.Context, id string, params url.Values) (json.RawMessage, error)

func (*Client) ListOrganizationCustomers

func (c *Client) ListOrganizationCustomers(ctx context.Context, id string, params url.Values) (json.RawMessage, error)

func (*Client) ListOrganizationProperties

func (c *Client) ListOrganizationProperties(ctx context.Context, params url.Values) (json.RawMessage, error)

func (*Client) ListOrganizations

func (c *Client) ListOrganizations(ctx context.Context, params url.Values) (json.RawMessage, error)

func (*Client) ListSavedReplies

func (c *Client) ListSavedReplies(ctx context.Context, params url.Values) (json.RawMessage, error)

func (*Client) ListTags

func (c *Client) ListTags(ctx context.Context, params url.Values) (json.RawMessage, error)

func (*Client) ListTeamMembers

func (c *Client) ListTeamMembers(ctx context.Context, id string, params url.Values) (json.RawMessage, error)

func (*Client) ListTeams

func (c *Client) ListTeams(ctx context.Context, params url.Values) (json.RawMessage, error)

func (*Client) ListThreads

func (c *Client) ListThreads(ctx context.Context, convID string, params url.Values) (json.RawMessage, error)

func (*Client) ListUserStatuses

func (c *Client) ListUserStatuses(ctx context.Context, params url.Values) (json.RawMessage, error)

func (*Client) ListUsers

func (c *Client) ListUsers(ctx context.Context, params url.Values) (json.RawMessage, error)

func (*Client) ListWebhooks

func (c *Client) ListWebhooks(ctx context.Context, params url.Values) (json.RawMessage, error)

func (*Client) ListWorkflows

func (c *Client) ListWorkflows(ctx context.Context, params url.Values) (json.RawMessage, error)

func (*Client) OverwriteCustomer

func (c *Client) OverwriteCustomer(ctx context.Context, id string, body any) error

func (*Client) RunWorkflow

func (c *Client) RunWorkflow(ctx context.Context, id string, body any) error

func (*Client) SetUserStatus

func (c *Client) SetUserStatus(ctx context.Context, id string, body any) error

func (*Client) UpdateConversation

func (c *Client) UpdateConversation(ctx context.Context, id string, body any) error

func (*Client) UpdateConversationFields

func (c *Client) UpdateConversationFields(ctx context.Context, id string, body any) error

func (*Client) UpdateConversationSnooze

func (c *Client) UpdateConversationSnooze(ctx context.Context, id string, body any) error

func (*Client) UpdateConversationTags

func (c *Client) UpdateConversationTags(ctx context.Context, id string, body any) error

func (*Client) UpdateCustomer

func (c *Client) UpdateCustomer(ctx context.Context, id string, body any) error

func (*Client) UpdateMailboxRouting

func (c *Client) UpdateMailboxRouting(ctx context.Context, mailboxID string, body any) error

func (*Client) UpdateOrganization

func (c *Client) UpdateOrganization(ctx context.Context, id string, body any) error

func (*Client) UpdateOrganizationProperty

func (c *Client) UpdateOrganizationProperty(ctx context.Context, id string, body any) error

func (*Client) UpdateSavedReply

func (c *Client) UpdateSavedReply(ctx context.Context, id string, body any) error

func (*Client) UpdateThread

func (c *Client) UpdateThread(ctx context.Context, convID string, threadID string, body any) error

func (*Client) UpdateWebhook

func (c *Client) UpdateWebhook(ctx context.Context, id string, body any) error

func (*Client) UpdateWorkflowStatus

func (c *Client) UpdateWorkflowStatus(ctx context.Context, id string, body any) error

type ClientAPI

type ClientAPI interface {
	ListMailboxes(ctx context.Context, params url.Values) (json.RawMessage, error)
	GetMailbox(ctx context.Context, id string) (json.RawMessage, error)
	ListMailboxFolders(ctx context.Context, mailboxID string, params url.Values) (json.RawMessage, error)
	ListMailboxCustomFields(ctx context.Context, mailboxID string, params url.Values) (json.RawMessage, error)
	GetMailboxRouting(ctx context.Context, mailboxID string) (json.RawMessage, error)
	UpdateMailboxRouting(ctx context.Context, mailboxID string, body any) error

	ListConversations(ctx context.Context, params url.Values) (json.RawMessage, error)
	GetConversation(ctx context.Context, id string, params url.Values) (json.RawMessage, error)
	CreateConversation(ctx context.Context, body any) (string, error)
	UpdateConversation(ctx context.Context, id string, body any) error
	UpdateConversationFields(ctx context.Context, id string, body any) error
	UpdateConversationTags(ctx context.Context, id string, body any) error
	UpdateConversationSnooze(ctx context.Context, id string, body any) error
	DeleteConversationSnooze(ctx context.Context, id string) error
	DeleteConversation(ctx context.Context, id string) error
	CreateAttachment(ctx context.Context, convID string, threadID string, body any) error
	GetAttachmentData(ctx context.Context, convID string, attachmentID string) (json.RawMessage, error)
	DeleteAttachment(ctx context.Context, convID string, attachmentID string) error

	ListThreads(ctx context.Context, convID string, params url.Values) (json.RawMessage, error)
	CreateReply(ctx context.Context, convID string, body any) error
	CreateNote(ctx context.Context, convID string, body any) error
	CreateChatThread(ctx context.Context, convID string, body any) error
	CreateCustomerThread(ctx context.Context, convID string, body any) error
	CreatePhoneThread(ctx context.Context, convID string, body any) error
	UpdateThread(ctx context.Context, convID string, threadID string, body any) error
	GetThreadSource(ctx context.Context, convID string, threadID string) (json.RawMessage, error)
	GetThreadSourceRFC822(ctx context.Context, convID string, threadID string) ([]byte, error)

	ListCustomers(ctx context.Context, params url.Values) (json.RawMessage, error)
	GetCustomer(ctx context.Context, id string, params url.Values) (json.RawMessage, error)
	CreateCustomer(ctx context.Context, body any) (string, error)
	UpdateCustomer(ctx context.Context, id string, body any) error
	OverwriteCustomer(ctx context.Context, id string, body any) error
	DeleteCustomer(ctx context.Context, id string, params url.Values) error

	ListTags(ctx context.Context, params url.Values) (json.RawMessage, error)
	GetTag(ctx context.Context, id string) (json.RawMessage, error)

	ListUsers(ctx context.Context, params url.Values) (json.RawMessage, error)
	GetUser(ctx context.Context, id string) (json.RawMessage, error)
	GetResourceOwner(ctx context.Context) (json.RawMessage, error)
	DeleteUser(ctx context.Context, id string) error
	ListUserStatuses(ctx context.Context, params url.Values) (json.RawMessage, error)
	GetUserStatus(ctx context.Context, id string) (json.RawMessage, error)
	SetUserStatus(ctx context.Context, id string, body any) error

	ListTeams(ctx context.Context, params url.Values) (json.RawMessage, error)
	ListTeamMembers(ctx context.Context, id string, params url.Values) (json.RawMessage, error)

	ListWorkflows(ctx context.Context, params url.Values) (json.RawMessage, error)
	UpdateWorkflowStatus(ctx context.Context, id string, body any) error
	RunWorkflow(ctx context.Context, id string, body any) error

	ListWebhooks(ctx context.Context, params url.Values) (json.RawMessage, error)
	GetWebhook(ctx context.Context, id string) (json.RawMessage, error)
	CreateWebhook(ctx context.Context, body any) (string, error)
	UpdateWebhook(ctx context.Context, id string, body any) error
	DeleteWebhook(ctx context.Context, id string) error

	ListSavedReplies(ctx context.Context, params url.Values) (json.RawMessage, error)
	GetSavedReply(ctx context.Context, id string) (json.RawMessage, error)
	CreateSavedReply(ctx context.Context, body any) (string, error)
	UpdateSavedReply(ctx context.Context, id string, body any) error
	DeleteSavedReply(ctx context.Context, id string) error

	ListOrganizations(ctx context.Context, params url.Values) (json.RawMessage, error)
	GetOrganization(ctx context.Context, id string) (json.RawMessage, error)
	CreateOrganization(ctx context.Context, body any) (string, error)
	UpdateOrganization(ctx context.Context, id string, body any) error
	DeleteOrganization(ctx context.Context, id string) error
	ListOrganizationConversations(ctx context.Context, id string, params url.Values) (json.RawMessage, error)
	ListOrganizationCustomers(ctx context.Context, id string, params url.Values) (json.RawMessage, error)

	ListOrganizationProperties(ctx context.Context, params url.Values) (json.RawMessage, error)
	GetOrganizationProperty(ctx context.Context, id string) (json.RawMessage, error)
	CreateOrganizationProperty(ctx context.Context, body any) (string, error)
	UpdateOrganizationProperty(ctx context.Context, id string, body any) error
	DeleteOrganizationProperty(ctx context.Context, id string) error

	ListCustomerProperties(ctx context.Context, params url.Values) (json.RawMessage, error)
	GetCustomerProperty(ctx context.Context, id string) (json.RawMessage, error)
	ListConversationProperties(ctx context.Context, params url.Values) (json.RawMessage, error)
	GetConversationProperty(ctx context.Context, id string) (json.RawMessage, error)

	GetRating(ctx context.Context, id string) (json.RawMessage, error)

	GetReport(ctx context.Context, family string, params url.Values) (json.RawMessage, error)
}

ClientAPI defines the public interface for the HelpScout API client.

type DocsClient

type DocsClient struct {
	// contains filtered or unexported fields
}

func NewDocs

func NewDocs(apiKey string, debug bool) *DocsClient

func NewDocsForTest

func NewDocsForTest(httpClient *http.Client, apiKey string) *DocsClient

NewDocsForTest creates a DocsClient with a custom http.Client and no rate limiter.

func (*DocsClient) CreateArticle

func (c *DocsClient) CreateArticle(ctx context.Context, body any) (json.RawMessage, error)

func (*DocsClient) CreateCategory

func (c *DocsClient) CreateCategory(ctx context.Context, body any) (json.RawMessage, error)

func (*DocsClient) CreateCollection

func (c *DocsClient) CreateCollection(ctx context.Context, body any) (json.RawMessage, error)

func (*DocsClient) CreateRedirect

func (c *DocsClient) CreateRedirect(ctx context.Context, body any) (json.RawMessage, error)

func (*DocsClient) CreateSite

func (c *DocsClient) CreateSite(ctx context.Context, body any) (json.RawMessage, error)

func (*DocsClient) DeleteArticle

func (c *DocsClient) DeleteArticle(ctx context.Context, id string) error

func (*DocsClient) DeleteArticleDraft

func (c *DocsClient) DeleteArticleDraft(ctx context.Context, articleID string) error

func (*DocsClient) DeleteCategory

func (c *DocsClient) DeleteCategory(ctx context.Context, id string) error

func (*DocsClient) DeleteCollection

func (c *DocsClient) DeleteCollection(ctx context.Context, id string) error

func (*DocsClient) DeleteRedirect

func (c *DocsClient) DeleteRedirect(ctx context.Context, id string) error

func (*DocsClient) DeleteSite

func (c *DocsClient) DeleteSite(ctx context.Context, id string) error

func (*DocsClient) FindRedirect

func (c *DocsClient) FindRedirect(ctx context.Context, params url.Values) (json.RawMessage, error)

func (*DocsClient) GetArticle

func (c *DocsClient) GetArticle(ctx context.Context, id string, params url.Values) (json.RawMessage, error)

func (*DocsClient) GetCategory

func (c *DocsClient) GetCategory(ctx context.Context, id string) (json.RawMessage, error)

func (*DocsClient) GetCollection

func (c *DocsClient) GetCollection(ctx context.Context, id string) (json.RawMessage, error)

func (*DocsClient) GetRedirect

func (c *DocsClient) GetRedirect(ctx context.Context, id string) (json.RawMessage, error)

func (*DocsClient) GetRelatedArticles

func (c *DocsClient) GetRelatedArticles(ctx context.Context, id string, params url.Values) (json.RawMessage, error)

func (*DocsClient) GetRevision

func (c *DocsClient) GetRevision(ctx context.Context, articleID, revisionID string) (json.RawMessage, error)

func (*DocsClient) GetSite

func (c *DocsClient) GetSite(ctx context.Context, id string) (json.RawMessage, error)

func (*DocsClient) GetSiteRestrictions

func (c *DocsClient) GetSiteRestrictions(ctx context.Context, id string) (json.RawMessage, error)

func (*DocsClient) ListArticles

func (c *DocsClient) ListArticles(ctx context.Context, collectionID string, params url.Values) (json.RawMessage, error)

func (*DocsClient) ListArticlesByCategory

func (c *DocsClient) ListArticlesByCategory(ctx context.Context, categoryID string, params url.Values) (json.RawMessage, error)

func (*DocsClient) ListCategories

func (c *DocsClient) ListCategories(ctx context.Context, collectionID string, params url.Values) (json.RawMessage, error)

func (*DocsClient) ListCollections

func (c *DocsClient) ListCollections(ctx context.Context, params url.Values) (json.RawMessage, error)

func (*DocsClient) ListRedirects

func (c *DocsClient) ListRedirects(ctx context.Context, siteID string, params url.Values) (json.RawMessage, error)

func (*DocsClient) ListRevisions

func (c *DocsClient) ListRevisions(ctx context.Context, articleID string, params url.Values) (json.RawMessage, error)

func (*DocsClient) ListSites

func (c *DocsClient) ListSites(ctx context.Context, params url.Values) (json.RawMessage, error)

func (*DocsClient) ReorderCategory

func (c *DocsClient) ReorderCategory(ctx context.Context, collectionID string, body any) error

func (*DocsClient) SaveArticleDraft

func (c *DocsClient) SaveArticleDraft(ctx context.Context, articleID string, body any) error

func (*DocsClient) SearchArticles

func (c *DocsClient) SearchArticles(ctx context.Context, params url.Values) (json.RawMessage, error)

func (*DocsClient) UpdateArticle

func (c *DocsClient) UpdateArticle(ctx context.Context, id string, body any) error

func (*DocsClient) UpdateArticleViewCount

func (c *DocsClient) UpdateArticleViewCount(ctx context.Context, id string, body any) error

func (*DocsClient) UpdateCategory

func (c *DocsClient) UpdateCategory(ctx context.Context, id string, body any) error

func (*DocsClient) UpdateCollection

func (c *DocsClient) UpdateCollection(ctx context.Context, id string, body any) error

func (*DocsClient) UpdateRedirect

func (c *DocsClient) UpdateRedirect(ctx context.Context, id string, body any) error

func (*DocsClient) UpdateSite

func (c *DocsClient) UpdateSite(ctx context.Context, id string, body any) error

func (*DocsClient) UpdateSiteRestrictions

func (c *DocsClient) UpdateSiteRestrictions(ctx context.Context, id string, body any) error

func (*DocsClient) UploadArticleAsset

func (c *DocsClient) UploadArticleAsset(ctx context.Context, articleID, filePath string) (json.RawMessage, error)

func (*DocsClient) UploadArticleSettingsAsset

func (c *DocsClient) UploadArticleSettingsAsset(ctx context.Context, filePath string) (json.RawMessage, error)

func (*DocsClient) UploadSettingsAsset

func (c *DocsClient) UploadSettingsAsset(ctx context.Context, filePath string) (json.RawMessage, error)

type DocsClientAPI

type DocsClientAPI interface {
	// Collections
	ListCollections(ctx context.Context, params url.Values) (json.RawMessage, error)
	GetCollection(ctx context.Context, id string) (json.RawMessage, error)
	CreateCollection(ctx context.Context, body any) (json.RawMessage, error)
	UpdateCollection(ctx context.Context, id string, body any) error
	DeleteCollection(ctx context.Context, id string) error

	// Categories
	ListCategories(ctx context.Context, collectionID string, params url.Values) (json.RawMessage, error)
	GetCategory(ctx context.Context, id string) (json.RawMessage, error)
	CreateCategory(ctx context.Context, body any) (json.RawMessage, error)
	UpdateCategory(ctx context.Context, id string, body any) error
	ReorderCategory(ctx context.Context, collectionID string, body any) error
	DeleteCategory(ctx context.Context, id string) error

	// Articles
	ListArticles(ctx context.Context, collectionID string, params url.Values) (json.RawMessage, error)
	ListArticlesByCategory(ctx context.Context, categoryID string, params url.Values) (json.RawMessage, error)
	SearchArticles(ctx context.Context, params url.Values) (json.RawMessage, error)
	GetArticle(ctx context.Context, id string, params url.Values) (json.RawMessage, error)
	GetRelatedArticles(ctx context.Context, id string, params url.Values) (json.RawMessage, error)
	ListRevisions(ctx context.Context, articleID string, params url.Values) (json.RawMessage, error)
	GetRevision(ctx context.Context, articleID, revisionID string) (json.RawMessage, error)
	CreateArticle(ctx context.Context, body any) (json.RawMessage, error)
	UpdateArticle(ctx context.Context, id string, body any) error
	DeleteArticle(ctx context.Context, id string) error
	UploadArticleAsset(ctx context.Context, articleID, filePath string) (json.RawMessage, error)
	UpdateArticleViewCount(ctx context.Context, id string, body any) error
	SaveArticleDraft(ctx context.Context, articleID string, body any) error
	DeleteArticleDraft(ctx context.Context, articleID string) error

	// Sites
	ListSites(ctx context.Context, params url.Values) (json.RawMessage, error)
	GetSite(ctx context.Context, id string) (json.RawMessage, error)
	CreateSite(ctx context.Context, body any) (json.RawMessage, error)
	UpdateSite(ctx context.Context, id string, body any) error
	DeleteSite(ctx context.Context, id string) error
	GetSiteRestrictions(ctx context.Context, id string) (json.RawMessage, error)
	UpdateSiteRestrictions(ctx context.Context, id string, body any) error

	// Redirects
	ListRedirects(ctx context.Context, siteID string, params url.Values) (json.RawMessage, error)
	FindRedirect(ctx context.Context, params url.Values) (json.RawMessage, error)
	GetRedirect(ctx context.Context, id string) (json.RawMessage, error)
	CreateRedirect(ctx context.Context, body any) (json.RawMessage, error)
	UpdateRedirect(ctx context.Context, id string, body any) error
	DeleteRedirect(ctx context.Context, id string) error

	// Assets
	UploadArticleSettingsAsset(ctx context.Context, filePath string) (json.RawMessage, error)
	UploadSettingsAsset(ctx context.Context, filePath string) (json.RawMessage, error)
}

DocsClientAPI defines the public interface for the HelpScout Docs API client.

type DocsListFunc

type DocsListFunc func(ctx context.Context, params url.Values) (json.RawMessage, error)

DocsListFunc is a function that fetches a page of Docs API results.

type HALResponse

type HALResponse struct {
	Embedded json.RawMessage `json:"_embedded"`
	Page     types.PageInfo  `json:"page"`
}

HALResponse represents a HAL+JSON list response from HelpScout.

type ListFunc

type ListFunc func(ctx context.Context, params url.Values) (json.RawMessage, error)

ListFunc is a function that fetches a page of results.

Jump to

Keyboard shortcuts

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