module Notion::Api::Endpoints::Blocks

Public Instance Methods

block_append_children(options = {}) click to toggle source

Creates and appends new children blocks to the parent block in the requested path using the ID specified. Returns the Block object being appended to.

Returns a 404 HTTP response if any of the following are true:

  • the ID does not exist

  • the bot doesn't have access to the block with the given ID

Returns a 400 or 429 HTTP response if the request exceeds Notion's Request limits.

@option options [id] :id

Block to get children info on.

@option options [[Object]] :children

Children blocks to append
# File lib/notion/api/endpoints/blocks.rb, line 46
def block_append_children(options = {})
  throw ArgumentError.new('Required arguments :id missing') if options[:id].nil?
  patch("blocks/#{options[:id]}/children", options)
end
block_children(options = {}) { |page| ... } click to toggle source

Returns a paginated array of Block objects contained in the block of the requested path using the ID specified.

Returns a 404 HTTP response if any of the following are true:

  • the ID does not exist

  • the bot doesn't have access to the block with the given ID

Returns a 400 or 429 HTTP response if the request exceeds Notion's Request limits.

@option options [id] :id

Block to get children info on.
# File lib/notion/api/endpoints/blocks.rb, line 19
def block_children(options = {})
  throw ArgumentError.new('Required arguments :id missing') if options[:id].nil?
  if block_given?
    Pagination::Cursor.new(self, :block_children, options).each do |page|
      yield page
    end
  else
    get("blocks/#{options[:id]}/children", options)
  end
end