From 086902806dea6956dd82951c231330d6db21561e Mon Sep 17 00:00:00 2001 From: Vernon Keenan Date: Sun, 19 Nov 2023 20:06:27 +0000 Subject: [PATCH] research service with user --- .../research_models/company_service.go | 46 ++ api/research/research_models/tenant_user.go | 99 +++ api/research/research_models/user.go | 461 +++++++++++++ api/research/research_models/user_role.go | 90 +++ api/sfgate/sfgate_models/company_service.go | 643 ++++++++++++++++++ swagger/defs/company-service.yaml | 5 + 6 files changed, 1344 insertions(+) create mode 100644 api/research/research_models/tenant_user.go create mode 100644 api/research/research_models/user.go create mode 100644 api/research/research_models/user_role.go diff --git a/api/research/research_models/company_service.go b/api/research/research_models/company_service.go index 67c771b..5083bc9 100644 --- a/api/research/research_models/company_service.go +++ b/api/research/research_models/company_service.go @@ -109,6 +109,9 @@ type CompanyService struct { // URL URL *string `json:"URL,omitempty"` + + // user + User *User `json:"User,omitempty"` } // Validate validates this company service @@ -119,6 +122,10 @@ func (m *CompanyService) Validate(formats strfmt.Registry) error { res = append(res, err) } + if err := m.validateUser(formats); err != nil { + res = append(res, err) + } + if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -151,6 +158,25 @@ func (m *CompanyService) validateIndustries(formats strfmt.Registry) error { return nil } +func (m *CompanyService) validateUser(formats strfmt.Registry) error { + if swag.IsZero(m.User) { // not required + return nil + } + + if m.User != nil { + if err := m.User.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("User") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("User") + } + return err + } + } + + return nil +} + // ContextValidate validate this company service based on the context it is used func (m *CompanyService) ContextValidate(ctx context.Context, formats strfmt.Registry) error { var res []error @@ -159,6 +185,10 @@ func (m *CompanyService) ContextValidate(ctx context.Context, formats strfmt.Reg res = append(res, err) } + if err := m.contextValidateUser(ctx, formats); err != nil { + res = append(res, err) + } + if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -185,6 +215,22 @@ func (m *CompanyService) contextValidateIndustries(ctx context.Context, formats return nil } +func (m *CompanyService) contextValidateUser(ctx context.Context, formats strfmt.Registry) error { + + if m.User != nil { + if err := m.User.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("User") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("User") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *CompanyService) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/api/research/research_models/tenant_user.go b/api/research/research_models/tenant_user.go new file mode 100644 index 0000000..46b8468 --- /dev/null +++ b/api/research/research_models/tenant_user.go @@ -0,0 +1,99 @@ +// Code generated by go-swagger; DO NOT EDIT. + +// (c) 2012-2023 by Vernon Keenan +// All rights reserved worldwide. +// Proprietary product; unlicensed use is not allowed + +package research_models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// TenantUser Relationship object that connects users to a tenant +// +// swagger:model tenantUser +type TenantUser struct { + + // The makeTenantUser access level for this User + AccessLevel *string `json:"AccessLevel,omitempty"` + + // Account ID + AccountID *string `json:"AccountID,omitempty"` + + // Auth0 User ID + Auth0UserID *string `json:"Auth0UserID,omitempty"` + + // Account Name + CompanyName *string `json:"CompanyName,omitempty"` + + // Contact ID + ContactID *string `json:"ContactID,omitempty"` + + // Account + ExternalAccount *string `json:"ExternalAccount,omitempty"` + + // Tenant active? + TenantActive *bool `json:"TenantActive,omitempty"` + + // The Tenant ID + TenantID *string `json:"TenantID,omitempty"` + + // Tenant Name + TenantName *string `json:"TenantName,omitempty"` + + // Tenant Status + TenantStatus *string `json:"TenantStatus,omitempty"` + + // Tenant type + TenantType *string `json:"TenantType,omitempty"` + + // Tenant Version + TenantVersion *string `json:"TenantVersion,omitempty"` + + // User Email Address + UserEmail *string `json:"UserEmail,omitempty"` + + // User Full Name + UserFullName *string `json:"UserFullName,omitempty"` + + // The User ID + UserID *string `json:"UserID,omitempty"` + + // Username + Username *string `json:"Username,omitempty"` +} + +// Validate validates this tenant user +func (m *TenantUser) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this tenant user based on context it is used +func (m *TenantUser) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *TenantUser) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *TenantUser) UnmarshalBinary(b []byte) error { + var res TenantUser + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/api/research/research_models/user.go b/api/research/research_models/user.go new file mode 100644 index 0000000..935bacd --- /dev/null +++ b/api/research/research_models/user.go @@ -0,0 +1,461 @@ +// Code generated by go-swagger; DO NOT EDIT. + +// (c) 2012-2023 by Vernon Keenan +// All rights reserved worldwide. +// Proprietary product; unlicensed use is not allowed + +package research_models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// User user +// +// swagger:model user +type User struct { + + // API Gateway URL + APIGatewayURL *string `json:"APIGatewayURL,omitempty"` + + // API Gateway User + APIGatewayUser *string `json:"APIGatewayUser,omitempty"` + + // API Key + APIKey *string `json:"APIKey,omitempty"` + + // About Me + AboutMe *string `json:"AboutMe,omitempty"` + + // Account ID + AccountID *string `json:"AccountID,omitempty"` + + // address + Address *UserAddress `json:"Address,omitempty"` + + // Alias + Alias *string `json:"Alias,omitempty"` + + // Auth0 User Id + Auth0UserID *string `json:"Auth0UserID,omitempty"` + + // Biography + Biography *string `json:"Biography,omitempty"` + + // Nickname + CommunityNickname *string `json:"CommunityNickname,omitempty"` + + // Company Name + CompanyName *string `json:"CompanyName,omitempty"` + + // Contact + ContactID *string `json:"ContactID,omitempty"` + + // Created User ID + CreatedByID *string `json:"CreatedByID,omitempty"` + + // Date Created + CreatedDate *string `json:"CreatedDate,omitempty"` + + // Delegated Approver + DelegatedApproverID *string `json:"DelegatedApproverID,omitempty"` + + // Department + Department *string `json:"Department,omitempty"` + + // Division + Division *string `json:"Division,omitempty"` + + // Email address + Email *string `json:"Email,omitempty"` + + // Employee Number + EmployeeNumber *string `json:"EmployeeNumber,omitempty"` + + // Time day ends + EndOfDay *string `json:"EndOfDay,omitempty"` + + // Environment + Environment *string `json:"Environment,omitempty"` + + // Extension + Extension *string `json:"Extension,omitempty"` + + // Account + ExternalAccount *string `json:"ExternalAccount,omitempty"` + + // Fax + Fax *string `json:"Fax,omitempty"` + + // The first name + FirstName *string `json:"FirstName,omitempty"` + + // Allow Forecasting + ForecastEnabled *bool `json:"ForecastEnabled,omitempty"` + + // Full Photo URL + FullPhotoURL *string `json:"FullPhotoURL,omitempty"` + + // GitHub + GitHub *string `json:"GitHub,omitempty"` + + // Record ID + ID string `json:"ID,omitempty"` + + // Active + IsActive *bool `json:"IsActive,omitempty"` + + // Is the user enabled for Communities? + IsPortalEnabled *bool `json:"IsPortalEnabled,omitempty"` + + // is system controlled + IsSystemControlled *bool `json:"IsSystemControlled,omitempty"` + + // IP address of last login + LastIP *string `json:"LastIP,omitempty"` + + // Last login time + LastLogin *string `json:"LastLogin,omitempty"` + + // Last Modified User ID + LastModifiedByID *string `json:"LastModifiedByID,omitempty"` + + // Last Modified Date + LastModifiedDate *string `json:"LastModifiedDate,omitempty"` + + // The Last Name + LastName *string `json:"LastName,omitempty"` + + // LinkedIn + LinkedIn *string `json:"LinkedIn,omitempty"` + + // Number of times user has logged in + LoginCount *int64 `json:"LoginCount,omitempty"` + + // Manager + ManagerID *string `json:"ManagerID,omitempty"` + + // Mobile + MobilePhone *string `json:"MobilePhone,omitempty"` + + // Name + Name *string `json:"Name,omitempty"` + + // Out of office message + OutOfOfficeMessage *string `json:"OutOfOfficeMessage,omitempty"` + + // Password (encrypted) + Password *string `json:"Password,omitempty"` + + // Phone + Phone *string `json:"Phone,omitempty"` + + // Portal Role Level + PortalRole *string `json:"PortalRole,omitempty"` + + // Profile + ProfileID *string `json:"ProfileID,omitempty"` + + // Login Provider + Provider *string `json:"Provider,omitempty"` + + // Info Emails + ReceivesAdminEmails *bool `json:"ReceivesAdminEmails,omitempty"` + + // Email Sender Address + SenderEmail *string `json:"SenderEmail,omitempty"` + + // Email Sender Name + SenderName *string `json:"SenderName,omitempty"` + + // Slug + Slug *string `json:"Slug,omitempty"` + + // Small Photo URL + SmallPhotoURL *string `json:"SmallPhotoURL,omitempty"` + + // The time day starts + StartOfDay *string `json:"StartOfDay,omitempty"` + + // Onboarding Status + Status *string `json:"Status,omitempty"` + + // Tenant ID associated with this user + TenantID *string `json:"TenantID,omitempty"` + + // tenant users + TenantUsers []*TenantUser `json:"TenantUsers"` + + // Time Zone + TimeZone *string `json:"TimeZone,omitempty"` + + // Title + Title *string `json:"Title,omitempty"` + + // Twitter + Twitter *string `json:"Twitter,omitempty"` + + // Role + UserRoleID *string `json:"UserRoleID,omitempty"` + + // user roles + UserRoles []*UserRole `json:"UserRoles"` + + // User Type + UserType *string `json:"UserType,omitempty"` + + // Username + Username *string `json:"Username,omitempty"` +} + +// Validate validates this user +func (m *User) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateAddress(formats); err != nil { + res = append(res, err) + } + + if err := m.validateTenantUsers(formats); err != nil { + res = append(res, err) + } + + if err := m.validateUserRoles(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *User) validateAddress(formats strfmt.Registry) error { + if swag.IsZero(m.Address) { // not required + return nil + } + + if m.Address != nil { + if err := m.Address.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Address") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("Address") + } + return err + } + } + + return nil +} + +func (m *User) validateTenantUsers(formats strfmt.Registry) error { + if swag.IsZero(m.TenantUsers) { // not required + return nil + } + + for i := 0; i < len(m.TenantUsers); i++ { + if swag.IsZero(m.TenantUsers[i]) { // not required + continue + } + + if m.TenantUsers[i] != nil { + if err := m.TenantUsers[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("TenantUsers" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("TenantUsers" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *User) validateUserRoles(formats strfmt.Registry) error { + if swag.IsZero(m.UserRoles) { // not required + return nil + } + + for i := 0; i < len(m.UserRoles); i++ { + if swag.IsZero(m.UserRoles[i]) { // not required + continue + } + + if m.UserRoles[i] != nil { + if err := m.UserRoles[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("UserRoles" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("UserRoles" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this user based on the context it is used +func (m *User) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateAddress(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateTenantUsers(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateUserRoles(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *User) contextValidateAddress(ctx context.Context, formats strfmt.Registry) error { + + if m.Address != nil { + if err := m.Address.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Address") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("Address") + } + return err + } + } + + return nil +} + +func (m *User) contextValidateTenantUsers(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.TenantUsers); i++ { + + if m.TenantUsers[i] != nil { + if err := m.TenantUsers[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("TenantUsers" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("TenantUsers" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *User) contextValidateUserRoles(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.UserRoles); i++ { + + if m.UserRoles[i] != nil { + if err := m.UserRoles[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("UserRoles" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("UserRoles" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *User) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *User) UnmarshalBinary(b []byte) error { + var res User + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} + +// UserAddress user address +// +// swagger:model UserAddress +type UserAddress struct { + + // City + City *string `json:"City,omitempty"` + + // Country full name + Country *string `json:"Country,omitempty"` + + // Country Code + CountryCode *string `json:"CountryCode,omitempty"` + + // Postal Code + PostalCode *string `json:"PostalCode,omitempty"` + + // State full name + State *string `json:"State,omitempty"` + + // State Code + StateCode *string `json:"StateCode,omitempty"` + + // Street number and name + Street *string `json:"Street,omitempty"` +} + +// Validate validates this user address +func (m *UserAddress) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this user address based on context it is used +func (m *UserAddress) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *UserAddress) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *UserAddress) UnmarshalBinary(b []byte) error { + var res UserAddress + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/api/research/research_models/user_role.go b/api/research/research_models/user_role.go new file mode 100644 index 0000000..3a5aa12 --- /dev/null +++ b/api/research/research_models/user_role.go @@ -0,0 +1,90 @@ +// Code generated by go-swagger; DO NOT EDIT. + +// (c) 2012-2023 by Vernon Keenan +// All rights reserved worldwide. +// Proprietary product; unlicensed use is not allowed + +package research_models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// UserRole Relationship object that connects user to a role +// +// swagger:model userRole +type UserRole struct { + + // Account Id + AccountID *string `json:"AccountID,omitempty"` + + // Linked role ID + Auth0RoleID *string `json:"Auth0RoleID,omitempty"` + + // Auth0 User ID + Auth0UserID *string `json:"Auth0UserID,omitempty"` + + // Company Name + CompanyName *string `json:"CompanyName,omitempty"` + + // Contact ID + ContactID *string `json:"ContactID,omitempty"` + + // Account Number + ExternalAccount *string `json:"ExternalAccount,omitempty"` + + // Role description + RoleDescription *string `json:"RoleDescription,omitempty"` + + // The Role ID + RoleID *string `json:"RoleID,omitempty"` + + // Role Name + RoleName *string `json:"RoleName,omitempty"` + + // User Email Address + UserEmail *string `json:"UserEmail,omitempty"` + + // User Full Name + UserFullName *string `json:"UserFullName,omitempty"` + + // The User ID + UserID *string `json:"UserID,omitempty"` + + // Username + Username *string `json:"Username,omitempty"` +} + +// Validate validates this user role +func (m *UserRole) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this user role based on context it is used +func (m *UserRole) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *UserRole) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *UserRole) UnmarshalBinary(b []byte) error { + var res UserRole + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/api/sfgate/sfgate_models/company_service.go b/api/sfgate/sfgate_models/company_service.go index 9d4dcdd..1770c26 100644 --- a/api/sfgate/sfgate_models/company_service.go +++ b/api/sfgate/sfgate_models/company_service.go @@ -109,6 +109,9 @@ type CompanyService struct { // URL URL *string `json:"URL,omitempty"` + + // user + User *CompanyServiceUser `json:"User,omitempty"` } // Validate validates this company service @@ -119,6 +122,10 @@ func (m *CompanyService) Validate(formats strfmt.Registry) error { res = append(res, err) } + if err := m.validateUser(formats); err != nil { + res = append(res, err) + } + if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -151,6 +158,25 @@ func (m *CompanyService) validateIndustries(formats strfmt.Registry) error { return nil } +func (m *CompanyService) validateUser(formats strfmt.Registry) error { + if swag.IsZero(m.User) { // not required + return nil + } + + if m.User != nil { + if err := m.User.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("User") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("User") + } + return err + } + } + + return nil +} + // ContextValidate validate this company service based on the context it is used func (m *CompanyService) ContextValidate(ctx context.Context, formats strfmt.Registry) error { var res []error @@ -159,6 +185,10 @@ func (m *CompanyService) ContextValidate(ctx context.Context, formats strfmt.Reg res = append(res, err) } + if err := m.contextValidateUser(ctx, formats); err != nil { + res = append(res, err) + } + if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -185,6 +215,22 @@ func (m *CompanyService) contextValidateIndustries(ctx context.Context, formats return nil } +func (m *CompanyService) contextValidateUser(ctx context.Context, formats strfmt.Registry) error { + + if m.User != nil { + if err := m.User.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("User") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("User") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *CompanyService) MarshalBinary() ([]byte, error) { if m == nil { @@ -202,3 +248,600 @@ func (m *CompanyService) UnmarshalBinary(b []byte) error { *m = res return nil } + +// CompanyServiceUser company service user +// +// swagger:model CompanyServiceUser +type CompanyServiceUser struct { + + // API Gateway URL + APIGatewayURL *string `json:"APIGatewayURL,omitempty"` + + // API Gateway User + APIGatewayUser *string `json:"APIGatewayUser,omitempty"` + + // API Key + APIKey *string `json:"APIKey,omitempty"` + + // About Me + AboutMe *string `json:"AboutMe,omitempty"` + + // Account ID + AccountID *string `json:"AccountID,omitempty"` + + // address + Address *CompanyServiceUserAddress `json:"Address,omitempty"` + + // Alias + Alias *string `json:"Alias,omitempty"` + + // Auth0 User Id + Auth0UserID *string `json:"Auth0UserID,omitempty"` + + // Biography + Biography *string `json:"Biography,omitempty"` + + // Nickname + CommunityNickname *string `json:"CommunityNickname,omitempty"` + + // Company Name + CompanyName *string `json:"CompanyName,omitempty"` + + // Contact + ContactID *string `json:"ContactID,omitempty"` + + // Created User ID + CreatedByID *string `json:"CreatedByID,omitempty"` + + // Date Created + CreatedDate *string `json:"CreatedDate,omitempty"` + + // Delegated Approver + DelegatedApproverID *string `json:"DelegatedApproverID,omitempty"` + + // Department + Department *string `json:"Department,omitempty"` + + // Division + Division *string `json:"Division,omitempty"` + + // Email address + Email *string `json:"Email,omitempty"` + + // Employee Number + EmployeeNumber *string `json:"EmployeeNumber,omitempty"` + + // Time day ends + EndOfDay *string `json:"EndOfDay,omitempty"` + + // Environment + Environment *string `json:"Environment,omitempty"` + + // Extension + Extension *string `json:"Extension,omitempty"` + + // Account + ExternalAccount *string `json:"ExternalAccount,omitempty"` + + // Fax + Fax *string `json:"Fax,omitempty"` + + // The first name + FirstName *string `json:"FirstName,omitempty"` + + // Allow Forecasting + ForecastEnabled *bool `json:"ForecastEnabled,omitempty"` + + // Full Photo URL + FullPhotoURL *string `json:"FullPhotoURL,omitempty"` + + // GitHub + GitHub *string `json:"GitHub,omitempty"` + + // Record ID + ID string `json:"ID,omitempty"` + + // Active + IsActive *bool `json:"IsActive,omitempty"` + + // Is the user enabled for Communities? + IsPortalEnabled *bool `json:"IsPortalEnabled,omitempty"` + + // is system controlled + IsSystemControlled *bool `json:"IsSystemControlled,omitempty"` + + // IP address of last login + LastIP *string `json:"LastIP,omitempty"` + + // Last login time + LastLogin *string `json:"LastLogin,omitempty"` + + // Last Modified User ID + LastModifiedByID *string `json:"LastModifiedByID,omitempty"` + + // Last Modified Date + LastModifiedDate *string `json:"LastModifiedDate,omitempty"` + + // The Last Name + LastName *string `json:"LastName,omitempty"` + + // LinkedIn + LinkedIn *string `json:"LinkedIn,omitempty"` + + // Number of times user has logged in + LoginCount *int64 `json:"LoginCount,omitempty"` + + // Manager + ManagerID *string `json:"ManagerID,omitempty"` + + // Mobile + MobilePhone *string `json:"MobilePhone,omitempty"` + + // Name + Name *string `json:"Name,omitempty"` + + // Out of office message + OutOfOfficeMessage *string `json:"OutOfOfficeMessage,omitempty"` + + // Password (encrypted) + Password *string `json:"Password,omitempty"` + + // Phone + Phone *string `json:"Phone,omitempty"` + + // Portal Role Level + PortalRole *string `json:"PortalRole,omitempty"` + + // Profile + ProfileID *string `json:"ProfileID,omitempty"` + + // Login Provider + Provider *string `json:"Provider,omitempty"` + + // Info Emails + ReceivesAdminEmails *bool `json:"ReceivesAdminEmails,omitempty"` + + // Email Sender Address + SenderEmail *string `json:"SenderEmail,omitempty"` + + // Email Sender Name + SenderName *string `json:"SenderName,omitempty"` + + // Slug + Slug *string `json:"Slug,omitempty"` + + // Small Photo URL + SmallPhotoURL *string `json:"SmallPhotoURL,omitempty"` + + // The time day starts + StartOfDay *string `json:"StartOfDay,omitempty"` + + // Onboarding Status + Status *string `json:"Status,omitempty"` + + // Tenant ID associated with this user + TenantID *string `json:"TenantID,omitempty"` + + // tenant users + TenantUsers []*CompanyServiceUserTenantUsersItems0 `json:"TenantUsers"` + + // Time Zone + TimeZone *string `json:"TimeZone,omitempty"` + + // Title + Title *string `json:"Title,omitempty"` + + // Twitter + Twitter *string `json:"Twitter,omitempty"` + + // Role + UserRoleID *string `json:"UserRoleID,omitempty"` + + // user roles + UserRoles []*CompanyServiceUserUserRolesItems0 `json:"UserRoles"` + + // User Type + UserType *string `json:"UserType,omitempty"` + + // Username + Username *string `json:"Username,omitempty"` +} + +// Validate validates this company service user +func (m *CompanyServiceUser) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateAddress(formats); err != nil { + res = append(res, err) + } + + if err := m.validateTenantUsers(formats); err != nil { + res = append(res, err) + } + + if err := m.validateUserRoles(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *CompanyServiceUser) validateAddress(formats strfmt.Registry) error { + if swag.IsZero(m.Address) { // not required + return nil + } + + if m.Address != nil { + if err := m.Address.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("User" + "." + "Address") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("User" + "." + "Address") + } + return err + } + } + + return nil +} + +func (m *CompanyServiceUser) validateTenantUsers(formats strfmt.Registry) error { + if swag.IsZero(m.TenantUsers) { // not required + return nil + } + + for i := 0; i < len(m.TenantUsers); i++ { + if swag.IsZero(m.TenantUsers[i]) { // not required + continue + } + + if m.TenantUsers[i] != nil { + if err := m.TenantUsers[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("User" + "." + "TenantUsers" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("User" + "." + "TenantUsers" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *CompanyServiceUser) validateUserRoles(formats strfmt.Registry) error { + if swag.IsZero(m.UserRoles) { // not required + return nil + } + + for i := 0; i < len(m.UserRoles); i++ { + if swag.IsZero(m.UserRoles[i]) { // not required + continue + } + + if m.UserRoles[i] != nil { + if err := m.UserRoles[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("User" + "." + "UserRoles" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("User" + "." + "UserRoles" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this company service user based on the context it is used +func (m *CompanyServiceUser) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateAddress(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateTenantUsers(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateUserRoles(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *CompanyServiceUser) contextValidateAddress(ctx context.Context, formats strfmt.Registry) error { + + if m.Address != nil { + if err := m.Address.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("User" + "." + "Address") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("User" + "." + "Address") + } + return err + } + } + + return nil +} + +func (m *CompanyServiceUser) contextValidateTenantUsers(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.TenantUsers); i++ { + + if m.TenantUsers[i] != nil { + if err := m.TenantUsers[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("User" + "." + "TenantUsers" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("User" + "." + "TenantUsers" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *CompanyServiceUser) contextValidateUserRoles(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.UserRoles); i++ { + + if m.UserRoles[i] != nil { + if err := m.UserRoles[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("User" + "." + "UserRoles" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("User" + "." + "UserRoles" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *CompanyServiceUser) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *CompanyServiceUser) UnmarshalBinary(b []byte) error { + var res CompanyServiceUser + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} + +// CompanyServiceUserAddress company service user address +// +// swagger:model CompanyServiceUserAddress +type CompanyServiceUserAddress struct { + + // City + City *string `json:"City,omitempty"` + + // Country full name + Country *string `json:"Country,omitempty"` + + // Country Code + CountryCode *string `json:"CountryCode,omitempty"` + + // Postal Code + PostalCode *string `json:"PostalCode,omitempty"` + + // State full name + State *string `json:"State,omitempty"` + + // State Code + StateCode *string `json:"StateCode,omitempty"` + + // Street number and name + Street *string `json:"Street,omitempty"` +} + +// Validate validates this company service user address +func (m *CompanyServiceUserAddress) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this company service user address based on context it is used +func (m *CompanyServiceUserAddress) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *CompanyServiceUserAddress) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *CompanyServiceUserAddress) UnmarshalBinary(b []byte) error { + var res CompanyServiceUserAddress + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} + +// CompanyServiceUserTenantUsersItems0 Relationship object that connects users to a tenant +// +// swagger:model CompanyServiceUserTenantUsersItems0 +type CompanyServiceUserTenantUsersItems0 struct { + + // The makeTenantUser access level for this User + AccessLevel *string `json:"AccessLevel,omitempty"` + + // Account ID + AccountID *string `json:"AccountID,omitempty"` + + // Auth0 User ID + Auth0UserID *string `json:"Auth0UserID,omitempty"` + + // Account Name + CompanyName *string `json:"CompanyName,omitempty"` + + // Contact ID + ContactID *string `json:"ContactID,omitempty"` + + // Account + ExternalAccount *string `json:"ExternalAccount,omitempty"` + + // Tenant active? + TenantActive *bool `json:"TenantActive,omitempty"` + + // The Tenant ID + TenantID *string `json:"TenantID,omitempty"` + + // Tenant Name + TenantName *string `json:"TenantName,omitempty"` + + // Tenant Status + TenantStatus *string `json:"TenantStatus,omitempty"` + + // Tenant type + TenantType *string `json:"TenantType,omitempty"` + + // Tenant Version + TenantVersion *string `json:"TenantVersion,omitempty"` + + // User Email Address + UserEmail *string `json:"UserEmail,omitempty"` + + // User Full Name + UserFullName *string `json:"UserFullName,omitempty"` + + // The User ID + UserID *string `json:"UserID,omitempty"` + + // Username + Username *string `json:"Username,omitempty"` +} + +// Validate validates this company service user tenant users items0 +func (m *CompanyServiceUserTenantUsersItems0) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this company service user tenant users items0 based on context it is used +func (m *CompanyServiceUserTenantUsersItems0) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *CompanyServiceUserTenantUsersItems0) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *CompanyServiceUserTenantUsersItems0) UnmarshalBinary(b []byte) error { + var res CompanyServiceUserTenantUsersItems0 + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} + +// CompanyServiceUserUserRolesItems0 Relationship object that connects user to a role +// +// swagger:model CompanyServiceUserUserRolesItems0 +type CompanyServiceUserUserRolesItems0 struct { + + // Account Id + AccountID *string `json:"AccountID,omitempty"` + + // Linked role ID + Auth0RoleID *string `json:"Auth0RoleID,omitempty"` + + // Auth0 User ID + Auth0UserID *string `json:"Auth0UserID,omitempty"` + + // Company Name + CompanyName *string `json:"CompanyName,omitempty"` + + // Contact ID + ContactID *string `json:"ContactID,omitempty"` + + // Account Number + ExternalAccount *string `json:"ExternalAccount,omitempty"` + + // Role description + RoleDescription *string `json:"RoleDescription,omitempty"` + + // The Role ID + RoleID *string `json:"RoleID,omitempty"` + + // Role Name + RoleName *string `json:"RoleName,omitempty"` + + // User Email Address + UserEmail *string `json:"UserEmail,omitempty"` + + // User Full Name + UserFullName *string `json:"UserFullName,omitempty"` + + // The User ID + UserID *string `json:"UserID,omitempty"` + + // Username + Username *string `json:"Username,omitempty"` +} + +// Validate validates this company service user user roles items0 +func (m *CompanyServiceUserUserRolesItems0) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this company service user user roles items0 based on context it is used +func (m *CompanyServiceUserUserRolesItems0) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *CompanyServiceUserUserRolesItems0) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *CompanyServiceUserUserRolesItems0) UnmarshalBinary(b []byte) error { + var res CompanyServiceUserUserRolesItems0 + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/swagger/defs/company-service.yaml b/swagger/defs/company-service.yaml index 73a13c9..ca49db5 100644 --- a/swagger/defs/company-service.yaml +++ b/swagger/defs/company-service.yaml @@ -117,4 +117,9 @@ CompanyService: description: URL type: string x-nullable: true + User: + description: User + $ref: "./user.yaml#/User" + type: object + x-nullable: true type: object