Help us shape the future of Go! Take the 2026 Go Developer Survey

archapi

package
v1.3.6 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ARCHCacheTTL = 6 * time.Hour
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ArchAthleteInput added in v1.3.6

type ArchAthleteInput struct {
	NationalID  string   `json:"national_id"   validate:"required,numeric"`
	FirstName   *string  `json:"first_name"    validate:"omitempty"`
	LastName    *string  `json:"last_name"     validate:"omitempty"`
	Initials    *string  `json:"initials"      validate:"omitempty"`
	DateOfBirth *string  `json:"date_of_birth" validate:"omitempty"`
	Height      *float64 `json:"height"        validate:"omitempty"`
	Weight      *float64 `json:"weight"        validate:"omitempty"`
}

type ArchDataUpsertInput

type ArchDataUpsertInput struct {
	ArchAthleteInput
	Measurements []ArchMeasurementInput `json:"measurements" validate:"omitempty,dive"`
}

ArchDataUpsertInput is the combined athlete + measurements body for POST /archinisis/data.

type ArchMeasurementInput

type ArchMeasurementInput struct {
	Comment            *string `json:"comment"`
	Discipline         *string `json:"discipline"`
	MeasurementGroupID int32   `json:"measurement_group_id" validate:"required,gt=0"`
	MeasurementID      int32   `json:"measurement_id"       validate:"required,gt=0"`
	NbSegments         *int32  `json:"nb_segments"`
	Place              *string `json:"place"`
	RaceID             *int32  `json:"race_id"`
	SessionName        *string `json:"session_name"`
	StartTime          *string `json:"start_time"`
	StopTime           *string `json:"stop_time"`
}

type ArchMeasurementsInput added in v1.3.6

type ArchMeasurementsInput struct {
	NationalID   string                 `json:"national_id"  validate:"required,numeric"`
	Measurements []ArchMeasurementInput `json:"measurements" validate:"required,min=1,dive"`
}

type DataHandler

type DataHandler struct {
	// contains filtered or unexported fields
}

func NewDataHandler

func NewDataHandler(store archinisis.Data, cache *cache.Storage) *DataHandler

func (*DataHandler) DeleteMeasurement added in v1.3.6

func (h *DataHandler) DeleteMeasurement(w http.ResponseWriter, r *http.Request)

DeleteMeasurement godoc

@Summary		Delete a single measurement by measurement ID
@Description	Removes the measurement identified by the given measurement_id.
@Tags			ARCHINISIS - Measurements
@Accept			json
@Produce		json
@Param			id	query	string	true	"Measurement ID"
@Success		200
@Failure		400	{object}	swagger.ValidationErrorResponse
@Failure		401	{object}	swagger.UnauthorizedResponse
@Failure		403	{object}	swagger.ForbiddenResponse
@Failure		404	{object}	swagger.NotFoundResponse
@Failure		500	{object}	swagger.InternalServerErrorResponse
@Failure		503	{object}	swagger.ServiceUnavailableResponse
@Security		BearerAuth
@Router			/archinisis/measurement [delete]

func (*DataHandler) GetArchData

func (h *DataHandler) GetArchData(w http.ResponseWriter, r *http.Request)

GetArchData godoc

@Summary		Get Archinisis athlete + measurements by ID
@Description	Returns the athlete profile and all measurements for the given ID.
@Tags			ARCHINISIS - Data
@Accept			json
@Produce		json
@Param			id	query		string	true	"National ID (Sportti ID)"
@Success		200	{object}	swagger.ArchDataResponse
@Failure		400	{object}	swagger.ValidationErrorResponse
@Failure		401	{object}	swagger.UnauthorizedResponse
@Failure		403	{object}	swagger.ForbiddenResponse
@Failure		404	{object}	swagger.NotFoundResponse
@Failure		500	{object}	swagger.InternalServerErrorResponse
@Failure		503	{object}	swagger.ServiceUnavailableResponse
@Security		BearerAuth
@Router			/archinisis/data [get]

func (*DataHandler) GetAthlete added in v1.3.6

func (h *DataHandler) GetAthlete(w http.ResponseWriter, r *http.Request)

GetAthlete godoc

@Summary		Get athlete profile by ID
@Description	Returns athlete profile fields (no measurements) for the given ID.
@Tags			ARCHINISIS - Athlete
@Accept			json
@Produce		json
@Param			id	query		string	true	"National ID (Sportti ID)"
@Success		200	{object}	swagger.ArchAthleteResponse
@Failure		400	{object}	swagger.ValidationErrorResponse
@Failure		401	{object}	swagger.UnauthorizedResponse
@Failure		403	{object}	swagger.ForbiddenResponse
@Failure		404	{object}	swagger.NotFoundResponse
@Failure		500	{object}	swagger.InternalServerErrorResponse
@Failure		503	{object}	swagger.ServiceUnavailableResponse
@Security		BearerAuth
@Router			/archinisis/athlete [get]

