func WithUser(id uint) GetAnnotationsParams {
	return func(v url.Values) {
		v.Set("userId", strconv.FormatUint(uint64(id), 10))
	}
}
WithUser filters the annotations to only be made by the specified user ID
package sdk
import (
	"context"
	"encoding/json"
	"fmt"
	"net/url"
	"strconv"
	"time"
	"github.com/pkg/errors"
)
func (r *Client) CreateAnnotation(ctx context.Context, a CreateAnnotationRequest) (StatusMessage, error) {
	var (
		raw  []byte
		resp StatusMessage
		err  error
	)
	if raw, err = json.Marshal(a); err != nil {
		return StatusMessage{}, errors.Wrap(err, "marshal request")
	}
	if raw, _, err = r.post(ctx, "api/annotations", nil, raw); err != nil {
		return StatusMessage{}, errors.Wrap(err, "create annotation")
	}
	if err = json.Unmarshal(raw, &resp); err != nil {
		return StatusMessage{}, errors.Wrap(err, "unmarshal response message")
	}
	return resp, nil
}
func (r *Client) PatchAnnotation(ctx context.Context, id uint, a PatchAnnotationRequest) (StatusMessage, error) {
	var (
		raw  []byte
		resp StatusMessage
		err  error
	)
	if raw, err = json.Marshal(a); err != nil {
		return StatusMessage{}, errors.Wrap(err, "marshal request")
	}
	if raw, _, err = r.patch(ctx, fmt.Sprintf("api/annotations/%d", id), nil, raw); err != nil {
		return StatusMessage{}, errors.Wrap(err, "patch annotation")
	}
	if err = json.Unmarshal(raw, &resp); err != nil {
		return StatusMessage{}, errors.Wrap(err, "unmarshal response message")
	}
	return resp, nil
}
func (r *Client) GetAnnotations(ctx context.Context, params ...GetAnnotationsParams) ([]AnnotationResponse, error) {
	var (
		raw           []byte
		err           error
		resp          []AnnotationResponse
		requestParams = make(url.Values)
	)
	for _, p := range params {
		p(requestParams)
	}
	if raw, _, err = r.get(ctx, "api/annotations", requestParams); err != nil {
		return nil, errors.Wrap(err, "get annotations")
	}
	if err = json.Unmarshal(raw, &resp); err != nil {
		return nil, errors.Wrap(err, "unmarshal response message")
	}
	return resp, nil
}
func (r *Client) DeleteAnnotation(ctx context.Context, id uint) (StatusMessage, error) {
	var (
		raw  []byte
		err  error
		resp StatusMessage
	)
	if raw, _, err = r.delete(ctx, fmt.Sprintf("api/annotations/%d", id)); err != nil {
		return StatusMessage{}, errors.Wrap(err, "delete annotation")
	}
	if err = json.Unmarshal(raw, &resp); err != nil {
		return StatusMessage{}, errors.Wrap(err, "unmarshal response message")
	}
	return resp, nil
}
type GetAnnotationsParams func(values url.Values)
func WithTag(tag string) GetAnnotationsParams {
	return func(v url.Values) {
		v.Add("tags", tag)
	}
}
func WithLimit(limit uint) GetAnnotationsParams {
	return func(v url.Values) {
		v.Set("limit", strconv.FormatUint(uint64(limit), 10))
	}
}
func WithAnnotationType() GetAnnotationsParams {
	return func(v url.Values) {
		v.Set("type", "annotation")
	}
}
func WithAlertType() GetAnnotationsParams {
	return func(v url.Values) {
		v.Set("type", "alert")
	}
}
func WithDashboard(id uint) GetAnnotationsParams {
	return func(v url.Values) {
		v.Set("dashboardId", strconv.FormatUint(uint64(id), 10))
	}
}
func WithPanel(id uint) GetAnnotationsParams {
	return func(v url.Values) {
		v.Set("panelId", strconv.FormatUint(uint64(id), 10))
	}
}