Debian Codegraph @

pkg/types/params.go

raw symbols SCIP
1 package typesscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/types`/
2
3 // Params is the string map used to provide additional variables to the service templates.
4 type Paramsscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/types`/Params# map[string]string
5
6 const (
7 // TitleKey is the common key for the title prop.
8 TitleKeyscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/types`/TitleKey. = "title"
9 // MessageKey is the common key for the message prop.
10 MessageKeyscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/types`/MessageKey. = "message"
11 // LevelKey is the common key for the message level prop.
12 LevelKeyscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/types`/LevelKey. = "level"
13 )
14
15 // Level returns the MessageLevel stored under the "level" param.
16 //
17 // Returns:
18 // - MessageLevel: the parsed level.
19 // - bool: true if the level was found and parsed successfully.
20 func (p Paramsscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/types`/Params#) Levelscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/types`/Params#Level().() (MessageLevelscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/types`/MessageLevel#, bool) {
21 levelStr, found := p[LevelKeyscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/types`/LevelKey.]
22 if !found {
23 return Unknownscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/types`/Unknown., false
24 }
25
26 return ParseMessageLevelscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/types`/ParseMessageLevel().(levelStr)
27 }
28
29 // SetLevel sets the "level" param to the string representation of the MessageLevel.
30 //
31 // Parameters:
32 // - level: the message level to set.
33 func (p Paramsscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/types`/Params#) SetLevelscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/types`/Params#SetLevel().(level MessageLevelscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/types`/MessageLevel#) {
34 p[LevelKeyscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/types`/LevelKey.] = level.Stringscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/types`/MessageLevel#String().()
35 }
36
37 // SetMessage sets the "message" param to the specified value.
38 //
39 // Parameters:
40 // - message: the message text to set.
41 func (p Paramsscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/types`/Params#) SetMessagescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/types`/Params#SetMessage().(message string) {
42 p[MessageKeyscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/types`/MessageKey.] = message
43 }
44
45 // SetTitle sets the "title" param to the specified value.
46 //
47 // Parameters:
48 // - title: the title text to set.
49 func (p Paramsscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/types`/Params#) SetTitlescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/types`/Params#SetTitle().(title string) {
50 p[TitleKeyscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/types`/TitleKey.] = title
51 }
52
53 // Title returns the "title" param.
54 //
55 // Returns:
56 // - string: the title value.
57 // - bool: true if the title was found.
58 func (p Paramsscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/types`/Params#) Titlescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/types`/Params#Title().() (string, bool) {
59 title, found := p[TitleKeyscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/types`/TitleKey.]
60
61 return title, found
62 }