Help us shape the future of Go! Take the 2026 Go Developer Survey

zed

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2019 License: Apache-2.0 Imports: 9 Imported by: 0

README

wercker status
Build Status

zed

Go client for the Zendesk API

It does everything we need which is very little at the moment, but you're welcome to submit a PR.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckResponse

func CheckResponse(r *http.Response) error

CheckResponse checks if a response is valid

Types

type ActivityResponse

type ActivityResponse struct {
	Activities []AgentsActivity `json:"users,omitempty"`
	Next       *string          `json:"next_page,omitempty"`
	Previous   *string          `json:"previous_page,omitempty"`
	Count      *int             `json:"count,omitempty"`
}

type ActivityService

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

func (*ActivityService) List

func (s *ActivityService) List() ([]AgentsActivity, error)

type AgentsActivity

type AgentsActivity struct {
	AgentID         *float64 `json:"agent_id,omitempty"`
	Status          *string  `json:"status,omitempty"`
	AvailableTime   *int     `json:"available_time,omitempty"`
	CallsAccepted   *int     `json:"calls_accepted,omitempty"`
	CallsDenied     *int     `json:"calls_denied,omitempty"`
	CallsMissed     *int     `json:"calls_missed,omitempty"`
	AverageTalkTime *int     `json:"average_talk_time,omitempty"`
}

type Article

type Article struct {
	ID               *float64 `json:"id,omitempty"`
	URL              *string  `json:"url,omitempty"`
	HtmlURL          *string  `json:"html_url,omitempty"`
	Title            *string  `json:"title,omitempty"`
	Name             *string  `json:"name,omitempty"`
	Body             *string  `json:"body,omitempty"`
	Locale           *string  `json:"locale,omitempty"`
	SourceLocale     *string  `json:"source_locale,omitempty"`
	AuthorID         *float64 `json:"author_id,omitempty"`
	CommentsDisabled *bool    `json:"comments_disabled,omitempty"`
	Outdated         *bool    `json:"outdated,omitempty"`
	Labels           []string `json:"label_names,omitempty"`
	Draft            *bool    `json:"draft,omitempty"`
	Promoted         *bool    `json:"promoted,omitempty"`
	Position         *int64   `json:"position,omitempty"`
	VoteSum          *int64   `json:"vote_sum,omitempty"`
	VoteCount        *int64   `json:"vote_count,omitempty"`
	SectionID        *float64 `json:"section_id,omitempty"`
	TranslationIds   []int64  `json:"translation_ids,omitempty"`
	CreatedAt        *string  `json:"created_at,omitempty"`
	UpdatedAt        *string  `json:"updated_at,omitempty"`
}

Article struct

type ArticleCollectionResponse

type ArticleCollectionResponse struct {
	Results   []Article `json:"articles,omitempty"`
	Count     *int64    `json:"count,omitempty"`
	Next      *string   `json:"next_page,omitempty"`
	Page      *int64    `json:"page,omitempty"`
	PageCount *int64    `json:"page_count,omitempty"`
	PerPage   *int64    `json:"per_page,omitempty"`
	Previous  *string   `json:"previous_page,omitempty"`
}

ArticleCollectionResponse struct

type ArticleLabel

type ArticleLabel struct {
	ID        *float64 `json:"id,omitempty"`
	URL       *string  `json:"url,omitempty"`
	Name      *string  `json:"name,omitempty"`
	CreatedAt *string  `json:"created_at,omitempty"`
	UpdatedAt *string  `json:"updated_at,omitempty"`
}

ArticleLabel struct

type ArticleResponse

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

ArticleResponse struct

type ArticleService

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

ArticleService struct

func (*ArticleService) Create

func (s *ArticleService) Create(a *Article) (*Article, error)

Create func creates a single new article

func (*ArticleService) Delete

func (s *ArticleService) Delete(id *int64) error

Delete func deletes a single article

func (*ArticleService) List

func (s *ArticleService) List() ([]Article, error)

List function

func (*ArticleService) Update

func (s *ArticleService) Update(a *Article) error

Update func updates a single article

type Category

