zendesk

package
v0.0.0-...-2c8fcdc Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2024 License: MIT Imports: 17 Imported by: 1

Documentation

Overview

Example
package main

import (
	"log"

	"github.com/MEDIGO/go-zendesk/zendesk"
)

func main() {
	client, err := zendesk.NewClient("domain", "username", "password")
	if err != nil {
		log.Fatal(err)
	}
	ticket, err := client.ShowTicket(1)
	if err != nil {
		log.Fatal(err)
	}
	log.Printf("Requester ID is: %d", *ticket.RequesterID)
}
Output:

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bool

func Bool(b bool) *bool

Bool is a helper function that returns a pointer to the bool value b.

func Int

func Int(i int64) *int64

Int is a helper function that returns a pointer to the int value i.

func String

func String(s string) *string

String is a helper function that returns a pointer to the string value s.

Types

type APIError

type APIError struct {
	Response *http.Response

	Type        *string                       `json:"error,omitmepty"`
	Description *string                       `json:"description,omitempty"`
	Details     *map[string][]*APIErrorDetail `json:"details,omitempty"`
}

APIError represents an error response returnted by the API.

func (*APIError) Error

func (e *APIError) Error() string

type APIErrorDetail

type APIErrorDetail struct {
	Type        *string `json:"error,omitempty"`
	Description *string `json:"description,omitempty"`
}

APIErrorDetail represents a detail about an APIError.

func (*APIErrorDetail) Error

func (e *APIErrorDetail) Error() string

type APIPayload

type APIPayload struct {
	Attachment                 *Attachment                `json:"attachment"`
	Attachments                []Attachment               `json:"attachments"`
	Audits                     []TicketAudit              `json:"audits,omitempty"`
	Comment                    *TicketComment             `json:"comment,omitempty"`
	Comments                   []TicketComment            `json:"comments,omitempty"`
	ComplianceDeletionStatuses []ComplianceDeletionStatus `json:"compliance_deletion_statuses,omitempty"`
	Identity                   *UserIdentity              `json:"identity,omitempty"`
	Identities                 []UserIdentity             `json:"identities,omitempty"`
	JobStatus                  *JobStatus                 `json:"job_status,omitempty"`
	Locale                     *Locale                    `json:"locale,omitempty"`
	Locales                    []Locale                   `json:"locales,omitempty"`
	Organization               *Organization              `json:"organization,omitempty"`
	OrganizationMembership     *OrganizationMembership    `json:"organization_membership,omitempty"`
	OrganizationMemberships    []OrganizationMembership   `json:"organization_memberships,omitempty"`
	Organizations              []Organization             `json:"organizations,omitempty"`
	Tags                       []string                   `json:"tags,omitempty"`
	Ticket                     *Ticket                    `json:"ticket,omitempty"`
	TicketField                *TicketField               `json:"ticket_field,omitempty"`
	TicketFields               []TicketField              `json:"ticket_fields,omitempty"`
	Tickets                    []Ticket                   `json:"tickets,omitempty"`
	Upload                     *Upload                    `json:"upload,omitempty"`
	User                       *User                      `json:"user,omitempty"`
	Users                      []User                     `json:"users,omitempty"`
	Group                      *Group                     `json:"group,omitempty"`
	Groups                     []Group                    `json:"groups,omitempty"`
	NextPage                   *string                    `json:"next_page,omitempty"`
	PreviousPage               *string                    `json:"previous_page,omitempty"`
	Count                      *int64                     `json:"count,omitempty"`
}

APIPayload represents the payload of an API call.

type Attachment

type Attachment struct {
	ID          *int64  `json:"id,omitempty"`
	FileName    *string `json:"file_name,omitempty"`
	ContentURL  *string `json:"content_url,omitempty"`
	ContentType *string `json:"content_type,omitempty"`
	Size        *int64  `json:"size,omitempty"`
	Inline      *bool   `json:"inline,omitempty"`
}

Attachment represents a Zendesk attachment for tickets and forum posts.

Zendesk Core API docs: https://developer.zendesk.com/rest_api/docs/core/attachments

type Client

