freshservice

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// TicketOpen is the value required to indicate a ticket status is open
	TicketOpen = 2
	// TicketPending is the value required to indicate a ticket status is pending
	TicketPending = 3
	// TicketResolved is the value required to indicate a ticket status is resolved
	TicketResolved = 4
	// TicketClosed is the value required to indicate a ticket status is closed
	TicketClosed = 5
	// LowPriority is the value to set a ticket priority to low
	LowPriority = 1
	// MediumPriority is the value to set a ticket priority to medium
	MediumPriority = 2
	// HighPriority is the value to set a ticket priority to high
	HighPriority = 3
	// UrgentPriority is the value to set a ticket priority to urgent
	UrgentPriority = 4
	// SourceEmail is the value to specify a ticket was opened via email
	SourceEmail = 1
	// SourcePortal is the value to specify a ticket was opened via portal
	SourcePortal = 2
	// SourcePhone is the value to specify a ticket was opened via phone
	SourcePhone = 3
	// SourceChat is the value to specify a ticket was opened via chat
	SourceChat = 4
	// SourceFeedbackWidget is the value to specify a ticket was opened via a Feedback Widget
	SourceFeedbackWidget = 5
	// SourceYammer is the value to specify a ticket was opened via Yammer
	SourceYammer = 6
	// SourceAWSCloudwatch is the value to specify a ticket was opened by AWS Cloudwatch
	SourceAWSCloudwatch = 7
	// SourcePagerduty is the value to specify a ticket was opened by Pagerduty
	SourcePagerduty = 8
	// SourceWalkup is the value to specify a ticket was opened via Walkup
	SourceWalkup = 9
	// SourceSlack is the value to specify a ticket was opened via Slack
	SourceSlack = 10
)

Variables

This section is empty.

Functions

func HasNextPage

func HasNextPage(resp *http.Response) string

HasNextPage will take in an http response and check for the existence of the "link" header to determine whether or not there is another page returning the next page's URL <https://example.freshservice.com/api/v2/tickets?page=2>; rel="next"

func Int

func Int(i int) *int

Int is a built in utility function that will return a *int

func ParseNextPage

func ParseNextPage(rawURL string) string

ParseNextPage will return the next page parameter parsed out of a raw URL string's "page=[:page_no]" parameter

func String

func String(s string) *string

String is a built in utilty function that will return a *string

func StringInSlice

func StringInSlice(a string, list []string) bool

StringInSlice is a utility function that can be used to see if a string exists in a static list of strings

Types

type AdditionalData added in v0.0.2

type AdditionalData struct {
	Overview     interface{} `json:"overview"`
	GraphData    interface{} `json:"graph_data"`
	LastSyncDate interface{} `json:"last_sync_date"`
}

type Agent

type Agent struct {
	Details AgentDetails `json:"agent"`
}

Agent holds the details of a specific Freshservice agent

type AgentDetails

type AgentDetails struct {
	ID                    int         `json:"id"`
	FirstName             string      `json:"first_name"`
	LastName              string      `json:"last_name"`
	Occasional            bool        `json:"occasional"`
	Active                bool        `json:"active"`
	JobTitle              string      `json:"job_title"`
	Email                 string      `json:"email"`
	WorkPhoneNumber       string      `json:"work_phone_number"`
	MobilePhoneNumber     string      `json:"mobile_phone_number"`
	ReportingManagerID    int         `json:"reporting_manager_id"`
	Address               string      `json:"address"`
	TimeZone              string      `json:"time_zone"`
	TimeFormat            string      `json:"time_format"`
	Language              string      `json:"language"`
	LocationID            int         `json:"location_id"`
	BackgroundInformation string      `json:"background_information"`
	ScoreboardLevelID     int         `json:"scoreboard_level_id"`
	GroupIds              []int       `json:"group_ids"` // being deprecated by freshservice
	MemberOf              []int       `json:"member_of"`
	ObserverOf            []int       `json:"observer_of"`
	RoleIds               []int       `json:"role_ids"` // being deprecated by freshservice
	Roles                 []AgentRole `json:"roles"`
	LastLoginAt           time.Time   `json:"last_login_at"`
	LastActiveAt          time.Time   `json:"last_active_at"`
	CustomFields          struct {
		House string `json:"house"`
	} `json:"custom_fields"`
	HasLoggedIn bool `json:"has_logged_in"`
}

