-
Notifications
You must be signed in to change notification settings - Fork 476
/
Copy pathconsts.go
95 lines (74 loc) · 3.15 KB
/
consts.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
package apidesc
import (
"net/http"
)
type MethodName string
const (
MethodNameGET MethodName = http.MethodGet
MethodNamePOST MethodName = http.MethodPost
MethodNamePUT MethodName = http.MethodPut
MethodNameDELETE MethodName = http.MethodDelete
)
type ServiceName string
const (
ServiceNameUp ServiceName = "up"
ServiceNameIo ServiceName = "io"
ServiceNameRs ServiceName = "rs"
ServiceNameRsf ServiceName = "rsf"
ServiceNameApi ServiceName = "api"
ServiceNameBucket ServiceName = "uc"
)
// StringLikeType 类字符串参数类型
type StringLikeType = string
const (
StringLikeTypeString StringLikeType = "string" // 字符串
StringLikeTypeInteger StringLikeType = "integer" // 整型数字
StringLikeTypeFloat StringLikeType = "float" // 浮点型数字
StringLikeTypeBoolean StringLikeType = "boolean" // 布尔值
)
type MultipartFormDataType = string
const (
MultipartFormDataTypeString MultipartFormDataType = "string" // 字符串
MultipartFormDataTypeInteger MultipartFormDataType = "integer"
MultipartFormDataTypeUploadToken MultipartFormDataType = "upload_token"
MultipartFormDataTypeBinaryData MultipartFormDataType = "binary_data"
)
type OptionalType string
const (
OptionalTypeRequired OptionalType = "" // 用户必须传值
OptionalTypeOmitEmpty OptionalType = "omitempty" // 如果用户不传值,则该字段省略
OptionalTypeKeepEmpty OptionalType = "keepempty" // 即使用户不传值,也会发送空值
OptionalTypeNullable OptionalType = "nullable" // 如果用户不传值,则该字段省略,但如果用户传值,即使是空值也会发送
)
type Authorization string
const (
AuthorizationNone Authorization = ""
AuthorizationQbox Authorization = "Qbox"
AuthorizationQiniu Authorization = "qiniu"
AuthorizationUpToken Authorization = "UploadToken"
)
type Idempotent string
const (
IdempotentDefault Idempotent = "default" // 默认幂等性(根据 HTTP 方法判定)
IdempotentAlways Idempotent = "always" // 总是幂等
IdempotentNever Idempotent = "never" // 总是不幂等
)
type EncodeType string
const (
EncodeTypeNone EncodeType = "none"
EncodeTypeUrlSafeBase64 EncodeType = "url_safe_base64" // 需要进行编码
EncodeTypeUrlSafeBase64OrNone EncodeType = "url_safe_base64_or_none" // 不仅需要编码,即使路径参数的值是 None 也要编码。该选项暗示了 nullable
)
type ServiceBucketType string
const (
ServiceBucketTypeNone ServiceBucketType = "" //
ServiceBucketTypePlainText ServiceBucketType = "plain_text" // 该值为存储空间名称
ServiceBucketTypeEntry ServiceBucketType = "entry" // 该值格式为 UrlSafeBase64("$bucket:$key")
ServiceBucketTypeUploadToken ServiceBucketType = "upload_token" // 该值为上传凭证,内部包含存储空间信息
)
type ServiceObjectType string
const (
ServiceObjectTypeNone ServiceObjectType = "" //
ServiceObjectTypePlainText ServiceObjectType = "plain_text" // 该值为对象名称
ServiceObjectTypeEntry ServiceObjectType = "entry" // 该值格式为 UrlSafeBase64("$bucket:$key")
)