type Client interface {
	WithHeader(name, value string) Client

	AddUserTags(int64, []string) ([]string, error)
	AutocompleteOrganizations(string) ([]Organization, error)
	BatchUpdateManyTickets([]Ticket) error
	BulkUpdateManyTickets([]int64, *Ticket) error
	CreateIdentity(int64, *UserIdentity) (*UserIdentity, error)
	CreateOrganization(*Organization) (*Organization, error)
	CreateOrganizationMembership(*OrganizationMembership) (*OrganizationMembership, error)
	CreateOrUpdateOrganization(*Organization) (*Organization, error)
	CreateOrUpdateUser(*User) (*User, error)
	CreateTicket(*Ticket) (*Ticket, error)
	CreateUser(*User) (*User, error)
	CreateGroup(*Group) (*Group, error)
	DeleteIdentity(int64, int64) error
	DeleteOrganization(int64) error
	DeleteTicket(int64) error
	DeleteUser(int64) (*User, error)
	DeleteOrganizationMembershipByID(int64) error
	DeleteGroup(int64) error
	ListIdentities(int64) ([]UserIdentity, error)
	ListLocales() ([]Locale, error)
	ListOrganizationMembershipsByUserID(id int64) ([]OrganizationMembership, error)
	ListOrganizations(*ListOptions) ([]Organization, error)
	ListOrganizationUsers(int64, *ListUsersOptions) ([]User, error)
	ListOrganizationTickets(int64, *ListOptions, ...SideLoad) (*ListResponse, error)
	ListExternalIDTickets(string, *ListOptions, ...SideLoad) (*ListResponse, error)
	ListRequestedTickets(int64) ([]Ticket, error)
	ListTickets(*ListOptions, ...SideLoad) (*ListResponse, error)
	ListTicketAudits(int64, *ListOptions) (*ListResponse, error)
	ListTicketComments(int64) ([]TicketComment, error)
	ListTicketCommentsFull(int64, *ListOptions, ...SideLoad) (*ListResponse, error)
	ListTicketCollaborators(int64) ([]User, error)
	ListTicketFollowers(int64) ([]User, error)
	ListTicketEmailCCs(int64) ([]User, error)
	ListTicketFields() ([]TicketField, error)
	ListTicketIncidents(int64) ([]Ticket, error)
	ListUsers(*ListUsersOptions) ([]User, error)
	ListGroups() ([]Group, error)
	MakeIdentityPrimary(int64, int64) ([]UserIdentity, error)
	PermanentlyDeleteTicket(int64) (*JobStatus, error)
	PermanentlyDeleteUser(int64) (*User, error)
	RedactCommentString(int64, int64, string) (*TicketComment, error)
	SearchOrganizationsByExternalID(string) ([]Organization, error)
	SearchTickets(string, *ListOptions, ...Filters) (*TicketSearchResults, error)
	SearchUsers(string) ([]User, error)
	SearchUsersEx(string, *ListOptions, ...Filters) (*UserSearchResults, error)
	SearchUserByExternalID(string) (*User, error)
	ShowComplianceDeletionStatuses(int64) ([]ComplianceDeletionStatus, error)
	ShowIdentity(int64, int64) (*UserIdentity, error)
	ShowJobStatus(string) (*JobStatus, error)
	ShowLocale(int64) (*Locale, error)
	ShowLocaleByCode(string) (*Locale, error)
	ShowManyOrganizations([]int64) ([]Organization, error)
	ShowManyUsers([]int64) ([]User, error)
	ShowManyUsersByExternalIDs([]string) ([]User, error)
	ShowOrganization(int64) (*Organization, error)
	ShowTicket(int64) (*Ticket, error)
	ShowUser(int64) (*User, error)
	ShowGroup(int64) (*Group, error)
	UpdateIdentity(int64, int64, *UserIdentity) (*UserIdentity, error)
	UpdateOrganization(int64, *Organization) (*Organization, error)
	UpdateTicket(int64, *Ticket) (*Ticket, error)
	UpdateUser(int64, *User) (*User, error)
	UploadFile(string, *string, io.Reader) (*Upload, error)
	UpdateGroup(int64, *Group) (*Group, error)
}

Client describes a client for the Zendesk Core API.

func NewClient

func NewClient(domain, username, password string, opts ...ClientOption) (Client, error)

NewClient creates a new Client.

You can use either a user email/password combination or an API token. For the latter, append /token to the email and use the API token as a password

func NewEnvClient

func NewEnvClient(opts ...ClientOption) (Client, error)

NewEnvClient creates a new Client configured via environment variables.

Three environment variables are required: ZENDESK_DOMAIN, ZENDESK_USERNAME and ZENDESK_PASSWORD they will provide parameters to the NewClient function

func NewURLClient

func NewURLClient(endpoint, username, password string, opts ...ClientOption) (Client, error)

NewURLClient is like NewClient but accepts an explicit end point instead of a Zendesk domain.

type ClientOption

type ClientOption func(*client)

func WithHTTPClient

func WithHTTPClient(httpClient *http.Client) ClientOption

type Collaborator

type Collaborator struct {
	Name  *string `json:"name,omitempty"`
	Email *string `json:"email,omitempty"`
}

type ComplianceDeletionStatus