AgentDetails contains the details of a specific Freshservice agent

type AgentListFilter

type AgentListFilter struct {
	PageQuery   string
	Email       *string
	MobilePhone *int
	WorkPhone   *int
	Active      bool
	Fulltime    bool
	Occasional  bool
}

AgentListFilter holds the filters available when listing Freservice agents

func (*AgentListFilter) QueryString

func (af *AgentListFilter) QueryString() string

QueryString allows the available filter items to meet the QueryFilter interface

type AgentRole

type AgentRole struct {
	RoleID          int    `json:"role_id"`
	AssignmentScope string `json:"assignment_scope"`
	Groups          []int  `json:"groups"`
}

AgentRole represents a Freshservice role that can be assigned to an agent

func (*AgentRole) Validate

func (ar *AgentRole) Validate() error

Validate will confirm that an agent role is valud

type AgentService

AgentService is an interface for interacting with the agent endpoints of the Freshservice API

type AgentServiceClient

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

AgentServiceClient facilitates requests with the AgentService methods

func (*AgentServiceClient) ConvertToRequester

func (as *AgentServiceClient) ConvertToRequester(ctx context.Context, id int) (*AgentDetails, error)

ConvertToRequester will convert a Freshservice agent to a requester

func (*AgentServiceClient) Create

Create a new Freshserrvice agent

func (*AgentServiceClient) Deactivate

func (as *AgentServiceClient) Deactivate(ctx context.Context, id int) (*AgentDetails, error)

Deactivate a Frehservice agent (does not delete)

func (*AgentServiceClient) Delete

func (as *AgentServiceClient) Delete(ctx context.Context, id int) error

Delete a Freshservice agent

func (*AgentServiceClient) Get

func (as *AgentServiceClient) Get(ctx context.Context, id int) (*AgentDetails, error)

Get a specific Freshservice agent

func (*AgentServiceClient) List

List all freshservice agents

func (*AgentServiceClient) Reactivate

func (as *AgentServiceClient) Reactivate(ctx context.Context, id int) (*AgentDetails, error)

Reactivate a Freshserrvice agent

func (*AgentServiceClient) Update

func (as *AgentServiceClient) Update(ctx context.Context, id int, ad *AgentDetails) (*AgentDetails, error)

Update a Freshservice agent

type Agents

type Agents struct {
	List []AgentDetails `json:"agents"`
}

Agents holds a list of Freshservice agents

type Announcement

type Announcement struct {
	Details AnnouncementDetails `json:"announcement"`
}

Announcement represents an announcment in Freshservice

type AnnouncementDetails

type AnnouncementDetails struct {
	Title            string    `json:"title"`
	Body             string    `json:"body"`
	BodyHTML         string    `json:"body_html"`
	VisibleFrom      time.Time `json:"visible_from"`
	VisibleTill      time.Time `json:"visible_till"`
	Visibility       string    `json:"visibility"`
	Departments      []int     `json:"departments"`
	Groups           []int     `json:"groups"`
	State            string    `json:"state"`
	IsRead           bool      `json:"is_read"`
	SendEmail        bool      `json:"send_email"`
	AdditionalEmails []string  `json:"additional_emails"`
	CreatedAt        time.Time `json:"created_at"`
	UpdatedAt        time.Time `json:"updated_at"`
	CreatedBy        int       `json:"created_by"`
}

AnnouncementDetails represents the specific details about a Freshservice announcement

type AnnouncementListFilter

type AnnouncementListFilter struct {
	State string
}

AnnouncementListFilter represents a filter that is available when listing Freshservice announcements

func (*AnnouncementListFilter) QueryString

func (af *AnnouncementListFilter) QueryString() string

QueryString allows the available filter items to meet the QueryFilter interface

type AnnouncementService

AnnouncementService is an interface for interacting with the announcement endpoints of the Freshservice API

type AnnouncementServiceClient

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

AnnouncementServiceClient facilitates requests with the AnnouncementService methods

func (*AnnouncementServiceClient) Create

Create a new announcement in Freshservice

func (*AnnouncementServiceClient) Delete

func (a *AnnouncementServiceClient) Delete(ctx context.Context, id int) error

Delete an announcement in Freshservice

func (*AnnouncementServiceClient) Get

