monday_ruby 1.0.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.env +1 -1
- data/.rspec +0 -1
- data/.rubocop.yml +19 -0
- data/.simplecov +1 -0
- data/CHANGELOG.md +49 -0
- data/CONTRIBUTING.md +165 -0
- data/README.md +167 -88
- data/docs/.vitepress/config.mjs +255 -0
- data/docs/.vitepress/theme/index.js +4 -0
- data/docs/.vitepress/theme/style.css +43 -0
- data/docs/README.md +80 -0
- data/docs/explanation/architecture.md +507 -0
- data/docs/explanation/best-practices/errors.md +478 -0
- data/docs/explanation/best-practices/performance.md +1084 -0
- data/docs/explanation/best-practices/rate-limiting.md +630 -0
- data/docs/explanation/best-practices/testing.md +820 -0
- data/docs/explanation/column-values.md +857 -0
- data/docs/explanation/design.md +795 -0
- data/docs/explanation/graphql.md +356 -0
- data/docs/explanation/migration/v1.md +808 -0
- data/docs/explanation/pagination.md +447 -0
- data/docs/guides/advanced/batch.md +1274 -0
- data/docs/guides/advanced/complex-queries.md +1114 -0
- data/docs/guides/advanced/errors.md +818 -0
- data/docs/guides/advanced/pagination.md +934 -0
- data/docs/guides/advanced/rate-limiting.md +981 -0
- data/docs/guides/authentication.md +286 -0
- data/docs/guides/boards/create.md +386 -0
- data/docs/guides/boards/delete.md +405 -0
- data/docs/guides/boards/duplicate.md +511 -0
- data/docs/guides/boards/query.md +530 -0
- data/docs/guides/boards/update.md +453 -0
- data/docs/guides/columns/create.md +452 -0
- data/docs/guides/columns/metadata.md +492 -0
- data/docs/guides/columns/query.md +455 -0
- data/docs/guides/columns/update-multiple.md +459 -0
- data/docs/guides/columns/update-values.md +509 -0
- data/docs/guides/files/add-to-column.md +40 -0
- data/docs/guides/files/add-to-update.md +37 -0
- data/docs/guides/files/clear-column.md +33 -0
- data/docs/guides/first-request.md +285 -0
- data/docs/guides/folders/manage.md +750 -0
- data/docs/guides/groups/items.md +626 -0
- data/docs/guides/groups/manage.md +501 -0
- data/docs/guides/installation.md +169 -0
- data/docs/guides/items/create.md +493 -0
- data/docs/guides/items/delete.md +514 -0
- data/docs/guides/items/query.md +605 -0
- data/docs/guides/items/subitems.md +483 -0
- data/docs/guides/items/update.md +699 -0
- data/docs/guides/updates/manage.md +619 -0
- data/docs/guides/use-cases/dashboard.md +1421 -0
- data/docs/guides/use-cases/import.md +1962 -0
- data/docs/guides/use-cases/task-management.md +1381 -0
- data/docs/guides/workspaces/manage.md +502 -0
- data/docs/index.md +69 -0
- data/docs/package-lock.json +2468 -0
- data/docs/package.json +13 -0
- data/docs/reference/client.md +540 -0
- data/docs/reference/configuration.md +586 -0
- data/docs/reference/errors.md +693 -0
- data/docs/reference/resources/account.md +208 -0
- data/docs/reference/resources/activity-log.md +369 -0
- data/docs/reference/resources/board-view.md +359 -0
- data/docs/reference/resources/board.md +393 -0
- data/docs/reference/resources/column.md +543 -0
- data/docs/reference/resources/file.md +236 -0
- data/docs/reference/resources/folder.md +386 -0
- data/docs/reference/resources/group.md +507 -0
- data/docs/reference/resources/item.md +348 -0
- data/docs/reference/resources/subitem.md +267 -0
- data/docs/reference/resources/update.md +259 -0
- data/docs/reference/resources/workspace.md +213 -0
- data/docs/reference/response.md +560 -0
- data/docs/tutorial/first-integration.md +713 -0
- data/lib/monday/client.rb +41 -2
- data/lib/monday/configuration.rb +13 -0
- data/lib/monday/deprecation.rb +23 -0
- data/lib/monday/error.rb +5 -2
- data/lib/monday/request.rb +19 -1
- data/lib/monday/resources/base.rb +4 -0
- data/lib/monday/resources/board.rb +52 -0
- data/lib/monday/resources/column.rb +6 -0
- data/lib/monday/resources/file.rb +56 -0
- data/lib/monday/resources/folder.rb +55 -0
- data/lib/monday/resources/group.rb +66 -0
- data/lib/monday/resources/item.rb +62 -0
- data/lib/monday/util.rb +33 -1
- data/lib/monday/version.rb +1 -1
- data/lib/monday_ruby.rb +1 -0
- metadata +92 -11
- data/monday_ruby.gemspec +0 -39
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
# Add Files (Assets)
|
|
2
|
+
|
|
3
|
+
Add files to board Columns and Updates (comments) via the `client.file` resource.
|
|
4
|
+
|
|
5
|
+
::: tip <span style="display: inline-flex; align-items: center; gap: 6px;"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"></circle><line x1="12" y1="16" x2="12" y2="12"></line><line x1="12" y1="8" x2="12.01" y2="8"></line></svg>What are Columns?</span>
|
|
6
|
+
Files can be added to a Column or an item Update (Comments).
|
|
7
|
+
:::
|
|
8
|
+
|
|
9
|
+
## Methods
|
|
10
|
+
|
|
11
|
+
### add_file_to_column
|
|
12
|
+
|
|
13
|
+
Adds a file to a column on a board.
|
|
14
|
+
|
|
15
|
+
```ruby
|
|
16
|
+
client.file.add_file_to_column(args: {}, select: ["id"])
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
**Parameters:**
|
|
20
|
+
|
|
21
|
+
| Name | Type | Default | Description |
|
|
22
|
+
|------|------|---------|-------------|
|
|
23
|
+
| `args` | Hash | `{}` | Creation arguments (required) |
|
|
24
|
+
| `select` | Array | `["id", "title", "description"]` | Fields to retrieve |
|
|
25
|
+
|
|
26
|
+
**Required args:**
|
|
27
|
+
- `item_id` - Integer - Item ID
|
|
28
|
+
- `column_id` - String - Column ID
|
|
29
|
+
- `file` - File - File to be added to the column.
|
|
30
|
+
|
|
31
|
+
**Optional args:**
|
|
32
|
+
- `defaults` - String (JSON) - Default column settings
|
|
33
|
+
|
|
34
|
+
**Returns:** `Monday::Response`
|
|
35
|
+
|
|
36
|
+
**Note**
|
|
37
|
+
- `UploadIO` is from the multipart-post gem that is included.
|
|
38
|
+
|
|
39
|
+
**Example:**
|
|
40
|
+
|
|
41
|
+
```ruby
|
|
42
|
+
// UploadIO is from the multipart-post gem that is included.
|
|
43
|
+
response = client.file.add_file_to_column(args: {
|
|
44
|
+
item_id: 1234567890,
|
|
45
|
+
column_id: 'file_mkxsq27k',
|
|
46
|
+
file: UploadIO.new(
|
|
47
|
+
File.open('/path/to/polarBear.jpg'),
|
|
48
|
+
'image/jpeg',
|
|
49
|
+
'polarBear.jpg'
|
|
50
|
+
)
|
|
51
|
+
})
|
|
52
|
+
|
|
53
|
+
if response.success?
|
|
54
|
+
monday_file_id = response.body.dig("data", "add_file_to_column", "id")
|
|
55
|
+
puts "Added file #{monday_file_id} to column"
|
|
56
|
+
end
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
**GraphQL:** `mutation { add_file_to_column { ... } }`
|
|
60
|
+
|
|
61
|
+
**See:** [monday.com add_file_to_column](https://developer.monday.com/api-reference/reference/assets-1#add-file-to-column)
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
### add_file_to_update
|
|
65
|
+
|
|
66
|
+
Adds a file to an item's Update (comments).
|
|
67
|
+
|
|
68
|
+
```ruby
|
|
69
|
+
client.file.add_file_to_update(args: {}, select: ["id"])
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
**Parameters:**
|
|
73
|
+
|
|
74
|
+
| Name | Type | Default | Description |
|
|
75
|
+
|------|------|---------|-------------|
|
|
76
|
+
| `args` | Hash | `{}` | Creation arguments (required) |
|
|
77
|
+
| `select` | Array | `["id", "title", "description"]` | Fields to retrieve |
|
|
78
|
+
|
|
79
|
+
**Required args:**
|
|
80
|
+
- `item_id` - Integer - Item ID
|
|
81
|
+
- `file` - File - File to be added to the column.
|
|
82
|
+
|
|
83
|
+
**Optional args:**
|
|
84
|
+
- `defaults` - String (JSON) - Default column settings
|
|
85
|
+
|
|
86
|
+
**Note**
|
|
87
|
+
- `UploadIO` is from the multipart-post gem that is included.
|
|
88
|
+
|
|
89
|
+
**Returns:** `Monday::Response`
|
|
90
|
+
|
|
91
|
+
**Example:**
|
|
92
|
+
|
|
93
|
+
```ruby
|
|
94
|
+
// UploadIO is from the multipart-post gem that is included.
|
|
95
|
+
response = client.file.add_file_to_update(args: {
|
|
96
|
+
update_id: 1234567890,
|
|
97
|
+
file: UploadIO.new(
|
|
98
|
+
File.open('/path/to/polarBear.jpg'),
|
|
99
|
+
'image/jpeg',
|
|
100
|
+
'polarBear.jpg'
|
|
101
|
+
)
|
|
102
|
+
})
|
|
103
|
+
|
|
104
|
+
if response.success?
|
|
105
|
+
monday_file_id = response.body.dig("data", "add_file_to_update", "id")
|
|
106
|
+
puts "Added file #{monday_file_id} to update"
|
|
107
|
+
end
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
**GraphQL:** `mutation { add_file_to_update { ... } }`
|
|
111
|
+
|
|
112
|
+
**See:** [monday.com add_file_to_update](https://developer.monday.com/api-reference/reference/assets-1#add-file-to-update)
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
### clear_file_column
|
|
116
|
+
|
|
117
|
+
Clears all files in an item's File column. This is a helper method for files and you could also use the column.change_value to clear the column as well.
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
```ruby
|
|
121
|
+
client.file.clear_file_column(args: {}, select: ["id"])
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
**Parameters:**
|
|
125
|
+
|
|
126
|
+
| Name | Type | Default | Description |
|
|
127
|
+
|------|------|---------|-------------|
|
|
128
|
+
| `args` | Hash | `{}` | Arguments (required) |
|
|
129
|
+
| `select` | Array | `["id"]` | Fields to retrieve |
|
|
130
|
+
|
|
131
|
+
**Required args:**
|
|
132
|
+
- `board_id` - Integer or String - Board to clear updates from
|
|
133
|
+
- `item_id` - Integer or String - Item to clear updates from
|
|
134
|
+
- `column_id` - String - Column to clear updates from
|
|
135
|
+
|
|
136
|
+
**Returns:** `Monday::Response`
|
|
137
|
+
|
|
138
|
+
::: warning <span style="display: inline-flex; align-items: center; gap: 6px;"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"></path><line x1="12" y1="9" x2="12" y2="13"></line><line x1="12" y1="17" x2="12.01" y2="17"></line></svg>Destructive Operation</span>
|
|
139
|
+
This permanently deletes all files from the item's File column. This cannot be undone.
|
|
140
|
+
:::
|
|
141
|
+
|
|
142
|
+
**Example:**
|
|
143
|
+
|
|
144
|
+
```ruby
|
|
145
|
+
response = client.file.clear_file_column(
|
|
146
|
+
args: {
|
|
147
|
+
board_id: 1234,
|
|
148
|
+
item_id: 5678,
|
|
149
|
+
column_id: 'file_1234'
|
|
150
|
+
}
|
|
151
|
+
)
|
|
152
|
+
|
|
153
|
+
result = response.body.dig("data", "change_column_value", "id")
|
|
154
|
+
# => 123456
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
**GraphQL:** `mutation { change_column_value { ... } }`
|
|
158
|
+
|
|
159
|
+
**See:** [monday.com change_column_value](https://developer.monday.com/api-reference/reference/columns#change-column-value)
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
## Response Structure
|
|
163
|
+
|
|
164
|
+
All methods return a `Monday::Response` object. Access data using:
|
|
165
|
+
|
|
166
|
+
```ruby
|
|
167
|
+
response.success? # => true/false
|
|
168
|
+
response.status # => 200
|
|
169
|
+
response.body # => Hash with GraphQL response
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
### Typical Response Pattern
|
|
173
|
+
|
|
174
|
+
```ruby
|
|
175
|
+
response = client.column.create(
|
|
176
|
+
args: {
|
|
177
|
+
board_id: 1234567890,
|
|
178
|
+
title: "Status",
|
|
179
|
+
column_type: :color
|
|
180
|
+
}
|
|
181
|
+
)
|
|
182
|
+
|
|
183
|
+
if response.success?
|
|
184
|
+
column = response.body.dig("data", "create_column")
|
|
185
|
+
# Work with column
|
|
186
|
+
else
|
|
187
|
+
# Handle error
|
|
188
|
+
end
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
## Constants
|
|
192
|
+
|
|
193
|
+
### DEFAULT_SELECT
|
|
194
|
+
|
|
195
|
+
Default fields returned by all methods:
|
|
196
|
+
|
|
197
|
+
```ruby
|
|
198
|
+
["id"]
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
## Error Handling
|
|
202
|
+
|
|
203
|
+
Common errors when working with columns:
|
|
204
|
+
|
|
205
|
+
- `Monday::AuthorizationError` - Invalid or missing API token
|
|
206
|
+
- `Monday::InvalidRequestError` - Invalid board ID or column ID
|
|
207
|
+
- `Monday::Error` - Invalid column type, invalid field, or other API errors
|
|
208
|
+
|
|
209
|
+
**Example:**
|
|
210
|
+
|
|
211
|
+
```ruby
|
|
212
|
+
begin
|
|
213
|
+
response = client.file.add_file_to_column(
|
|
214
|
+
args: {
|
|
215
|
+
item_id: 123,
|
|
216
|
+
column_id: "file_123",
|
|
217
|
+
file: 'some_file_string' # Invalid file/stream
|
|
218
|
+
}
|
|
219
|
+
)
|
|
220
|
+
rescue Monday::InvalidRequestError => e
|
|
221
|
+
puts "Error: #{e.message}"
|
|
222
|
+
end
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
See the [Error Handling guide](/guides/advanced/errors) for more details.
|
|
226
|
+
|
|
227
|
+
## Related Resources
|
|
228
|
+
|
|
229
|
+
- [Column](/reference/resources/column) - Columns on items
|
|
230
|
+
- [Update](/reference/resources/update) - Updates (comments) on items
|
|
231
|
+
|
|
232
|
+
## External References
|
|
233
|
+
|
|
234
|
+
- [monday.com Columns API](https://developer.monday.com/api-reference/reference/columns)
|
|
235
|
+
- [GraphQL API Overview](https://developer.monday.com/api-reference/docs/introduction-to-graphql)
|
|
236
|
+
- [Column Types](https://support.monday.com/hc/en-us/articles/115005483545-All-About-Columns)
|
|
@@ -0,0 +1,386 @@
|
|
|
1
|
+
# Folder
|
|
2
|
+
|
|
3
|
+
Access and manage folders via the `client.folder` resource.
|
|
4
|
+
|
|
5
|
+
::: tip <span style="display: inline-flex; align-items: center; gap: 6px;"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"></circle><line x1="12" y1="16" x2="12" y2="12"></line><line x1="12" y1="8" x2="12.01" y2="8"></line></svg>What are Folders?</span>
|
|
6
|
+
Folders help organize boards within workspaces. They act as containers that group related boards together, making it easier to navigate and structure your monday.com workspace. Each folder must belong to a workspace.
|
|
7
|
+
:::
|
|
8
|
+
|
|
9
|
+
## Methods
|
|
10
|
+
|
|
11
|
+
### query
|
|
12
|
+
|
|
13
|
+
Retrieves folders from your account.
|
|
14
|
+
|
|
15
|
+
```ruby
|
|
16
|
+
client.folder.query(args: {}, select: DEFAULT_SELECT)
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
**Parameters:**
|
|
20
|
+
|
|
21
|
+
| Name | Type | Default | Description |
|
|
22
|
+
|------|------|---------|-------------|
|
|
23
|
+
| `args` | Hash | `{}` | Query arguments (see [folders query](https://developer.monday.com/api-reference/reference/folders#queries)) |
|
|
24
|
+
| `select` | Array | `["id", "name"]` | Fields to retrieve |
|
|
25
|
+
|
|
26
|
+
**Returns:** `Monday::Response`
|
|
27
|
+
|
|
28
|
+
**Common args:**
|
|
29
|
+
- `ids` - Array of folder IDs
|
|
30
|
+
- `workspace_ids` - Array of workspace IDs to filter folders
|
|
31
|
+
|
|
32
|
+
**Example:**
|
|
33
|
+
|
|
34
|
+
```ruby
|
|
35
|
+
response = client.folder.query(
|
|
36
|
+
select: ["id", "name", "color", "created_at"]
|
|
37
|
+
)
|
|
38
|
+
|
|
39
|
+
folders = response.body.dig("data", "folders")
|
|
40
|
+
|
|
41
|
+
folders.each do |folder|
|
|
42
|
+
puts "#{folder['name']} (ID: #{folder['id']})"
|
|
43
|
+
end
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
**GraphQL:** `query { folders { ... } }`
|
|
47
|
+
|
|
48
|
+
**See:** [monday.com folders query](https://developer.monday.com/api-reference/reference/folders#queries)
|
|
49
|
+
|
|
50
|
+
### create
|
|
51
|
+
|
|
52
|
+
Creates a new folder within a workspace.
|
|
53
|
+
|
|
54
|
+
```ruby
|
|
55
|
+
client.folder.create(args: {}, select: DEFAULT_SELECT)
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
**Parameters:**
|
|
59
|
+
|
|
60
|
+
| Name | Type | Default | Description |
|
|
61
|
+
|------|------|---------|-------------|
|
|
62
|
+
| `args` | Hash | `{}` | Creation arguments (required) |
|
|
63
|
+
| `select` | Array | `["id", "name"]` | Fields to retrieve |
|
|
64
|
+
|
|
65
|
+
**Required args:**
|
|
66
|
+
- `workspace_id` - Integer or String - Workspace to create folder in
|
|
67
|
+
- `name` - String - Folder name
|
|
68
|
+
|
|
69
|
+
**Optional args:**
|
|
70
|
+
- `color` - String - Folder color (hex code or color name)
|
|
71
|
+
- `parent_folder_id` - Integer - Create as subfolder of another folder
|
|
72
|
+
|
|
73
|
+
**Returns:** `Monday::Response`
|
|
74
|
+
|
|
75
|
+
**Example:**
|
|
76
|
+
|
|
77
|
+
```ruby
|
|
78
|
+
response = client.folder.create(
|
|
79
|
+
args: {
|
|
80
|
+
workspace_id: 8529962,
|
|
81
|
+
name: "Database boards"
|
|
82
|
+
}
|
|
83
|
+
)
|
|
84
|
+
|
|
85
|
+
folder = response.body.dig("data", "create_folder")
|
|
86
|
+
# => {"id"=>"15476755", "name"=>"Database boards"}
|
|
87
|
+
|
|
88
|
+
puts "Created folder: #{folder['name']}"
|
|
89
|
+
puts "Folder ID: #{folder['id']}"
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
**With custom fields:**
|
|
93
|
+
|
|
94
|
+
```ruby
|
|
95
|
+
response = client.folder.create(
|
|
96
|
+
args: {
|
|
97
|
+
workspace_id: 8529962,
|
|
98
|
+
name: "Q1 Projects",
|
|
99
|
+
color: "#FF5AC4"
|
|
100
|
+
},
|
|
101
|
+
select: ["id", "name", "color"]
|
|
102
|
+
)
|
|
103
|
+
|
|
104
|
+
folder = response.body.dig("data", "create_folder")
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
**GraphQL:** `mutation { create_folder { ... } }`
|
|
108
|
+
|
|
109
|
+
**See:** [monday.com create_folder](https://developer.monday.com/api-reference/reference/folders#create-folder)
|
|
110
|
+
|
|
111
|
+
### update
|
|
112
|
+
|
|
113
|
+
Updates a folder's attributes.
|
|
114
|
+
|
|
115
|
+
```ruby
|
|
116
|
+
client.folder.update(args: {}, select: ["id"])
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
**Parameters:**
|
|
120
|
+
|
|
121
|
+
| Name | Type | Default | Description |
|
|
122
|
+
|------|------|---------|-------------|
|
|
123
|
+
| `args` | Hash | `{}` | Update arguments (required) |
|
|
124
|
+
| `select` | Array | `["id"]` | Fields to retrieve |
|
|
125
|
+
|
|
126
|
+
**Required args:**
|
|
127
|
+
- `folder_id` - Integer or String - Folder to update
|
|
128
|
+
- One or more update fields:
|
|
129
|
+
- `name` - String - New folder name
|
|
130
|
+
- `color` - String - New folder color
|
|
131
|
+
- `parent_folder_id` - Integer - Move to different parent folder
|
|
132
|
+
|
|
133
|
+
**Returns:** `Monday::Response`
|
|
134
|
+
|
|
135
|
+
**Example:**
|
|
136
|
+
|
|
137
|
+
```ruby
|
|
138
|
+
response = client.folder.update(
|
|
139
|
+
args: {
|
|
140
|
+
folder_id: 15476750,
|
|
141
|
+
name: "Cool boards"
|
|
142
|
+
}
|
|
143
|
+
)
|
|
144
|
+
|
|
145
|
+
folder = response.body.dig("data", "update_folder")
|
|
146
|
+
# => {"id"=>"15476750"}
|
|
147
|
+
|
|
148
|
+
puts "Updated folder ID: #{folder['id']}"
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
**Update multiple attributes:**
|
|
152
|
+
|
|
153
|
+
```ruby
|
|
154
|
+
response = client.folder.update(
|
|
155
|
+
args: {
|
|
156
|
+
folder_id: 15476750,
|
|
157
|
+
name: "Updated Projects",
|
|
158
|
+
color: "#00C875"
|
|
159
|
+
},
|
|
160
|
+
select: ["id", "name", "color"]
|
|
161
|
+
)
|
|
162
|
+
|
|
163
|
+
folder = response.body.dig("data", "update_folder")
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
**GraphQL:** `mutation { update_folder { ... } }`
|
|
167
|
+
|
|
168
|
+
**See:** [monday.com update_folder](https://developer.monday.com/api-reference/reference/folders#update-folder)
|
|
169
|
+
|
|
170
|
+
### delete
|
|
171
|
+
|
|
172
|
+
Permanently deletes a folder.
|
|
173
|
+
|
|
174
|
+
```ruby
|
|
175
|
+
client.folder.delete(args: {}, select: ["id"])
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
**Parameters:**
|
|
179
|
+
|
|
180
|
+
| Name | Type | Default | Description |
|
|
181
|
+
|------|------|---------|-------------|
|
|
182
|
+
| `args` | Hash | `{}` | Deletion arguments (required) |
|
|
183
|
+
| `select` | Array | `["id"]` | Fields to retrieve |
|
|
184
|
+
|
|
185
|
+
**Required args:**
|
|
186
|
+
- `folder_id` - Integer or String - Folder to delete
|
|
187
|
+
|
|
188
|
+
**Returns:** `Monday::Response`
|
|
189
|
+
|
|
190
|
+
::: warning <span style="display: inline-flex; align-items: center; gap: 6px;"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"></path><line x1="12" y1="9" x2="12" y2="13"></line><line x1="12" y1="17" x2="12.01" y2="17"></line></svg>Permanent Deletion</span>
|
|
191
|
+
This operation cannot be undone. All boards in the folder will be moved to the workspace root, not deleted.
|
|
192
|
+
:::
|
|
193
|
+
|
|
194
|
+
**Example:**
|
|
195
|
+
|
|
196
|
+
```ruby
|
|
197
|
+
response = client.folder.delete(
|
|
198
|
+
args: { folder_id: 15476753 }
|
|
199
|
+
)
|
|
200
|
+
|
|
201
|
+
folder = response.body.dig("data", "delete_folder")
|
|
202
|
+
# => {"id"=>"15476753"}
|
|
203
|
+
|
|
204
|
+
puts "Deleted folder ID: #{folder['id']}"
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
**GraphQL:** `mutation { delete_folder { ... } }`
|
|
208
|
+
|
|
209
|
+
**See:** [monday.com delete_folder](https://developer.monday.com/api-reference/reference/folders#delete-folder)
|
|
210
|
+
|
|
211
|
+
## Response Structure
|
|
212
|
+
|
|
213
|
+
All methods return a `Monday::Response` object. Access data using:
|
|
214
|
+
|
|
215
|
+
```ruby
|
|
216
|
+
response.success? # => true/false
|
|
217
|
+
response.status # => 200
|
|
218
|
+
response.body # => Hash with GraphQL response
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
### Typical Response Pattern
|
|
222
|
+
|
|
223
|
+
```ruby
|
|
224
|
+
response = client.folder.query
|
|
225
|
+
|
|
226
|
+
if response.success?
|
|
227
|
+
folders = response.body.dig("data", "folders")
|
|
228
|
+
# Work with folders
|
|
229
|
+
else
|
|
230
|
+
# Handle error
|
|
231
|
+
end
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
## Constants
|
|
235
|
+
|
|
236
|
+
### DEFAULT_SELECT
|
|
237
|
+
|
|
238
|
+
Default fields returned by `query` and `create`:
|
|
239
|
+
|
|
240
|
+
```ruby
|
|
241
|
+
["id", "name"]
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
## Error Handling
|
|
245
|
+
|
|
246
|
+
Common errors when working with folders:
|
|
247
|
+
|
|
248
|
+
- `Monday::AuthorizationError` - Invalid or missing API token
|
|
249
|
+
- `Monday::ResourceNotFoundError` - Folder with given ID not found
|
|
250
|
+
- `Monday::Error` - Invalid field requested, invalid workspace_id, or other API errors
|
|
251
|
+
|
|
252
|
+
**Example:**
|
|
253
|
+
|
|
254
|
+
```ruby
|
|
255
|
+
begin
|
|
256
|
+
response = client.folder.delete(
|
|
257
|
+
args: { folder_id: 999999 }
|
|
258
|
+
)
|
|
259
|
+
|
|
260
|
+
if response.success?
|
|
261
|
+
puts "Folder deleted"
|
|
262
|
+
end
|
|
263
|
+
rescue Monday::ResourceNotFoundError
|
|
264
|
+
puts "Folder not found"
|
|
265
|
+
rescue Monday::AuthorizationError
|
|
266
|
+
puts "Invalid API token"
|
|
267
|
+
rescue Monday::Error => e
|
|
268
|
+
puts "Error: #{e.message}"
|
|
269
|
+
end
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
## Use Cases
|
|
273
|
+
|
|
274
|
+
### Organize Workspace Boards
|
|
275
|
+
|
|
276
|
+
Use folders to group related boards:
|
|
277
|
+
|
|
278
|
+
```ruby
|
|
279
|
+
# Create folders for different departments
|
|
280
|
+
departments = ["Engineering", "Marketing", "Sales", "HR"]
|
|
281
|
+
workspace_id = 8529962
|
|
282
|
+
|
|
283
|
+
departments.each do |dept|
|
|
284
|
+
response = client.folder.create(
|
|
285
|
+
args: {
|
|
286
|
+
workspace_id: workspace_id,
|
|
287
|
+
name: dept
|
|
288
|
+
}
|
|
289
|
+
)
|
|
290
|
+
|
|
291
|
+
if response.success?
|
|
292
|
+
folder = response.body.dig("data", "create_folder")
|
|
293
|
+
puts "Created #{dept} folder: #{folder['id']}"
|
|
294
|
+
end
|
|
295
|
+
end
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
### List Workspace Structure
|
|
299
|
+
|
|
300
|
+
Query all folders to understand workspace organization:
|
|
301
|
+
|
|
302
|
+
```ruby
|
|
303
|
+
response = client.folder.query(
|
|
304
|
+
select: [
|
|
305
|
+
"id",
|
|
306
|
+
"name",
|
|
307
|
+
"color",
|
|
308
|
+
"created_at",
|
|
309
|
+
{
|
|
310
|
+
workspace: ["id", "name"]
|
|
311
|
+
}
|
|
312
|
+
]
|
|
313
|
+
)
|
|
314
|
+
|
|
315
|
+
if response.success?
|
|
316
|
+
folders = response.body.dig("data", "folders")
|
|
317
|
+
|
|
318
|
+
folders.each do |folder|
|
|
319
|
+
workspace_name = folder.dig("workspace", "name")
|
|
320
|
+
puts "#{folder['name']} → #{workspace_name}"
|
|
321
|
+
end
|
|
322
|
+
end
|
|
323
|
+
```
|
|
324
|
+
|
|
325
|
+
### Rename and Color-Code Folders
|
|
326
|
+
|
|
327
|
+
Update folder appearance:
|
|
328
|
+
|
|
329
|
+
```ruby
|
|
330
|
+
folder_id = 15476750
|
|
331
|
+
|
|
332
|
+
response = client.folder.update(
|
|
333
|
+
args: {
|
|
334
|
+
folder_id: folder_id,
|
|
335
|
+
name: "Active Projects",
|
|
336
|
+
color: "#00C875" # Green
|
|
337
|
+
},
|
|
338
|
+
select: ["id", "name", "color"]
|
|
339
|
+
)
|
|
340
|
+
|
|
341
|
+
if response.success?
|
|
342
|
+
folder = response.body.dig("data", "update_folder")
|
|
343
|
+
puts "Updated: #{folder['name']} (#{folder['color']})"
|
|
344
|
+
end
|
|
345
|
+
```
|
|
346
|
+
|
|
347
|
+
### Clean Up Empty Folders
|
|
348
|
+
|
|
349
|
+
Delete folders that are no longer needed:
|
|
350
|
+
|
|
351
|
+
```ruby
|
|
352
|
+
# Query folder with boards to check if empty
|
|
353
|
+
response = client.folder.query(
|
|
354
|
+
select: [
|
|
355
|
+
"id",
|
|
356
|
+
"name",
|
|
357
|
+
{
|
|
358
|
+
children: ["id", "name"]
|
|
359
|
+
}
|
|
360
|
+
]
|
|
361
|
+
)
|
|
362
|
+
|
|
363
|
+
if response.success?
|
|
364
|
+
folders = response.body.dig("data", "folders")
|
|
365
|
+
|
|
366
|
+
folders.each do |folder|
|
|
367
|
+
if folder["children"].nil? || folder["children"].empty?
|
|
368
|
+
delete_response = client.folder.delete(
|
|
369
|
+
args: { folder_id: folder["id"] }
|
|
370
|
+
)
|
|
371
|
+
|
|
372
|
+
puts "Deleted empty folder: #{folder['name']}" if delete_response.success?
|
|
373
|
+
end
|
|
374
|
+
end
|
|
375
|
+
end
|
|
376
|
+
```
|
|
377
|
+
|
|
378
|
+
## Related Resources
|
|
379
|
+
|
|
380
|
+
- [Board](/reference/resources/board) - Boards within folders
|
|
381
|
+
- [Workspace](/reference/resources/workspace) - Folder parent workspaces
|
|
382
|
+
|
|
383
|
+
## External References
|
|
384
|
+
|
|
385
|
+
- [monday.com Folders API](https://developer.monday.com/api-reference/reference/folders)
|
|
386
|
+
- [GraphQL API Overview](https://developer.monday.com/api-reference/docs/introduction-to-graphql)
|