From f58f4218bce8148567fa2ba702f70ac9898ec84e Mon Sep 17 00:00:00 2001 From: "cloudquery-ci[bot]" <271027272+cloudquery-ci[bot]@users.noreply.github.com> Date: Wed, 8 Jul 2026 10:29:10 +0000 Subject: [PATCH] fix: Generate CloudQuery Go API Client from `spec.json` --- client.gen.go | 358 -------------------------------------- models.gen.go | 471 -------------------------------------------------- spec.json | 180 ------------------- 3 files changed, 1009 deletions(-) diff --git a/client.gen.go b/client.gen.go index 198047a..9a9f0b6 100644 --- a/client.gen.go +++ b/client.gen.go @@ -159,16 +159,6 @@ type ClientInterface interface { CreatePlatformSignup(ctx context.Context, body CreatePlatformSignupJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) - // ActivatePlatformWithBody request with any body - ActivatePlatformWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) - - ActivatePlatform(ctx context.Context, body ActivatePlatformJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) - - // RenewPlatformActivationWithBody request with any body - RenewPlatformActivationWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) - - RenewPlatformActivation(ctx context.Context, body RenewPlatformActivationJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) - // ConsumePlatformTenantMagicLinkWithBody request with any body ConsumePlatformTenantMagicLinkWithBody(ctx context.Context, tenantID openapi_types.UUID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) @@ -841,54 +831,6 @@ func (c *Client) CreatePlatformSignup(ctx context.Context, body CreatePlatformSi return c.Client.Do(req) } -func (c *Client) ActivatePlatformWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewActivatePlatformRequestWithBody(c.Server, 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) ActivatePlatform(ctx context.Context, body ActivatePlatformJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewActivatePlatformRequest(c.Server, 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) RenewPlatformActivationWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewRenewPlatformActivationRequestWithBody(c.Server, 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) RenewPlatformActivation(ctx context.Context, body RenewPlatformActivationJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewRenewPlatformActivationRequest(c.Server, 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) ConsumePlatformTenantMagicLinkWithBody(ctx context.Context, tenantID openapi_types.UUID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewConsumePlatformTenantMagicLinkRequestWithBody(c.Server, tenantID, contentType, body) if err != nil { @@ -3494,86 +3436,6 @@ func NewCreatePlatformSignupRequestWithBody(server string, contentType string, b return req, nil } -// NewActivatePlatformRequest calls the generic ActivatePlatform builder with application/json body -func NewActivatePlatformRequest(server string, body ActivatePlatformJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewActivatePlatformRequestWithBody(server, "application/json", bodyReader) -} - -// NewActivatePlatformRequestWithBody generates requests for ActivatePlatform with any type of body -func NewActivatePlatformRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error) { - var err error - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/platform/activate") - 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 -} - -// NewRenewPlatformActivationRequest calls the generic RenewPlatformActivation builder with application/json body -func NewRenewPlatformActivationRequest(server string, body RenewPlatformActivationJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewRenewPlatformActivationRequestWithBody(server, "application/json", bodyReader) -} - -// NewRenewPlatformActivationRequestWithBody generates requests for RenewPlatformActivation with any type of body -func NewRenewPlatformActivationRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error) { - var err error - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/platform/activate/renew") - 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 -} - // NewConsumePlatformTenantMagicLinkRequest calls the generic ConsumePlatformTenantMagicLink builder with application/json body func NewConsumePlatformTenantMagicLinkRequest(server string, tenantID openapi_types.UUID, body ConsumePlatformTenantMagicLinkJSONRequestBody) (*http.Request, error) { var bodyReader io.Reader @@ -9273,16 +9135,6 @@ type ClientWithResponsesInterface interface { CreatePlatformSignupWithResponse(ctx context.Context, body CreatePlatformSignupJSONRequestBody, reqEditors ...RequestEditorFn) (*CreatePlatformSignupResponse, error) - // ActivatePlatformWithBodyWithResponse request with any body - ActivatePlatformWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*ActivatePlatformResponse, error) - - ActivatePlatformWithResponse(ctx context.Context, body ActivatePlatformJSONRequestBody, reqEditors ...RequestEditorFn) (*ActivatePlatformResponse, error) - - // RenewPlatformActivationWithBodyWithResponse request with any body - RenewPlatformActivationWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*RenewPlatformActivationResponse, error) - - RenewPlatformActivationWithResponse(ctx context.Context, body RenewPlatformActivationJSONRequestBody, reqEditors ...RequestEditorFn) (*RenewPlatformActivationResponse, error) - // ConsumePlatformTenantMagicLinkWithBodyWithResponse request with any body ConsumePlatformTenantMagicLinkWithBodyWithResponse(ctx context.Context, tenantID openapi_types.UUID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*ConsumePlatformTenantMagicLinkResponse, error) @@ -10101,60 +9953,6 @@ func (r CreatePlatformSignupResponse) StatusCode() int { return 0 } -type ActivatePlatformResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *ActivatePlatform200Response - JSON205 *ActivatePlatform205Response - JSON400 *BadRequest - JSON404 *NotFound - JSON429 *TooManyRequests - JSON500 *InternalError -} - -// Status returns HTTPResponse.Status -func (r ActivatePlatformResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r ActivatePlatformResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type RenewPlatformActivationResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *RenewPlatformActivation200Response - JSON205 *ActivatePlatform205Response - JSON400 *BadRequest - JSON404 *NotFound - JSON429 *TooManyRequests - JSON500 *InternalError -} - -// Status returns HTTPResponse.Status -func (r RenewPlatformActivationResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r RenewPlatformActivationResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - type ConsumePlatformTenantMagicLinkResponse struct { Body []byte HTTPResponse *http.Response @@ -13015,40 +12813,6 @@ func (c *ClientWithResponses) CreatePlatformSignupWithResponse(ctx context.Conte return ParseCreatePlatformSignupResponse(rsp) } -// ActivatePlatformWithBodyWithResponse request with arbitrary body returning *ActivatePlatformResponse -func (c *ClientWithResponses) ActivatePlatformWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*ActivatePlatformResponse, error) { - rsp, err := c.ActivatePlatformWithBody(ctx, contentType, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseActivatePlatformResponse(rsp) -} - -func (c *ClientWithResponses) ActivatePlatformWithResponse(ctx context.Context, body ActivatePlatformJSONRequestBody, reqEditors ...RequestEditorFn) (*ActivatePlatformResponse, error) { - rsp, err := c.ActivatePlatform(ctx, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseActivatePlatformResponse(rsp) -} - -// RenewPlatformActivationWithBodyWithResponse request with arbitrary body returning *RenewPlatformActivationResponse -func (c *ClientWithResponses) RenewPlatformActivationWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*RenewPlatformActivationResponse, error) { - rsp, err := c.RenewPlatformActivationWithBody(ctx, contentType, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseRenewPlatformActivationResponse(rsp) -} - -func (c *ClientWithResponses) RenewPlatformActivationWithResponse(ctx context.Context, body RenewPlatformActivationJSONRequestBody, reqEditors ...RequestEditorFn) (*RenewPlatformActivationResponse, error) { - rsp, err := c.RenewPlatformActivation(ctx, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseRenewPlatformActivationResponse(rsp) -} - // ConsumePlatformTenantMagicLinkWithBodyWithResponse request with arbitrary body returning *ConsumePlatformTenantMagicLinkResponse func (c *ClientWithResponses) ConsumePlatformTenantMagicLinkWithBodyWithResponse(ctx context.Context, tenantID openapi_types.UUID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*ConsumePlatformTenantMagicLinkResponse, error) { rsp, err := c.ConsumePlatformTenantMagicLinkWithBody(ctx, tenantID, contentType, body, reqEditors...) @@ -15137,128 +14901,6 @@ func ParseCreatePlatformSignupResponse(rsp *http.Response) (*CreatePlatformSignu return response, nil } -// ParseActivatePlatformResponse parses an HTTP response from a ActivatePlatformWithResponse call -func ParseActivatePlatformResponse(rsp *http.Response) (*ActivatePlatformResponse, error) { - bodyBytes, err := io.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &ActivatePlatformResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest ActivatePlatform200Response - 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 == 205: - var dest ActivatePlatform205Response - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON205 = &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 == 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 == 429: - var dest TooManyRequests - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON429 = &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 -} - -// ParseRenewPlatformActivationResponse parses an HTTP response from a RenewPlatformActivationWithResponse call -func ParseRenewPlatformActivationResponse(rsp *http.Response) (*RenewPlatformActivationResponse, error) { - bodyBytes, err := io.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &RenewPlatformActivationResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest RenewPlatformActivation200Response - 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 == 205: - var dest ActivatePlatform205Response - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON205 = &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 == 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 == 429: - var dest TooManyRequests - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON429 = &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 -} - // ParseConsumePlatformTenantMagicLinkResponse parses an HTTP response from a ConsumePlatformTenantMagicLinkWithResponse call func ParseConsumePlatformTenantMagicLinkResponse(rsp *http.Response) (*ConsumePlatformTenantMagicLinkResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) diff --git a/models.gen.go b/models.gen.go index 8140731..a7609eb 100644 --- a/models.gen.go +++ b/models.gen.go @@ -353,42 +353,6 @@ type AcceptTeamInvitationRequest struct { Token openapi_types.UUID `json:"token"` } -// ActivatePlatform200Response defines model for ActivatePlatform_200_response. -type ActivatePlatform200Response struct { - // ActivationID Activation ID for the platform - ActivationID interface{} `json:"activation_id"` - - // NextCheckInSeconds Time in seconds until the next check in - NextCheckInSeconds interface{} `json:"next_check_in_seconds"` - - // TeamName Name of the team that was activated - TeamName interface{} `json:"team_name"` - AdditionalProperties map[string]interface{} `json:"-"` -} - -// ActivatePlatform205Response defines model for ActivatePlatform_205_response. -type ActivatePlatform205Response struct { - // ButtonText Text for the button - ButtonText *interface{} `json:"button_text,omitempty"` - - // ButtonURL URL for the button - ButtonURL *interface{} `json:"button_url,omitempty"` - - // Error Error message - Error interface{} `json:"error"` - AdditionalProperties map[string]interface{} `json:"-"` -} - -// ActivatePlatformRequest defines model for ActivatePlatform_request. -type ActivatePlatformRequest struct { - // APIKey Team API key to activate platform with - APIKey interface{} `json:"api_key"` - - // InstallationID Installation ID of the platform - InstallationID interface{} `json:"installation_id"` - AdditionalProperties map[string]interface{} `json:"-"` -} - // Addon CloudQuery Addon type Addon struct { // AddonFormat Supported formats for addons @@ -1846,23 +1810,6 @@ type RemoveTeamMembershipRequest struct { Email string `json:"email"` } -// RenewPlatformActivation200Response defines model for RenewPlatformActivation_200_response. -type RenewPlatformActivation200Response struct { - // NextCheckInSeconds Time in seconds until the next check in - NextCheckInSeconds interface{} `json:"next_check_in_seconds"` - AdditionalProperties map[string]interface{} `json:"-"` -} - -// RenewPlatformActivationRequest defines model for RenewPlatformActivation_request. -type RenewPlatformActivationRequest struct { - // ActivationID Previous activation ID - ActivationID interface{} `json:"activation_id"` - - // InstallationID Installation ID of the platform - InstallationID interface{} `json:"installation_id"` - AdditionalProperties map[string]interface{} `json:"-"` -} - // ReportTenantPlatformDataRequest defines model for ReportTenantPlatformData_request. type ReportTenantPlatformDataRequest struct { Host string `json:"host"` @@ -2685,12 +2632,6 @@ type CreatePlatformDestinationSessionJSONRequestBody = CreatePlatformDestination // CreatePlatformSignupJSONRequestBody defines body for CreatePlatformSignup for application/json ContentType. type CreatePlatformSignupJSONRequestBody = CreatePlatformSignupRequest -// ActivatePlatformJSONRequestBody defines body for ActivatePlatform for application/json ContentType. -type ActivatePlatformJSONRequestBody = ActivatePlatformRequest - -// RenewPlatformActivationJSONRequestBody defines body for RenewPlatformActivation for application/json ContentType. -type RenewPlatformActivationJSONRequestBody = RenewPlatformActivationRequest - // ConsumePlatformTenantMagicLinkJSONRequestBody defines body for ConsumePlatformTenantMagicLink for application/json ContentType. type ConsumePlatformTenantMagicLinkJSONRequestBody = ConsumePlatformTenantMagicLinkRequest @@ -3237,273 +3178,6 @@ func (a AIOnboardingNewConversationRequest) MarshalJSON() ([]byte, error) { return json.Marshal(object) } -// Getter for additional properties for ActivatePlatform200Response. Returns the specified -// element and whether it was found -func (a ActivatePlatform200Response) Get(fieldName string) (value interface{}, found bool) { - if a.AdditionalProperties != nil { - value, found = a.AdditionalProperties[fieldName] - } - return -} - -// Setter for additional properties for ActivatePlatform200Response -func (a *ActivatePlatform200Response) Set(fieldName string, value interface{}) { - if a.AdditionalProperties == nil { - a.AdditionalProperties = make(map[string]interface{}) - } - a.AdditionalProperties[fieldName] = value -} - -// Override default JSON handling for ActivatePlatform200Response to handle AdditionalProperties -func (a *ActivatePlatform200Response) UnmarshalJSON(b []byte) error { - object := make(map[string]json.RawMessage) - err := json.Unmarshal(b, &object) - if err != nil { - return err - } - - if raw, found := object["activation_id"]; found { - err = json.Unmarshal(raw, &a.ActivationID) - if err != nil { - return fmt.Errorf("error reading 'activation_id': %w", err) - } - delete(object, "activation_id") - } - - if raw, found := object["next_check_in_seconds"]; found { - err = json.Unmarshal(raw, &a.NextCheckInSeconds) - if err != nil { - return fmt.Errorf("error reading 'next_check_in_seconds': %w", err) - } - delete(object, "next_check_in_seconds") - } - - if raw, found := object["team_name"]; found { - err = json.Unmarshal(raw, &a.TeamName) - if err != nil { - return fmt.Errorf("error reading 'team_name': %w", err) - } - delete(object, "team_name") - } - - if len(object) != 0 { - a.AdditionalProperties = make(map[string]interface{}) - for fieldName, fieldBuf := range object { - var fieldVal interface{} - err := json.Unmarshal(fieldBuf, &fieldVal) - if err != nil { - return fmt.Errorf("error unmarshaling field %s: %w", fieldName, err) - } - a.AdditionalProperties[fieldName] = fieldVal - } - } - return nil -} - -// Override default JSON handling for ActivatePlatform200Response to handle AdditionalProperties -func (a ActivatePlatform200Response) MarshalJSON() ([]byte, error) { - var err error - object := make(map[string]json.RawMessage) - - object["activation_id"], err = json.Marshal(a.ActivationID) - if err != nil { - return nil, fmt.Errorf("error marshaling 'activation_id': %w", err) - } - - object["next_check_in_seconds"], err = json.Marshal(a.NextCheckInSeconds) - if err != nil { - return nil, fmt.Errorf("error marshaling 'next_check_in_seconds': %w", err) - } - - object["team_name"], err = json.Marshal(a.TeamName) - if err != nil { - return nil, fmt.Errorf("error marshaling 'team_name': %w", err) - } - - for fieldName, field := range a.AdditionalProperties { - object[fieldName], err = json.Marshal(field) - if err != nil { - return nil, fmt.Errorf("error marshaling '%s': %w", fieldName, err) - } - } - return json.Marshal(object) -} - -// Getter for additional properties for ActivatePlatform205Response. Returns the specified -// element and whether it was found -func (a ActivatePlatform205Response) Get(fieldName string) (value interface{}, found bool) { - if a.AdditionalProperties != nil { - value, found = a.AdditionalProperties[fieldName] - } - return -} - -// Setter for additional properties for ActivatePlatform205Response -func (a *ActivatePlatform205Response) Set(fieldName string, value interface{}) { - if a.AdditionalProperties == nil { - a.AdditionalProperties = make(map[string]interface{}) - } - a.AdditionalProperties[fieldName] = value -} - -// Override default JSON handling for ActivatePlatform205Response to handle AdditionalProperties -func (a *ActivatePlatform205Response) UnmarshalJSON(b []byte) error { - object := make(map[string]json.RawMessage) - err := json.Unmarshal(b, &object) - if err != nil { - return err - } - - if raw, found := object["button_text"]; found { - err = json.Unmarshal(raw, &a.ButtonText) - if err != nil { - return fmt.Errorf("error reading 'button_text': %w", err) - } - delete(object, "button_text") - } - - if raw, found := object["button_url"]; found { - err = json.Unmarshal(raw, &a.ButtonURL) - if err != nil { - return fmt.Errorf("error reading 'button_url': %w", err) - } - delete(object, "button_url") - } - - if raw, found := object["error"]; found { - err = json.Unmarshal(raw, &a.Error) - if err != nil { - return fmt.Errorf("error reading 'error': %w", err) - } - delete(object, "error") - } - - if len(object) != 0 { - a.AdditionalProperties = make(map[string]interface{}) - for fieldName, fieldBuf := range object { - var fieldVal interface{} - err := json.Unmarshal(fieldBuf, &fieldVal) - if err != nil { - return fmt.Errorf("error unmarshaling field %s: %w", fieldName, err) - } - a.AdditionalProperties[fieldName] = fieldVal - } - } - return nil -} - -// Override default JSON handling for ActivatePlatform205Response to handle AdditionalProperties -func (a ActivatePlatform205Response) MarshalJSON() ([]byte, error) { - var err error - object := make(map[string]json.RawMessage) - - if a.ButtonText != nil { - object["button_text"], err = json.Marshal(a.ButtonText) - if err != nil { - return nil, fmt.Errorf("error marshaling 'button_text': %w", err) - } - } - - if a.ButtonURL != nil { - object["button_url"], err = json.Marshal(a.ButtonURL) - if err != nil { - return nil, fmt.Errorf("error marshaling 'button_url': %w", err) - } - } - - object["error"], err = json.Marshal(a.Error) - if err != nil { - return nil, fmt.Errorf("error marshaling 'error': %w", err) - } - - for fieldName, field := range a.AdditionalProperties { - object[fieldName], err = json.Marshal(field) - if err != nil { - return nil, fmt.Errorf("error marshaling '%s': %w", fieldName, err) - } - } - return json.Marshal(object) -} - -// Getter for additional properties for ActivatePlatformRequest. Returns the specified -// element and whether it was found -func (a ActivatePlatformRequest) Get(fieldName string) (value interface{}, found bool) { - if a.AdditionalProperties != nil { - value, found = a.AdditionalProperties[fieldName] - } - return -} - -// Setter for additional properties for ActivatePlatformRequest -func (a *ActivatePlatformRequest) Set(fieldName string, value interface{}) { - if a.AdditionalProperties == nil { - a.AdditionalProperties = make(map[string]interface{}) - } - a.AdditionalProperties[fieldName] = value -} - -// Override default JSON handling for ActivatePlatformRequest to handle AdditionalProperties -func (a *ActivatePlatformRequest) UnmarshalJSON(b []byte) error { - object := make(map[string]json.RawMessage) - err := json.Unmarshal(b, &object) - if err != nil { - return err - } - - if raw, found := object["api_key"]; found { - err = json.Unmarshal(raw, &a.APIKey) - if err != nil { - return fmt.Errorf("error reading 'api_key': %w", err) - } - delete(object, "api_key") - } - - if raw, found := object["installation_id"]; found { - err = json.Unmarshal(raw, &a.InstallationID) - if err != nil { - return fmt.Errorf("error reading 'installation_id': %w", err) - } - delete(object, "installation_id") - } - - if len(object) != 0 { - a.AdditionalProperties = make(map[string]interface{}) - for fieldName, fieldBuf := range object { - var fieldVal interface{} - err := json.Unmarshal(fieldBuf, &fieldVal) - if err != nil { - return fmt.Errorf("error unmarshaling field %s: %w", fieldName, err) - } - a.AdditionalProperties[fieldName] = fieldVal - } - } - return nil -} - -// Override default JSON handling for ActivatePlatformRequest to handle AdditionalProperties -func (a ActivatePlatformRequest) MarshalJSON() ([]byte, error) { - var err error - object := make(map[string]json.RawMessage) - - object["api_key"], err = json.Marshal(a.APIKey) - if err != nil { - return nil, fmt.Errorf("error marshaling 'api_key': %w", err) - } - - object["installation_id"], err = json.Marshal(a.InstallationID) - if err != nil { - return nil, fmt.Errorf("error marshaling 'installation_id': %w", err) - } - - for fieldName, field := range a.AdditionalProperties { - object[fieldName], err = json.Marshal(field) - if err != nil { - return nil, fmt.Errorf("error marshaling '%s': %w", fieldName, err) - } - } - return json.Marshal(object) -} - // Getter for additional properties for ConsumePlatformTenantMagicLinkRequest. Returns the specified // element and whether it was found func (a ConsumePlatformTenantMagicLinkRequest) Get(fieldName string) (value interface{}, found bool) { @@ -4006,151 +3680,6 @@ func (a RegisterUserRequest) MarshalJSON() ([]byte, error) { return json.Marshal(object) } -// Getter for additional properties for RenewPlatformActivation200Response. Returns the specified -// element and whether it was found -func (a RenewPlatformActivation200Response) Get(fieldName string) (value interface{}, found bool) { - if a.AdditionalProperties != nil { - value, found = a.AdditionalProperties[fieldName] - } - return -} - -// Setter for additional properties for RenewPlatformActivation200Response -func (a *RenewPlatformActivation200Response) Set(fieldName string, value interface{}) { - if a.AdditionalProperties == nil { - a.AdditionalProperties = make(map[string]interface{}) - } - a.AdditionalProperties[fieldName] = value -} - -// Override default JSON handling for RenewPlatformActivation200Response to handle AdditionalProperties -func (a *RenewPlatformActivation200Response) UnmarshalJSON(b []byte) error { - object := make(map[string]json.RawMessage) - err := json.Unmarshal(b, &object) - if err != nil { - return err - } - - if raw, found := object["next_check_in_seconds"]; found { - err = json.Unmarshal(raw, &a.NextCheckInSeconds) - if err != nil { - return fmt.Errorf("error reading 'next_check_in_seconds': %w", err) - } - delete(object, "next_check_in_seconds") - } - - if len(object) != 0 { - a.AdditionalProperties = make(map[string]interface{}) - for fieldName, fieldBuf := range object { - var fieldVal interface{} - err := json.Unmarshal(fieldBuf, &fieldVal) - if err != nil { - return fmt.Errorf("error unmarshaling field %s: %w", fieldName, err) - } - a.AdditionalProperties[fieldName] = fieldVal - } - } - return nil -} - -// Override default JSON handling for RenewPlatformActivation200Response to handle AdditionalProperties -func (a RenewPlatformActivation200Response) MarshalJSON() ([]byte, error) { - var err error - object := make(map[string]json.RawMessage) - - object["next_check_in_seconds"], err = json.Marshal(a.NextCheckInSeconds) - if err != nil { - return nil, fmt.Errorf("error marshaling 'next_check_in_seconds': %w", err) - } - - for fieldName, field := range a.AdditionalProperties { - object[fieldName], err = json.Marshal(field) - if err != nil { - return nil, fmt.Errorf("error marshaling '%s': %w", fieldName, err) - } - } - return json.Marshal(object) -} - -// Getter for additional properties for RenewPlatformActivationRequest. Returns the specified -// element and whether it was found -func (a RenewPlatformActivationRequest) Get(fieldName string) (value interface{}, found bool) { - if a.AdditionalProperties != nil { - value, found = a.AdditionalProperties[fieldName] - } - return -} - -// Setter for additional properties for RenewPlatformActivationRequest -func (a *RenewPlatformActivationRequest) Set(fieldName string, value interface{}) { - if a.AdditionalProperties == nil { - a.AdditionalProperties = make(map[string]interface{}) - } - a.AdditionalProperties[fieldName] = value -} - -// Override default JSON handling for RenewPlatformActivationRequest to handle AdditionalProperties -func (a *RenewPlatformActivationRequest) UnmarshalJSON(b []byte) error { - object := make(map[string]json.RawMessage) - err := json.Unmarshal(b, &object) - if err != nil { - return err - } - - if raw, found := object["activation_id"]; found { - err = json.Unmarshal(raw, &a.ActivationID) - if err != nil { - return fmt.Errorf("error reading 'activation_id': %w", err) - } - delete(object, "activation_id") - } - - if raw, found := object["installation_id"]; found { - err = json.Unmarshal(raw, &a.InstallationID) - if err != nil { - return fmt.Errorf("error reading 'installation_id': %w", err) - } - delete(object, "installation_id") - } - - if len(object) != 0 { - a.AdditionalProperties = make(map[string]interface{}) - for fieldName, fieldBuf := range object { - var fieldVal interface{} - err := json.Unmarshal(fieldBuf, &fieldVal) - if err != nil { - return fmt.Errorf("error unmarshaling field %s: %w", fieldName, err) - } - a.AdditionalProperties[fieldName] = fieldVal - } - } - return nil -} - -// Override default JSON handling for RenewPlatformActivationRequest to handle AdditionalProperties -func (a RenewPlatformActivationRequest) MarshalJSON() ([]byte, error) { - var err error - object := make(map[string]json.RawMessage) - - object["activation_id"], err = json.Marshal(a.ActivationID) - if err != nil { - return nil, fmt.Errorf("error marshaling 'activation_id': %w", err) - } - - object["installation_id"], err = json.Marshal(a.InstallationID) - if err != nil { - return nil, fmt.Errorf("error marshaling 'installation_id': %w", err) - } - - for fieldName, field := range a.AdditionalProperties { - object[fieldName], err = json.Marshal(field) - if err != nil { - return nil, fmt.Errorf("error marshaling '%s': %w", fieldName, err) - } - } - return json.Marshal(object) -} - // Getter for additional properties for ReportTenantPlatformDataRequest. Returns the specified // element and whether it was found func (a ReportTenantPlatformDataRequest) Get(fieldName string) (value interface{}, found bool) { diff --git a/spec.json b/spec.json index fc4cd7d..fd257d7 100644 --- a/spec.json +++ b/spec.json @@ -4863,112 +4863,6 @@ "x-internal" : true } }, - "/platform/activate" : { - "post" : { - "description" : "Activate platform usage by API key", - "operationId" : "ActivatePlatform", - "requestBody" : { - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/ActivatePlatform_request" - } - } - }, - "required" : true - }, - "responses" : { - "200" : { - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/ActivatePlatform_200_response" - } - } - }, - "description" : "Success" - }, - "205" : { - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/ActivatePlatform_205_response" - } - } - }, - "description" : "Activation method is no longer valid" - }, - "400" : { - "$ref" : "#/components/responses/BadRequest" - }, - "404" : { - "$ref" : "#/components/responses/NotFound" - }, - "429" : { - "$ref" : "#/components/responses/TooManyRequests" - }, - "500" : { - "$ref" : "#/components/responses/InternalError" - } - }, - "security" : [ ], - "tags" : [ "platform" ], - "x-internal" : true - } - }, - "/platform/activate/renew" : { - "post" : { - "description" : "Renew platform activation", - "operationId" : "RenewPlatformActivation", - "requestBody" : { - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/RenewPlatformActivation_request" - } - } - }, - "required" : true - }, - "responses" : { - "200" : { - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/RenewPlatformActivation_200_response" - } - } - }, - "description" : "Success" - }, - "205" : { - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/ActivatePlatform_205_response" - } - } - }, - "description" : "Activation method is no longer valid" - }, - "400" : { - "$ref" : "#/components/responses/BadRequest" - }, - "404" : { - "$ref" : "#/components/responses/NotFound" - }, - "429" : { - "$ref" : "#/components/responses/TooManyRequests" - }, - "500" : { - "$ref" : "#/components/responses/InternalError" - } - }, - "security" : [ ], - "tags" : [ "platform" ], - "x-internal" : true - } - }, "/platform/{tenant_id}/report" : { "post" : { "description" : "Report tenant platform data", @@ -8817,80 +8711,6 @@ }, "required" : [ "items", "metadata" ] }, - "ActivatePlatform_request" : { - "additionalProperties" : { }, - "properties" : { - "api_key" : { - "description" : "Team API key to activate platform with", - "x-go-name" : "APIKey" - }, - "installation_id" : { - "description" : "Installation ID of the platform", - "pattern" : "^[a-z0-9]{64}$", - "x-go-name" : "InstallationID" - } - }, - "required" : [ "api_key", "installation_id" ] - }, - "ActivatePlatform_200_response" : { - "additionalProperties" : { }, - "properties" : { - "activation_id" : { - "description" : "Activation ID for the platform", - "format" : "uuid", - "x-go-name" : "ActivationID" - }, - "team_name" : { - "description" : "Name of the team that was activated" - }, - "next_check_in_seconds" : { - "description" : "Time in seconds until the next check in" - } - }, - "required" : [ "activation_id", "next_check_in_seconds", "team_name" ] - }, - "ActivatePlatform_205_response" : { - "additionalProperties" : { }, - "properties" : { - "error" : { - "description" : "Error message" - }, - "button_text" : { - "description" : "Text for the button" - }, - "button_url" : { - "description" : "URL for the button", - "format" : "url", - "x-go-name" : "ButtonURL" - } - }, - "required" : [ "error" ] - }, - "RenewPlatformActivation_request" : { - "additionalProperties" : { }, - "properties" : { - "installation_id" : { - "description" : "Installation ID of the platform", - "pattern" : "^[a-z0-9]{64}$", - "x-go-name" : "InstallationID" - }, - "activation_id" : { - "description" : "Previous activation ID", - "format" : "uuid", - "x-go-name" : "ActivationID" - } - }, - "required" : [ "activation_id", "installation_id" ] - }, - "RenewPlatformActivation_200_response" : { - "additionalProperties" : { }, - "properties" : { - "next_check_in_seconds" : { - "description" : "Time in seconds until the next check in" - } - }, - "required" : [ "next_check_in_seconds" ] - }, "ReportTenantPlatformData_request" : { "additionalProperties" : { }, "properties" : {