Get a specific Freshservice announcement

func (*AnnouncementServiceClient) List

List announcements in Freshservice

func (*AnnouncementServiceClient) Update

Update an announcement in Freshservice

type Announcements

type Announcements struct {
	List []AnnouncementDetails `json:"announcements"`
}

Announcements represents a list of announcements in Freshservice

type Application added in v0.0.2

type Application struct {
	Details ApplicationDetails `json:"application"`
}

Application holds the details of a specific Freshservice application

type ApplicationDetails added in v0.0.2

type ApplicationDetails struct {
	AdditionalData    AdditionalData `json:"additional_data"`
	UserCount         int            `json:"user_count"`
	InstallationCount int            `json:"installation_count"`
	ID                int64          `json:"id"`
	Name              string         `json:"name"`
	Description       interface{}    `json:"description"`
	Notes             interface{}    `json:"notes"`
	PublisherID       int64          `json:"publisher_id"`
	CreatedAt         time.Time      `json:"created_at"`
	UpdatedAt         time.Time      `json:"updated_at"`
	ApplicationType   string         `json:"application_type"`
	Status            string         `json:"status"`
	ManagedByID       int64          `json:"managed_by_id"`
	Category          string         `json:"category"`
	Sources           []interface{}  `json:"sources"`
}

ApplicationDetails are the details related to a specific application in Freshservice

type ApplicationInstallationDetails added in v0.0.2

type ApplicationInstallationDetails struct {
	ID                    int       `json:"id"`
	CreatedAt             time.Time `json:"created_at"`
	UpdatedAt             time.Time `json:"updated_at"`
	InstallationPath      string    `json:"installation_path"`
	Version               string    `json:"version"`
	InstallationMachineID int       `json:"installation_machine_id"`
	UserID                int       `json:"user_id"`
	DepartmentID          int       `json:"department_id"`
	InstallationDate      time.Time `json:"installation_date"`
}

ApplicationInstallationDetails holds the details of installations for a specific Freshservice application

type ApplicationInstallations added in v0.0.2

type ApplicationInstallations struct {
	List []ApplicationInstallationDetails `json:"installations"`
}

ApplicationInstallations holds a list of Freshservice application installations

type ApplicationListOptions added in v0.0.2

type ApplicationListOptions struct {
	PageQuery string
}

ApplicationListOptions holds the available options that can be passed when requesting a list of Freshservice Applications

func (*ApplicationListOptions) QueryString added in v0.0.2

func (opts *ApplicationListOptions) QueryString() string

QueryString allows us to pass TicketListOptions as a QueryFilter and will return a new endpoint URL with query parameters attached

type ApplicationService added in v0.0.2

ApplicationService is an interface for interacting with the application endpoints of the Freshservice API

type ApplicationServiceClient added in v0.0.2

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

ApplicationServiceClient facilitates requests with the TicketService methods

func (*ApplicationServiceClient) Get added in v0.0.2

Get a specific all application

func (*ApplicationServiceClient) List added in v0.0.2

List all application All the below requests are paginated to return only 30 tickets per page. Append the parameter "page=[:page_no]" in the url to traverse through pages.

func (*ApplicationServiceClient) ListInstallations added in v0.0.2

func (a *ApplicationServiceClient) ListInstallations(ctx context.Context, appID int64) ([]ApplicationInstallationDetails, error)

ListInstallations lists all the installations of an application

func (*ApplicationServiceClient) ListLicenses added in v0.0.2

func (a *ApplicationServiceClient) ListLicenses(ctx context.Context, appID int64) ([]LicensesDetails, error)

ListLicenses lists all the licenses for an application

func (*ApplicationServiceClient) ListUsers added in v0.0.2

ListUsers lists all the users of an application

type ApplicationUserDetails added in v0.0.2

type ApplicationUserDetails struct {
	ID            int       `json:"id"`
	CreatedAt     time.Time `json:"created_at"`
	UpdatedAt     time.Time `json:"updated_at"`
	UserID        int       `json:"user_id"`
	LicenseID     int       `json:"license_id"`
	AllocatedDate time.Time `json:"allocated_date"`
	FirstUsed     time.Time `json:"first_used"`
	LastUsed      time.Time `json:"last_used"`
	Source        string    `json:"source"`
}

ApplicationUserDetails holds the details of users for a specific Freshservice application

