This repository was archived by the owner on Feb 5, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathtransformation.go
More file actions
279 lines (237 loc) · 9.69 KB
/
transformation.go
File metadata and controls
279 lines (237 loc) · 9.69 KB
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
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
// This file was auto-generated by Fern from our API Definition.
package api
import (
json "encoding/json"
fmt "fmt"
core "github.com/hookdeck/hookdeck-go-sdk/core"
time "time"
)
type TransformationCreateRequest struct {
// A unique, human-friendly name for the transformation
Name string `json:"name" url:"-"`
// JavaScript code to be executed as string
Code string `json:"code" url:"-"`
// Key-value environment variables to be passed to the transformation
Env *core.Optional[map[string]string] `json:"env,omitempty" url:"-"`
}
type TransformationListRequest struct {
Id []*string `json:"-" url:"id,omitempty"`
Name *string `json:"-" url:"name,omitempty"`
OrderBy *TransformationListRequestOrderBy `json:"-" url:"order_by,omitempty"`
Dir *TransformationListRequestDir `json:"-" url:"dir,omitempty"`
Limit *int `json:"-" url:"limit,omitempty"`
Next *string `json:"-" url:"next,omitempty"`
Prev *string `json:"-" url:"prev,omitempty"`
}
type TransformationListExecutionRequest struct {
LogLevel *TransformationListExecutionRequestLogLevel `json:"-" url:"log_level,omitempty"`
WebhookId []*string `json:"-" url:"webhook_id,omitempty"`
IssueId []*string `json:"-" url:"issue_id,omitempty"`
CreatedAt *time.Time `json:"-" url:"created_at,omitempty"`
OrderBy *TransformationListExecutionRequestOrderBy `json:"-" url:"order_by,omitempty"`
Dir *TransformationListExecutionRequestDir `json:"-" url:"dir,omitempty"`
Limit *int `json:"-" url:"limit,omitempty"`
Next *string `json:"-" url:"next,omitempty"`
Prev *string `json:"-" url:"prev,omitempty"`
}
type TransformationRunRequest struct {
// Key-value environment variables to be passed to the transformation
Env *core.Optional[map[string]string] `json:"env,omitempty" url:"-"`
// ID of the connection to use for the execution `context`
WebhookId *core.Optional[string] `json:"webhook_id,omitempty" url:"-"`
// JavaScript code to be executed
Code *core.Optional[string] `json:"code,omitempty" url:"-"`
// Transformation ID
TransformationId *core.Optional[string] `json:"transformation_id,omitempty" url:"-"`
// Request input to use for the transformation execution
Request *core.Optional[TransformationRunRequestRequest] `json:"request,omitempty" url:"-"`
EventId *core.Optional[string] `json:"event_id,omitempty" url:"-"`
}
type TransformationDeleteResponse struct {
// ID of the Transformation
Id string `json:"id" url:"id"`
extraProperties map[string]interface{}
_rawJSON json.RawMessage
}
func (t *TransformationDeleteResponse) GetExtraProperties() map[string]interface{} {
return t.extraProperties
}
func (t *TransformationDeleteResponse) UnmarshalJSON(data []byte) error {
type unmarshaler TransformationDeleteResponse
var value unmarshaler
if err := json.Unmarshal(data, &value); err != nil {
return err
}
*t = TransformationDeleteResponse(value)
extraProperties, err := core.ExtractExtraProperties(data, *t)
if err != nil {
return err
}
t.extraProperties = extraProperties
t._rawJSON = json.RawMessage(data)
return nil
}
func (t *TransformationDeleteResponse) String() string {
if len(t._rawJSON) > 0 {
if value, err := core.StringifyJSON(t._rawJSON); err == nil {
return value
}
}
if value, err := core.StringifyJSON(t); err == nil {
return value
}
return fmt.Sprintf("%#v", t)
}
type TransformationListExecutionRequestDir string
const (
TransformationListExecutionRequestDirAsc TransformationListExecutionRequestDir = "asc"
TransformationListExecutionRequestDirDesc TransformationListExecutionRequestDir = "desc"
)
func NewTransformationListExecutionRequestDirFromString(s string) (TransformationListExecutionRequestDir, error) {
switch s {
case "asc":
return TransformationListExecutionRequestDirAsc, nil
case "desc":
return TransformationListExecutionRequestDirDesc, nil
}
var t TransformationListExecutionRequestDir
return "", fmt.Errorf("%s is not a valid %T", s, t)
}
func (t TransformationListExecutionRequestDir) Ptr() *TransformationListExecutionRequestDir {
return &t
}
type TransformationListExecutionRequestLogLevel string
const (
TransformationListExecutionRequestLogLevelDebug TransformationListExecutionRequestLogLevel = "debug"
TransformationListExecutionRequestLogLevelInfo TransformationListExecutionRequestLogLevel = "info"
TransformationListExecutionRequestLogLevelWarn TransformationListExecutionRequestLogLevel = "warn"
TransformationListExecutionRequestLogLevelError TransformationListExecutionRequestLogLevel = "error"
TransformationListExecutionRequestLogLevelFatal TransformationListExecutionRequestLogLevel = "fatal"
)
func NewTransformationListExecutionRequestLogLevelFromString(s string) (TransformationListExecutionRequestLogLevel, error) {
switch s {
case "debug":
return TransformationListExecutionRequestLogLevelDebug, nil
case "info":
return TransformationListExecutionRequestLogLevelInfo, nil
case "warn":
return TransformationListExecutionRequestLogLevelWarn, nil
case "error":
return TransformationListExecutionRequestLogLevelError, nil
case "fatal":
return TransformationListExecutionRequestLogLevelFatal, nil
}
var t TransformationListExecutionRequestLogLevel
return "", fmt.Errorf("%s is not a valid %T", s, t)
}
func (t TransformationListExecutionRequestLogLevel) Ptr() *TransformationListExecutionRequestLogLevel {
return &t
}
type TransformationListExecutionRequestOrderBy string
const (
TransformationListExecutionRequestOrderByCreatedAt TransformationListExecutionRequestOrderBy = "created_at"
)
func NewTransformationListExecutionRequestOrderByFromString(s string) (TransformationListExecutionRequestOrderBy, error) {
switch s {
case "created_at":
return TransformationListExecutionRequestOrderByCreatedAt, nil
}
var t TransformationListExecutionRequestOrderBy
return "", fmt.Errorf("%s is not a valid %T", s, t)
}
func (t TransformationListExecutionRequestOrderBy) Ptr() *TransformationListExecutionRequestOrderBy {
return &t
}
type TransformationListRequestDir string
const (
TransformationListRequestDirAsc TransformationListRequestDir = "asc"
TransformationListRequestDirDesc TransformationListRequestDir = "desc"
)
func NewTransformationListRequestDirFromString(s string) (TransformationListRequestDir, error) {
switch s {
case "asc":
return TransformationListRequestDirAsc, nil
case "desc":
return TransformationListRequestDirDesc, nil
}
var t TransformationListRequestDir
return "", fmt.Errorf("%s is not a valid %T", s, t)
}
func (t TransformationListRequestDir) Ptr() *TransformationListRequestDir {
return &t
}
type TransformationListRequestOrderBy string
const (
TransformationListRequestOrderByCreatedAt TransformationListRequestOrderBy = "created_at"
)
func NewTransformationListRequestOrderByFromString(s string) (TransformationListRequestOrderBy, error) {
switch s {
case "created_at":
return TransformationListRequestOrderByCreatedAt, nil
}
var t TransformationListRequestOrderBy
return "", fmt.Errorf("%s is not a valid %T", s, t)
}
func (t TransformationListRequestOrderBy) Ptr() *TransformationListRequestOrderBy {
return &t
}
// Request input to use for the transformation execution
type TransformationRunRequestRequest struct {
// Headers of the request
Headers map[string]string `json:"headers,omitempty" url:"headers,omitempty"`
// Body of the request
Body *TransformationRunRequestRequestBody `json:"body,omitempty" url:"body,omitempty"`
// Path of the request
Path *string `json:"path,omitempty" url:"path,omitempty"`
// String representation of the query params of the request
Query *string `json:"query,omitempty" url:"query,omitempty"`
// JSON representation of the query params
ParsedQuery *TransformationRunRequestRequestParsedQuery `json:"parsed_query,omitempty" url:"parsed_query,omitempty"`
extraProperties map[string]interface{}
_rawJSON json.RawMessage
}
func (t *TransformationRunRequestRequest) GetExtraProperties() map[string]interface{} {
return t.extraProperties
}
func (t *TransformationRunRequestRequest) UnmarshalJSON(data []byte) error {
type unmarshaler TransformationRunRequestRequest
var value unmarshaler
if err := json.Unmarshal(data, &value); err != nil {
return err
}
*t = TransformationRunRequestRequest(value)
extraProperties, err := core.ExtractExtraProperties(data, *t)
if err != nil {
return err
}
t.extraProperties = extraProperties
t._rawJSON = json.RawMessage(data)
return nil
}
func (t *TransformationRunRequestRequest) String() string {
if len(t._rawJSON) > 0 {
if value, err := core.StringifyJSON(t._rawJSON); err == nil {
return value
}
}
if value, err := core.StringifyJSON(t); err == nil {
return value
}
return fmt.Sprintf("%#v", t)
}
type TransformationUpdateRequest struct {
// A unique, human-friendly name for the transformation
Name *core.Optional[string] `json:"name,omitempty" url:"-"`
// JavaScript code to be executed
Code *core.Optional[string] `json:"code,omitempty" url:"-"`
// Key-value environment variables to be passed to the transformation
Env *core.Optional[map[string]string] `json:"env,omitempty" url:"-"`
}
type TransformationUpsertRequest struct {
// A unique, human-friendly name for the transformation
Name string `json:"name" url:"-"`
// JavaScript code to be executed as string
Code string `json:"code" url:"-"`
// Key-value environment variables to be passed to the transformation
Env *core.Optional[map[string]string] `json:"env,omitempty" url:"-"`
}