type ComplianceDeletionStatus struct {
	AccountID        *int64     `json:"account_id,omitempty"`
	Action           *string    `json:"action,omitempty"`
	Application      *string    `json:"application,omitempty"`
	AccountSubdomain *string    `json:"account_subdomian,omitempty"`
	ExecuterID       *int64     `json:"executer_id,omitempty"`
	CreatedAt        *time.Time `json:"created_at,omitempty"`
	UserID           *int64     `json:"user_id,omitempty"`
}

ComplianceDeletionStatus represents a GDPR status

Zendesk Core API docs: https://developer.zendesk.com/rest_api/docs/core/users#show-compliance-deletion-statuses

type CustomField

type CustomField struct {
	ID    *int64      `json:"id"`
	Value interface{} `json:"value"`
}

type Filters

type Filters func(*QueryOptions)

SearchString to pass to zendesk

func GroupNameFilter

func GroupNameFilter(name string) Filters

GroupNameFilter filters results by their group name

func OrganizationFilter

func OrganizationFilter(organizationID int) Filters

OrganizationFilter filters tickets for the matching organization

func StatusFilter

func StatusFilter(s Status, o SearchOperator) Filters

StatusFilter filters tickets by their status

type Group

type Group struct {
	ID        *int64     `json:"id,omitempty"`
	URL       *string    `json:"url,omitempty"`
	Name      *string    `json:"name,omitempty"`
	Deleted   *bool      `json:"deleted,omitempty"`
	CreatedAt *time.Time `json:"created_at,omitempty"`
	UpdatedAt *time.Time `json:"updated_at,omitempty"`
}

Group represents a Zendesk group.

Zendesk Core API docs: https://developer.zendesk.com/rest_api/docs/core/groups

type JobStatus

type JobStatus struct {
	ID       *string `json:"id,omitempty"`
	Message  *string `json:"message,omitempty"`
	Progress *int64  `json:"progress,omitempty"`
	// TODO: Raise this issue with ZenDesk support
	// API docs are inconsistent with actual behaviour
	Results *Result `json:"results,omitempty"`
	Status  *string `json:"status,omitempty"`
	Total   *int64  `json:"total,omitempty"`
	URL     *string `json:"url,omitempty"`
}

JobStatus represents a Zendesk JobStatus.

Zendesk Core API docs: https://developer.zendesk.com/rest_api/docs/core/job_statuses#json-format

type ListOptions

type ListOptions struct {
	// Sets the page of results to retrieve.
	Page int `url:"page,omitempty"`
	// Sets the number of results to include per page.
	PerPage int `url:"per_page,omitempty"`
	// Sets the field to sort the retrieved results by.
	SortBy string `url:"sort_by,omitempty"`
	// Sets the sort order of the results. One of asc or desc.
	SortOrder string `url:"sort_order,omitempty"`
}

ListOptions specifies the optional parameters for the list methods that support pagination.

Zendesk Core API doscs: https://developer.zendesk.com/rest_api/docs/core/introduction#pagination

type ListResponse

type ListResponse struct {
	Comments     []TicketComment
	Tickets      []Ticket
	Users        []User
	Groups       []Group
	Audits       []TicketAudit
	NextPage     *string
	PreviousPage *string
	Count        *int64
}

ListResponse is a holder for the various returns from the list apis

type ListUsersOptions

type ListUsersOptions struct {
	ListOptions

	Role          []string `url:"role"`
	PermissionSet int64    `url:"permision_set"`
}

ListUsersOptions specifies the optional parameters for the list users methods.

type Locale

type Locale struct {
	ID        *int64     `json:"id,omitempty"`
	URL       *string    `json:"url,omitempty"`
	Locale    *string    `json:"locale,omitempty"`
	Name      *string    `json:"name,omitempty"`
	CreatedAt *time.Time `json:"created_at,omitempty"`
	UpdatedAt *time.Time `json:"updated_at,omitempty"`
}

Locale represents an Zendesk translation locale.

Zendesk Core API docs: https://developer.zendesk.com/rest_api/docs/core/locales

type MockClient

type MockClient struct {
	mock.Mock
}

MockClient is an autogenerated mock type for the Client type

func (*MockClient) AddUserTags

func (_m *MockClient) AddUserTags(_a0 int64, _a1 []string) ([]string, error)

AddUserTags provides a mock function with given fields: _a0, _a1

func (*MockClient) AutocompleteOrganizations

func (_m *MockClient) AutocompleteOrganizations(_a0 string) ([]Organization, error)

AutocompleteOrganizations provides a mock function with given fields: _a0

func (*MockClient) BatchUpdateManyTickets

func (_m *MockClient) BatchUpdateManyTickets(_a0 []Ticket) error

BatchUpdateManyTickets provides a mock function with given fields: _a0

func (*MockClient) BulkUpdateManyTickets

func (_m *MockClient) BulkUpdateManyTickets(_a0 []int64, _a1 *Ticket) error

BulkUpdateManyTickets provides a mock function with given fields: _a0, _a1

