Documentation
¶
Index ¶
- type CreatePriceFeedRequest
- type Handler
- func (h *Handler) CreatePriceFeed(c *gin.Context)
- func (h *Handler) DeletePriceFeed(c *gin.Context)
- func (h *Handler) GetAllPrices(c *gin.Context)
- func (h *Handler) GetPrice(c *gin.Context)
- func (h *Handler) GetPriceFeed(c *gin.Context)
- func (h *Handler) GetPriceFeedHistory(c *gin.Context)
- func (h *Handler) GetPriceHistory(c *gin.Context)
- func (h *Handler) ListPriceFeeds(c *gin.Context)
- func (h *Handler) Register(router *gin.RouterGroup)
- func (h *Handler) TriggerPriceUpdate(c *gin.Context)
- func (h *Handler) UpdatePriceFeed(c *gin.Context)
- type UpdatePriceFeedRequest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CreatePriceFeedRequest ¶
type CreatePriceFeedRequest struct {
BaseToken string `json:"base_token" binding:"required"`
QuoteToken string `json:"quote_token" binding:"required"`
UpdateInterval string `json:"update_interval"`
DeviationThreshold float64 `json:"deviation_threshold"`
HeartbeatInterval string `json:"heartbeat_interval"`
ContractAddress string `json:"contract_address"`
}
CreatePriceFeedRequest is the request body for creating a price feed
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler handles price feed API endpoints
func NewHandler ¶
func NewHandler(priceFeedService *pricefeed.PriceFeedService, logger *logger.Logger) *Handler
NewHandler creates a new price feed handler
func (*Handler) CreatePriceFeed ¶
CreatePriceFeed creates a new price feed @Summary Create price feed @Description Create a new price feed configuration @Tags price-feeds @Accept json @Produce json @Param request body CreatePriceFeedRequest true "Price Feed Request" @Success 201 {object} models.PriceFeed @Failure 400 {object} common.ErrorResponse @Failure 500 {object} common.ErrorResponse @Router /api/v1/price-feeds [post]
func (*Handler) DeletePriceFeed ¶
DeletePriceFeed deletes a price feed @Summary Delete price feed @Description Delete a price feed configuration @Tags price-feeds @Produce json @Param id path int true "Price Feed ID" @Success 204 {object} nil @Failure 400 {object} common.ErrorResponse @Failure 500 {object} common.ErrorResponse @Router /api/v1/price-feeds/{id} [delete]
func (*Handler) GetAllPrices ¶
GetAllPrices gets current prices for all feeds @Summary Get all prices @Description Get current prices for all feeds @Tags public @Produce json @Success 200 {array} models.PriceData @Failure 500 {object} common.ErrorResponse @Router /api/v1/public/prices [get]
func (*Handler) GetPrice ¶
GetPrice gets the current price for a specific feed @Summary Get price @Description Get current price for a specific feed @Tags public @Produce json @Param id path int true "Price Feed ID" @Success 200 {object} models.PriceData @Failure 404 {object} common.ErrorResponse @Failure 500 {object} common.ErrorResponse @Router /api/v1/public/prices/{id} [get]
func (*Handler) GetPriceFeed ¶
GetPriceFeed gets a price feed by ID @Summary Get a price feed @Description Get details of a specific price feed by ID @Tags price-feeds @Produce json @Param id path int true "Price Feed ID" @Success 200 {object} models.PriceFeed @Failure 404 {object} common.ErrorResponse @Failure 500 {object} common.ErrorResponse @Router /api/v1/price-feeds/{id} [get]
func (*Handler) GetPriceFeedHistory ¶
GetPriceFeedHistory gets the price history for a price feed @Summary Get price history @Description Get historical price data for a specific price feed @Tags price-feeds @Produce json @Param id path int true "Price Feed ID" @Param limit query int false "Limit" default(100) @Param offset query int false "Offset" default(0) @Success 200 {array} models.PriceData @Failure 404 {object} common.ErrorResponse @Failure 500 {object} common.ErrorResponse @Router /api/v1/price-feeds/{id}/history [get]
func (*Handler) GetPriceHistory ¶
GetPriceHistory gets the price history for a specific feed (public endpoint) @Summary Get price history @Description Get historical price data for a specific feed @Tags public @Produce json @Param id path int true "Price Feed ID" @Param limit query int false "Limit" default(100) @Param offset query int false "Offset" default(0) @Success 200 {array} models.PriceData @Failure 404 {object} common.ErrorResponse @Failure 500 {object} common.ErrorResponse @Router /api/v1/public/prices/{id}/history [get]
func (*Handler) ListPriceFeeds ¶
ListPriceFeeds lists all price feeds @Summary List all price feeds @Description Get a list of all configured price feeds @Tags price-feeds @Produce json @Success 200 {array} models.PriceFeed @Failure 500 {object} common.ErrorResponse @Router /api/v1/price-feeds [get]
func (*Handler) Register ¶
func (h *Handler) Register(router *gin.RouterGroup)
Register registers price feed routes with the given router
func (*Handler) TriggerPriceUpdate ¶
TriggerPriceUpdate manually triggers a price update @Summary Trigger price update @Description Manually trigger a price update for a specific feed @Tags price-feeds @Produce json @Param id path int true "Price Feed ID" @Success 204 {object} nil @Failure 400 {object} common.ErrorResponse @Failure 404 {object} common.ErrorResponse @Failure 500 {object} common.ErrorResponse @Router /api/v1/price-feeds/{id}/trigger-update [post]
func (*Handler) UpdatePriceFeed ¶
UpdatePriceFeed updates a price feed @Summary Update price feed @Description Update an existing price feed configuration @Tags price-feeds @Accept json @Produce json @Param id path int true "Price Feed ID" @Param request body UpdatePriceFeedRequest true "Price Feed Request" @Success 200 {object} models.PriceFeed @Failure 400 {object} common.ErrorResponse @Failure 404 {object} common.ErrorResponse @Failure 500 {object} common.ErrorResponse @Router /api/v1/price-feeds/{id} [put]
type UpdatePriceFeedRequest ¶
type UpdatePriceFeedRequest struct {
BaseToken string `json:"base_token"`
QuoteToken string `json:"quote_token"`
UpdateInterval string `json:"update_interval"`
DeviationThreshold float64 `json:"deviation_threshold"`
HeartbeatInterval string `json:"heartbeat_interval"`
ContractAddress string `json:"contract_address"`
Active bool `json:"active"`
}
UpdatePriceFeedRequest is the request body for updating a price feed