mirror of https://github.com/vernonkeenan/lib
169 lines
4.0 KiB
Go
169 lines
4.0 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 members_models
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/go-openapi/errors"
|
|
"github.com/go-openapi/strfmt"
|
|
"github.com/go-openapi/swag/jsonutils"
|
|
"github.com/go-openapi/validate"
|
|
)
|
|
|
|
// AuthorizedClientScope authorized client scope
|
|
//
|
|
// swagger:model AuthorizedClientScope
|
|
type AuthorizedClientScope struct {
|
|
AuditFields
|
|
|
|
// authorized client Id
|
|
// Required: true
|
|
// Format: uuid
|
|
AuthorizedClientID *strfmt.UUID `json:"authorizedClientId"`
|
|
|
|
// service scope Id
|
|
// Required: true
|
|
// Format: uuid
|
|
ServiceScopeID *strfmt.UUID `json:"serviceScopeId"`
|
|
}
|
|
|
|
// UnmarshalJSON unmarshals this object from a JSON structure
|
|
func (m *AuthorizedClientScope) UnmarshalJSON(raw []byte) error {
|
|
// AO0
|
|
var aO0 AuditFields
|
|
if err := jsonutils.ReadJSON(raw, &aO0); err != nil {
|
|
return err
|
|
}
|
|
m.AuditFields = aO0
|
|
|
|
// AO1
|
|
var dataAO1 struct {
|
|
AuthorizedClientID *strfmt.UUID `json:"authorizedClientId"`
|
|
|
|
ServiceScopeID *strfmt.UUID `json:"serviceScopeId"`
|
|
}
|
|
if err := jsonutils.ReadJSON(raw, &dataAO1); err != nil {
|
|
return err
|
|
}
|
|
|
|
m.AuthorizedClientID = dataAO1.AuthorizedClientID
|
|
|
|
m.ServiceScopeID = dataAO1.ServiceScopeID
|
|
|
|
return nil
|
|
}
|
|
|
|
// MarshalJSON marshals this object to a JSON structure
|
|
func (m AuthorizedClientScope) MarshalJSON() ([]byte, error) {
|
|
_parts := make([][]byte, 0, 2)
|
|
|
|
aO0, err := jsonutils.WriteJSON(m.AuditFields)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
_parts = append(_parts, aO0)
|
|
var dataAO1 struct {
|
|
AuthorizedClientID *strfmt.UUID `json:"authorizedClientId"`
|
|
|
|
ServiceScopeID *strfmt.UUID `json:"serviceScopeId"`
|
|
}
|
|
|
|
dataAO1.AuthorizedClientID = m.AuthorizedClientID
|
|
|
|
dataAO1.ServiceScopeID = m.ServiceScopeID
|
|
|
|
jsonDataAO1, errAO1 := jsonutils.WriteJSON(dataAO1)
|
|
if errAO1 != nil {
|
|
return nil, errAO1
|
|
}
|
|
_parts = append(_parts, jsonDataAO1)
|
|
return jsonutils.ConcatJSON(_parts...), nil
|
|
}
|
|
|
|
// Validate validates this authorized client scope
|
|
func (m *AuthorizedClientScope) Validate(formats strfmt.Registry) error {
|
|
var res []error
|
|
|
|
// validation for a type composition with AuditFields
|
|
if err := m.AuditFields.Validate(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.validateAuthorizedClientID(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.validateServiceScopeID(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if len(res) > 0 {
|
|
return errors.CompositeValidationError(res...)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (m *AuthorizedClientScope) validateAuthorizedClientID(formats strfmt.Registry) error {
|
|
|
|
if err := validate.Required("authorizedClientId", "body", m.AuthorizedClientID); err != nil {
|
|
return err
|
|
}
|
|
|
|
if err := validate.FormatOf("authorizedClientId", "body", "uuid", m.AuthorizedClientID.String(), formats); err != nil {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (m *AuthorizedClientScope) validateServiceScopeID(formats strfmt.Registry) error {
|
|
|
|
if err := validate.Required("serviceScopeId", "body", m.ServiceScopeID); err != nil {
|
|
return err
|
|
}
|
|
|
|
if err := validate.FormatOf("serviceScopeId", "body", "uuid", m.ServiceScopeID.String(), formats); err != nil {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// ContextValidate validate this authorized client scope based on the context it is used
|
|
func (m *AuthorizedClientScope) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
|
var res []error
|
|
|
|
// validation for a type composition with AuditFields
|
|
if err := m.AuditFields.ContextValidate(ctx, formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if len(res) > 0 {
|
|
return errors.CompositeValidationError(res...)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// MarshalBinary interface implementation
|
|
func (m *AuthorizedClientScope) MarshalBinary() ([]byte, error) {
|
|
if m == nil {
|
|
return nil, nil
|
|
}
|
|
return jsonutils.WriteJSON(m)
|
|
}
|
|
|
|
// UnmarshalBinary interface implementation
|
|
func (m *AuthorizedClientScope) UnmarshalBinary(b []byte) error {
|
|
var res AuthorizedClientScope
|
|
if err := jsonutils.ReadJSON(b, &res); err != nil {
|
|
return err
|
|
}
|
|
*m = res
|
|
return nil
|
|
}
|