-
Notifications
You must be signed in to change notification settings - Fork 0
/
Response.go
114 lines (90 loc) · 2.72 KB
/
Response.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
package libdatamanager
import (
"net/http"
)
// ResponseStatus the status of response
type ResponseStatus uint8
const (
// ResponseError if there was an error
ResponseError ResponseStatus = 0
// ResponseSuccess if the response is successful
ResponseSuccess ResponseStatus = 1
)
const (
// HeaderStatus headername for status in response
HeaderStatus string = "X-Response-Status"
// HeaderStatusMessage headername for status in response
HeaderStatusMessage string = "X-Response-Message"
// HeaderContentType contenttype of response
HeaderContentType string = "Content-Type"
// HeaderFileName filename header
HeaderFileName string = "X-Filename"
// HeaderRequest request content
HeaderRequest string = "Request"
// HeaderEncryption encryption header
HeaderEncryption string = "X-Encryption"
// HeaderContentLength request content length
HeaderContentLength string = "ContentLength"
// HeaderFileID fileid header
HeaderFileID string = "X-FileID"
// HeaderChecksum files checksum
HeaderChecksum string = "Checksum"
)
// LoginResponse response for login
type LoginResponse struct {
Token string `json:"token"`
Namespace string `json:"ns"`
}
// RestRequestResponse the response of a rest call
type RestRequestResponse struct {
HTTPCode int
Status ResponseStatus
Message string
Headers *http.Header
}
// StringResponse response containing only one string
type StringResponse struct {
String string `json:"content"`
}
// StringSliceResponse response containing only one string slice
type StringSliceResponse struct {
Slice []string `json:"slice"`
}
// FileListResponse response for listing files
type FileListResponse struct {
Files []FileResponseItem
}
// UploadResponse response for uploading file
type UploadResponse struct {
FileID uint `json:"fileID"`
Filename string `json:"filename"`
PublicFilename string `json:"publicFilename,omitempty"`
Checksum string `json:"checksum"`
FileSize int64 `json:"size"`
Namespace string `json:"ns"`
}
// PublishResponse response for publishing a file
type PublishResponse struct {
PublicFilename string `json:"pubName"`
}
// BulkPublishResponse response for publishing a file
type BulkPublishResponse struct {
Files []UploadResponse `json:"files"`
}
// CountResponse response containing a count of changed items
type CountResponse struct {
Count uint32 `json:"count"`
}
// IDsResponse response containing a list of ids
type IDsResponse struct {
IDs []uint `json:"ids"`
}
// UserAttributeDataResponse response for userattribute data
type UserAttributeDataResponse struct {
Namespace []Namespaceinfo `json:"nsData"`
}
// Namespaceinfo info for namespace
type Namespaceinfo struct {
Name string `json:"ns"`
Groups []string `json:"groups"`
}