type Category struct {
	ID             float64       `json:"id,omitempty"`
	Name           string        `json:"name,omitempty"`
	Description    string        `json:"description,omitempty"`
	Locale         string        `json:"locale,omitempty"`
	SourceLocale   string        `json:"source_locale,omitempty"`
	URL            string        `json:"url,omitempty"`
	HtmlURL        string        `json:"html_url,omitempty"`
	Outdated       bool          `json:"outdated,omitempty"`
	Position       float64       `json:"position,omitempty"`
	TranslationIDs []interface{} `json:"translation_ids,omitempty"`
	CreatedAt      string        `json:"created_at,omitempty"`
	UpdatedAt      string        `json:"updated_at,omitempty"`
}

Category struct

type CategoryService

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

CategoryService struct

type Client

type Client struct {
	UserAgent string

	Tickets       *TicketService
	Users         *UserService
	Articles      *ArticleService
	Labels        *LabelService
	Organizations *OrganizationService
	Search        *SearchService
	// contains filtered or unexported fields
}

Client which talks to the Vend API

func NewClient

func NewClient(dmn, usrname, passwd string, httpClient *http.Client) *Client

NewClient creates a new instance of the Client type

func (*Client) Do

func (c *Client) Do(req *http.Request, v interface{}) (*Response, error)

Do function executes a client request

func (*Client) NewRequest

func (c *Client) NewRequest(method, urlStr string, body interface{}) (*http.Request, error)

NewRequest function creates a new request

type Comment

type Comment struct {
	Body     *string `json:"body,omitempty"`
	Public   *bool   `json:"public,omitempty"`
	AuthorID *int    `json:"author_id,omitemtpy"`
}

Comment on ticket

type CustomField

type CustomField struct {
	ID    *float64    `json:"id,omitempty"`
	Value interface{} `json:"value,omitempty"`
}

CustomField struct

type ErrorResponse

type ErrorResponse struct {
	Response    *http.Response
	Message     string      `json:"error,omitempty"`
	Description *string     `json:"description,omitempty"`
	Details     interface{} `json:"details,omitempty"`
}

ErrorResponse wraps an error response

func (*ErrorResponse) Error

func (r *ErrorResponse) Error() string

type Group

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

Group struct

type LabelCollectionResponse

type LabelCollectionResponse struct {
	Results   []ArticleLabel `json:"labels,omitempty"`
	Count     *int64         `json:"count,omitempty"`
	Next      *string        `json:"next_page,omitempty"`
	Page      *int64         `json:"page,omitempty"`
	PageCount *int64         `json:"page_count,omitempty"`
	PerPage   *int64         `json:"per_page,omitempty"`
	Previous  *string        `json:"previous_page,omitempty"`
}

LabelCollectionResponse struct

type LabelResponse

type LabelResponse struct {
	Label *ArticleLabel `json:"label,omitempty"`
}

LabelResponse struct

type LabelService

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

LabelService struct

func (*LabelService) Create

func (s *LabelService) Create(id *int64, l *ArticleLabel) (*ArticleLabel, error)

Create func creates a single new article

func (*LabelService) Delete

func (s *LabelService) Delete(articleID, id *int64) error

Delete func deletes a single article

func (*LabelService) Get

func (s *LabelService) Get(id *int64) ([]ArticleLabel, error)

Get function lists lablels used in an article with a given id

func (*LabelService) List

func (s *LabelService) List() ([]ArticleLabel, error)

List function lists labels used in all articles

type Organization

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

Organization struct

type OrganizationCollectionResponse

type OrganizationCollectionResponse struct {
	Organizations []Organization `json:"organizations,omitempty"`
	NextPage      *string        `json:"next_page,omitempty"`
	PreviousPage  *string        `json:"previous_page,omitempty"`
	Count         *int           `json:"count,omitempty"`
}

OrganizationCollectionResponse struct

type OrganizationResponse

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

OrganizationResponse struct

type OrganizationSearchResponse

type OrganizationSearchResponse struct {
	Organizations []Organization `json:"results,omitempty"`
	NextPage      *string        `json:"next_page,omitempty"`
	PreviousPage  *string        `json:"previous_page,omitempty"`
	Count         *int           `json:"count,omitempty"`
}

OrganizationSearchResponse struct

type OrganizationService

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

OrganizationService struct

func (*OrganizationService) Create

func (s *OrganizationService) Create(org *Organization) (*Organization, error)

Create creates a new organization

func (*OrganizationService) Get

func (s *OrganizationService) Get(organizationID string) (*Organization, *Response, error)

Get finds an organization in Zendesk by ID

