user.go 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. package types
  2. type User struct {
  3. ID uint `json:"id"`
  4. Email string `json:"email"`
  5. EmailVerified bool `json:"email_verified"`
  6. FirstName string `json:"first_name"`
  7. LastName string `json:"last_name"`
  8. CompanyName string `json:"company_name"`
  9. // ReferralCode is a unique code that can be shared to referr other users to Porter
  10. ReferralCode string `json:"referral_code"`
  11. // ReferralRewardClaimed indicates if the user has already received a credits reward
  12. // for referring users
  13. ReferralRewardClaimed bool `json:"referral_reward_received"`
  14. }
  15. type CreateUserRequest struct {
  16. Email string `json:"email" form:"required,max=255,email"`
  17. Password string `json:"password" form:"required,max=255"`
  18. FirstName string `json:"first_name" form:"required,max=255"`
  19. LastName string `json:"last_name" form:"required,max=255"`
  20. CompanyName string `json:"company_name" form:"required,max=255"`
  21. ReferralMethod string `json:"referral_method" form:"max=255"`
  22. // ReferredBy is the referral code of the user who referred this user
  23. ReferredBy string `json:"referred_by_code" form:"max=255"`
  24. }
  25. type CreateUserResponse User
  26. type GetAuthenticatedUserResponse User
  27. type LoginUserRequest struct {
  28. Email string `json:"email" form:"required,max=255,email"`
  29. Password string `json:"password" form:"required,max=255"`
  30. }
  31. type LoginUserResponse User
  32. type CLILoginUserRequest struct {
  33. Redirect string `schema:"redirect" form:"required"`
  34. }
  35. type CLILoginExchangeRequest struct {
  36. AuthorizationCode string `json:"authorization_code" form:"required"`
  37. }
  38. type CLILoginExchangeResponse struct {
  39. Token string `json:"token" form:"required"`
  40. }
  41. type InitiateResetUserPasswordRequest struct {
  42. Email string `json:"email" form:"required"`
  43. }
  44. type VerifyTokenFinalizeRequest struct {
  45. TokenID uint `json:"token_id" schema:"token_id" form:"required"`
  46. Token string `json:"token" schema:"token" form:"required"`
  47. }
  48. type VerifyEmailFinalizeRequest struct {
  49. VerifyTokenFinalizeRequest
  50. }
  51. type VerifyResetUserPasswordRequest struct {
  52. VerifyTokenFinalizeRequest
  53. Email string `json:"email" form:"required,max=255,email"`
  54. }
  55. type FinalizeResetUserPasswordRequest struct {
  56. VerifyResetUserPasswordRequest
  57. NewPassword string `json:"new_password" form:"required,max=255"`
  58. }
  59. // ListUserProjectsResponse type for api responses to GET /projects
  60. type ListUserProjectsResponse []*ProjectList
  61. type WelcomeWebhookRequest struct {
  62. Email string `json:"email" schema:"email"`
  63. IsCompany bool `json:"isCompany" schema:"isCompany"`
  64. Company string `json:"company" schema:"company"`
  65. Role string `json:"role" schema:"role"`
  66. Name string `json:"name" schema:"name"`
  67. }
  68. type UpdateUserInfoRequest struct {
  69. FirstName string `json:"first_name" form:"required,max=255"`
  70. LastName string `json:"last_name" form:"required,max=255"`
  71. CompanyName string `json:"company_name" form:"required,max=255"`
  72. }