github.com/ActiveState/cli@v0.0.0-20240508170324-6801f60cd051/pkg/platform/api/mono/mono_client/users/search_emails_responses.go (about)

     1  // Code generated by go-swagger; DO NOT EDIT.
     2  
     3  package users
     4  
     5  // This file was generated by the swagger tool.
     6  // Editing this file might prove futile when you re-run the swagger generate command
     7  
     8  import (
     9  	"context"
    10  	"fmt"
    11  	"io"
    12  
    13  	"github.com/go-openapi/runtime"
    14  	"github.com/go-openapi/strfmt"
    15  	"github.com/go-openapi/swag"
    16  
    17  	"github.com/ActiveState/cli/pkg/platform/api/mono/mono_models"
    18  )
    19  
    20  // SearchEmailsReader is a Reader for the SearchEmails structure.
    21  type SearchEmailsReader struct {
    22  	formats strfmt.Registry
    23  }
    24  
    25  // ReadResponse reads a server response into the received o.
    26  func (o *SearchEmailsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
    27  	switch response.Code() {
    28  	case 200:
    29  		result := NewSearchEmailsOK()
    30  		if err := result.readResponse(response, consumer, o.formats); err != nil {
    31  			return nil, err
    32  		}
    33  		return result, nil
    34  	case 403:
    35  		result := NewSearchEmailsForbidden()
    36  		if err := result.readResponse(response, consumer, o.formats); err != nil {
    37  			return nil, err
    38  		}
    39  		return nil, result
    40  	case 500:
    41  		result := NewSearchEmailsInternalServerError()
    42  		if err := result.readResponse(response, consumer, o.formats); err != nil {
    43  			return nil, err
    44  		}
    45  		return nil, result
    46  	default:
    47  		return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
    48  	}
    49  }
    50  
    51  // NewSearchEmailsOK creates a SearchEmailsOK with default headers values
    52  func NewSearchEmailsOK() *SearchEmailsOK {
    53  	return &SearchEmailsOK{}
    54  }
    55  
    56  /* SearchEmailsOK describes a response with status code 200, with default header values.
    57  
    58  Search for users matching the given search string
    59  */
    60  type SearchEmailsOK struct {
    61  	Payload []*mono_models.User
    62  }
    63  
    64  func (o *SearchEmailsOK) Error() string {
    65  	return fmt.Sprintf("[POST /users/search_emails][%d] searchEmailsOK  %+v", 200, o.Payload)
    66  }
    67  func (o *SearchEmailsOK) GetPayload() []*mono_models.User {
    68  	return o.Payload
    69  }
    70  
    71  func (o *SearchEmailsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
    72  
    73  	// response payload
    74  	if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
    75  		return err
    76  	}
    77  
    78  	return nil
    79  }
    80  
    81  // NewSearchEmailsForbidden creates a SearchEmailsForbidden with default headers values
    82  func NewSearchEmailsForbidden() *SearchEmailsForbidden {
    83  	return &SearchEmailsForbidden{}
    84  }
    85  
    86  /* SearchEmailsForbidden describes a response with status code 403, with default header values.
    87  
    88  Forbidden
    89  */
    90  type SearchEmailsForbidden struct {
    91  	Payload *mono_models.Message
    92  }
    93  
    94  func (o *SearchEmailsForbidden) Error() string {
    95  	return fmt.Sprintf("[POST /users/search_emails][%d] searchEmailsForbidden  %+v", 403, o.Payload)
    96  }
    97  func (o *SearchEmailsForbidden) GetPayload() *mono_models.Message {
    98  	return o.Payload
    99  }
   100  
   101  func (o *SearchEmailsForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
   102  
   103  	o.Payload = new(mono_models.Message)
   104  
   105  	// response payload
   106  	if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
   107  		return err
   108  	}
   109  
   110  	return nil
   111  }
   112  
   113  // NewSearchEmailsInternalServerError creates a SearchEmailsInternalServerError with default headers values
   114  func NewSearchEmailsInternalServerError() *SearchEmailsInternalServerError {
   115  	return &SearchEmailsInternalServerError{}
   116  }
   117  
   118  /* SearchEmailsInternalServerError describes a response with status code 500, with default header values.
   119  
   120  Server Error
   121  */
   122  type SearchEmailsInternalServerError struct {
   123  	Payload *mono_models.Message
   124  }
   125  
   126  func (o *SearchEmailsInternalServerError) Error() string {
   127  	return fmt.Sprintf("[POST /users/search_emails][%d] searchEmailsInternalServerError  %+v", 500, o.Payload)
   128  }
   129  func (o *SearchEmailsInternalServerError) GetPayload() *mono_models.Message {
   130  	return o.Payload
   131  }
   132  
   133  func (o *SearchEmailsInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
   134  
   135  	o.Payload = new(mono_models.Message)
   136  
   137  	// response payload
   138  	if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
   139  		return err
   140  	}
   141  
   142  	return nil
   143  }
   144  
   145  /*SearchEmailsBody search emails body
   146  swagger:model SearchEmailsBody
   147  */
   148  type SearchEmailsBody struct {
   149  
   150  	// The search query
   151  	Query string `json:"query,omitempty"`
   152  }
   153  
   154  // Validate validates this search emails body
   155  func (o *SearchEmailsBody) Validate(formats strfmt.Registry) error {
   156  	return nil
   157  }
   158  
   159  // ContextValidate validates this search emails body based on context it is used
   160  func (o *SearchEmailsBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
   161  	return nil
   162  }
   163  
   164  // MarshalBinary interface implementation
   165  func (o *SearchEmailsBody) MarshalBinary() ([]byte, error) {
   166  	if o == nil {
   167  		return nil, nil
   168  	}
   169  	return swag.WriteJSON(o)
   170  }
   171  
   172  // UnmarshalBinary interface implementation
   173  func (o *SearchEmailsBody) UnmarshalBinary(b []byte) error {
   174  	var res SearchEmailsBody
   175  	if err := swag.ReadJSON(b, &res); err != nil {
   176  		return err
   177  	}
   178  	*o = res
   179  	return nil
   180  }