/* * Solidarity Mobility API * * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * API version: 1.0.0 * Generated by: OpenAPI Generator (https://openapi-generator.tech) */ package openapi import ( "errors" ) type User struct { // User's identifier. It MUST be unique for a given `operator`. Id string `json:"id"` // The operator identifier. MUST be a Fully Qualified Domain Name (example carpool.mycity.com) owned by the operator or a Partially Qualified Domain Name (example operator.org) owned and exclusively operated by the operator. Operators SHOULD always send the same value. Operator string `json:"operator"` // User's alias. Alias string `json:"alias"` // User's first name. FirstName string `json:"firstName,omitempty"` // User's last name. LastName string `json:"lastName,omitempty"` // User's grade from 1 to 5. Grade int32 `json:"grade,omitempty"` // User's profile picture absolute URL. Picture string `json:"picture,omitempty"` // User's gender. 'O' stands for 'Other'. Gender string `json:"gender,omitempty"` // true if the identity of this user has been verified by the operator or a third party; and the firstName, lastName, birthdate have been confirmed as identitical to an official identity proof document. Can be left empty if the information is not available. VerifiedIdentity bool `json:"verifiedIdentity,omitempty"` } // AssertUserRequired checks if the required fields are not zero-ed func AssertUserRequired(obj User) error { elements := map[string]interface{}{ "id": obj.Id, "operator": obj.Operator, "alias": obj.Alias, } for name, el := range elements { if isZero := IsZeroValue(el); isZero { return &RequiredError{Field: name} } } return nil } // AssertUserConstraints checks if the values respects the defined constraints func AssertUserConstraints(obj User) error { if obj.Grade < 1 { return &ParsingError{Err: errors.New(errMsgMinValueConstraint)} } if obj.Grade > 5 { return &ParsingError{Err: errors.New(errMsgMaxValueConstraint)} } return nil }