func (*DataHandler) GetMeasurement added in v1.3.6

func (h *DataHandler) GetMeasurement(w http.ResponseWriter, r *http.Request)

GetMeasurement godoc

@Summary		Get a single measurement by measurement ID
@Description	Returns the measurement identified by the given measurement_id.
@Tags			ARCHINISIS - Measurements
@Accept			json
@Produce		json
@Param			id	query		string	true	"Measurement ID"
@Success		200	{object}	swagger.ArchMeasurementResponse
@Failure		400	{object}	swagger.ValidationErrorResponse
@Failure		401	{object}	swagger.UnauthorizedResponse
@Failure		403	{object}	swagger.ForbiddenResponse
@Failure		404	{object}	swagger.NotFoundResponse
@Failure		500	{object}	swagger.InternalServerErrorResponse
@Failure		503	{object}	swagger.ServiceUnavailableResponse
@Security		BearerAuth
@Router			/archinisis/measurement [get]

func (*DataHandler) GetMeasurements added in v1.3.6

func (h *DataHandler) GetMeasurements(w http.ResponseWriter, r *http.Request)

GetMeasurements godoc

@Summary		Get all measurements for an athlete
@Description	Returns all measurements for the athlete identified by the given ID.
@Tags			ARCHINISIS - Measurements
@Accept			json
@Produce		json
@Param			id	query		string	true	"National ID (Sportti ID)"
@Success		200	{object}	swagger.ArchMeasurementsResponse
@Failure		400	{object}	swagger.ValidationErrorResponse
@Failure		401	{object}	swagger.UnauthorizedResponse
@Failure		403	{object}	swagger.ForbiddenResponse
@Failure		500	{object}	swagger.InternalServerErrorResponse
@Failure		503	{object}	swagger.ServiceUnavailableResponse
@Security		BearerAuth
@Router			/archinisis/measurements [get]

func (*DataHandler) GetRaceReportHTML

func (h *DataHandler) GetRaceReportHTML(w http.ResponseWriter, r *http.Request)

GetRaceReportHTML godoc

@Summary		Get a specific race report (HTML)
@Description	Returns the raw HTML race report for a (sportti_id, session_id). Content-Type is text/html.
@Tags			ARCHINISIS - Data
@Accept			json
@Produce		html
@Param			id			query		string	true	"Sportti ID"
@Param			session_id	query		string	true	"Session ID"
@Success		200			{string}	string	"<!DOCTYPE html><html><head><title>Race Report</title></head><body><h1>HTML RACE REPORT</h1><p>full report returned in html DOCTYPE</p></body></html>"
@Failure		400			{object}	swagger.ValidationErrorResponse
@Failure		401			{object}	swagger.UnauthorizedResponse
@Failure		403			{object}	swagger.ForbiddenResponse
@Failure		404			{object}	swagger.NotFoundResponse
@Failure		500			{object}	swagger.InternalServerErrorResponse
@Failure		503			{object}	swagger.ServiceUnavailableResponse
@Security		BearerAuth
@Router			/archinisis/race-report [get]

func (*DataHandler) GetRaceReportSessions

func (h *DataHandler) GetRaceReportSessions(w http.ResponseWriter, r *http.Request)

GetRaceReportSessions godoc

@Summary		List race-report session IDs for a Sportti ID
@Description	Returns all session_id values that have race reports for the given sportti_id
@Tags			ARCHINISIS - Data
@Accept			json
@Produce		json
@Param			id	query		string	true	"Sportti ID"
@Success		200	{object}	swagger.RaceReportSessionsResponse
@Failure		400	{object}	swagger.ValidationErrorResponse
@Failure		401	{object}	swagger.UnauthorizedResponse
@Failure		403	{object}	swagger.ForbiddenResponse
@Failure		500	{object}	swagger.InternalServerErrorResponse
@Failure		503	{object}	swagger.ServiceUnavailableResponse
@Security		BearerAuth
@Router			/archinisis/race-report/sessions [get]

func (*DataHandler) PostArchData

func (h *DataHandler) PostArchData(w http.ResponseWriter, r *http.Request)

PostArchData godoc

@Summary		Upsert Archinisis athlete + measurements
@Description	Inserts/updates the athlete profile and the related measurements in one request. Missing measurement groups (sessions) are created automatically.
@Tags			ARCHINISIS - Data
@Accept			json
@Produce		json
@Param			data	body	swagger.ArchDataUpsertRequest	true	"athlete + measurements"
@Success		201		"Data processed successfully"
@Failure		400		{object}	swagger.ValidationErrorResponse
@Failure		401		{object}	swagger.UnauthorizedResponse
@Failure		403		{object}	swagger.ForbiddenResponse
@Failure		500		{object}	swagger.InternalServerErrorResponse
@Failure		503		{object}	swagger.ServiceUnavailableResponse
@Security		BearerAuth
@Router			/archinisis/data [post]