func (*OrganizationService) Update

func (s *OrganizationService) Update(org *Organization) (*Organization, error)

Update updates and organization by id

type Photo

type Photo struct {
	URL              *string     `json:"url,omitempty"`
	ID               *int        `json:"id,omitempty"`
	FileName         *string     `json:"file_name,omitempty"`
	ContentURL       *string     `json:"content_url,omitempty"`
	MappedContentURL *string     `json:"mapped_content_url,omitempty"`
	ContentType      *string     `json:"content_type,omitempty"`
	Size             *int        `json:"size,omitempty"`
	Inline           *bool       `json:"inline,omitempty"`
	Thumbnails       []Thumbnail `json:"thumbnails,omitempty"`
}

type Response

type Response struct {
	*http.Response
}

Response wraps the http.Response type

type SatisfactionRating

type SatisfactionRating struct {
	ID      *float64 `json:"id,omitempty"`
	Score   *string  `json:"score,omitempty"`
	Comment *string  `json:"comment,omitempty"`
}

SatisfactionRating struct

type SearchService

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

SearchService struct

func (*SearchService) OrganizationByName

func (s *SearchService) OrganizationByName(name string) (*OrganizationSearchResponse, error)

OrganizationByName searches the organization by name

type Section

type Section struct {
	ID                         *float64 `json:"id,omitempty"`
	Name                       *string  `json:"name,omitempty"`
	Description                *string  `json:"description,omitempty"`
	Locale                     *string  `json:"locale,omitempty"`
	SourceLocale               *string  `json:"source_locale,omitempty"`
	URL                        *string  `json:"url,omitempty"`
	HtmlURL                    *string  `json:"html_url,omitempty"`
	CategoryID                 *float64 `json:"category_id,omitempty"`
	Visibility                 *string  `json:"visibility,omitempty"`
	Outdated                   *bool    `json:"outdated,omitempty"`
	RestrictToManager          *bool    `json:"restrict_to_manager,omitempty"`
	InternalRestrictionTags    []string `json:"internal_restriction_tags,omitempty"`
	RestrictedRestrictionTags  []string `json:"restricted_restriction_tags,omitempty"`
	RestrictionGroupIds        []string `json:"restriction_group_ids,omitempty"`
	RestrictionOrganizationIds []string `json:"restriction_organization_ids,omitempty"`
	Position                   *float64 `json:"position,omitempty"`
	Sorting                    *string  `json:"sorting,omitempty"`
	TranslationIds             []string `json:"translation_ids,omitempty"`
	CreatedAt                  *string  `json:"created_at,omitempty"`
	UpdatedAt                  *string  `json:"updated_at,omitempty"`
}

Section struct

type SectionService

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

SectionService struct

type Thumbnail

type Thumbnail struct {
	URL              *string `json:"url,omitempty"`
	ID               *int    `json:"id,omitempty"`
	FileName         *string `json:"file_name,omitempty"`
	ContentURL       *string `json:"content_url,omitempty"`
	MappedContentURL *string `json:"mapped_content_url,omitempty"`
	ContentType      *string `json:"content_type,omitempty"`
	Size             *int    `json:"size,omitempty"`
	Inline           *bool   `json:"inline,omitempty"`
}

type Ticket

type Ticket struct {
	ID                  *float64            `json:"id,omitempty"`
	URL                 *string             `json:"url,omitempty"`
	ExternalID          *string             `json:"external_id,omitempty"`
	Type                *string             `json:"type,omitempty"`
	Subject             *string             `json:"subject,omitempty"`
	Description         *string             `json:"description,omitempty"`
	Priority            *string             `json:"priority,omitempty"`
	Status              *string             `json:"status,omitempty"`
	Recipient           *string             `json:"recipient,omitempty"`
	RequesterID         *float64            `json:"requester_id,omitempty"`
	Requester           *User               `json:"requester,omitempty"`
	SubmitterID         *float64            `json:"submitter_id,omitempty"`
	AssigneeID          *float64            `json:"assignee_id,omitempty"`
	OrganizationID      *float64            `json:"organization_id,omitempty"`
	GroupID             *float64            `json:"group_id,omitempty"`
	CollaboratorIDs     []float64           `json:"collaborator_ids,omitempty"`
	ForumTopicID        *float64            `json:"forum_topic_id,omitempty"`
	ProblemID           *float64            `json:"problem_id,omitempty"`
	HasIncidents        *bool               `json:"has_incidents,omitempty"`
	DueAt               *string             `json:"due_at,omitempty"`
	Tags                []string            `json:"tags,omitempty"`
	Via                 *Via                `json:"via,omitempty"`
	CustomFields        []CustomField       `json:"custom_fields,omitempty"`
	SatisfactionRating  *SatisfactionRating `json:"satisfaction_rating,omitempty"`
	SharingAgreementIds []float64           `json:"sharing_agreement_ids,omitempty"`
	FollowupIds         []float64           `json:"followup_ids,omitempty"`
	TicketFormID        *float64            `json:"ticket_form_id,omitempty"`
	BrandID             *float64            `json:"brand_id,omitempty"`
	CreatedAt           *string             `json:"created_at,omitempty"`
	UpdatedAt           *string             `json:"updated_at,omitempty"`
	Comment             *Comment            `json:"comment,omitempty"`
}

