api polish for register endpoint (#834)

This commit is contained in:
Michael Quigley 2025-02-03 11:53:33 -05:00
parent 3f0d36e755
commit 164fb96b73
No known key found for this signature in database
GPG Key ID: 9B60314A9DD20A62
18 changed files with 360 additions and 105 deletions

View File

@ -19,7 +19,7 @@ func newRegisterHandler(cfg *config.Config) *registerHandler {
} }
} }
func (h *registerHandler) Handle(params account.RegisterParams) middleware.Responder { func (h *registerHandler) Handle(params account.RegisterParams) middleware.Responder {
if params.Body == nil || params.Body.Token == "" || params.Body.Password == "" { if params.Body.Token == "" || params.Body.Password == "" {
logrus.Error("missing token or password") logrus.Error("missing token or password")
return account.NewRegisterNotFound() return account.NewRegisterNotFound()
} }
@ -77,5 +77,5 @@ func (h *registerHandler) Handle(params account.RegisterParams) middleware.Respo
logrus.Infof("created account '%v'", a.Email) logrus.Infof("created account '%v'", a.Email)
return account.NewRegisterOK().WithPayload(&rest_model_zrok.RegisterResponse{Token: a.Token}) return account.NewRegisterOK().WithPayload(&account.RegisterOKBody{Token: a.Token})
} }

View File

