Documentation ¶
Index ¶
- Constants
- func WithSetBasicAuth(username, password string) uhttp.RequestOption
- type Agent
- type AgentDetailAPIData
- type AgentGroup
- type AgentGroupDetailAPIData
- type AgentGroupsAPIData
- type AgentRole
- type AgentsAPIData
- type Choice
- type CustomField
- type CustomFieldOption
- type FieldOptions
- type FreshServiceClient
- func (f *FreshServiceClient) AddRequesterToRequesterGroup(ctx context.Context, requesterGroupId string, requesterId string) (annotations.Annotations, error)
- func (f *FreshServiceClient) CreateServiceRequest(ctx context.Context, serviceCatalogItemID string, ...) (*ServiceRequest, annotations.Annotations, error)
- func (f *FreshServiceClient) DeleteRequesterFromRequesterGroup(ctx context.Context, requesterGroupId string, requesterId string) (annotations.Annotations, error)
- func (f *FreshServiceClient) GetAgentDetail(ctx context.Context, userId string) (*AgentDetailAPIData, annotations.Annotations, error)
- func (f *FreshServiceClient) GetAgentGroupDetail(ctx context.Context, groupId string) (*AgentGroupDetailAPIData, annotations.Annotations, error)
- func (f *FreshServiceClient) GetCategoryID() string
- func (f *FreshServiceClient) GetDomain() string
- func (f *FreshServiceClient) GetServiceItem(ctx context.Context, serviceItemID string) (*ServiceItem, error)
- func (f *FreshServiceClient) GetTicket(ctx context.Context, ticketId string) (*TicketDetails, annotations.Annotations, error)
- func (f *FreshServiceClient) GetTicketFields(ctx context.Context) (*TicketFieldsResponse, error)
- func (f *FreshServiceClient) GetTicketStatuses(ctx context.Context) ([]*v2.TicketStatus, error)
- func (f *FreshServiceClient) ListAgentGroups(ctx context.Context, opts PageOptions) (*AgentGroupsAPIData, string, annotations.Annotations, error)
- func (f *FreshServiceClient) ListAgentUsers(ctx context.Context, opts PageOptions) (*AgentsAPIData, string, annotations.Annotations, error)
- func (f *FreshServiceClient) ListRequesterGroupMembers(ctx context.Context, requesterGroupId string, opts PageOptions) (*requesterGroupMembersAPIData, string, annotations.Annotations, error)
- func (f *FreshServiceClient) ListRequesterGroups(ctx context.Context, opts PageOptions) (*RequesterGroupsAPIData, string, annotations.Annotations, error)
- func (f *FreshServiceClient) ListRequesterUsers(ctx context.Context, opts PageOptions) (*requestersAPIData, string, annotations.Annotations, error)
- func (f *FreshServiceClient) ListRoles(ctx context.Context, opts PageOptions) (*RolesAPIData, string, annotations.Annotations, error)
- func (f *FreshServiceClient) ListServiceCatalogItems(ctx context.Context, opts PageOptions) (*ServiceCatalogItemsListResponse, annotations.Annotations, string, error)
- func (f *FreshServiceClient) UpdateAgentGroupMembers(ctx context.Context, groupId string, usersId []int64) (annotations.Annotations, error)
- func (f *FreshServiceClient) UpdateAgentRoles(ctx context.Context, roleIDs []AgentRole, userId string) (annotations.Annotations, error)
- func (f *FreshServiceClient) UpdateTicket(ctx context.Context, ticketID string, payload *TicketUpdatePayload) (*TicketDetails, annotations.Annotations, error)
- func (f *FreshServiceClient) WithBearerToken(apiToken string) *FreshServiceClient
- func (f *FreshServiceClient) WithCategoryID(categoryID string) *FreshServiceClient
- func (f *FreshServiceClient) WithDomain(domain string) *FreshServiceClient
- type NestedField
- type PageOptions
- type ReqOpt
- type RequesterGroup
- type RequesterGroupMember
- type RequesterGroupsAPIData
- type Requesters
- type Roles
- type RolesAPIData
- type Section
- type ServiceCatalogItemResponse
- type ServiceCatalogItemsListResponse
- type ServiceItem
- type ServiceRequest
- type ServiceRequestPayload
- type ServiceRequestResponse
- type TicketDetails
- type TicketField
- type TicketFieldsResponse
- type TicketResponse
- type TicketUpdatePayload
- type UpdateAgentRoles
Constants ¶
const ItemsPerPage = 100
By default, the number of objects returned per page is 30. The maximum number of objects that can be retrieved per page is 100 https://api.freshservice.com/v2/#pagination
const ServiceItemVisibilityDraft = 1
Variables ¶
This section is empty.
Functions ¶
func WithSetBasicAuth ¶
func WithSetBasicAuth(username, password string) uhttp.RequestOption
Types ¶
type Agent ¶
type Agent struct { Active bool `json:"active,omitempty"` Address string `json:"address,omitempty"` Email string `json:"email,omitempty"` FirstName string `json:"first_name,omitempty"` ID int64 `json:"id,omitempty"` LastName string `json:"last_name,omitempty"` Roles []AgentRole `json:"roles,omitempty"` }
type AgentDetailAPIData ¶
type AgentDetailAPIData struct {
Agent Agent `json:"agent,omitempty"`
}
type AgentGroup ¶
type AgentGroupDetailAPIData ¶
type AgentGroupDetailAPIData struct {
Group AgentGroup `json:"group,omitempty"`
}
type AgentGroupsAPIData ¶
type AgentGroupsAPIData struct {
Groups []AgentGroup `json:"groups,omitempty"`
}
type AgentsAPIData ¶
type AgentsAPIData struct {
Agents []Agent `json:"agents,omitempty"`
}
type CustomField ¶
type CustomField struct { ID string `json:"id"` Label string `json:"label"` Name string `json:"name"` FieldType string `json:"field_type"` ItemID int64 `json:"item_id"` Required bool `json:"required"` Choices [][]string `json:"choices"` FieldOptions FieldOptions `json:"field_options"` NestedFields []interface{} `json:"nested_fields"` Deleted bool `json:"deleted"` }
type CustomFieldOption ¶
type CustomFieldOption func(serviceRequestPayload *ServiceRequestPayload)
func WithCustomField ¶
func WithCustomField(id string, value interface{}) CustomFieldOption
type FieldOptions ¶
type FieldOptions struct { VisibleInAgentPortal string `json:"visible_in_agent_portal"` PDF string `json:"pdf"` IMAPIName string `json:"im_api_name"` RequiredForCreate string `json:"required_for_create"` RequesterCanEdit string `json:"requester_can_edit"` VisibleInPublic string `json:"visible_in_public"` RequiredForClosure string `json:"required_for_closure"` DisplayedToRequester string `json:"displayed_to_requester"` Placeholder string `json:"placeholder"` // Used for dynamic dropdown Link string `json:"link"` DataSource string `json:"data_source"` Conditions string `json:"conditions"` SameAsAgent string `json:"same_as_agent"` }
type FreshServiceClient ¶
type FreshServiceClient struct {
// contains filtered or unexported fields
}
func New ¶
func New(ctx context.Context, freshServiceClient *FreshServiceClient) (*FreshServiceClient, error)
func NewClient ¶
func NewClient() *FreshServiceClient
func (*FreshServiceClient) AddRequesterToRequesterGroup ¶
func (f *FreshServiceClient) AddRequesterToRequesterGroup( ctx context.Context, requesterGroupId string, requesterId string, ) (annotations.Annotations, error)
AddRequesterToRequesterGroup. Add Requester to Requester Group. https://api.freshservice.com/v2/#add_member_to_requester_group
func (*FreshServiceClient) CreateServiceRequest ¶
func (f *FreshServiceClient) CreateServiceRequest(ctx context.Context, serviceCatalogItemID string, payload *ServiceRequestPayload) (*ServiceRequest, annotations.Annotations, error)
func (*FreshServiceClient) DeleteRequesterFromRequesterGroup ¶
func (f *FreshServiceClient) DeleteRequesterFromRequesterGroup( ctx context.Context, requesterGroupId string, requesterId string, ) (annotations.Annotations, error)
DeleteRequesterFromRequesterGroup. Delete Requester from Requester Group. https://api.freshservice.com/v2/#delete_member_from_requester_group
func (*FreshServiceClient) GetAgentDetail ¶
func (f *FreshServiceClient) GetAgentDetail(ctx context.Context, userId string) (*AgentDetailAPIData, annotations.Annotations, error)
GetAgentDetail. Get agent detail. https://api.freshservice.com/v2/#view_an_agent
func (*FreshServiceClient) GetAgentGroupDetail ¶
func (f *FreshServiceClient) GetAgentGroupDetail(ctx context.Context, groupId string) (*AgentGroupDetailAPIData, annotations.Annotations, error)
GetAgentGroupDetail. List All Agents in a Group. https://api.freshservice.com/v2/#view_a_group
func (*FreshServiceClient) GetCategoryID ¶
func (f *FreshServiceClient) GetCategoryID() string
func (*FreshServiceClient) GetDomain ¶
func (f *FreshServiceClient) GetDomain() string
func (*FreshServiceClient) GetServiceItem ¶
func (f *FreshServiceClient) GetServiceItem(ctx context.Context, serviceItemID string) (*ServiceItem, error)
func (*FreshServiceClient) GetTicket ¶
func (f *FreshServiceClient) GetTicket(ctx context.Context, ticketId string) (*TicketDetails, annotations.Annotations, error)
func (*FreshServiceClient) GetTicketFields ¶
func (f *FreshServiceClient) GetTicketFields(ctx context.Context) (*TicketFieldsResponse, error)
TODO(lauren) this can take workspace_id as query param
func (*FreshServiceClient) GetTicketStatuses ¶
func (f *FreshServiceClient) GetTicketStatuses(ctx context.Context) ([]*v2.TicketStatus, error)
func (*FreshServiceClient) ListAgentGroups ¶
func (f *FreshServiceClient) ListAgentGroups(ctx context.Context, opts PageOptions) (*AgentGroupsAPIData, string, annotations.Annotations, error)
func (*FreshServiceClient) ListAgentUsers ¶
func (f *FreshServiceClient) ListAgentUsers(ctx context.Context, opts PageOptions) (*AgentsAPIData, string, annotations.Annotations, error)
func (*FreshServiceClient) ListRequesterGroupMembers ¶
func (f *FreshServiceClient) ListRequesterGroupMembers(ctx context.Context, requesterGroupId string, opts PageOptions) (*requesterGroupMembersAPIData, string, annotations.Annotations, error)
https://api.freshservice.com/v2/#list_members_of_requester_group
func (*FreshServiceClient) ListRequesterGroups ¶
func (f *FreshServiceClient) ListRequesterGroups(ctx context.Context, opts PageOptions) (*RequesterGroupsAPIData, string, annotations.Annotations, error)
func (*FreshServiceClient) ListRequesterUsers ¶
func (f *FreshServiceClient) ListRequesterUsers(ctx context.Context, opts PageOptions) (*requestersAPIData, string, annotations.Annotations, error)
func (*FreshServiceClient) ListRoles ¶
func (f *FreshServiceClient) ListRoles(ctx context.Context, opts PageOptions) (*RolesAPIData, string, annotations.Annotations, error)
func (*FreshServiceClient) ListServiceCatalogItems ¶
func (f *FreshServiceClient) ListServiceCatalogItems(ctx context.Context, opts PageOptions) (*ServiceCatalogItemsListResponse, annotations.Annotations, string, error)
TODO(lauren) this can take workspace_id as query param TODO(lauren) this can take category as query param
func (*FreshServiceClient) UpdateAgentGroupMembers ¶
func (f *FreshServiceClient) UpdateAgentGroupMembers(ctx context.Context, groupId string, usersId []int64) (annotations.Annotations, error)
UpdateAgentGroupMembers. Update the existing agent group to add another agent to the group https://api.freshservice.com/v2/#update_a_group
func (*FreshServiceClient) UpdateAgentRoles ¶
func (f *FreshServiceClient) UpdateAgentRoles(ctx context.Context, roleIDs []AgentRole, userId string) (annotations.Annotations, error)
UpdateAgentRoles. Update an Agent. https://api.freshservice.com/v2/#update_an_agent
func (*FreshServiceClient) UpdateTicket ¶
func (f *FreshServiceClient) UpdateTicket(ctx context.Context, ticketID string, payload *TicketUpdatePayload) (*TicketDetails, annotations.Annotations, error)
func (*FreshServiceClient) WithBearerToken ¶
func (f *FreshServiceClient) WithBearerToken(apiToken string) *FreshServiceClient
func (*FreshServiceClient) WithCategoryID ¶
func (f *FreshServiceClient) WithCategoryID(categoryID string) *FreshServiceClient
func (*FreshServiceClient) WithDomain ¶
func (f *FreshServiceClient) WithDomain(domain string) *FreshServiceClient
type NestedField ¶
type NestedField struct { Name string `json:"name"` ID int `json:"id"` Label string `json:"label"` LabelInPortal string `json:"label_in_portal"` Level int `json:"level"` Description string `json:"description"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` FieldID int `json:"field_id"` }
type PageOptions ¶
PageOptions is options for list method of paginatable resources. It's used to create query string.
type ReqOpt ¶
func WithPage ¶
Number for the page (inclusive). The page number starts with 1. If page is 0, first page is assumed.
func WithQueryParam ¶
type RequesterGroup ¶
type RequesterGroupMember ¶
type RequesterGroupsAPIData ¶
type RequesterGroupsAPIData struct {
RequesterGroups []RequesterGroup `json:"requester_groups,omitempty"`
}
type Requesters ¶
type Requesters struct { Active bool `json:"active,omitempty"` Address string `json:"address,omitempty"` FirstName string `json:"first_name,omitempty"` ID int64 `json:"id,omitempty"` IsAgent bool `json:"is_agent,omitempty"` LastName string `json:"last_name,omitempty"` PrimaryEmail string `json:"primary_email,omitempty"` }
type RolesAPIData ¶
type RolesAPIData struct {
Roles []Roles `json:"roles,omitempty"`
}
type ServiceCatalogItemResponse ¶
type ServiceCatalogItemResponse struct {
ServiceItem *ServiceItem `json:"service_item"`
}
type ServiceCatalogItemsListResponse ¶
type ServiceCatalogItemsListResponse struct {
ServiceItems []*ServiceItem `json:"service_items"`
}
type ServiceItem ¶
type ServiceItem struct { ID int64 `json:"id"` Name string `json:"name"` DisplayID int64 `json:"display_id"` CustomFields []CustomField `json:"custom_fields"` CategoryID int64 `json:"category_id"` ProductID *int64 `json:"product_id"` Deleted bool `json:"deleted"` ItemType int `json:"item_type"` CITypeID *int64 `json:"ci_type_id"` Visibility int `json:"visibility"` // 1 denotes draft and 2 denotes published. WorkspaceID int `json:"workspace_id"` IsBundle bool `json:"is_bundle"` CreateChild bool `json:"create_child"` ChildItems []interface{} `json:"child_items"` }
type ServiceRequest ¶
type ServiceRequest struct { ApprovalStatusName string `json:"approval_status_name"` ApprovalStatus string `json:"approval_status"` TicketDetails }
type ServiceRequestPayload ¶
type ServiceRequestResponse ¶
type ServiceRequestResponse struct {
ServiceRequest *ServiceRequest `json:"service_request"`
}
type TicketDetails ¶
type TicketDetails struct { ID int `json:"id"` Type string `json:"type"` RequesterID int `json:"requester_id"` RequestedForID int `json:"requested_for_id"` ResponderID *int `json:"responder_id"` Source int `json:"source"` Status int `json:"status"` Subject string `json:"subject"` WorkspaceID int `json:"workspace_id"` Description string `json:"description"` DescriptionText string `json:"description_text"` CustomFields interface{} `json:"custom_fields"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` Category *string `json:"category"` SubCategory *string `json:"sub_category"` ItemCategory *string `json:"item_category"` Deleted bool `json:"deleted"` ApprovalStatus int `json:"approval_status"` ApprovalStatusName string `json:"approval_status_name"` Tags []string `json:"tags"` }
type TicketField ¶
type TicketField struct { ID int `json:"id"` WorkspaceID *int `json:"workspace_id,omitempty"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` Name string `json:"name"` Label string `json:"label"` Description string `json:"description"` FieldType string `json:"field_type"` Required bool `json:"required"` RequiredForClosure bool `json:"required_for_closure"` DefaultField bool `json:"default_field"` Choices []Choice `json:"choices"` NestedFields []NestedField `json:"nested_fields"` Sections []Section `json:"sections"` BelongsToSection bool `json:"belongs_to_section"` }
type TicketFieldsResponse ¶
type TicketFieldsResponse struct {
TicketFields []TicketField `json:"ticket_fields"`
}
type TicketResponse ¶
type TicketResponse struct {
Ticket *TicketDetails `json:"ticket"`
}
type TicketUpdatePayload ¶
type TicketUpdatePayload struct { Description string `json:"description,omitempty"` Subject string `json:"subject,omitempty"` Tags []string `json:"tags,omitempty"` }
Ticket models.
type UpdateAgentRoles ¶
type UpdateAgentRoles struct {
Roles []AgentRole `json:"roles"`
}