This commit is contained in:
2025-09-03 08:29:15 -07:00
parent 56f55daa85
commit 2898ccdb79
164 changed files with 275 additions and 25235 deletions

View File

@@ -85,6 +85,11 @@ type WorkoutListOptions struct {
SportType string
NameContains string
OwnerID int64
Offset int
SortBy string
SortOrder string
Type string
Status string
}
// WorkoutUpdate represents fields that can be updated on a workout
@@ -102,6 +107,9 @@ func (s *WorkoutService) List(ctx context.Context, opts WorkoutListOptions) ([]W
if opts.Limit > 0 {
params.Set("limit", strconv.Itoa(opts.Limit))
}
if opts.Offset > 0 {
params.Set("offset", strconv.Itoa(opts.Offset))
}
if !opts.StartDate.IsZero() {
params.Set("startDate", opts.StartDate.Format(time.RFC3339))
}
@@ -111,12 +119,24 @@ func (s *WorkoutService) List(ctx context.Context, opts WorkoutListOptions) ([]W
if opts.SportType != "" {
params.Set("sportType", opts.SportType)
}
if opts.Type != "" {
params.Set("type", opts.Type)
}
if opts.Status != "" {
params.Set("status", opts.Status)
}
if opts.NameContains != "" {
params.Set("nameContains", opts.NameContains)
}
if opts.OwnerID > 0 {
params.Set("ownerId", strconv.FormatInt(opts.OwnerID, 10))
}
if opts.SortBy != "" {
params.Set("sortBy", opts.SortBy)
}
if opts.SortOrder != "" {
params.Set("sortOrder", opts.SortOrder)
}
path := "/workout-service/workouts"
if len(params) > 0 {