func (*MockClient) CreateIdentity

func (_m *MockClient) CreateIdentity(_a0 int64, _a1 *UserIdentity) (*UserIdentity, error)

CreateIdentity provides a mock function with given fields: _a0, _a1

func (*MockClient) CreateOrUpdateOrganization

func (_m *MockClient) CreateOrUpdateOrganization(_a0 *Organization) (*Organization, error)

CreateOrUpdateOrganization provides a mock function with given fields: _a0

func (*MockClient) CreateOrUpdateUser

func (_m *MockClient) CreateOrUpdateUser(_a0 *User) (*User, error)

CreateOrUpdateUser provides a mock function with given fields: _a0

func (*MockClient) CreateOrganization

func (_m *MockClient) CreateOrganization(_a0 *Organization) (*Organization, error)

CreateOrganization provides a mock function with given fields: _a0

func (*MockClient) CreateOrganizationMembership

func (_m *MockClient) CreateOrganizationMembership(_a0 *OrganizationMembership) (*OrganizationMembership, error)

CreateOrganizationMembership provides a mock function with given fields: _a0

func (*MockClient) CreateTicket

func (_m *MockClient) CreateTicket(_a0 *Ticket) (*Ticket, error)

CreateTicket provides a mock function with given fields: _a0

func (*MockClient) CreateUser

func (_m *MockClient) CreateUser(_a0 *User) (*User, error)

CreateUser provides a mock function with given fields: _a0

func (*MockClient) DeleteIdentity

func (_m *MockClient) DeleteIdentity(_a0 int64, _a1 int64) error

DeleteIdentity provides a mock function with given fields: _a0, _a1

func (*MockClient) DeleteOrganization

func (_m *MockClient) DeleteOrganization(_a0 int64) error

DeleteOrganization provides a mock function with given fields: _a0

func (*MockClient) DeleteOrganizationMembershipByID

func (_m *MockClient) DeleteOrganizationMembershipByID(_a0 int64) error

DeleteOrganizationMembershipByID provides a mock function with given fields: _a0

func (*MockClient) DeleteTicket

func (_m *MockClient) DeleteTicket(_a0 int64) error

DeleteTicket provides a mock function with given fields: _a0

func (*MockClient) DeleteUser

func (_m *MockClient) DeleteUser(_a0 int64) (*User, error)

DeleteUser provides a mock function with given fields: _a0

func (*MockClient) ListIdentities

func (_m *MockClient) ListIdentities(_a0 int64) ([]UserIdentity, error)

ListIdentities provides a mock function with given fields: _a0

func (*MockClient) ListLocales

func (_m *MockClient) ListLocales() ([]Locale, error)

ListLocales provides a mock function with given fields:

func (*MockClient) ListOrganizationMembershipsByUserID

func (_m *MockClient) ListOrganizationMembershipsByUserID(id int64) ([]OrganizationMembership, error)

ListOrganizationMembershipsByUserID provides a mock function with given fields: id

func (*MockClient) ListOrganizationTickets

func (_m *MockClient) ListOrganizationTickets(_a0 int64, _a1 *ListOptions, _a2 ...SideLoad) (*ListResponse, error)

ListOrganizationTickets provides a mock function with given fields: _a0, _a1, _a2

func (*MockClient) ListOrganizationUsers

func (_m *MockClient) ListOrganizationUsers(_a0 int64, _a1 *ListUsersOptions) ([]User, error)

ListOrganizationUsers provides a mock function with given fields: _a0, _a1

func (*MockClient) ListOrganizations

func (_m *MockClient) ListOrganizations(_a0 *ListOptions) ([]Organization, error)

ListOrganizations provides a mock function with given fields: _a0

func (*MockClient) ListRequestedTickets

func (_m *MockClient) ListRequestedTickets(_a0 int64) ([]Ticket, error)

ListRequestedTickets provides a mock function with given fields: _a0

func (*MockClient) ListTicketComments

func (_m *MockClient) ListTicketComments(_a0 int64) ([]TicketComment, error)

ListTicketComments provides a mock function with given fields: _a0

func (*MockClient) ListTicketFields

func (_m *MockClient) ListTicketFields() ([]TicketField, error)

ListTicketFields provides a mock function with given fields:

func (*MockClient) ListTicketIncidents

func (_m *MockClient) ListTicketIncidents(_a0 int64) ([]Ticket, error)

ListTicketIncidents provides a mock function with given fields: _a0

func (*MockClient) ListUsers

func (_m *MockClient) ListUsers(_a0 *ListUsersOptions) ([]User, error)

ListUsers provides a mock function with given fields: _a0

func (*MockClient) PermanentlyDeleteTicket

func (_m *MockClient) PermanentlyDeleteTicket(_a0 int64) (*JobStatus, error)