@ -14,8 +14,6 @@ import (
"github.com/go-openapi/runtime" "github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client" cr "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt" "github.com/go-openapi/strfmt"
"github.com/openziti/zrok/rest_model_zrok"
) )
// NewRegisterParams creates a new RegisterParams object, // NewRegisterParams creates a new RegisterParams object,
@ -64,7 +62,7 @@ RegisterParams contains all the parameters to send to the API endpoint
type RegisterParams struct { type RegisterParams struct {
// Body. // Body.
Body *rest_model_zrok.RegisterRequest Body RegisterBody
timeout time.Duration timeout time.Duration
Context context.Context Context context.Context
@ -120,13 +118,13 @@ func (o *RegisterParams) SetHTTPClient(client *http.Client) {
} }
// WithBody adds the body to the register params // WithBody adds the body to the register params
func (o *RegisterParams) WithBody(body *rest_model_zrok.RegisterRequest) *RegisterParams { func (o *RegisterParams) WithBody(body RegisterBody) *RegisterParams {
o.SetBody(body) o.SetBody(body)
return o return o
} }
// SetBody adds the body to the register params // SetBody adds the body to the register params
func (o *RegisterParams) SetBody(body *rest_model_zrok.RegisterRequest) { func (o *RegisterParams) SetBody(body RegisterBody) {
o.Body = body o.Body = body
} }
@ -137,10 +135,8 @@ func (o *RegisterParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Regi
return err return err
} }
var res []error var res []error
if o.Body != nil { if err := r.SetBodyParam(o.Body); err != nil {
if err := r.SetBodyParam(o.Body); err != nil { return err
return err
}
} }
if len(res) > 0 { if len(res) > 0 {

View File

@ -6,11 +6,13 @@ package account
// Editing this file might prove futile when you re-run the swagger generate command // Editing this file might prove futile when you re-run the swagger generate command
import ( import (
"context"
"fmt" "fmt"
"io" "io"
"github.com/go-openapi/runtime" "github.com/go-openapi/runtime"
"github.com/go-openapi/strfmt" "github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
"github.com/openziti/zrok/rest_model_zrok" "github.com/openziti/zrok/rest_model_zrok"
) )
@ -63,7 +65,7 @@ RegisterOK describes a response with status code 200, with default header values
account created account created
*/ */
type RegisterOK struct { type RegisterOK struct {
Payload *rest_model_zrok.RegisterResponse Payload *RegisterOKBody
} }
// IsSuccess returns true when this register o k response has a 2xx status code // IsSuccess returns true when this register o k response has a 2xx status code
@ -104,13 +106,13 @@ func (o *RegisterOK) String() string {
return fmt.Sprintf("[POST /register][%d] registerOK %+v", 200, o.Payload) return fmt.Sprintf("[POST /register][%d] registerOK %+v", 200, o.Payload)
} }
func (o *RegisterOK) GetPayload() *rest_model_zrok.RegisterResponse { func (o *RegisterOK) GetPayload() *RegisterOKBody {
return o.Payload return o.Payload
} }
func (o *RegisterOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { func (o *RegisterOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(rest_model_zrok.RegisterResponse) o.Payload = new(RegisterOKBody)
// response payload // response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
@ -297,3 +299,82 @@ func (o *RegisterInternalServerError) readResponse(response runtime.ClientRespon
return nil return nil
} }
/*
RegisterBody register body
swagger:model RegisterBody
*/
type RegisterBody struct {
// password
Password string `json:"password,omitempty"`
// token
Token string `json:"token,omitempty"`
}
// Validate validates this register body
func (o *RegisterBody) Validate(formats strfmt.Registry) error {
return nil
}
// ContextValidate validates this register body based on context it is used
func (o *RegisterBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
return nil
}
// MarshalBinary interface implementation
func (o *RegisterBody) MarshalBinary() ([]byte, error) {
if o == nil {
return nil, nil
}
return swag.WriteJSON(o)
}
// UnmarshalBinary interface implementation
func (o *RegisterBody) UnmarshalBinary(b []byte) error {
var res RegisterBody
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*o = res
return nil
}
/*
RegisterOKBody register o k body
swagger:model RegisterOKBody
*/
type RegisterOKBody struct {
// token
Token string `json:"token,omitempty"`
}
// Validate validates this register o k body
func (o *RegisterOKBody) Validate(formats strfmt.Registry) error {
return nil
}
// ContextValidate validates this register o k body based on context it is used
func (o *RegisterOKBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
return nil
}
// MarshalBinary interface implementation
func (o *RegisterOKBody) MarshalBinary() ([]byte, error) {
if o == nil {
return nil, nil
}
return swag.WriteJSON(o)
}
// UnmarshalBinary interface implementation
func (o *RegisterOKBody) UnmarshalBinary(b []byte) error {
var res RegisterOKBody
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*o = res
return nil
}

View File

@ -1337,7 +1337,14 @@ func init() {
"name": "body", "name": "body",
"in": "body", "in": "body",
"schema": { "schema": {
"$ref": "#/definitions/registerRequest" "properties": {
"password": {
"type": "string"
},
"token": {
"type": "string"
}
}
} }
} }
], ],
@ -1345,7 +1352,11 @@ func init() {
"200": { "200": {
"description": "account created", "description": "account created",
"schema": { "schema": {
"$ref": "#/definitions/registerResponse" "properties": {
"token": {
"type": "string"
}
}
} }
}, },
"404": { "404": {
@ -2029,25 +2040,6 @@ func init() {
"$ref": "#/definitions/publicFrontend" "$ref": "#/definitions/publicFrontend"
} }
}, },
"registerRequest": {
"type": "object",
"properties": {
"password": {
"type": "string"
},
"token": {
"type": "string"
}
}
},
"registerResponse": {
"type": "object",
"properties": {
"token": {
"type": "string"
}
}
},
"resetPasswordRequest": { "resetPasswordRequest": {
"type": "object", "type": "object",
"properties": { "properties": {
@ -3600,7 +3592,14 @@ func init() {
"name": "body", "name": "body",
"in": "body", "in": "body",
"schema": { "schema": {
"$ref": "#/definitions/registerRequest" "properties": {
"password": {
"type": "string"
},
"token": {
"type": "string"
}
}
} }
} }
], ],
@ -3608,7 +3607,11 @@ func init() {
"200": { "200": {
"description": "account created", "description": "account created",
"schema": { "schema": {
"$ref": "#/definitions/registerResponse" "properties": {
"token": {
"type": "string"
}
}
} }
}, },
"404": { "404": {
@ -4325,25 +4328,6 @@ func init() {
"$ref": "#/definitions/publicFrontend" "$ref": "#/definitions/publicFrontend"
} }
}, },
"registerRequest": {
"type": "object",
"properties": {
"password": {
"type": "string"
},
"token": {
"type": "string"
}
}
},
"registerResponse": {
"type": "object",
"properties": {
"token": {
"type": "string"
}
}
},
"resetPasswordRequest": { "resetPasswordRequest": {
"type": "object", "type": "object",
"properties": { "properties": {

View File

@ -6,9 +6,12 @@ package account
// Editing this file might prove futile when you re-run the generate command // Editing this file might prove futile when you re-run the generate command
import ( import (
"context"
"net/http" "net/http"
"github.com/go-openapi/runtime/middleware" "github.com/go-openapi/runtime/middleware"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
) )
// RegisterHandlerFunc turns a function with the right signature into a register handler // RegisterHandlerFunc turns a function with the right signature into a register handler
@ -54,3 +57,80 @@ func (o *Register) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
o.Context.Respond(rw, r, route.Produces, route, res) o.Context.Respond(rw, r, route.Produces, route, res)
} }
// RegisterBody register body
//
// swagger:model RegisterBody
type RegisterBody struct {
// password
Password string `json:"password,omitempty"`
// token
Token string `json:"token,omitempty"`
}
// Validate validates this register body
func (o *RegisterBody) Validate(formats strfmt.Registry) error {
return nil
}
// ContextValidate validates this register body based on context it is used
func (o *RegisterBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
return nil
}
// MarshalBinary interface implementation
func (o *RegisterBody) MarshalBinary() ([]byte, error) {
if o == nil {
return nil, nil
}
return swag.WriteJSON(o)
}
// UnmarshalBinary interface implementation
func (o *RegisterBody) UnmarshalBinary(b []byte) error {
var res RegisterBody
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*o = res
return nil
}
// RegisterOKBody register o k body
//
// swagger:model RegisterOKBody
type RegisterOKBody struct {
// token
Token string `json:"token,omitempty"`
}
// Validate validates this register o k body
func (o *RegisterOKBody) Validate(formats strfmt.Registry) error {
return nil
}
// ContextValidate validates this register o k body based on context it is used
func (o *RegisterOKBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
return nil
}
// MarshalBinary interface implementation
func (o *RegisterOKBody) MarshalBinary() ([]byte, error) {
if o == nil {
return nil, nil
}
return swag.WriteJSON(o)
}
// UnmarshalBinary interface implementation
func (o *RegisterOKBody) UnmarshalBinary(b []byte) error {
var res RegisterOKBody
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*o = res
return nil
}

View File

@ -12,8 +12,6 @@ import (
"github.com/go-openapi/runtime" "github.com/go-openapi/runtime"
"github.com/go-openapi/runtime/middleware" "github.com/go-openapi/runtime/middleware"
"github.com/go-openapi/validate" "github.com/go-openapi/validate"
"github.com/openziti/zrok/rest_model_zrok"
) )
// NewRegisterParams creates a new RegisterParams object // NewRegisterParams creates a new RegisterParams object
@ -36,7 +34,7 @@ type RegisterParams struct {
/* /*
In: body In: body
*/ */
Body *rest_model_zrok.RegisterRequest Body RegisterBody
} }
// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface // 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 *RegisterParams) BindRequest(r *http.Request, route *middleware.MatchedR
if runtime.HasBody(r) { if runtime.HasBody(r) {
defer r.Body.Close() defer r.Body.Close()
var body rest_model_zrok.RegisterRequest var body RegisterBody
if err := route.Consumer.Consume(r.Body, &body); err != nil { if err := route.Consumer.Consume(r.Body, &body); err != nil {
res = append(res, errors.NewParseError("body", "body", "", err)) res = append(res, errors.NewParseError("body", "body", "", err))
} else { } else {
@ -65,7 +63,7 @@ func (o *RegisterParams) BindRequest(r *http.Request, route *middleware.MatchedR
} }
if len(res) == 0 { if len(res) == 0 {
o.Body = &body o.Body = body
} }
} }
} }

