config

package
v0.1.10 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

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 NewHandler(service *Service) *Handler

func (*Handler) Get added in v0.1.10

func (h *Handler) Get(c *gin.Context)

Get handles GET /api/v1/configs/:id.

func (*Handler) GetVersion

func (h *Handler) GetVersion(c *gin.Context)

GetVersion handles the config version detail request

func (*Handler) GetVersionByID added in v0.1.10

func (h *Handler) GetVersionByID(c *gin.Context)

GetVersionByID handles GET /api/v1/configs/:id/versions/:version.

func (*Handler) List added in v0.1.10

func (h *Handler) List(c *gin.Context)

List handles GET /api/v1/configs.

func (*Handler) ListVersions

func (h *Handler) ListVersions(c *gin.Context)

ListVersions handles the config versions list request

func (*Handler) ListVersionsByID added in v0.1.10

func (h *Handler) ListVersionsByID(c *gin.Context)

ListVersionsByID handles GET /api/v1/configs/:id/versions.

func (*Handler) Save added in v0.1.10

func (h *Handler) Save(c *gin.Context)

Save handles PUT /api/v1/configs/:id.

func (*Handler) Upsert

func (h *Handler) Upsert(c *gin.Context)

Upsert handles the config create/update request

func (*Handler) Validate added in v0.1.10

func (h *Handler) Validate(c *gin.Context)

Validate handles POST /api/v1/configs/:id/validate.

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

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

type ValidateConfigRequest struct {
	Format  string `json:"format"`
	Content string `json:"content"`
}

ValidateConfigRequest defines the payload for POST /api/v1/configs/:id/validate.

type ValidateConfigResponse added in v0.1.10

type ValidateConfigResponse struct {
	Valid  bool     `json:"valid"`
	Errors []string `json:"errors"`
}

ValidateConfigResponse returns parse validation results only.

Jump to

Keyboard shortcuts

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