PermanentlyDeleteTicket provides a mock function with given fields: _a0

func (*MockClient) PermanentlyDeleteUser

func (_m *MockClient) PermanentlyDeleteUser(_a0 int64) (*User, error)

PermanentlyDeleteUser provides a mock function with given fields: _a0

func (*MockClient) RedactCommentString

func (_m *MockClient) RedactCommentString(_a0 int64, _a1 int64, _a2 string) (*TicketComment, error)

RedactCommentString provides a mock function with given fields: _a0, _a1, _a2

func (*MockClient) SearchOrganizationsByExternalID

func (_m *MockClient) SearchOrganizationsByExternalID(_a0 string) ([]Organization, error)

SearchOrganizationsByExternalID provides a mock function with given fields: _a0

func (*MockClient) SearchTickets

func (_m *MockClient) SearchTickets(_a0 string, _a1 *ListOptions, _a2 ...Filters) (*TicketSearchResults, error)

SearchTickets provides a mock function with given fields: _a0, _a1, _a2

func (*MockClient) SearchUserByExternalID

func (_m *MockClient) SearchUserByExternalID(_a0 string) (*User, error)

SearchUserByExternalID provides a mock function with given fields: _a0

func (*MockClient) SearchUsers

func (_m *MockClient) SearchUsers(_a0 string) ([]User, error)

SearchUsers provides a mock function with given fields: _a0

func (*MockClient) ShowComplianceDeletionStatuses

func (_m *MockClient) ShowComplianceDeletionStatuses(_a0 int64) ([]ComplianceDeletionStatus, error)

ShowComplianceDeletionStatuses provides a mock function with given fields: _a0

func (*MockClient) ShowIdentity

func (_m *MockClient) ShowIdentity(_a0 int64, _a1 int64) (*UserIdentity, error)

ShowIdentity provides a mock function with given fields: _a0, _a1

func (*MockClient) ShowJobStatus

func (_m *MockClient) ShowJobStatus(_a0 string) (*JobStatus, error)

ShowJobStatus provides a mock function with given fields: _a0

func (*MockClient) ShowLocale

func (_m *MockClient) ShowLocale(_a0 int64) (*Locale, error)

ShowLocale provides a mock function with given fields: _a0

func (*MockClient) ShowLocaleByCode

func (_m *MockClient) ShowLocaleByCode(_a0 string) (*Locale, error)

ShowLocaleByCode provides a mock function with given fields: _a0

func (*MockClient) ShowManyUsers

func (_m *MockClient) ShowManyUsers(_a0 []int64) ([]User, error)

ShowManyUsers provides a mock function with given fields: _a0

func (*MockClient) ShowOrganization

func (_m *MockClient) ShowOrganization(_a0 int64) (*Organization, error)

ShowOrganization provides a mock function with given fields: _a0

func (*MockClient) ShowTicket

func (_m *MockClient) ShowTicket(_a0 int64) (*Ticket, error)

ShowTicket provides a mock function with given fields: _a0

func (*MockClient) ShowUser

func (_m *MockClient) ShowUser(_a0 int64) (*User, error)

ShowUser provides a mock function with given fields: _a0

func (*MockClient) UpdateIdentity

func (_m *MockClient) UpdateIdentity(_a0 int64, _a1 int64, _a2 *UserIdentity) (*UserIdentity, error)

UpdateIdentity provides a mock function with given fields: _a0, _a1, _a2

func (*MockClient) UpdateOrganization

func (_m *MockClient) UpdateOrganization(_a0 int64, _a1 *Organization) (*Organization, error)

UpdateOrganization provides a mock function with given fields: _a0, _a1

func (*MockClient) UpdateTicket

func (_m *MockClient) UpdateTicket(_a0 int64, _a1 *Ticket) (*Ticket, error)

UpdateTicket provides a mock function with given fields: _a0, _a1

func (*MockClient) UpdateUser

func (_m *MockClient) UpdateUser(_a0 int64, _a1 *User) (*User, error)

UpdateUser provides a mock function with given fields: _a0, _a1

func (*MockClient) UploadFile

func (_m *MockClient) UploadFile(_a0 string, _a1 *string, _a2 io.Reader) (*Upload, error)

UploadFile provides a mock function with given fields: _a0, _a1, _a2

func (*MockClient) WithHeader

func (_m *MockClient) WithHeader(name string, value string) Client

WithHeader provides a mock function with given fields: name, value

type Organization