type ApplicationUsers added in v0.0.2

type ApplicationUsers struct {
	List []ApplicationUserDetails `json:"application_users"`
}

ApplicationUsers holds a list of Freshservice application users

type Applications added in v0.0.2

type Applications struct {
	List []ApplicationDetails `json:"applications"`
}

Applications holds a list of Freshservice application details

type Asset added in v0.0.2

type Asset struct {
	Details AssetDetails `json:"asset"`
}

Asset holds the details of a specific Freshservice asset

type AssetDetails added in v0.0.2

type AssetDetails struct {
	ID           int       `json:"id"`
	DisplayID    int       `json:"display_id"`
	Name         string    `json:"name"`
	Description  string    `json:"description"`
	AssetTypeID  int       `json:"asset_type_id"`
	Impact       string    `json:"impact"`
	AuthorType   string    `json:"author_type"`
	UsageType    string    `json:"usage_type"`
	AssetTag     string    `json:"asset_tag"`
	UserID       int64     `json:"user_id"`
	LocationID   int64     `json:"location_id"`
	DepartmentID int64     `json:"department_id"`
	AgentID      int64     `json:"agent_id"`
	AssignedOn   time.Time `json:"assigned_on"`
	CreatedAt    time.Time `json:"created_at"`
	UpdatedAt    time.Time `json:"updated_at"`
}

AssetDetails are the details related to a specific asset in Freshservice

type AssetEmbedOptions added in v0.0.2

type AssetEmbedOptions struct {
	TypeFields bool
	Trashed    bool
}

AssetEmbedOptions will optonally embed desired metadata in an asset list response Each include will consume an additional 2 credits. For example if you embed the stats information you will be charged a total of 3 API credits (1 credit for the API call, and 2 credits for the additional stats embedding).

type AssetListOptions added in v0.0.2

type AssetListOptions struct {
	PageQuery string
	SortBy    *SortOptions
	Embed     *AssetEmbedOptions
}

AssetListOptions holds the available options that can be passed when requesting a list of Freshservice assets

func (*AssetListOptions) QueryString added in v0.0.2

func (opts *AssetListOptions) QueryString() string

QueryString allows us to pass AssetListOptions as a QueryFilter and will return a new endpoint URL with query parameters attached

type AssetService added in v0.0.2

type AssetService interface {
	List(context.Context, QueryFilter) ([]AssetDetails, string, error)
	Get(context.Context, int) (*AssetDetails, error)
}

AssetService is an interface for interacting with the asset endpoints of the Freshservice API

type AssetServiceClient added in v0.0.2

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

AssetServiceClient facilitates requests with the AssetService methods

func (*AssetServiceClient) Get added in v0.0.2

func (a *AssetServiceClient) Get(ctx context.Context, assetID int) (*AssetDetails, error)

Get a specific asset

func (*AssetServiceClient) List added in v0.0.2

List all Assets Append the parameter "page=[:page_no]" in the url to traverse through pages.

type Assets added in v0.0.2

type Assets struct {
	List []AssetDetails `json:"assets"`
}

Assets holds a list of Freshservice asset details

type Attachment

type Attachment struct {
	ContentType   string    `json:"content_type"`
	Size          int       `json:"size"`
	Name          string    `json:"name"`
	AttachmentURL string    `json:"attachment_url"`
	CreatedAt     time.Time `json:"created_at"`
	UpdatedAt     time.Time `json:"updated_at"`
}

Attachment represents a ticket attachment

type BasicAuth

type BasicAuth struct {
	APIKey string
}

BasicAuth holds the basic auth requirements needed to utilize the Freshservice API

type BusinessHours

type BusinessHours struct {
	List []BusinessHoursDetails `json:"business_hours"`
}

BusinessHours holds the Business Hours Configurations in Freshservice

type BusinessHoursConfig

type BusinessHoursConfig struct {
	Details BusinessHoursDetails `json:"business_hours"`
}

BusinessHoursConfig holds a configuration for business hours in Freshservice

type BusinessHoursDetails

type BusinessHoursDetails struct {
	ID               int              `json:"id"`
	CreatedAt        time.Time        `json:"created_at"`
	UpdatedAt        time.Time        `json:"updated_at"`
	Name             string           `json:"name"`
	Description      string           `json:"description"`
	IsDefault        bool             `json:"is_default"`
	TimeZone         string           `json:"time_zone"`
	ServiceDeskHours ServiceDeskHours `json:"service_desk_hours"`
	ListOfHolidays   []WorkdayHoliday `json:"list_of_holidays"`
}

