zendesk

package
v0.0.11 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Zendesk API client library for Go (golang).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithLogger

func WithLogger(logger *log.Logger) configOption

func WithRequestPreProcessor

func WithRequestPreProcessor(requestPreProcessor RequestPreProcessor) configOption

func WithRoundTripper

func WithRoundTripper(roundTripper http.RoundTripper) configOption

Types

type AgentEvent added in v0.0.4

type AgentEvent struct {
	StartTime     time.Time       `json:"timestamp"`
	AccountID     uint64          `json:"account_id"`
	AgentID       UserID          `json:"agent_id"`
	FieldName     string          `json:"field_name"`
	ID            string          `json:"id"`
	PreviousValue AgentEventValue `json:"previous_value"`
	Value         AgentEventValue `json:"value"`
}

type AgentEventExportResponse added in v0.0.4

type AgentEventExportResponse struct {
	AgentEvents []AgentEvent `json:"agent_events"`
	EndTimeUnix float64      `json:"end_time"`
	NextPage    string       `json:"next_page"`
	Count       int64        `json:"count"`
}

func (AgentEventExportResponse) EndTime added in v0.0.4

func (response AgentEventExportResponse) EndTime() time.Time

type AgentEventService added in v0.0.4

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

https://developer.zendesk.com/api-reference/live-chat/chat-api/incremental_agent_events_api/

func (*AgentEventService) GetAgentStates added in v0.0.4

func (s *AgentEventService) GetAgentStates(
	ctx context.Context,
) AgentStates

func (*AgentEventService) UpdateAgentStates added in v0.0.4

func (s *AgentEventService) UpdateAgentStates(
	ctx context.Context,
	defaultStateTime time.Time,
) error

type AgentEventValue added in v0.0.4

type AgentEventValue string

func (*AgentEventValue) UnmarshalJSON added in v0.0.4

func (a *AgentEventValue) UnmarshalJSON(data []byte) (err error)

type AgentState added in v0.0.4

type AgentState struct {
	AgentID         UserID
	EngagementCount uint64
	Status          string
	Timestamp       time.Time
}

type AgentStates added in v0.0.4

type AgentStates map[UserID]AgentState

type Article

type Article struct {
	AuthorID          UserID    `json:"author_id"`
	Body              string    `json:"body"`
	CommentsDisabled  bool      `json:"comments_disabled"`
	ContentTagIds     []any     `json:"content_tag_ids"`
	CreatedAt         time.Time `json:"created_at"`
	Draft             bool      `json:"draft"`
	EditedAt          time.Time `json:"edited_at"`
	HTML_URL          string    `json:"html_url"`
	ID                ArticleID `json:"id"`
	LabelNames        []any     `json:"label_names"`
	Locale            string    `json:"locale"`
	Name              string    `json:"name"`
	Outdated          bool      `json:"outdated"`
	PermissionGroupID uint64    `json:"permission_group_id"`
	Position          int64     `json:"position"`
	Promoted          bool      `json:"promoted"`
	SectionID         uint64    `json:"section_id"`
	SourceLocale      string    `json:"source_locale"`
	Title             string    `json:"title"`
	UpdatedAt         time.Time `json:"updated_at"`
	URL               string    `json:"url"`
	UserSegmentID     uint64    `json:"user_segment_id"`
	VoteCount         uint64    `json:"vote_count"`
	VoteSum           uint64    `json:"vote_sum"`
}

type ArticleID

type ArticleID uint64

type ArticleResponse

type ArticleResponse struct {
	Article Article `json:"article"`
}

type ArticlesResponse

type ArticlesResponse struct {
	Articles []Article `json:"articles"`
	CursorPaginationResponse
}

type AuthenticationPassword

type AuthenticationPassword struct {
	Email    string
	Password string
}

func (AuthenticationPassword) AddZendeskAuthentication

func (auth AuthenticationPassword) AddZendeskAuthentication(r *http.Request)

type AuthenticationToken

type AuthenticationToken struct {
	Email string
	Token string
}

func (AuthenticationToken) AddZendeskAuthentication

func (auth AuthenticationToken) AddZendeskAuthentication(r *http.Request)

type CategoriesResponse