Ticket struct

type TicketCollectionResponse

type TicketCollectionResponse struct {
	Results  []Ticket `json:"tickets"`
	Next     *string  `json:"next_page,omitempty"`
	Previous *string  `json:"previous_page,omitempty"`
	Count    *int     `json:"count,omitempty"`
}

TicketCollectionResponse struct

type TicketResponse

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

TicketResponse struct

type TicketService

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

TicketService struct

func (*TicketService) Create

func (s *TicketService) Create(ticket *Ticket) (*Ticket, *Response, error)

Create a new Zendesk Ticket

func (*TicketService) Get

func (s *TicketService) Get(id string) (*Ticket, *Response, error)

Get method

func (*TicketService) GetProblemIncidents

func (s *TicketService) GetProblemIncidents(id string) ([]Ticket, error)

GetProblemIncidents gets all problem tickets

func (*TicketService) GetProblemIncidentsCount

func (s *TicketService) GetProblemIncidentsCount(id string) (int, error)

GetProblemIncidentsCount gets only the first page of tickets which includes the count field

func (*TicketService) List

func (s *TicketService) List() ([]Ticket, error)

List returns a slice of all products

func (*TicketService) ListByView

func (s *TicketService) ListByView(id string) ([]Ticket, error)

ListByView function

func (*TicketService) ListByViewUG

func (s *TicketService) ListByViewUG(id string) ([]Ticket, []User, []Group, error)

ListByViewUG function

func (*TicketService) Update

func (s *TicketService) Update(ticket *Ticket) (*Ticket, *Response, error)

Update a Zendesk Ticket

type TicketUserGroupResponse

type TicketUserGroupResponse struct {
	Tickets  []Ticket `json:"tickets,omitempty"`
	Users    []User   `json:"users,omitempty"`
	Groups   []Group  `json:"groups,omitempty"`
	Next     *string  `json:"next_page,omitempty"`
	Previous *string  `json:"previous_page,omitempty"`
	Count    *int     `json:"count,omitempty"`
}

TicketUserGroupResponse struct

type Translation

type Translation struct {
	ID          *int       `json:"id"`
	URL         *string    `json:"url"`
	HTMLURL     *string    `json:"html_url"`
	SourceID    *int       `json:"source_id"`
	SourceType  *string    `json:"source_type"`
	Locale      *string    `json:"locale"`
	Title       *string    `json:"title"`
	Body        *string    `json:"body"`
	Outdated    *bool      `json:"outdated"`
	Draft       *bool      `json:"draft"`
	Hidden      *bool      `json:"hidden"`
	CreatedAt   *time.Time `json:"created_at,omitempty"`
	UpdatedAt   *time.Time `json:"updated_at,omitempty"`
	UpdatedByID *int       `json:"updated_by_id"`
	CreatedByID *int       `json:"created_by_id"`
}

Translation struct

type TranslationResponse

type TranslationResponse struct {
	Translation *Translation `json:"translation"`
}

TranslationResponse struct

type User

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

type UserResponse

type UserResponse struct {
	Users    []User  `json:"users,omitempty"`
	Next     *string `json:"next_page,omitempty"`
	Previous *string `json:"previous_page,omitempty"`
	Count    *int    `json:"count,omitempty"`
}

type UserService

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

func (*UserService) List

func (s *UserService) List() ([]User, error)

type Via

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

Via struct

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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