BusinessHoursDetails holds a configuration for business hours in Freshservice

type BusinessHoursService

type BusinessHoursService interface {
	List(context.Context) ([]BusinessHoursDetails, error)
	Get(context.Context, int) (*BusinessHoursDetails, error)
}

BusinessHoursService is an interface for interacting with the business hours endpoints of the Freshservice API

type BusinessHoursServiceClient

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

BusinessHoursServiceClient facilitates requests with the AnnouncementService methods

func (*BusinessHoursServiceClient) Get

Get a details for a specific business hour configuration in Freshservice

func (*BusinessHoursServiceClient) List

List all business hours configured in Freshservice

type CarbonCopy

type CarbonCopy struct {
	CcEmails  []string `json:"cc_emails"`
	FwdEmails []string `json:"fwd_emails"`
	ReplyCc   []string `json:"reply_cc"`
	TktCc     []string `json:"tkt_cc"`
}

CarbonCopy manages the emails to be copied in on a ticket

type Client

type Client struct {
	// Freshservice domain
	Domain string
	// Context to leverage during the lifetime of the client
	Context context.Context

	// Basic Authentication requried for Freshservice API calls
	Auth *BasicAuth
	// contains filtered or unexported fields
}

Client represents a new Freshservice API client to be utilized for API requests

func New

func New(ctx context.Context, domain string, apikey string, client *http.Client) (*Client, error)

New returns a new Freshservice API client that can be used for both V1 and V2 of the Freshservice API

func (*Client) Agents

func (fs *Client) Agents() AgentService

Agents is the interface between the HTTP client and the Freshservice agent related endpoints

func (*Client) Announcements

func (fs *Client) Announcements() AnnouncementService

Announcements is the interface between the HTTP client and the Freshservice announcement related endpoints

func (*Client) Applications added in v0.0.2

func (fs *Client) Applications() ApplicationService

Application is the interface between the HTTP client and the Freshservice application related endpoints

func (*Client) Assets added in v0.0.2

func (fs *Client) Assets() AssetService

Asset is the interface between the HTTP client and the Freshservice asset related endpoints

func (*Client) BusinessHours

func (fs *Client) BusinessHours() BusinessHoursService

BusinessHours is the interface between the HTTP client and the Freshservice business hours related endpoints

func (*Client) ServiceCatalog

func (fs *Client) ServiceCatalog() ServiceCatalogService

ServiceCatalog is the interface between the HTTP client and the Freshservice service catalog related endpoints

func (*Client) Tasks

func (fs *Client) Tasks() TaskService

Tasks is the interface between the HTTP client and the Freshservice business hours related endpoints

func (*Client) Tickets

func (fs *Client) Tickets() TicketService

Tickets is the interface between the HTTP client and the Freshservice ticket related endpoints

type CustomFields

type CustomFields map[string]interface{}

CustomFields holds a mapping of custom ticket fields

type Error

type Error struct {
	Field   string `json:"field"` // Applicable to HTTP 400 errors only.
	Message string `json:"message"`
	Code    string `json:"code"`
}

Error holds the details of a Freshservice error

type ErrorResponse

type ErrorResponse struct {
	Description string  `json:"description"`
	Errors      []Error `json:"errors"`
}

ErrorResponse represents a Freshservice API error

type Licenses added in v0.0.2

type Licenses struct {
	List []LicensesDetails `json:"licenses"`
}

Licenses holds a list of Freshservice licenses for an application

type LicensesDetails added in v0.0.2

type LicensesDetails struct {
	ID          int       `json:"id"`
	ContractID  string    `json:"contract_id"`
	CreatedTime time.Time `json:"created_time"`
	UpdatedTime time.Time `json:"updated_time"`
}

LicenseDetails holds the details of a specific Freshservice application license

type QueryFilter

type QueryFilter interface {
	// QueryString should take return string with the query parameters attached
	QueryString() string
}

QueryFilter is an interface that can be passed around to Freshservice API methods that can accept a query param filter

type ServiceCatalog

type ServiceCatalog struct {
	Items []ServiceCatalogItemDetails `json:"service_items"`
}

