-
Notifications
You must be signed in to change notification settings - Fork 0
/
opsTriggerType.go
32 lines (26 loc) · 1013 Bytes
/
opsTriggerType.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package wildlifenl
import (
"context"
"net/http"
"github.com/danielgtaylor/huma/v2"
)
type TriggerTypesHolder struct {
Body []string `json:"triggerTypes"`
}
type triggerTypeOperations Operations
func newTriggerTypeOperations() *triggerTypeOperations {
return &triggerTypeOperations{Endpoint: "triggerType"}
}
func (o *triggerTypeOperations) RegisterGetAll(api huma.API) {
name := "Get All TriggerTypes"
description := "Retrieve all trigger types."
path := "/" + o.Endpoint + "s/"
scopes := []string{}
method := http.MethodGet
huma.Register(api, huma.Operation{
OperationID: name, Summary: name, Path: path, Method: method, Tags: []string{o.Endpoint}, Description: generateDescription(description, scopes), Security: []map[string][]string{{"auth": scopes}},
}, func(ctx context.Context, input *struct{}) (*TriggerTypesHolder, error) {
// This is not super elegant and hard coded, but a client needed it.
return &TriggerTypesHolder{Body: []string{"encounter", "answer", "alarm"}}, nil
})
}