diff --git a/client.gen.go b/client.gen.go index b69dd85..20e589e 100644 --- a/client.gen.go +++ b/client.gen.go @@ -672,6 +672,9 @@ type ClientInterface interface { ResetUserPassword(ctx context.Context, body ResetUserPasswordJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) + // DeterminePlatformTenantByEmail request + DeterminePlatformTenantByEmail(ctx context.Context, params *DeterminePlatformTenantByEmailParams, reqEditors ...RequestEditorFn) (*http.Response, error) + // CreateUserToken request CreateUserToken(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) @@ -3240,6 +3243,18 @@ func (c *Client) ResetUserPassword(ctx context.Context, body ResetUserPasswordJS return c.Client.Do(req) } +func (c *Client) DeterminePlatformTenantByEmail(ctx context.Context, params *DeterminePlatformTenantByEmailParams, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewDeterminePlatformTenantByEmailRequest(c.Server, 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) CreateUserToken(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewCreateUserTokenRequest(c.Server) if err != nil { @@ -11843,6 +11858,51 @@ func NewResetUserPasswordRequestWithBody(server string, contentType string, body return req, nil } +// NewDeterminePlatformTenantByEmailRequest generates requests for DeterminePlatformTenantByEmail +func NewDeterminePlatformTenantByEmailRequest(server string, params *DeterminePlatformTenantByEmailParams) (*http.Request, error) { + var err error + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/user/tenant") + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + if params != nil { + queryValues := queryURL.Query() + + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "email", runtime.ParamLocationQuery, params.Email); 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 +} + // NewCreateUserTokenRequest generates requests for CreateUserToken func NewCreateUserTokenRequest(server string) (*http.Request, error) { var err error @@ -12566,6 +12626,9 @@ type ClientWithResponsesInterface interface { ResetUserPasswordWithResponse(ctx context.Context, body ResetUserPasswordJSONRequestBody, reqEditors ...RequestEditorFn) (*ResetUserPasswordResponse, error) + // DeterminePlatformTenantByEmailWithResponse request + DeterminePlatformTenantByEmailWithResponse(ctx context.Context, params *DeterminePlatformTenantByEmailParams, reqEditors ...RequestEditorFn) (*DeterminePlatformTenantByEmailResponse, error) + // CreateUserTokenWithResponse request CreateUserTokenWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*CreateUserTokenResponse, error) @@ -16563,6 +16626,32 @@ func (r ResetUserPasswordResponse) StatusCode() int { return 0 } +type DeterminePlatformTenantByEmailResponse struct { + Body []byte + HTTPResponse *http.Response + JSON200 *DeterminePlatformTenantByEmail200Response + JSON400 *BadRequest + JSON404 *NotFound + JSON429 *TooManyRequests + JSON500 *InternalError +} + +// Status returns HTTPResponse.Status +func (r DeterminePlatformTenantByEmailResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r DeterminePlatformTenantByEmailResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + type CreateUserTokenResponse struct { Body []byte HTTPResponse *http.Response @@ -18497,6 +18586,15 @@ func (c *ClientWithResponses) ResetUserPasswordWithResponse(ctx context.Context, return ParseResetUserPasswordResponse(rsp) } +// DeterminePlatformTenantByEmailWithResponse request returning *DeterminePlatformTenantByEmailResponse +func (c *ClientWithResponses) DeterminePlatformTenantByEmailWithResponse(ctx context.Context, params *DeterminePlatformTenantByEmailParams, reqEditors ...RequestEditorFn) (*DeterminePlatformTenantByEmailResponse, error) { + rsp, err := c.DeterminePlatformTenantByEmail(ctx, params, reqEditors...) + if err != nil { + return nil, err + } + return ParseDeterminePlatformTenantByEmailResponse(rsp) +} + // CreateUserTokenWithResponse request returning *CreateUserTokenResponse func (c *ClientWithResponses) CreateUserTokenWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*CreateUserTokenResponse, error) { rsp, err := c.CreateUserToken(ctx, reqEditors...) @@ -26843,6 +26941,60 @@ func ParseResetUserPasswordResponse(rsp *http.Response) (*ResetUserPasswordRespo return response, nil } +// ParseDeterminePlatformTenantByEmailResponse parses an HTTP response from a DeterminePlatformTenantByEmailWithResponse call +func ParseDeterminePlatformTenantByEmailResponse(rsp *http.Response) (*DeterminePlatformTenantByEmailResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &DeterminePlatformTenantByEmailResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: + var dest DeterminePlatformTenantByEmail200Response + 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 == 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 +} + // ParseCreateUserTokenResponse parses an HTTP response from a CreateUserTokenWithResponse call func ParseCreateUserTokenResponse(rsp *http.Response) (*CreateUserTokenResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) diff --git a/models.gen.go b/models.gen.go index cce9316..b85fbd2 100644 --- a/models.gen.go +++ b/models.gen.go @@ -956,6 +956,12 @@ type DeleteTeamInvitationRequest struct { Email openapi_types.Email `json:"email"` } +// DeterminePlatformTenantByEmail200Response defines model for DeterminePlatformTenantByEmail_200_response. +type DeterminePlatformTenantByEmail200Response struct { + // TenantURL URL of the tenant + TenantURL string `json:"tenant_url"` +} + // DisplayName A human-readable display name type DisplayName = string @@ -3471,6 +3477,11 @@ type GetCurrentUserMembershipsParams struct { PerPage *PerPage `form:"per_page,omitempty" json:"per_page,omitempty"` } +// DeterminePlatformTenantByEmailParams defines parameters for DeterminePlatformTenantByEmail. +type DeterminePlatformTenantByEmailParams struct { + Email string `form:"email" json:"email"` +} + // CreateAddonJSONRequestBody defines body for CreateAddon for application/json ContentType. type CreateAddonJSONRequestBody = AddonCreate diff --git a/spec.json b/spec.json index cc4f7f9..996c76a 100644 --- a/spec.json +++ b/spec.json @@ -4038,6 +4038,53 @@ "x-internal" : true } }, + "/user/tenant" : { + "get" : { + "description" : "Determine platform tenant by email", + "operationId" : "DeterminePlatformTenantByEmail", + "parameters" : [ { + "explode" : true, + "in" : "query", + "name" : "email", + "required" : true, + "schema" : { + "description" : "Email address of the user", + "type" : "string" + }, + "style" : "form" + } ], + "responses" : { + "200" : { + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/DeterminePlatformTenantByEmail_200_response" + } + } + }, + "description" : "Tenant found" + }, + "204" : { + "description" : "No tenant found, or multiple tenants" + }, + "400" : { + "$ref" : "#/components/responses/BadRequest" + }, + "404" : { + "$ref" : "#/components/responses/NotFound" + }, + "429" : { + "$ref" : "#/components/responses/TooManyRequests" + }, + "500" : { + "$ref" : "#/components/responses/InternalError" + } + }, + "security" : [ ], + "tags" : [ "platform", "users" ], + "x-internal" : true + } + }, "/users/{user_id}" : { "delete" : { "description" : "Delete user", @@ -11184,6 +11231,17 @@ }, "required" : [ "first_name", "last_name" ] }, + "DeterminePlatformTenantByEmail_200_response" : { + "properties" : { + "tenant_url" : { + "description" : "URL of the tenant", + "format" : "url", + "type" : "string", + "x-go-name" : "TenantURL" + } + }, + "required" : [ "tenant_url" ] + }, "ListTeamAPIKeys_200_response" : { "properties" : { "items" : {