Documentation
¶
Index ¶
- func NewLoggingClient(level slog.Level) *http.Client
- func NewLoggingClientWithLogger(level slog.Level, logger *slog.Logger) *http.Client
- type BusinessHourService
- func (s *BusinessHourService) Create(ctx context.Context, businesshour *models.BusinessHourResponse) (*models.BusinessHourResponse, error)
- func (s *BusinessHourService) Get(ctx context.Context, id int, params url.Values) (*models.BusinessHourResponse, error)
- func (s *BusinessHourService) List(ctx context.Context, params url.Values) (*models.BusinessHoursResponse, error)
- func (s *BusinessHourService) Update(ctx context.Context, id int, businesshour *models.BusinessHourResponse) (*models.BusinessHourResponse, error)
- type Client
- type CompanyService
- func (s *CompanyService) Create(ctx context.Context, company *models.CompanyResponse) (*models.CompanyResponse, error)
- func (s *CompanyService) Get(ctx context.Context, id int, params url.Values) (*models.CompanyResponse, error)
- func (s *CompanyService) List(ctx context.Context, params url.Values) (*models.CompaniesResponse, error)
- func (s *CompanyService) Update(ctx context.Context, id int, company *models.CompanyResponse) (*models.CompanyResponse, error)
- type Config
- type CustomerService
- func (s *CustomerService) Create(ctx context.Context, customer *models.CustomerResponse) (*models.CustomerResponse, error)
- func (s *CustomerService) Get(ctx context.Context, id int, params url.Values) (*models.CustomerResponse, error)
- func (s *CustomerService) List(ctx context.Context, params url.Values) (*models.CustomersResponse, error)
- func (s *CustomerService) Update(ctx context.Context, id int, customer *models.CustomerResponse) (*models.CustomerResponse, error)
- type DefaultPathHandler
- type FilePathHandler
- type FileService
- func (s *FileService) Create(ctx context.Context, file *models.FileResponse) (*models.FileResponse, error)
- func (s *FileService) Get(ctx context.Context, id int, params url.Values) (*models.FileResponse, error)
- func (s *FileService) List(ctx context.Context, params url.Values) (*models.FilesResponse, error)
- func (s *FileService) Update(ctx context.Context, id int, file *models.FileResponse) (*models.FileResponse, error)
- func (s *FileService) Upload(ctx context.Context, file *models.FileResponse, f []byte) error
- type FilterBuilder
- func (f *FilterBuilder) And(filters ...*FilterBuilder) *FilterBuilder
- func (f *FilterBuilder) Build() string
- func (f *FilterBuilder) Eq(field string, value any) *FilterBuilder
- func (f *FilterBuilder) Gt(field string, value any) *FilterBuilder
- func (f *FilterBuilder) Gte(field string, value any) *FilterBuilder
- func (f *FilterBuilder) In(field string, values []any) *FilterBuilder
- func (f *FilterBuilder) Lt(field string, value any) *FilterBuilder
- func (f *FilterBuilder) Lte(field string, value any) *FilterBuilder
- func (f *FilterBuilder) Ne(field string, value any) *FilterBuilder
- func (f *FilterBuilder) Nin(field string, values []any) *FilterBuilder
- func (f *FilterBuilder) Or(filters ...*FilterBuilder) *FilterBuilder
- type FilterOperator
- type GetOptions
- type HelpDocArticleService
- func (s *HelpDocArticleService) Create(ctx context.Context, article *models.HelpDocArticleResponse) (*models.HelpDocArticleResponse, error)
- func (s *HelpDocArticleService) CreateForSite(ctx context.Context, siteID int, article *models.HelpDocArticleResponse) (*models.HelpDocArticleResponse, error)
- func (s *HelpDocArticleService) Get(_ context.Context, _ int, _ url.Values) (*models.HelpDocArticleResponse, error)
- func (s *HelpDocArticleService) GetForSite(ctx context.Context, siteID, id int, params url.Values) (*models.HelpDocArticleResponse, error)
- func (s *HelpDocArticleService) List(ctx context.Context, params url.Values) (*models.HelpDocArticlesResponse, error)
- func (s *HelpDocArticleService) Search(ctx context.Context, filter *models.SearchHelpdocsFilter) (*models.HelpDocArticlesResponse, error)
- func (s *HelpDocArticleService) Update(ctx context.Context, id int, article *models.HelpDocArticleResponse) (*models.HelpDocArticleResponse, error)
- func (s *HelpDocArticleService) UpdateForSite(ctx context.Context, siteID, id int, article *models.HelpDocArticleResponse) (*models.HelpDocArticleResponse, error)
- type HelpDocCategoryService
- func (s *HelpDocCategoryService) Create(ctx context.Context, category *models.HelpDocCategoryResponse) (*models.HelpDocCategoryResponse, error)
- func (s *HelpDocCategoryService) Get(ctx context.Context, id int, params url.Values) (*models.HelpDocCategoryResponse, error)
- func (s *HelpDocCategoryService) List(ctx context.Context, params url.Values) (*models.HelpDocCategoriesResponse, error)
- func (s *HelpDocCategoryService) Update(ctx context.Context, id int, category *models.HelpDocCategoryResponse) (*models.HelpDocCategoryResponse, error)
- type HelpDocSiteService
- func (s *HelpDocSiteService) Create(ctx context.Context, helpDocSite *models.HelpDocSiteResponse) (*models.HelpDocSiteResponse, error)
- func (s *HelpDocSiteService) Get(ctx context.Context, id int, params url.Values) (*models.HelpDocSiteResponse, error)
- func (s *HelpDocSiteService) List(ctx context.Context, params url.Values) (*models.HelpDocSitesResponse, error)
- func (s *HelpDocSiteService) Update(ctx context.Context, id int, helpDocSite *models.HelpDocSiteResponse) (*models.HelpDocSiteResponse, error)
- type InboxService
- func (s *InboxService) Create(ctx context.Context, inbox *models.InboxResponse) (*models.InboxResponse, error)
- func (s *InboxService) Get(ctx context.Context, id int, params url.Values) (*models.InboxResponse, error)
- func (s *InboxService) List(ctx context.Context, params url.Values) (*models.InboxesResponse, error)
- func (s *InboxService) Update(ctx context.Context, id int, inbox *models.InboxResponse) (*models.InboxResponse, error)
- type ListOptions
- type LoggingTransport
- type MessageService
- func (s *MessageService) Create(ctx context.Context, message *models.MessageResponse) (*models.MessageResponse, error)
- func (s *MessageService) CreateForTicket(ctx context.Context, ticketID int, message *models.MessageResponse) (*models.MessageResponse, error)
- func (s *MessageService) Get(ctx context.Context, id int, params url.Values) (*models.MessageResponse, error)
- func (s *MessageService) List(ctx context.Context, params url.Values) (*models.MessagesResponse, error)
- func (s *MessageService) Update(ctx context.Context, id int, message *models.MessageResponse) (*models.MessageResponse, error)
- type MiddlewareFunc
- func AuthMiddleware(token string) MiddlewareFunc
- func ConditionalMiddleware(condition func(*http.Request) bool, middleware MiddlewareFunc) MiddlewareFunc
- func HeaderMiddleware(headers map[string]string) MiddlewareFunc
- func LoggingMiddleware(logger *slog.Logger) MiddlewareFunc
- func RateLimitMiddleware(requestsPerSecond float64) MiddlewareFunc
- func RequestIDMiddleware() MiddlewareFunc
- func RetryMiddleware(maxRetries int, retryDelay time.Duration) MiddlewareFunc
- func TimeoutMiddleware(timeout time.Duration) MiddlewareFunc
- func UserAgentMiddleware(userAgent string) MiddlewareFunc
- type MockReadCloser
- type MockRoundTripper
- type Option
- type PathHandler
- type RequestHandler
- type SLAService
- func (s *SLAService) Create(ctx context.Context, sla *models.SLAResponse) (*models.SLAResponse, error)
- func (s *SLAService) Get(ctx context.Context, id int, params url.Values) (*models.SLAResponse, error)
- func (s *SLAService) List(ctx context.Context, params url.Values) (*models.SLAsResponse, error)
- func (s *SLAService) Update(ctx context.Context, id int, sla *models.SLAResponse) (*models.SLAResponse, error)
- type Service
- func (s *Service[T, L]) Create(ctx context.Context, resource *T) (*T, error)
- func (s *Service[T, L]) Get(ctx context.Context, id int, params url.Values) (*T, error)
- func (s *Service[T, L]) List(ctx context.Context, params url.Values) (*L, error)
- func (s *Service[T, L]) Update(ctx context.Context, id int, resource *T) (*T, error)
- type SpamlistService
- func (s *SpamlistService) Create(ctx context.Context, spamlist *models.SpamlistResponse) (*models.SpamlistResponse, error)
- func (s *SpamlistService) Get(ctx context.Context, id int, params url.Values) (*models.SpamlistResponse, error)
- func (s *SpamlistService) List(ctx context.Context, params url.Values) (*models.SpamlistsResponse, error)
- func (s *SpamlistService) Update(ctx context.Context, id int, spamlist *models.SpamlistResponse) (*models.SpamlistResponse, error)
- type TagService
- func (s *TagService) Create(ctx context.Context, tag *models.TagResponse) (*models.TagResponse, error)
- func (s *TagService) Get(ctx context.Context, id int, params url.Values) (*models.TagResponse, error)
- func (s *TagService) List(ctx context.Context, params url.Values) (*models.TagsResponse, error)
- func (s *TagService) Update(ctx context.Context, id int, tag *models.TagResponse) (*models.TagResponse, error)
- type TicketPriorityService
- func (s *TicketPriorityService) Create(ctx context.Context, ticketpriority *models.TicketPriorityResponse) (*models.TicketPriorityResponse, error)
- func (s *TicketPriorityService) Get(ctx context.Context, id int, params url.Values) (*models.TicketPriorityResponse, error)
- func (s *TicketPriorityService) List(ctx context.Context, params url.Values) (*models.TicketPrioritiesResponse, error)
- func (s *TicketPriorityService) Update(ctx context.Context, id int, ticketpriority *models.TicketPriorityResponse) (*models.TicketPriorityResponse, error)
- type TicketService
- func (s *TicketService) Create(ctx context.Context, ticket *models.TicketResponse) (*models.TicketResponse, error)
- func (s *TicketService) Get(ctx context.Context, id int, params url.Values) (*models.TicketResponse, error)
- func (s *TicketService) LinkTask(ctx context.Context, ticketID, taskID int) error
- func (s *TicketService) List(ctx context.Context, params url.Values) (*models.TicketsResponse, error)
- func (s *TicketService) Search(ctx context.Context, filter *models.SearchTicketsFilter) (*models.TicketsResponse, error)
- func (s *TicketService) UnlinkTask(ctx context.Context, ticketID, taskID int) error
- func (s *TicketService) Update(ctx context.Context, id int, ticket *models.TicketResponse) (*models.TicketResponse, error)
- type TicketSourceService
- func (s *TicketSourceService) Create(ctx context.Context, ticketsource *models.TicketSourceResponse) (*models.TicketSourceResponse, error)
- func (s *TicketSourceService) Get(ctx context.Context, id int, params url.Values) (*models.TicketSourceResponse, error)
- func (s *TicketSourceService) List(ctx context.Context, params url.Values) (*models.TicketSourcesResponse, error)
- func (s *TicketSourceService) Update(ctx context.Context, id int, ticketsource *models.TicketSourceResponse) (*models.TicketSourceResponse, error)
- type TicketStatusService
- func (s *TicketStatusService) Create(ctx context.Context, ticketstatus *models.TicketStatusResponse) (*models.TicketStatusResponse, error)
- func (s *TicketStatusService) Get(ctx context.Context, id int, params url.Values) (*models.TicketStatusResponse, error)
- func (s *TicketStatusService) List(ctx context.Context, params url.Values) (*models.TicketStatusesResponse, error)
- func (s *TicketStatusService) Update(ctx context.Context, id int, ticketstatus *models.TicketStatusResponse) (*models.TicketStatusResponse, error)
- type TicketTypeService
- func (s *TicketTypeService) Create(ctx context.Context, tickettype *models.TicketTypeResponse) (*models.TicketTypeResponse, error)
- func (s *TicketTypeService) Get(ctx context.Context, id int, params url.Values) (*models.TicketTypeResponse, error)
- func (s *TicketTypeService) List(ctx context.Context, params url.Values) (*models.TicketTypesResponse, error)
- func (s *TicketTypeService) Update(ctx context.Context, id int, tickettype *models.TicketTypeResponse) (*models.TicketTypeResponse, error)
- type UserService
- func (s *UserService) Create(ctx context.Context, user *models.UserResponse) (*models.UserResponse, error)
- func (s *UserService) Get(ctx context.Context, id int, params url.Values) (*models.UserResponse, error)
- func (s *UserService) List(ctx context.Context, params url.Values) (*models.UsersResponse, error)
- func (s *UserService) Update(ctx context.Context, id int, user *models.UserResponse) (*models.UserResponse, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewLoggingClient ¶
NewLoggingClient creates a new HTTP client with logging
Types ¶
type BusinessHourService ¶
type BusinessHourService struct {
*Service[models.BusinessHourResponse, models.BusinessHoursResponse]
}
BusinessHourService handles ticket-related operations
func NewBusinessHourService ¶
func NewBusinessHourService(client *Client) *BusinessHourService
NewBusinessHourService creates a new ticket service
func (*BusinessHourService) Create ¶
func (s *BusinessHourService) Create(ctx context.Context, businesshour *models.BusinessHourResponse) (*models.BusinessHourResponse, error)
Create creates a new businesshour
func (*BusinessHourService) Get ¶
func (s *BusinessHourService) Get(ctx context.Context, id int, params url.Values) (*models.BusinessHourResponse, error)
Get retrieves a businesshour by ID
func (*BusinessHourService) List ¶
func (s *BusinessHourService) List(ctx context.Context, params url.Values) (*models.BusinessHoursResponse, error)
List retrieves a list of businesshours with optional filters
func (*BusinessHourService) Update ¶
func (s *BusinessHourService) Update(ctx context.Context, id int, businesshour *models.BusinessHourResponse) (*models.BusinessHourResponse, error)
Update updates an existing businesshour
type Client ¶
type Client struct {
// Services
BusinessHours *BusinessHourService
Companies *CompanyService
Customers *CustomerService
Files *FileService
HelpDocArticles *HelpDocArticleService
HelpDocCategories *HelpDocCategoryService
HelpDocSites *HelpDocSiteService
Inboxes *InboxService
Messages *MessageService
SLAs *SLAService
Spamlists *SpamlistService
Tags *TagService
TicketPriorities *TicketPriorityService
Tickets *TicketService
TicketSources *TicketSourceService
TicketStatuses *TicketStatusService
TicketTypes *TicketTypeService
Users *UserService
// contains filtered or unexported fields
}
Client represents the Desk API client
type CompanyService ¶
type CompanyService struct {
*Service[models.CompanyResponse, models.CompaniesResponse]
}
CompanyService handles company-related operations
func NewCompanyService ¶
func NewCompanyService(client *Client) *CompanyService
NewCompanyService creates a new company service
func (*CompanyService) Create ¶
func (s *CompanyService) Create(ctx context.Context, company *models.CompanyResponse) (*models.CompanyResponse, error)
Create creates a new company
func (*CompanyService) Get ¶
func (s *CompanyService) Get(ctx context.Context, id int, params url.Values) (*models.CompanyResponse, error)
Get retrieves a company by ID
func (*CompanyService) List ¶
func (s *CompanyService) List(ctx context.Context, params url.Values) (*models.CompaniesResponse, error)
List retrieves a list of companies with optional filters
func (*CompanyService) Update ¶
func (s *CompanyService) Update(ctx context.Context, id int, company *models.CompanyResponse) (*models.CompanyResponse, error)
Update updates an existing company
type CustomerService ¶
type CustomerService struct {
*Service[models.CustomerResponse, models.CustomersResponse]
}
CustomerService handles customer-related operations
func NewCustomerService ¶
func NewCustomerService(client *Client) *CustomerService
NewCustomerService creates a new customer service
func (*CustomerService) Create ¶
func (s *CustomerService) Create(ctx context.Context, customer *models.CustomerResponse) (*models.CustomerResponse, error)
Create creates a new customer
func (*CustomerService) Get ¶
func (s *CustomerService) Get(ctx context.Context, id int, params url.Values) (*models.CustomerResponse, error)
Get retrieves a customer by ID
func (*CustomerService) List ¶
func (s *CustomerService) List(ctx context.Context, params url.Values) (*models.CustomersResponse, error)
List retrieves a list of customers with optional filters
func (*CustomerService) Update ¶
func (s *CustomerService) Update(ctx context.Context, id int, customer *models.CustomerResponse) (*models.CustomerResponse, error)
Update updates an existing customer
type DefaultPathHandler ¶
type DefaultPathHandler struct {
// contains filtered or unexported fields
}
func NewDefaultPathHandler ¶
func NewDefaultPathHandler(base string) DefaultPathHandler
func NewDefaultPathHandlerWithUpdateMethod ¶
func NewDefaultPathHandlerWithUpdateMethod(base, updateMethod string) DefaultPathHandler
func (DefaultPathHandler) Create ¶
func (d DefaultPathHandler) Create() string
func (DefaultPathHandler) Get ¶
func (d DefaultPathHandler) Get(id int) string
func (DefaultPathHandler) List ¶
func (d DefaultPathHandler) List() string
func (DefaultPathHandler) Update ¶
func (d DefaultPathHandler) Update(id int) string
func (DefaultPathHandler) UpdateMethod ¶
func (d DefaultPathHandler) UpdateMethod() string
type FilePathHandler ¶
type FilePathHandler struct {
DefaultPathHandler
}
func NewFilePathHandler ¶
func NewFilePathHandler() FilePathHandler
func (FilePathHandler) Create ¶
func (f FilePathHandler) Create() string
type FileService ¶
type FileService struct {
*Service[models.FileResponse, models.FilesResponse]
}
FileService handles ticket-related operations
func NewFileService ¶
func NewFileService(client *Client) *FileService
NewFileService creates a new ticket service
func (*FileService) Create ¶
func (s *FileService) Create(ctx context.Context, file *models.FileResponse) (*models.FileResponse, error)
Create creates a new file reference. This does not upload the file to s3, but returns the necessary information to do so.
func (*FileService) Get ¶
func (s *FileService) Get(ctx context.Context, id int, params url.Values) (*models.FileResponse, error)
Get retrieves a file by ID
func (*FileService) List ¶
func (s *FileService) List(ctx context.Context, params url.Values) (*models.FilesResponse, error)
List retrieves a list of files with optional filters
func (*FileService) Update ¶
func (s *FileService) Update(ctx context.Context, id int, file *models.FileResponse) (*models.FileResponse, error)
Update updates an existing file
func (*FileService) Upload ¶
func (s *FileService) Upload(ctx context.Context, file *models.FileResponse, f []byte) error
Upload uploads a file to s3. This is a helper method that uses the information returned from the Create method.
type FilterBuilder ¶
type FilterBuilder struct {
// contains filtered or unexported fields
}
FilterBuilder helps build MongoDB-style filters
func (*FilterBuilder) And ¶
func (f *FilterBuilder) And(filters ...*FilterBuilder) *FilterBuilder
And adds an AND condition
func (*FilterBuilder) Build ¶
func (f *FilterBuilder) Build() string
Build returns the filter as a JSON string
func (*FilterBuilder) Eq ¶
func (f *FilterBuilder) Eq(field string, value any) *FilterBuilder
Eq adds an equality condition
func (*FilterBuilder) Gt ¶
func (f *FilterBuilder) Gt(field string, value any) *FilterBuilder
Gt adds a greater-than condition
func (*FilterBuilder) Gte ¶
func (f *FilterBuilder) Gte(field string, value any) *FilterBuilder
Gte adds a greater-than-or-equal condition
func (*FilterBuilder) In ¶
func (f *FilterBuilder) In(field string, values []any) *FilterBuilder
In adds an in-list condition
func (*FilterBuilder) Lt ¶
func (f *FilterBuilder) Lt(field string, value any) *FilterBuilder
Lt adds a less-than condition
func (*FilterBuilder) Lte ¶
func (f *FilterBuilder) Lte(field string, value any) *FilterBuilder
Lte adds a less-than-or-equal condition
func (*FilterBuilder) Ne ¶
func (f *FilterBuilder) Ne(field string, value any) *FilterBuilder
Ne adds a not-equal condition
func (*FilterBuilder) Nin ¶
func (f *FilterBuilder) Nin(field string, values []any) *FilterBuilder
Nin adds a not-in-list condition
func (*FilterBuilder) Or ¶
func (f *FilterBuilder) Or(filters ...*FilterBuilder) *FilterBuilder
Or adds an OR condition
type FilterOperator ¶
type FilterOperator string
FilterOperator represents the available filter operators
const ( // Comparison operators OpEq FilterOperator = "$eq" OpNe FilterOperator = "$ne" OpLt FilterOperator = "$lt" OpLte FilterOperator = "$lte" OpGt FilterOperator = "$gt" OpGte FilterOperator = "$gte" OpIn FilterOperator = "$in" OpNin FilterOperator = "$nin" // Logical operators OpAnd FilterOperator = "$and" OpOr FilterOperator = "$or" )
type GetOptions ¶
GetOptions represents options for single-resource get operations
func (*GetOptions) Values ¶
func (o *GetOptions) Values() url.Values
Values builds a url.Values from the options. Defaults includes to "all" when unset.
type HelpDocArticleService ¶
type HelpDocArticleService struct {
*Service[models.HelpDocArticleResponse, models.HelpDocArticlesResponse]
// contains filtered or unexported fields
}
HelpDocArticleService handles help doc article-related operations
func NewHelpDocArticleService ¶
func NewHelpDocArticleService(client *Client) *HelpDocArticleService
NewHelpDocArticleService creates a new help doc article service
func (*HelpDocArticleService) Create ¶
func (s *HelpDocArticleService) Create( ctx context.Context, article *models.HelpDocArticleResponse, ) (*models.HelpDocArticleResponse, error)
Create creates a new help doc article on the site its helpdocsite reference names.
func (*HelpDocArticleService) CreateForSite ¶ added in v1.1.2
func (s *HelpDocArticleService) CreateForSite( ctx context.Context, siteID int, article *models.HelpDocArticleResponse, ) (*models.HelpDocArticleResponse, error)
CreateForSite creates a new help doc article on the given site.
The route carries the site and the endpoint takes it from there, so what the body's helpdocsite says is ignored.
func (*HelpDocArticleService) Get ¶
func (s *HelpDocArticleService) Get(_ context.Context, _ int, _ url.Values) (*models.HelpDocArticleResponse, error)
Get is not reachable without a site: an article is addressed through the site it belongs to, so there is nothing to read from an ID alone. Use GetForSite.
It is kept to the shape the other services share, rather than dropped, so a caller ranging over services still compiles — and is told what to call.
func (*HelpDocArticleService) GetForSite ¶ added in v1.1.2
func (s *HelpDocArticleService) GetForSite( ctx context.Context, siteID, id int, params url.Values, ) (*models.HelpDocArticleResponse, error)
GetForSite retrieves a help doc article by ID from the site it belongs to.
func (*HelpDocArticleService) List ¶
func (s *HelpDocArticleService) List(ctx context.Context, params url.Values) (*models.HelpDocArticlesResponse, error)
List retrieves a list of help doc articles across the sites the caller can see, with optional filters. It is the one article route that is not keyed on a site.
func (*HelpDocArticleService) Search ¶ added in v1.0.1
func (s *HelpDocArticleService) Search(ctx context.Context, filter *models.SearchHelpdocsFilter) (*models.HelpDocArticlesResponse, error)
Search searches for help doc articles based on filter parameters
func (*HelpDocArticleService) Update ¶
func (s *HelpDocArticleService) Update( ctx context.Context, id int, article *models.HelpDocArticleResponse, ) (*models.HelpDocArticleResponse, error)
Update updates an existing help doc article on the site its helpdocsite reference names.
func (*HelpDocArticleService) UpdateForSite ¶ added in v1.1.2
func (s *HelpDocArticleService) UpdateForSite( ctx context.Context, siteID, id int, article *models.HelpDocArticleResponse, ) (*models.HelpDocArticleResponse, error)
UpdateForSite updates an existing help doc article on the given site.
The endpoint binds the body over the stored article and revalidates the result, so only the properties the body carries change — and one carried as its zero value is an erasure rather than a no-op.
type HelpDocCategoryService ¶ added in v1.1.2
type HelpDocCategoryService struct {
*Service[models.HelpDocCategoryResponse, models.HelpDocCategoriesResponse]
// contains filtered or unexported fields
}
HelpDocCategoryService handles help doc category-related operations
func NewHelpDocCategoryService ¶ added in v1.1.2
func NewHelpDocCategoryService(client *Client) *HelpDocCategoryService
NewHelpDocCategoryService creates a new help doc category service
func (*HelpDocCategoryService) Create ¶ added in v1.1.2
func (s *HelpDocCategoryService) Create( ctx context.Context, category *models.HelpDocCategoryResponse, ) (*models.HelpDocCategoryResponse, error)
Create creates a new help doc category
func (*HelpDocCategoryService) Get ¶ added in v1.1.2
func (s *HelpDocCategoryService) Get( ctx context.Context, id int, params url.Values, ) (*models.HelpDocCategoryResponse, error)
Get retrieves a help doc category by ID
func (*HelpDocCategoryService) List ¶ added in v1.1.2
func (s *HelpDocCategoryService) List( ctx context.Context, params url.Values, ) (*models.HelpDocCategoriesResponse, error)
List retrieves a list of help doc categories with optional filters. Narrow it to one site with the filter query parameter: {"sites.id": <siteID>}.
func (*HelpDocCategoryService) Update ¶ added in v1.1.2
func (s *HelpDocCategoryService) Update( ctx context.Context, id int, category *models.HelpDocCategoryResponse, ) (*models.HelpDocCategoryResponse, error)
Update updates an existing help doc category
type HelpDocSiteService ¶
type HelpDocSiteService struct {
*Service[models.HelpDocSiteResponse, models.HelpDocSitesResponse]
}
HelpDocSiteService handles help doc site-related operations
func NewHelpDocSiteService ¶
func NewHelpDocSiteService(client *Client) *HelpDocSiteService
NewHelpDocSiteService creates a new help doc site service
func (*HelpDocSiteService) Create ¶
func (s *HelpDocSiteService) Create(ctx context.Context, helpDocSite *models.HelpDocSiteResponse) (*models.HelpDocSiteResponse, error)
Create creates a new ticket
func (*HelpDocSiteService) Get ¶
func (s *HelpDocSiteService) Get(ctx context.Context, id int, params url.Values) (*models.HelpDocSiteResponse, error)
Get retrieves a help doc site by ID
func (*HelpDocSiteService) List ¶
func (s *HelpDocSiteService) List(ctx context.Context, params url.Values) (*models.HelpDocSitesResponse, error)
List retrieves a list of help doc sites with optional filters
func (*HelpDocSiteService) Update ¶
func (s *HelpDocSiteService) Update(ctx context.Context, id int, helpDocSite *models.HelpDocSiteResponse) (*models.HelpDocSiteResponse, error)
Update updates an existing ticket
type InboxService ¶
type InboxService struct {
*Service[models.InboxResponse, models.InboxesResponse]
}
InboxService handles ticket-related operations
func NewInboxService ¶
func NewInboxService(client *Client) *InboxService
NewInboxService creates a new ticket service
func (*InboxService) Create ¶
func (s *InboxService) Create(ctx context.Context, inbox *models.InboxResponse) (*models.InboxResponse, error)
Create creates a new inbox
func (*InboxService) Get ¶
func (s *InboxService) Get(ctx context.Context, id int, params url.Values) (*models.InboxResponse, error)
Get retrieves an inbox by ID
func (*InboxService) List ¶
func (s *InboxService) List(ctx context.Context, params url.Values) (*models.InboxesResponse, error)
List retrieves a list of inboxes with optional filters
func (*InboxService) Update ¶
func (s *InboxService) Update(ctx context.Context, id int, inbox *models.InboxResponse) (*models.InboxResponse, error)
Update updates an existing inbox
type ListOptions ¶
type ListOptions struct {
Page int
PerPage int
SortBy string
SortDir string
Embed string
Fields string
Q string
}
ListOptions represents options for list operations
func (*ListOptions) Encode ¶
func (o *ListOptions) Encode() string
Encode encodes the options into a query string
type LoggingTransport ¶
type LoggingTransport struct {
Transport http.RoundTripper
Logger *slog.Logger
}
LoggingTransport wraps an http.RoundTripper and logs the request and response
type MessageService ¶
type MessageService struct {
*Service[models.MessageResponse, models.MessagesResponse]
// contains filtered or unexported fields
}
MessageService handles message-related operations
func NewMessageService ¶
func NewMessageService(client *Client) *MessageService
NewMessageService creates a new message service
func (*MessageService) Create ¶
func (s *MessageService) Create(ctx context.Context, message *models.MessageResponse) (*models.MessageResponse, error)
Create creates a new message
func (*MessageService) CreateForTicket ¶
func (s *MessageService) CreateForTicket(ctx context.Context, ticketID int, message *models.MessageResponse) (*models.MessageResponse, error)
CreateForTicket creates a new message scoped to a ticket
func (*MessageService) Get ¶
func (s *MessageService) Get(ctx context.Context, id int, params url.Values) (*models.MessageResponse, error)
Get retrieves a message by ID
func (*MessageService) List ¶
func (s *MessageService) List(ctx context.Context, params url.Values) (*models.MessagesResponse, error)
List retrieves a list of messages with optional filters
func (*MessageService) Update ¶
func (s *MessageService) Update(ctx context.Context, id int, message *models.MessageResponse) (*models.MessageResponse, error)
Update updates an existing message
type MiddlewareFunc ¶
type MiddlewareFunc func(ctx context.Context, req *http.Request, next RequestHandler) (*http.Response, error)
MiddlewareFunc represents a middleware function that can modify requests before they are sent
func AuthMiddleware ¶
func AuthMiddleware(token string) MiddlewareFunc
AuthMiddleware creates middleware that adds authentication headers
func ConditionalMiddleware ¶
func ConditionalMiddleware(condition func(*http.Request) bool, middleware MiddlewareFunc) MiddlewareFunc
ConditionalMiddleware creates middleware that only executes when a condition is met
func HeaderMiddleware ¶
func HeaderMiddleware(headers map[string]string) MiddlewareFunc
HeaderMiddleware creates middleware that adds custom headers to requests
func LoggingMiddleware ¶
func LoggingMiddleware(logger *slog.Logger) MiddlewareFunc
LoggingMiddleware creates middleware that logs HTTP requests and responses
func RateLimitMiddleware ¶
func RateLimitMiddleware(requestsPerSecond float64) MiddlewareFunc
RateLimitMiddleware creates middleware that implements rate limiting
func RequestIDMiddleware ¶
func RequestIDMiddleware() MiddlewareFunc
RequestIDMiddleware creates middleware that adds a unique request ID header
func RetryMiddleware ¶
func RetryMiddleware(maxRetries int, retryDelay time.Duration) MiddlewareFunc
RetryMiddleware creates middleware that retries requests on failure
func TimeoutMiddleware ¶
func TimeoutMiddleware(timeout time.Duration) MiddlewareFunc
TimeoutMiddleware creates middleware that enforces request timeouts
func UserAgentMiddleware ¶
func UserAgentMiddleware(userAgent string) MiddlewareFunc
UserAgentMiddleware creates middleware that adds a User-Agent header
type MockReadCloser ¶
MockReadCloser implements io.ReadCloser for testing
func NewMockReadCloser ¶
func NewMockReadCloser(s string) *MockReadCloser
NewMockReadCloser creates a new MockReadCloser from a string
type MockRoundTripper ¶
type MockRoundTripper struct {
// contains filtered or unexported fields
}
MockRoundTripper implements http.RoundTripper for testing
func NewMockRoundTripper ¶
func NewMockRoundTripper() *MockRoundTripper
NewMockRoundTripper creates a new mock round tripper
func (*MockRoundTripper) AddResponse ¶
func (m *MockRoundTripper) AddResponse(method, urlPath string, statusCode int, body interface{})
AddResponse adds a mock response for a given method and path
func (*MockRoundTripper) GetRequests ¶
func (m *MockRoundTripper) GetRequests() []*http.Request
GetRequests returns all requests made to the mock
func (*MockRoundTripper) Reset ¶
func (m *MockRoundTripper) Reset()
Reset clears all stored requests and responses
type Option ¶
type Option func(*Client)
Option is a function that configures a Client
func WithHTTPClient ¶
WithHTTPClient sets a custom HTTP client
func WithLogLevel ¶
WithLogLevel sets the log level for the client
func WithLogger ¶
WithLogger sets a custom logger for the client
func WithMiddleware ¶
func WithMiddleware(mw MiddlewareFunc) Option
WithMiddleware adds middleware to the client
type PathHandler ¶
type RequestHandler ¶
RequestHandler represents the function that executes the actual HTTP request
type SLAService ¶
type SLAService struct {
*Service[models.SLAResponse, models.SLAsResponse]
}
SLAService handles ticket-related operations
func NewSLAService ¶
func NewSLAService(client *Client) *SLAService
NewSLAService creates a new ticket service
func (*SLAService) Create ¶
func (s *SLAService) Create(ctx context.Context, sla *models.SLAResponse) (*models.SLAResponse, error)
Create creates a new sla
func (*SLAService) Get ¶
func (s *SLAService) Get(ctx context.Context, id int, params url.Values) (*models.SLAResponse, error)
Get retrieves a sla by ID
func (*SLAService) List ¶
func (s *SLAService) List(ctx context.Context, params url.Values) (*models.SLAsResponse, error)
List retrieves a list of slas with optional filters
func (*SLAService) Update ¶
func (s *SLAService) Update(ctx context.Context, id int, sla *models.SLAResponse) (*models.SLAResponse, error)
Update updates an existing sla
type Service ¶
Service handles generic resource operations
func NewService ¶
func NewService[T any, L any](client *Client, router PathHandler) *Service[T, L]
NewService creates a new generic service
type SpamlistService ¶
type SpamlistService struct {
*Service[models.SpamlistResponse, models.SpamlistsResponse]
}
SpamlistService handles spamlist-related operations
func NewSpamlistService ¶
func NewSpamlistService(client *Client) *SpamlistService
NewSpamlistService creates a new spamlist service
func (*SpamlistService) Create ¶
func (s *SpamlistService) Create(ctx context.Context, spamlist *models.SpamlistResponse) (*models.SpamlistResponse, error)
Create creates a new spamlist
func (*SpamlistService) Get ¶
func (s *SpamlistService) Get(ctx context.Context, id int, params url.Values) (*models.SpamlistResponse, error)
Get retrieves a spamlist by ID
func (*SpamlistService) List ¶
func (s *SpamlistService) List(ctx context.Context, params url.Values) (*models.SpamlistsResponse, error)
List retrieves a list of spamlistes with optional filters
func (*SpamlistService) Update ¶
func (s *SpamlistService) Update(ctx context.Context, id int, spamlist *models.SpamlistResponse) (*models.SpamlistResponse, error)
Update updates an existing spamlist
type TagService ¶
type TagService struct {
*Service[models.TagResponse, models.TagsResponse]
}
TagService handles ticket-related operations
func NewTagService ¶
func NewTagService(client *Client) *TagService
NewTagService creates a new ticket service
func (*TagService) Create ¶
func (s *TagService) Create(ctx context.Context, tag *models.TagResponse) (*models.TagResponse, error)
Create creates a new tag
func (*TagService) Get ¶
func (s *TagService) Get(ctx context.Context, id int, params url.Values) (*models.TagResponse, error)
Get retrieves a tag by ID
func (*TagService) List ¶
func (s *TagService) List(ctx context.Context, params url.Values) (*models.TagsResponse, error)
List retrieves a list of tages with optional filters
func (*TagService) Update ¶
func (s *TagService) Update(ctx context.Context, id int, tag *models.TagResponse) (*models.TagResponse, error)
Update updates an existing tag
type TicketPriorityService ¶
type TicketPriorityService struct {
*Service[models.TicketPriorityResponse, models.TicketPrioritiesResponse]
}
TicketPriorityService handles ticket-related operations
func NewTicketPriorityService ¶
func NewTicketPriorityService(client *Client) *TicketPriorityService
NewTicketPriorityService creates a new ticket service
func (*TicketPriorityService) Create ¶
func (s *TicketPriorityService) Create(ctx context.Context, ticketpriority *models.TicketPriorityResponse) (*models.TicketPriorityResponse, error)
Create creates a new ticketpriority
func (*TicketPriorityService) Get ¶
func (s *TicketPriorityService) Get(ctx context.Context, id int, params url.Values) (*models.TicketPriorityResponse, error)
Get retrieves a ticketpriority by ID
func (*TicketPriorityService) List ¶
func (s *TicketPriorityService) List(ctx context.Context, params url.Values) (*models.TicketPrioritiesResponse, error)
List retrieves a list of ticketpriorityes with optional filters
func (*TicketPriorityService) Update ¶
func (s *TicketPriorityService) Update(ctx context.Context, id int, ticketpriority *models.TicketPriorityResponse) (*models.TicketPriorityResponse, error)
Update updates an existing ticketpriority
type TicketService ¶
type TicketService struct {
*Service[models.TicketResponse, models.TicketsResponse]
// contains filtered or unexported fields
}
TicketService handles ticket-related operations
func NewTicketService ¶
func NewTicketService(client *Client) *TicketService
NewTicketService creates a new ticket service
func (*TicketService) Create ¶
func (s *TicketService) Create(ctx context.Context, ticket *models.TicketResponse) (*models.TicketResponse, error)
Create creates a new ticket
func (*TicketService) Get ¶
func (s *TicketService) Get(ctx context.Context, id int, params url.Values) (*models.TicketResponse, error)
Get retrieves a ticket by ID
func (*TicketService) LinkTask ¶ added in v1.1.0
func (s *TicketService) LinkTask(ctx context.Context, ticketID, taskID int) error
LinkTask links a project task to a ticket
func (*TicketService) List ¶
func (s *TicketService) List(ctx context.Context, params url.Values) (*models.TicketsResponse, error)
List retrieves a list of tickets with optional filters
func (*TicketService) Search ¶
func (s *TicketService) Search(ctx context.Context, filter *models.SearchTicketsFilter) (*models.TicketsResponse, error)
Search searches for tickets based on query parameters
func (*TicketService) UnlinkTask ¶ added in v1.1.0
func (s *TicketService) UnlinkTask(ctx context.Context, ticketID, taskID int) error
UnlinkTask removes the link between a project task and a ticket
func (*TicketService) Update ¶
func (s *TicketService) Update(ctx context.Context, id int, ticket *models.TicketResponse) (*models.TicketResponse, error)
Update updates an existing ticket
type TicketSourceService ¶
type TicketSourceService struct {
*Service[models.TicketSourceResponse, models.TicketSourcesResponse]
}
TicketSourceService handles ticket-related operations
func NewTicketSourceService ¶
func NewTicketSourceService(client *Client) *TicketSourceService
NewTicketSourceService creates a new ticket service
func (*TicketSourceService) Create ¶
func (s *TicketSourceService) Create(ctx context.Context, ticketsource *models.TicketSourceResponse) (*models.TicketSourceResponse, error)
Create creates a new ticketsource
func (*TicketSourceService) Get ¶
func (s *TicketSourceService) Get(ctx context.Context, id int, params url.Values) (*models.TicketSourceResponse, error)
Get retrieves a ticketsource by ID
func (*TicketSourceService) List ¶
func (s *TicketSourceService) List(ctx context.Context, params url.Values) (*models.TicketSourcesResponse, error)
List retrieves a list of ticketsources with optional filters
func (*TicketSourceService) Update ¶
func (s *TicketSourceService) Update(ctx context.Context, id int, ticketsource *models.TicketSourceResponse) (*models.TicketSourceResponse, error)
Update updates an existing ticketsource
type TicketStatusService ¶
type TicketStatusService struct {
*Service[models.TicketStatusResponse, models.TicketStatusesResponse]
}
TicketStatusService handles ticket-related operations
func NewTicketStatusService ¶
func NewTicketStatusService(client *Client) *TicketStatusService
NewTicketStatusService creates a new ticket service
func (*TicketStatusService) Create ¶
func (s *TicketStatusService) Create(ctx context.Context, ticketstatus *models.TicketStatusResponse) (*models.TicketStatusResponse, error)
Create creates a new ticketstatus
func (*TicketStatusService) Get ¶
func (s *TicketStatusService) Get(ctx context.Context, id int, params url.Values) (*models.TicketStatusResponse, error)
Get retrieves a ticketstatus by ID
func (*TicketStatusService) List ¶
func (s *TicketStatusService) List(ctx context.Context, params url.Values) (*models.TicketStatusesResponse, error)
List retrieves a list of ticketstatuses with optional filters
func (*TicketStatusService) Update ¶
func (s *TicketStatusService) Update(ctx context.Context, id int, ticketstatus *models.TicketStatusResponse) (*models.TicketStatusResponse, error)
Update updates an existing ticketstatus
type TicketTypeService ¶
type TicketTypeService struct {
*Service[models.TicketTypeResponse, models.TicketTypesResponse]
}
TicketTypeService handles ticket-related operations
func NewTicketTypeService ¶
func NewTicketTypeService(client *Client) *TicketTypeService
NewTicketTypeService creates a new ticket service
func (*TicketTypeService) Create ¶
func (s *TicketTypeService) Create(ctx context.Context, tickettype *models.TicketTypeResponse) (*models.TicketTypeResponse, error)
Create creates a new tickettype
func (*TicketTypeService) Get ¶
func (s *TicketTypeService) Get(ctx context.Context, id int, params url.Values) (*models.TicketTypeResponse, error)
Get retrieves a tickettype by ID
func (*TicketTypeService) List ¶
func (s *TicketTypeService) List(ctx context.Context, params url.Values) (*models.TicketTypesResponse, error)
List retrieves a list of tickettypees with optional filters
func (*TicketTypeService) Update ¶
func (s *TicketTypeService) Update(ctx context.Context, id int, tickettype *models.TicketTypeResponse) (*models.TicketTypeResponse, error)
Update updates an existing tickettype
type UserService ¶
type UserService struct {
*Service[models.UserResponse, models.UsersResponse]
}
UserService handles user-related operations
func NewUserService ¶
func NewUserService(client *Client) *UserService
NewUserService creates a new user service
func (*UserService) Create ¶
func (s *UserService) Create(ctx context.Context, user *models.UserResponse) (*models.UserResponse, error)
Create creates a new user
func (*UserService) Get ¶
func (s *UserService) Get(ctx context.Context, id int, params url.Values) (*models.UserResponse, error)
Get retrieves a user by ID
func (*UserService) List ¶
func (s *UserService) List(ctx context.Context, params url.Values) (*models.UsersResponse, error)
List retrieves a list of users with optional filters
func (*UserService) Update ¶
func (s *UserService) Update(ctx context.Context, id int, user *models.UserResponse) (*models.UserResponse, error)
Update updates an existing user
Source Files
¶
- businesshours.go
- client.go
- companies.go
- customers.go
- file.go
- filter.go
- helpdocarticles.go
- helpdoccategories.go
- helpdocsites.go
- inboxes.go
- messages.go
- middleware.go
- mock_client.go
- path.go
- resource.go
- slas.go
- spamlist.go
- tags.go
- ticketpriorities.go
- tickets.go
- ticketsources.go
- ticketstatuses.go
- tickettypes.go
- transport.go
- users.go