client

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
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

View Source
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 AgentGroup struct {
	ID          int64   `json:"id,omitempty"`
	Name        string  `json:"name,omitempty"`
	Description string  `json:"description,omitempty"`
	Members     []int64 `json:"members,omitempty"`
}

type AgentGroupDetailAPIData

type AgentGroupDetailAPIData struct {
	Group AgentGroup `json:"group,omitempty"`
}

type AgentGroupsAPIData

type AgentGroupsAPIData struct {
	Groups []AgentGroup `json:"groups,omitempty"`
}

type AgentRole

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

type AgentsAPIData

type AgentsAPIData struct {
	Agents []Agent `json:"agents,omitempty"`
}

type Choice

type Choice struct {
	ID            int      `json:"id"`
	Value         string   `json:"value"`
	DisplayID     *int     `json:"display_id,omitempty"`
	NestedOptions []Choice `json:"nested_options,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

GetAgentDetail. Get agent detail. https://api.freshservice.com/v2/#view_an_agent

func (*FreshServiceClient) GetAgentGroupDetail

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 (*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) 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) ListRequesterUsers

func (f *FreshServiceClient) ListRequesterUsers(ctx context.Context, opts PageOptions) (*requestersAPIData, string, annotations.Annotations, error)

https://api.freshservice.com/v2/#list_all_requesters

func (*FreshServiceClient) ListServiceCatalogItems

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 (*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

type PageOptions struct {
	PerPage int `url:"limit,omitempty"`
	Page    int `url:"page,omitempty"`
}

PageOptions is options for list method of paginatable resources. It's used to create query string.

type ReqOpt

type ReqOpt func(reqURL *url.URL)

func WithPage

func WithPage(page int) ReqOpt

Number for the page (inclusive). The page number starts with 1. If page is 0, first page is assumed.

func WithPageLimit

func WithPageLimit(pageLimit int) ReqOpt

Number of items to return.

func WithQueryParam

func WithQueryParam(key string, value string) ReqOpt

type RequesterGroup

type RequesterGroup struct {
	ID          int64  `json:"id,omitempty"`
	Name        string `json:"name,omitempty"`
	Description string `json:"description,omitempty"`
	Type        string `json:"type,omitempty"`
}

type RequesterGroupMember

type RequesterGroupMember struct {
	ID        int    `json:"id,omitempty"`
	FirstName string `json:"first_name,omitempty"`
	LastName  string `json:"last_name,omitempty"`
	Email     string `json:"email,omitempty"`
}

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 Roles

type Roles struct {
	Description string   `json:"description,omitempty"`
	Privileges  []string `json:"privileges,omitempty"`
	ID          int64    `json:"id,omitempty"`
	Name        string   `json:"name,omitempty"`
	RoleType    int      `json:"role_type,omitempty"`
}

type RolesAPIData

type RolesAPIData struct {
	Roles []Roles `json:"roles,omitempty"`
}

type Section

type Section struct {
}

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 ServiceRequestPayload struct {
	RequestedFor string                 `json:"requested_for,omitempty"`
	Email        string                 `json:"email"`
	Quantity     int                    `json:"quantity"`
	CustomFields map[string]interface{} `json:"custom_fields"`
}

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"`
}

Jump to

Keyboard shortcuts

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