api.proto 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. syntax = "proto3";
  2. import "google/api/annotations.proto";
  3. import "github.com/gogo/protobuf/gogoproto/gogo.proto";
  4. package passport.service.sns;
  5. option go_package = "api";
  6. service PassportSNS {
  7. // GetAuthorizeURL get authorize url
  8. rpc GetAuthorizeURL (GetAuthorizeURLReq) returns (GetAuthorizeURLReply) {
  9. option (google.api.http) = {
  10. get: "/x/internal/passport-sns/authorize/url";
  11. };
  12. }
  13. // Bind bind sns account
  14. rpc Bind (BindReq) returns (EmptyReply) {
  15. option (google.api.http) = {
  16. post: "/x/internal/passport-sns/bind";
  17. };
  18. }
  19. // Unbind unbind sns account
  20. rpc Unbind (UnbindReq) returns (EmptyReply) {
  21. option (google.api.http) = {
  22. post: "/x/internal/passport-sns/unbind";
  23. };
  24. }
  25. // GetInfo get info by mid
  26. rpc GetInfo (GetInfoReq) returns (GetInfoReply) {
  27. option (google.api.http) = {
  28. get: "/x/internal/passport-sns/info";
  29. };
  30. }
  31. // GetInfoByCode get info by authorize code
  32. rpc GetInfoByCode (GetInfoByCodeReq) returns (GetInfoByCodeReply) {
  33. option (google.api.http) = {
  34. get: "/x/internal/passport-sns/info/code";
  35. };
  36. }
  37. // UpdateInfo update info
  38. rpc UpdateInfo (UpdateInfoReq) returns (EmptyReply) {
  39. option (google.api.http) = {
  40. post: "/x/internal/passport-sns/info/update";
  41. };
  42. }
  43. }
  44. message EmptyReply {
  45. }
  46. message Info {
  47. int64 mid = 1 [(gogoproto.jsontag) = "mid"];
  48. string platform = 2 [(gogoproto.jsontag) = "platform"];
  49. string union_id = 3 [(gogoproto.jsontag) = "unionid"];
  50. int64 expires = 4 [(gogoproto.jsontag) = "expires"];
  51. }
  52. message GetAuthorizeURLReq {
  53. string app_id = 1 [(gogoproto.moretags) = "form:\"appid\" validate:\"required\""];
  54. string platform = 2 [(gogoproto.moretags) = "form:\"platform\" validate:\"required\""];
  55. string redirect_url = 3 [(gogoproto.moretags) = "form:\"redirect_url\" validate:\"required\""];
  56. string display = 4 [(gogoproto.moretags) = "form:\"display\""];
  57. }
  58. message GetAuthorizeURLReply {
  59. string url = 1 [(gogoproto.jsontag) = "url"];
  60. }
  61. message BindReq {
  62. int64 mid = 1 [(gogoproto.moretags) = "form:\"mid\" validate:\"required\""];
  63. string code = 2 [(gogoproto.moretags) = "form:\"code\" validate:\"required\""];
  64. string app_id = 3 [(gogoproto.moretags) = "form:\"appid\" validate:\"required\""];
  65. string platform = 4 [(gogoproto.moretags) = "form:\"platform\" validate:\"required\""];
  66. string redirect_url = 5 [(gogoproto.moretags) = "form:\"redirect_url\" validate:\"required\""];
  67. }
  68. message UnbindReq {
  69. int64 mid = 1 [(gogoproto.moretags) = "form:\"mid\" validate:\"required\""];
  70. string app_id = 2 [(gogoproto.moretags) = "form:\"appid\""];
  71. string platform = 3 [(gogoproto.moretags) = "form:\"platform\" validate:\"required\""];
  72. }
  73. message GetInfoReq {
  74. int64 mid = 1 [(gogoproto.moretags) = "form:\"mid\" validate:\"required\""];
  75. }
  76. message GetInfoReply {
  77. repeated Info infos = 1 [(gogoproto.jsontag) = "infos"];
  78. }
  79. message GetInfoByCodeReq {
  80. string code = 1 [(gogoproto.moretags) = "form:\"code\" validate:\"required\""];
  81. string app_id = 2 [(gogoproto.moretags) = "form:\"appid\" validate:\"required\""];
  82. string platform = 3 [(gogoproto.moretags) = "form:\"platform\" validate:\"required\""];
  83. string redirect_url = 4 [(gogoproto.moretags) = "form:\"redirect_url\" validate:\"required\""];
  84. }
  85. message GetInfoByCodeReply {
  86. int64 mid = 1 [(gogoproto.jsontag) = "mid"];
  87. string union_id = 2 [(gogoproto.jsontag) = "unionid"];
  88. string open_id = 3 [(gogoproto.jsontag) = "openid"];
  89. int64 expires = 4 [(gogoproto.jsontag) = "expires"];
  90. string token = 5 [(gogoproto.jsontag) = "token"];
  91. }
  92. message UpdateInfoReq {
  93. string platform = 1 [(gogoproto.moretags) = "form:\"platform\" validate:\"required\""];
  94. string app_id = 2 [(gogoproto.moretags) = "form:\"appid\" validate:\"required\""];
  95. int64 mid = 3 [(gogoproto.moretags) = "form:\"mid\" validate:\"required\""];
  96. string open_id = 4 [(gogoproto.moretags) = "form:\"openid\" validate:\"required\""];
  97. }