ServiceCatalog represents a list of Freshservice service catalog items

type ServiceCatalogItem

type ServiceCatalogItem struct {
	Details ServiceCatalogItemDetails `json:"service_item"`
}

ServiceCatalogItem represents a specifc Freshservice service catalog item

type ServiceCatalogItemDetails

type ServiceCatalogItemDetails struct {
	ID                     int               `json:"id"`
	CreatedAt              time.Time         `json:"created_at"`
	UpdatedAt              time.Time         `json:"updated_at"`
	Name                   string            `json:"name"`
	DeliveryTime           int               `json:"delivery_time"`
	DisplayID              int               `json:"display_id"`
	CategoryID             int               `json:"category_id"`
	ProductID              int               `json:"product_id"`
	Quantity               int               `json:"quantity"`
	Deleted                bool              `json:"deleted"`
	IconName               string            `json:"icon_name"`
	GroupVisibility        int               `json:"group_visibility"`
	ItemType               int               `json:"item_type"`
	CiTypeID               int               `json:"ci_type_id"`
	CostVisibility         bool              `json:"cost_visibility"`
	DeliveryTimeVisibility bool              `json:"delivery_time_visibility"`
	Configs                map[string]string `json:"configs"`
	Botified               bool              `json:"botified"`
	Visibility             int               `json:"visibility"`
	AllowAttachments       bool              `json:"allow_attachments"`
	AllowQuantity          bool              `json:"allow_quantity"`
	IsBundle               bool              `json:"is_bundle"`
	CreateChild            bool              `json:"create_child"`
	Description            string            `json:"description"`
	ShortDescription       string            `json:"short_description"`
	Cost                   string            `json:"cost"`
	CustomFields           []interface{}     `json:"custom_fields"`
	ChildItems             []interface{}     `json:"child_items"`
}

ServiceCatalogItemDetails holds the details for a specific Freshservice service catalog item

type ServiceCatalogItemListFilter

type ServiceCatalogItemListFilter struct {
	CatalogID int
}

ServiceCatalogItemListFilter are the available filter options for a service catalog API list request

func (*ServiceCatalogItemListFilter) QueryString

func (scf *ServiceCatalogItemListFilter) QueryString() string

QueryString allows the available filter items to meet the QueryFilter interface

type ServiceCatalogService

type ServiceCatalogService interface {
	List(context.Context, QueryFilter) ([]ServiceCatalogItemDetails, error)
	Categories(context.Context) ([]ServiceCategory, error)
	Get(context.Context, int) (*ServiceCatalogItemDetails, error)
}

ServiceCatalogService is an interface for interacting with the service catalog endpoints of the Freshservice API

type ServiceCatalogServiceClient

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

ServiceCatalogServiceClient facilitates requests with the ServiceCatalogService methods

func (*ServiceCatalogServiceClient) Categories

Categories will list all service catalog item categories in freshservice

func (*ServiceCatalogServiceClient) Get

Get a specific service category item from Freshservice via the item's ID

func (*ServiceCatalogServiceClient) List

List all service category items in Freshservice Optional filter: category_id=[category_id]

type ServiceCategories

type ServiceCategories struct {
	List []ServiceCategory `json:"service_categories"`
}

ServiceCategories represents service catalog item categories in Freshservice

type ServiceCategory

type ServiceCategory struct {
	Description string    `json:"description"`
	ID          int       `json:"id"`
	CreatedAt   time.Time `json:"created_at"`
	UpdatedAt   time.Time `json:"updated_at"`
	Name        string    `json:"name"`
	Position    int       `json:"position"`
}

ServiceCategory represents a category assigned to a service catalog item in Freshservice

type ServiceDeskHours

type ServiceDeskHours struct {
	Monday    WorkdayHours `json:"monday"`
	Tuesday   WorkdayHours `json:"tuesday"`
	Wednesday WorkdayHours `json:"wednesday"`
	Thursday  WorkdayHours `json:"thursday"`
	Friday    WorkdayHours `json:"friday"`
}

ServiceDeskHours contains the time at which the workday begins and ends for the seven days of the week.

type SortOptions

type SortOptions struct {
	Ascending  bool
	Descending bool
}

SortOptions will opitionally sort the ticket list results

type Task

type Task struct {
	Details TaskDetails `json:"task"`
}

