types.go 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. // +build ee
  2. package billing
  3. type Team struct {
  4. ID string `json:"id"`
  5. ProviderID string `json:"provider_id"`
  6. Name string `json:"name"`
  7. Members []Teammate `json:"members"`
  8. Subscription Subscription `json:"subscription"`
  9. }
  10. type RoleEnum string
  11. const (
  12. RoleEnumOwner RoleEnum = "owner"
  13. RoleEnumMember RoleEnum = "member"
  14. )
  15. type Teammate struct {
  16. ID string `json:"id"`
  17. CustomerID string `json:"customer_id"`
  18. Role RoleEnum `json:"role"`
  19. Email string `json:"email"`
  20. }
  21. type Subscription struct {
  22. ID string `json:"id"`
  23. Plan Plan `json:"plan"`
  24. IsActive bool `json:"is_active"`
  25. }
  26. type Plan struct {
  27. ID string `json:"id"`
  28. ProviderID string `json:"string"`
  29. Name string `json:"name"`
  30. IsActive bool `json:"is_active"`
  31. Features []PlanFeature `json:"features"`
  32. }
  33. type ListPlansResponse struct {
  34. Results []Plan `json:"results"`
  35. }
  36. type PlanFeature struct {
  37. ID string `json:"id"`
  38. IsActive bool `json:"is_active"`
  39. Feature Feature `json:"feature"`
  40. FeatureSpec FeatureSpec `json:"spec"`
  41. }
  42. type Feature struct {
  43. Slug string `json:"slug"`
  44. }
  45. type FeatureSpec struct {
  46. ID string `json:"id"`
  47. Name string `json:"name"`
  48. MaxLimit int64 `json:"max_limit"`
  49. ProviderID string `json:"provider_id"`
  50. }
  51. type CreateTeamRequest struct {
  52. Name string `json:"name"`
  53. }
  54. type AddTeammateRequest struct {
  55. Role RoleEnum `json:"role"`
  56. Email string `json:"email"`
  57. SourceID string `json:"source_id"`
  58. TeamID string `json:"team_id"`
  59. }
  60. type UpdateTeammateRequest struct {
  61. Role RoleEnum `json:"role"`
  62. }
  63. type CreateIDTokenRequest struct {
  64. Email string `json:"customer_email"`
  65. UserID string `json:"customer_source_id"`
  66. }
  67. type CreateIDTokenResponse struct {
  68. Token string `json:"token"`
  69. }
  70. type SubscriptionWebhookRequest struct {
  71. EventType string `json:"event_type"`
  72. TeamID string `json:"team_id"`
  73. Plan Plan `json:"plan"`
  74. }
  75. type CreateSubscriptionRequest struct {
  76. PlanID string `json:"plan_id"`
  77. TeamID string `json:"team_id"`
  78. IsPaused bool `json:"is_paused"`
  79. NextPlanID string `json:"next_plan_id"`
  80. }