mirror of
https://github.com/openziti/zrok.git
synced 2025-06-21 10:17:51 +02:00
api polish for register endpoint (#834)
This commit is contained in:
parent
3f0d36e755
commit
164fb96b73
@ -19,7 +19,7 @@ func newRegisterHandler(cfg *config.Config) *registerHandler {
|
||||
}
|
||||
}
|
||||
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")
|
||||
return account.NewRegisterNotFound()
|
||||
}
|
||||
@ -77,5 +77,5 @@ func (h *registerHandler) Handle(params account.RegisterParams) middleware.Respo
|
||||
|
||||
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})
|
||||
}
|
||||
|
@ -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"
|
||||
)
|
||||
|
||||
// NewRegisterParams creates a new RegisterParams object,
|
||||
@ -64,7 +62,7 @@ RegisterParams contains all the parameters to send to the API endpoint
|
||||
type RegisterParams struct {
|
||||
|
||||
// Body.
|
||||
Body *rest_model_zrok.RegisterRequest
|
||||
Body RegisterBody
|
||||
|
||||
timeout time.Duration
|
||||
Context context.Context
|
||||
@ -120,13 +118,13 @@ func (o *RegisterParams) SetHTTPClient(client *http.Client) {
|
||||
}
|
||||
|
||||
// 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)
|
||||
return o
|
||||
}
|
||||
|
||||
// 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
|
||||
}
|
||||
|
||||
@ -137,11 +135,9 @@ func (o *RegisterParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Regi
|
||||
return err
|
||||
}
|
||||
var res []error
|
||||
if o.Body != nil {
|
||||
if err := r.SetBodyParam(o.Body); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
|
@ -6,11 +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/go-openapi/swag"
|
||||
|
||||
"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
|
||||
*/
|
||||
type RegisterOK struct {
|
||||
Payload *rest_model_zrok.RegisterResponse
|
||||
Payload *RegisterOKBody
|
||||
}
|
||||
|
||||
// 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)
|
||||
}
|
||||
|
||||
func (o *RegisterOK) GetPayload() *rest_model_zrok.RegisterResponse {
|
||||
func (o *RegisterOK) GetPayload() *RegisterOKBody {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
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
|
||||
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
|
||||
}
|
||||
|
||||
/*
|
||||
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
|
||||
}
|
||||
|
@ -1337,7 +1337,14 @@ func init() {
|
||||
"name": "body",
|
||||
"in": "body",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/registerRequest"
|
||||
"properties": {
|
||||
"password": {
|
||||
"type": "string"
|
||||
},
|
||||
"token": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
@ -1345,7 +1352,11 @@ func init() {
|
||||
"200": {
|
||||
"description": "account created",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/registerResponse"
|
||||
"properties": {
|
||||
"token": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"404": {
|
||||
@ -2029,25 +2040,6 @@ func init() {
|
||||
"$ref": "#/definitions/publicFrontend"
|
||||
}
|
||||
},
|
||||
"registerRequest": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"password": {
|
||||
"type": "string"
|
||||
},
|
||||
"token": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"registerResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"token": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"resetPasswordRequest": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@ -3600,7 +3592,14 @@ func init() {
|
||||
"name": "body",
|
||||
"in": "body",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/registerRequest"
|
||||
"properties": {
|
||||
"password": {
|
||||
"type": "string"
|
||||
},
|
||||
"token": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
@ -3608,7 +3607,11 @@ func init() {
|
||||
"200": {
|
||||
"description": "account created",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/registerResponse"
|
||||
"properties": {
|
||||
"token": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"404": {
|
||||
@ -4325,25 +4328,6 @@ func init() {
|
||||
"$ref": "#/definitions/publicFrontend"
|
||||
}
|
||||
},
|
||||
"registerRequest": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"password": {
|
||||
"type": "string"
|
||||
},
|
||||
"token": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"registerResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"token": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"resetPasswordRequest": {
|
||||
"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"
|
||||
)
|
||||
|
||||
// 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)
|
||||
|
||||
}
|
||||
|
||||
// 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
|
||||
}
|
||||
|
@ -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"
|
||||
)
|
||||
|
||||
// NewRegisterParams creates a new RegisterParams object
|
||||
@ -36,7 +34,7 @@ type RegisterParams struct {
|
||||
/*
|
||||
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
|
||||
@ -50,7 +48,7 @@ func (o *RegisterParams) BindRequest(r *http.Request, route *middleware.MatchedR
|
||||
|
||||
if runtime.HasBody(r) {
|
||||
defer r.Body.Close()
|
||||
var body rest_model_zrok.RegisterRequest
|
||||
var body RegisterBody
|
||||
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 *RegisterParams) BindRequest(r *http.Request, route *middleware.MatchedR
|
||||
}
|
||||
|
||||
if len(res) == 0 {
|
||||
o.Body = &body
|
||||
o.Body = body
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ type RegisterOK struct {
|
||||
/*
|
||||
In: Body
|
||||
*/
|
||||
Payload *rest_model_zrok.RegisterResponse `json:"body,omitempty"`
|
||||
Payload *RegisterOKBody `json:"body,omitempty"`
|
||||
}
|
||||
|
||||
// NewRegisterOK creates RegisterOK with default headers values
|
||||
@ -36,13 +36,13 @@ func NewRegisterOK() *RegisterOK {
|
||||
}
|
||||
|
||||
// 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
|
||||
return o
|
||||
}
|
||||
|
||||
// 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
|
||||
}
|
||||
|
||||
|
@ -46,7 +46,6 @@ model/publicFrontend.ts
|
||||
model/regenerateToken200Response.ts
|
||||
model/regenerateTokenRequest.ts
|
||||
model/registerRequest.ts
|
||||
model/registerResponse.ts
|
||||
model/removeOrganizationMemberRequest.ts
|
||||
model/resetPasswordRequest.ts
|
||||
model/share.ts
|
||||
|
@ -21,7 +21,6 @@ import { LoginRequest } from '../model/loginRequest';
|
||||
import { RegenerateToken200Response } from '../model/regenerateToken200Response';
|
||||
import { RegenerateTokenRequest } from '../model/regenerateTokenRequest';
|
||||
import { RegisterRequest } from '../model/registerRequest';
|
||||
import { RegisterResponse } from '../model/registerResponse';
|
||||
import { ResetPasswordRequest } from '../model/resetPasswordRequest';
|
||||
import { VerifyRequest } from '../model/verifyRequest';
|
||||
import { VerifyResponse } from '../model/verifyResponse';
|
||||
@ -358,7 +357,7 @@ export class AccountApi {
|
||||
*
|
||||
* @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';
|
||||
let localVarQueryParameters: any = {};
|
||||
let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
|
||||
@ -401,13 +400,13 @@ export class AccountApi {
|
||||
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) => {
|
||||
if (error) {
|
||||
reject(error);
|
||||
} else {
|
||||
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
|
||||
body = ObjectSerializer.deserialize(body, "RegisterResponse");
|
||||
body = ObjectSerializer.deserialize(body, "RegenerateToken200Response");
|
||||
resolve({ response: response, body: body });
|
||||
} else {
|
||||
reject(new HttpError(response, body, response.statusCode));
|
||||
|
@ -39,7 +39,6 @@ export * from './publicFrontend';
|
||||
export * from './regenerateToken200Response';
|
||||
export * from './regenerateTokenRequest';
|
||||
export * from './registerRequest';
|
||||
export * from './registerResponse';
|
||||
export * from './removeOrganizationMemberRequest';
|
||||
export * from './resetPasswordRequest';
|
||||
export * from './share';
|
||||
@ -105,7 +104,6 @@ import { PublicFrontend } from './publicFrontend';
|
||||
import { RegenerateToken200Response } from './regenerateToken200Response';
|
||||
import { RegenerateTokenRequest } from './regenerateTokenRequest';
|
||||
import { RegisterRequest } from './registerRequest';
|
||||
import { RegisterResponse } from './registerResponse';
|
||||
import { RemoveOrganizationMemberRequest } from './removeOrganizationMemberRequest';
|
||||
import { ResetPasswordRequest } from './resetPasswordRequest';
|
||||
import { Share } from './share';
|
||||
@ -179,7 +177,6 @@ let typeMap: {[index: string]: any} = {
|
||||
"RegenerateToken200Response": RegenerateToken200Response,
|
||||
"RegenerateTokenRequest": RegenerateTokenRequest,
|
||||
"RegisterRequest": RegisterRequest,
|
||||
"RegisterResponse": RegisterResponse,
|
||||
"RemoveOrganizationMemberRequest": RemoveOrganizationMemberRequest,
|
||||
"ResetPasswordRequest": ResetPasswordRequest,
|
||||
"Share": Share,
|
||||
|
@ -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_list import PublicFrontendList
|
||||
from zrok_api.models.regenerate_token_body import RegenerateTokenBody
|
||||
from zrok_api.models.register_request import RegisterRequest
|
||||
from zrok_api.models.register_response import RegisterResponse
|
||||
from zrok_api.models.register_body import RegisterBody
|
||||
from zrok_api.models.reset_password_request import ResetPasswordRequest
|
||||
from zrok_api.models.reset_password_request_body import ResetPasswordRequestBody
|
||||
from zrok_api.models.share import Share
|
||||
|
@ -413,8 +413,8 @@ class AccountApi(object):
|
||||
>>> result = thread.get()
|
||||
|
||||
:param async_req bool
|
||||
:param RegisterRequest body:
|
||||
:return: RegisterResponse
|
||||
:param RegisterBody body:
|
||||
:return: InlineResponse200
|
||||
If the method is called asynchronously,
|
||||
returns the request thread.
|
||||
"""
|
||||
@ -434,8 +434,8 @@ class AccountApi(object):
|
||||
>>> result = thread.get()
|
||||
|
||||
:param async_req bool
|
||||
:param RegisterRequest body:
|
||||
:return: RegisterResponse
|
||||
:param RegisterBody body:
|
||||
:return: InlineResponse200
|
||||
If the method is called asynchronously,
|
||||
returns the request thread.
|
||||
"""
|
||||
@ -489,7 +489,7 @@ class AccountApi(object):
|
||||
body=body_params,
|
||||
post_params=form_params,
|
||||
files=local_var_files,
|
||||
response_type='RegisterResponse', # noqa: E501
|
||||
response_type='InlineResponse200', # noqa: E501
|
||||
auth_settings=auth_settings,
|
||||
async_req=params.get('async_req'),
|
||||
_return_http_data_only=params.get('_return_http_data_only'),
|
||||
|
@ -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_list import PublicFrontendList
|
||||
from zrok_api.models.regenerate_token_body import RegenerateTokenBody
|
||||
from zrok_api.models.register_request import RegisterRequest
|
||||
from zrok_api.models.register_response import RegisterResponse
|
||||
from zrok_api.models.register_body import RegisterBody
|
||||
from zrok_api.models.reset_password_request import ResetPasswordRequest
|
||||
from zrok_api.models.reset_password_request_body import ResetPasswordRequestBody
|
||||
from zrok_api.models.share import Share
|
||||
|
136
sdk/python/sdk/zrok/zrok_api/models/register_body.py
Normal file
136
sdk/python/sdk/zrok/zrok_api/models/register_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 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
|
@ -130,12 +130,18 @@ paths:
|
||||
- name: body
|
||||
in: body
|
||||
schema:
|
||||
$ref: "#/definitions/registerRequest"
|
||||
properties:
|
||||
token:
|
||||
type: string
|
||||
password:
|
||||
type: string
|
||||
responses:
|
||||
200:
|
||||
description: account created
|
||||
schema:
|
||||
$ref: "#/definitions/registerResponse"
|
||||
properties:
|
||||
token:
|
||||
type: string
|
||||
404:
|
||||
description: request not found
|
||||
422:
|
||||
@ -1289,20 +1295,6 @@ definitions:
|
||||
items:
|
||||
$ref: "#/definitions/publicFrontend"
|
||||
|
||||
registerRequest:
|
||||
type: object
|
||||
properties:
|
||||
token:
|
||||
type: string
|
||||
password:
|
||||
type: string
|
||||
|
||||
registerResponse:
|
||||
type: object
|
||||
properties:
|
||||
token:
|
||||
type: string
|
||||
|
||||
resetPasswordRequest:
|
||||
type: object
|
||||
properties:
|
||||
|
@ -44,7 +44,6 @@ models/PublicFrontend.ts
|
||||
models/RegenerateToken200Response.ts
|
||||
models/RegenerateTokenRequest.ts
|
||||
models/RegisterRequest.ts
|
||||
models/RegisterResponse.ts
|
||||
models/RemoveOrganizationMemberRequest.ts
|
||||
models/ResetPasswordRequest.ts
|
||||
models/Share.ts
|
||||
|
@ -21,7 +21,6 @@ import type {
|
||||
RegenerateToken200Response,
|
||||
RegenerateTokenRequest,
|
||||
RegisterRequest,
|
||||
RegisterResponse,
|
||||
ResetPasswordRequest,
|
||||
VerifyRequest,
|
||||
VerifyResponse,
|
||||
@ -39,8 +38,6 @@ import {
|
||||
RegenerateTokenRequestToJSON,
|
||||
RegisterRequestFromJSON,
|
||||
RegisterRequestToJSON,
|
||||
RegisterResponseFromJSON,
|
||||
RegisterResponseToJSON,
|
||||
ResetPasswordRequestFromJSON,
|
||||
ResetPasswordRequestToJSON,
|
||||
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 headerParameters: runtime.HTTPHeaders = {};
|
||||
@ -221,12 +218,12 @@ export class AccountApi extends runtime.BaseAPI {
|
||||
body: RegisterRequestToJSON(requestParameters['body']),
|
||||
}, 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);
|
||||
return await response.value();
|
||||
}
|
||||
|
@ -39,7 +39,6 @@ export * from './PublicFrontend';
|
||||
export * from './RegenerateToken200Response';
|
||||
export * from './RegenerateTokenRequest';
|
||||
export * from './RegisterRequest';
|
||||
export * from './RegisterResponse';
|
||||
export * from './RemoveOrganizationMemberRequest';
|
||||
export * from './ResetPasswordRequest';
|
||||
export * from './Share';
|
||||
|
Loading…
x
Reference in New Issue
Block a user