-
Notifications
You must be signed in to change notification settings - Fork 0
/
structs.go
195 lines (170 loc) · 5.67 KB
/
structs.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
183
184
185
186
187
188
189
190
191
192
193
194
195
package sirv
import "net/http"
type PlanLimit struct {
TotalRequestsPerHour int
SearchRequests int
VideoToSpinConversions int
SpinToVideoConversions int
FetchRequests int
}
type Client struct {
BaseURL string
HTTPClient *http.Client
Token string
Limit PlanLimit
}
type TokenResponse struct {
Token string `json:"token"`
Expires int `json:"expiresIn"`
Scope []string `json:"scope"`
}
type AuthPayload struct {
ClientId string `json:"clientId"`
ClientSecret string `json:"clientSecret"`
}
type AccountInfo struct {
DateCreated string `json:"dateCreated"`
Alias string `json:"alias"`
FileSizeLimit int64 `json:"fileSizeLimit"`
Fetching struct {
Enabled bool `json:"enabled"`
Type string `json:"type"`
HTTP struct {
Auth struct {
Enabled bool `json:"enabled"`
} `json:"auth"`
URL string `json:"url"`
} `json:"http"`
MaxFileSize int64 `json:"maxFilesize"`
} `json:"fetching"`
Minify struct {
Enabled bool `json:"enabled"`
} `json:"minify"`
CDNTempURL string `json:"cdnTempURL"`
CDNURL string `json:"cdnURL"`
Aliases map[string]struct {
Prefix string `json:"prefix"`
CDN bool `json:"cdn"`
} `json:"aliases"`
}
type LimitInfo struct {
Count int `json:"count"`
Limit int `json:"limit"`
Remaining int `json:"remaining"`
Reset int `json:"reset"`
}
type APILimits struct {
S3Global LimitInfo `json:"s3:global"`
S3PUT LimitInfo `json:"s3:PUT"`
S3GET LimitInfo `json:"s3:GET"`
S3DELETE LimitInfo `json:"s3:DELETE"`
RestGlobal LimitInfo `json:"rest:global"`
RestPostFilesSearch LimitInfo `json:"rest:post:files:search"`
RestPostFilesSearchScroll LimitInfo `json:"rest:post:files:search:scroll"`
RestPostFilesVideo2spin LimitInfo `json:"rest:post:files:video2spin"`
RestPostFilesSpin2video LimitInfo `json:"rest:post:files:spin2video"`
RestPostFilesFetch LimitInfo `json:"rest:post:files:fetch"`
RestPostFilesUpload LimitInfo `json:"rest:post:files:upload"`
RestPostFilesDelete LimitInfo `json:"rest:post:files:delete"`
RestPostAccount LimitInfo `json:"rest:post:account"`
RestPostAccountFetching LimitInfo `json:"rest:post:account:fetching"`
RestGetStatsHttp LimitInfo `json:"rest:get:stats:http"`
RestGetStatsStorage LimitInfo `json:"rest:get:stats:storage"`
RestPostAccountNew LimitInfo `json:"rest:post:account:new"`
RestPostUserAccounts LimitInfo `json:"rest:post:user:accounts"`
RestGetRestCredentials LimitInfo `json:"rest:get:rest:credentials"`
RestPostVideoToSpin LimitInfo `json:"rest:post:video:toSpin"`
RestPostUploadToSirv LimitInfo `json:"rest:post:upload:toSirv"`
FtpGlobal LimitInfo `json:"ftp:global"`
FtpSTOR LimitInfo `json:"ftp:STOR"`
FtpRETR LimitInfo `json:"ftp:RETR"`
FtpDELE LimitInfo `json:"ftp:DELE"`
FetchFile LimitInfo `json:"fetch:file"`
}
type StorageInfo struct {
Plan int64 `json:"plan"`
Burstable int64 `json:"burstable"`
Extra int64 `json:"extra"`
Used int64 `json:"used"`
Files int64 `json:"files"`
QuotaExceededDate interface{} `json:"quotaExceededDate"` // The type here is uncertain, if it's a timestamp string you can use time.Time
}
type User struct {
Role string `json:"role"`
UserID string `json:"userId"`
}
type Filename string
type FileSearchPayload struct {
Query string `json:"query,omitempty"`
Sort map[string]string `json:"sort,omitempty"`
From int `json:"from,omitempty"`
Size int `json:"size,omitempty"`
Scroll bool `json:"scroll,omitempty"`
}
type FileSearchResponse struct {
Hits []FileHit `json:"hits"`
Total int `json:"total"`
Relation string `json:"_relation"`
ScrollId string `json:"scrollId,omitempty"`
}
type FileHit struct {
Index string `json:"_index"`
Type string `json:"_type"`
Id string `json:"_id"`
Routing string `json:"_routing"`
Source Source `json:"_source"`
Sort []float64 `json:"sort"`
}
type FileMeta struct {
Width int `json:"width"`
Height int `json:"height"`
Format string `json:"format"`
Duration int `json:"duration"`
EXIF EXIF `json:"EXIF"`
}
type EXIF struct {
ModifyDate string `json:"ModifyDate"`
}
type FileSearchScrollPayload struct {
ScrollId string `json:"scrollId"`
}
type FileSearchScrollResponse struct {
Hits []FileHit `json:"hits"`
Total int `json:"total"`
Relation string `json:"_relation"`
ScrollId string `json:"scrollId"`
}
type FolderContents struct {
Contents []File `json:"contents"`
Continuation string `json:"continuation"`
}
type CommonFileInfo struct {
MTime string `json:"mtime"`
ContentType string `json:"contentType"`
Size int `json:"size"`
IsDirectory bool `json:"isDirectory"`
Meta map[string]interface{} `json:"meta"`
}
type File struct {
CommonFileInfo
Filename Filename `json:"filename"`
}
type FileInfo struct {
CommonFileInfo
CTime string `json:"ctime"`
}
type Source struct {
CommonFileInfo
AccountId string `json:"accountId"`
Filename Filename `json:"filename"`
Dirname string `json:"dirname"`
Basename string `json:"basename"`
Extension string `json:"extension"`
Id string `json:"id"`
}
type FileDeletionResponse struct {
HTTPStatusCode int `json:"httpStatusCode"`
}
type DeleteFilePayload struct {
Filename Filename `json:"filename"`
}