Class: Moonbase::Models::Collections::FieldCreateParams::Field::FieldRelation

Inherits:
Internal::Type::BaseModel show all
Defined in:
lib/moonbase/models/collections/field_create_params.rb

Defined Under Namespace

Modules: Cardinality, RelationType Classes: AllowedCollection

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Internal::Type::BaseModel

==, #==, #[], coerce, #deconstruct_keys, #deep_to_h, dump, fields, hash, #hash, inherited, inspect, #inspect, known_fields, optional, recursively_to_h, required, #to_h, #to_json, #to_s, to_sorbet_type, #to_yaml

Methods included from Internal::Type::Converter

#coerce, coerce, #dump, dump, #inspect, inspect, meta_info, new_coerce_state, type_info

Methods included from Internal::Util::SorbetRuntimeSupport

#const_missing, #define_sorbet_constant!, #sorbet_constant_defined?, #to_sorbet_type, to_sorbet_type

Constructor Details

#initialize(id: nil, ref: nil, type: :collection) ⇒ Object

A reference to a ‘Collection` used in request bodies. Provide at least one of `id` or `ref` to identify the collection.

Parameters:

  • id (String) (defaults to: nil)

    Unique identifier of the collection.

  • ref (String) (defaults to: nil)

    The stable, machine-readable reference identifier of the collection.

  • type (Symbol, :collection) (defaults to: :collection)

    String representing the object’s type. Always ‘collection` for this object.



# File 'lib/moonbase/models/collections/field_create_params.rb', line 1703

Instance Attribute Details

#allowed_collectionsArray<Moonbase::Models::Collections::FieldCreateParams::Field::FieldRelation::AllowedCollection>

A list of collection IDs or ‘ref` values that are valid targets for this relation.



1595
1596
# File 'lib/moonbase/models/collections/field_create_params.rb', line 1595

required :allowed_collections,
-> { Moonbase::Internal::Type::ArrayOf[Moonbase::Collections::FieldCreateParams::Field::FieldRelation::AllowedCollection] }

#cardinalitySymbol, ...

Whether the field holds a single value (‘one`) or multiple values (`many`). Defaults to `one`.



1623
1624
# File 'lib/moonbase/models/collections/field_create_params.rb', line 1623

optional :cardinality,
enum: -> { Moonbase::Collections::FieldCreateParams::Field::FieldRelation::Cardinality }

#default_valuesArray<Moonbase::Models::RelationValueParam, Moonbase::Models::CurrentMember>?



1629
1630
# File 'lib/moonbase/models/collections/field_create_params.rb', line 1629

optional :default_values,
-> { Moonbase::Internal::Type::ArrayOf[union: Moonbase::RelationFieldDefaultValueParam] }

#descriptionString?

An optional description of the field’s purpose.

Returns:

  • (String, nil)


1636
# File 'lib/moonbase/models/collections/field_create_params.rb', line 1636

optional :description, String

#nameString

The human-readable name for the field.

Returns:

  • (String)


1602
# File 'lib/moonbase/models/collections/field_create_params.rb', line 1602

required :name, String

#relation_typeSymbol, Moonbase::Models::Collections::FieldCreateParams::Field::FieldRelation::RelationType

The type of relationship: ‘one_way` for simple references, or `two_way` for bidirectional relationships.



1609
1610
# File 'lib/moonbase/models/collections/field_create_params.rb', line 1609

required :relation_type,
enum: -> { Moonbase::Collections::FieldCreateParams::Field::FieldRelation::RelationType }

#requiredBoolean?

If ‘true`, items must have a value for this field. Defaults to `false`.

Returns:

  • (Boolean, nil)


1642
# File 'lib/moonbase/models/collections/field_create_params.rb', line 1642

optional :required, Moonbase::Internal::Type::Boolean

#reverse_field_nameString?

For ‘two_way` relations, the name of the reverse field created on the target collection.

Returns:

  • (String, nil)


1649
# File 'lib/moonbase/models/collections/field_create_params.rb', line 1649

optional :reverse_field_name, String

#typeSymbol, :"field/relation"

The field type. Must be ‘field/relation`.

Returns:

  • (Symbol, :"field/relation")


1616
# File 'lib/moonbase/models/collections/field_create_params.rb', line 1616

required :type, const: :"field/relation"

#uniqueBoolean?

If ‘true`, values must be unique across all items. Defaults to `false`.

Returns:

  • (Boolean, nil)


1655
# File 'lib/moonbase/models/collections/field_create_params.rb', line 1655

optional :unique, Moonbase::Internal::Type::Boolean

Class Method Details

.valuesArray<Symbol>

Returns:

  • (Array<Symbol>)


# File 'lib/moonbase/models/collections/field_create_params.rb', line 1724