type Organization struct {
	ID                 *int64                 `json:"id,omitempty"`
	URL                *string                `json:"url,omitempty"`
	ExternalID         *string                `json:"external_id,omitempty"`
	Name               *string                `json:"name,omitempty"`
	CreatedAt          *time.Time             `json:"created_at,omitempty"`
	UpdatedAt          *time.Time             `json:"updated_at,omitempty"`
	DomainNames        *[]string              `json:"domain_names,omitempty"`
	Details            *string                `json:"details,omitempty"`
	Notes              *string                `json:"notes,omitempty"`
	GroupID            *int64                 `json:"group_id,omitempty"`
	SharedTickets      *bool                  `json:"shared_tickets,omitempty"`
	SharedComments     *bool                  `json:"shared_comments,omitempty"`
	Tags               *[]string              `json:"tags,omitempty"`
	OrganizationFields map[string]interface{} `json:"organization_fields,omitempty"`
}

Organization represents a Zendesk organization.

Zendesk Core API docs: https://developer.zendesk.com/rest_api/docs/core/organizations

type OrganizationMembership

type OrganizationMembership struct {
	ID             *int64     `json:"id,omitempty"`
	URL            *string    `json:"url,omitempty"`
	UserID         *int64     `json:"user_id,omitempty"`
	OrganizationID *int64     `json:"organization_id,omitempty"`
	Default        *bool      `json:"default,omitempty"`
	CreatedAt      *time.Time `json:"created_at,omitempty"`
	UpdatedAt      *time.Time `json:"updated_at,omitempty"`
}

OrganizationMembership represents a Zendesk association between an org and a user.

Zendesk Core API docs: https://developer.zendesk.com/rest_api/docs/core/organization_memberships

type QueryOptions

type QueryOptions struct {
	Search []string
}

QueryOptions to narrow search results

type RedactedString

type RedactedString struct {
	Text *string `json:"text"`
}

type Requester

type Requester struct {
	LocaleID *int    `json:"locale_id"`
	Name     *string `json:"name,omitempty"`
	Email    *string `json:"email,omitempty"`
}

type Result

type Result struct {
	Action  *string `json:"action,omitempty"`
	Errors  *string `json:"errors,omitempty"`
	ID      *int64  `json:"id,omitempty"`
	Status  *string `json:"status,omitempty"`
	Success *bool   `json:"success,omitempty"`
	Title   *string `json:"title,omitempty"`
}

Result represents the data from processed tasks within the Job Status

type ResultType

type ResultType string

ResultType returns records of the specified resource type Possible values include ticket, user, organization, or group

const (
	ResultTypeTicket       ResultType = "ticket"
	ResultTypeUser         ResultType = "user"
	ResultTypeOrganization ResultType = "organization"
	ResultTypeGroup        ResultType = "group"
)

type SearchOperator

type SearchOperator string

SearchOperator represents supported search operators for zendesk searches

const (
	Equality             SearchOperator = ":"
	LessThan             SearchOperator = "<"
	GreaterThan          SearchOperator = ">"
	LessThanOrEqualTo    SearchOperator = "<="
	GreaterThanOrEqualTo SearchOperator = ">="
)

type SideLoad

type SideLoad func(*SideLoadOptions)

Allows for side loads to be specified on api requests that support it

func IncludeCommentCount

func IncludeCommentCount() SideLoad

IncludeCommentCount will include a top level array of groups

func IncludeGroups

func IncludeGroups() SideLoad

IncludeGroups will include a top level array of groups

func IncludeUsers

func IncludeUsers() SideLoad

IncludeUsers will include a top level array of users

type SideLoadOptions

type SideLoadOptions struct {
	Include []string
}

Side-Loading

Zendesk Core API doscs: https://developer.zendesk.com/rest_api/docs/core/side_loading#side-loading

type Source

type Source struct {
	To   *SourceInfo `json:"to,omitempty"`
	From *SourceInfo `json:"from,omitempty"`
	Rel  *string     `json:"rel,omitempty"`
}

type SourceInfo

type SourceInfo struct {
	Address                          *string       `json:"address,omitempty"`
	Deleted                          *bool         `json:"deleted,omitempty"`
	FacebookID                       *string       `json:"facebook_id,omitempty"`
	FormattedPhone                   *string       `json:"formatted_phone,omitempty"`
	ID                               *int          `json:"id,omitempty"`
	Name                             *string       `json:"name,omitempty"`
	OriginalRecipients               []string      `json:"original_recipients,omitempty"`
	EmailCCs                         []interface{} `json:"email_ccs,omitempty"`
	Phone                            *string       `json:"phone,omitempty"`
	ProfileURL                       *string       `json:"profile_url,omitempty"`
	RegisteredIntegrationServiceName *string       `json:"registered_integration_service_name,omitempty"`
	RevisionID                       *int          `json:"revision_id,omitempty"`
	ServiceInfo                      *string       `json:"service_info,omitempty"`
	Subject                          *string       `json:"subject,omitempty"`
	SupportsChannelback              *bool         `json:"supports_channelback,omitempty"`
	SupportsClickthrough             *bool         `json:"supports_clickthrough,omitempty"`
	TicketID                         *int          `json:"ticket_id,omitempty"`
	Title                            *string       `json:"title,omitempty"`
	TopicID                          *int          `json:"topic_id,omitempty"`
	TopicName                        *string       `json:"topic_name,omitempty"`
	Username                         *string       `json:"username,omitempty"`
}

