mirror of
https://github.com/openziti/zrok.git
synced 2025-03-20 10:26:38 +01:00
login api polish (#834)
This commit is contained in:
parent
b97c6d9ca2
commit
3f0d36e755
@ -8,7 +8,6 @@ import (
|
||||
"github.com/openziti/zrok/environment"
|
||||
"github.com/openziti/zrok/rest_client_zrok/account"
|
||||
"github.com/openziti/zrok/rest_client_zrok/metadata"
|
||||
"github.com/openziti/zrok/rest_model_zrok"
|
||||
"github.com/openziti/zrok/tui"
|
||||
"github.com/openziti/zrok/util"
|
||||
"github.com/spf13/cobra"
|
||||
@ -79,10 +78,8 @@ func (cmd *inviteCommand) run(_ *cobra.Command, _ []string) {
|
||||
token := cmd.tui.tokenInput.Value()
|
||||
|
||||
req := account.NewInviteParams()
|
||||
req.Body = &rest_model_zrok.InviteRequest{
|
||||
Email: email,
|
||||
Token: token,
|
||||
}
|
||||
req.Body.Email = email
|
||||
req.Body.Token = token
|
||||
_, err = zrok.Account.Invite(req)
|
||||
if err != nil {
|
||||
cmd.endpointError(env.ApiEndpoint())
|
||||
|
@ -2,13 +2,12 @@ package controller
|
||||
|
||||
import (
|
||||
"github.com/go-openapi/runtime/middleware"
|
||||
"github.com/openziti/zrok/rest_model_zrok"
|
||||
"github.com/openziti/zrok/rest_server_zrok/operations/account"
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
func loginHandler(params account.LoginParams) middleware.Responder {
|
||||
if params.Body == nil || params.Body.Email == "" || params.Body.Password == "" {
|
||||
if params.Body.Email == "" || params.Body.Password == "" {
|
||||
logrus.Errorf("missing email or password")
|
||||
return account.NewLoginUnauthorized()
|
||||
}
|
||||
@ -36,5 +35,5 @@ func loginHandler(params account.LoginParams) middleware.Responder {
|
||||
return account.NewLoginUnauthorized()
|
||||
}
|
||||
|
||||
return account.NewLoginOK().WithPayload(rest_model_zrok.LoginResponse(a.Token))
|
||||
return account.NewLoginOK().WithPayload(a.Token)
|
||||
}
|
||||
|
@ -14,8 +14,6 @@ import (
|
||||
"github.com/go-openapi/runtime"
|
||||
cr "github.com/go-openapi/runtime/client"
|
||||
"github.com/go-openapi/strfmt"
|
||||
|
||||
"github.com/openziti/zrok/rest_model_zrok"
|
||||
)
|
||||
|
||||
// NewLoginParams creates a new LoginParams object,
|
||||
@ -64,7 +62,7 @@ LoginParams contains all the parameters to send to the API endpoint
|
||||
type LoginParams struct {
|
||||
|
||||
// Body.
|
||||
Body *rest_model_zrok.LoginRequest
|
||||
Body LoginBody
|
||||
|
||||
timeout time.Duration
|
||||
Context context.Context
|
||||
@ -120,13 +118,13 @@ func (o *LoginParams) SetHTTPClient(client *http.Client) {
|
||||
}
|
||||
|
||||
// WithBody adds the body to the login params
|
||||
func (o *LoginParams) WithBody(body *rest_model_zrok.LoginRequest) *LoginParams {
|
||||
func (o *LoginParams) WithBody(body LoginBody) *LoginParams {
|
||||
o.SetBody(body)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetBody adds the body to the login params
|
||||
func (o *LoginParams) SetBody(body *rest_model_zrok.LoginRequest) {
|
||||
func (o *LoginParams) SetBody(body LoginBody) {
|
||||
o.Body = body
|
||||
}
|
||||
|
||||
@ -137,10 +135,8 @@ func (o *LoginParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registr
|
||||
return err
|
||||
}
|
||||
var res []error
|
||||
if o.Body != nil {
|
||||
if err := r.SetBodyParam(o.Body); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := r.SetBodyParam(o.Body); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
|
@ -6,13 +6,13 @@ package account
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/strfmt"
|
||||
|
||||
"github.com/openziti/zrok/rest_model_zrok"
|
||||
"github.com/go-openapi/swag"
|
||||
)
|
||||
|
||||
// LoginReader is a Reader for the Login structure.
|
||||
@ -51,7 +51,7 @@ LoginOK describes a response with status code 200, with default header values.
|
||||
login successful
|
||||
*/
|
||||
type LoginOK struct {
|
||||
Payload rest_model_zrok.LoginResponse
|
||||
Payload string
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this login o k response has a 2xx status code
|
||||
@ -92,7 +92,7 @@ func (o *LoginOK) String() string {
|
||||
return fmt.Sprintf("[POST /login][%d] loginOK %+v", 200, o.Payload)
|
||||
}
|
||||
|
||||
func (o *LoginOK) GetPayload() rest_model_zrok.LoginResponse {
|
||||
func (o *LoginOK) GetPayload() string {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
@ -161,3 +161,44 @@ func (o *LoginUnauthorized) readResponse(response runtime.ClientResponse, consum
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
/*
|
||||
LoginBody login body
|
||||
swagger:model LoginBody
|
||||
*/
|
||||
type LoginBody struct {
|
||||
|
||||
// email
|
||||
Email string `json:"email,omitempty"`
|
||||
|
||||
// password
|
||||
Password string `json:"password,omitempty"`
|
||||
}
|
||||
|
||||
// Validate validates this login body
|
||||
func (o *LoginBody) Validate(formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validates this login body based on context it is used
|
||||
func (o *LoginBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (o *LoginBody) MarshalBinary() ([]byte, error) {
|
||||
if o == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(o)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (o *LoginBody) UnmarshalBinary(b []byte) error {
|
||||
var res LoginBody
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*o = res
|
||||
return nil
|
||||
}
|
||||
|
@ -711,7 +711,14 @@ func init() {
|
||||
"name": "body",
|
||||
"in": "body",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/loginRequest"
|
||||
"properties": {
|
||||
"email": {
|
||||
"type": "string"
|
||||
},
|
||||
"password": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
@ -719,7 +726,7 @@ func init() {
|
||||
"200": {
|
||||
"description": "login successful",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/loginResponse"
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"401": {
|
||||
@ -1905,20 +1912,6 @@ func init() {
|
||||
}
|
||||
}
|
||||
},
|
||||
"loginRequest": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"email": {
|
||||
"type": "string"
|
||||
},
|
||||
"password": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"loginResponse": {
|
||||
"type": "string"
|
||||
},
|
||||
"metrics": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@ -3012,7 +3005,14 @@ func init() {
|
||||
"name": "body",
|
||||
"in": "body",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/loginRequest"
|
||||
"properties": {
|
||||
"email": {
|
||||
"type": "string"
|
||||
},
|
||||
"password": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
@ -3020,7 +3020,7 @@ func init() {
|
||||
"200": {
|
||||
"description": "login successful",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/loginResponse"
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"401": {
|
||||
@ -4208,20 +4208,6 @@ func init() {
|
||||
}
|
||||
}
|
||||
},
|
||||
"loginRequest": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"email": {
|
||||
"type": "string"
|
||||
},
|
||||
"password": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"loginResponse": {
|
||||
"type": "string"
|
||||
},
|
||||
"metrics": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
|
@ -6,9 +6,12 @@ package account
|
||||
// Editing this file might prove futile when you re-run the generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
|
||||
"github.com/go-openapi/runtime/middleware"
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
)
|
||||
|
||||
// LoginHandlerFunc turns a function with the right signature into a login handler
|
||||
@ -54,3 +57,43 @@ func (o *Login) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
|
||||
o.Context.Respond(rw, r, route.Produces, route, res)
|
||||
|
||||
}
|
||||
|
||||
// LoginBody login body
|
||||
//
|
||||
// swagger:model LoginBody
|
||||
type LoginBody struct {
|
||||
|
||||
// email
|
||||
Email string `json:"email,omitempty"`
|
||||
|
||||
// password
|
||||
Password string `json:"password,omitempty"`
|
||||
}
|
||||
|
||||
// Validate validates this login body
|
||||
func (o *LoginBody) Validate(formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validates this login body based on context it is used
|
||||
func (o *LoginBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (o *LoginBody) MarshalBinary() ([]byte, error) {
|
||||
if o == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(o)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (o *LoginBody) UnmarshalBinary(b []byte) error {
|
||||
var res LoginBody
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*o = res
|
||||
return nil
|
||||
}
|
||||
|
@ -12,8 +12,6 @@ import (
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/runtime/middleware"
|
||||
"github.com/go-openapi/validate"
|
||||
|
||||
"github.com/openziti/zrok/rest_model_zrok"
|
||||
)
|
||||
|
||||
// NewLoginParams creates a new LoginParams object
|
||||
@ -36,7 +34,7 @@ type LoginParams struct {
|
||||
/*
|
||||
In: body
|
||||
*/
|
||||
Body *rest_model_zrok.LoginRequest
|
||||
Body LoginBody
|
||||
}
|
||||
|
||||
// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
|
||||
@ -50,7 +48,7 @@ func (o *LoginParams) BindRequest(r *http.Request, route *middleware.MatchedRout
|
||||
|
||||
if runtime.HasBody(r) {
|
||||
defer r.Body.Close()
|
||||
var body rest_model_zrok.LoginRequest
|
||||
var body LoginBody
|
||||
if err := route.Consumer.Consume(r.Body, &body); err != nil {
|
||||
res = append(res, errors.NewParseError("body", "body", "", err))
|
||||
} else {
|
||||
@ -65,7 +63,7 @@ func (o *LoginParams) BindRequest(r *http.Request, route *middleware.MatchedRout
|
||||
}
|
||||
|
||||
if len(res) == 0 {
|
||||
o.Body = &body
|
||||
o.Body = body
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -9,8 +9,6 @@ import (
|
||||
"net/http"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
|
||||
"github.com/openziti/zrok/rest_model_zrok"
|
||||
)
|
||||
|
||||
// LoginOKCode is the HTTP code returned for type LoginOK
|
||||
@ -26,7 +24,7 @@ type LoginOK struct {
|
||||
/*
|
||||
In: Body
|
||||
*/
|
||||
Payload rest_model_zrok.LoginResponse `json:"body,omitempty"`
|
||||
Payload string `json:"body,omitempty"`
|
||||
}
|
||||
|
||||
// NewLoginOK creates LoginOK with default headers values
|
||||
@ -36,13 +34,13 @@ func NewLoginOK() *LoginOK {
|
||||
}
|
||||
|
||||
// WithPayload adds the payload to the login o k response
|
||||
func (o *LoginOK) WithPayload(payload rest_model_zrok.LoginResponse) *LoginOK {
|
||||
func (o *LoginOK) WithPayload(payload string) *LoginOK {
|
||||
o.Payload = payload
|
||||
return o
|
||||
}
|
||||
|
||||
// SetPayload sets the payload to the login o k response
|
||||
func (o *LoginOK) SetPayload(payload rest_model_zrok.LoginResponse) {
|
||||
func (o *LoginOK) SetPayload(payload string) {
|
||||
o.Payload = payload
|
||||
}
|
||||
|
||||
|
@ -12,7 +12,6 @@ model/addOrganizationMemberRequest.ts
|
||||
model/authUser.ts
|
||||
model/changePasswordRequest.ts
|
||||
model/configuration.ts
|
||||
model/createAccountRequest.ts
|
||||
model/createFrontendRequest.ts
|
||||
model/createFrontendResponse.ts
|
||||
model/createIdentity201Response.ts
|
||||
|
@ -16,7 +16,6 @@ import http from 'http';
|
||||
|
||||
/* tslint:disable:no-unused-locals */
|
||||
import { AddOrganizationMemberRequest } from '../model/addOrganizationMemberRequest';
|
||||
import { CreateAccountRequest } from '../model/createAccountRequest';
|
||||
import { CreateFrontendRequest } from '../model/createFrontendRequest';
|
||||
import { CreateFrontendResponse } from '../model/createFrontendResponse';
|
||||
import { CreateIdentity201Response } from '../model/createIdentity201Response';
|
||||
@ -27,6 +26,7 @@ import { GrantsRequest } from '../model/grantsRequest';
|
||||
import { InviteTokenGenerateRequest } from '../model/inviteTokenGenerateRequest';
|
||||
import { ListOrganizationMembers200Response } from '../model/listOrganizationMembers200Response';
|
||||
import { ListOrganizations200Response } from '../model/listOrganizations200Response';
|
||||
import { LoginRequest } from '../model/loginRequest';
|
||||
import { PublicFrontend } from '../model/publicFrontend';
|
||||
import { RegenerateToken200Response } from '../model/regenerateToken200Response';
|
||||
import { RemoveOrganizationMemberRequest } from '../model/removeOrganizationMemberRequest';
|
||||
@ -166,7 +166,7 @@ export class AdminApi {
|
||||
*
|
||||
* @param body
|
||||
*/
|
||||
public async createAccount (body?: CreateAccountRequest, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: RegenerateToken200Response; }> {
|
||||
public async createAccount (body?: LoginRequest, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: RegenerateToken200Response; }> {
|
||||
const localVarPath = this.basePath + '/account';
|
||||
let localVarQueryParameters: any = {};
|
||||
let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
|
||||
@ -190,7 +190,7 @@ export class AdminApi {
|
||||
uri: localVarPath,
|
||||
useQuerystring: this._useQuerystring,
|
||||
json: true,
|
||||
body: ObjectSerializer.serialize(body, "CreateAccountRequest")
|
||||
body: ObjectSerializer.serialize(body, "LoginRequest")
|
||||
};
|
||||
|
||||
let authenticationPromise = Promise.resolve();
|
||||
|
@ -6,7 +6,6 @@ export * from './addOrganizationMemberRequest';
|
||||
export * from './authUser';
|
||||
export * from './changePasswordRequest';
|
||||
export * from './configuration';
|
||||
export * from './createAccountRequest';
|
||||
export * from './createFrontendRequest';
|
||||
export * from './createFrontendResponse';
|
||||
export * from './createIdentity201Response';
|
||||
@ -73,7 +72,6 @@ import { AddOrganizationMemberRequest } from './addOrganizationMemberRequest';
|
||||
import { AuthUser } from './authUser';
|
||||
import { ChangePasswordRequest } from './changePasswordRequest';
|
||||
import { Configuration } from './configuration';
|
||||
import { CreateAccountRequest } from './createAccountRequest';
|
||||
import { CreateFrontendRequest } from './createFrontendRequest';
|
||||
import { CreateFrontendResponse } from './createFrontendResponse';
|
||||
import { CreateIdentity201Response } from './createIdentity201Response';
|
||||
@ -148,7 +146,6 @@ let typeMap: {[index: string]: any} = {
|
||||
"AuthUser": AuthUser,
|
||||
"ChangePasswordRequest": ChangePasswordRequest,
|
||||
"Configuration": Configuration,
|
||||
"CreateAccountRequest": CreateAccountRequest,
|
||||
"CreateFrontendRequest": CreateFrontendRequest,
|
||||
"CreateFrontendResponse": CreateFrontendResponse,
|
||||
"CreateIdentity201Response": CreateIdentity201Response,
|
||||
|
@ -55,8 +55,7 @@ from zrok_api.models.inline_response2004 import InlineResponse2004
|
||||
from zrok_api.models.inline_response201 import InlineResponse201
|
||||
from zrok_api.models.invite_body import InviteBody
|
||||
from zrok_api.models.invite_token_generate_request import InviteTokenGenerateRequest
|
||||
from zrok_api.models.login_request import LoginRequest
|
||||
from zrok_api.models.login_response import LoginResponse
|
||||
from zrok_api.models.login_body import LoginBody
|
||||
from zrok_api.models.metrics import Metrics
|
||||
from zrok_api.models.metrics_sample import MetricsSample
|
||||
from zrok_api.models.organization_add_body import OrganizationAddBody
|
||||
|
@ -227,8 +227,8 @@ class AccountApi(object):
|
||||
>>> result = thread.get()
|
||||
|
||||
:param async_req bool
|
||||
:param LoginRequest body:
|
||||
:return: LoginResponse
|
||||
:param LoginBody body:
|
||||
:return: str
|
||||
If the method is called asynchronously,
|
||||
returns the request thread.
|
||||
"""
|
||||
@ -248,8 +248,8 @@ class AccountApi(object):
|
||||
>>> result = thread.get()
|
||||
|
||||
:param async_req bool
|
||||
:param LoginRequest body:
|
||||
:return: LoginResponse
|
||||
:param LoginBody body:
|
||||
:return: str
|
||||
If the method is called asynchronously,
|
||||
returns the request thread.
|
||||
"""
|
||||
@ -303,7 +303,7 @@ class AccountApi(object):
|
||||
body=body_params,
|
||||
post_params=form_params,
|
||||
files=local_var_files,
|
||||
response_type='LoginResponse', # noqa: E501
|
||||
response_type='str', # noqa: E501
|
||||
auth_settings=auth_settings,
|
||||
async_req=params.get('async_req'),
|
||||
_return_http_data_only=params.get('_return_http_data_only'),
|
||||
|
@ -45,8 +45,7 @@ from zrok_api.models.inline_response2004 import InlineResponse2004
|
||||
from zrok_api.models.inline_response201 import InlineResponse201
|
||||
from zrok_api.models.invite_body import InviteBody
|
||||
from zrok_api.models.invite_token_generate_request import InviteTokenGenerateRequest
|
||||
from zrok_api.models.login_request import LoginRequest
|
||||
from zrok_api.models.login_response import LoginResponse
|
||||
from zrok_api.models.login_body import LoginBody
|
||||
from zrok_api.models.metrics import Metrics
|
||||
from zrok_api.models.metrics_sample import MetricsSample
|
||||
from zrok_api.models.organization_add_body import OrganizationAddBody
|
||||
|
136
sdk/python/sdk/zrok/zrok_api/models/login_body.py
Normal file
136
sdk/python/sdk/zrok/zrok_api/models/login_body.py
Normal file
@ -0,0 +1,136 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
zrok
|
||||
|
||||
zrok client access # noqa: E501
|
||||
|
||||
OpenAPI spec version: 1.0.0
|
||||
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
"""
|
||||
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
|
||||
import six
|
||||
|
||||
class LoginBody(object):
|
||||
"""NOTE: This class is auto generated by the swagger code generator program.
|
||||
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
"""
|
||||
Attributes:
|
||||
swagger_types (dict): The key is attribute name
|
||||
and the value is attribute type.
|
||||
attribute_map (dict): The key is attribute name
|
||||
and the value is json key in definition.
|
||||
"""
|
||||
swagger_types = {
|
||||
'email': 'str',
|
||||
'password': 'str'
|
||||
}
|
||||
|
||||
attribute_map = {
|
||||
'email': 'email',
|
||||
'password': 'password'
|
||||
}
|
||||
|
||||
def __init__(self, email=None, password=None): # noqa: E501
|
||||
"""LoginBody - a model defined in Swagger""" # noqa: E501
|
||||
self._email = None
|
||||
self._password = None
|
||||
self.discriminator = None
|
||||
if email is not None:
|
||||
self.email = email
|
||||
if password is not None:
|
||||
self.password = password
|
||||
|
||||
@property
|
||||
def email(self):
|
||||
"""Gets the email of this LoginBody. # noqa: E501
|
||||
|
||||
|
||||
:return: The email of this LoginBody. # noqa: E501
|
||||
:rtype: str
|
||||
"""
|
||||
return self._email
|
||||
|
||||
@email.setter
|
||||
def email(self, email):
|
||||
"""Sets the email of this LoginBody.
|
||||
|
||||
|
||||
:param email: The email of this LoginBody. # noqa: E501
|
||||
:type: str
|
||||
"""
|
||||
|
||||
self._email = email
|
||||
|
||||
@property
|
||||
def password(self):
|
||||
"""Gets the password of this LoginBody. # noqa: E501
|
||||
|
||||
|
||||
:return: The password of this LoginBody. # noqa: E501
|
||||
:rtype: str
|
||||
"""
|
||||
return self._password
|
||||
|
||||
@password.setter
|
||||
def password(self, password):
|
||||
"""Sets the password of this LoginBody.
|
||||
|
||||
|
||||
:param password: The password of this LoginBody. # noqa: E501
|
||||
:type: str
|
||||
"""
|
||||
|
||||
self._password = password
|
||||
|
||||
def to_dict(self):
|
||||
"""Returns the model properties as a dict"""
|
||||
result = {}
|
||||
|
||||
for attr, _ in six.iteritems(self.swagger_types):
|
||||
value = getattr(self, attr)
|
||||
if isinstance(value, list):
|
||||
result[attr] = list(map(
|
||||
lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
|
||||
value
|
||||
))
|
||||
elif hasattr(value, "to_dict"):
|
||||
result[attr] = value.to_dict()
|
||||
elif isinstance(value, dict):
|
||||
result[attr] = dict(map(
|
||||
lambda item: (item[0], item[1].to_dict())
|
||||
if hasattr(item[1], "to_dict") else item,
|
||||
value.items()
|
||||
))
|
||||
else:
|
||||
result[attr] = value
|
||||
if issubclass(LoginBody, dict):
|
||||
for key, value in self.items():
|
||||
result[key] = value
|
||||
|
||||
return result
|
||||
|
||||
def to_str(self):
|
||||
"""Returns the string representation of the model"""
|
||||
return pprint.pformat(self.to_dict())
|
||||
|
||||
def __repr__(self):
|
||||
"""For `print` and `pprint`"""
|
||||
return self.to_str()
|
||||
|
||||
def __eq__(self, other):
|
||||
"""Returns true if both objects are equal"""
|
||||
if not isinstance(other, LoginBody):
|
||||
return False
|
||||
|
||||
return self.__dict__ == other.__dict__
|
||||
|
||||
def __ne__(self, other):
|
||||
"""Returns true if both objects are not equal"""
|
||||
return not self == other
|
@ -82,12 +82,16 @@ paths:
|
||||
- name: body
|
||||
in: body
|
||||
schema:
|
||||
$ref: "#/definitions/loginRequest"
|
||||
properties:
|
||||
email:
|
||||
type: string
|
||||
password:
|
||||
type: string
|
||||
responses:
|
||||
200:
|
||||
description: login successful
|
||||
schema:
|
||||
$ref: "#/definitions/loginResponse"
|
||||
type: string
|
||||
401:
|
||||
description: invalid login
|
||||
|
||||
@ -1202,17 +1206,6 @@ definitions:
|
||||
items:
|
||||
type: string
|
||||
|
||||
loginRequest:
|
||||
type: object
|
||||
properties:
|
||||
email:
|
||||
type: string
|
||||
password:
|
||||
type: string
|
||||
|
||||
loginResponse:
|
||||
type: string
|
||||
|
||||
metrics:
|
||||
type: object
|
||||
properties:
|
||||
|
@ -1,4 +1,3 @@
|
||||
.openapi-generator-ignore
|
||||
apis/AccountApi.ts
|
||||
apis/AdminApi.ts
|
||||
apis/EnvironmentApi.ts
|
||||
@ -11,7 +10,6 @@ models/AccessResponse.ts
|
||||
models/AddOrganizationMemberRequest.ts
|
||||
models/AuthUser.ts
|
||||
models/ChangePasswordRequest.ts
|
||||
models/CreateAccountRequest.ts
|
||||
models/CreateFrontendRequest.ts
|
||||
models/CreateFrontendResponse.ts
|
||||
models/CreateIdentity201Response.ts
|
||||
|
@ -16,7 +16,6 @@
|
||||
import * as runtime from '../runtime';
|
||||
import type {
|
||||
AddOrganizationMemberRequest,
|
||||
CreateAccountRequest,
|
||||
CreateFrontendRequest,
|
||||
CreateFrontendResponse,
|
||||
CreateIdentity201Response,
|
||||
@ -27,6 +26,7 @@ import type {
|
||||
InviteTokenGenerateRequest,
|
||||
ListOrganizationMembers200Response,
|
||||
ListOrganizations200Response,
|
||||
LoginRequest,
|
||||
PublicFrontend,
|
||||
RegenerateToken200Response,
|
||||
RemoveOrganizationMemberRequest,
|
||||
@ -35,8 +35,6 @@ import type {
|
||||
import {
|
||||
AddOrganizationMemberRequestFromJSON,
|
||||
AddOrganizationMemberRequestToJSON,
|
||||
CreateAccountRequestFromJSON,
|
||||
CreateAccountRequestToJSON,
|
||||
CreateFrontendRequestFromJSON,
|
||||
CreateFrontendRequestToJSON,
|
||||
CreateFrontendResponseFromJSON,
|
||||
@ -57,6 +55,8 @@ import {
|
||||
ListOrganizationMembers200ResponseToJSON,
|
||||
ListOrganizations200ResponseFromJSON,
|
||||
ListOrganizations200ResponseToJSON,
|
||||
LoginRequestFromJSON,
|
||||
LoginRequestToJSON,
|
||||
PublicFrontendFromJSON,
|
||||
PublicFrontendToJSON,
|
||||
RegenerateToken200ResponseFromJSON,
|
||||
@ -71,8 +71,8 @@ export interface AddOrganizationMemberOperationRequest {
|
||||
body?: AddOrganizationMemberRequest;
|
||||
}
|
||||
|
||||
export interface CreateAccountOperationRequest {
|
||||
body?: CreateAccountRequest;
|
||||
export interface CreateAccountRequest {
|
||||
body?: LoginRequest;
|
||||
}
|
||||
|
||||
export interface CreateFrontendOperationRequest {
|
||||
@ -152,7 +152,7 @@ export class AdminApi extends runtime.BaseAPI {
|
||||
|
||||
/**
|
||||
*/
|
||||
async createAccountRaw(requestParameters: CreateAccountOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<RegenerateToken200Response>> {
|
||||
async createAccountRaw(requestParameters: CreateAccountRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<RegenerateToken200Response>> {
|
||||
const queryParameters: any = {};
|
||||
|
||||
const headerParameters: runtime.HTTPHeaders = {};
|
||||
@ -168,7 +168,7 @@ export class AdminApi extends runtime.BaseAPI {
|
||||
method: 'POST',
|
||||
headers: headerParameters,
|
||||
query: queryParameters,
|
||||
body: CreateAccountRequestToJSON(requestParameters['body']),
|
||||
body: LoginRequestToJSON(requestParameters['body']),
|
||||
}, initOverrides);
|
||||
|
||||
return new runtime.JSONApiResponse(response, (jsonValue) => RegenerateToken200ResponseFromJSON(jsonValue));
|
||||
@ -176,7 +176,7 @@ export class AdminApi extends runtime.BaseAPI {
|
||||
|
||||
/**
|
||||
*/
|
||||
async createAccount(requestParameters: CreateAccountOperationRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<RegenerateToken200Response> {
|
||||
async createAccount(requestParameters: CreateAccountRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<RegenerateToken200Response> {
|
||||
const response = await this.createAccountRaw(requestParameters, initOverrides);
|
||||
return await response.value();
|
||||
}
|
||||
|
@ -5,7 +5,6 @@ export * from './AccessResponse';
|
||||
export * from './AddOrganizationMemberRequest';
|
||||
export * from './AuthUser';
|
||||
export * from './ChangePasswordRequest';
|
||||
export * from './CreateAccountRequest';
|
||||
export * from './CreateFrontendRequest';
|
||||
export * from './CreateFrontendResponse';
|
||||
export * from './CreateIdentity201Response';
|
||||
|
Loading…
Reference in New Issue
Block a user