View File

@ -26,7 +26,7 @@ type RegisterOK struct {
/* /*
In: Body In: Body
*/ */
Payload *rest_model_zrok.RegisterResponse `json:"body,omitempty"` Payload *RegisterOKBody `json:"body,omitempty"`
} }
// NewRegisterOK creates RegisterOK with default headers values // NewRegisterOK creates RegisterOK with default headers values
@ -36,13 +36,13 @@ func NewRegisterOK() *RegisterOK {
} }
// WithPayload adds the payload to the register o k response // WithPayload adds the payload to the register o k response
func (o *RegisterOK) WithPayload(payload *rest_model_zrok.RegisterResponse) *RegisterOK { func (o *RegisterOK) WithPayload(payload *RegisterOKBody) *RegisterOK {
o.Payload = payload o.Payload = payload
return o return o
} }
// SetPayload sets the payload to the register o k response // SetPayload sets the payload to the register o k response
func (o *RegisterOK) SetPayload(payload *rest_model_zrok.RegisterResponse) { func (o *RegisterOK) SetPayload(payload *RegisterOKBody) {
o.Payload = payload o.Payload = payload
} }

View File

@ -46,7 +46,6 @@ model/publicFrontend.ts
model/regenerateToken200Response.ts model/regenerateToken200Response.ts
model/regenerateTokenRequest.ts model/regenerateTokenRequest.ts
model/registerRequest.ts model/registerRequest.ts
model/registerResponse.ts
model/removeOrganizationMemberRequest.ts model/removeOrganizationMemberRequest.ts
model/resetPasswordRequest.ts model/resetPasswordRequest.ts
model/share.ts model/share.ts