type CategoriesResponse struct {
	Categories []Category `json:"categories"`
	CursorPaginationResponse
}

type CategoriesService

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

https://developer.zendesk.com/api-reference/help_center/help-center-api/categories/

type Category

type Category struct {
	CreatedAt    time.Time  `json:"created_at"`
	Description  string     `json:"description"`
	HTML_URL     string     `json:"html_url"`
	ID           CategoryID `json:"id"`
	Locale       string     `json:"locale"`
	Name         string     `json:"name"`
	Outdated     bool       `json:"outdated"`
	Position     int64      `json:"position"`
	SourceLocale string     `json:"source_locale"`
	UpdatedAt    time.Time  `json:"updated_at"`
	URL          string     `json:"url"`
}

type CategoryID

type CategoryID uint64

type CategoryResponse

type CategoryResponse struct {
	Category Category `json:"category"`
}

type Chat

type Chat struct {
	ID              ChatID           `json:"id"`
	Visitor         ChatVisitor      `json:"visitor"`
	StartedBy       string           `json:"started_by"`
	Session         ChatSession      `json:"session"`
	WebPath         []ChatWebPath    `json:"webpath"`
	Timestamp       time.Time        `json:"timestamp"`
	Count           ChatCount        `json:"count"`
	Duration        uint64           `json:"duration"`
	ResponseTime    ChatResponseTime `json:"response_time"`
	AgentIds        []UserID         `json:"agent_ids"`
	Triggered       bool             `json:"triggered"`
	Unread          bool             `json:"unread"`
	Missed          bool             `json:"missed"`
	Tags            []string         `json:"tags"`
	Type            string           `json:"type"`
	History         []ChatHistory    `json:"history"`
	DepartmentID    *GroupID         `json:"department_id"`
	EndTimestamp    time.Time        `json:"end_timestamp"`
	ZendeskTicketID TicketID         `json:"zendesk_ticket_id"`
}

type ChatCount

type ChatCount struct {
	Visitor uint64 `json:"visitor"`
	Agent   uint64 `json:"agent"`
	Total   uint64 `json:"total"`
}

type ChatCredentials

type ChatCredentials struct {
	ClientID     string
	ClientSecret string
}

type ChatEngagement added in v0.0.2

type ChatEngagement struct {
	ID           ChatEngagementID `json:"id"`
	AgentID      UserID           `json:"agent_id"`
	DepartmentID *GroupID         `json:"department_id"`
	Assigned     bool             `json:"assigned"`
	Accepted     bool             `json:"accepted"`
	StartedBy    string           `json:"started_by"`
	Timestamp    time.Time        `json:"timestamp"`
	Duration     float64          `json:"duration"`
	Count        ChatCount        `json:"count"`
	ResponseTime ChatResponseTime `json:"response_time"`
}

type ChatEngagementID added in v0.0.2

type ChatEngagementID string

type ChatHistory

type ChatHistory struct {
	DepartmentID   GroupID   `json:"department_id"`
	DepartmentName string    `json:"department_name"`
	Name           string    `json:"name"`
	Channel        string    `json:"channel"`
	Index          int       `json:"index"`
	Timestamp      time.Time `json:"timestamp"`
	Type           string    `json:"type"`
	Msg            string    `json:"msg"`
	Options        string    `json:"options"`
	MsgID          string    `json:"msg_id"`
	SenderType     string    `json:"sender_type"`
	Source         string    `json:"source"`
	AgentID        UserID    `json:"agent_id,string"`
	Reason         string    `json:"reason"`
}

type ChatID

type ChatID string

type ChatResponseTime

type ChatResponseTime struct {
	First uint64  `json:"first"`
	Avg   float64 `json:"avg"`
	Max   uint64  `json:"max"`
}

type ChatSearchResult added in v0.0.3

type ChatSearchResult struct {
	ID        ChatID    `json:"id"`
	Timestamp time.Time `json:"timestamp"`
	Preview   string    `json:"preview"`
	Type      string    `json:"type"`
}

type ChatSession

