80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
|
# File 'lib/notion_api/notion_types/collection_view_blocks.rb', line 80
def add_property(name, type)
cookies = Core.options["cookies"]
= Core.options["headers"]
request_id = (SecureRandom.hex(16))
transaction_id = (SecureRandom.hex(16))
space_id = (SecureRandom.hex(16))
request_ids = {
request_id: request_id,
transaction_id: transaction_id,
space_id: space_id,
}
schema = (@collection_id, @view_id)
schema[name] = {
name: name,
type: type,
}
new_schema = {
schema: schema,
}
add_collection_property = Utils::CollectionViewComponents.add_collection_property(@collection_id, new_schema)
operations = [
add_collection_property,
]
request_url = URLS[:UPDATE_BLOCK]
request_body = build_payload(operations, request_ids)
response = HTTParty.post(
request_url,
body: request_body.to_json,
cookies: cookies,
headers: ,
)
unless response.code == 200; raise "There was an issue completing your request. Here is the response from Notion: #{response.body}, and here is the payload that was sent: #{operations}.
Please try again, and if issues persist open an issue in GitHub."; end
true
end
|