zendesk

package
v0.4.10 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

zendesk package provides api access to the zendesk rest api

zendesk package provides api access to the zendesk rest apis

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func URL added in v0.3.3

func URL(subDomain, ticketID string) string

Types

type Attachment added in v0.3.0

type Attachment struct {
	ParentCommentDate time.Time // "created_at": "2000-01-01T11:11:07Z",
	ParentCommentID   int64
	FileName          string
	ContentURL        string
	ContentType       string
	Size              int64
	Deleted           bool
}

Attachment maps to

{
	"url": "https://dremio.zendesk.com/api/v2/attachments/1.json",
	"id": 1,
	"file_name": "test.txt",
	"content_url": "https://tester.zendesk.com/attachments/token/abc/?name=test.txt",
	"mapped_content_url": "https://test.tester.com/attachments/token/abc/?name=test.txt",
	"content_type": "text/plain",
	"size": 1111,
	"width": null,
	"height": null,
	"inline": false,
	"deleted": false,
	"thumbnails": []
}

with additional data from parent comment

func GetAttachmentsFromComments added in v0.3.3

func GetAttachmentsFromComments(jsonData string) ([]Attachment, *string, error)

GetLinksFromComments is parsing out the links from the html_ docs are here https://developer.zendesk.com/api-reference/ticketing/tickets/ticket_comments/#list-comments

type Client added in v0.3.3

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

func NewClient added in v0.3.3

func NewClient(username, password, subDomain string, verbose bool) *Client

func (*Client) GetTicketComentsJSON added in v0.3.3

func (z *Client) GetTicketComentsJSON(ticketID string, pageURL *string) (string, error)

GetTicketComments returns all comments as a concatenated string so we can search them GET /api/v2/tickets/{ticket_id}/comments curl https://{subdomain}.zendesk.com/api/v2/tickets/{ticket_id}/comments.json \

{
	"comments": [
	  {
		"attachments": [
		  {
			"content_type": "text/plain",
			"content_url": "https://company.zendesk.com/attachments/crash.log",
			"file_name": "crash.log",
			"id": 498483,
			"size": 2532,
			"thumbnails": []
		  }
		],
		"author_id": 123123,
		"body": "Thanks for your help!",
		"created_at": "2009-07-20T22:55:29Z",
		"id": 1274,
		"metadata": {
		  "system": {
			"client": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36",
			"ip_address": "1.1.1.1",
			"latitude": -37.000000000001,
			"location": "Melbourne, 07, Australia",
			"longitude": 144.0000000000002
		  },
		  "via": {
			"channel": "web",
			"source": {
			  "from": {},
			  "rel": "web_widget",
			  "to": {}
			}
		  }
		},
		"public": true,
		"type": "Comment"
	  }
	]
  }
type CommentTextWithLink struct {
	Body string
	URL  string
}

CommentTextWithLink takes the extracted link from the html_body and then also returns the body in text format so that we can store the comment with the downloaded files

func GetLinksFromComments added in v0.3.0

func GetLinksFromComments(jsonData string) ([]CommentTextWithLink, *string, error)

GetLinksFromComments is parsing out the links from the html_ docs are here https://developer.zendesk.com/api-reference/ticketing/tickets/ticket_comments/#list-comments

type MissingJSONFieldError added in v0.3.3

type MissingJSONFieldError struct {
	FieldName string
	JSONData  string
	Location  string
}

MissingJSONFieldError provides location, field name and raw json data parsed

func (MissingJSONFieldError) Error added in v0.3.3

func (m MissingJSONFieldError) Error() string

Error provides location if one is present otherwise it will omit that text

type ParserErr added in v0.3.3

type ParserErr struct {
	Err      error
	JSONData string
	Location string
}

ParserErr provides location, raw json data parsed and nested error

func (ParserErr) Error added in v0.3.3

func (p ParserErr) Error() string

Error provides location if one is present otherwise it will omit that text

Jump to

Keyboard shortcuts

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