type ChatSession struct {
	EndDate     time.Time `json:"end_date"`
	CountryCode string    `json:"country_code"`
	City        string    `json:"city"`
	Browser     string    `json:"browser"`
	IP          string    `json:"ip"`
	CountryName string    `json:"country_name"`
	ID          string    `json:"id"`
	Region      string    `json:"region"`
	Platform    string    `json:"platform"`
	UserAgent   string    `json:"user_agent"`
	StartDate   time.Time `json:"start_date"`
}

type ChatVisitor

type ChatVisitor struct {
	Name  string `json:"name"`
	Notes string `json:"notes"`
	ID    string `json:"id"`
	Phone string `json:"phone"`
	Email string `json:"email"`
}

type ChatWebPath

type ChatWebPath struct {
	Timestamp time.Time `json:"timestamp"`
	To        string    `json:"to"`
	From      string    `json:"from"`
	Title     string    `json:"title"`
}

type ChatsIncrementalExportResponse

type ChatsIncrementalExportResponse struct {
	Chats       []IncrementalExportChat `json:"chats"`
	Count       uint64                  `json:"count"`
	EndID       ChatID                  `json:"end_id"`
	EndTimeUnix int64                   `json:"end_time"`
	NextPage    string                  `json:"next_page"`
}

func (ChatsIncrementalExportResponse) EndTime

func (response ChatsIncrementalExportResponse) EndTime() time.Time

type ChatsResponse

type ChatsResponse struct {
	Chats   []Chat  `json:"chats"`
	NextURL *string `json:"next_url"`
}

type ChatsSearchResponse added in v0.0.3

type ChatsSearchResponse struct {
	Results []ChatSearchResult `json:"results"`
	NextURL *string            `json:"next_url"`
}
type CursorPaginationLinks struct {
	First string `json:"first"`
	Last  string `json:"last"`
	Next  string `json:"next"`
}

type CursorPaginationMeta

type CursorPaginationMeta struct {
	HasMore      bool   `json:"has_more"`
	AfterCursor  string `json:"after_cursor"`
	BeforeCursor string `json:"before_cursor"`
}

type CursorPaginationResponse

type CursorPaginationResponse struct {
	Meta  CursorPaginationMeta  `json:"meta"`
	Links CursorPaginationLinks `json:"links"`
}

type Error

type Error struct {
	StatusCode  int
	Body        []byte
	Message     string
	Description string
}

func (*Error) Error

func (err *Error) Error() string

func (*Error) UnmarshalJSON

func (err *Error) UnmarshalJSON(b []byte) error

type GroupID

type GroupID uint64

type IncrementalExportChat added in v0.0.2

type IncrementalExportChat struct {
	Chat
	ChatEngagements []ChatEngagement `json:"engagements"`
}

type IncrementalExportResponse

type IncrementalExportResponse struct {
	EndTimeUnix int64 `json:"end_time"`
	EndOfStream bool  `json:"end_of_stream"`
}

func (IncrementalExportResponse) EndTime

func (response IncrementalExportResponse) EndTime() time.Time

type Organization

type Organization struct {
	ID OrganizationID `json:"id"`
}

type OrganizationCustomField

type OrganizationCustomField struct {
	ID    int `json:"id"`
	Value any `json:"value"`
}

type OrganizationID

type OrganizationID uint64

type OrganizationResponse

type OrganizationResponse struct {
	Organization Organization `json:"organization"`
}

type OrganizationSatisfactionRating

type OrganizationSatisfactionRating struct {
	Score string `json:"score"`
}

type OrganizationVia

type OrganizationVia struct {
	Channel string `json:"channel"`
}

type OrganizationsIncrementalExportResponse

type OrganizationsIncrementalExportResponse struct {
	OrganizationsResponse
	IncrementalExportResponse
}

type OrganizationsResponse

type OrganizationsResponse struct {
	Organizations []Organization `json:"organizations"`
}

type RequestPreProcessor

type RequestPreProcessor interface {
	ProcessRequest(*http.Request) error
}

type RequestPreProcessorFunc

type RequestPreProcessorFunc func(*http.Request) error

func (RequestPreProcessorFunc) ProcessRequest

func (p RequestPreProcessorFunc) ProcessRequest(r *http.Request) error

type Section

