API Reference
1. Info
- Title: gRPC API
- Version: 1.0.0
- Description: This documentation is generated from protobuf files using protoc-gen-doc.
2. Paths
Notify
Time
- Summary: Time
- Method:
Time - Endpoint:
notify.Notify/Time - Request:
- Content-Type:
application/grpc - Schema: Empty
- Content-Type:
- Response:
- Content-Type:
application/grpc - Schema: TimeResponse
- Content-Type:
AddMessage
- Summary: 添加站内信
- Method:
AddMessage - Endpoint:
notify.Notify/AddMessage - Request:
- Content-Type:
application/grpc - Schema: AddMessageRequest
- Content-Type:
- Response:
- Content-Type:
application/grpc - Schema: AddMessageResponse
- Content-Type:
DeleteMessage
- Summary: 删除站内信
- Method:
DeleteMessage - Endpoint:
notify.Notify/DeleteMessage - Request:
- Content-Type:
application/grpc - Schema: DeleteMessageRequest
- Content-Type:
- Response:
- Content-Type:
application/grpc - Schema: Empty
- Content-Type:
GetMessageList
- Summary: 获取站内信列表
- Method:
GetMessageList - Endpoint:
notify.Notify/GetMessageList - Request:
- Content-Type:
application/grpc - Schema: GetMessageListRequest
- Content-Type:
- Response:
- Content-Type:
application/grpc - Schema: GetMessageListResponse
- Content-Type:
GetUserMessageList
- Summary: 获取用户站内信
- Method:
GetUserMessageList - Endpoint:
notify.Notify/GetUserMessageList - Request:
- Content-Type:
application/grpc - Schema: GetUserMessageListRequest
- Content-Type:
- Response:
- Content-Type:
application/grpc - Schema: GetUserMessageListResponse
- Content-Type:
GetUserMessage
- Summary: 获取单个用户信息详情
- Method:
GetUserMessage - Endpoint:
notify.Notify/GetUserMessage - Request:
- Content-Type:
application/grpc - Schema: GetUserMessageRequest
- Content-Type:
- Response:
- Content-Type:
application/grpc - Schema: GetUserMessageResponse
- Content-Type:
UpdateUserMessage
- Summary: 更新用户站内信
- Method:
UpdateUserMessage - Endpoint:
notify.Notify/UpdateUserMessage - Request:
- Content-Type:
application/grpc - Schema: UpdateUserMessageRequest
- Content-Type:
- Response:
- Content-Type:
application/grpc - Schema: Empty
- Content-Type:
DeleteUserMessage
- Summary: 删除用户站内信
- Method:
DeleteUserMessage - Endpoint:
notify.Notify/DeleteUserMessage - Request:
- Content-Type:
application/grpc - Schema: DeleteUserMessageRequest
- Content-Type:
- Response:
- Content-Type:
application/grpc - Schema: Empty
- Content-Type:
AddUserMessage
- Summary: 增加用户站内信
- Method:
AddUserMessage - Endpoint:
notify.Notify/AddUserMessage - Request:
- Content-Type:
application/grpc - Schema: AddUserMessageRequest
- Content-Type:
- Response:
- Content-Type:
application/grpc - Schema: AddUserMessageResponse
- Content-Type:
SendEmail
- Summary: 发送邮件
- Method:
SendEmail - Endpoint:
notify.Notify/SendEmail - Request:
- Content-Type:
application/grpc - Schema: SendEmailRequest
- Content-Type:
- Response:
- Content-Type:
application/grpc - Schema: SendEmailResponse
- Content-Type:
GetSenderList
- Summary: 获取发件人列表
- Method:
GetSenderList - Endpoint:
notify.Notify/GetSenderList - Request:
- Content-Type:
application/grpc - Schema: GetSenderListRequest
- Content-Type:
- Response:
- Content-Type:
application/grpc - Schema: GetSenderListResponse
- Content-Type:
GetSender
- Summary: 获取发件人信息
- Method:
GetSender - Endpoint:
notify.Notify/GetSender - Request:
- Content-Type:
application/grpc - Schema: GetSenderRequest
- Content-Type:
- Response:
- Content-Type:
application/grpc - Schema: GetSenderResponse
- Content-Type:
GetMessageStatistics
- Summary: 获取消息统计信息
- Method:
GetMessageStatistics - Endpoint:
notify.Notify/GetMessageStatistics - Request:
- Content-Type:
application/grpc - Schema: GetMessageStatisticsRequest
- Content-Type:
- Response:
- Content-Type:
application/grpc - Schema: GetMessageStatisticsResponse
- Content-Type:
3. Components
3.1 Schemas
AccountMessage
| Field | Type | Description |
|---|---|---|
| e | EventName | 事件名称:1-订单事件,2-账户信息 |
| eT | int64 | 事件发生时间 |
| t | int32 | 事件类型 |
| b | BalanceMessage | none |
AddMessageRequest
| Field | Type | Description |
|---|---|---|
| sender | string | 发送人 |
| receiver | string | 接收者:all所有人 |
| title | string | 站内信标题 |
| content | string | 站内信内容 |
| senderType | SenderType | 消息类型:1-站内信 2-邮件 3-短信 |
| sendEmail | string | send email |
| operator | string | 操作人名称 |
AddMessageResponse
| Field | Type | Description |
|---|---|---|
| messageId | int64 | 站内信id |
AddUserMessageRequest
| Field | Type | Description |
|---|---|---|
| userId | string | 用户id |
| messageType | MessageType | 站内信id |
| title | string | title |
| content | string | 消息内容 |
| templateType | MessageTemplateType | 站内信类型 |
AddUserMessageResponse
| Field | Type | Description |
|---|---|---|
| userMessageId | int64 | 站内信id |
BalanceMessage
| Field | Type | Description |
|---|---|---|
| c | string | 变动量 |
| v | string | 总量 |
| l | string | 冻结 |
| f | string | 可用 |
| a | string | 资产id |
DeleteMessageRequest
| Field | Type | Description |
|---|---|---|
| messageIds | int64 | 站内信id |
DeleteUserMessageRequest
| Field | Type | Description |
|---|---|---|
| userMessageIds | int64 | 站内信id |
| userId | string | 用户id |
| messageType | MessageType | 消息类型:1-系统消息,2-成交消息,3-后台消息 |
EmailAttachment
| Field | Type | Description |
|---|---|---|
| attachmentBase64 | string | none |
| fileName | string | none |
GetMessageListRequest
| Field | Type | Description |
|---|---|---|
| offset | int32 | none |
| limit | int32 | 链id |
| searchValue | string | 搜索关键字 |
| senderType | SenderType | 消息类型:1-站内信 2-邮件 3-短信 |
GetMessageListResponse
| Field | Type | Description |
|---|---|---|
| list | GetMessageListResponse.Message | none |
| offset | int32 | 总页数 |
| limit | int32 | 当前页 |
| total | int64 | none |
Message
| Field | Type | Description |
|---|---|---|
| messageId | int64 | 站内信id |
| sender | string | 发送者 |
| receiver | string | 接收者 |
| title | string | 站内信标题 |
| content | string | 站内信内容 |
| createTime | int64 | 站内信创建时间 |
| senderType | SenderType | 消息类型:1-站内信 2-邮件 3-短信 |
| sendEmail | string | 发送者邮箱地址 |
| operator | string | 操作人名称 |
GetMessageStatisticsRequest
| Field | Type | Description |
|---|---|---|
| userId | string | 用户id |
| limit | int32 | 需要查询的消息条数:默认为1条 |
GetMessageStatisticsResponse
| Field | Type | Description |
|---|---|---|
| userId | string | 用户id |
| statistics | GetMessageStatisticsResponse.Statistics | 站内信统计信息 |
| total | int64 | 总消息数 |
Statistics
统计信息
| Field | Type | Description |
|---|---|---|
| unread | int64 | 未读消息数量 |
| read | int64 | 已读消息数量 |
| total | int64 | 总消息数量 |
| messageType | MessageType | 消息类型:1-系统消息,2-成交消息,3-后台消息 |
| messageList | GetUserMessageResponse | 消息列表 |
GetSenderListRequest
| Field | Type | Description |
|---|---|---|
| senderType | SenderType | 消息类型:1-站内信 2-邮件 3-短信 |
| messageType | MessageType | 消息类型:1-系统消息,2-成交消息,3-后台消息 |
GetSenderListResponse
| Field | Type | Description |
|---|---|---|
| list | GetSenderResponse | none |
GetSenderRequest
| Field | Type | Description |
|---|---|---|
| senderType | SenderType | 消息类型:1-站内信 2-邮件 3-短信 |
| messageType | MessageType | 消息类型:1-系统消息,2-成交消息,3-后台消息 |
GetSenderResponse
| Field | Type | Description |
|---|---|---|
| name | string | 发送者 |
| senderType | SenderType | 消息类型:1-站内信 2-邮件 3-短信 |
| from | string | 发送者来源 |
| messageType | MessageType | 消息类型:1-系统消息,2-成交消息,3-后台消息 |
GetUserMessageListRequest
| Field | Type | Description |
|---|---|---|
| userId | string | 用户id |
| isRead | MessageStatus | 站内信状态:1-未读,2-已读 |
| messageType | MessageType | 站内信类型:1-系统消息,2-成交消息,3-后台消息 |
| offset | int32 | none |
| limit | int32 | none |
GetUserMessageListResponse
| Field | Type | Description |
|---|---|---|
| list | GetUserMessageResponse | none |
| offset | int32 | 总页数 |
| limit | int32 | 当前页 |
| total | int64 | none |
GetUserMessageRequest
| Field | Type | Description |
|---|---|---|
| userMessageId | int64 | 站内信id |
| userId | string | 用户id |
GetUserMessageResponse
| Field | Type | Description |
|---|---|---|
| userMessageId | int64 | 站内信id |
| userId | string | 用户id |
| title | string | 消息头 |
| content | string | 消息内容 |
| messageType | MessageType | 站内信类型:1-系统消息,2-成交消息,3-后台消息 |
| isRead | MessageStatus | 站内信状态:1-未读,2-已读 |
| createTime | int64 | 站内信创建时间 |
| templateType | MessageTemplateType | 站内信类型:1-注册完成,2-登陆IP改变,3-修改密码成功,4-解绑GA成功,5-修改GA成功,6-KYC身份证审核通过,7-KYC身份证被拒,8-KYC居住地认证通过,9-KYC居住地认证被拒,10-充值到账,11-充值被隔离,12-充值地址更新,13-提现成功,14-提现审核被拒,15-补充保证金警报,16-强行平仓,17-对手盘减仓 |
NotifyMessage
| Field | Type | Description |
|---|---|---|
| e | EventName | 事件名称:1-订单事件,2-站内信事件 |
| eT | int64 | 事件发生时间 |
| h | string | 消息头部 |
| c | string | 消息内容 |
OrderMessage
| Field | Type | Description |
|---|---|---|
| e | EventName | 事件名称:1-订单事件,2-站内信事件 |
| eT | int64 | 事件发生时间 |
| t | int32 | 事件类型:1-挂单成功,2-成交,3-撤单成功,4-强平,5-自成交,6-挂单成交,7-吃单成交 |
| o | string | 订单id |
| s | string | 交易对 |
| p | string | 价格 |
| v | string | 成交量 |
| oS | string | 买卖方向 |
PlatformEvent
| Field | Type | Description |
|---|---|---|
| PlatformEventType | PlatformEventType | none |
| AccountId | string | none |
| string | none | |
| Data | PlatformEvent.DataEntry | none |
| emailAttachment | EmailAttachment | 附件:文件的base编码,若发送携带附件的文件,建议使用grpc调用 |
DataEntry
| Field | Type | Description |
|---|---|---|
| key | string | none |
| value | string | none |
Receiver
| Field | Type | Description |
|---|---|---|
| receiver_type.email | string | none |
| receiver_type.userId | string | none |
SendEmailRequest
| Field | Type | Description |
|---|---|---|
| subject | string | title |
| template | PlatformEventType | 邮件模版编号 |
| receiver | Receiver | none |
| sender | string | 邮件发送者:可为空 |
| msg | SendEmailRequest.MsgEntry | 邮件内容 |
| emailAttachment | EmailAttachment | 附件:文件的base编码,若发送携带附件的文件,建议使用grpc调用 |
| messageType | MessageType | 消息类型:1-系统消息,2-成交消息,3-后台消息,默认为1 |
| requestId | string | none |
MsgEntry
| Field | Type | Description |
|---|---|---|
| key | string | none |
| value | string | none |
SendEmailResponse
| Field | Type | Description |
|---|---|---|
| requestId | string | none |
TimeResponse
| Field | Type | Description |
|---|---|---|
| serverTime | int64 | 当前服务器时间 |
UpdateUserMessageRequest
| Field | Type | Description |
|---|---|---|
| userMessageIds | int64 | 站内信id |
| isRead | MessageStatus | 站内信状态:1-未读,2-已读 |
| userId | string | 用户id |
| messageType | MessageType | 消息类型:1-系统消息,2-成交消息,3-后台消息 |
3.2 Enums
EventName
| Name | Number | Description |
|---|---|---|
| NONE | 0 | none |
| ORDER | 1 | 订单事件 |
| ACCOUNT | 2 | 账户更新 |
| KEY_EXPIRED | 3 | Key过期 |
MessageStatus
| Name | Number | Description |
|---|---|---|
| STATUSNONE | 0 | none |
| UNREAD | 1 | 未读 |
| READ | 2 | 已读 |
MessageTemplateType
| Name | Number | Description |
|---|---|---|
| TYPENONE | 0 | none |
| REGISTER | 1 | 注册完成 |
| LOGINIP | 2 | 登陆IP改变 |
| CHANGEPASSWORD | 3 | 修改密码成功 |
| UNBINDGA | 4 | 解绑GA成功 |
| CHANGEGA | 5 | 修改GA成功 |
| KYC_IDCARD_PASS | 6 | KYC身份证审核通过 |
| KYC_IDCARD | 7 | KYC身份证被拒 |
| KYC_RESIDENCE_PASS | 8 | KYC居住地认证通过 |
| KYC_RESIDENCE | 9 | KYC居住地认证被拒 |
| DEPOSIT | 10 | 充值到账 |
| DEPOSIT_ISOLATED | 11 | 充值被隔离 |
| DEPOSIT_ADDRESS | 12 | 充值地址更新 |
| WITHDRAW | 13 | 提现成功 |
| WITHDRAW_AUDIT | 14 | 提现审核被拒 |
| ADDITIONAL_MARGIN | 15 | 补充保证金警报 |
| FORCED_LIQUIDATION | 16 | 强行平仓 |
| REDUCE_POSITION | 17 | 对手盘减仓 |
| ADMIN_MESSAGE | 18 | 后台消息 |
| KYC_PASS | 19 | KYC审核通过 |
MessageType
| Name | Number | Description |
|---|---|---|
| MESSAGENONE | 0 | none |
| SYSTEM | 1 | 系统消息 |
| TRADE | 2 | 交易信息 |
| ADMIN | 3 | 后台发送消息 |
PlatformEventType
| Name | Number | Description |
|---|---|---|
| PlatformEventTypeUnknown | 0 | not used, just for 0 check in proto3 |
| PlatformEventTypeRegistrationCompleted | 1 | 注册成功。-- |
| PlatformEventTypeLoginIPChanged | 2 | 登录IP变更。email, ip, time -- |
| PlatformEventTypeResetPasswordCompleted | 3 | 密码重置成功。-- |
| PlatformEventTypeGADisabled | 4 | 解绑GA成功。-- |
| PlatformEventTypeGAUpdated | 5 | 修改GA成功。-- |
| PlatformEventTypeKYCPassed | 6 | KYC审核通过。-- |
| PlatformEventTypeKYCIdentityRejected | 7 | KYC身份审核拒绝。reason -- |
| PlatformEventTypeResidentCertificationPassed | 8 | 居住地认证通过。 -- |
| PlatformEventTypeResidentCertificationRejected | 9 | 居住地认证拒绝。reason -- |
| PlatformEventTypeDepositCompleted | 10 | 充值成功。amount, asset, txId |
| PlatformEventTypeDepositIsolated | 11 | 充值被隔离。amount, asset, address |
| PlatformEventTypeDepositAddressUpdated | 12 | 充值地址更新。 |
| PlatformEventTypeWithdrawCompleted | 13 | 提现成功。 amount, asset, address,txId |
| PlatformEventTypeWithdrawRejected | 14 | 提现被拒绝。amount, asset, address, reason |
| PlatformEventTypeMarginCalled | 15 | 补充保证金警报。marginRatio, marginRatioThreshold, symbol, positionSide, isolationType |
| PlatformEventTypeLiquidated | 16 | 强平。symbol, positionSide, isolationType, markPrice, markPriceAsset |
| PlatformEventTypePositionReducted | 17 | 对手盘强行减仓。symbol, positionSide, isolationType, markPrice, markPriceAsset, amount, realizedPnl |
| PlatformEventTypeTwoFARegistrationRequested | 18 | 注册验证码,code, ip, validMinutes -- |
| PlatformEventTypeTwoFALoginRequested | 19 | 登录验证码,code, validMinutes -- |
| PlatformEventTypeTwoFAResetPasswordRequested | 20 | 重置密码验证码,code, validMinutes -- |
| PlatformEventTypeTwoFABindGARequested | 21 | 绑定GA验证码,code, validMinutes -- |
| PlatformEventTypeTwoFAWithdrawRequested | 22 | 提现验证码,code, validMinutes, amount, asset, address |
| PlatformEventTypeAdminMessage | 23 | 后台邮件 |
| PlatformEventTypeKYCIdentityPassed | 24 | KYC身份审核通过 -- |
| SpotEventTypeRegistrationCode | 25 | Spot |
注册验证码,code, ip, validMinutes | | SpotEventTypeRegistrationCompleted | 26 | 注册完成 | | SpotEventTypeLoginCode | 27 | 登录验证码,code, validMinutes | | SpotEventTypeResetPasswordCode | 28 | 重设密码验证码,code, validMinutes | | SpotEventTypeResetPasswordSuccess | 29 | 重设密码成功 | | SpotEventTypeBindGACode | 30 | 绑定GA验证码,code, validMinutes | | SpotEventTypeUnbindGACodeSuccess | 31 | 解绑GA成功 | | SpotEventTypeUpdateGASuccess | 32 | 修改GA成功 | | SpotEventTypeKYCIdentityPassed | 33 | KYC身份认证通过 | | SpotEventTypeKYCIdentityReturned | 34 | KYC身份认证退回,reason | | SpotEventTypeKYCIdentityPermanentlyRejected | 35 | KYC身份认证永久被拒绝,reason | | SpotEventTypeKYCComplete | 36 | KYC认证完成 | | SpotEventTypeDigitalCurrencyDepositReceived | 37 | 充值数字币到账,amount, asset,txId | | SpotEventTypeFiatCurrencyDepositReceived | 38 | 充值法币到账,amount, asset,orderId | | SpotEventTypeDepositAddressNotVerified | 39 | 充值地址未认证,amount, asset,address,blockchain | | SpotEventTypeDepositAmountMismatch | 40 | 充值金额不符,amount, asset | | SpotEventTypeDepositRejected | 41 | 充值被拒绝,amount, asset,address,txId | | SpotEventTypeDepositAddressUpdatePending | 42 | 充值地址即将更新,assets | | SpotEventTypeDepositAddressUpdated | 43 | 充值地址更新,assets | | SpotEventTypeFiatCurrencyWithdrawCode | 44 | 提现数字币验证码,amount, asset,address,code,validMinutes | | SpotEventTypeDigitalCurrencyWithdrawSuccess | 45 | 提现数字币成功,amount, asset,address,txId,time | | SpotEventTypeFiatCurrencyWithdrawSuccess | 46 | 提现法币成功,amount, currency,fee,txId,orderTime | | SpotEventTypeWithdrawRejected | 47 | 提现被拒绝,amount, asset,reason | | SpotEventTypeTradeSettlementStatistics | 48 | 交易成交统计 | | SpotEventTypeSelfTradeCancellationNotice | 49 | 交易自成交取消提示 | | SpotEventTypePositionLimitReminder | 50 | 持仓上限提醒 | | SpotEventTypeAddDepositWhiteList | 51 | 添加充值白名单,address,code,validMinutes | | SpotEventTypeRemoveDepositWhiteList | 52 | 删除充值白名单,address,code,validMinutes | | SpotEventTypeAddWithdrawWhiteList | 53 | 添加提现白名单,address,code,validMinutes | | SpotEventTypeRemoveWithdrawWhiteList | 54 | 删除提现白名单,address,code,validMinutes | | SpotEventTypeLoginNotification | 55 | 以下为新增内容
登录通知,userAgent,ip,ipCountry(HongKong),loginTime(2024-05-23 12:11:53(UTC)) | | SpotEventTypeLoginPasswordExpire | 56 | 登录密码过期,儅用戶密碼創建時間6個月時發送,告知用戶必須更改密碼,未修改密碼的用戶會被限制登陸。 | | SpotEventTypeDigitalCurrencyWithdrawCode | 57 | 提现法币验证码,amount, asset,bankName,bankNo,code,validMinutes | | SpotEventTypeAddDepositWhiteListSuccess | 58 | 添加充值地址白名单成功, address,time(2024-05-16 08:11:11) | | SpotEventTypeAddWithdrawWhiteListSuccess | 59 | 新增提现白名单地址成功, address,time(2024-05-16 08:11:11) | | SpotEventTypeAddBankAccountWhiteListSuccess | 60 | 添加银行账户白名单成功, bankName,bankNo,time(2024-05-16 08:11:11) | | SpotEventTypeRemoveBankAccountWhiteList | 61 | 删除银行账户白名单, //code,validMinutes,bankName,bankNo | | SpotEventTypeKYCUpdateRequired | 62 | KYC需要更新, 用戶KYC認證還有30天過期,或者管理員在後臺點擊需要更新時發送 | | SpotEventTypeKYCExpired | 63 | KYC失效, 用戶KYC認證過期時發送 | | SpotEventTypeHotWalletThresholdWarning | 64 | amount,asset,rate(2.35),valuation(1.5) | | SpotEventTypeDailyStatement | 65 | 日结
userId,date | | SpotEventTypeMonthlyStatement | 66 | 月结
userId,date | | SpotEventTypePasswordWillExpire | 67 | 密码即将过期
onlyDay | | SpotEventTypeOTCTradeNotification | 68 | OTC成交通知 | | SpotEventTypeOTCSettlementCompletedNotification | 69 | OTC結算完成通知 | | SpotEventTypeOTCSettlementCancelledNotification | 70 | OTC結算撤銷通知 | | SpotEventTypeUserTermsandConditions | 71 | KYC签名授权模版 | | SpotEventTypeIPMonitoring | 72 | IP Monitoring | | SpotEventTypeWalletAddressCountWarning | 73 | 地址数量不足报警
asset,walletTypes,count eg:assets=BTC/ETH walletTypes=hot/cold count=10 | | SpotEventTypeAddressScanningWarning | 74 | 白名单地址扫描警报
date/December 2, 2024,walletTypes,num,total | | SpotEventTypeWhiteListExpired | 75 | 白名单失效通知
type,blockchain,address eg:type=deposit/withdrawal,blockchain=ETH,address=0x1234567890123456789 | | SpotEventTypeBankAccountNotification | 76 | 银行账户通知模版
userId,username,no | | SpotEventTypeFiatSwapSubmitted | 77 | 法币换汇申请
fromAmount,fromAsset,toAmount,toAsset | | SpotEventTypeFiatSwapCompleted | 78 | 法币换汇审核通过
fromAmount,fromAsset,toAmount,toAsset,rate | | SpotEventTypeFiatSwapRejected | 79 | 法币换汇审核拒绝
fromAmount,fromAsset,toAmount,toAsset,remark | | SpotEventTypeRetailUpgradeToPI | 80 | 零售升级为PI | | SpotEventTypePIDowngradeToRetail | 81 | PI降级为零售 | | SpotEventTypeIDExpirationReminder | 82 | 身份证件到期提醒
users | | SpotEventTypeDigitalCurrencyDepositReminder | 83 | 数字币充值提醒
amount,asset | | SpotEventTypeDigitalCurrencyWithdrawReminder | 84 | 数字币提现提醒
amount,asset | | SpotEventTypeFiatCurrencyDepositReminder | 85 | 法币充值提醒
amount,asset | | SpotEventTypeFiatCurrencyWithdrawReminder | 86 | 法币提现提醒
amount,asset | | SpotEventTypeAddAddressWhiteListReminder | 87 | 添加地址白名单提醒
userId | | SpotEventTypeKYCSubmissionReminder | 88 | KYC信息提交提醒
userId |
SenderType
| Name | Number | Description |
|---|---|---|
| SENDNONE | 0 | none |
| NOTIFY | 1 | 站内信 |
| 2 | 邮件 | |
| SMS | 3 | 短信 |
4. Scalar Value Types
| Proto Type | Go Type | C++ Type | Java Type | Python Type | Notes |
|---|---|---|---|---|---|
| double | float64 | double | double | float | |
| float | float32 | float | float | float | |
| int32 | int32 | int32 | int | int | Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint32 instead. |
| int64 | int64 | int64 | long | int/long | Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint64 instead. |
| uint32 | uint32 | uint32 | int | int/long | Uses variable-length encoding. |
| uint64 | uint64 | uint64 | long | int/long | Uses variable-length encoding. |
| sint32 | int32 | int32 | int | int | Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int32s. |
| sint64 | int64 | int64 | long | int/long | Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int64s. |
| fixed32 | uint32 | uint32 | int | int | Always four bytes. More efficient than uint32 if values are often greater than 2^28. |
| fixed64 | uint64 | uint64 | long | int/long | Always eight bytes. More efficient than uint64 if values are often greater than 2^56. |
| sfixed32 | int32 | int32 | int | int | Always four bytes. |
| sfixed64 | int64 | int64 | long | int/long | Always eight bytes. |
| bool | bool | bool | boolean | boolean | |
| string | string | string | String | str/unicode | A string must always contain UTF-8 encoded or 7-bit ASCII text. |
| bytes | []byte | string | ByteString | str | May contain any arbitrary sequence of bytes. |
