github.com/kaisawind/go-swagger@v0.19.0/examples/contributed-templates/stratoscale/models/api_response.go (about)

     1  // Code generated by go-swagger; DO NOT EDIT.
     2  
     3  package models
     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  	strfmt "github.com/go-openapi/strfmt"
    10  
    11  	"github.com/go-openapi/swag"
    12  )
    13  
    14  // APIResponse is the response to an API call.
    15  type APIResponse struct {
    16  
    17  	// code
    18  	Code int32 `json:"code,omitempty"`
    19  
    20  	// message
    21  	Message string `json:"message,omitempty"`
    22  
    23  	// type
    24  	Type string `json:"type,omitempty"`
    25  }
    26  
    27  // Validate validates this Api response
    28  func (m *APIResponse) Validate(formats strfmt.Registry) error {
    29  	return nil
    30  }
    31  
    32  // MarshalBinary interface implementation
    33  func (m *APIResponse) MarshalBinary() ([]byte, error) {
    34  	if m == nil {
    35  		return nil, nil
    36  	}
    37  	return swag.WriteJSON(m)
    38  }
    39  
    40  // UnmarshalBinary interface implementation
    41  func (m *APIResponse) UnmarshalBinary(b []byte) error {
    42  	var res APIResponse
    43  	if err := swag.ReadJSON(b, &res); err != nil {
    44  		return err
    45  	}
    46  	*m = res
    47  	return nil
    48  }