-
Notifications
You must be signed in to change notification settings - Fork 6
/
inputs.go
67 lines (56 loc) · 1.32 KB
/
inputs.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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
package models
import (
"encoding/json"
"fmt"
"net/url"
"strconv"
"strings"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/validate"
)
// These imports may not be used depending on the input parameters
var _ = json.Marshal
var _ = fmt.Sprintf
var _ = url.QueryEscape
var _ = strconv.FormatInt
var _ = strings.Replace
var _ = validate.Maximum
var _ = strfmt.NewFormats
// NilCheckInput holds the input parameters for a nilCheck operation.
type NilCheckInput struct {
ID string
Query *string
Header string
Array []string
Body *NilFields
}
// Validate returns an error if any of the NilCheckInput parameters don't satisfy the
// requirements from the swagger yml file.
func (i NilCheckInput) Validate() error {
if i.Body != nil {
if err := i.Body.Validate(nil); err != nil {
return err
}
}
return nil
}
// Path returns the URI path for the input.
func (i NilCheckInput) Path() (string, error) {
path := "/v1/check/{id}"
urlVals := url.Values{}
pathid := i.ID
if pathid == "" {
err := fmt.Errorf("id cannot be empty because it's a path parameter")
if err != nil {
return "", err
}
}
path = strings.Replace(path, "{id}", pathid, -1)
if i.Query != nil {
urlVals.Add("query", *i.Query)
}
for _, v := range i.Array {
urlVals.Add("array", v)
}
return path + "?" + urlVals.Encode(), nil
}