whd

package
v0.0.0-...-afe3a89 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2023 License: ISC Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ApiKeyAuth     authType = 0
	SessionKeyAuth authType = 1
	PasswordAuth   authType = 2
)

Variables

View Source
var RETRY_MAX = 10

Functions

func CreateHiddenNote

func CreateHiddenNote(uri string, user User, whdTicketId int, noteTxt string, sslVerify bool) (int, error)

func CreateNote

func CreateNote(uri string, user User, whdTicketId int, noteTxt string, sslVerify bool) (int, error)

func CreateUpdateLocation

func CreateUpdateLocation(uri string, user User, whdLocation Location, sslVerify bool) (int, error)

func CreateUpdateTicket

func CreateUpdateTicket(uri string, user User, whdTicket Ticket, sslVerify bool) (int, error)

func GetAsset

func GetAsset(uri string, user User, assetNumber string, asset *[]Asset, sslVerify bool) error

func GetAssetByID

func GetAssetByID(uri string, user User, assetID int, asset *Asset, sslVerify bool) error

func GetAssetCustomFieldList

func GetAssetCustomFieldList(uri string, user User, list map[int]string, sslVerify bool) error

func GetAssets

func GetAssets(uri string, user User, qualifier string, limit uint, page uint, asset *[]Asset, sslVerify bool) error

func GetAttachment

func GetAttachment(uri string, user User, attachmentId int, sslVerify bool) ([]byte, error)

func GetAttachmentAsBase64

func GetAttachmentAsBase64(uri string, user User, attachmentId int, sslVerify bool) (string, error)

func GetCustomFieldList

func GetCustomFieldList(uri string, user User, list map[int]string, sslVerify bool) error

func GetLocation

func GetLocation(uri string, user User, id int, location *Location, sslVerify bool) error

func GetLocationCustomFieldList

func GetLocationCustomFieldList(uri string, user User, list map[int]string, sslVerify bool) error

func GetLocationList

func GetLocationList(uri string, user User, list map[int]string, sslVerify bool) error

func GetNotes

func GetNotes(uri string, user User, ticketID int, notes *[]Note, sslVerify bool) error

func GetPriorityTypeList

func GetPriorityTypeList(uri string, user User, list map[int]string, sslVerify bool) error

func GetRequestTypeList

func GetRequestTypeList(uri string, user User, result map[int]RequestType, sslVerify bool) error

func GetSessionKey

func GetSessionKey(uri string, user User) (string, error)

func GetStatusTypeList

func GetStatusTypeList(uri string, user User, list map[int]string, sslVerify bool) error

func GetTechList

func GetTechList(uri string, user User, list map[int]string, sslVerify bool) error

func GetTicket

func GetTicket(uri string, user User, id int, ticket *Ticket, sslVerify bool) error

func GetTickets

func GetTickets(uri string, user User, qualifier string, limit uint, page uint, ticket *[]Ticket, sslVerify bool) error

GetTickets allows you to query WHD for a list of tickets which matches a qualifier sample qualifier:

  • all tickets including deleted: ((deleted %3D null) or (deleted %3D 0) or (deleted %3D 1))
  • tickets in location ATL (location.locationName %3D 'ATL')
  • tickets in stauts New (statustype.statusTypeName %3D 'Open')

limit - limits the number of tickets returned, default is 25, max value is 100 page - Page of results to retrieve. Returns `limit` number of items, starting

with item `(page*limit)` of the search results

func SetRetryMax

func SetRetryMax(retry int)

func TerminateSession

func TerminateSession(uri string, sessionKey string) error

func UploadAttachment

func UploadAttachment(uri string, user User, ticketId int, filename string, filedata []byte, sslVerify bool) (int, error)

func UploadAttachmentToEntity

func UploadAttachmentToEntity(uri string, user User, entity string, entityId int, filename string, filedata []byte, sslVerify bool) (int, error)

func UploadAttachmentToNote

func UploadAttachmentToNote(uri string, user User, noteId int, filename string, filedata []byte, sslVerify bool) (int, error)

func UploadAttachmentToNoteFromFile

func UploadAttachmentToNoteFromFile(uri string, user User, noteId int, filename string, fullFilePath string, deleteFileAfter bool, sslVerify bool) (int, error)

func UploadAttachmentToTicketFromFile

func UploadAttachmentToTicketFromFile(uri string, user User, ticketId int, filename string, fullFilePath string, deleteFileAfter bool, sslVerify bool) (int, error)

func WrapAuth

func WrapAuth(req *retryablehttp.Request, user User)

Types

type Asset

type Asset struct {
	Id             int           `json:"id,omitempty"`
	Type           string        `json:"type,omitempty"`
	AssetNumber    string        `json:"assetNumber,omitempty"`
	SerialNumber   string        `json:"serialNumber,omitempty"`
	NetworkAddress string        `json:"networkAddress,omitempty"`
	NetworkName    string        `json:"networkName,omitempty"`
	Location       Location      `json:"location,omitempty"`
	CustomFields   []CustomField `json:"assetCustomFields,omitempty"`
}

