Module: Utils
- Included in:
- NotionAPI::BlockTemplate, NotionAPI::Core
- Defined in:
- lib/notion_api/utils.rb
Defined Under Namespace
Classes: BlockComponents, CollectionViewComponents, SchemaTypeError
Constant Summary collapse
- URLS =
! defines utility functions and static variables for this application.
{ GET_BLOCK: "https://www.notion.so/api/v3/loadPageChunk", UPDATE_BLOCK: "https://www.notion.so/api/v3/saveTransactions", GET_COLLECTION: "https://www.notion.so/api/v3/queryCollection", }.freeze
Instance Method Summary collapse
Instance Method Details
#build_payload(operations, request_ids) ⇒ Object
682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 |
# File 'lib/notion_api/utils.rb', line 682 def build_payload(operations, request_ids) # ! properly formats the payload for Notions backend. # ! operations -> an array of hashes that define the operations to perform : ``Array[Hash]`` # ! request_ids -> the unique IDs for the request : ``str`` request_id = request_ids[:request_id] transaction_id = request_ids[:transaction_id] space_id = request_ids[:space_id] payload = { requestId: request_id, transactions: [ { id: transaction_id, shardId: 955_090, spaceId: space_id, operations: operations, }, ], } payload end |