diff --git a/client.gen.go b/client.gen.go index b733f93..fda3f69 100644 --- a/client.gen.go +++ b/client.gen.go @@ -297,6 +297,17 @@ type ClientInterface interface { // DownloadPluginAssetByTeam request DownloadPluginAssetByTeam(ctx context.Context, teamName TeamName, pluginTeam PluginTeam, pluginKind PluginKind, pluginName PluginName, versionName VersionName, targetName TargetName, params *DownloadPluginAssetByTeamParams, reqEditors ...RequestEditorFn) (*http.Response, error) + // ListSubscriptionOrdersByTeam request + ListSubscriptionOrdersByTeam(ctx context.Context, teamName TeamName, params *ListSubscriptionOrdersByTeamParams, reqEditors ...RequestEditorFn) (*http.Response, error) + + // CreateSubscriptionOrderForTeamWithBody request with any body + CreateSubscriptionOrderForTeamWithBody(ctx context.Context, teamName TeamName, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) + + CreateSubscriptionOrderForTeam(ctx context.Context, teamName TeamName, body CreateSubscriptionOrderForTeamJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) + + // GetSubscriptionOrderByTeam request + GetSubscriptionOrderByTeam(ctx context.Context, teamName TeamName, teamSubscriptionOrderID TeamSubscriptionOrderID, reqEditors ...RequestEditorFn) (*http.Response, error) + // ListTeamPluginUsage request ListTeamPluginUsage(ctx context.Context, teamName TeamName, params *ListTeamPluginUsageParams, reqEditors ...RequestEditorFn) (*http.Response, error) @@ -1241,6 +1252,54 @@ func (c *Client) DownloadPluginAssetByTeam(ctx context.Context, teamName TeamNam return c.Client.Do(req) } +func (c *Client) ListSubscriptionOrdersByTeam(ctx context.Context, teamName TeamName, params *ListSubscriptionOrdersByTeamParams, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewListSubscriptionOrdersByTeamRequest(c.Server, teamName, params) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +func (c *Client) CreateSubscriptionOrderForTeamWithBody(ctx context.Context, teamName TeamName, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewCreateSubscriptionOrderForTeamRequestWithBody(c.Server, teamName, contentType, body) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +func (c *Client) CreateSubscriptionOrderForTeam(ctx context.Context, teamName TeamName, body CreateSubscriptionOrderForTeamJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewCreateSubscriptionOrderForTeamRequest(c.Server, teamName, body) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +func (c *Client) GetSubscriptionOrderByTeam(ctx context.Context, teamName TeamName, teamSubscriptionOrderID TeamSubscriptionOrderID, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewGetSubscriptionOrderByTeamRequest(c.Server, teamName, teamSubscriptionOrderID) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + func (c *Client) ListTeamPluginUsage(ctx context.Context, teamName TeamName, params *ListTeamPluginUsageParams, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewListTeamPluginUsageRequest(c.Server, teamName, params) if err != nil { @@ -4845,6 +4904,166 @@ func NewDownloadPluginAssetByTeamRequest(server string, teamName TeamName, plugi return req, nil } +// NewListSubscriptionOrdersByTeamRequest generates requests for ListSubscriptionOrdersByTeam +func NewListSubscriptionOrdersByTeamRequest(server string, teamName TeamName, params *ListSubscriptionOrdersByTeamParams) (*http.Request, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "team_name", runtime.ParamLocationPath, teamName) + if err != nil { + return nil, err + } + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/teams/%s/subscription-orders", pathParam0) + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + if params != nil { + queryValues := queryURL.Query() + + if params.Page != nil { + + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "page", runtime.ParamLocationQuery, *params.Page); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } + } + + } + + if params.PerPage != nil { + + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "per_page", runtime.ParamLocationQuery, *params.PerPage); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } + } + + } + + queryURL.RawQuery = queryValues.Encode() + } + + req, err := http.NewRequest("GET", queryURL.String(), nil) + if err != nil { + return nil, err + } + + return req, nil +} + +// NewCreateSubscriptionOrderForTeamRequest calls the generic CreateSubscriptionOrderForTeam builder with application/json body +func NewCreateSubscriptionOrderForTeamRequest(server string, teamName TeamName, body CreateSubscriptionOrderForTeamJSONRequestBody) (*http.Request, error) { + var bodyReader io.Reader + buf, err := json.Marshal(body) + if err != nil { + return nil, err + } + bodyReader = bytes.NewReader(buf) + return NewCreateSubscriptionOrderForTeamRequestWithBody(server, teamName, "application/json", bodyReader) +} + +// NewCreateSubscriptionOrderForTeamRequestWithBody generates requests for CreateSubscriptionOrderForTeam with any type of body +func NewCreateSubscriptionOrderForTeamRequestWithBody(server string, teamName TeamName, contentType string, body io.Reader) (*http.Request, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "team_name", runtime.ParamLocationPath, teamName) + if err != nil { + return nil, err + } + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/teams/%s/subscription-orders", pathParam0) + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + req, err := http.NewRequest("POST", queryURL.String(), body) + if err != nil { + return nil, err + } + + req.Header.Add("Content-Type", contentType) + + return req, nil +} + +// NewGetSubscriptionOrderByTeamRequest generates requests for GetSubscriptionOrderByTeam +func NewGetSubscriptionOrderByTeamRequest(server string, teamName TeamName, teamSubscriptionOrderID TeamSubscriptionOrderID) (*http.Request, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "team_name", runtime.ParamLocationPath, teamName) + if err != nil { + return nil, err + } + + var pathParam1 string + + pathParam1, err = runtime.StyleParamWithLocation("simple", false, "subscription_order_id", runtime.ParamLocationPath, teamSubscriptionOrderID) + if err != nil { + return nil, err + } + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/teams/%s/subscription-orders/%s", pathParam0, pathParam1) + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + req, err := http.NewRequest("GET", queryURL.String(), nil) + if err != nil { + return nil, err + } + + return req, nil +} + // NewListTeamPluginUsageRequest generates requests for ListTeamPluginUsage func NewListTeamPluginUsageRequest(server string, teamName TeamName, params *ListTeamPluginUsageParams) (*http.Request, error) { var err error @@ -5566,6 +5785,17 @@ type ClientWithResponsesInterface interface { // DownloadPluginAssetByTeamWithResponse request DownloadPluginAssetByTeamWithResponse(ctx context.Context, teamName TeamName, pluginTeam PluginTeam, pluginKind PluginKind, pluginName PluginName, versionName VersionName, targetName TargetName, params *DownloadPluginAssetByTeamParams, reqEditors ...RequestEditorFn) (*DownloadPluginAssetByTeamResponse, error) + // ListSubscriptionOrdersByTeamWithResponse request + ListSubscriptionOrdersByTeamWithResponse(ctx context.Context, teamName TeamName, params *ListSubscriptionOrdersByTeamParams, reqEditors ...RequestEditorFn) (*ListSubscriptionOrdersByTeamResponse, error) + + // CreateSubscriptionOrderForTeamWithBodyWithResponse request with any body + CreateSubscriptionOrderForTeamWithBodyWithResponse(ctx context.Context, teamName TeamName, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateSubscriptionOrderForTeamResponse, error) + + CreateSubscriptionOrderForTeamWithResponse(ctx context.Context, teamName TeamName, body CreateSubscriptionOrderForTeamJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateSubscriptionOrderForTeamResponse, error) + + // GetSubscriptionOrderByTeamWithResponse request + GetSubscriptionOrderByTeamWithResponse(ctx context.Context, teamName TeamName, teamSubscriptionOrderID TeamSubscriptionOrderID, reqEditors ...RequestEditorFn) (*GetSubscriptionOrderByTeamResponse, error) + // ListTeamPluginUsageWithResponse request ListTeamPluginUsageWithResponse(ctx context.Context, teamName TeamName, params *ListTeamPluginUsageParams, reqEditors ...RequestEditorFn) (*ListTeamPluginUsageResponse, error) @@ -7096,6 +7326,89 @@ func (r DownloadPluginAssetByTeamResponse) StatusCode() int { return 0 } +type ListSubscriptionOrdersByTeamResponse struct { + Body []byte + HTTPResponse *http.Response + JSON200 *struct { + Items []TeamSubscriptionOrder `json:"items"` + Metadata ListMetadata `json:"metadata"` + } + JSON401 *RequiresAuthentication + JSON403 *Forbidden + JSON404 *NotFound + JSON500 *InternalError +} + +// Status returns HTTPResponse.Status +func (r ListSubscriptionOrdersByTeamResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r ListSubscriptionOrdersByTeamResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +type CreateSubscriptionOrderForTeamResponse struct { + Body []byte + HTTPResponse *http.Response + JSON201 *TeamSubscriptionOrder + JSON400 *BadRequest + JSON401 *RequiresAuthentication + JSON403 *Forbidden + JSON404 *NotFound + JSON422 *UnprocessableEntity + JSON500 *InternalError +} + +// Status returns HTTPResponse.Status +func (r CreateSubscriptionOrderForTeamResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r CreateSubscriptionOrderForTeamResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +type GetSubscriptionOrderByTeamResponse struct { + Body []byte + HTTPResponse *http.Response + JSON200 *TeamSubscriptionOrder + JSON401 *RequiresAuthentication + JSON403 *Forbidden + JSON404 *NotFound + JSON500 *InternalError +} + +// Status returns HTTPResponse.Status +func (r GetSubscriptionOrderByTeamResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r GetSubscriptionOrderByTeamResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + type ListTeamPluginUsageResponse struct { Body []byte HTTPResponse *http.Response @@ -8001,6 +8314,41 @@ func (c *ClientWithResponses) DownloadPluginAssetByTeamWithResponse(ctx context. return ParseDownloadPluginAssetByTeamResponse(rsp) } +// ListSubscriptionOrdersByTeamWithResponse request returning *ListSubscriptionOrdersByTeamResponse +func (c *ClientWithResponses) ListSubscriptionOrdersByTeamWithResponse(ctx context.Context, teamName TeamName, params *ListSubscriptionOrdersByTeamParams, reqEditors ...RequestEditorFn) (*ListSubscriptionOrdersByTeamResponse, error) { + rsp, err := c.ListSubscriptionOrdersByTeam(ctx, teamName, params, reqEditors...) + if err != nil { + return nil, err + } + return ParseListSubscriptionOrdersByTeamResponse(rsp) +} + +// CreateSubscriptionOrderForTeamWithBodyWithResponse request with arbitrary body returning *CreateSubscriptionOrderForTeamResponse +func (c *ClientWithResponses) CreateSubscriptionOrderForTeamWithBodyWithResponse(ctx context.Context, teamName TeamName, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateSubscriptionOrderForTeamResponse, error) { + rsp, err := c.CreateSubscriptionOrderForTeamWithBody(ctx, teamName, contentType, body, reqEditors...) + if err != nil { + return nil, err + } + return ParseCreateSubscriptionOrderForTeamResponse(rsp) +} + +func (c *ClientWithResponses) CreateSubscriptionOrderForTeamWithResponse(ctx context.Context, teamName TeamName, body CreateSubscriptionOrderForTeamJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateSubscriptionOrderForTeamResponse, error) { + rsp, err := c.CreateSubscriptionOrderForTeam(ctx, teamName, body, reqEditors...) + if err != nil { + return nil, err + } + return ParseCreateSubscriptionOrderForTeamResponse(rsp) +} + +// GetSubscriptionOrderByTeamWithResponse request returning *GetSubscriptionOrderByTeamResponse +func (c *ClientWithResponses) GetSubscriptionOrderByTeamWithResponse(ctx context.Context, teamName TeamName, teamSubscriptionOrderID TeamSubscriptionOrderID, reqEditors ...RequestEditorFn) (*GetSubscriptionOrderByTeamResponse, error) { + rsp, err := c.GetSubscriptionOrderByTeam(ctx, teamName, teamSubscriptionOrderID, reqEditors...) + if err != nil { + return nil, err + } + return ParseGetSubscriptionOrderByTeamResponse(rsp) +} + // ListTeamPluginUsageWithResponse request returning *ListTeamPluginUsageResponse func (c *ClientWithResponses) ListTeamPluginUsageWithResponse(ctx context.Context, teamName TeamName, params *ListTeamPluginUsageParams, reqEditors ...RequestEditorFn) (*ListTeamPluginUsageResponse, error) { rsp, err := c.ListTeamPluginUsage(ctx, teamName, params, reqEditors...) @@ -11137,6 +11485,185 @@ func ParseDownloadPluginAssetByTeamResponse(rsp *http.Response) (*DownloadPlugin return response, nil } +// ParseListSubscriptionOrdersByTeamResponse parses an HTTP response from a ListSubscriptionOrdersByTeamWithResponse call +func ParseListSubscriptionOrdersByTeamResponse(rsp *http.Response) (*ListSubscriptionOrdersByTeamResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &ListSubscriptionOrdersByTeamResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: + var dest struct { + Items []TeamSubscriptionOrder `json:"items"` + Metadata ListMetadata `json:"metadata"` + } + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON200 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401: + var dest RequiresAuthentication + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON401 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 403: + var dest Forbidden + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON403 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: + var dest NotFound + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON404 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 500: + var dest InternalError + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON500 = &dest + + } + + return response, nil +} + +// ParseCreateSubscriptionOrderForTeamResponse parses an HTTP response from a CreateSubscriptionOrderForTeamWithResponse call +func ParseCreateSubscriptionOrderForTeamResponse(rsp *http.Response) (*CreateSubscriptionOrderForTeamResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &CreateSubscriptionOrderForTeamResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 201: + var dest TeamSubscriptionOrder + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON201 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400: + var dest BadRequest + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON400 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401: + var dest RequiresAuthentication + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON401 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 403: + var dest Forbidden + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON403 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: + var dest NotFound + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON404 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 422: + var dest UnprocessableEntity + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON422 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 500: + var dest InternalError + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON500 = &dest + + } + + return response, nil +} + +// ParseGetSubscriptionOrderByTeamResponse parses an HTTP response from a GetSubscriptionOrderByTeamWithResponse call +func ParseGetSubscriptionOrderByTeamResponse(rsp *http.Response) (*GetSubscriptionOrderByTeamResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &GetSubscriptionOrderByTeamResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: + var dest TeamSubscriptionOrder + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON200 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401: + var dest RequiresAuthentication + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON401 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 403: + var dest Forbidden + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON403 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: + var dest NotFound + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON404 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 500: + var dest InternalError + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON500 = &dest + + } + + return response, nil +} + // ParseListTeamPluginUsageResponse parses an HTTP response from a ListTeamPluginUsageWithResponse call func ParseListTeamPluginUsageResponse(rsp *http.Response) (*ListTeamPluginUsageResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) diff --git a/models.gen.go b/models.gen.go index 29a33bb..6356e2c 100644 --- a/models.gen.go +++ b/models.gen.go @@ -34,9 +34,9 @@ const ( // Defines values for AddonOrderStatus. const ( - Cancelled AddonOrderStatus = "cancelled" - Completed AddonOrderStatus = "completed" - Pending AddonOrderStatus = "pending" + AddonOrderStatusCancelled AddonOrderStatus = "cancelled" + AddonOrderStatusCompleted AddonOrderStatus = "completed" + AddonOrderStatusPending AddonOrderStatus = "pending" ) // Defines values for AddonTier. @@ -74,8 +74,9 @@ const ( // Defines values for PluginTier. const ( - PluginTierFree PluginTier = "free" - PluginTierPaid PluginTier = "paid" + PluginTierFree PluginTier = "free" + PluginTierOpenCore PluginTier = "open-core" + PluginTierPaid PluginTier = "paid" ) // Defines values for PluginVersionPackageType. @@ -90,6 +91,13 @@ const ( Paid TeamPlan = "paid" ) +// Defines values for TeamSubscriptionOrderStatus. +const ( + TeamSubscriptionOrderStatusCancelled TeamSubscriptionOrderStatus = "cancelled" + TeamSubscriptionOrderStatusCompleted TeamSubscriptionOrderStatus = "completed" + TeamSubscriptionOrderStatusPending TeamSubscriptionOrderStatus = "pending" +) + // Defines values for AddonSortBy. const ( AddonSortByCreatedAt AddonSortBy = "created_at" @@ -955,6 +963,44 @@ type TeamName = string // TeamPlan The plan the team is on type TeamPlan string +// TeamSubscriptionOrder Team subscription order +type TeamSubscriptionOrder struct { + CompletedAt *time.Time `json:"completed_at,omitempty"` + + // CompletionUrl Stripe URL for completing purchase. Only shown in response to POST request when a paid plan is selected. + CompletionURL *string `json:"completion_url,omitempty"` + CreatedAt time.Time `json:"created_at"` + + // Id ID of the team subscription order + TeamSubscriptionOrderID TeamSubscriptionOrderID `json:"id"` + + // Plan The plan the team is on + Plan TeamPlan `json:"plan"` + Status TeamSubscriptionOrderStatus `json:"status"` + + // TeamName The unique name for the team. + TeamName TeamName `json:"team_name"` + UpdatedAt time.Time `json:"updated_at"` +} + +// TeamSubscriptionOrderCreate Create team subscription order +type TeamSubscriptionOrderCreate struct { + // CancelUrl URL to redirect to after order cancellation + CancelUrl string `json:"cancel_url"` + + // Plan The plan the team is on + Plan TeamPlan `json:"plan"` + + // SuccessUrl URL to redirect to after successful order completion + SuccessUrl string `json:"success_url"` +} + +// TeamSubscriptionOrderID ID of the team subscription order +type TeamSubscriptionOrderID = openapi_types.UUID + +// TeamSubscriptionOrderStatus defines model for TeamSubscriptionOrderStatus. +type TeamSubscriptionOrderStatus string + // UsageCurrent The usage of a plugin within the current calendar month. type UsageCurrent struct { // PluginKind The kind of plugin, ie. source or destination. @@ -1355,6 +1401,15 @@ type DownloadPluginAssetByTeamParams struct { Accept *string `json:"Accept,omitempty"` } +// ListSubscriptionOrdersByTeamParams defines parameters for ListSubscriptionOrdersByTeam. +type ListSubscriptionOrdersByTeamParams struct { + // Page Page number of the results to fetch + Page *Page `form:"page,omitempty" json:"page,omitempty"` + + // PerPage The number of results per page (max 1000). + PerPage *PerPage `form:"per_page,omitempty" json:"per_page,omitempty"` +} + // ListTeamPluginUsageParams defines parameters for ListTeamPluginUsage. type ListTeamPluginUsageParams struct { // Page Page number of the results to fetch @@ -1457,6 +1512,9 @@ type CreateMonthlyLimitJSONRequestBody = MonthlyLimitCreate // UpdateMonthlyLimitJSONRequestBody defines body for UpdateMonthlyLimit for application/json ContentType. type UpdateMonthlyLimitJSONRequestBody = MonthlyLimitUpdate +// CreateSubscriptionOrderForTeamJSONRequestBody defines body for CreateSubscriptionOrderForTeam for application/json ContentType. +type CreateSubscriptionOrderForTeamJSONRequestBody = TeamSubscriptionOrderCreate + // IncreaseTeamPluginUsageJSONRequestBody defines body for IncreaseTeamPluginUsage for application/json ContentType. type IncreaseTeamPluginUsageJSONRequestBody = UsageIncrease diff --git a/spec.json b/spec.json index 69cb963..4b92f42 100644 --- a/spec.json +++ b/spec.json @@ -3276,6 +3276,157 @@ } } }, + "/teams/{team_name}/subscription-orders": { + "get": { + "description": "List all subscription orders for the team.", + "operationId": "ListSubscriptionOrdersByTeam", + "parameters": [ + { + "$ref": "#/components/parameters/team_name" + }, + { + "$ref": "#/components/parameters/page" + }, + { + "$ref": "#/components/parameters/per_page" + } + ], + "responses": { + "200": { + "description": "Response", + "content": { + "application/json": { + "schema": { + "required": [ + "items", + "metadata" + ], + "properties": { + "items": { + "items": { + "$ref": "#/components/schemas/TeamSubscriptionOrder" + }, + "type": "array" + }, + "metadata": { + "$ref": "#/components/schemas/ListMetadata" + } + } + } + } + } + }, + "401": { + "$ref": "#/components/responses/RequiresAuthentication" + }, + "403": { + "$ref": "#/components/responses/Forbidden" + }, + "404": { + "$ref": "#/components/responses/NotFound" + }, + "500": { + "$ref": "#/components/responses/InternalError" + } + }, + "tags": [ + "teams" + ] + }, + "post": { + "description": "Start the checkout process for a subscription order.", + "operationId": "CreateSubscriptionOrderForTeam", + "parameters": [ + { + "$ref": "#/components/parameters/team_name" + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/TeamSubscriptionOrderCreate" + } + } + } + }, + "responses": { + "201": { + "description": "Response", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/TeamSubscriptionOrder" + } + } + } + }, + "400": { + "$ref": "#/components/responses/BadRequest" + }, + "401": { + "$ref": "#/components/responses/RequiresAuthentication" + }, + "403": { + "$ref": "#/components/responses/Forbidden" + }, + "404": { + "$ref": "#/components/responses/NotFound" + }, + "422": { + "$ref": "#/components/responses/UnprocessableEntity" + }, + "500": { + "$ref": "#/components/responses/InternalError" + } + }, + "tags": [ + "teams" + ] + } + }, + "/teams/{team_name}/subscription-orders/{subscription_order_id}": { + "get": { + "description": "Get a subscription order for the team.", + "operationId": "GetSubscriptionOrderByTeam", + "parameters": [ + { + "$ref": "#/components/parameters/team_name" + }, + { + "$ref": "#/components/parameters/team_subscription_order_id" + } + ], + "responses": { + "200": { + "description": "Response", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/TeamSubscriptionOrder" + } + } + } + }, + "401": { + "$ref": "#/components/responses/RequiresAuthentication" + }, + "403": { + "$ref": "#/components/responses/Forbidden" + }, + "404": { + "$ref": "#/components/responses/NotFound" + }, + "500": { + "$ref": "#/components/responses/InternalError" + } + }, + "tags": [ + "teams" + ] + } + }, "/teams/{team_name}/users": { "get": { "description": "List all users in the current team.", @@ -3770,7 +3921,8 @@ "type": "string", "enum": [ "free", - "paid" + "paid", + "open-core" ] }, "Plugin": { @@ -5280,6 +5432,96 @@ "title": "CloudQuery Team Membership", "type": "object" }, + "TeamSubscriptionOrderID": { + "description": "ID of the team subscription order", + "type": "string", + "format": "uuid", + "example": "12345678-1234-1234-1234-1234567890ab", + "x-go-name": "TeamSubscriptionOrderID" + }, + "TeamSubscriptionOrderStatus": { + "type": "string", + "enum": [ + "pending", + "completed", + "cancelled" + ] + }, + "TeamSubscriptionOrder": { + "additionalProperties": false, + "title": "Team subscription order", + "description": "Team subscription order", + "properties": { + "id": { + "$ref": "#/components/schemas/TeamSubscriptionOrderID" + }, + "team_name": { + "$ref": "#/components/schemas/TeamName" + }, + "plan": { + "$ref": "#/components/schemas/TeamPlan" + }, + "status": { + "$ref": "#/components/schemas/TeamSubscriptionOrderStatus" + }, + "created_at": { + "type": "string", + "format": "date-time", + "example": "2017-07-14T16:53:42Z" + }, + "updated_at": { + "type": "string", + "format": "date-time", + "example": "2017-07-14T16:53:42Z" + }, + "completed_at": { + "type": "string", + "format": "date-time", + "example": "2017-07-14T16:53:42Z" + }, + "completion_url": { + "type": "string", + "format": "uri", + "description": "Stripe URL for completing purchase. Only shown in response to POST request when a paid plan is selected.", + "x-go-name": "CompletionURL" + } + }, + "required": [ + "id", + "team_name", + "plan", + "status", + "created_at", + "updated_at" + ], + "type": "object" + }, + "TeamSubscriptionOrderCreate": { + "additionalProperties": false, + "description": "Create team subscription order", + "properties": { + "plan": { + "$ref": "#/components/schemas/TeamPlan" + }, + "success_url": { + "type": "string", + "description": "URL to redirect to after successful order completion", + "example": "https://cloud.cloudquery.io/order-completion" + }, + "cancel_url": { + "type": "string", + "description": "URL to redirect to after order cancellation", + "example": "https://cloud.cloudquery.io/order-cancelled" + } + }, + "required": [ + "plan", + "success_url", + "cancel_url" + ], + "title": "Create team subscription order", + "type": "object" + }, "InvitationWithToken": { "additionalProperties": false, "allOf": [ @@ -5638,6 +5880,15 @@ "$ref": "#/components/schemas/Email" } }, + "team_subscription_order_id": { + "name": "subscription_order_id", + "in": "path", + "required": true, + "schema": { + "$ref": "#/components/schemas/TeamSubscriptionOrderID" + }, + "x-go-name": "TeamSubscriptionOrderID" + }, "apikey_id": { "name": "apikey_id", "in": "path",