forked from apprentice3d/forge-api-go-client
/
types.go
131 lines (113 loc) · 4.31 KB
/
types.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
package recap
// PhotoScene holds data encountered in replies like creation of photoScene
type PhotoScene struct {
ID string `json:"photosceneid"`
Name string `json:"name,omitempty"`
Files []string `json:",omitempty"`
Formats []string `json:",omitempty"`
Metadata []struct {
Name string
Values string
} `json:",omitempty"`
}
// SceneCreationReply reflects the response content upon scene creation
type SceneCreationReply struct {
Usage string `json:",omitempty"`
Resource string `json:",omitempty"`
PhotoScene PhotoScene `json:"Photoscene,omitempty"`
Error *Error `json:"Error,omitempty"`
}
// SceneDeletionReply reflects the response content upon scene deletion
type SceneDeletionReply struct {
Usage string `json:",omitempty"`
Resource string `json:",omitempty"`
Message string `json:"msg"`
Error *Error `json:"Error,omitempty"`
}
// SceneCancelReply reflects the response content upon scene cancel processing
type SceneCancelReply struct {
Usage string `json:",omitempty"`
Resource string `json:",omitempty"`
Message string `json:"msg"`
Error *Error `json:"Error,omitempty"`
}
// FileUploadingReply reflects the response content upon uploading a file,
// be it a link or a local one
type FileUploadingReply struct {
Usage string `json:",omitempty"`
Resource string `json:",omitempty"`
Files *struct {
File struct {
FileName string `json:"filename"`
FileID string `json:"fileid"`
FileSize string `json:"filesize"`
Message string `json:"msg"`
} `json:"file"`
} `json:"Files"`
Error *Error `json:"Error,omitempty"`
}
//type LinksUploadingReply struct {
// Usage string `json:",omitempty"`
// Resource string `json:",omitempty"`
// Files *struct {
// File []struct {
// FileName string `json:"filename"`
// FileID string `json:"fileid"`
// FileSize string `json:"filesize"`
// Message string `json:"msg"`
// } `json:"file"`
// } `json:"Files"`
// Error *struct {
// Code string `json:"code"`
// Message string `json:"msg"`
// } `json:"Error"`
//}
// SceneStartProcessingReply reflects the response content upon starting scene processing
type SceneStartProcessingReply struct {
Message string `json:"msg"`
PhotoScene PhotoScene `json:"Photoscene"`
Error *Error `json:"Error,omitempty"`
}
// SceneProgressReply reflects the response content upon polling for scene status
type SceneProgressReply struct {
Usage string `json:",omitempty"`
Resource string `json:",omitempty"`
PhotoScene struct {
ID string `json:"photosceneid"`
Message string `json:"progressmsg"`
Progress string `json:"progress"`
} `json:"Photoscene"`
Error *Error `json:"Error,omitempty"`
}
// SceneResultReply reflects the response content upon requesting the scene results in a certain format
type SceneResultReply struct {
PhotoScene struct {
ID string `json:"photosceneid"`
Message string `json:"progressmsg"`
Progress string `json:"progress"`
SceneLink string `json:"scenelink"`
FileSize string `json:"filesize"`
} `json:"Photoscene"`
Error *Error `json:"Error,omitempty"`
}
// BUG(apprentice3d): SceneResultReply has a slightly different schema when getting results from a successfully
// processed scene and one that failed. In this situation, error of type [JSON DECODING ERROR] should be considered
// as [SCENE FAILED TO PROCESS]
// ErrorMessage represents a struct corresponding to successfully received task, but failed due to some reasons.
// Check the bug section of this documentation for more info.
type ErrorMessage struct {
Usage string `json:",omitempty"`
Resource string `json:",omitempty"`
Error *Error `json:"Error"`
}
// BUG(apprentice3d) Frequently the operation succeeded with returning code 200, meaning that the task was
// received successfully, but failed to execute due to reasons specified in message
// (g.e. uploading a file by specifying an wrong link: POST request is successful,
// but internally it failed to download the file because of the wrongly provided link)
// Error is inner struct encountered in cases when the server reported status OK, but still contains details
// on encountered errors. Check the bug section of this documentation for more info.
// This bug was reported to the engineering team
type Error struct {
Code string `json:"code"`
Message string `json:"msg"`
}