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

     1  // Code generated by go-swagger; DO NOT EDIT.
     2  
     3  package mono_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  	"context"
    10  
    11  	"github.com/go-openapi/errors"
    12  	"github.com/go-openapi/strfmt"
    13  	"github.com/go-openapi/swag"
    14  	"github.com/go-openapi/validate"
    15  )
    16  
    17  // BillingInformationEditable billing information editable
    18  //
    19  // swagger:model BillingInformationEditable
    20  type BillingInformationEditable struct {
    21  
    22  	// address
    23  	// Required: true
    24  	Address *AddressInfo `json:"address"`
    25  
    26  	// billing date
    27  	BillingDate *string `json:"billingDate,omitempty"`
    28  
    29  	// email
    30  	Email *string `json:"email,omitempty"`
    31  
    32  	// name
    33  	// Required: true
    34  	Name *string `json:"name"`
    35  
    36  	// stripe payment token
    37  	StripePaymentToken *string `json:"stripePaymentToken,omitempty"`
    38  }
    39  
    40  // Validate validates this billing information editable
    41  func (m *BillingInformationEditable) Validate(formats strfmt.Registry) error {
    42  	var res []error
    43  
    44  	if err := m.validateAddress(formats); err != nil {
    45  		res = append(res, err)
    46  	}
    47  
    48  	if err := m.validateName(formats); err != nil {
    49  		res = append(res, err)
    50  	}
    51  
    52  	if len(res) > 0 {
    53  		return errors.CompositeValidationError(res...)
    54  	}
    55  	return nil
    56  }
    57  
    58  func (m *BillingInformationEditable) validateAddress(formats strfmt.Registry) error {
    59  
    60  	if err := validate.Required("address", "body", m.Address); err != nil {
    61  		return err
    62  	}
    63  
    64  	if m.Address != nil {
    65  		if err := m.Address.Validate(formats); err != nil {
    66  			if ve, ok := err.(*errors.Validation); ok {
    67  				return ve.ValidateName("address")
    68  			}
    69  			return err
    70  		}
    71  	}
    72  
    73  	return nil
    74  }
    75  
    76  func (m *BillingInformationEditable) validateName(formats strfmt.Registry) error {
    77  
    78  	if err := validate.Required("name", "body", m.Name); err != nil {
    79  		return err
    80  	}
    81  
    82  	return nil
    83  }
    84  
    85  // ContextValidate validate this billing information editable based on the context it is used
    86  func (m *BillingInformationEditable) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
    87  	var res []error
    88  
    89  	if err := m.contextValidateAddress(ctx, formats); err != nil {
    90  		res = append(res, err)
    91  	}
    92  
    93  	if len(res) > 0 {
    94  		return errors.CompositeValidationError(res...)
    95  	}
    96  	return nil
    97  }
    98  
    99  func (m *BillingInformationEditable) contextValidateAddress(ctx context.Context, formats strfmt.Registry) error {
   100  
   101  	if m.Address != nil {
   102  		if err := m.Address.ContextValidate(ctx, formats); err != nil {
   103  			if ve, ok := err.(*errors.Validation); ok {
   104  				return ve.ValidateName("address")
   105  			}
   106  			return err
   107  		}
   108  	}
   109  
   110  	return nil
   111  }
   112  
   113  // MarshalBinary interface implementation
   114  func (m *BillingInformationEditable) MarshalBinary() ([]byte, error) {
   115  	if m == nil {
   116  		return nil, nil
   117  	}
   118  	return swag.WriteJSON(m)
   119  }
   120  
   121  // UnmarshalBinary interface implementation
   122  func (m *BillingInformationEditable) UnmarshalBinary(b []byte) error {
   123  	var res BillingInformationEditable
   124  	if err := swag.ReadJSON(b, &res); err != nil {
   125  		return err
   126  	}
   127  	*m = res
   128  	return nil
   129  }