Documentation ¶
Index ¶
- Constants
- func StringPtr(s string) *string
- type Config
- type EdgesResponse
- type ErrorResponse
- type GraphsResponse
- type NodesResponse
- type Server
- func (s *Server) Close(ctx context.Context) error
- func (s *Server) CreateEdge(c *fiber.Ctx) error
- func (s *Server) CreateGraph(c *fiber.Ctx) error
- func (s *Server) CreateNode(c *fiber.Ctx) error
- func (s *Server) DeleteEdge(c *fiber.Ctx) error
- func (s *Server) DeleteEdgeBetween(c *fiber.Ctx) error
- func (s *Server) DeleteGraph(c *fiber.Ctx) error
- func (s *Server) DeleteNodeByID(c *fiber.Ctx) error
- func (s *Server) DeleteNodeByUID(c *fiber.Ctx) error
- func (s *Server) GetAllEdges(c *fiber.Ctx) error
- func (s *Server) GetAllGraphs(c *fiber.Ctx) error
- func (s *Server) GetEdgeByUID(c *fiber.Ctx) error
- func (s *Server) GetGraphByUID(c *fiber.Ctx) error
- func (s *Server) GetNodeByID(c *fiber.Ctx) error
- func (s *Server) GetNodeByUID(c *fiber.Ctx) error
- func (s *Server) GetNodes(c *fiber.Ctx) error
- func (s *Server) Listen() error
- func (s *Server) UpdateEdgeBetween(c *fiber.Ctx) error
- func (s *Server) UpdateGraph(c *fiber.Ctx) error
- func (s *Server) UpdateNode(c *fiber.Ctx) error
Constants ¶
const (
// DefaultLimit defines default results limit
DefaultLimit = 20
)
Variables ¶
This section is empty.
Functions ¶
Types ¶
type EdgesResponse ¶
EdgesReponse is returned when querying edges.
type ErrorResponse ¶
type ErrorResponse struct {
Error string `json:"error"`
}
ErrorResponse represents a JSON structure for error output.
type GraphsResponse ¶
GraphsResponse is returned when querying graphs.
type NodesResponse ¶
NodesResponse is returned when querying nodes.
type Server ¶
type Server struct { // Addr is bind address Addr string // GraphService provides access to Graph endpoints. GraphService api.GraphService // NodeService provides access to Node endpoints. NodeService api.NodeService // EdgeService provides access to Edge endpoints. EdgeService api.EdgeService // contains filtered or unexported fields }
Server is an HTTP server used to provide REST API access for various Graph API endpoints.
func (*Server) CreateEdge ¶
CreateEdge creates a new graph edge between two nodes. @Summary Create new graph edge. @Description Create a new graph edge and return it. @Tags edges @Accept json @Produce json @Param graph body api.Edge true "Create a edge" @Success 200 {object} api.Edge @Failure 400 {object} ErrorResponse @Failure 404 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /v1/graphs/{guid}/edges [post]
func (*Server) CreateGraph ¶
CreateGraph creates a new graph. @Summary Create new graph. @Description Create new graph. @Tags graphs @Accept json @Produce json @Param graph body api.Graph true "Create a graph" @Success 200 {object} api.Graph @Failure 400 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /v1/graphs [post]
func (*Server) CreateNode ¶
CreateNode creates a new graph node. @Summary Create new graph node. @Description Create a new graph node and returns it. @Tags nodes @Accept json @Produce json @Param graph body api.Node true "Create a node" @Success 200 {object} api.Node @Failure 400 {object} ErrorResponse @Failure 404 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /v1/graphs/{guid}/nodes [post]
func (*Server) DeleteEdge ¶
DeleteEdge deletes graph edge with the given UID. @Summary Delete graph edge by UID. @Description Delete graph edge with the given UID. @Tags edges @Produce json @Param guid path string true "Graph UID" @Param uid path string true "Edge UID" @Success 204 {string} status "Edge was deleted successfully" @Failure 404 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /v1/graphs/{guid}/edges/{uid} [delete]
func (*Server) DeleteEdgeBetween ¶
DeleteEdgeBetween deletes a graph edge between two nodes. @Summary Delete graph edge between two nodes. @Description Delete graph edge between nodes with given IDs. @Tags edges @Produce json @Param uid path string true "Graph UID" @Param source query int false "Source node ID" @Param target query int false "Target node ID" @Success 204 {string} status "Edge was deleted successfully" @Failure 400 {object} ErrorResponse @Failure 404 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /v1/graphs/{guid}/edges [delete]
func (*Server) DeleteGraph ¶
DeleteGraph deletes graph by uid. @Summary Delete graph by UID. @Description Delete graph with the given UID. @Tags graphs @Produce json @Param uid path string true "Graph UID" @Success 204 {string} status "Graph was deleted successfully" @Failure 404 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /v1/graphs/{uid} [delete]
func (*Server) DeleteNodeByID ¶
DeleteNodeByID deletes a graph node by id. @Summary Delete graph node by ID. @Description Delete graph node with the given ID. @Tags nodes @Produce json @Param uid path string true "Graph UID" @Param id path string true "Node ID" @Success 204 {string} status "Node was deleted successfully" @Failure 400 {object} ErrorResponse @Failure 404 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /v1/graphs/{guid}/nodes/{id} [delete]
func (*Server) DeleteNodeByUID ¶
DeleteNodeByUID deletes a graph node by UID. @Summary Delete graph node by UID. @Description Delete graph node with the given UID. @Tags nodes @Produce json @Param uid path string true "Graph UID" @Param id path string true "Node ID" @Success 204 {string} status "Node was deleted successfully" @Failure 404 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /v1/graphs/{guid}/nodes/uid/{uid} [delete]
func (*Server) GetAllEdges ¶
GetAllEdges returns all edges in the graph matching a query. @Summary Get graph edges matching a filter. @Description Get all edges matching a query. @Tags edges @Produce json @Param offset query int false "Result offset" @Param limit query int false "Result limit" @Param label query string false "Node label" @Param guid path string true "Graph UID" @Success 200 {object} EdgesResponse @Failure 404 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /v1/graphs/{guid}/edges [get]
func (*Server) GetAllGraphs ¶
GetAllGraphs returns all available graphs. @Summary Get all graphs @Description Get all available graphs. @Tags graphs @Produce json @Param offset query int false "Result offset" @Param limit query int false "Result limit" @Success 200 {object} GraphsResponse @Failure 500 {object} ErrorResponse @Router /v1/graphs [get]
func (*Server) GetEdgeByUID ¶
GetEdgeByUID returns graph edge with the given UID. @Summary Get graph edge by UID. @Description Get graph a single graph edge with the given UID. @Tags edges @Produce json @Param guid path string true "Graph UID" @Param uid path string true "Edge UID" @Success 200 {object} api.Edge @Failure 404 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /v1/graphs/{guid}/edges/{uid} [get]
func (*Server) GetGraphByUID ¶
GetGraphByUID returns graph with the given UID. @Summary Get graph by UID. @Description Get graph returns graph with the given UID. @Tags graphs @Produce json @Param uid path string true "Graph UID" @Success 200 {object} api.Graph @Failure 404 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /v1/graphs/{uid} [get]
func (*Server) GetNodeByID ¶
GetNodeByID returns a single graph node with the given ID. @Summary Get graph node by ID. @Description Get a single graph node with the given ID. @Tags nodes @Produce json @Param guid path string true "Graph UID" @Param id path string true "Node ID" @Success 200 {object} api.Node @Failure 400 {object} ErrorResponse @Failure 404 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /v1/graphs/{guid}/nodes/{id} [get]
func (*Server) GetNodeByUID ¶
GetNodeByUID returns a single graph node with the given UID. @Summary Get graph node by UID. @Description Get graph returns a single graph node with the given UID. @Tags nodes @Produce json @Param guid path string true "Graph UID" @Param uid path string true "Node UID" @Success 200 {object} api.Node @Failure 404 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /v1/graphs/{guid}/nodes/uid/{uid} [get]
func (*Server) GetNodes ¶
GetNodes returns all nodes in the graph matching a query. @Summary Graph nodes matching a filter. @Description Get all nodes matching a query. @Tags nodes @Produce json @Param offset query int false "Result offset" @Param limit query int false "Result limit" @Param label query string false "Node label" @Param guid path string true "Graph UID" @Success 200 {object} NodesResponse @Failure 404 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /v1/graphs/{guid}/nodes [get]
func (*Server) Listen ¶
Listen validates the server options and starts listening on the bind address.
func (*Server) UpdateEdgeBetween ¶
UpdateEdgeBetween updates an existing edge between two nodes. @Summary Update graph edge between two existing nodes. @Description Update existing graph edge between the nodes with the given IDs. @Tags edges @Accept json @Produce json @Param uid path string true "Graph UID" @Param graph body api.EdgeUpdate true "Update an edge" @Param source query int false "Source node ID" @Param target query int false "Target node ID" @Success 200 {object} api.Edge @Failure 400 {object} ErrorResponse @Failure 404 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /v1/graphs/{guid}/edges [patch]
func (*Server) UpdateGraph ¶
UpdateGraph updates existing graph. @Summary Update graph @Description Update existing graph. @Tags graphs @Accept json @Produce json @Param uid path string true "Graph UID" @Param graph body api.GraphUpdate true "Update a graph" @Success 200 {object} api.Graph @Failure 400 {object} ErrorResponse @Failure 404 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /v1/graphs/{uid} [patch]
func (*Server) UpdateNode ¶
UpdateNode updates existing graph node. @Summary Update graph node. @Description Update existing graph node. @Tags nodes @Accept json @Produce json @Param uid path string true "Graph UID" @Param id path string true "Node ID" @Param graph body api.NodeUpdate true "Update a node" @Success 200 {object} api.Node @Failure 400 {object} ErrorResponse @Failure 404 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /v1/graphs/{guid}/nodes/{id} [patch]