-
Notifications
You must be signed in to change notification settings - Fork 1
/
jobs_params.go
182 lines (145 loc) · 5.13 KB
/
jobs_params.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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
package modzy
import (
"time"
"github.com/modzy/sdk-go/model"
)
// GetJobDetailsInput -
type GetJobDetailsInput struct {
JobIdentifier string
}
type WaitForJobCompletionInput GetJobDetailsInput
// GetJobDetailsOutput -
type GetJobDetailsOutput struct {
Details model.JobDetails `json:"details"`
}
type ListJobsHistoryInput struct {
Paging PagingInput
}
// ListJobsHistoryFilterField are known field names that can be used when filtering the jobs history
type ListJobsHistoryFilterField string
const (
ListJobsHistoryFilterFieldStartDate ListJobsHistoryFilterField = "startDate"
ListJobsHistoryFilterFieldEndDate ListJobsHistoryFilterField = "endDate"
ListJobsHistoryFilterFieldStatus ListJobsHistoryFilterField = "status"
ListJobsHistoryFilterFieldModel ListJobsHistoryFilterField = "model"
ListJobsHistoryFilterFieldUser ListJobsHistoryFilterField = "user"
ListJobsHistoryFilterFieldAccessKey ListJobsHistoryFilterField = "accessKey" // I see "prefix" in the docs -- what does that mean?
)
// ListJobsHistorySortField are known field names that can be used when sorting the jobs history
type ListJobsHistorySortField string
const (
ListJobsHistorySortFieldIdentifier ListJobsHistorySortField = "identifier"
ListJobsHistorySortFieldSubmittedBy ListJobsHistorySortField = "submittedBy"
ListJobsHistorySortFieldSubmittedJobs ListJobsHistorySortField = "submittedJobs"
ListJobsHistorySortFieldStatus ListJobsHistorySortField = "status"
ListJobsHistorySortFieldCreatedAt ListJobsHistorySortField = "createdAt"
ListJobsHistorySortFieldUpdatedAt ListJobsHistorySortField = "updatedAt"
ListJobsHistorySortFieldSubmittedAt ListJobsHistorySortField = "submittedAt"
ListJobsHistorySortFieldTotal ListJobsHistorySortField = "total"
ListJobsHistorySortFieldCompleted ListJobsHistorySortField = "completed"
ListJobsHistorySortFieldFail ListJobsHistorySortField = "fail"
ListJobsHistorySortFieldModel ListJobsHistorySortField = "model"
)
func (i *ListJobsHistoryInput) WithPaging(perPage int, page int) *ListJobsHistoryInput {
i.Paging = NewPaging(perPage, page)
return i
}
func (i *ListJobsHistoryInput) WithFilter(field ListJobsHistoryFilterField, value string) *ListJobsHistoryInput {
i.Paging = i.Paging.WithFilterAnd(string(field), value)
return i
}
func (i *ListJobsHistoryInput) WithFilterAnd(field ListJobsHistoryFilterField, values ...string) *ListJobsHistoryInput {
i.Paging = i.Paging.WithFilterAnd(string(field), values...)
return i
}
func (i *ListJobsHistoryInput) WithFilterOr(field ListJobsHistoryFilterField, values ...string) *ListJobsHistoryInput {
i.Paging = i.Paging.WithFilterOr(string(field), values...)
return i
}
func (i *ListJobsHistoryInput) WithSort(sortDirection SortDirection, sortBy ...ListJobsHistorySortField) *ListJobsHistoryInput {
sorts := []string{}
for _, s := range sortBy {
sorts = append(sorts, string(s))
}
i.Paging.SortDirection = sortDirection
i.Paging.SortBy = sorts
return i
}
type ListJobsHistoryOutput struct {
Jobs []model.JobDetails `json:"jobs"`
NextPage *ListJobsHistoryInput `json:"nextPage"`
}
type SubmitJobOutput struct {
Response model.SubmitJobResponse
JobActions
}
type TextInputItem map[string]string
type SubmitJobTextInput struct {
ModelIdentifier string
ModelVersion string
Explain bool
Timeout time.Duration
Inputs map[string]TextInputItem
}
type SubmitJobTextOutput = SubmitJobOutput
type EmbeddedInputItem map[string]URIEncodable
type SubmitJobEmbeddedInput struct {
ModelIdentifier string
ModelVersion string
Explain bool
Timeout time.Duration
Inputs map[string]EmbeddedInputItem
}
type SubmitJobEmbeddedOutput = SubmitJobOutput
type FileInputItem map[string]FileInputEncodable
type SubmitJobFileInput struct {
ModelIdentifier string
ModelVersion string
Explain bool
Timeout time.Duration
// ChunkSize (in bytes) is optional -- if not provided it will use the configured MaximumChunkSize.
// If provided it will be limited to the configured maximum;
ChunkSize int
Inputs map[string]FileInputItem
}
type SubmitJobFileOutput = SubmitJobOutput
type S3InputItem map[string]S3Inputable
type SubmitJobS3Input struct {
ModelIdentifier string
ModelVersion string
Explain bool
Timeout time.Duration
AWSAccessKeyID string
AWSSecretAccessKey string
AWSRegion string
Inputs map[string]S3InputItem
}
type SubmitJobS3Output = SubmitJobOutput
type SubmitJobJDBCInput struct {
ModelIdentifier string
ModelVersion string
Explain bool
Timeout time.Duration
JDBCConnectionURL string
DatabaseUsername string
DatabasePassword string
Query string
}
type SubmitJobJDBCOutput = SubmitJobOutput
type CancelJobInput struct {
JobIdentifier string `json:"jobIdentifier"`
}
type CancelJobOutput struct {
Details model.JobDetails
}
type GetJobResultsInput struct {
JobIdentifier string
}
type GetJobResultsOutput struct {
Results model.JobResults
}
type GetJobFeaturesInput struct {
}
type GetJobFeaturesOutput struct {
Features model.JobFeatures `json:"features"`
}