pss

package
v1.14.0 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2022 License: MIT Imports: 3 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

Functions

This section is empty.

Types

type Attachment

type Attachment struct {
	Name string `json:"name"`
}

Attachment represents a PSS attachment

type AttachmentNotFoundError

type AttachmentNotFoundError struct {
	Name string
}

AttachmentNotFoundError indicates a attachment was not found

func (*AttachmentNotFoundError) Error

func (e *AttachmentNotFoundError) Error() string

type Author

type Author struct {
	ID   int        `json:"id"`
	Name string     `json:"name"`
	Type AuthorType `json:"type"`
}

Author represents a PSS request author

type AuthorType

type AuthorType string
const (
	AuthorTypeClient  AuthorType = "Client"
	AuthorTypeAuto    AuthorType = "Auto"
	AuthorTypeSupport AuthorType = "Support"
)

func ParseAuthorType

func ParseAuthorType(s string) (AuthorType, error)

ParseAuthorType attempts to parse a AuthorType from string

func (AuthorType) String

func (s AuthorType) String() string

type CreateFeedbackRequest

type CreateFeedbackRequest struct {
	ContactID         int    `json:"contact_id"`
	Score             int    `json:"score"`
	Comment           string `json:"comment"`
	SpeedResolved     int    `json:"speed_resolved"`
	Quality           int    `json:"quality"`
	NPSScore          int    `json:"nps_score"`
	ThirdPartyConsent bool   `json:"thirdparty_consent"`
}

CreateFeedbackRequest represents a request to create PSS request feedback

type CreateReplyRequest

type CreateReplyRequest struct {
	connection.APIRequestBodyDefaultValidator

	Author      Author `json:"author" validate:"required"`
	Description string `json:"description" validate:"required"`
}

CreateReplyRequest represents a request to create a PSS request reply

func (*CreateReplyRequest) Validate

Validate returns an error if struct properties are missing/invalid

type CreateRequestRequest

type CreateRequestRequest struct {
	connection.APIRequestBodyDefaultValidator

	Author            Author          `json:"author" validate:"required"`
	Secure            bool            `json:"secure"`
	Priority          RequestPriority `json:"priority" validate:"required"`
	Subject           string          `json:"subject" validate:"required"`
	Details           string          `json:"details" validate:"required"`
	CC                []string        `json:"cc,omitempty"`
	RequestSMS        bool            `json:"request_sms"`
	CustomerReference string          `json:"customer_reference,omitempty"`
	Product           *Product        `json:"product,omitempty"`
}

CreateRequestRequest represents a request to create a PSS request

func (*CreateRequestRequest) Validate

Validate returns an error if struct properties are missing/invalid

type Feedback

type Feedback struct {
	ID               int                 `json:"id"`
	ContactID        int                 `json:"contact_id"`
	Score            int                 `json:"score"`
	Comment          string              `json:"comment"`
	SpeedResolved    int                 `json:"speed_resolved"`
	Quality          int                 `json:"quality"`
	NPSScore         int                 `json:"nps_score"`
	ThirdPartConsent bool                `json:"thirdparty_consent"`
	CreatedAt        connection.DateTime `json:"created_at"`
}

Feedback represents PSS feedback

type PSSService

type PSSService interface {
	CreateRequest(req CreateRequestRequest) (int, error)
	GetRequests(parameters connection.APIRequestParameters) ([]Request, error)
	GetRequestsPaginated(parameters connection.APIRequestParameters) (*connection.Paginated[Request], error)
	GetRequest(requestID int) (Request, error)
	PatchRequest(requestID int, req PatchRequestRequest) error

	GetRequestFeedback(requestID int) (Feedback, error)
	CreateRequestFeedback(requestID int, req CreateFeedbackRequest) (int, error)

	CreateRequestReply(requestID int, req CreateReplyRequest) (string, error)
	GetRequestReplies(solutionID int, parameters connection.APIRequestParameters) ([]Reply, error)
	GetRequestRepliesPaginated(solutionID int, parameters connection.APIRequestParameters) (*connection.Paginated[Reply], error)
	GetRequestConversation(requestID int, parameters connection.APIRequestParameters) ([]Reply, error)
	GetRequestConversationPaginated(requestID int, parameters connection.APIRequestParameters) (*connection.Paginated[Reply], error)

	GetReply(replyID string) (Reply, error)

	DownloadReplyAttachmentStream(replyID string, attachmentName string) (contentStream io.ReadCloser, err error)
	UploadReplyAttachmentStream(replyID string, attachmentName string, fileStream io.Reader) (err error)
	DeleteReplyAttachment(replyID string, attachmentName string) error
}

PSSService is an interface for managing PSS

type PatchRequestRequest

type PatchRequestRequest struct {
	Secure     *bool           `json:"secure,omitempty"`
	Read       *bool           `json:"read,omitempty"`
	Priority   RequestPriority `json:"priority,omitempty"`
	Status     RequestStatus   `json:"status,omitempty"`
	RequestSMS *bool           `json:"request_sms,omitempty"`
	Archived   *bool           `json:"archived,omitempty"`
}

PatchRequestRequest represents a PSS Request patch request

type Product

type Product struct {
	ID   int    `json:"id"`
	Name string `json:"name"`
	Type string `json:"type"`
}

Product represents a product to which the request applies to

type Reply

type Reply struct {
	ID          string              `json:"id"`
	RequestID   int                 `json:"request_id"`
	Author      Author              `json:"author"`
	Description string              `json:"description"`
	Attachments []Attachment        `json:"attachments"`
	Read        bool                `json:"read"`
	CreatedAt   connection.DateTime `json:"created_at"`
}

Reply represents a PSS reply

type ReplyNotFoundError

type ReplyNotFoundError struct {
	ID string
}