View File

@ -21,7 +21,6 @@ import { LoginRequest } from '../model/loginRequest';
import { RegenerateToken200Response } from '../model/regenerateToken200Response'; import { RegenerateToken200Response } from '../model/regenerateToken200Response';
import { RegenerateTokenRequest } from '../model/regenerateTokenRequest'; import { RegenerateTokenRequest } from '../model/regenerateTokenRequest';
import { RegisterRequest } from '../model/registerRequest'; import { RegisterRequest } from '../model/registerRequest';
import { RegisterResponse } from '../model/registerResponse';
import { ResetPasswordRequest } from '../model/resetPasswordRequest'; import { ResetPasswordRequest } from '../model/resetPasswordRequest';
import { VerifyRequest } from '../model/verifyRequest'; import { VerifyRequest } from '../model/verifyRequest';
import { VerifyResponse } from '../model/verifyResponse'; import { VerifyResponse } from '../model/verifyResponse';
@ -358,7 +357,7 @@ export class AccountApi {
* *
* @param body * @param body
*/ */
public async register (body?: RegisterRequest, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: RegisterResponse; }> { public async register (body?: RegisterRequest, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: RegenerateToken200Response; }> {
const localVarPath = this.basePath + '/register'; const localVarPath = this.basePath + '/register';
let localVarQueryParameters: any = {}; let localVarQueryParameters: any = {};
let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders); let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
@ -401,13 +400,13 @@ export class AccountApi {
localVarRequestOptions.form = localVarFormParams; localVarRequestOptions.form = localVarFormParams;
} }
} }
return new Promise<{ response: http.IncomingMessage; body: RegisterResponse; }>((resolve, reject) => { return new Promise<{ response: http.IncomingMessage; body: RegenerateToken200Response; }>((resolve, reject) => {
localVarRequest(localVarRequestOptions, (error, response, body) => { localVarRequest(localVarRequestOptions, (error, response, body) => {
if (error) { if (error) {
reject(error); reject(error);
} else { } else {
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
body = ObjectSerializer.deserialize(body, "RegisterResponse"); body = ObjectSerializer.deserialize(body, "RegenerateToken200Response");
resolve({ response: response, body: body }); resolve({ response: response, body: body });
} else { } else {
reject(new HttpError(response, body, response.statusCode)); reject(new HttpError(response, body, response.statusCode));

View File

@ -39,7 +39,6 @@ export * from './publicFrontend';
export * from './regenerateToken200Response'; export * from './regenerateToken200Response';
export * from './regenerateTokenRequest'; export * from './regenerateTokenRequest';
export * from './registerRequest'; export * from './registerRequest';
export * from './registerResponse';
export * from './removeOrganizationMemberRequest'; export * from './removeOrganizationMemberRequest';
export * from './resetPasswordRequest'; export * from './resetPasswordRequest';
export * from './share'; export * from './share';
@ -105,7 +104,6 @@ import { PublicFrontend } from './publicFrontend';
import { RegenerateToken200Response } from './regenerateToken200Response'; import { RegenerateToken200Response } from './regenerateToken200Response';
import { RegenerateTokenRequest } from './regenerateTokenRequest'; import { RegenerateTokenRequest } from './regenerateTokenRequest';
import { RegisterRequest } from './registerRequest'; import { RegisterRequest } from './registerRequest';
import { RegisterResponse } from './registerResponse';
import { RemoveOrganizationMemberRequest } from './removeOrganizationMemberRequest'; import { RemoveOrganizationMemberRequest } from './removeOrganizationMemberRequest';
import { ResetPasswordRequest } from './resetPasswordRequest'; import { ResetPasswordRequest } from './resetPasswordRequest';
import { Share } from './share'; import { Share } from './share';
@ -179,7 +177,6 @@ let typeMap: {[index: string]: any} = {
"RegenerateToken200Response": RegenerateToken200Response, "RegenerateToken200Response": RegenerateToken200Response,
"RegenerateTokenRequest": RegenerateTokenRequest, "RegenerateTokenRequest": RegenerateTokenRequest,
"RegisterRequest": RegisterRequest, "RegisterRequest": RegisterRequest,
"RegisterResponse": RegisterResponse,
"RemoveOrganizationMemberRequest": RemoveOrganizationMemberRequest, "RemoveOrganizationMemberRequest": RemoveOrganizationMemberRequest,
"ResetPasswordRequest": ResetPasswordRequest, "ResetPasswordRequest": ResetPasswordRequest,
"Share": Share, "Share": Share,

View File

@ -69,8 +69,7 @@ from zrok_api.models.principal import Principal
from zrok_api.models.public_frontend import PublicFrontend from zrok_api.models.public_frontend import PublicFrontend
from zrok_api.models.public_frontend_list import PublicFrontendList from zrok_api.models.public_frontend_list import PublicFrontendList
from zrok_api.models.regenerate_token_body import RegenerateTokenBody from zrok_api.models.regenerate_token_body import RegenerateTokenBody
from zrok_api.models.register_request import RegisterRequest from zrok_api.models.register_body import RegisterBody
from zrok_api.models.register_response import RegisterResponse
from zrok_api.models.reset_password_request import ResetPasswordRequest from zrok_api.models.reset_password_request import ResetPasswordRequest
from zrok_api.models.reset_password_request_body import ResetPasswordRequestBody from zrok_api.models.reset_password_request_body import ResetPasswordRequestBody
from zrok_api.models.share import Share from zrok_api.models.share import Share

View File

@ -413,8 +413,8 @@ class AccountApi(object):
>>> result = thread.get() >>> result = thread.get()
:param async_req bool :param async_req bool
:param RegisterRequest body: :param RegisterBody body:
:return: RegisterResponse :return: InlineResponse200
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
""" """
@ -434,8 +434,8 @@ class AccountApi(object):
>>> result = thread.get() >>> result = thread.get()
:param async_req bool :param async_req bool
:param RegisterRequest body: :param RegisterBody body:
:return: RegisterResponse :return: InlineResponse200
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
""" """
@ -489,7 +489,7 @@ class AccountApi(object):
body=body_params, body=body_params,
post_params=form_params, post_params=form_params,
files=local_var_files, files=local_var_files,
response_type='RegisterResponse', # noqa: E501 response_type='InlineResponse200', # noqa: E501
auth_settings=auth_settings, auth_settings=auth_settings,
async_req=params.get('async_req'), async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'), _return_http_data_only=params.get('_return_http_data_only'),

View File

@ -59,8 +59,7 @@ from zrok_api.models.principal import Principal
from zrok_api.models.public_frontend import PublicFrontend from zrok_api.models.public_frontend import PublicFrontend
from zrok_api.models.public_frontend_list import PublicFrontendList from zrok_api.models.public_frontend_list import PublicFrontendList
from zrok_api.models.regenerate_token_body import RegenerateTokenBody from zrok_api.models.regenerate_token_body import RegenerateTokenBody
from zrok_api.models.register_request import RegisterRequest from zrok_api.models.register_body import RegisterBody
from zrok_api.models.register_response import RegisterResponse
from zrok_api.models.reset_password_request import ResetPasswordRequest from zrok_api.models.reset_password_request import ResetPasswordRequest
from zrok_api.models.reset_password_request_body import ResetPasswordRequestBody from zrok_api.models.reset_password_request_body import ResetPasswordRequestBody
from zrok_api.models.share import Share from zrok_api.models.share import Share

View 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 RegisterBody(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 = {
'token': 'str',
'password': 'str'
}
attribute_map = {
'token': 'token',
'password': 'password'
}
def __init__(self, token=None, password=None): # noqa: E501
"""RegisterBody - a model defined in Swagger""" # noqa: E501
self._token = None
self._password = None
self.discriminator = None
if token is not None:
self.token = token
if password is not None:
self.password = password
@property
def token(self):
"""Gets the token of this RegisterBody. # noqa: E501
:return: The token of this RegisterBody. # noqa: E501
:rtype: str
"""
return self._token
@token.setter
def token(self, token):
"""Sets the token of this RegisterBody.
:param token: The token of this RegisterBody. # noqa: E501
:type: str
"""
self._token = token
@property
def password(self):
"""Gets the password of this RegisterBody. # noqa: E501
:return: The password of this RegisterBody. # noqa: E501
:rtype: str
"""
return self._password
@password.setter
def password(self, password):
"""Sets the password of this RegisterBody.
:param password: The password of this RegisterBody. # 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(RegisterBody, 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, RegisterBody):
return False
return self.__dict__ == other.__dict__
def __ne__(self, other):
"""Returns true if both objects are not equal"""
return not self == other

View File

@ -130,12 +130,18 @@ paths:
- name: body - name: body
in: body in: body
schema: schema:
$ref: "#/definitions/registerRequest" properties:
token:
type: string
password:
type: string
responses: responses:
200: 200:
description: account created description: account created
schema: schema:
$ref: "#/definitions/registerResponse" properties:
token:
type: string
404: 404:
description: request not found description: request not found
422: 422:
@ -1289,20 +1295,6 @@ definitions:
items: items:
$ref: "#/definitions/publicFrontend" $ref: "#/definitions/publicFrontend"
registerRequest:
type: object
properties:
token:
type: string
password:
type: string
registerResponse:
type: object
properties:
token:
type: string
resetPasswordRequest: resetPasswordRequest:
type: object type: object
properties: properties:

View File

@ -44,7 +44,6 @@ models/PublicFrontend.ts
models/RegenerateToken200Response.ts models/RegenerateToken200Response.ts
models/RegenerateTokenRequest.ts models/RegenerateTokenRequest.ts
models/RegisterRequest.ts models/RegisterRequest.ts
models/RegisterResponse.ts
models/RemoveOrganizationMemberRequest.ts models/RemoveOrganizationMemberRequest.ts
models/ResetPasswordRequest.ts models/ResetPasswordRequest.ts
models/Share.ts models/Share.ts

View File

@ -21,7 +21,6 @@ import type {
RegenerateToken200Response, RegenerateToken200Response,
RegenerateTokenRequest, RegenerateTokenRequest,
RegisterRequest, RegisterRequest,
RegisterResponse,
ResetPasswordRequest, ResetPasswordRequest,
VerifyRequest, VerifyRequest,
VerifyResponse, VerifyResponse,
@ -39,8 +38,6 @@ import {
RegenerateTokenRequestToJSON, RegenerateTokenRequestToJSON,
RegisterRequestFromJSON, RegisterRequestFromJSON,
RegisterRequestToJSON, RegisterRequestToJSON,
RegisterResponseFromJSON,
RegisterResponseToJSON,
ResetPasswordRequestFromJSON, ResetPasswordRequestFromJSON,
ResetPasswordRequestToJSON, ResetPasswordRequestToJSON,
VerifyRequestFromJSON, VerifyRequestFromJSON,
@ -206,7 +203,7 @@ export class AccountApi extends runtime.BaseAPI {
/** /**
*/ */
async registerRaw(requestParameters: RegisterOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<RegisterResponse>> { async registerRaw(requestParameters: RegisterOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<RegenerateToken200Response>> {
const queryParameters: any = {}; const queryParameters: any = {};
const headerParameters: runtime.HTTPHeaders = {}; const headerParameters: runtime.HTTPHeaders = {};
@ -221,12 +218,12 @@ export class AccountApi extends runtime.BaseAPI {
body: RegisterRequestToJSON(requestParameters['body']), body: RegisterRequestToJSON(requestParameters['body']),
}, initOverrides); }, initOverrides);
return new runtime.JSONApiResponse(response, (jsonValue) => RegisterResponseFromJSON(jsonValue)); return new runtime.JSONApiResponse(response, (jsonValue) => RegenerateToken200ResponseFromJSON(jsonValue));
} }
/** /**
*/ */
async register(requestParameters: RegisterOperationRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<RegisterResponse> { async register(requestParameters: RegisterOperationRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<RegenerateToken200Response> {
const response = await this.registerRaw(requestParameters, initOverrides); const response = await this.registerRaw(requestParameters, initOverrides);
return await response.value(); return await response.value();
} }

View File

@ -39,7 +39,6 @@ export * from './PublicFrontend';
export * from './RegenerateToken200Response'; export * from './RegenerateToken200Response';
export * from './RegenerateTokenRequest'; export * from './RegenerateTokenRequest';
export * from './RegisterRequest'; export * from './RegisterRequest';
export * from './RegisterResponse';
export * from './RemoveOrganizationMemberRequest'; export * from './RemoveOrganizationMemberRequest';
export * from './ResetPasswordRequest'; export * from './ResetPasswordRequest';
export * from './Share'; export * from './Share';