Documentation
¶
Index ¶
- type ConfigItem
- type ConfigVersion
- type ConfigVersionItem
- type GetConfigRequest
- type GetConfigResponse
- type GetVersionRequest
- type GetVersionResponse
- type Handler
- func (h *Handler) Get(c *gin.Context)
- func (h *Handler) GetVersion(c *gin.Context)
- func (h *Handler) GetVersionByID(c *gin.Context)
- func (h *Handler) List(c *gin.Context)
- func (h *Handler) ListVersions(c *gin.Context)
- func (h *Handler) ListVersionsByID(c *gin.Context)
- func (h *Handler) Save(c *gin.Context)
- func (h *Handler) Upsert(c *gin.Context)
- func (h *Handler) Validate(c *gin.Context)
- type ListConfigsRequest
- type ListConfigsResponse
- type ListVersionsRequest
- type ListVersionsResponse
- type SaveConfigRequest
- type SaveConfigResponse
- type Service
- func (s *Service) GetConfig(ctx context.Context, req *GetConfigRequest) (*GetConfigResponse, error)
- func (s *Service) GetVersion(ctx context.Context, req *GetVersionRequest) (*GetVersionResponse, error)
- func (s *Service) ListConfigs(ctx context.Context, req *ListConfigsRequest) (*ListConfigsResponse, error)
- func (s *Service) ListVersions(ctx context.Context, req *ListVersionsRequest) (*ListVersionsResponse, error)
- func (s *Service) SaveConfig(ctx context.Context, id string, req *SaveConfigRequest) (*SaveConfigResponse, error)
- func (s *Service) Upsert(ctx context.Context, req *UpsertRequest) (*UpsertResponse, error)
- func (s *Service) ValidateConfig(_ context.Context, _ string, req *ValidateConfigRequest) (*ValidateConfigResponse, error)
- type UpsertRequest
- type UpsertResponse
- type ValidateConfigRequest
- type ValidateConfigResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConfigItem ¶ added in v0.1.10
type ConfigItem struct {
ID string `json:"id"`
Format string `json:"format"`
GameID string `json:"gameId"`
Env string `json:"env"`
LatestVersion int `json:"latestVersion"`
UpdatedAt string `json:"updatedAt"`
LastMessage string `json:"lastMessage"`
LastModifiedBy string `json:"lastModifiedBy"`
}
ConfigItem represents the latest version summary for a config key.
type ConfigVersion ¶
type ConfigVersion struct {
Key string `json:"key"`
Version int `json:"version"`
CreatedBy string `json:"createdBy"`
CreatedAt string `json:"createdAt"`
GameID string `json:"gameId"`
Env string `json:"env"`
Format string `json:"format"`
Message string `json:"message"`
Value string `json:"value,omitempty"`
}
ConfigVersion represents a single config version. Canonical HTTP JSON contract should use camelCase keys.
type ConfigVersionItem ¶
type ConfigVersionItem struct {
Key string `json:"key"`
Version int `json:"version"`
CreatedBy string `json:"createdBy"`
CreatedAt string `json:"createdAt"`
GameID string `json:"gameId"`
Env string `json:"env"`
Format string `json:"format"`
Message string `json:"message"`
Value string `json:"value"`
}
ConfigVersionItem represents a simplified config version for list view
type GetConfigRequest ¶ added in v0.1.10
type GetConfigRequest struct {
ID string `uri:"id"`
}
GetConfigRequest defines the resource identity for GET /api/v1/configs/:id.
type GetConfigResponse ¶ added in v0.1.10
type GetConfigResponse struct {
ID string `json:"id"`
Format string `json:"format"`
Content string `json:"content"`
Version int `json:"version"`
GameID string `json:"gameId"`
Env string `json:"env"`
}
GetConfigResponse returns the latest editable content for a config key.
type GetVersionRequest ¶
type GetVersionRequest struct {
Key string `form:"key"` // config key
Version int `form:"version"` // version number
}
GetVersionRequest represents the request to get a specific config version
type GetVersionResponse ¶
type GetVersionResponse struct {
Version ConfigVersion `json:"version"`
}
GetVersionResponse represents the response for a specific config version
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
func NewHandler ¶
func (*Handler) GetVersion ¶
GetVersion handles the config version detail request
func (*Handler) GetVersionByID ¶ added in v0.1.10
GetVersionByID handles GET /api/v1/configs/:id/versions/:version.
func (*Handler) ListVersions ¶
ListVersions handles the config versions list request
func (*Handler) ListVersionsByID ¶ added in v0.1.10
ListVersionsByID handles GET /api/v1/configs/:id/versions.
type ListConfigsRequest ¶ added in v0.1.10
type ListConfigsRequest struct {
GameID string `form:"gameId"`
Env string `form:"env"`
Format string `form:"format"`
IDLike string `form:"idLike"`
}
ListConfigsRequest defines the filters for GET /api/v1/configs.
type ListConfigsResponse ¶ added in v0.1.10
type ListConfigsResponse struct {
Items []ConfigItem `json:"items"`
}
ListConfigsResponse returns the latest version summary for each config key.
type ListVersionsRequest ¶
type ListVersionsRequest struct {
Key string `form:"key"` // config key
}
ListVersionsRequest represents the request to list config versions
type ListVersionsResponse ¶
type ListVersionsResponse struct {
Key string `json:"key"`
Total int `json:"total"`
Versions []ConfigVersionItem `json:"versions"`
}
ListVersionsResponse represents the response with config versions list
type SaveConfigRequest ¶ added in v0.1.10
type SaveConfigRequest struct {
Format string `json:"format"`
Content string `json:"content"`
Message string `json:"message"`
BaseVersion int `json:"baseVersion"`
GameID string `json:"gameId"`
Env string `json:"env"`
}
SaveConfigRequest defines the canonical write contract for PUT /api/v1/configs/:id.
type SaveConfigResponse ¶ added in v0.1.10
type SaveConfigResponse struct {
Version int `json:"version"`
}
SaveConfigResponse returns the newly created version metadata.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewService ¶
func NewService(svcCtx *svc.ServiceContext) *Service
func (*Service) GetConfig ¶ added in v0.1.10
func (s *Service) GetConfig(ctx context.Context, req *GetConfigRequest) (*GetConfigResponse, error)
GetConfig returns the latest editable version for a single config key.
func (*Service) GetVersion ¶
func (s *Service) GetVersion(ctx context.Context, req *GetVersionRequest) (*GetVersionResponse, error)
GetVersion retrieves a specific version of a config
func (*Service) ListConfigs ¶ added in v0.1.10
func (s *Service) ListConfigs(ctx context.Context, req *ListConfigsRequest) (*ListConfigsResponse, error)
ListConfigs returns the latest version summary for each config key.
func (*Service) ListVersions ¶
func (s *Service) ListVersions(ctx context.Context, req *ListVersionsRequest) (*ListVersionsResponse, error)
ListVersions retrieves all versions for a given config key
func (*Service) SaveConfig ¶ added in v0.1.10
func (s *Service) SaveConfig(ctx context.Context, id string, req *SaveConfigRequest) (*SaveConfigResponse, error)
SaveConfig creates a new config version using the canonical RESTful contract.
func (*Service) Upsert ¶
func (s *Service) Upsert(ctx context.Context, req *UpsertRequest) (*UpsertResponse, error)
Upsert creates or updates a config value
func (*Service) ValidateConfig ¶ added in v0.1.10
func (s *Service) ValidateConfig(_ context.Context, _ string, req *ValidateConfigRequest) (*ValidateConfigResponse, error)
ValidateConfig validates the submitted config content according to the declared format.
type UpsertRequest ¶
type UpsertRequest struct {
Key string `json:"key"` // config key
Value string `json:"value"` // config value
}
UpsertRequest represents the legacy request to create or update a config. Source of truth for new HTTP clients should be SaveConfigRequest.
type UpsertResponse ¶
type UpsertResponse struct {
Version ConfigVersion `json:"version"`
}
UpsertResponse represents the response for config upsert
type ValidateConfigRequest ¶ added in v0.1.10
ValidateConfigRequest defines the payload for POST /api/v1/configs/:id/validate.
type ValidateConfigResponse ¶ added in v0.1.10
ValidateConfigResponse returns parse validation results only.