Task holds the details of a specific Freshservice task

type TaskDetails

type TaskDetails struct {
	ID           int       `json:"id"`
	AgentID      int       `json:"agent_id"`
	Status       int       `json:"status"`
	DueDate      time.Time `json:"due_date"`
	NotifyBefore int       `json:"notify_before"`
	Title        string    `json:"title"`
	Description  string    `json:"description"`
	CreatedAt    time.Time `json:"created_at"`
	UpdatedAt    time.Time `json:"updated_at"`
	ClosedAt     int       `json:"closed_at"`
	GroupID      int       `json:"group_id"`
}

TaskDetails are the details related to a specific task in Freshservice

type TaskService

type TaskService interface {
	List(context.Context, int) ([]TaskDetails, error)
	Create(context.Context, int, *TaskDetails) (*TaskDetails, error)
	Get(context.Context, int, int) (*TaskDetails, error)
	Update(context.Context, int, int, *TaskDetails) (*TaskDetails, error)
	Delete(context.Context, int, int) error
}

TaskService is an interface for interacting with the task endpoints of the Freshservice API

type TaskServiceClient

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

TaskServiceClient facilitates requests with the TicketService methods

func (*TaskServiceClient) Create

func (c *TaskServiceClient) Create(ctx context.Context, tickID int, td *TaskDetails) (*TaskDetails, error)

Create a task on a given ticket by ID

func (*TaskServiceClient) Delete

func (c *TaskServiceClient) Delete(ctx context.Context, tickID int, tid int) error

Delete a specific task for a given ticket ID Note: Deleted tasks are permanently lost. You can't retrieve them once it's get deleted.

func (*TaskServiceClient) Get

func (c *TaskServiceClient) Get(ctx context.Context, tickID int, tid int) (*TaskDetails, error)

Get a specific task assigned to a given ticket ID

func (*TaskServiceClient) List

func (c *TaskServiceClient) List(ctx context.Context, tickID int) ([]TaskDetails, error)

List all tasks assigned to a given ticket ID

func (*TaskServiceClient) Update

func (c *TaskServiceClient) Update(ctx context.Context, tickID int, tid int, td *TaskDetails) (*TaskDetails, error)

Update a specific task for a given ticket ID

type Tasks

type Tasks struct {
	List []TaskDetails `json:"tasks"`
}

Tasks holds a list of Freshservice task details

type Ticket

type Ticket struct {
	Details TicketDetails `json:"ticket,omitempty"`
}

Ticket represents a Freshservice ticket object

type TicketDetails

type TicketDetails struct {
	CcEmails        []string     `json:"cc_emails"`
	FwdEmails       []string     `json:"fwd_emails"`
	ReplyCcEmails   []string     `json:"reply_cc_emails"`
	FrEscalated     bool         `json:"fr_escalated"`
	Spam            bool         `json:"spam"`
	EmailConfigID   int          `json:"email_config_id"`
	GroupID         int          `json:"group_id"`
	Priority        int          `json:"priority"`
	RequesterID     int          `json:"requester_id"`
	ResponderID     int          `json:"responder_id"`
	Source          int          `json:"source"`
	Status          int          `json:"status"`
	Subject         string       `json:"subject"`
	ToEmails        []string     `json:"to_emails"`
	SLAPolicyID     int          `json:"sla_policy_id"`
	DepartmentID    int          `json:"department_id"`
	ID              int          `json:"id"`
	Type            string       `json:"type"`
	DueBy           time.Time    `json:"due_by"`
	FrDueBy         time.Time    `json:"fr_due_by"`
	IsEscalated     bool         `json:"is_escalated"`
	Description     string       `json:"description"`
	DescriptionText string       `json:"description_text"`
	CustomFields    CustomFields `json:"custom_fields"`
	CreatedAt       time.Time    `json:"created_at"`
	UpdatedAt       time.Time    `json:"updated_at"`
	Urgency         int          `json:"urgency"`
	Impact          int          `json:"impact"`
	Category        string       `json:"category"`
	SubCategory     string       `json:"sub_category"`
	ItemCategory    string       `json:"item_category"`
	Deleted         bool         `json:"deleted"`
	Attachments     []Attachment `json:"attachments"`
}

TicketDetails contains the specific ticket details

type TicketEmbedOptions

