zendeskfake

package
v0.20260720.0 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2026 License: MPL-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TicketsJSONPath = apiPrefix + "/tickets.json"
	SearchJSONPath  = apiPrefix + "/search.json"
	TicketsPath     = apiPrefix + "/tickets/"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Server

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

func NewServer

func NewServer(tokenEmail, apiToken string, s *Store) *Server

NewServer creates a new Server with the specified user and token. If no store is provided, it creates a new Store with the default capacity.

func (*Server) GetTicket

func (s *Server) GetTicket(id int64) (ticket, bool)

GetTicket retrieves a ticket by its ID directly from the inner store. It returns a copy of the ticket to ensure that the original ticket in the store is never modified. If the ticket does not exist, it returns false.

func (*Server) Handler

func (s *Server) Handler() http.Handler

Handler returns an HTTP handler that serves the Zendesk fake API.

type Store

type Store struct {
	sync.Mutex
	// contains filtered or unexported fields
}

Store is a thread-safe in-memory store for tickets. It uses a stack to store the tickets and a map to quickly access them by ID. The stack has a fixed capacity, and when it is full, the oldest ticket is removed to make room.

func NewStore

func NewStore(capacity int) *Store

NewStore creates a new Store with the specified capacity. If no capacity is specified, it defaults to 200 tickets.

Jump to

Keyboard shortcuts

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