func (*DataHandler) PostAthlete added in v1.3.6

func (h *DataHandler) PostAthlete(w http.ResponseWriter, r *http.Request)

PostAthlete godoc

@Summary		Upsert athlete profile
@Description	Inserts or updates athlete profile fields. New data for the same national_id overwrites existing.
@Tags			ARCHINISIS - Athlete
@Accept			json
@Produce		json
@Param			data	body	swagger.ArchAthleteUpsertRequest	true	"athlete profile"
@Success		201		"Data processed successfully"
@Failure		400		{object}	swagger.ValidationErrorResponse
@Failure		401		{object}	swagger.UnauthorizedResponse
@Failure		403		{object}	swagger.ForbiddenResponse
@Failure		500		{object}	swagger.InternalServerErrorResponse
@Failure		503		{object}	swagger.ServiceUnavailableResponse
@Security		BearerAuth
@Router			/archinisis/athlete [post]

func (*DataHandler) PostMeasurements added in v1.3.6

func (h *DataHandler) PostMeasurements(w http.ResponseWriter, r *http.Request)

PostMeasurements godoc

@Summary		Upsert measurements for an athlete
@Description	Inserts or updates one or more measurements (keyed on measurement_id) linked to the given national_id. Missing measurement groups (sessions) are created automatically.
@Tags			ARCHINISIS - Measurements
@Accept			json
@Produce		json
@Param			data	body	swagger.ArchMeasurementsUpsertRequest	true	"measurements"
@Success		201		"Data processed successfully"
@Failure		400		{object}	swagger.ValidationErrorResponse
@Failure		401		{object}	swagger.UnauthorizedResponse
@Failure		403		{object}	swagger.ForbiddenResponse
@Failure		500		{object}	swagger.InternalServerErrorResponse
@Failure		503		{object}	swagger.ServiceUnavailableResponse
@Security		BearerAuth
@Router			/archinisis/measurements [post]

func (*DataHandler) PostRaceReport

func (h *DataHandler) PostRaceReport(w http.ResponseWriter, r *http.Request)

PostRaceReport godoc

@Summary		Upsert a race report (HTML)
@Description	Inserts or updates the race report for the given (sportti_id, session_id) pair. The session_id must exist as a measurement group.
@Tags			ARCHINISIS - Data
@Accept			json
@Produce		json
@Param			data	body	swagger.ArchRaceReportUpsertRequest	true	"race report"
@Success		201		"Data processed successfully"
@Failure		400		{object}	swagger.ValidationErrorResponse
@Failure		401		{object}	swagger.UnauthorizedResponse
@Failure		403		{object}	swagger.ForbiddenResponse
@Failure		500		{object}	swagger.InternalServerErrorResponse
@Failure		503		{object}	swagger.ServiceUnavailableResponse
@Security		BearerAuth
@Router			/archinisis/race-report [post]

type RaceReportHTMLQuery

type RaceReportHTMLQuery struct {
	ID        string `validate:"required,numeric"`
	SessionID string `validate:"required,numeric"`
}

type RaceReportSessionsQuery

type RaceReportSessionsQuery struct {
	ID string `validate:"required,numeric"`
}

type RaceReportUpsertInput

type RaceReportUpsertInput struct {
	SporttiID  string `json:"sportti_id" validate:"required,numeric"`
	SessionID  int32  `json:"session_id" validate:"required,gt=0"`
	RaceReport string `json:"race_report" validate:"required"`
}

type SporttiIDParam

type SporttiIDParam struct {
	SporttiID string `form:"sportti_id" validate:"required,numeric"`
}

type UserDataHandler

type UserDataHandler struct {
	// contains filtered or unexported fields
}

func NewUserDataHandler

func NewUserDataHandler(store archinisis.Users, cache *cache.Storage) *UserDataHandler

func (*UserDataHandler) DeleteUser

func (h *UserDataHandler) DeleteUser(w http.ResponseWriter, r *http.Request)

DeleteUser godoc

@Summary		Delete an athlete (hard delete)
@Description	Removes an athlete by sportti_id. Related measurements and race reports are deleted via FK cascades. Measurement groups remain.
@Tags			Archinisis - User
@Accept			json
@Produce		json
@Param			sportti_id	query	string	true	"Sportti ID"
@Success		200
@Failure		400	{object}	swagger.ValidationErrorResponse
@Failure		401	{object}	swagger.UnauthorizedResponse
@Failure		403	{object}	swagger.ForbiddenResponse
@Failure		404	{object}	swagger.NotFoundResponse
@Failure		500	{object}	swagger.InternalServerErrorResponse
@Failure		503	{object}	swagger.ServiceUnavailableResponse
@Security		BearerAuth
@Router			/archinisis/user [delete]

Jump to

Keyboard shortcuts

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