Documentation ¶
Index ¶
Constants ¶
const ( //ReplyTime is the first reply time in minutes. ReplyTime MetricAttribute = "reply_time" //FirstResolutionTime is the first resolution time in minutes. FirstResolutionTime MetricAttribute = "first_resolution_time" //FullResolutionTime is the full resolution time in minutes. FullResolutionTime MetricAttribute = "full_resolution_time" //AgentWaitTime is the first agent wait time in minutes. AgentWaitTime MetricAttribute = "agent_wait_time" //RequesterWaitTime is the first requester wait time in minutes. RequesterWaitTime MetricAttribute = "requester_wait_time" //OnHoldTime is the first on hold time in minutes. OnHoldTime MetricAttribute = "on_hold_time" //BusinessMetric relates to the business time. BusinessMetric MetricSubMetric = "business" //CalendarMetric relates to the calendar time. CalendarMetric MetricSubMetric = "calendar" )
Variables ¶
var ( // ErrInvalidAttribute is thrown when the metric attribute is invalid. ErrInvalidAttribute = fmt.Errorf("The metric attribute is not valid must be one of %s", validMetricAttributes) // ErrInvalidUnit is thrown when the metric unit is invalid. ErrInvalidUnit = fmt.Errorf("The metric unit is not valid must be one of %s", validMetricUnits) // ErrEmptyMetricOptions is thrown when the metric options are all empty. ErrEmptyMetricOptions = errors.New("The metric options must be present to be valid for a metric report") // ErrEmptyGrouping is thrown when there are no groupings and it is required by the report. ErrEmptyGrouping = errors.New("The metric grouping is required when using detailed_metric report") // ErrInvalidGroupUnit is thrown when one of the grouping unit are invalid. ErrInvalidGroupUnit = errors.New("The metric group unit is invalid must be one of [minute hour]") // ErrFromGreaterThanTo is thrown when the group From is greater than To. ErrFromGreaterThanTo = errors.New("The metric group 'from' value must not be greater than the 'to' value") // ErrFromEqualToTo is thrown when the group From is equal to To. ErrFromEqualToTo = errors.New("The metric group 'from' value must not be equal to the 'to' value") )
Functions ¶
This section is empty.
Types ¶
type Auth ¶
type Auth struct { Email string `yaml:"email"` Password string `yaml:"password"` APIKey string `yaml:"api_key"` Subdomain string `yaml:"subdomain"` }
Auth makes up the Zendesk authentication options.
type Config ¶
type Config struct { Geckoboard Geckoboard `yaml:"geckoboard"` Zendesk Zendesk `yaml:"zendesk"` }
Config is the toplevel instance of the config containing both Geckoboard and Zendesk configurations.
func LoadConfig ¶
LoadConfig take path and attempts to open the file and returns any errors that might occur with yaml syntax or file issues.
type DateFilter ¶
type DateFilter struct { Attribute dateAttribute `yaml:"attribute"` Unit calendarUnit `yaml:"unit"` Custom string `yaml:"custom"` Past int `yaml:"past"` }
DateFilter represents a date filter on the zendesk search api.
func (*DateFilter) BuildQuery ¶
func (df *DateFilter) BuildQuery(t *time.Time) string
BuildQuery takes a time instance and builds the date query calling getDateAPIFormat to return api formatted date based on the unit and past values otherwise it builds on the user custom input with attribute and returns it as a string.
func (*DateFilter) Validate ¶
func (df *DateFilter) Validate() error
Validate returns first error it occurs otherwise nil based on the user options.
type DateFilters ¶
type DateFilters []DateFilter
DateFilters is a slice of DateFilter.
func (DateFilters) BuildQuery ¶
func (df DateFilters) BuildQuery(t *time.Time) string
BuildQuery for the DateFilters type which calls the DateFilter BuildQuery method and returns all concatenated.
type Geckoboard ¶
Geckoboard describes the authentication options.
type GroupBy ¶
GroupBy describes how a report should be grouped.
func (*GroupBy) DisplayName ¶
DisplayName returns the key if Name attribute is an empty string or returns the Name attribute specified by the user.
type MetricAttribute ¶
type MetricAttribute string
MetricAttribute defines the allowed metric attributes.
type MetricGroup ¶
type MetricGroup struct { Unit calendarUnit `yaml:"unit"` From int `yaml:"from"` To int `yaml:"to"` }
MetricGroup describes how to group ticket metrics. For instance to group ticket metrics by 0-1 hours you would specify TimeGroup{Unit: hour, From: 0, To: 1}.
func (MetricGroup) DisplayName ¶
func (m MetricGroup) DisplayName() string
DisplayName returns a string representation of the group name and alters the unit into plural version when the To value is greater than 1.
func (MetricGroup) FromInMinutes ¶
func (m MetricGroup) FromInMinutes() int
FromInMinutes returns from converted into minutes based on the unit else returns -1 if the unit is not valid.
func (MetricGroup) ToInMinutes ¶
func (m MetricGroup) ToInMinutes() int
ToInMinutes returns from converted into minutes based on the unit else returns -1 if the unit is not valid.
type MetricOption ¶
type MetricOption struct { Attribute MetricAttribute `yaml:"attribute"` Unit MetricSubMetric `yaml:"unit"` Grouping []MetricGroup `yaml:"grouping"` }
MetricOption describes the options for metric reports
func (MetricOption) GroupingValid ¶
func (m MetricOption) GroupingValid() error
GroupingValid validates that at least one MetricGroup is present if the len is less than 1 it will return an error and checks each Metric Group is valid as well.
func (MetricOption) IsEmpty ¶
func (m MetricOption) IsEmpty() bool
IsEmpty return true if the metric option is initialized with just the default values for that data type or false if one of the attributes are not empty.
func (MetricOption) Valid ¶
func (m MetricOption) Valid() error
Valid return either true or false validating options required for metric reports. It doesn't validate against the grouping as not all metric reports require it.
type MetricSubMetric ¶
type MetricSubMetric string
MetricSubMetric is the unit to use from a metric attribute.
type Report ¶
type Report struct { Name string `yaml:"name"` DataSet string `yaml:"dataset"` GroupBy GroupBy `yaml:"group_by"` Filter SearchFilter `yaml:"filter"` MetricOptions MetricOption `yaml:"metric_options"` }
Report describes the template to use and the filters to build for the Zendesk request.
type SearchFilter ¶
type SearchFilter struct { Type string `yaml:"type"` DateRange DateFilters `yaml:"date_range"` Value map[string]string `yaml:"value"` Values map[string][]string `yaml:"values"` }
SearchFilter describes a filter query on Zendesk api.
func (*SearchFilter) BuildQuery ¶
func (sf *SearchFilter) BuildQuery(t *time.Time) string
BuildQuery builds a valid zendesk search api and returns it as a string.
func (*SearchFilter) Validate ¶
func (sf *SearchFilter) Validate() error
Validate checks the search filter and returns an error if not.