type Section struct {
	CategoryID      CategoryID `json:"category_id"`
	CreatedAt       time.Time  `json:"created_at"`
	Description     string     `json:"description"`
	HTML_URL        string     `json:"html_url"`
	ID              SectionID  `json:"id"`
	Locale          string     `json:"locale"`
	Name            string     `json:"name"`
	Outdated        bool       `json:"outdated"`
	ParentSectionID any        `json:"parent_section_id"`
	Position        uint       `json:"position"`
	Sorting         string     `json:"sorting"`
	SourceLocale    string     `json:"source_locale"`
	ThemeTemplate   string     `json:"theme_template"`
	UpdatedAt       time.Time  `json:"updated_at"`
	URL             string     `json:"url"`
}

type SectionID

type SectionID uint64

type SectionsResponse

type SectionsResponse struct {
	Sections     []Section `json:"sections"`
	Page         int       `json:"page"`
	PreviousPage any       `json:"previous_page"`
	NextPage     string    `json:"next_page"`
	PerPage      int       `json:"per_page"`
	PageCount    int       `json:"page_count"`
	Count        int       `json:"count"`
	SortBy       string    `json:"sort_by"`
	SortOrder    string    `json:"sort_order"`
}

type SectionsService

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

https://developer.zendesk.com/api-reference/help_center/help-center-api/sections/

type Service

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

func NewService

func NewService(
	subDomain string,
	zendeskAuth authentication,
	chatCredentials ChatCredentials,
	opts ...configOption,
) *Service

type Tags

type Tags []string

type TagsPayload

type TagsPayload struct {
	Tags Tags `json:"tags"`
}

type Ticket

type Ticket struct {
	AssigneeID         *UserID                  `json:"assignee_id"`
	CreatedAt          time.Time                `json:"created_at"`
	CustomFields       []TicketCustomField      `json:"custom_fields"`
	Description        string                   `json:"description"`
	DueAt              *time.Time               `json:"due_at"`
	ExternalID         *string                  `json:"external_id"`
	GroupID            *GroupID                 `json:"group_id"`
	HasIncidents       bool                     `json:"has_incidents"`
	ID                 TicketID                 `json:"id"`
	IsPublic           bool                     `json:"is_public"`
	OrganizationID     *OrganizationID          `json:"organization_id"`
	Priority           string                   `json:"priority"`
	ProblemID          *TicketID                `json:"problem_id"`
	RequesterID        UserID                   `json:"requester_id"`
	SatisfactionRating TicketSatisfactionRating `json:"satisfaction_rating"`
	Status             string                   `json:"status"`
	Subject            string                   `json:"subject"`
	SubmitterID        UserID                   `json:"submitter_id"`
	Tags               Tags                     `json:"tags"`
	TicketFormID       TicketFormID             `json:"ticket_form_id"`
	Type               *string                  `json:"type"`
	UpdatedAt          time.Time                `json:"updated_at"`
	URL                string                   `json:"url"`
	Via                TicketVia                `json:"via"`
}

type TicketCustomField

type TicketCustomField struct {
	ID    int `json:"id"`
	Value any `json:"value"`
}

type TicketFormID

type TicketFormID uint64

type TicketID

type TicketID uint64

type TicketResponse

type TicketResponse struct {
	Ticket Ticket `json:"ticket"`
}

type TicketSatisfactionRating

type TicketSatisfactionRating struct {
	Score string `json:"score"`
}

type TicketVia

type TicketVia struct {
	Channel string `json:"channel"`
}

type TicketsIncrementalExportResponse

type TicketsIncrementalExportResponse struct {
	TicketsResponse
	IncrementalExportResponse
}

type TicketsResponse

type TicketsResponse struct {
	Tickets []Ticket `json:"tickets"`
}

type User

type User struct {
	ID UserID `json:"id"`
}

type UserID

type UserID uint64

func (*UserID) UnmarshalJSON

func (userID *UserID) UnmarshalJSON(b []byte) error

type UserResponse

type UserResponse struct {
	User User `json:"user"`
}

type UsersIncrementalExportResponse

type UsersIncrementalExportResponse struct {
	UsersResponse
	IncrementalExportResponse
}

type UsersResponse

type UsersResponse struct {
	Users []User `json:"users"`
}

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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