i2bill.api 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. syntax = "v1"
  2. info(
  3. title: // TODO: add title
  4. desc: // TODO: add description
  5. author: "double.huang"
  6. email: "2637309949@qq.com"
  7. )
  8. type WXLoginResponse {
  9. OpenID string `json:"openid"`
  10. SessionKey string `json:"session_key"`
  11. UnionID string `json:"unionid"`
  12. ErrCode int `json:"errcode"`
  13. ErrMsg string `json:"errmsg"`
  14. }
  15. type Watermark {
  16. AppID string `json:"appid"`
  17. TimeStamp int64 `json:"timestamp"`
  18. }
  19. type WXUserInfo {
  20. OpenID string `json:"openId,omitempty"`
  21. SessionKey string `json:"SessionKey"`
  22. NickName string `json:"nickName"`
  23. AvatarUrl string `json:"avatarUrl"`
  24. Gender int64 `json:"gender"`
  25. Country string `json:"country"`
  26. Province string `json:"province"`
  27. City string `json:"city"`
  28. UnionID string `json:"unionId,omitempty"`
  29. Language string `json:"language"`
  30. Watermark Watermark `json:"watermark,omitempty"`
  31. }
  32. type ResUserInfo {
  33. UserInfo WXUserInfo `json:"userInfo"`
  34. RawData string `json:"rawData"`
  35. Signature string `json:"signature"`
  36. EncryptedData string `json:"encryptedData"`
  37. IV string `json:"iv"`
  38. }
  39. type loginByWeixinRequest {
  40. Code string `json:"code"`
  41. // UserInfo ResUserInfo `json:"userInfo"`
  42. }
  43. type AuthUserInfo {
  44. ID int64 `json:"id"`
  45. Mobile string `json:"mobile"`
  46. UserName string `json:"username"`
  47. NickName string `json:"nickname"`
  48. Gender int64 `json:"gender"`
  49. Avatar string `json:"avatar"`
  50. Birthday int64 `json:"birthday"`
  51. }
  52. type loginByWeixinResponse {
  53. Token string `json:"token"`
  54. UserInfo AuthUserInfo `json:"userInfo"`
  55. }
  56. type jzQrcodeResponse {
  57. Id int64 `json:"id"`
  58. FileId string `json:"fileId"`
  59. }
  60. type bindMobileRequest {
  61. Iv string `json:"iv"`
  62. EncryptedData string `json:"encryptedData"`
  63. }
  64. type bindMobileResponse {
  65. Id int64 `json:"id"`
  66. }
  67. type partTimeUserAddRequest {
  68. Name string `json:"name"`
  69. IponeNumber string `json:"ipone_number"`
  70. Sex int64 `json:"sex"`
  71. MkId string `json:"mk_id"`
  72. CityId int64 `json:"city_id"` // 城市
  73. }
  74. type infoResponse {
  75. ID int64 `json:"id"`
  76. Mobile string `json:"mobile"`
  77. UserName string `json:"username"`
  78. NickName string `json:"nickname"`
  79. Gender int64 `json:"gender"`
  80. Avatar string `json:"avatar"`
  81. Birthday int64 `json:"birthday"`
  82. IsJzMem bool `json:"isJzMem"`
  83. IsJzMk bool `json:"isJzMk"`
  84. }
  85. service i2bill-api {
  86. @handler Hello
  87. get /api/hello
  88. @handler LoginByWeixin
  89. post /api/auth/loginByWeixin(loginByWeixinRequest) returns(loginByWeixinResponse)
  90. }
  91. @server(
  92. jwt: JwtAuth
  93. )
  94. service i2bill-api {
  95. @handler JzQrCode
  96. get /api/user/share/jzQrcode returns(jzQrcodeResponse)
  97. @handler BindMobile
  98. post /api/user/bindMobile(bindMobileRequest) returns(bindMobileResponse)
  99. @handler GetUser
  100. get /api/user/info returns(infoResponse)
  101. @handler GetUser // TODO: set handler name and delete this comment
  102. get /api/users/id/:userId(request) returns(response)
  103. @handler PartTimeUserAd
  104. post /api/v1/part_time_user/add (partTimeUserAddRequest) returns(response)
  105. }