<aside> 👉 Links (Property base class)

ButtonProperty

CheckboxProperty

CreatedByProperty

CreatedTimeProperty

DateProperty

EmailProperty

FilesProperty

FormulaProperty

MultiSelectProperty

LastEditedByProperty

LastEditedTimeProperty

NumberProperty

PeopleProperty

PhoneNumberProperty

Property

RelationProperty

RichTextProperty

RollupProperty

SelectProperty

StatusProperty

TitleProperty

UniqueIdProperty

UrlProperty

VerificationProperty

Notion Ruby Mapping Public API Reference

</aside>

<aside> 💡

[P] means methods for Page Property, [DB/DS] means methods for Database or DataSource Property.

</aside>

1. Instance methods

[DB/DS] add_multi_select_option(name: a_name, color: a_color) → Array<Hash>

  1. add_multi_select_option adds a multi_select option to Database / DataSource property schema.

  2. add_multi_select_option marks the property as updated and returns the updated option array.

  3. add_multi_select_option of Page property raises StandardError.

    page.properties["MultiSelectTitle"].add_multi_select_option name: "a_name", color: "green"
    # => in `assert_database_or_data_source_property': add_multi_select_option can execute only Database or DataSource property. (StandardError)
    
    ds.properties["MultiSelectTitle"].add_multi_select_option name: "a_name", color: "green"
    # => 
    # [{"id"=>"2a0eeeee-b3fd-4072-96a9-865f67cfa6ff", "name"=>"Multi Select 1", "color"=>"yellow"},
    #  {"id"=>"5f554552-b77a-474b-b5c7-4ae819966e32", "name"=>"Multi Select 2", "color"=>"default"},
    #  {"id"=>"d4bc3d6e-a6e1-4d57-af66-d8ecbbda1dd3", "name"=>"multi_select", "color"=>"red"},
    #  {"name"=>"a_name", "color"=>"green"}]
    

Filter usage

These methods return a Query; .filter in the examples reads its generated Hash. Creating a condition does not send an API request or update the property value. [DB/DS] indicates query usage, not an execution-time restriction on the method.

For contains and does_not_contain, pass a multi-select option name as a String. Omit condition: and another_type: for an ordinary multi_select filter; these optional keywords are for nested Formula / Rollup conditions. MultiSelectProperty inherits ContainsDoesNotContain and IsEmptyIsNotEmpty through MultiProperty.

[DB/DS] filter_contains(value) → Query

Creates a Query object whose multi_select condition matches properties that include the given option name.

ds.properties["MultiSelectTitle"].filter_contains("Multi Select 1").filter
# => {"property" => "MultiSelectTitle", "multi_select" => {"contains" => "Multi Select 1"}}

[DB/DS] filter_does_not_contain(value) → Query

Creates a Query object whose multi_select condition matches properties that do not include the given option name.

ds.properties["MultiSelectTitle"].filter_does_not_contain("Multi Select 1").filter
# => {"property" => "MultiSelectTitle", "multi_select" => {"does_not_contain" => "Multi Select 1"}}

[DB/DS] filter_is_empty → Query

Creates a Query object whose multi_select condition matches properties with no selected options.