ReplyNotFoundError indicates a reply was not found

func (*ReplyNotFoundError) Error

func (e *ReplyNotFoundError) Error() string

type Request

type Request struct {
	ID                int                 `json:"id"`
	Author            Author              `json:"author"`
	Type              string              `json:"type"`
	Secure            bool                `json:"secure"`
	Subject           string              `json:"subject"`
	CreatedAt         connection.DateTime `json:"created_at"`
	Priority          RequestPriority     `json:"priority"`
	Archived          bool                `json:"archived"`
	Status            RequestStatus       `json:"status"`
	RequestSMS        bool                `json:"request_sms"`
	Version           int                 `json:"version"`
	CustomerReference string              `json:"customer_reference"`
	Product           Product             `json:"product"`
	LastRepliedAt     connection.DateTime `json:"last_replied_at"`
	CC                []string            `json:"cc"`
	UnreadReplies     int                 `json:"unread_replies"`
	ContactMethod     string              `json:"contact_method"`
}

Request represents a PSS request

type RequestFeedbackNotFoundError

type RequestFeedbackNotFoundError struct {
	RequestID int
}

RequestFeedbackNotFoundError indicates feedback for a request was not found

func (*RequestFeedbackNotFoundError) Error

type RequestNotFoundError

type RequestNotFoundError struct {
	ID int
}

RequestNotFoundError indicates a request was not found

func (*RequestNotFoundError) Error

func (e *RequestNotFoundError) Error() string

type RequestPriority

type RequestPriority string
const (
	RequestPriorityNormal   RequestPriority = "Normal"
	RequestPriorityHigh     RequestPriority = "High"
	RequestPriorityCritical RequestPriority = "Critical"
)

func ParseRequestPriority

func ParseRequestPriority(s string) (RequestPriority, error)

ParseRequestPriority attempts to parse a RequestPriority from string

func (RequestPriority) String

func (s RequestPriority) String() string

type RequestStatus

type RequestStatus string
const (
	RequestStatusCompleted                RequestStatus = "Completed"
	RequestStatusAwaitingCustomerResponse RequestStatus = "Awaiting Customer Response"
	RequestStatusRepliedAndCompleted      RequestStatus = "Replied and Completed"
	RequestStatusSubmitted                RequestStatus = "Submitted"
)

func ParseRequestStatus

func ParseRequestStatus(s string) (RequestStatus, error)

ParseRequestStatus attempts to parse a RequestStatus from string

func (RequestStatus) String

func (s RequestStatus) String() string

type Service

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

Service implements PSSService for managing PSS via the UKFast API

func NewService

func NewService(connection connection.Connection) *Service

NewService returns a new instance of PSSService

func (*Service) CreateRequest

func (s *Service) CreateRequest(req CreateRequestRequest) (int, error)

CreateRequest creates a new request

func (*Service) CreateRequestFeedback

func (s *Service) CreateRequestFeedback(requestID int, req CreateFeedbackRequest) (int, error)

CreateRequestFeedback creates a new request feedback

func (*Service) CreateRequestReply

func (s *Service) CreateRequestReply(requestID int, req CreateReplyRequest) (string, error)

CreateRequestReply creates a new request reply

func (*Service) DeleteReplyAttachment

func (s *Service) DeleteReplyAttachment(replyID string, attachmentName string) error

DeleteReplyAttachment removes a reply attachment

func (*Service) DownloadReplyAttachmentStream

func (s *Service) DownloadReplyAttachmentStream(replyID string, attachmentName string) (contentStream io.ReadCloser, err error)

DownloadReplyAttachmentStream downloads the provided attachment, returning a stream of the file contents and an error

func (*Service) GetReply

func (s *Service) GetReply(replyID string) (Reply, error)

GetReply retrieves a single reply by id

func (*Service) GetRequest

func (s *Service) GetRequest(requestID int) (Request, error)

GetRequest retrieves a single request by id

func (*Service) GetRequestConversation

func (s *Service) GetRequestConversation(solutionID int, parameters connection.APIRequestParameters) ([]Reply, error)

GetRequestConversation retrieves a list of replies

func (*Service) GetRequestConversationPaginated

func (s *Service) GetRequestConversationPaginated(solutionID int, parameters connection.APIRequestParameters) (*connection.Paginated[Reply], error)

GetRequestConversationPaginated retrieves a paginated list of domains

func (*Service) GetRequestFeedback

func (s *Service) GetRequestFeedback(requestID int) (Feedback, error)

GetRequestFeedback retrieves feedback for a request

func (*Service) GetRequestReplies

func (s *Service) GetRequestReplies(solutionID int, parameters connection.APIRequestParameters) ([]Reply, error)

GetRequestReplies is an alias for GetRequestConversation

func (*Service) GetRequestRepliesPaginated

func (s *Service) GetRequestRepliesPaginated(solutionID int, parameters connection.APIRequestParameters) (*connection.Paginated[Reply], error)

GetRequestRepliesPaginated is an alias for GetRequestConversationPaginated

func (*Service) GetRequests

func (s *Service) GetRequests(parameters connection.APIRequestParameters) ([]Request, error)

GetRequests retrieves a list of requests

func (*Service) GetRequestsPaginated

func (s *Service) GetRequestsPaginated(parameters connection.APIRequestParameters) (*connection.Paginated[Request], error)

GetRequestsPaginated retrieves a paginated list of requests

func (*Service) PatchRequest

func (s *Service) PatchRequest(requestID int, req PatchRequestRequest) error

PatchRequest patches a request

func (*Service) UploadReplyAttachmentStream

func (s *Service) UploadReplyAttachmentStream(replyID string, attachmentName string, stream io.Reader) (err error)

UploadReplyAttachmentStream uploads the provided attachment

Jump to

Keyboard shortcuts

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