You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: user_timeline.go
    path of file: ./repos/cds/engine/api
    
    the code of the file until where you have to start completion: package api

import (
	"context"
	"net/http"

	"github.com/ovh/cds/engine/api/user"
	"github.com/ovh/cds/engine/service"
	"github.com/ovh/cds/sdk"
)

func (api *API) getTimelineFilterHandler() service.Handler {
	return func(ctx context.Context, w http.ResponseWriter, r *http.Request) error {
		u := getUserConsumer(ctx).AuthConsumerUser.AuthentifiedUser
		filter, err := user.LoadTimelineFilter(api.mustDB(), u.ID)
		if err != nil {
			return sdk.WrapError(err, "getTimelineFilterHandler")
		}
		return service.WriteJSON(w, filte
    
func (api *API) postTimelineFilterHandler() service.Handler {
	return func(ctx context.Context, w http.ResponseWriter, r *http.Request) error {
		u := getUserConsumer(ctx).AuthConsumerUser.AuthentifiedUser
		var timelineFilter sdk.TimelineFilter
		if err := service.UnmarshalBody(r, &timelineFilter); err != nil {
			return sdk.WrapError(err, "Unable to read body")
		}

		// Try to load
		count, errLoad := user.CountTimelineFilter(api.mustDB(), u.ID)
		if errLoad != nil {
			return sdk.WrapError(errLoad, "Cannot load filter")
		}
		if count == 0 {
			if err := user.InsertTimelineFilter(api.mustDB(), timelineFilter, u.ID); err != nil {
				return sdk.WrapError(err, "Cannot insert filter")
			}
		} else {
			if err := user.UpdateTimelineFilter(api.mustDB(), timelineFilter, u.ID); err != nil {
				return sdk.WrapError(err, "Unable to update filter")
			}
		}
		return nil
	}
}