Method: Utils::BlockComponents.convert_type

Defined in:
lib/notion_api/utils.rb

.convert_type(id, block_class_to_convert_to) ⇒ Object



91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# File 'lib/notion_api/utils.rb', line 91

def self.convert_type(id, block_class_to_convert_to)
  # ! payload for converting a block to a different type.
  # ! id -> id of the block to convert : ``str``
  # ! block_class_to_convert_to -> type to convert to block to: ``NotionAPI::<Block_Type>``
  table = "block"
  path = []
  command = "update"

  {
    id: id,
    table: table,
    path: path,
    command: command,
    args: {
      type: block_class_to_convert_to.notion_type,
    },
  }
end