-
Notifications
You must be signed in to change notification settings - Fork 0
/
files.go
223 lines (195 loc) · 4.95 KB
/
files.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
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
// This file was auto-generated by Fern from our API Definition.
package api
import (
json "encoding/json"
fmt "fmt"
internal "github.com/VapiAI/server-sdk-go/internal"
time "time"
)
type File struct {
Object *string `json:"object,omitempty" url:"object,omitempty"`
Status *FileStatus `json:"status,omitempty" url:"status,omitempty"`
// This is the name of the file. This is just for your own reference.
Name *string `json:"name,omitempty" url:"name,omitempty"`
OriginalName *string `json:"originalName,omitempty" url:"originalName,omitempty"`
Bytes *float64 `json:"bytes,omitempty" url:"bytes,omitempty"`
Purpose *string `json:"purpose,omitempty" url:"purpose,omitempty"`
Mimetype *string `json:"mimetype,omitempty" url:"mimetype,omitempty"`
Key *string `json:"key,omitempty" url:"key,omitempty"`
Path *string `json:"path,omitempty" url:"path,omitempty"`
Bucket *string `json:"bucket,omitempty" url:"bucket,omitempty"`
Url *string `json:"url,omitempty" url:"url,omitempty"`
Metadata map[string]interface{} `json:"metadata,omitempty" url:"metadata,omitempty"`
// This is the unique identifier for the file.
Id string `json:"id" url:"id"`
// This is the unique identifier for the org that this file belongs to.
OrgId string `json:"orgId" url:"orgId"`
// This is the ISO 8601 date-time string of when the file was created.
CreatedAt time.Time `json:"createdAt" url:"createdAt"`
// This is the ISO 8601 date-time string of when the file was last updated.
UpdatedAt time.Time `json:"updatedAt" url:"updatedAt"`
extraProperties map[string]interface{}
rawJSON json.RawMessage
}
func (f *File) GetStatus() *FileStatus {
if f == nil {
return nil
}
return f.Status
}
func (f *File) GetName() *string {
if f == nil {
return nil
}
return f.Name
}
func (f *File) GetOriginalName() *string {
if f == nil {
return nil
}
return f.OriginalName
}
func (f *File) GetBytes() *float64 {
if f == nil {
return nil
}
return f.Bytes
}
func (f *File) GetPurpose() *string {
if f == nil {
return nil
}
return f.Purpose
}
func (f *File) GetMimetype() *string {
if f == nil {
return nil
}
return f.Mimetype
}
func (f *File) GetKey() *string {
if f == nil {
return nil
}
return f.Key
}
func (f *File) GetPath() *string {
if f == nil {
return nil
}
return f.Path
}
func (f *File) GetBucket() *string {
if f == nil {
return nil
}
return f.Bucket
}
func (f *File) GetUrl() *string {
if f == nil {
return nil
}
return f.Url
}
func (f *File) GetMetadata() map[string]interface{} {
if f == nil {
return nil
}
return f.Metadata
}
func (f *File) GetId() string {
if f == nil {
return ""
}
return f.Id
}
func (f *File) GetOrgId() string {
if f == nil {
return ""
}
return f.OrgId
}
func (f *File) GetCreatedAt() time.Time {
if f == nil {
return time.Time{}
}
return f.CreatedAt
}
func (f *File) GetUpdatedAt() time.Time {
if f == nil {
return time.Time{}
}
return f.UpdatedAt
}
func (f *File) GetExtraProperties() map[string]interface{} {
return f.extraProperties
}
func (f *File) UnmarshalJSON(data []byte) error {
type embed File
var unmarshaler = struct {
embed
CreatedAt *internal.DateTime `json:"createdAt"`
UpdatedAt *internal.DateTime `json:"updatedAt"`
}{
embed: embed(*f),
}
if err := json.Unmarshal(data, &unmarshaler); err != nil {
return err
}
*f = File(unmarshaler.embed)
f.CreatedAt = unmarshaler.CreatedAt.Time()
f.UpdatedAt = unmarshaler.UpdatedAt.Time()
extraProperties, err := internal.ExtractExtraProperties(data, *f)
if err != nil {
return err
}
f.extraProperties = extraProperties
f.rawJSON = json.RawMessage(data)
return nil
}
func (f *File) MarshalJSON() ([]byte, error) {
type embed File
var marshaler = struct {
embed
CreatedAt *internal.DateTime `json:"createdAt"`
UpdatedAt *internal.DateTime `json:"updatedAt"`
}{
embed: embed(*f),
CreatedAt: internal.NewDateTime(f.CreatedAt),
UpdatedAt: internal.NewDateTime(f.UpdatedAt),
}
return json.Marshal(marshaler)
}
func (f *File) String() string {
if len(f.rawJSON) > 0 {
if value, err := internal.StringifyJSON(f.rawJSON); err == nil {
return value
}
}
if value, err := internal.StringifyJSON(f); err == nil {
return value
}
return fmt.Sprintf("%#v", f)
}
type FileStatus string
const (
FileStatusIndexed FileStatus = "indexed"
FileStatusNotIndexed FileStatus = "not_indexed"
)
func NewFileStatusFromString(s string) (FileStatus, error) {
switch s {
case "indexed":
return FileStatusIndexed, nil
case "not_indexed":
return FileStatusNotIndexed, nil
}
var t FileStatus
return "", fmt.Errorf("%s is not a valid %T", s, t)
}
func (f FileStatus) Ptr() *FileStatus {
return &f
}
type UpdateFileDto struct {
// This is the name of the file. This is just for your own reference.
Name *string `json:"name,omitempty" url:"-"`
}