Bladeren bron

consolidate types and change comment

Alexander Belanger 4 jaren geleden
bovenliggende
commit
e2578c0b23
2 gewijzigde bestanden met toevoegingen van 30 en 32 verwijderingen
  1. 1 32
      ee/billing/ironplans.go
  2. 29 0
      ee/billing/types.go

+ 1 - 32
ee/billing/ironplans.go

@@ -24,8 +24,7 @@ import (
 	cemodels "github.com/porter-dev/porter/internal/models"
 )
 
-// Client contains an API client for a Bind DNS server wrapped
-// with a lightweight API
+// Client contains an API client for IronPlans
 type Client struct {
 	apiKey    string
 	serverURL string
@@ -43,31 +42,6 @@ func NewClient(serverURL, apiKey string, repo repository.EERepository) *Client {
 	return &Client{apiKey, serverURL, repo, httpClient}
 }
 
-// CreateTeamRequest creates a new team for billing
-type CreateTeamRequest struct {
-	Name string `json:"name"`
-}
-
-type AddTeammateRequest struct {
-	Role     RoleEnum `json:"role"`
-	Email    string   `json:"email"`
-	SourceID string   `json:"source_id"`
-	TeamID   string   `json:"team_id"`
-}
-
-type UpdateTeammateRequest struct {
-	Role RoleEnum `json:"role"`
-}
-
-type CreateIDTokenRequest struct {
-	Email  string `json:"customer_email"`
-	UserID string `json:"customer_source_id"`
-}
-
-type CreateIDTokenResponse struct {
-	Token string `json:"token"`
-}
-
 func (c *Client) CreateTeam(proj *cemodels.Project) (string, error) {
 	resp := &Team{}
 	err := c.postRequest("/teams/v1", &CreateTeamRequest{
@@ -329,11 +303,6 @@ func (c *Client) writeRequest(method, path string, data interface{}, dst interfa
 	return nil
 }
 
-type SubscriptionWebhookRequest struct {
-	TeamID string `json:"team_id"`
-	Plan   Plan   `json:"plan"`
-}
-
 const (
 	FeatureSlugCPU      string = "cpu"
 	FeatureSlugMemory   string = "memory"

+ 29 - 0
ee/billing/types.go

@@ -52,3 +52,32 @@ type FeatureSpec struct {
 	MaxLimit   int64  `json:"max_limit"`
 	ProviderID string `json:"provider_id"`
 }
+
+type CreateTeamRequest struct {
+	Name string `json:"name"`
+}
+
+type AddTeammateRequest struct {
+	Role     RoleEnum `json:"role"`
+	Email    string   `json:"email"`
+	SourceID string   `json:"source_id"`
+	TeamID   string   `json:"team_id"`
+}
+
+type UpdateTeammateRequest struct {
+	Role RoleEnum `json:"role"`
+}
+
+type CreateIDTokenRequest struct {
+	Email  string `json:"customer_email"`
+	UserID string `json:"customer_source_id"`
+}
+
+type CreateIDTokenResponse struct {
+	Token string `json:"token"`
+}
+
+type SubscriptionWebhookRequest struct {
+	TeamID string `json:"team_id"`
+	Plan   Plan   `json:"plan"`
+}