forked from go-swagger/go-swagger
-
Notifications
You must be signed in to change notification settings - Fork 0
/
list_tasks_parameters.go
133 lines (106 loc) · 2.78 KB
/
list_tasks_parameters.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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
package tasks
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
"github.com/go-openapi/swag"
strfmt "github.com/go-openapi/strfmt"
)
// NewListTasksParams creates a new ListTasksParams object
// with the default values initialized.
func NewListTasksParams() *ListTasksParams {
var (
pageSizeDefault int32 = int32(20)
)
return &ListTasksParams{
PageSize: &pageSizeDefault,
}
}
/*ListTasksParams contains all the parameters to send to the API endpoint
for the list tasks operation typically these are written to a http.Request
*/
type ListTasksParams struct {
/*PageSize
Amount of items to return in a single page
*/
PageSize *int32
/*SinceID
The last id that was seen.
*/
SinceID *int64
/*Status
the status to filter by
*/
Status []string
/*Tags
the tags to filter by
*/
Tags []string
}
// WithPageSize adds the pageSize to the list tasks params
func (o *ListTasksParams) WithPageSize(PageSize *int32) *ListTasksParams {
o.PageSize = PageSize
return o
}
// WithSinceID adds the sinceId to the list tasks params
func (o *ListTasksParams) WithSinceID(SinceID *int64) *ListTasksParams {
o.SinceID = SinceID
return o
}
// WithStatus adds the status to the list tasks params
func (o *ListTasksParams) WithStatus(Status []string) *ListTasksParams {
o.Status = Status
return o
}
// WithTags adds the tags to the list tasks params
func (o *ListTasksParams) WithTags(Tags []string) *ListTasksParams {
o.Tags = Tags
return o
}
// WriteToRequest writes these params to a swagger request
func (o *ListTasksParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
var res []error
if o.PageSize != nil {
// query param pageSize
var qrPageSize int32
if o.PageSize != nil {
qrPageSize = *o.PageSize
}
qPageSize := swag.FormatInt32(qrPageSize)
if qPageSize != "" {
if err := r.SetQueryParam("pageSize", qPageSize); err != nil {
return err
}
}
}
if o.SinceID != nil {
// query param sinceId
var qrSinceID int64
if o.SinceID != nil {
qrSinceID = *o.SinceID
}
qSinceID := swag.FormatInt64(qrSinceID)
if qSinceID != "" {
if err := r.SetQueryParam("sinceId", qSinceID); err != nil {
return err
}
}
}
valuesStatus := o.Status
joinedStatus := swag.JoinByFormat(valuesStatus, "pipes")
// query array param status
if err := r.SetQueryParam("status", joinedStatus...); err != nil {
return err
}
valuesTags := o.Tags
joinedTags := swag.JoinByFormat(valuesTags, "")
// query array param tags
if err := r.SetQueryParam("tags", joinedTags...); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}