type Status

type Status string

Status returns tickets set to the specified status. Possible values include new, open, pending, hold, solved, or closed

const (
	StatusNew     Status = "new"
	StatusOpen    Status = "open"
	StatusPending Status = "pending"
	StatusHold    Status = "hold"
	StatusSolved  Status = "solved"
	StatusClosed  Status = "closed"
)

type Ticket

type Ticket struct {
	ID                      *int64         `json:"id,omitempty"`
	URL                     *string        `json:"url,omitempty"`
	ExternalID              *string        `json:"external_id,omitempty"`
	Type                    *string        `json:"type,omitempty"`
	Subject                 *string        `json:"subject,omitempty"`
	RawSubject              *string        `json:"raw_subject,omitempty"`
	Description             *string        `json:"description,omitempty"`
	Comment                 *TicketComment `json:"comment,omitempty"`
	CommentCount            *int64         `json:"comment_count,omitempty"`
	Priority                *string        `json:"priority,omitempty"`
	Status                  *string        `json:"status,omitempty"`
	Recipient               *string        `json:"recipient,omitempty"`
	RequesterID             *int64         `json:"requester_id,omitempty"`
	Requester               *Requester     `json:"requester,omitempty"`
	SubmitterID             *int64         `json:"submitter_id,omitempty"`
	AssigneeID              *int64         `json:"assignee_id,omitempty"`
	AssigneeEmail           *string        `json:"assignee_email,omitempty"`
	OrganizationID          *int64         `json:"organization_id,omitempty"`
	GroupID                 *int64         `json:"group_id,omitempty"`
	CollaboratorIDs         []int64        `json:"collaborator_ids,omitempty"`
	Collaborators           []interface{}  `json:"collaborators,omitempty"`
	AdditionalCollaborators []interface{}  `json:"additional_collaborators,omitempty"`
	ForumTopicID            *int64         `json:"forum_topic_id,omitempty"`
	ProblemID               *int64         `json:"problem_id,omitempty"`
	HasIncidents            *bool          `json:"has_incidents,omitempty"`
	DueAt                   *time.Time     `json:"due_at,omitempty"`
	Tags                    []string       `json:"tags,omitempty"`
	Via                     *Via           `json:"via,omitempty"`
	CreatedAt               *time.Time     `json:"created_at,omitempty"`
	UpdatedAt               *time.Time     `json:"updated_at,omitempty"`
	CustomFields            []CustomField  `json:"custom_fields,omitempty"`
	BrandID                 *int64         `json:"brand_id,omitempty"`
	TicketFormID            *int64         `json:"ticket_form_id,omitempty"`
	FollowupSourceID        *int64         `json:"via_followup_source_id,omitempty"`

	AdditionalTags []string `json:"additional_tags,omitempty"`
	RemoveTags     []string `json:"remove_tags,omitempty"`
}

Ticket represents a Zendesk Ticket.

Zendesk Core API docs: https://developer.zendesk.com/rest_api/docs/core/tickets

type TicketAudit

type TicketAudit struct {
	ID        *int64                 `json:"id,omitempty"`
	TicketID  *int64                 `json:"ticket_id,omitempty"`
	AuthorID  *int64                 `json:"author_id,omitempty"`
	CreatedAt *time.Time             `json:"created_at,omitempty"`
	UpdatedAt *time.Time             `json:"updated_at,omitempty"`
	Events    []interface{}          `json:"events,omitempty"`
	Via       *Via                   `json:"via,omitempty"`
	Metadata  map[string]interface{} `json:"metadata,omitempty"`
}

TicketAudit represents an audit on a Ticket.

Zendesk Core API docs: https://developer.zendesk.com/rest_api/docs/support/ticket_audits

type TicketComment

type TicketComment struct {
	ID          *int64       `json:"id,omitempty"`
	Type        *string      `json:"type,omitempty"`
	Body        *string      `json:"body,omitempty"`
	HTMLBody    *string      `json:"html_body,omitempty"`
	Public      *bool        `json:"public,omitempty"`
	AuthorID    *int64       `json:"author_id,omitempty"`
	Attachments []Attachment `json:"attachments,omitempty"`
	CreatedAt   *time.Time   `json:"created_at,omitempty"`
	Uploads     []string     `json:"uploads,omitempty"`
	Via         *Via         `json:"via,omitempty"`
}

TicketComment represents a comment on a Ticket.

Zendesk Core API docs: https://developer.zendesk.com/rest_api/docs/core/ticket_comments

