forked from ThisIsNoahEvans/DuuxAPI
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstructs.go
More file actions
101 lines (91 loc) · 2.35 KB
/
structs.go
File metadata and controls
101 lines (91 loc) · 2.35 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
package main
import (
"time"
)
// Struct for LoginCodeResponse
type LoginCodeResponse struct {
Success bool `json:"success"`
Message string `json:"message"`
}
// Struct for AuthTokenResponse
type AuthTokenResponse struct {
AccessToken string `json:"access_token"`
RefreshToken string `json:"refresh_token"`
ExpiresIn int `json:"expires_in"`
TokenType string `json:"token_type"`
}
// Struct for UserResponse
type UserResponseSubset struct {
User struct {
ID int `json:"id"`
Username string `json:"username"`
Email string `json:"email"`
Tenants []struct {
ID int `json:"id"`
Name string `json:"name"`
} `json:"tenants"`
} `json:"user"`
}
// Struct for SensorResponse
type SensorResponse struct {
ID int `json:"id"`
Type string `json:"type"`
DisplayName string `json:"displayName"`
}
// Individual sensor response
type SensorResponseIndividual struct {
ID int `json:"id"`
Type string `json:"type"`
Name string `json:"name"`
DisplayName string `json:"displayName"`
Colour string `json:"color"`
LatestData struct {
FullData struct {
Mode *int `json:"mode"`
ModeString *string
Power *int `json:"power"`
PowerString *string
Speed int `json:"speed"`
Swing int `json:"swing"`
SwingString *string
Tilt int `json:"tilt"`
TiltString *string
Timer int `json:"timer"`
TimerString *string
Sensor string `json:"sensor"`
} `json:"fullData"`
} `json:"latestData"`
}
// General success response
type SuccessResponse struct {
Response struct {
Success bool `json:"success"`
Message string `json:"message"`
} `json:"response"`
}
type SensorScheduleValue struct {
Cron string `json:"cron"`
Power int `json:"power"`
Mode *int `json:"mode,omitempty"`
Speed *int `json:"speed,omitempty"`
}
type SensorSchedule struct {
ID int
Cron string
Type string
Value struct {
Power *int
Mode *int
Speed *int
PowerString *string
ModeString *string
SpeedString *string
}
}
type Sensor struct {
SensorID int `json:"SensorId"`
CreatedAt time.Time `json:"createdAt"`
ID int `json:"id"`
UpdatedAt time.Time `json:"updatedAt"`
SensorSchedules []SensorSchedule `json:"SensorSchedules"`
}