lib/api/members/members_client/sessions/create_handoff_responses.go

545 lines
16 KiB
Go

// Code generated by go-swagger; DO NOT EDIT.
// (c) 2012-2020 by Taxnexus, Inc.
// All rights reserved worldwide.
// Proprietary product; unlicensed use is not allowed
package sessions
import (
"context"
"encoding/json"
stderrors "errors"
"fmt"
"io"
"code.tnxs.net/vernonkeenan/lib/api/members/members_models"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag/jsonutils"
"github.com/go-openapi/swag/typeutils"
"github.com/go-openapi/validate"
)
// CreateHandoffReader is a Reader for the CreateHandoff structure.
type CreateHandoffReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *CreateHandoffReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
switch response.Code() {
case 200:
result := NewCreateHandoffOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 400:
result := NewCreateHandoffBadRequest()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 401:
result := NewCreateHandoffUnauthorized()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 403:
result := NewCreateHandoffForbidden()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 500:
result := NewCreateHandoffInternalServerError()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
default:
return nil, runtime.NewAPIError("[POST /sessions/handoff/create] createHandoff", response, response.Code())
}
}
// NewCreateHandoffOK creates a CreateHandoffOK with default headers values
func NewCreateHandoffOK() *CreateHandoffOK {
return &CreateHandoffOK{}
}
// CreateHandoffOK describes a response with status code 200, with default header values.
//
// Handoff token created successfully
type CreateHandoffOK struct {
Payload *CreateHandoffOKBody
}
// IsSuccess returns true when this create handoff o k response has a 2xx status code
func (o *CreateHandoffOK) IsSuccess() bool {
return true
}
// IsRedirect returns true when this create handoff o k response has a 3xx status code
func (o *CreateHandoffOK) IsRedirect() bool {
return false
}
// IsClientError returns true when this create handoff o k response has a 4xx status code
func (o *CreateHandoffOK) IsClientError() bool {
return false
}
// IsServerError returns true when this create handoff o k response has a 5xx status code
func (o *CreateHandoffOK) IsServerError() bool {
return false
}
// IsCode returns true when this create handoff o k response a status code equal to that given
func (o *CreateHandoffOK) IsCode(code int) bool {
return code == 200
}
// Code gets the status code for the create handoff o k response
func (o *CreateHandoffOK) Code() int {
return 200
}
func (o *CreateHandoffOK) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /sessions/handoff/create][%d] createHandoffOK %s", 200, payload)
}
func (o *CreateHandoffOK) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /sessions/handoff/create][%d] createHandoffOK %s", 200, payload)
}
func (o *CreateHandoffOK) GetPayload() *CreateHandoffOKBody {
return o.Payload
}
func (o *CreateHandoffOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(CreateHandoffOKBody)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
return nil
}
// NewCreateHandoffBadRequest creates a CreateHandoffBadRequest with default headers values
func NewCreateHandoffBadRequest() *CreateHandoffBadRequest {
return &CreateHandoffBadRequest{}
}
// CreateHandoffBadRequest describes a response with status code 400, with default header values.
//
// Invalid request parameters
type CreateHandoffBadRequest struct {
Payload *members_models.Error
}
// IsSuccess returns true when this create handoff bad request response has a 2xx status code
func (o *CreateHandoffBadRequest) IsSuccess() bool {
return false
}
// IsRedirect returns true when this create handoff bad request response has a 3xx status code
func (o *CreateHandoffBadRequest) IsRedirect() bool {
return false
}
// IsClientError returns true when this create handoff bad request response has a 4xx status code
func (o *CreateHandoffBadRequest) IsClientError() bool {
return true
}
// IsServerError returns true when this create handoff bad request response has a 5xx status code
func (o *CreateHandoffBadRequest) IsServerError() bool {
return false
}
// IsCode returns true when this create handoff bad request response a status code equal to that given
func (o *CreateHandoffBadRequest) IsCode(code int) bool {
return code == 400
}
// Code gets the status code for the create handoff bad request response
func (o *CreateHandoffBadRequest) Code() int {
return 400
}
func (o *CreateHandoffBadRequest) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /sessions/handoff/create][%d] createHandoffBadRequest %s", 400, payload)
}
func (o *CreateHandoffBadRequest) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /sessions/handoff/create][%d] createHandoffBadRequest %s", 400, payload)
}
func (o *CreateHandoffBadRequest) GetPayload() *members_models.Error {
return o.Payload
}
func (o *CreateHandoffBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(members_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
return nil
}
// NewCreateHandoffUnauthorized creates a CreateHandoffUnauthorized with default headers values
func NewCreateHandoffUnauthorized() *CreateHandoffUnauthorized {
return &CreateHandoffUnauthorized{}
}
// CreateHandoffUnauthorized describes a response with status code 401, with default header values.
//
// Access Unauthorized, invalid API-KEY was used
type CreateHandoffUnauthorized struct {
Payload *members_models.Error
}
// IsSuccess returns true when this create handoff unauthorized response has a 2xx status code
func (o *CreateHandoffUnauthorized) IsSuccess() bool {
return false
}
// IsRedirect returns true when this create handoff unauthorized response has a 3xx status code
func (o *CreateHandoffUnauthorized) IsRedirect() bool {
return false
}
// IsClientError returns true when this create handoff unauthorized response has a 4xx status code
func (o *CreateHandoffUnauthorized) IsClientError() bool {
return true
}
// IsServerError returns true when this create handoff unauthorized response has a 5xx status code
func (o *CreateHandoffUnauthorized) IsServerError() bool {
return false
}
// IsCode returns true when this create handoff unauthorized response a status code equal to that given
func (o *CreateHandoffUnauthorized) IsCode(code int) bool {
return code == 401
}
// Code gets the status code for the create handoff unauthorized response
func (o *CreateHandoffUnauthorized) Code() int {
return 401
}
func (o *CreateHandoffUnauthorized) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /sessions/handoff/create][%d] createHandoffUnauthorized %s", 401, payload)
}
func (o *CreateHandoffUnauthorized) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /sessions/handoff/create][%d] createHandoffUnauthorized %s", 401, payload)
}
func (o *CreateHandoffUnauthorized) GetPayload() *members_models.Error {
return o.Payload
}
func (o *CreateHandoffUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(members_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
return nil
}
// NewCreateHandoffForbidden creates a CreateHandoffForbidden with default headers values
func NewCreateHandoffForbidden() *CreateHandoffForbidden {
return &CreateHandoffForbidden{}
}
// CreateHandoffForbidden describes a response with status code 403, with default header values.
//
// Domain not allowed
type CreateHandoffForbidden struct {
Payload *members_models.Error
}
// IsSuccess returns true when this create handoff forbidden response has a 2xx status code
func (o *CreateHandoffForbidden) IsSuccess() bool {
return false
}
// IsRedirect returns true when this create handoff forbidden response has a 3xx status code
func (o *CreateHandoffForbidden) IsRedirect() bool {
return false
}
// IsClientError returns true when this create handoff forbidden response has a 4xx status code
func (o *CreateHandoffForbidden) IsClientError() bool {
return true
}
// IsServerError returns true when this create handoff forbidden response has a 5xx status code
func (o *CreateHandoffForbidden) IsServerError() bool {
return false
}
// IsCode returns true when this create handoff forbidden response a status code equal to that given
func (o *CreateHandoffForbidden) IsCode(code int) bool {
return code == 403
}
// Code gets the status code for the create handoff forbidden response
func (o *CreateHandoffForbidden) Code() int {
return 403
}
func (o *CreateHandoffForbidden) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /sessions/handoff/create][%d] createHandoffForbidden %s", 403, payload)
}
func (o *CreateHandoffForbidden) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /sessions/handoff/create][%d] createHandoffForbidden %s", 403, payload)
}
func (o *CreateHandoffForbidden) GetPayload() *members_models.Error {
return o.Payload
}
func (o *CreateHandoffForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(members_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
return nil
}
// NewCreateHandoffInternalServerError creates a CreateHandoffInternalServerError with default headers values
func NewCreateHandoffInternalServerError() *CreateHandoffInternalServerError {
return &CreateHandoffInternalServerError{}
}
// CreateHandoffInternalServerError describes a response with status code 500, with default header values.
//
// Server Internal Error
type CreateHandoffInternalServerError struct {
Payload *members_models.Error
}
// IsSuccess returns true when this create handoff internal server error response has a 2xx status code
func (o *CreateHandoffInternalServerError) IsSuccess() bool {
return false
}
// IsRedirect returns true when this create handoff internal server error response has a 3xx status code
func (o *CreateHandoffInternalServerError) IsRedirect() bool {
return false
}
// IsClientError returns true when this create handoff internal server error response has a 4xx status code
func (o *CreateHandoffInternalServerError) IsClientError() bool {
return false
}
// IsServerError returns true when this create handoff internal server error response has a 5xx status code
func (o *CreateHandoffInternalServerError) IsServerError() bool {
return true
}
// IsCode returns true when this create handoff internal server error response a status code equal to that given
func (o *CreateHandoffInternalServerError) IsCode(code int) bool {
return code == 500
}
// Code gets the status code for the create handoff internal server error response
func (o *CreateHandoffInternalServerError) Code() int {
return 500
}
func (o *CreateHandoffInternalServerError) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /sessions/handoff/create][%d] createHandoffInternalServerError %s", 500, payload)
}
func (o *CreateHandoffInternalServerError) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /sessions/handoff/create][%d] createHandoffInternalServerError %s", 500, payload)
}
func (o *CreateHandoffInternalServerError) GetPayload() *members_models.Error {
return o.Payload
}
func (o *CreateHandoffInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(members_models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
return nil
}
// CreateHandoffBody create handoff body
//
// swagger:model CreateHandoffBody
type CreateHandoffBody struct {
// CSRF state parameter
// Example: random-csrf-token-123
// Required: true
State *string `json:"state"`
// Target domain for handoff
// Example: salesforcedevops.net
// Required: true
TargetDomain *string `json:"target_domain"`
}
// Validate validates this create handoff body
func (o *CreateHandoffBody) Validate(formats strfmt.Registry) error {
var res []error
if err := o.validateState(formats); err != nil {
res = append(res, err)
}
if err := o.validateTargetDomain(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (o *CreateHandoffBody) validateState(formats strfmt.Registry) error {
if err := validate.Required("handoffRequest"+"."+"state", "body", o.State); err != nil {
return err
}
return nil
}
func (o *CreateHandoffBody) validateTargetDomain(formats strfmt.Registry) error {
if err := validate.Required("handoffRequest"+"."+"target_domain", "body", o.TargetDomain); err != nil {
return err
}
return nil
}
// ContextValidate validates this create handoff body based on context it is used
func (o *CreateHandoffBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
return nil
}
// MarshalBinary interface implementation
func (o *CreateHandoffBody) MarshalBinary() ([]byte, error) {
if o == nil {
return nil, nil
}
return jsonutils.WriteJSON(o)
}
// UnmarshalBinary interface implementation
func (o *CreateHandoffBody) UnmarshalBinary(b []byte) error {
var res CreateHandoffBody
if err := jsonutils.ReadJSON(b, &res); err != nil {
return err
}
*o = res
return nil
}
// CreateHandoffOKBody create handoff o k body
//
// swagger:model CreateHandoffOKBody
type CreateHandoffOKBody struct {
// Token expiration time
// Format: date-time
ExpiresAt strfmt.DateTime `json:"expires_at,omitempty"`
// One-time handoff token
// Example: hoff_1234567890abcdef
HandoffToken string `json:"handoff_token,omitempty"`
}
// Validate validates this create handoff o k body
func (o *CreateHandoffOKBody) Validate(formats strfmt.Registry) error {
var res []error
if err := o.validateExpiresAt(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (o *CreateHandoffOKBody) validateExpiresAt(formats strfmt.Registry) error {
if typeutils.IsZero(o.ExpiresAt) { // not required
return nil
}
if err := validate.FormatOf("createHandoffOK"+"."+"expires_at", "body", "date-time", o.ExpiresAt.String(), formats); err != nil {
return err
}
return nil
}
// ContextValidate validates this create handoff o k body based on context it is used
func (o *CreateHandoffOKBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
return nil
}
// MarshalBinary interface implementation
func (o *CreateHandoffOKBody) MarshalBinary() ([]byte, error) {
if o == nil {
return nil, nil
}
return jsonutils.WriteJSON(o)
}
// UnmarshalBinary interface implementation
func (o *CreateHandoffOKBody) UnmarshalBinary(b []byte) error {
var res CreateHandoffOKBody
if err := jsonutils.ReadJSON(b, &res); err != nil {
return err
}
*o = res
return nil
}