Skip to content

Commit 50f772b

Browse files
committed
Added dtos
1 parent dce40ed commit 50f772b

File tree

1 file changed

+272
-0
lines changed

1 file changed

+272
-0
lines changed

internal/storage-api/dto.go

+272
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import (
2121
"time"
2222

2323
"github.com/arduino/arduino-cli/table"
24+
"github.com/gofrs/uuid"
2425
)
2526

2627
type (
@@ -70,3 +71,274 @@ func formatHumanReadableTs(ts string) string {
7071
}
7172
return parsed.Format(time.RFC3339)
7273
}
74+
75+
type TemplateDescribeResponse struct {
76+
// CompatibleBoards List of devices compatible with the template
77+
CompatibleBoards *[]string `json:"compatible_boards,omitempty"`
78+
79+
// CreatedAt Template creation date/time
80+
CreatedAt *time.Time `json:"created_at,omitempty"`
81+
82+
// DashboardTemplates List of dashboard templates
83+
DashboardTemplates *[]DashboardTemplate `json:"dashboard_templates,omitempty"`
84+
85+
// DeletedAt Template soft deletion date/time
86+
DeletedAt *time.Time `json:"deleted_at,omitempty"`
87+
88+
// Description Description of the template
89+
Description string `json:"description"`
90+
91+
// ImageLinks Optional list of images to be included in the template
92+
ImageLinks *[]string `json:"image_links,omitempty"`
93+
94+
// Name Template name
95+
Name string `json:"name" validate:"required,max=128"`
96+
97+
// OrganizationId Organization identifier
98+
OrganizationId *uuid.UUID `json:"organization_id,omitempty"`
99+
TemplateId uuid.UUID `json:"template_id" validate:"required,uuid"`
100+
101+
// ThingTemplates List of thing templates
102+
ThingTemplates *[]ThingTemplate `json:"thing_templates,omitempty"`
103+
104+
// TriggerTemplates List of trigger templates
105+
TriggerTemplates *[]TriggerTemplate `json:"trigger_templates,omitempty"`
106+
107+
// UpdatedAt Template update date/time
108+
UpdatedAt *time.Time `json:"updated_at,omitempty"`
109+
110+
// UserId User identifier
111+
UserId *uuid.UUID `json:"user_id,omitempty" validate:"uuid"`
112+
}
113+
114+
type ThingTemplate struct {
115+
// Id Template ID
116+
Id string `json:"id"`
117+
118+
// Name Name
119+
Name string `json:"name"`
120+
121+
// Tags Tags
122+
Tags *[]Tag `json:"tags,omitempty"`
123+
124+
// Variables Thing variables
125+
Variables *[]Variable `json:"variables,omitempty"`
126+
127+
// WebhookUri Webhook URI
128+
WebhookUri *string `json:"webhook_uri,omitempty"`
129+
}
130+
131+
type Variable struct {
132+
// Id Id
133+
Id *string `json:"id,omitempty"`
134+
135+
// Name Name
136+
Name *string `json:"name,omitempty"`
137+
138+
// Permission Permission
139+
Permission *string `json:"permission,omitempty"`
140+
141+
// Type Type
142+
Type *string `json:"type,omitempty"`
143+
144+
// UpdateParameter Update parameter
145+
UpdateParameter *float32 `json:"update_parameter,omitempty"`
146+
147+
// UpdateStrategy Update strategy
148+
UpdateStrategy *string `json:"update_strategy,omitempty"`
149+
150+
// VariableName Variable name
151+
VariableName *string `json:"variable_name,omitempty"`
152+
}
153+
154+
type Tag struct {
155+
// Key Key
156+
Key string `json:"key"`
157+
158+
// Value Value
159+
Value string `json:"value"`
160+
}
161+
162+
type DashboardTemplate struct {
163+
// Id Template ID
164+
Id string `json:"id"`
165+
166+
// Name Name
167+
Name string `json:"name"`
168+
169+
// Widgets Widgets
170+
Widgets *[]Widget `json:"widgets,omitempty"`
171+
}
172+
173+
type Widget struct {
174+
// Height height
175+
Height *float32 `json:"height,omitempty"`
176+
177+
// HeightMobile height mobile
178+
HeightMobile *float32 `json:"height_mobile,omitempty"`
179+
180+
// Name Name
181+
Name string `json:"name"`
182+
183+
// Options Widget options
184+
Options *map[string]interface{} `json:"options,omitempty"`
185+
186+
// Type Widget type
187+
Type string `json:"type"`
188+
189+
// Variables Widget variables
190+
Variables *[]WidgetVariable `json:"variables,omitempty"`
191+
192+
// Width Width
193+
Width *float32 `json:"width,omitempty"`
194+
195+
// WidthMobile Width mobile
196+
WidthMobile *float32 `json:"width_mobile,omitempty"`
197+
198+
// X x
199+
X *float32 `json:"x,omitempty"`
200+
201+
// XMobile x mobile
202+
XMobile *float32 `json:"x_mobile,omitempty"`
203+
204+
// Y y
205+
Y *float32 `json:"y,omitempty"`
206+
207+
// YMobile y mobile
208+
YMobile *float32 `json:"y_mobile,omitempty"`
209+
}
210+
211+
type WidgetVariable struct {
212+
// Name Name
213+
Name string `json:"name"`
214+
215+
// Permission Permission
216+
Permission *string `json:"permission,omitempty"`
217+
218+
// ThingId Thing ID
219+
ThingId *string `json:"thing_id,omitempty"`
220+
221+
// Type Widget type
222+
Type string `json:"type"`
223+
224+
// VariableId Variable ID
225+
VariableId *string `json:"variable_id,omitempty"`
226+
}
227+
228+
type TriggerTemplate struct {
229+
// Actions Actions
230+
Actions *[]TriggerAction `json:"actions,omitempty"`
231+
232+
// Active Active
233+
Active *bool `json:"active,omitempty"`
234+
235+
// Description Description
236+
Description *string `json:"description,omitempty"`
237+
238+
// Id Template ID
239+
Id string `json:"id"`
240+
LinkedDevice *LinkedDevice `json:"linked_device,omitempty"`
241+
LinkedProperty *LinkedProperty `json:"linked_property,omitempty"`
242+
243+
// Name Name
244+
Name string `json:"name"`
245+
}
246+
247+
type TriggerAction struct {
248+
// Description Description
249+
Description *string `json:"description,omitempty"`
250+
Email *EmailAction `json:"email,omitempty"`
251+
252+
// Kind Kind
253+
Kind *string `json:"kind,omitempty"`
254+
255+
// Name Name
256+
Name string `json:"name"`
257+
PushNotification *PushNotificationAction `json:"push_notification,omitempty"`
258+
}
259+
260+
type LinkedDevice struct {
261+
// DeviceConnectedDelay Device connected delay
262+
DeviceConnectedDelay *float32 `json:"device_connected_delay,omitempty"`
263+
264+
// DeviceDisconnectedDelay Device disconnected delay
265+
DeviceDisconnectedDelay *float32 `json:"device_disconnected_delay,omitempty"`
266+
267+
// ThingId Thing ID
268+
ThingId string `json:"thing_id"`
269+
}
270+
271+
// LinkedProperty defines model for LinkedProperty.
272+
type LinkedProperty struct {
273+
// PropertyId Property ID
274+
PropertyId string `json:"property_id"`
275+
276+
// ThingId Thing ID
277+
ThingId string `json:"thing_id"`
278+
}
279+
280+
// NotificationBody defines model for NotificationBody.
281+
type NotificationBody struct {
282+
// Expression Expression
283+
Expression string `json:"expression"`
284+
285+
// Variables Variables
286+
Variables []BodyVariable `json:"variables"`
287+
}
288+
289+
// PushNotificationAction defines model for PushNotificationAction.
290+
type PushNotificationAction struct {
291+
Body NotificationBody `json:"body"`
292+
Delivery Delivery `json:"delivery"`
293+
Title Subject `json:"title"`
294+
}
295+
296+
// Subject defines model for Subject.
297+
type Subject struct {
298+
// Expression expression
299+
Expression string `json:"expression"`
300+
}
301+
302+
type BodyVariable struct {
303+
// Attribute attribute
304+
Attribute string `json:"attribute"`
305+
306+
// Entity entity
307+
Entity string `json:"entity"`
308+
309+
// Placeholder placeholder
310+
Placeholder string `json:"placeholder"`
311+
312+
// PropertyId property_id
313+
PropertyId *string `json:"property_id,omitempty"`
314+
315+
// ThingId thing_id
316+
ThingId *string `json:"thing_id,omitempty"`
317+
}
318+
319+
type Delivery struct {
320+
// Bcc BCC
321+
Bcc *[]DeliveryTo `json:"bcc,omitempty"`
322+
323+
// Cc CC
324+
Cc *[]DeliveryTo `json:"cc,omitempty"`
325+
326+
// To To
327+
To []DeliveryTo `json:"to"`
328+
}
329+
330+
// DeliveryTo defines model for DeliveryTo.
331+
type DeliveryTo struct {
332+
// Email email
333+
Email *string `json:"email,omitempty"`
334+
335+
// Username username
336+
Username *string `json:"username,omitempty"`
337+
}
338+
339+
// EmailAction defines model for EmailAction.
340+
type EmailAction struct {
341+
Body NotificationBody `json:"body"`
342+
Delivery Delivery `json:"delivery"`
343+
Subject Subject `json:"subject"`
344+
}

0 commit comments

Comments
 (0)