type TicketField

type TicketField struct {
	ID              *int64     `json:"id,omitempty"`
	Type            *string    `json:"string,omitempty"`
	Title           *string    `json:"title,omitempty"`
	Description     *string    `json:"description,omitempty"`
	Position        *int64     `json:"position,omitempty"`
	Active          *bool      `json:"active,omitempty"`
	VisibleInPortal *bool      `json:"visible_in_portal,omitempty"`
	CreatedAt       *time.Time `json:"created_at,omitempty"`
	UpdatedAt       *time.Time `json:"updated_at,omitempty"`
}

type TicketSearchResults

type TicketSearchResults struct {
	Results      []Ticket `json:"results"`
	NextPage     *string  `json:"next_page"`
	PreviousPage *string  `json:"previous_page"`
	Count        *int64   `json:"count"`
}

TicketSearchResults represents returned results from the unified search api for type:ticket

type Upload

type Upload struct {
	Token       *string      `json:"token"`
	Attachment  *Attachment  `json:"attachment"`
	Attachments []Attachment `json:"attachments"`
}

Upload represents a Zendesk file upload.

type User

type User struct {
	ID                  *int64                 `json:"id,omitempty"`
	URL                 *string                `json:"url,omitempty"`
	Name                *string                `json:"name,omitempty"`
	ExternalID          *string                `json:"external_id,omitempty"`
	Alias               *string                `json:"alias,omitempty"`
	CreatedAt           *time.Time             `json:"created_at,omitempty"`
	UpdatedAt           *time.Time             `json:"updated_at,omitempty"`
	Active              *bool                  `json:"active,omitempty"`
	Verified            *bool                  `json:"verified,omitempty"`
	Shared              *bool                  `json:"shared,omitempty"`
	SharedAgent         *bool                  `json:"shared_agent,omitempty"`
	Locale              *string                `json:"locale,omitempty"`
	LocaleID            *int64                 `json:"locale_id,omitempty"`
	TimeZone            *string                `json:"time_zone,omitempty"`
	LastLoginAt         *time.Time             `json:"last_login_at,omitempty"`
	Email               *string                `json:"email,omitempty"`
	Phone               *string                `json:"phone,omitempty"`
	Signature           *string                `json:"signature,omitempty"`
	Details             *string                `json:"details,omitempty"`
	Notes               *string                `json:"notes,omitempty"`
	OrganizationID      *int64                 `json:"organization_id,omitempty"`
	Role                *string                `json:"role,omitempty"`
	CustomerRoleID      *int64                 `json:"custom_role_id,omitempty"`
	Moderator           *bool                  `json:"moderator,omitempty"`
	TicketRestriction   *string                `json:"ticket_restriction,omitempty"`
	OnlyPrivateComments *bool                  `json:"only_private_comments,omitempty"`
	Tags                []string               `json:"tags,omitempty"`
	RestrictedAgent     *bool                  `json:"restricted_agent,omitempty"`
	Suspended           *bool                  `json:"suspended,omitempty"`
	UserFields          map[string]interface{} `json:"user_fields,omitempty"`
}

User represents a Zendesk user.

Zendesk Core API docs: https://developer.zendesk.com/rest_api/docs/core/users#content

type UserIdentity

type UserIdentity struct {
	ID                 *int64     `json:"id,omitempty"`
	URL                *string    `json:"url,omitempty"`
	UserID             *int64     `json:"user_id,omitempty"`
	Type               *string    `json:"type,omitempty"`
	Value              *string    `json:"value,omitempty"`
	Verified           *bool      `json:"verified,omitempty"`
	Primary            *bool      `json:"primary,omitempty"`
	CreatedAt          *time.Time `json:"created_at,omitempty"`
	UpdatedAt          *time.Time `json:"updated_at,omitempty"`
	UndeliverableCount *int64     `json:"undeliverable_count,omitempty"`
	DeliverableState   *string    `json:"deliverable_state,omitempty"`
}

UserIdentity represents a Zendesk user identity.

Zendesk Core API docs: https://developer.zendesk.com/rest_api/docs/core/user_identities

type UserSearchResults

type UserSearchResults struct {
	Results      []User  `json:"results"`
	NextPage     *string `json:"next_page"`
	PreviousPage *string `json:"previous_page"`
	Count        *int64  `json:"count"`
}

UserSearchResults represents returned results from the unified search api for type:user

type Via

type Via struct {
	Channel *string `json:"channel,omitempty"`
	Source  *Source `json:"source,omitempty"`
}

The via object of a ticket audit or audit event tells you how or why the audit or event was created

Zendesk Via API docs: https://developer.zendesk.com/rest_api/docs/support/ticket_audits#the-via-object

Jump to

Keyboard shortcuts

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