type TicketEmbedOptions struct {
	Stats         bool
	RequesterInfo bool
}

TicketEmbedOptions will optonally embed desired metadata in a ticket list response Each include will consume an additional 2 credits. For example if you embed the stats information you will be charged a total of 3 API credits (1 credit for the API call, and 2 credits for the additional stats embedding).

type TicketFilter

type TicketFilter struct {
	NewAndMyOpen   bool
	Watching       bool
	Spam           bool
	Deleted        bool
	RequesterID    *int
	RequesterEmail *string
	UpdatedSince   *time.Time
	Type           *string
}

TicketFilter are optional filters that can be enabled when querying a ticket list

type TicketListOptions

type TicketListOptions struct {
	PageQuery string
	FilterBy  *TicketFilter
	SortBy    *SortOptions
	Embed     *TicketEmbedOptions
}

TicketListOptions holds the available options that can be passed when requesting a list of Freshservice ticketsx

func (*TicketListOptions) QueryString

func (opts *TicketListOptions) QueryString() string

QueryString allows us to pass TicketListOptions as a QueryFilter and will return a new endpoint URL with query parameters attached

type TicketNote

type TicketNote struct {
	Details TicketNoteDetails `json:"note"`
}

TicketNote represents a note added to a Freshservice ticket

type TicketNoteDetails

type TicketNoteDetails struct {
	ID           int64        `json:"id"` // Read-Only
	UserID       int64        `json:"user_id"`
	Source       int          `json:"source"`
	Incoming     bool         `json:"incoming"`
	Private      bool         `json:"private"`
	CreatedAt    string       `json:"created_at"`
	UpdatedAt    string       `json:"updated_at"`
	Deleted      bool         `json:"deleted"`
	Body         string       `json:"body"`
	BodyHTML     string       `json:"body_html"`   // Mandatory
	Attachments  []Attachment `json:"attachments"` // Read-Only
	SupportEmail interface{}  `json:"support_email"`
}

TicketNoteDetails holds the details of a note added to a Freshservice ticket

type TicketService

type TicketService interface {
	List(context.Context, QueryFilter) ([]TicketDetails, string, error)
	Create(context.Context, *TicketDetails) (*TicketDetails, error)
	CreateWithAttachment() (*Ticket, error)
	Get(context.Context, int, QueryFilter) (*TicketDetails, error)
	Update(context.Context, int, *TicketDetails) (*TicketDetails, error)
	Delete(context.Context, int) error
}

TicketService is an interface for interacting with the ticket endpoints of the Freshservice API

type TicketServiceClient

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

TicketServiceClient facilitates requests with the TicketService methods

func (*TicketServiceClient) Create

Create a new Freshservice ticket

func (*TicketServiceClient) CreateWithAttachment

func (t *TicketServiceClient) CreateWithAttachment() (*Ticket, error)

CreateWithAttachment creates new Freshservice ticket with attachment

func (*TicketServiceClient) Delete

func (t *TicketServiceClient) Delete(ctx context.Context, id int) error

Delete Freshservice ticket

func (*TicketServiceClient) Get

Get a specific Freshservice ticket by Ticket ID. By default, certain fields such as conversations, tags and requester email will not be included in the response. They can be retrieved via the embedding functionality.

func (*TicketServiceClient) List

List all Freshservice tickets All the below requests are paginated to return only 30 tickets per page. Append the parameter "page=[:page_no]" in the url to traverse through pages.

func (*TicketServiceClient) Update

func (t *TicketServiceClient) Update(ctx context.Context, id int, details *TicketDetails) (*TicketDetails, error)

Update a Freshservice ticket

type Tickets

type Tickets struct {
	List []TicketDetails `json:"tickets"`
}

Tickets holds a list of tickets returned from the Freshservice API

type WorkdayHoliday

type WorkdayHoliday struct {
	HolidayDate string `json:"holiday_date"`
	HolidayName string `json:"holiday_name"`
}

WorkdayHoliday holds a configured holiday for the year. Dates are in ISO --MM-DD format.

type WorkdayHours

type WorkdayHours struct {
	BeginningOfWorkday string `json:"beginning_of_workday"`
	EndOfWorkday       string `json:"end_of_workday"`
}

WorkdayHours contains the time at which the workday begins and ends

Jump to

Keyboard shortcuts

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