mirror of
https://github.com/openziti/zrok.git
synced 2025-03-24 21:17:57 +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/environment"
|
||||||
"github.com/openziti/zrok/rest_client_zrok/account"
|
"github.com/openziti/zrok/rest_client_zrok/account"
|
||||||
"github.com/openziti/zrok/rest_client_zrok/metadata"
|
"github.com/openziti/zrok/rest_client_zrok/metadata"
|
||||||
"github.com/openziti/zrok/rest_model_zrok"
|
|
||||||
"github.com/openziti/zrok/tui"
|
"github.com/openziti/zrok/tui"
|
||||||
"github.com/openziti/zrok/util"
|
"github.com/openziti/zrok/util"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
@ -79,10 +78,8 @@ func (cmd *inviteCommand) run(_ *cobra.Command, _ []string) {
|
|||||||
token := cmd.tui.tokenInput.Value()
|
token := cmd.tui.tokenInput.Value()
|
||||||
|
|
||||||
req := account.NewInviteParams()
|
req := account.NewInviteParams()
|
||||||
req.Body = &rest_model_zrok.InviteRequest{
|
req.Body.Email = email
|
||||||
Email: email,
|
req.Body.Token = token
|
||||||
Token: token,
|
|
||||||
}
|
|
||||||
_, err = zrok.Account.Invite(req)
|
_, err = zrok.Account.Invite(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
cmd.endpointError(env.ApiEndpoint())
|
cmd.endpointError(env.ApiEndpoint())
|
||||||
|
@ -2,13 +2,12 @@ package controller
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/go-openapi/runtime/middleware"
|
"github.com/go-openapi/runtime/middleware"
|
||||||
"github.com/openziti/zrok/rest_model_zrok"
|
|
||||||
"github.com/openziti/zrok/rest_server_zrok/operations/account"
|
"github.com/openziti/zrok/rest_server_zrok/operations/account"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
)
|
)
|
||||||
|
|
||||||
func loginHandler(params account.LoginParams) middleware.Responder {
|
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")
|
logrus.Errorf("missing email or password")
|
||||||
return account.NewLoginUnauthorized()
|
return account.NewLoginUnauthorized()
|
||||||
}
|
}
|
||||||
@ -36,5 +35,5 @@ func loginHandler(params account.LoginParams) middleware.Responder {
|
|||||||
return account.NewLoginUnauthorized()
|
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"
|
"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"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// NewLoginParams creates a new LoginParams object,
|
// NewLoginParams creates a new LoginParams object,
|
||||||
@ -64,7 +62,7 @@ LoginParams contains all the parameters to send to the API endpoint
|
|||||||
type LoginParams struct {
|
type LoginParams struct {
|
||||||
|
|
||||||
// Body.
|
// Body.
|
||||||
Body *rest_model_zrok.LoginRequest
|
Body LoginBody
|
||||||
|
|
||||||
timeout time.Duration
|
timeout time.Duration
|
||||||
Context context.Context
|
Context context.Context
|
||||||
@ -120,13 +118,13 @@ func (o *LoginParams) SetHTTPClient(client *http.Client) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// WithBody adds the body to the login params
|
// 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)
|
o.SetBody(body)
|
||||||
return o
|
return o
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetBody adds the body to the login params
|
// 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
|
o.Body = body
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -137,11 +135,9 @@ func (o *LoginParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registr
|
|||||||
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 {
|
||||||
return errors.CompositeValidationError(res...)
|
return errors.CompositeValidationError(res...)
|
||||||
|
@ -6,13 +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"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// LoginReader is a Reader for the Login structure.
|
// 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
|
login successful
|
||||||
*/
|
*/
|
||||||
type LoginOK struct {
|
type LoginOK struct {
|
||||||
Payload rest_model_zrok.LoginResponse
|
Payload string
|
||||||
}
|
}
|
||||||
|
|
||||||
// IsSuccess returns true when this login o k response has a 2xx status code
|
// 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)
|
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
|
return o.Payload
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -161,3 +161,44 @@ func (o *LoginUnauthorized) readResponse(response runtime.ClientResponse, consum
|
|||||||
|
|
||||||
return nil
|
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",
|
"name": "body",
|
||||||
"in": "body",
|
"in": "body",
|
||||||
"schema": {
|
"schema": {
|
||||||
"$ref": "#/definitions/loginRequest"
|
"properties": {
|
||||||
|
"email": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"password": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@ -719,7 +726,7 @@ func init() {
|
|||||||
"200": {
|
"200": {
|
||||||
"description": "login successful",
|
"description": "login successful",
|
||||||
"schema": {
|
"schema": {
|
||||||
"$ref": "#/definitions/loginResponse"
|
"type": "string"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"401": {
|
"401": {
|
||||||
@ -1905,20 +1912,6 @@ func init() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"loginRequest": {
|
|
||||||
"type": "object",
|
|
||||||
"properties": {
|
|
||||||
"email": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"password": {
|
|
||||||
"type": "string"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"loginResponse": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"metrics": {
|
"metrics": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
@ -3012,7 +3005,14 @@ func init() {
|
|||||||
"name": "body",
|
"name": "body",
|
||||||
"in": "body",
|
"in": "body",
|
||||||
"schema": {
|
"schema": {
|
||||||
"$ref": "#/definitions/loginRequest"
|
"properties": {
|
||||||
|
"email": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"password": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@ -3020,7 +3020,7 @@ func init() {
|
|||||||
"200": {
|
"200": {
|
||||||
"description": "login successful",
|
"description": "login successful",
|
||||||
"schema": {
|
"schema": {
|
||||||
"$ref": "#/definitions/loginResponse"
|
"type": "string"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"401": {
|
"401": {
|
||||||
@ -4208,20 +4208,6 @@ func init() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"loginRequest": {
|
|
||||||
"type": "object",
|
|
||||||
"properties": {
|
|
||||||
"email": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"password": {
|
|
||||||
"type": "string"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"loginResponse": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"metrics": {
|
"metrics": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
|
@ -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"
|
||||||
)
|
)
|
||||||
|
|
||||||
// LoginHandlerFunc turns a function with the right signature into a login handler
|
// 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)
|
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"
|
||||||
"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"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// NewLoginParams creates a new LoginParams object
|
// NewLoginParams creates a new LoginParams object
|
||||||
@ -36,7 +34,7 @@ type LoginParams struct {
|
|||||||
/*
|
/*
|
||||||
In: body
|
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
|
// 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) {
|
if runtime.HasBody(r) {
|
||||||
defer r.Body.Close()
|
defer r.Body.Close()
|
||||||
var body rest_model_zrok.LoginRequest
|
var body LoginBody
|
||||||
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 *LoginParams) BindRequest(r *http.Request, route *middleware.MatchedRout
|
|||||||
}
|
}
|
||||||
|
|
||||||
if len(res) == 0 {
|
if len(res) == 0 {
|
||||||
o.Body = &body
|
o.Body = body
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,8 +9,6 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"github.com/go-openapi/runtime"
|
"github.com/go-openapi/runtime"
|
||||||
|
|
||||||
"github.com/openziti/zrok/rest_model_zrok"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// LoginOKCode is the HTTP code returned for type LoginOK
|
// LoginOKCode is the HTTP code returned for type LoginOK
|
||||||
@ -26,7 +24,7 @@ type LoginOK struct {
|
|||||||
/*
|
/*
|
||||||
In: Body
|
In: Body
|
||||||
*/
|
*/
|
||||||
Payload rest_model_zrok.LoginResponse `json:"body,omitempty"`
|
Payload string `json:"body,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewLoginOK creates LoginOK with default headers values
|
// NewLoginOK creates LoginOK with default headers values
|
||||||
@ -36,13 +34,13 @@ func NewLoginOK() *LoginOK {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// WithPayload adds the payload to the login o k response
|
// 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
|
o.Payload = payload
|
||||||
return o
|
return o
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetPayload sets the payload to the login o k response
|
// 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
|
o.Payload = payload
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,7 +12,6 @@ model/addOrganizationMemberRequest.ts
|
|||||||
model/authUser.ts
|
model/authUser.ts
|
||||||
model/changePasswordRequest.ts
|
model/changePasswordRequest.ts
|
||||||
model/configuration.ts
|
model/configuration.ts
|
||||||
model/createAccountRequest.ts
|
|
||||||
model/createFrontendRequest.ts
|
model/createFrontendRequest.ts
|
||||||
model/createFrontendResponse.ts
|
model/createFrontendResponse.ts
|
||||||
model/createIdentity201Response.ts
|
model/createIdentity201Response.ts
|
||||||
|
@ -16,7 +16,6 @@ import http from 'http';
|
|||||||
|
|
||||||
/* tslint:disable:no-unused-locals */
|
/* tslint:disable:no-unused-locals */
|
||||||
import { AddOrganizationMemberRequest } from '../model/addOrganizationMemberRequest';
|
import { AddOrganizationMemberRequest } from '../model/addOrganizationMemberRequest';
|
||||||
import { CreateAccountRequest } from '../model/createAccountRequest';
|
|
||||||
import { CreateFrontendRequest } from '../model/createFrontendRequest';
|
import { CreateFrontendRequest } from '../model/createFrontendRequest';
|
||||||
import { CreateFrontendResponse } from '../model/createFrontendResponse';
|
import { CreateFrontendResponse } from '../model/createFrontendResponse';
|
||||||
import { CreateIdentity201Response } from '../model/createIdentity201Response';
|
import { CreateIdentity201Response } from '../model/createIdentity201Response';
|
||||||
@ -27,6 +26,7 @@ import { GrantsRequest } from '../model/grantsRequest';
|
|||||||
import { InviteTokenGenerateRequest } from '../model/inviteTokenGenerateRequest';
|
import { InviteTokenGenerateRequest } from '../model/inviteTokenGenerateRequest';
|
||||||
import { ListOrganizationMembers200Response } from '../model/listOrganizationMembers200Response';
|
import { ListOrganizationMembers200Response } from '../model/listOrganizationMembers200Response';
|
||||||
import { ListOrganizations200Response } from '../model/listOrganizations200Response';
|
import { ListOrganizations200Response } from '../model/listOrganizations200Response';
|
||||||
|
import { LoginRequest } from '../model/loginRequest';
|
||||||
import { PublicFrontend } from '../model/publicFrontend';
|
import { PublicFrontend } from '../model/publicFrontend';
|
||||||
import { RegenerateToken200Response } from '../model/regenerateToken200Response';
|
import { RegenerateToken200Response } from '../model/regenerateToken200Response';
|
||||||
import { RemoveOrganizationMemberRequest } from '../model/removeOrganizationMemberRequest';
|
import { RemoveOrganizationMemberRequest } from '../model/removeOrganizationMemberRequest';
|
||||||
@ -166,7 +166,7 @@ export class AdminApi {
|
|||||||
*
|
*
|
||||||
* @param body
|
* @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';
|
const localVarPath = this.basePath + '/account';
|
||||||
let localVarQueryParameters: any = {};
|
let localVarQueryParameters: any = {};
|
||||||
let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
|
let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
|
||||||
@ -190,7 +190,7 @@ export class AdminApi {
|
|||||||
uri: localVarPath,
|
uri: localVarPath,
|
||||||
useQuerystring: this._useQuerystring,
|
useQuerystring: this._useQuerystring,
|
||||||
json: true,
|
json: true,
|
||||||
body: ObjectSerializer.serialize(body, "CreateAccountRequest")
|
body: ObjectSerializer.serialize(body, "LoginRequest")
|
||||||
};
|
};
|
||||||
|
|
||||||
let authenticationPromise = Promise.resolve();
|
let authenticationPromise = Promise.resolve();
|
||||||
|
@ -6,7 +6,6 @@ export * from './addOrganizationMemberRequest';
|
|||||||
export * from './authUser';
|
export * from './authUser';
|
||||||
export * from './changePasswordRequest';
|
export * from './changePasswordRequest';
|
||||||
export * from './configuration';
|
export * from './configuration';
|
||||||
export * from './createAccountRequest';
|
|
||||||
export * from './createFrontendRequest';
|
export * from './createFrontendRequest';
|
||||||
export * from './createFrontendResponse';
|
export * from './createFrontendResponse';
|
||||||
export * from './createIdentity201Response';
|
export * from './createIdentity201Response';
|
||||||
@ -73,7 +72,6 @@ import { AddOrganizationMemberRequest } from './addOrganizationMemberRequest';
|
|||||||
import { AuthUser } from './authUser';
|
import { AuthUser } from './authUser';
|
||||||
import { ChangePasswordRequest } from './changePasswordRequest';
|
import { ChangePasswordRequest } from './changePasswordRequest';
|
||||||
import { Configuration } from './configuration';
|
import { Configuration } from './configuration';
|
||||||
import { CreateAccountRequest } from './createAccountRequest';
|
|
||||||
import { CreateFrontendRequest } from './createFrontendRequest';
|
import { CreateFrontendRequest } from './createFrontendRequest';
|
||||||
import { CreateFrontendResponse } from './createFrontendResponse';
|
import { CreateFrontendResponse } from './createFrontendResponse';
|
||||||
import { CreateIdentity201Response } from './createIdentity201Response';
|
import { CreateIdentity201Response } from './createIdentity201Response';
|
||||||
@ -148,7 +146,6 @@ let typeMap: {[index: string]: any} = {
|
|||||||
"AuthUser": AuthUser,
|
"AuthUser": AuthUser,
|
||||||
"ChangePasswordRequest": ChangePasswordRequest,
|
"ChangePasswordRequest": ChangePasswordRequest,
|
||||||
"Configuration": Configuration,
|
"Configuration": Configuration,
|
||||||
"CreateAccountRequest": CreateAccountRequest,
|
|
||||||
"CreateFrontendRequest": CreateFrontendRequest,
|
"CreateFrontendRequest": CreateFrontendRequest,
|
||||||
"CreateFrontendResponse": CreateFrontendResponse,
|
"CreateFrontendResponse": CreateFrontendResponse,
|
||||||
"CreateIdentity201Response": CreateIdentity201Response,
|
"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.inline_response201 import InlineResponse201
|
||||||
from zrok_api.models.invite_body import InviteBody
|
from zrok_api.models.invite_body import InviteBody
|
||||||
from zrok_api.models.invite_token_generate_request import InviteTokenGenerateRequest
|
from zrok_api.models.invite_token_generate_request import InviteTokenGenerateRequest
|
||||||
from zrok_api.models.login_request import LoginRequest
|
from zrok_api.models.login_body import LoginBody
|
||||||
from zrok_api.models.login_response import LoginResponse
|
|
||||||
from zrok_api.models.metrics import Metrics
|
from zrok_api.models.metrics import Metrics
|
||||||
from zrok_api.models.metrics_sample import MetricsSample
|
from zrok_api.models.metrics_sample import MetricsSample
|
||||||
from zrok_api.models.organization_add_body import OrganizationAddBody
|
from zrok_api.models.organization_add_body import OrganizationAddBody
|
||||||
|
@ -227,8 +227,8 @@ class AccountApi(object):
|
|||||||
>>> result = thread.get()
|
>>> result = thread.get()
|
||||||
|
|
||||||
:param async_req bool
|
:param async_req bool
|
||||||
:param LoginRequest body:
|
:param LoginBody body:
|
||||||
:return: LoginResponse
|
:return: str
|
||||||
If the method is called asynchronously,
|
If the method is called asynchronously,
|
||||||
returns the request thread.
|
returns the request thread.
|
||||||
"""
|
"""
|
||||||
@ -248,8 +248,8 @@ class AccountApi(object):
|
|||||||
>>> result = thread.get()
|
>>> result = thread.get()
|
||||||
|
|
||||||
:param async_req bool
|
:param async_req bool
|
||||||
:param LoginRequest body:
|
:param LoginBody body:
|
||||||
:return: LoginResponse
|
:return: str
|
||||||
If the method is called asynchronously,
|
If the method is called asynchronously,
|
||||||
returns the request thread.
|
returns the request thread.
|
||||||
"""
|
"""
|
||||||
@ -303,7 +303,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='LoginResponse', # noqa: E501
|
response_type='str', # 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'),
|
||||||
|
@ -45,8 +45,7 @@ from zrok_api.models.inline_response2004 import InlineResponse2004
|
|||||||
from zrok_api.models.inline_response201 import InlineResponse201
|
from zrok_api.models.inline_response201 import InlineResponse201
|
||||||
from zrok_api.models.invite_body import InviteBody
|
from zrok_api.models.invite_body import InviteBody
|
||||||
from zrok_api.models.invite_token_generate_request import InviteTokenGenerateRequest
|
from zrok_api.models.invite_token_generate_request import InviteTokenGenerateRequest
|
||||||
from zrok_api.models.login_request import LoginRequest
|
from zrok_api.models.login_body import LoginBody
|
||||||
from zrok_api.models.login_response import LoginResponse
|
|
||||||
from zrok_api.models.metrics import Metrics
|
from zrok_api.models.metrics import Metrics
|
||||||
from zrok_api.models.metrics_sample import MetricsSample
|
from zrok_api.models.metrics_sample import MetricsSample
|
||||||
from zrok_api.models.organization_add_body import OrganizationAddBody
|
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
|
- name: body
|
||||||
in: body
|
in: body
|
||||||
schema:
|
schema:
|
||||||
$ref: "#/definitions/loginRequest"
|
properties:
|
||||||
|
email:
|
||||||
|
type: string
|
||||||
|
password:
|
||||||
|
type: string
|
||||||
responses:
|
responses:
|
||||||
200:
|
200:
|
||||||
description: login successful
|
description: login successful
|
||||||
schema:
|
schema:
|
||||||
$ref: "#/definitions/loginResponse"
|
type: string
|
||||||
401:
|
401:
|
||||||
description: invalid login
|
description: invalid login
|
||||||
|
|
||||||
@ -1202,17 +1206,6 @@ definitions:
|
|||||||
items:
|
items:
|
||||||
type: string
|
type: string
|
||||||
|
|
||||||
loginRequest:
|
|
||||||
type: object
|
|
||||||
properties:
|
|
||||||
email:
|
|
||||||
type: string
|
|
||||||
password:
|
|
||||||
type: string
|
|
||||||
|
|
||||||
loginResponse:
|
|
||||||
type: string
|
|
||||||
|
|
||||||
metrics:
|
metrics:
|
||||||
type: object
|
type: object
|
||||||
properties:
|
properties:
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
.openapi-generator-ignore
|
|
||||||
apis/AccountApi.ts
|
apis/AccountApi.ts
|
||||||
apis/AdminApi.ts
|
apis/AdminApi.ts
|
||||||
apis/EnvironmentApi.ts
|
apis/EnvironmentApi.ts
|
||||||
@ -11,7 +10,6 @@ models/AccessResponse.ts
|
|||||||
models/AddOrganizationMemberRequest.ts
|
models/AddOrganizationMemberRequest.ts
|
||||||
models/AuthUser.ts
|
models/AuthUser.ts
|
||||||
models/ChangePasswordRequest.ts
|
models/ChangePasswordRequest.ts
|
||||||
models/CreateAccountRequest.ts
|
|
||||||
models/CreateFrontendRequest.ts
|
models/CreateFrontendRequest.ts
|
||||||
models/CreateFrontendResponse.ts
|
models/CreateFrontendResponse.ts
|
||||||
models/CreateIdentity201Response.ts
|
models/CreateIdentity201Response.ts
|
||||||
|
@ -16,7 +16,6 @@
|
|||||||
import * as runtime from '../runtime';
|
import * as runtime from '../runtime';
|
||||||
import type {
|
import type {
|
||||||
AddOrganizationMemberRequest,
|
AddOrganizationMemberRequest,
|
||||||
CreateAccountRequest,
|
|
||||||
CreateFrontendRequest,
|
CreateFrontendRequest,
|
||||||
CreateFrontendResponse,
|
CreateFrontendResponse,
|
||||||
CreateIdentity201Response,
|
CreateIdentity201Response,
|
||||||
@ -27,6 +26,7 @@ import type {
|
|||||||
InviteTokenGenerateRequest,
|
InviteTokenGenerateRequest,
|
||||||
ListOrganizationMembers200Response,
|
ListOrganizationMembers200Response,
|
||||||
ListOrganizations200Response,
|
ListOrganizations200Response,
|
||||||
|
LoginRequest,
|
||||||
PublicFrontend,
|
PublicFrontend,
|
||||||
RegenerateToken200Response,
|
RegenerateToken200Response,
|
||||||
RemoveOrganizationMemberRequest,
|
RemoveOrganizationMemberRequest,
|
||||||
@ -35,8 +35,6 @@ import type {
|
|||||||
import {
|
import {
|
||||||
AddOrganizationMemberRequestFromJSON,
|
AddOrganizationMemberRequestFromJSON,
|
||||||
AddOrganizationMemberRequestToJSON,
|
AddOrganizationMemberRequestToJSON,
|
||||||
CreateAccountRequestFromJSON,
|
|
||||||
CreateAccountRequestToJSON,
|
|
||||||
CreateFrontendRequestFromJSON,
|
CreateFrontendRequestFromJSON,
|
||||||
CreateFrontendRequestToJSON,
|
CreateFrontendRequestToJSON,
|
||||||
CreateFrontendResponseFromJSON,
|
CreateFrontendResponseFromJSON,
|
||||||
@ -57,6 +55,8 @@ import {
|
|||||||
ListOrganizationMembers200ResponseToJSON,
|
ListOrganizationMembers200ResponseToJSON,
|
||||||
ListOrganizations200ResponseFromJSON,
|
ListOrganizations200ResponseFromJSON,
|
||||||
ListOrganizations200ResponseToJSON,
|
ListOrganizations200ResponseToJSON,
|
||||||
|
LoginRequestFromJSON,
|
||||||
|
LoginRequestToJSON,
|
||||||
PublicFrontendFromJSON,
|
PublicFrontendFromJSON,
|
||||||
PublicFrontendToJSON,
|
PublicFrontendToJSON,
|
||||||
RegenerateToken200ResponseFromJSON,
|
RegenerateToken200ResponseFromJSON,
|
||||||
@ -71,8 +71,8 @@ export interface AddOrganizationMemberOperationRequest {
|
|||||||
body?: AddOrganizationMemberRequest;
|
body?: AddOrganizationMemberRequest;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface CreateAccountOperationRequest {
|
export interface CreateAccountRequest {
|
||||||
body?: CreateAccountRequest;
|
body?: LoginRequest;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface CreateFrontendOperationRequest {
|
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 queryParameters: any = {};
|
||||||
|
|
||||||
const headerParameters: runtime.HTTPHeaders = {};
|
const headerParameters: runtime.HTTPHeaders = {};
|
||||||
@ -168,7 +168,7 @@ export class AdminApi extends runtime.BaseAPI {
|
|||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: headerParameters,
|
headers: headerParameters,
|
||||||
query: queryParameters,
|
query: queryParameters,
|
||||||
body: CreateAccountRequestToJSON(requestParameters['body']),
|
body: LoginRequestToJSON(requestParameters['body']),
|
||||||
}, initOverrides);
|
}, initOverrides);
|
||||||
|
|
||||||
return new runtime.JSONApiResponse(response, (jsonValue) => RegenerateToken200ResponseFromJSON(jsonValue));
|
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);
|
const response = await this.createAccountRaw(requestParameters, initOverrides);
|
||||||
return await response.value();
|
return await response.value();
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,6 @@ export * from './AccessResponse';
|
|||||||
export * from './AddOrganizationMemberRequest';
|
export * from './AddOrganizationMemberRequest';
|
||||||
export * from './AuthUser';
|
export * from './AuthUser';
|
||||||
export * from './ChangePasswordRequest';
|
export * from './ChangePasswordRequest';
|
||||||
export * from './CreateAccountRequest';
|
|
||||||
export * from './CreateFrontendRequest';
|
export * from './CreateFrontendRequest';
|
||||||
export * from './CreateFrontendResponse';
|
export * from './CreateFrontendResponse';
|
||||||
export * from './CreateIdentity201Response';
|
export * from './CreateIdentity201Response';
|
||||||
|
Loading…
Reference in New Issue
Block a user