Documentation
¶
Index ¶
- Constants
- func GetCredentials() (string, string)
- type Address
- type Asset
- type AssetItem
- type AssetList
- type AssetType
- type AssetTypeItem
- type AssetTypeList
- type Attachment
- type Attachments
- type Client
- func (c *Client) CreateAsset(asset *Asset) (*Asset, error)
- func (c *Client) CreateAssetType(at *AssetType) (*AssetType, error)
- func (c *Client) CreateLocation(loc *Location) (*Location, error)
- func (c *Client) CreateProduct(prod *Product) (*Product, error)
- func (c *Client) CreateRequester(new *NewRequester) (Requester, error)
- func (c *Client) CreateTicket(ticket *NewTicket, attachments ...UploadAttachment) (*Ticket, error)
- func (c *Client) CreateTicketNote(note *NewNote, ticket int, attachments ...UploadAttachment) (*Note, error)
- func (c *Client) CreateTicketReply(reply *NewReply, ticketId int, attachments ...UploadAttachment) (*Reply, error)
- func (c *Client) DeleteAsset(displayID int) error
- func (c *Client) DeleteTicket(Id int) (err error)
- func (c *Client) FilterAllTickets(query string) ([]Ticket, error)
- func (c *Client) FilterTickets(query string, page int) ([]Ticket, error)
- func (c *Client) GetRequesterByEmail(email string) (requester *Requester, err error)
- func (c *Client) GetRequesterByWorkPhone(workPhone string) (requester *Requester, err error)
- func (c *Client) ListAllAssetTypes() ([]AssetType, error)
- func (c *Client) ListAllAssets(options url.Values) ([]Asset, error)
- func (c *Client) ListAllLocations() ([]Location, error)
- func (c *Client) ListAllProducts(options url.Values) ([]Product, error)
- func (c *Client) ListAllRequesters(options url.Values) (result RequesterSearchResults, err error)
- func (c *Client) ListAllTickets(options url.Values) ([]Ticket, error)
- func (c *Client) ListAssetTypes(page int) ([]AssetType, error)
- func (c *Client) ListAssets(page int, options url.Values) ([]Asset, error)
- func (c *Client) ListLocations(page int) ([]Location, error)
- func (c *Client) ListProducts(page int, options url.Values) ([]Product, error)
- func (c *Client) ListTickets(page int, options url.Values) ([]Ticket, error)
- func (c *Client) POSTRequest(req *http.Request, out interface{}) error
- func (c *Client) ReadObject(path string, obj interface{}, options url.Values) error
- func (c *Client) TicketFields(workspaceId int) (fields []TicketField, err error)
- func (c *Client) UpdateTicket(id int, changes *NewTicket, bypass bool) (result *Ticket, err error)
- func (c *Client) WalkPagedObjects(path string, options url.Values, f func(resp *http.Response) (err error)) (err error)
- func (c *Client) WriteObject(path string, method string, in interface{}, out interface{}) error
- type Conversation
- type Location
- type LocationItem
- type LocationList
- type NewNote
- type NewReply
- type NewRequester
- type NewTicket
- type Note
- type Product
- type ProductItem
- type ProuctList
- type Reply
- type ReplyItem
- type Requester
- type RequesterResponse
- type RequesterSearch
- type RequesterSearchResults
- type Ticket
- type TicketField
- type TicketFieldList
- type TicketItem
- type TicketList
- type TicketResponse
- type UploadAttachment
Constants ¶
const ( TicketStatusOpen = iota + 2 TicketStatusPending TicketStatusResolved TicketStatusClosed )
const ( TicketPriorityLow = iota + 1 TicketPriorityMedium TicketPriorityHigh TicketPriorityUrgent )
const ( TicketSourceEmail = iota + 1 TicketSourcePortal TicketSourcePhone TicketSourceChat TicketSourceFeedbackWidget TicketSourceYammer TicketSourceAWSCloudwatch TicketSourcePagerduty TicketSourceWalkup TicketSourceSlack TicketSourceChatbot TicketSourceWorkplace TicketSourceEmployeeOnboarding TicketSourceAlerts TicketSourceMSTeams TicketSourceImport = 1001 )
Variables ¶
This section is empty.
Functions ¶
func GetCredentials ¶
GetCredentials of fresh service client from environment variables
Types ¶
type Address ¶
type Address struct { //Address line 1. Line1 string `json:"line1,omitempty"` //Address line 2. Line2 string `json:"line2,omitempty"` // Name of the City. City string `json:"city,omitempty"` //Name of the State. State string `json:"state,omitempty"` //Name of the Country. Country string `json:"country,omitempty"` //Zipcode of the location. Zipcode string `json:"zipcode,omitempty"` }
Address ...
type Asset ¶
type Asset struct { //ID Unique ID of the asset. ID int `json:"id,omitempty"` //DisplayID Display ID of the asset. DisplayID int `json:"display_id,omitempty"` //Name Name of the asset. Mandatory Name string `json:"name,omitempty"` //Description of the asset. Description string `json:"description,omitempty"` //ID of the asset type. Mandatory. AssetTypeID int `json:"asset_type_id,omitempty"` //Asset tag of the asset. AssetTag string `json:"asset_tag,omitempty"` //Impact of the asset. Impact string `json:"impact,omitempty"` // Indicates whether the asset was created by a user or discovery tools (Probe or Agent). AuthorType string `json:"author_type,omitempty"` //Usage type of the asset (Loaner / Permanent). UsageType string `json:"usage_type,omitempty"` //ID of the associated user (Used By). UserID int `json:"user_id,omitempty"` //ID of the associated location. LocationID int `json:"location_id,omitempty"` //ID of the associated department. DepartmentID int `json:"department_id,omitempty"` //ID of the associated agent (Managed By). AgentID int `json:"agent_id,omitempty"` //ID of the associated agent group (Managed By Group). GroupID int `json:"group_id,omitempty"` //Date and time when the asset was assigned. AssignedOn *time.Time `json:"assigned_on,omitempty"` //Date and time when the asset was created. CreatedAt *time.Time `json:"created_at,omitempty"` //Date and time when the asset was updated. UpdatedAt *time.Time `json:"updated_at,omitempty"` //TypeFields type specific fields TypeFields map[string]interface{} `json:"type_fields,omitempty"` }
Asset ...
type AssetItem ¶
type AssetItem struct {
Asset Asset `json:"asset,omitempty"`
}
AssetItem holds one asset
type AssetList ¶
type AssetList struct {
Assets []Asset `json:"assets,omitempty"`
}
AssetList holds a list of assets
type AssetType ¶
type AssetType struct { //ID Unique ID of the asset type. ID int `json:"id,omitempty"` //Name Name of the asset type. Name string `json:"name,omitempty"` //Description Short description of the asset type. Description string `json:"description,omitempty"` //IParentAssetTypeID D of the parent asset type. ParentAssetTypeID int `json:"parent_asset_type_id,omitempty"` //Visible Visibility of the default asset type. Set to true if the asset type is visible. Custom asset types are set to true by default and cannot be modified. Visible bool `json:"visible,omitempty"` //Date and time when the asset type was created CreatedAt *time.Time `json:"created_at,omitempty"` //Date and time when the asset type was last updated UpdatedAt *time.Time `json:"updated_at,omitempty"` }
AssetType Asset types are a broad classification of different collection of assets.
type AssetTypeItem ¶
type AssetTypeItem struct {
AssetType AssetType `json:"asset_type,omitempty"`
}
AssetTypeItem ....
type AssetTypeList ¶
type AssetTypeList struct {
AssetTypes []AssetType `json:"asset_types,omitempty"`
}
AssetTypeList ...
type Attachment ¶
type Attachment struct { Id int `json:"id,omitempty"` ContentType string `json:"content_type,omitempty"` Size int `json:"size,omitempty"` Name string `json:"name,omitempty"` AttachmentUrl string `json:"attachment_url,omitempty"` CreatedAt time.Time `json:"created_at,omitempty"` UpdatedAt time.Time `json:"updated_at,omitempty"` }
type Attachments ¶
type Attachments []Attachment
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is the freshservice client
func (*Client) CreateAsset ¶
CreateAsset creates an asset
func (*Client) CreateAssetType ¶
CreateAssetType creates am asset type
func (*Client) CreateLocation ¶
CreateLocation creates a location
func (*Client) CreateProduct ¶
CreateProduct creates a procuct
func (*Client) CreateRequester ¶
func (c *Client) CreateRequester(new *NewRequester) (Requester, error)
func (*Client) CreateTicket ¶
func (c *Client) CreateTicket(ticket *NewTicket, attachments ...UploadAttachment) (*Ticket, error)
CreateTicket creates a ticket
func (*Client) CreateTicketNote ¶
func (c *Client) CreateTicketNote(note *NewNote, ticket int, attachments ...UploadAttachment) (*Note, error)
CreateTicketNote creates a ticket reply
func (*Client) CreateTicketReply ¶
func (c *Client) CreateTicketReply(reply *NewReply, ticketId int, attachments ...UploadAttachment) (*Reply, error)
CreateTicketReply creates a ticket reply
func (*Client) DeleteAsset ¶
DeleteAsset deletes an asset
func (*Client) DeleteTicket ¶
func (*Client) FilterTickets ¶
func (*Client) GetRequesterByEmail ¶
func (*Client) GetRequesterByWorkPhone ¶
func (*Client) ListAllAssetTypes ¶
ListAllAssetTypes ...
func (*Client) ListAllAssets ¶
ListAllAssets ...
func (*Client) ListAllLocations ¶
ListAllLocations read all locations
func (*Client) ListAllProducts ¶
ListAllProducts read all products
func (*Client) ListAllRequesters ¶
func (c *Client) ListAllRequesters(options url.Values) (result RequesterSearchResults, err error)
func (*Client) ListAllTickets ¶
ListAllTickets lists all tickets
func (*Client) ListAssetTypes ¶
ListAssetTypes ...
func (*Client) ListAssets ¶
ListAssets ...
func (*Client) ListLocations ¶
ListLocations get locations by page
func (*Client) ListProducts ¶
ListProducts get products by page
func (*Client) ListTickets ¶
ListTickets get locations by page
func (*Client) POSTRequest ¶
POSTRequest writes object with the provided method, using content-type multipart/form-data
func (*Client) ReadObject ¶
ReadObject reads an object with GET method
func (*Client) TicketFields ¶
func (c *Client) TicketFields(workspaceId int) (fields []TicketField, err error)
func (*Client) UpdateTicket ¶
type Conversation ¶
type Conversation struct {
Note `json:"conversation"`
}
type Location ¶
type Location struct { //Unique ID of the location. ID int `json:"id,omitempty"` //Name of the location. Name string `json:"name,omitempty"` //ID of the parent location. ParentLocationID int `json:"parent_location_id,omitempty"` //User ID of the primary contact (must be a user in Freshservice). PrimaryContactID int `json:"primary_contact_id,omitempty"` //Address ... Address Address `json:"address,omitempty"` //Date and time when the location was created CreatedAt *time.Time `json:"created_at,omitempty"` //Date and time when the location was last updated UpdatedAt *time.Time `json:"updated_at,omitempty"` }
Location ...
type LocationItem ¶
type LocationItem struct {
Location Location `json:"location,omitempty"`
}
LocationItem holds one location
type LocationList ¶
type LocationList struct {
Locations []Location `json:"locations,omitempty"`
}
LocationList holds a list of locations
type NewNote ¶
type NewNote struct { Body string `json:"body"` //Content of the note in HTML format UserID int `json:"user_id,omitempty"` //ID of the agent/user who is adding the note NotifyEmails []string `json:"notify_emails,omitempty"` //Email addresses of agents/users who need to be notified about this note Private bool `json:"private"` //Set to true if the note is private. The default value is true. Incoming bool `json:"incoming"` // Set to true if a particular note should appear as being created from the outside (i.e., not through the web portal). The default value is false }
type NewReply ¶
type NewReply struct { Body string `json:"body" schema:"body"` FromEmail string `json:"from_email,omitempty"` UserID int `json:"user_id,omitempty"` CCEmails []string `json:"cc_emails,omitempty"` BCCEmails []string `json:"bcc_emails,omitempty"` }
NewReply what you should send when you're making a new reply
type NewRequester ¶
type NewRequester struct { FirstName string `json:"first_name"` // First name of the requester. MANDATORY LastName string `json:"last_name,omitempty"` // Last name of the requester. JobTitle string `json:"job_title,omitempty"` // Job title of the requester. PrimaryEmail string `json:"primary_email,omitempty"` // Primary email address of the requester. SecondaryEmails []string `json:"secondary_emails,omitempty"` // Additional/secondary emails associated with the requester. WorkPhoneNumber string `json:"work_phone_number,omitempty"` // Work phone number of the requester. MobilePhoneNumber string `json:"mobile_phone_number,omitempty"` // Mobile phone number of the requester. DepartmentIDs []int `json:"department_ids[],omitempty"` // Unique IDs of the departments associated with the requester. CanSeeAllTicketsFromAssociatedDepartments bool `json:"can_see_all_tickets_from_associated_departments,omitempty"` // Set to true if the requester must be allowed to view tickets filed by other members of the department, and false otherwise. ReportingManagerID int `json:"reporting_manager_id,omitempty"` // User ID of the requester’s reporting manager. Address string `json:"address,omitempty"` // Address of the requester. TimeZone string `json:"time_zone,omitempty"` // Time zone of the requester. TimeFormat string `json:"time_format,omitempty"` // Time format for the requester. Possible values: 12h (12 hour format), 24h (24 hour format) Language string `json:"language,omitempty"` // Language used by the requester. The default language is “en” (English). LocationID int `json:"location_id,omitempty"` // Unique ID of the location associated with the requester. BackgroundInformation string `json:"background_information,omitempty"` // Background information of the requester. CustomFields map[string]string `json:"custom_fields,omitempty"` // Key-value pair containing the names and values of the (custom) requester fields. }
type NewTicket ¶
type NewTicket struct { Id int `json:"id,omitempty" ` // Workspace ID of the ticket. Only applicable for accounts with workspaces enabled WorkspaceId int `json:"workspace_id,omitempty" ` // Name of the requester Name string `json:"name,omitempty" ` // User ID of the requester. For existing contacts, the requester_id can be passed instead of the requester's email. // RequesterId int `json:"requester_id,omitempty" ` // Email address of the requester. If no contact exists with this email address in Freshservice, it will be added as a new contact. Email string `json:"email,omitempty" ` // Phone number of the requester. If no contact exists with this phone number in Freshservice, it will be added as a new contact. Phone string `json:"phone,omitempty" ` // Subject of the ticket. The default value is null. Subject string `json:"subject,omitempty" ` // Type Helps categorize the ticket according to the different kinds of issues your support team deals with. The default Value is incident. * As of now, API v2 supports only type ‘incident’ Type string `json:"type,omitempty" ` // Status of the ticket. Status int `json:"status,omitempty" ` // Priority of the ticket. Priority int `json:"priority,omitempty" ` // Description HTML content of the ticket. Description string `json:"description,omitempty" ` // ID of the agent assigned ResponderId int `json:"responder_id,omitempty" ` // attachments Attachments Attachments `json:"-" ` // CCEmails Email address added in the 'cc' field of the incoming ticket email. CCEmails []string `json:"cc_emails,omitempty" ` // CustomFields Key value pairs containing the names and values of custom fields. CustomFields map[string]interface{} `json:"custom_fields,omitempty"` // DueBy Timestamp that denotes when the ticket is due to be resolved. DueBy *time.Time `json:"due_by,omitempty" ` // ID of the group to which the ticket has been assigned. The default value is the ID of the group that is associated with the given email_config_id GroupID int `json:"group_id,omitempty"` // Source The channel through which the ticket was created. Source int `json:"source,omitempty" ` // Tags Tags that have been associated with the ticket. Tags []string `json:"tags,omitempty" ` // DepartmentID // Category Tags that have been associated with the ticket. Category string `json:"category,omitempty" ` // SubCategory // ItemCategory // Assets List of assets associated with the ticket Assets []Asset `json:"assets,omitempty" ` }
NewTicket see here: https://api.freshservice.com/v2/#ticket_attributes
type Note ¶
type Note struct { Id int `json:"id"` Incoming bool `json:"incoming"` Private bool `json:"private"` UserId int `json:"user_id"` SupportEmail interface{} `json:"support_email"` Body string `json:"body"` BodyText string `json:"body_text"` TicketId int `json:"ticket_id"` ToEmails []interface{} `json:"to_emails"` Attachments Attachments `json:"attachments"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` }
type Product ¶
type Product struct { //Unique ID of the product. ID int `json:"id,omitempty"` //Name of the Product. Name string `json:"name,omitempty"` //ID of the asset type(must be a type in Freshservice) AssetTypeID int `json:"asset_type_id,omitempty"` //Manufacturer of the product Manufacturer string `json:"manufacturer,omitempty"` //Status of the product. Status string `json:"status,omitempty"` //Mode of procurement of the product. ModeOfProcurement string `json:"mode_of_procurement,omitempty"` //ID of the depreciation type. DepreciationTypeID int `json:"depreciation_type_id,omitempty"` //HTML Content of the product. Description string `json:"description,omitempty"` //Description of the product in plain text. DescriptionText string `json:"description_text,omitempty"` //Date and time when the product was created CreatedAt string `json:"created_at,omitempty"` //Date and time when the product was last updated UpdatedAt string `json:"updated_at,omitempty"` }
Product ...
type ProductItem ¶
type ProductItem struct {
Product Product `json:"product,omitempty"`
}
ProductItem holds one prouct
type ProuctList ¶
type ProuctList struct {
Products []Product `json:"products,omitempty"`
}
ProuctList holds a list of products
type Reply ¶
type Reply struct { Id int `json:"id,omitempty"` Body string `json:"body"` Attachments Attachments `json:"attachments,omitempty"` FromEmail string `json:"from_email,omitempty"` UserID int `json:"user_id,omitempty"` ToEmails []string `json:"to_emails,omitempty"` CCEmails []string `json:"cc_emails,omitempty"` BCCEmails []string `json:"bcc_emails,omitempty"` CreatedAt time.Time `json:"created_at,omitempty"` UpdatedAt time.Time `json:"updated_at,omitempty"` }
Reply What you get when you get replies
type Requester ¶
type Requester struct { Active bool `json:"active"` Address string `json:"address"` IsAgent bool `json:"is_agent"` BackgroundInformation string `json:"background_information"` CanSeeAllTicketsFromAssociatedDepartments bool `json:"can_see_all_tickets_from_associated_departments"` CreatedAt time.Time `json:"created_at"` CustomFields any `json:"custom_fields"` DepartmentIds []interface{} `json:"department_ids"` ExternalId interface{} `json:"external_id"` FirstName string `json:"first_name"` HasLoggedIn bool `json:"has_logged_in"` Id int `json:"id"` JobTitle string `json:"job_title"` Language string `json:"language"` LastName string `json:"last_name"` LocationId interface{} `json:"location_id"` MobilePhoneNumber string `json:"mobile_phone_number"` PrimaryEmail string `json:"primary_email"` ReportingManagerId interface{} `json:"reporting_manager_id"` SecondaryEmails []string `json:"secondary_emails"` TimeFormat string `json:"time_format"` TimeZone string `json:"time_zone"` UpdatedAt time.Time `json:"updated_at"` WorkPhoneNumber string `json:"work_phone_number"` }
type RequesterResponse ¶
type RequesterResponse struct {
Requester `json:"requester"`
}
type RequesterSearch ¶
type RequesterSearch struct { FirstName string `json:"first_name,omitempty"` // First name of the requester. LastName string `json:"last_name,omitempty"` // Last name of the requester. Name string `json:"name,omitempty"` // Concatenation of first_name and last_name with single space in-between fields. JobTitle string `json:"job_title,omitempty"` // Title of the requester. PrimaryEmail string `json:"primary_email,omitempty"` // Email address of the requester. WorkPhoneNumber string `json:"work_phone_number,omitempty"` // Work phone of the requester. MobilePhoneNumber string `json:"mobile_phone_number,omitempty"` // Mobile phone of the requester. DepartmentID int `json:"department_id,omitempty"` // ID of the department(s) assigned to the requester. ReportingManagerID int `json:"reporting_manager_id,omitempty"` // ID of the reporting manager. TimeZone string `json:"time_zone,omitempty"` // ID of the department. Language string `json:"language,omitempty"` // Language code (Eg. en, ja-JP). LocationID int `json:"location_id,omitempty"` // ID of the location. CreatedAt string `json:"created_at,omitempty"` // Date (YYYY-MM-DD) when the requester is created. UpdatedAt string `json:"updated_at,omitempty"` // Date (YYYY-MM-DD) when the requester is updated. IncludeAgents bool `json:"include_agents,omitempty"` }
type RequesterSearchResults ¶
type RequesterSearchResults struct {
Requesters []Requester `json:"requesters"`
}
type Ticket ¶
type Ticket struct { CcEmails []string `json:"cc_emails"` FwdEmails []interface{} `json:"fwd_emails"` ReplyCcEmails []string `json:"reply_cc_emails"` FrEscalated bool `json:"fr_escalated"` Spam bool `json:"spam"` EmailConfigId interface{} `json:"email_config_id"` GroupId interface{} `json:"group_id"` Priority int `json:"priority"` RequesterId int `json:"requester_id"` RequestedForId int `json:"requested_for_id"` ResponderId interface{} `json:"responder_id"` Source int `json:"source"` Status int `json:"status"` Subject string `json:"subject"` ToEmails interface{} `json:"to_emails"` DepartmentId interface{} `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"` Category interface{} `json:"category"` SubCategory interface{} `json:"sub_category"` ItemCategory interface{} `json:"item_category"` CustomFields struct { AutoCheckbox interface{} `json:"auto_checkbox"` } `json:"custom_fields"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` Tags []interface{} `json:"tags"` Attachments []interface{} `json:"attachments"` WorkspaceId int `json:"workspace_id"` }
type TicketField ¶
type TicketField struct { ID int `json:"id"` Label string `json:"label"` Description string `json:"description"` FieldType string `json:"field_type"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` Position int `json:"position"` RequiredForClosure bool `json:"required_for_closure"` Name string `json:"name"` DefaultField bool `json:"default_field"` RequiredForAgents bool `json:"required_for_agents"` CustomersCanEdit bool `json:"customers_can_edit"` LabelForCustomers string `json:"label_for_customers"` RequiredForCustomers bool `json:"required_for_customers"` DisplayedToCustomers bool `json:"displayed_to_customers"` BelongsToSection bool `json:"belongs_to_section"` Choices []any `json:"choices"` NestedFields []any `json:"nested_fields"` Sections []any `json:"sections"` WorkspaceID any `json:"workspace_id"` PortalCc bool `json:"portal_cc,omitempty"` PortalccTo string `json:"portalcc_to,omitempty"` }
type TicketFieldList ¶
type TicketFieldList struct {
TicketFields []TicketField `json:"ticket_fields"`
}
type TicketItem ¶
type TicketItem struct {
Ticket Ticket `json:"ticket,omitempty"`
}
TicketItem holds one ticket
type TicketList ¶
type TicketList struct {
Tickets []Ticket `json:"tickets,omitempty"`
}
TicketList holds a list of tickets
type TicketResponse ¶
type TicketResponse struct {
Ticket `json:"ticket"`
}
type UploadAttachment ¶
UploadAttachment content is a struct which contains a file's name, its type and its data for uploading