Documentation
¶
Overview ¶
Package api provides the HTTP API server for the genealogy application.
Package api provides the HTTP API server for the genealogy application.
Index ¶
- Constants
- func OpenAPISpec() []byte
- type APIError
- type AddChildRequest
- type CreateFamilyRequest
- type CreatePersonRequest
- type FamilyChildResponse
- type FamilyDetailResponse
- type FamilyListResponse
- type FamilyResponse
- type FamilySummaryResponse
- type ImportGedcomResponse
- type PedigreeNodeResponse
- type PedigreeResponse
- type PersonDetailResponse
- type PersonListResponse
- type PersonResponse
- type Server
- type UpdateFamilyRequest
- type UpdatePersonRequest
Constants ¶
View Source
const ( CodeBadRequest = "BAD_REQUEST" CodeNotFound = "NOT_FOUND" CodeConflict = "CONFLICT" CodeInternalError = "INTERNAL_ERROR" CodeValidation = "VALIDATION_ERROR" )
Error codes.
Variables ¶
This section is empty.
Functions ¶
func OpenAPISpec ¶
func OpenAPISpec() []byte
OpenAPISpec returns the embedded OpenAPI specification.
Types ¶
type APIError ¶
type APIError struct {
Code string `json:"code"`
Message string `json:"message"`
Details map[string]any `json:"details,omitempty"`
}
APIError represents a standardized API error response.
func NewAPIError ¶
NewAPIError creates a new API error with the given code and message.
type AddChildRequest ¶
type CreateFamilyRequest ¶
type CreateFamilyRequest struct {
Partner1ID *string `json:"partner1_id,omitempty"`
Partner2ID *string `json:"partner2_id,omitempty"`
RelationshipType *string `json:"relationship_type,omitempty"`
MarriageDate *string `json:"marriage_date,omitempty"`
MarriagePlace *string `json:"marriage_place,omitempty"`
}
type CreatePersonRequest ¶
type CreatePersonRequest struct {
GivenName string `json:"given_name" validate:"required,min=1,max=100"`
Surname string `json:"surname" validate:"required,min=1,max=100"`
Gender *string `json:"gender,omitempty"`
BirthDate *string `json:"birth_date,omitempty"`
BirthPlace *string `json:"birth_place,omitempty"`
DeathDate *string `json:"death_date,omitempty"`
DeathPlace *string `json:"death_place,omitempty"`
Notes *string `json:"notes,omitempty"`
}
type FamilyChildResponse ¶
type FamilyDetailResponse ¶
type FamilyDetailResponse struct {
FamilyResponse
Children []FamilyChildResponse `json:"children,omitempty"`
}
type FamilyListResponse ¶
type FamilyListResponse struct {
Items []FamilyResponse `json:"items"`
Total int `json:"total"`
Limit int `json:"limit"`
Offset int `json:"offset"`
}
type FamilyResponse ¶
type FamilyResponse struct {
ID string `json:"id"`
Partner1ID *string `json:"partner1_id,omitempty"`
Partner1Name *string `json:"partner1_name,omitempty"`
Partner2ID *string `json:"partner2_id,omitempty"`
Partner2Name *string `json:"partner2_name,omitempty"`
RelationshipType *string `json:"relationship_type,omitempty"`
MarriageDate any `json:"marriage_date,omitempty"`
MarriagePlace *string `json:"marriage_place,omitempty"`
ChildCount int `json:"child_count"`
Version int64 `json:"version"`
}
type FamilySummaryResponse ¶
type ImportGedcomResponse ¶
type ImportGedcomResponse struct {
ImportID string `json:"import_id"`
PersonsImported int `json:"persons_imported"`
FamiliesImported int `json:"families_imported"`
Warnings []string `json:"warnings,omitempty"`
Errors []string `json:"errors,omitempty"`
}
ImportGedcomResponse represents the response from a GEDCOM import.
type PedigreeNodeResponse ¶
type PedigreeNodeResponse struct {
ID string `json:"id"`
GivenName string `json:"given_name"`
Surname string `json:"surname"`
Gender string `json:"gender,omitempty"`
BirthDate *string `json:"birth_date,omitempty"`
BirthPlace *string `json:"birth_place,omitempty"`
DeathDate *string `json:"death_date,omitempty"`
DeathPlace *string `json:"death_place,omitempty"`
Generation int `json:"generation"`
Father *PedigreeNodeResponse `json:"father,omitempty"`
Mother *PedigreeNodeResponse `json:"mother,omitempty"`
}
PedigreeNodeResponse represents a person in the pedigree tree.
type PedigreeResponse ¶
type PedigreeResponse struct {
Root *PedigreeNodeResponse `json:"root"`
TotalAncestors int `json:"total_ancestors"`
MaxGeneration int `json:"max_generation"`
}
PedigreeResponse represents the pedigree tree for a person.
type PersonDetailResponse ¶
type PersonDetailResponse struct {
PersonResponse
FamiliesAsPartner []FamilySummaryResponse `json:"families_as_partner,omitempty"`
FamilyAsChild *FamilySummaryResponse `json:"family_as_child,omitempty"`
}
type PersonListResponse ¶
type PersonListResponse struct {
Items []PersonResponse `json:"items"`
Total int `json:"total"`
Limit int `json:"limit"`
Offset int `json:"offset"`
}
type PersonResponse ¶
type PersonResponse struct {
ID string `json:"id"`
GivenName string `json:"given_name"`
Surname string `json:"surname"`
Gender *string `json:"gender,omitempty"`
BirthDate any `json:"birth_date,omitempty"`
BirthPlace *string `json:"birth_place,omitempty"`
DeathDate any `json:"death_date,omitempty"`
DeathPlace *string `json:"death_place,omitempty"`
Notes *string `json:"notes,omitempty"`
Version int64 `json:"version"`
}
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server wraps the Echo server with application dependencies.
func NewServer ¶
func NewServer( cfg *config.Config, eventStore repository.EventStore, readStore repository.ReadModelStore, frontendFS fs.FS, ) *Server
NewServer creates a new API server with all dependencies.
type UpdateFamilyRequest ¶
type UpdateFamilyRequest struct {
Partner1ID *string `json:"partner1_id,omitempty"`
Partner2ID *string `json:"partner2_id,omitempty"`
RelationshipType *string `json:"relationship_type,omitempty"`
MarriageDate *string `json:"marriage_date,omitempty"`
MarriagePlace *string `json:"marriage_place,omitempty"`
Version int64 `json:"version" validate:"required"`
}
type UpdatePersonRequest ¶
type UpdatePersonRequest struct {
GivenName *string `json:"given_name,omitempty"`
Surname *string `json:"surname,omitempty"`
Gender *string `json:"gender,omitempty"`
BirthDate *string `json:"birth_date,omitempty"`
BirthPlace *string `json:"birth_place,omitempty"`
DeathDate *string `json:"death_date,omitempty"`
DeathPlace *string `json:"death_place,omitempty"`
Notes *string `json:"notes,omitempty"`
Version int64 `json:"version" validate:"required"`
}
Click to show internal directories.
Click to hide internal directories.