type Attachment

type Attachment struct {
	Id            int       `json:"id,omitempty"`
	FileName      string    `json:"fileName,omitempty"`
	SizeString    string    `json:"sizeString,omitempty"`
	UploadDateUtc time.Time `json:"uploadDateUtc,omitempty"`
}

type ClientTech

type ClientTech struct {
	Id          int    `json:"id,omitempty"`
	Type        string `json:"type,omitempty"`
	Email       string `json:"email,omitempty"`
	DisplayName string `json:"displayName,omitempty"`
}

type CustomField

type CustomField struct {
	Id    int    `json:"definitionId,omitempty"`
	Value string `json:"restValue,omitempty"`
}

type Location

type Location struct {
	Id           int           `json:"id,omitempty"`
	Type         string        `json:"type,omitempty"`
	Address      string        `json:"address,omitempty"`
	City         string        `json:"city,omitempty"`
	Name         string        `json:"locationName,omitempty"`
	PostalCode   string        `json:"postalCode,omitempty"`
	State        string        `json:"state,omitempty"`
	Country      string        `json:"country,omitempty"`
	CustomFields []CustomField `json:"locationCustomFields,omitempty"`
}

type Note

type Note struct {
	Id                  int          `json:"id,omitempty"`
	Date                time.Time    `json:"date,omitempty"`
	MobileNoteText      string       `json:"mobileNoteText,omitempty"` // Used for reading notes FROM whd
	PrettyUpdatedString string       `json:"prettyUpdatedString,omitempty"`
	NoteText            string       `json:"noteText,omitempty"` // Used to Create note TO whd
	Attachments         []Attachment `json:"attachments,omitempty"`
	IsHidden            bool         `json:"isHidden"`
	IsTechNote          bool         `json:"isTechNote"`
	JobTicket           struct {
		Id   int    `json:"id,omitempty"`
		Type string `json:"type,omitempty"`
	} `json:"jobticket,omitempty"`
	Reason string `json:"reason,omitempty"`
}

type OrionAlert

type OrionAlert struct {
	Id   string            `json:"id,omitempty"`
	Data map[string]string `json:"data,omitempty"`
}

type PriorityType

type PriorityType struct {
	Id   int    `json:"id,omitempty"`
	Type string `json:"type,omitempty"`
	Name string `json:"priorityTypeName,omitempty"`
}

type ProblemType

type ProblemType struct {
	Id   int    `json:"id"`
	Type string `json:"type"`
	Name string `json:"detailDisplayName,omitempty"`
}

type RequestType

type RequestType struct {
	Id       int
	ParentId int
	Name     string `json:"problemTypeName"`
}

func (RequestType) String

func (rt RequestType) String() string

type StatusType

type StatusType struct {
	Id   int    `json:"id,omitempty"`
	Type string `json:"type,omitempty"`
	Name string `json:"statusTypeName,omitempty"`
}

type TechGroupLevel

type TechGroupLevel struct {
	Id             int    `json:"id,omitempty"`
	Type           string `json:"type,omitempty"`
	Level          int    `json:"level,omitempty"`
	LevelName      string `json:"email,omitempty"`
	ShortLevelName string `json:"displayName,omitempty"`
}

type Ticket

type Ticket struct {
	Id             int            `json:"id,omitempty"`
	Detail         string         `json:"detail,omitempty"`
	Subject        string         `json:"subject,omitempty"`
	LastUpdated    time.Time      `json:"lastUpdated,omitempty"`
	ReportDateUtc  string         `json:"reportDateUtc,omitempty"`
	LocationId     int            `json:"locationId,omitempty"`
	Location       Location       `json:"location,omitempty"`
	StatusTypeId   int            `json:"statusTypeId,omitempty"`
	StatusType     StatusType     `json:"statustype,omitempty"`
	PriorityTypeId int            `json:"priorityTypeId,omitempty"`
	PriorityType   PriorityType   `json:"prioritytype,omitempty"`
	ProblemType    ProblemType    `json:"problemtype,omitempty"`
	CustomFields   []CustomField  `json:"ticketCustomFields,omitempty"`
	Assets         []Asset        `json:"assets,omitempty"`
	Notes          []Note         `json:"notes,omitempty"`
	Attachments    []Attachment   `json:"attachments,omitempty"`
	ClientTech     ClientTech     `json:"clientTech,omitempty"`
	TechGroupLevel TechGroupLevel `json:"techGroupLevel,omitempty"`
	OrionAlert     OrionAlert     `json:"orionAlert,omitempty"`
	EmailTech      bool           `json:"emailTech,omitempty"`
	EmailClient    bool           `json:"emailClient"`
}

type User

type User struct {
	Name string
	Pass string
	Type authType
}

Jump to

Keyboard shortcuts

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