Skip to content

Commit b54985c

Browse files
committed
Add other options
1 parent 806bebf commit b54985c

File tree

2 files changed

+23
-3
lines changed

2 files changed

+23
-3
lines changed

zendesk/mock/client.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

zendesk/ticket_comment.go

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010
// TicketCommentAPI is an interface containing all ticket comment related API methods
1111
type TicketCommentAPI interface {
1212
CreateTicketComment(ctx context.Context, ticketID int64, ticketComment TicketComment) (TicketComment, error)
13-
ListTicketComments(ctx context.Context, ticketID int64, opts *CursorPagination) (*ListTicketCommentsResult, error)
13+
ListTicketComments(ctx context.Context, ticketID int64, opts *ListTicketCommentsOptions) (*ListTicketCommentsResult, error)
1414
MakeCommentPrivate(ctx context.Context, ticketID int64, ticketCommentID int64) error
1515
}
1616

@@ -82,6 +82,22 @@ func (z *Client) CreateTicketComment(ctx context.Context, ticketID int64, ticket
8282
return result, err
8383
}
8484

85+
type ListTicketCommentsSort string
86+
87+
const (
88+
TICKET_COMMENT_CREATED_AT_ASC ListTicketCommentsSort = "created_at"
89+
TICKET_COMMENT_CREATED_AT_DESC ListTicketCommentsSort = "-created_at"
90+
)
91+
92+
// ListTicketCommentOptions contains all the options supported by ListTicketComments endpoint.
93+
type ListTicketCommentsOptions struct {
94+
CursorPagination
95+
96+
Include string `url:"include,omitempty"`
97+
IncludeInlineImages string `url:"include_inline_images,omitempty"`
98+
Sort ListTicketCommentsSort `url:"sort,omitempty"`
99+
}
100+
85101
// ListTicketCommentsResult contains the resulting ticket comments
86102
// and cursor pagination metadata.
87103
type ListTicketCommentsResult struct {
@@ -92,7 +108,11 @@ type ListTicketCommentsResult struct {
92108
// ListTicketComments gets a list of comment for a specified ticket
93109
//
94110
// ref: https://developer.zendesk.com/rest_api/docs/support/ticket_comments#list-comments
95-
func (z *Client) ListTicketComments(ctx context.Context, ticketID int64, opts *CursorPagination) (*ListTicketCommentsResult, error) {
111+
func (z *Client) ListTicketComments(
112+
ctx context.Context,
113+
ticketID int64,
114+
opts *ListTicketCommentsOptions,
115+
) (*ListTicketCommentsResult, error) {
96116
url := fmt.Sprintf("/tickets/%d/comments.json", ticketID)
97117

98118
var err error

0 commit comments

Comments
 (0)