types.go 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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. FeatureSpec FeatureSpec `json:"spec"`
  40. Slug string `json:"slug"`
  41. MaxLimit int64 `json:"max_limit"`
  42. }
  43. type FeatureSpec struct {
  44. ID string `json:"id"`
  45. Name string `json:"name"`
  46. MaxLimit int64 `json:"max_limit"`
  47. ProviderID string `json:"provider_id"`
  48. }
  49. type CreateTeamRequest struct {
  50. Name string `json:"name"`
  51. }
  52. type AddTeammateRequest struct {
  53. Role RoleEnum `json:"role"`
  54. Email string `json:"email"`
  55. SourceID string `json:"source_id"`
  56. TeamID string `json:"team_id"`
  57. }
  58. type UpdateTeammateRequest struct {
  59. Role RoleEnum `json:"role"`
  60. }
  61. type CreateIDTokenRequest struct {
  62. Email string `json:"customer_email"`
  63. UserID string `json:"customer_source_id"`
  64. }
  65. type CreateIDTokenResponse struct {
  66. Token string `json:"token"`
  67. }
  68. type SubscriptionWebhookRequest struct {
  69. EventType string `json:"event_type"`
  70. TeamID string `json:"team_id"`
  71. Plan Plan `json:"plan"`
  72. }
  73. type CreateSubscriptionRequest struct {
  74. PlanID string `json:"plan_id"`
  75. TeamID string `json:"team_id"`
  76. IsPaused bool `json:"is_paused"`
  77. NextPlanID string `json:"next_plan_id"`
  78. }