-
Notifications
You must be signed in to change notification settings - Fork 237
Expand file tree
/
Copy pathapi.go
More file actions
47 lines (35 loc) · 764 Bytes
/
api.go
File metadata and controls
47 lines (35 loc) · 764 Bytes
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// @@@SNIPSTART samples-go-nexus-service
package service
import (
"fmt"
"strings"
)
const HelloServiceName = "my-hello-service"
// Echo operation
const EchoOperationName = "echo"
type EchoInput struct {
Message string
}
type EchoOutput EchoInput
// Hello operation
const HelloOperationName = "say-hello"
type Language string
const (
EN Language = "en"
FR Language = "fr"
DE Language = "de"
ES Language = "es"
TR Language = "tr"
)
type HelloInput struct {
Name string
Language Language
}
type HelloOutput struct {
Message string
}
func HelloWorkflowID(input HelloInput) string {
name := strings.ToLower(strings.ReplaceAll(strings.TrimSpace(input.Name), " ", "-"))
return fmt.Sprintf("hello-%s-%s", input.Language, name)
}
// @@@SNIPEND