basecamp-sdk 0.12.0 → 0.13.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.
Files changed (60) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +127 -8
  3. data/lib/basecamp/client.rb +35 -11
  4. data/lib/basecamp/config.rb +69 -0
  5. data/lib/basecamp/generated/metadata.json +280 -141
  6. data/lib/basecamp/generated/services/base_service.rb +37 -16
  7. data/lib/basecamp/generated/services/bookmarks_service.rb +5 -4
  8. data/lib/basecamp/generated/services/boosts_service.rb +12 -6
  9. data/lib/basecamp/generated/services/campfires_service.rb +54 -41
  10. data/lib/basecamp/generated/services/cards_service.rb +6 -3
  11. data/lib/basecamp/generated/services/checkins_service.rb +28 -15
  12. data/lib/basecamp/generated/services/client_approvals_service.rb +8 -5
  13. data/lib/basecamp/generated/services/client_correspondences_service.rb +8 -5
  14. data/lib/basecamp/generated/services/client_replies_service.rb +12 -7
  15. data/lib/basecamp/generated/services/cloud_files_service.rb +57 -0
  16. data/lib/basecamp/generated/services/comments_service.rb +6 -3
  17. data/lib/basecamp/generated/services/documents_service.rb +9 -6
  18. data/lib/basecamp/generated/services/drafts_service.rb +5 -4
  19. data/lib/basecamp/generated/services/events_service.rb +6 -3
  20. data/lib/basecamp/generated/services/everything_service.rb +70 -56
  21. data/lib/basecamp/generated/services/folders_service.rb +62 -0
  22. data/lib/basecamp/generated/services/forwards_service.rb +12 -17
  23. data/lib/basecamp/generated/services/gauges_service.rb +12 -7
  24. data/lib/basecamp/generated/services/google_documents_service.rb +61 -0
  25. data/lib/basecamp/generated/services/message_types_service.rb +4 -3
  26. data/lib/basecamp/generated/services/messages_service.rb +6 -4
  27. data/lib/basecamp/generated/services/my_notes_service.rb +1 -1
  28. data/lib/basecamp/generated/services/my_notifications_service.rb +8 -5
  29. data/lib/basecamp/generated/services/people_service.rb +17 -10
  30. data/lib/basecamp/generated/services/projects_service.rb +26 -4
  31. data/lib/basecamp/generated/services/recordings_service.rb +6 -13
  32. data/lib/basecamp/generated/services/reports_service.rb +15 -9
  33. data/lib/basecamp/generated/services/schedules_service.rb +90 -16
  34. data/lib/basecamp/generated/services/search_service.rb +6 -4
  35. data/lib/basecamp/generated/services/templates_service.rb +6 -4
  36. data/lib/basecamp/generated/services/timeline_service.rb +6 -3
  37. data/lib/basecamp/generated/services/timesheets_service.rb +22 -8
  38. data/lib/basecamp/generated/services/todolist_groups_service.rb +7 -4
  39. data/lib/basecamp/generated/services/todolists_service.rb +11 -9
  40. data/lib/basecamp/generated/services/todos_service.rb +6 -14
  41. data/lib/basecamp/generated/services/uploads_service.rb +10 -6
  42. data/lib/basecamp/generated/services/vaults_service.rb +6 -3
  43. data/lib/basecamp/generated/services/webhooks_service.rb +4 -3
  44. data/lib/basecamp/generated/types.rb +527 -139
  45. data/lib/basecamp/http.rb +346 -163
  46. data/lib/basecamp/list_enumerator.rb +29 -0
  47. data/lib/basecamp/list_meta.rb +44 -0
  48. data/lib/basecamp/services/cards_extensions.rb +35 -27
  49. data/lib/basecamp/services/documents_extensions.rb +136 -0
  50. data/lib/basecamp/services/merge_safe.rb +255 -0
  51. data/lib/basecamp/services/schedules_extensions.rb +354 -0
  52. data/lib/basecamp/services/todolists_extensions.rb +274 -0
  53. data/lib/basecamp/services/todos_extensions.rb +22 -6
  54. data/lib/basecamp/validation_error.rb +11 -1
  55. data/lib/basecamp/version.rb +2 -2
  56. data/lib/basecamp.rb +94 -4
  57. data/scripts/generate-services.rb +74 -25
  58. data/scripts/generate-types.rb +2 -1
  59. data/scripts/go_type_spellings.rb +26 -0
  60. metadata +12 -2
@@ -11,12 +11,13 @@ module Basecamp
11
11
  # @param assignee_ids [Array, nil] Restrict to tasks assigned to at least one of the given people (repeatable).
12
12
  # Assignees on nested steps are not considered.
13
13
  # @param due [String, nil] Filter by due date: with, without, or overdue. Unrecognized values are ignored.
14
- # @param page [Integer, nil] Page number for paginating through results. Defaults to 1.
15
- # @return [Enumerator<Hash>] paginated results
16
- def get_everything_completed_cards(assignee_ids: nil, due: nil, page: nil)
14
+ # @param page [Integer, nil] Page number for paginating through results. Defaults to 1. A positive value selects exactly that page, not a starting offset; see SPEC section 8.
15
+ # @param max_items [Integer, nil] cap on items yielded across pages; nil or non-positive means no cap
16
+ # @return [ListEnumerator<Hash>] lazily paginated results (#meta carries pagination metadata)
17
+ def get_everything_completed_cards(assignee_ids: nil, due: nil, page: nil, max_items: nil)
17
18
  wrap_paginated(service: "everything", operation: "get_everything_completed_cards", is_mutation: false) do
18
19
  params = compact_query_params(assignee_ids: assignee_ids, due: due, page: page)
19
- paginate("/cards/completed.json", params: params, operation: "GetEverythingCompletedCards")
20
+ paginate("/cards/completed.json", params: params, operation: "GetEverythingCompletedCards", max_items: max_items)
20
21
  end
21
22
  end
22
23
 
@@ -24,12 +25,13 @@ module Basecamp
24
25
  # @param assignee_ids [Array, nil] Restrict to tasks assigned to at least one of the given people (repeatable).
25
26
  # Assignees on nested steps are not considered.
26
27
  # @param due [String, nil] Filter by due date: with, without, or overdue. Unrecognized values are ignored.
27
- # @param page [Integer, nil] Page number for paginating through results. Defaults to 1.
28
- # @return [Enumerator<Hash>] paginated results
29
- def get_everything_no_due_date_cards(assignee_ids: nil, due: nil, page: nil)
28
+ # @param page [Integer, nil] Page number for paginating through results. Defaults to 1. A positive value selects exactly that page, not a starting offset; see SPEC section 8.
29
+ # @param max_items [Integer, nil] cap on items yielded across pages; nil or non-positive means no cap
30
+ # @return [ListEnumerator<Hash>] lazily paginated results (#meta carries pagination metadata)
31
+ def get_everything_no_due_date_cards(assignee_ids: nil, due: nil, page: nil, max_items: nil)
30
32
  wrap_paginated(service: "everything", operation: "get_everything_no_due_date_cards", is_mutation: false) do
31
33
  params = compact_query_params(assignee_ids: assignee_ids, due: due, page: page)
32
- paginate("/cards/no_due_date.json", params: params, operation: "GetEverythingNoDueDateCards")
34
+ paginate("/cards/no_due_date.json", params: params, operation: "GetEverythingNoDueDateCards", max_items: max_items)
33
35
  end
34
36
  end
35
37
 
@@ -37,12 +39,13 @@ module Basecamp
37
39
  # @param assignee_ids [Array, nil] Restrict to tasks assigned to at least one of the given people (repeatable).
38
40
  # Assignees on nested steps are not considered.
39
41
  # @param due [String, nil] Filter by due date: with, without, or overdue. Unrecognized values are ignored.
40
- # @param page [Integer, nil] Page number for paginating through results. Defaults to 1.
41
- # @return [Enumerator<Hash>] paginated results
42
- def get_everything_not_now_cards(assignee_ids: nil, due: nil, page: nil)
42
+ # @param page [Integer, nil] Page number for paginating through results. Defaults to 1. A positive value selects exactly that page, not a starting offset; see SPEC section 8.
43
+ # @param max_items [Integer, nil] cap on items yielded across pages; nil or non-positive means no cap
44
+ # @return [ListEnumerator<Hash>] lazily paginated results (#meta carries pagination metadata)
45
+ def get_everything_not_now_cards(assignee_ids: nil, due: nil, page: nil, max_items: nil)
43
46
  wrap_paginated(service: "everything", operation: "get_everything_not_now_cards", is_mutation: false) do
44
47
  params = compact_query_params(assignee_ids: assignee_ids, due: due, page: page)
45
- paginate("/cards/not_now.json", params: params, operation: "GetEverythingNotNowCards")
48
+ paginate("/cards/not_now.json", params: params, operation: "GetEverythingNotNowCards", max_items: max_items)
46
49
  end
47
50
  end
48
51
 
@@ -50,12 +53,13 @@ module Basecamp
50
53
  # @param assignee_ids [Array, nil] Restrict to tasks assigned to at least one of the given people (repeatable).
51
54
  # Assignees on nested steps are not considered.
52
55
  # @param due [String, nil] Filter by due date: with, without, or overdue. Unrecognized values are ignored.
53
- # @param page [Integer, nil] Page number for paginating through results. Defaults to 1.
54
- # @return [Enumerator<Hash>] paginated results
55
- def get_everything_open_cards(assignee_ids: nil, due: nil, page: nil)
56
+ # @param page [Integer, nil] Page number for paginating through results. Defaults to 1. A positive value selects exactly that page, not a starting offset; see SPEC section 8.
57
+ # @param max_items [Integer, nil] cap on items yielded across pages; nil or non-positive means no cap
58
+ # @return [ListEnumerator<Hash>] lazily paginated results (#meta carries pagination metadata)
59
+ def get_everything_open_cards(assignee_ids: nil, due: nil, page: nil, max_items: nil)
56
60
  wrap_paginated(service: "everything", operation: "get_everything_open_cards", is_mutation: false) do
57
61
  params = compact_query_params(assignee_ids: assignee_ids, due: due, page: page)
58
- paginate("/cards/open.json", params: params, operation: "GetEverythingOpenCards")
62
+ paginate("/cards/open.json", params: params, operation: "GetEverythingOpenCards", max_items: max_items)
59
63
  end
60
64
  end
61
65
 
@@ -74,64 +78,70 @@ module Basecamp
74
78
  # @param assignee_ids [Array, nil] Restrict to tasks assigned to at least one of the given people (repeatable).
75
79
  # Assignees on nested steps are not considered.
76
80
  # @param due [String, nil] Filter by due date: with, without, or overdue. Unrecognized values are ignored.
77
- # @param page [Integer, nil] Page number for paginating through results. Defaults to 1.
78
- # @return [Enumerator<Hash>] paginated results
79
- def get_everything_unassigned_cards(assignee_ids: nil, due: nil, page: nil)
81
+ # @param page [Integer, nil] Page number for paginating through results. Defaults to 1. A positive value selects exactly that page, not a starting offset; see SPEC section 8.
82
+ # @param max_items [Integer, nil] cap on items yielded across pages; nil or non-positive means no cap
83
+ # @return [ListEnumerator<Hash>] lazily paginated results (#meta carries pagination metadata)
84
+ def get_everything_unassigned_cards(assignee_ids: nil, due: nil, page: nil, max_items: nil)
80
85
  wrap_paginated(service: "everything", operation: "get_everything_unassigned_cards", is_mutation: false) do
81
86
  params = compact_query_params(assignee_ids: assignee_ids, due: due, page: page)
82
- paginate("/cards/unassigned.json", params: params, operation: "GetEverythingUnassignedCards")
87
+ paginate("/cards/unassigned.json", params: params, operation: "GetEverythingUnassignedCards", max_items: max_items)
83
88
  end
84
89
  end
85
90
 
86
91
  # Get every automatic check-in answer across all accessible projects, newest-first.
87
- # @param page [Integer, nil] Page number for paginating through results. Defaults to 1.
88
- # @return [Enumerator<Hash>] paginated results
89
- def get_everything_checkins(page: nil)
92
+ # @param page [Integer, nil] Page number for paginating through results. Defaults to 1. A positive value selects exactly that page, not a starting offset; see SPEC section 8.
93
+ # @param max_items [Integer, nil] cap on items yielded across pages; nil or non-positive means no cap
94
+ # @return [ListEnumerator<Hash>] lazily paginated results (#meta carries pagination metadata)
95
+ def get_everything_checkins(page: nil, max_items: nil)
90
96
  wrap_paginated(service: "everything", operation: "get_everything_checkins", is_mutation: false) do
91
97
  params = compact_query_params(page: page)
92
- paginate("/checkins.json", params: params, operation: "GetEverythingCheckins")
98
+ paginate("/checkins.json", params: params, operation: "GetEverythingCheckins", max_items: max_items)
93
99
  end
94
100
  end
95
101
 
96
102
  # Get every comment across all accessible projects, newest-first (paginated).
97
- # @param page [Integer, nil] Page number for paginating through results. Defaults to 1.
98
- # @return [Enumerator<Hash>] paginated results
99
- def get_everything_comments(page: nil)
103
+ # @param page [Integer, nil] Page number for paginating through results. Defaults to 1. A positive value selects exactly that page, not a starting offset; see SPEC section 8.
104
+ # @param max_items [Integer, nil] cap on items yielded across pages; nil or non-positive means no cap
105
+ # @return [ListEnumerator<Hash>] lazily paginated results (#meta carries pagination metadata)
106
+ def get_everything_comments(page: nil, max_items: nil)
100
107
  wrap_paginated(service: "everything", operation: "get_everything_comments", is_mutation: false) do
101
108
  params = compact_query_params(page: page)
102
- paginate("/comments.json", params: params, operation: "GetEverythingComments")
109
+ paginate("/comments.json", params: params, operation: "GetEverythingComments", max_items: max_items)
103
110
  end
104
111
  end
105
112
 
106
113
  # Get every file recording across all accessible projects, newest-first (paginated).
107
114
  # @param kind [String, nil] Filter by file kind: all (default), images, pdfs, documents, or videos.
108
115
  # @param people_ids [Array, nil] Restrict to files created by the given people (repeatable).
109
- # @param page [Integer, nil] Page number for paginating through results. Defaults to 1.
110
- # @return [Enumerator<Hash>] paginated results
111
- def get_everything_files(kind: nil, people_ids: nil, page: nil)
116
+ # @param page [Integer, nil] Page number for paginating through results. Defaults to 1. A positive value selects exactly that page, not a starting offset; see SPEC section 8.
117
+ # @param max_items [Integer, nil] cap on items yielded across pages; nil or non-positive means no cap
118
+ # @return [ListEnumerator<Hash>] lazily paginated results (#meta carries pagination metadata)
119
+ def get_everything_files(kind: nil, people_ids: nil, page: nil, max_items: nil)
112
120
  wrap_paginated(service: "everything", operation: "get_everything_files", is_mutation: false) do
113
121
  params = compact_query_params(kind: kind, people_ids: people_ids, page: page)
114
- paginate("/files.json", params: params, operation: "GetEverythingFiles")
122
+ paginate("/files.json", params: params, operation: "GetEverythingFiles", max_items: max_items)
115
123
  end
116
124
  end
117
125
 
118
126
  # Get every inbox forward across all accessible projects, newest-first (paginated).
119
- # @param page [Integer, nil] Page number for paginating through results. Defaults to 1.
120
- # @return [Enumerator<Hash>] paginated results
121
- def get_everything_forwards(page: nil)
127
+ # @param page [Integer, nil] Page number for paginating through results. Defaults to 1. A positive value selects exactly that page, not a starting offset; see SPEC section 8.
128
+ # @param max_items [Integer, nil] cap on items yielded across pages; nil or non-positive means no cap
129
+ # @return [ListEnumerator<Hash>] lazily paginated results (#meta carries pagination metadata)
130
+ def get_everything_forwards(page: nil, max_items: nil)
122
131
  wrap_paginated(service: "everything", operation: "get_everything_forwards", is_mutation: false) do
123
132
  params = compact_query_params(page: page)
124
- paginate("/forwards.json", params: params, operation: "GetEverythingForwards")
133
+ paginate("/forwards.json", params: params, operation: "GetEverythingForwards", max_items: max_items)
125
134
  end
126
135
  end
127
136
 
128
137
  # Get every message across all accessible projects, newest-first (paginated).
129
- # @param page [Integer, nil] Page number for paginating through results. Defaults to 1.
130
- # @return [Enumerator<Hash>] paginated results
131
- def get_everything_messages(page: nil)
138
+ # @param page [Integer, nil] Page number for paginating through results. Defaults to 1. A positive value selects exactly that page, not a starting offset; see SPEC section 8.
139
+ # @param max_items [Integer, nil] cap on items yielded across pages; nil or non-positive means no cap
140
+ # @return [ListEnumerator<Hash>] lazily paginated results (#meta carries pagination metadata)
141
+ def get_everything_messages(page: nil, max_items: nil)
132
142
  wrap_paginated(service: "everything", operation: "get_everything_messages", is_mutation: false) do
133
143
  params = compact_query_params(page: page)
134
- paginate("/messages.json", params: params, operation: "GetEverythingMessages")
144
+ paginate("/messages.json", params: params, operation: "GetEverythingMessages", max_items: max_items)
135
145
  end
136
146
  end
137
147
 
@@ -139,12 +149,13 @@ module Basecamp
139
149
  # @param assignee_ids [Array, nil] Restrict to tasks assigned to at least one of the given people (repeatable).
140
150
  # Assignees on nested steps are not considered.
141
151
  # @param due [String, nil] Filter by due date: with, without, or overdue. Unrecognized values are ignored.
142
- # @param page [Integer, nil] Page number for paginating through results. Defaults to 1.
143
- # @return [Enumerator<Hash>] paginated results
144
- def get_everything_completed_todos(assignee_ids: nil, due: nil, page: nil)
152
+ # @param page [Integer, nil] Page number for paginating through results. Defaults to 1. A positive value selects exactly that page, not a starting offset; see SPEC section 8.
153
+ # @param max_items [Integer, nil] cap on items yielded across pages; nil or non-positive means no cap
154
+ # @return [ListEnumerator<Hash>] lazily paginated results (#meta carries pagination metadata)
155
+ def get_everything_completed_todos(assignee_ids: nil, due: nil, page: nil, max_items: nil)
145
156
  wrap_paginated(service: "everything", operation: "get_everything_completed_todos", is_mutation: false) do
146
157
  params = compact_query_params(assignee_ids: assignee_ids, due: due, page: page)
147
- paginate("/todos/completed.json", params: params, operation: "GetEverythingCompletedTodos")
158
+ paginate("/todos/completed.json", params: params, operation: "GetEverythingCompletedTodos", max_items: max_items)
148
159
  end
149
160
  end
150
161
 
@@ -152,12 +163,13 @@ module Basecamp
152
163
  # @param assignee_ids [Array, nil] Restrict to tasks assigned to at least one of the given people (repeatable).
153
164
  # Assignees on nested steps are not considered.
154
165
  # @param due [String, nil] Filter by due date: with, without, or overdue. Unrecognized values are ignored.
155
- # @param page [Integer, nil] Page number for paginating through results. Defaults to 1.
156
- # @return [Enumerator<Hash>] paginated results
157
- def get_everything_no_due_date_todos(assignee_ids: nil, due: nil, page: nil)
166
+ # @param page [Integer, nil] Page number for paginating through results. Defaults to 1. A positive value selects exactly that page, not a starting offset; see SPEC section 8.
167
+ # @param max_items [Integer, nil] cap on items yielded across pages; nil or non-positive means no cap
168
+ # @return [ListEnumerator<Hash>] lazily paginated results (#meta carries pagination metadata)
169
+ def get_everything_no_due_date_todos(assignee_ids: nil, due: nil, page: nil, max_items: nil)
158
170
  wrap_paginated(service: "everything", operation: "get_everything_no_due_date_todos", is_mutation: false) do
159
171
  params = compact_query_params(assignee_ids: assignee_ids, due: due, page: page)
160
- paginate("/todos/no_due_date.json", params: params, operation: "GetEverythingNoDueDateTodos")
172
+ paginate("/todos/no_due_date.json", params: params, operation: "GetEverythingNoDueDateTodos", max_items: max_items)
161
173
  end
162
174
  end
163
175
 
@@ -165,12 +177,13 @@ module Basecamp
165
177
  # @param assignee_ids [Array, nil] Restrict to tasks assigned to at least one of the given people (repeatable).
166
178
  # Assignees on nested steps are not considered.
167
179
  # @param due [String, nil] Filter by due date: with, without, or overdue. Unrecognized values are ignored.
168
- # @param page [Integer, nil] Page number for paginating through results. Defaults to 1.
169
- # @return [Enumerator<Hash>] paginated results
170
- def get_everything_open_todos(assignee_ids: nil, due: nil, page: nil)
180
+ # @param page [Integer, nil] Page number for paginating through results. Defaults to 1. A positive value selects exactly that page, not a starting offset; see SPEC section 8.
181
+ # @param max_items [Integer, nil] cap on items yielded across pages; nil or non-positive means no cap
182
+ # @return [ListEnumerator<Hash>] lazily paginated results (#meta carries pagination metadata)
183
+ def get_everything_open_todos(assignee_ids: nil, due: nil, page: nil, max_items: nil)
171
184
  wrap_paginated(service: "everything", operation: "get_everything_open_todos", is_mutation: false) do
172
185
  params = compact_query_params(assignee_ids: assignee_ids, due: due, page: page)
173
- paginate("/todos/open.json", params: params, operation: "GetEverythingOpenTodos")
186
+ paginate("/todos/open.json", params: params, operation: "GetEverythingOpenTodos", max_items: max_items)
174
187
  end
175
188
  end
176
189
 
@@ -189,12 +202,13 @@ module Basecamp
189
202
  # @param assignee_ids [Array, nil] Restrict to tasks assigned to at least one of the given people (repeatable).
190
203
  # Assignees on nested steps are not considered.
191
204
  # @param due [String, nil] Filter by due date: with, without, or overdue. Unrecognized values are ignored.
192
- # @param page [Integer, nil] Page number for paginating through results. Defaults to 1.
193
- # @return [Enumerator<Hash>] paginated results
194
- def get_everything_unassigned_todos(assignee_ids: nil, due: nil, page: nil)
205
+ # @param page [Integer, nil] Page number for paginating through results. Defaults to 1. A positive value selects exactly that page, not a starting offset; see SPEC section 8.
206
+ # @param max_items [Integer, nil] cap on items yielded across pages; nil or non-positive means no cap
207
+ # @return [ListEnumerator<Hash>] lazily paginated results (#meta carries pagination metadata)
208
+ def get_everything_unassigned_todos(assignee_ids: nil, due: nil, page: nil, max_items: nil)
195
209
  wrap_paginated(service: "everything", operation: "get_everything_unassigned_todos", is_mutation: false) do
196
210
  params = compact_query_params(assignee_ids: assignee_ids, due: due, page: page)
197
- paginate("/todos/unassigned.json", params: params, operation: "GetEverythingUnassignedTodos")
211
+ paginate("/todos/unassigned.json", params: params, operation: "GetEverythingUnassignedTodos", max_items: max_items)
198
212
  end
199
213
  end
200
214
  end
@@ -0,0 +1,62 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Basecamp
4
+ module Services
5
+ # Service for Folders operations
6
+ #
7
+ # @generated from OpenAPI spec
8
+ class FoldersService < BaseService
9
+
10
+ # List the authenticated user's folders in home-screen order.
11
+ # @return [Array<Hash>] response data
12
+ def list_folders()
13
+ with_operation(service: "folders", operation: "list_folders", is_mutation: false) do
14
+ http_get("/stacks.json", operation: "ListFolders").json
15
+ end
16
+ end
17
+
18
+ # Create a folder for the authenticated user and file the given projects into it.
19
+ # @param name [String, nil] The folder's name. Defaults to `New folder` when blank, null, or omitted.
20
+ # @param project_ids [Array, nil] IDs of the projects to file into the folder — the same ids the folder
21
+ # reports back as `bucket_ids` and expands as `projects`. This does not
22
+ # round-trip under its own name. Omit it, or send null or an empty array,
23
+ # for an empty folder.
24
+ # @return [Hash] response data
25
+ def create_folder(name: nil, project_ids: nil)
26
+ with_operation(service: "folders", operation: "create_folder", is_mutation: true) do
27
+ http_post("/stacks.json", body: compact_params(name: name, project_ids: project_ids)).json
28
+ end
29
+ end
30
+
31
+ # Get one folder, with the projects grouped inside it expanded under `projects`.
32
+ # @param folder_id [Integer] folder id ID
33
+ # @return [Hash] response data
34
+ def get_folder(folder_id:)
35
+ with_operation(service: "folders", operation: "get_folder", is_mutation: false, resource_id: folder_id) do
36
+ http_get("/stacks/#{folder_id}", operation: "GetFolder").json
37
+ end
38
+ end
39
+
40
+ # Rename a folder.
41
+ # @param folder_id [Integer] folder id ID
42
+ # @param name [String] The folder's new name. Blank is rejected with 422 — unlike create, update
43
+ # does not fall back to a default name.
44
+ # @return [Hash] response data
45
+ def update_folder(folder_id:, name:)
46
+ with_operation(service: "folders", operation: "update_folder", is_mutation: true, resource_id: folder_id) do
47
+ http_put("/stacks/#{folder_id}", body: compact_params(name: name)).json
48
+ end
49
+ end
50
+
51
+ # Delete a folder and unpin its projects from the home screen (returns 204 No Content).
52
+ # @param folder_id [Integer] folder id ID
53
+ # @return [void]
54
+ def delete_folder(folder_id:)
55
+ with_operation(service: "folders", operation: "delete_folder", is_mutation: true, resource_id: folder_id) do
56
+ http_delete("/stacks/#{folder_id}")
57
+ nil
58
+ end
59
+ end
60
+ end
61
+ end
62
+ end
@@ -18,20 +18,13 @@ module Basecamp
18
18
 
19
19
  # List all replies to a forward
20
20
  # @param forward_id [Integer] forward id ID
21
- # @return [Enumerator<Hash>] paginated results
22
- def list_replies(forward_id:)
21
+ # @param page [Integer, nil] Page number for paginating through results. Defaults to 1. A positive value selects exactly that page, not a starting offset; see SPEC section 8.
22
+ # @param max_items [Integer, nil] cap on items yielded across pages; nil or non-positive means no cap
23
+ # @return [ListEnumerator<Hash>] lazily paginated results (#meta carries pagination metadata)
24
+ def list_replies(forward_id:, page: nil, max_items: nil)
23
25
  wrap_paginated(service: "forwards", operation: "list_replies", is_mutation: false, resource_id: forward_id) do
24
- paginate("/inbox_forwards/#{forward_id}/replies.json", operation: "ListForwardReplies")
25
- end
26
- end
27
-
28
- # Create a reply to a forward
29
- # @param forward_id [Integer] forward id ID
30
- # @param content [String] content
31
- # @return [Hash] response data
32
- def create_reply(forward_id:, content:)
33
- with_operation(service: "forwards", operation: "create_reply", is_mutation: true, resource_id: forward_id) do
34
- http_post("/inbox_forwards/#{forward_id}/replies.json", body: compact_params(content: content)).json
26
+ params = compact_query_params(page: page)
27
+ paginate("/inbox_forwards/#{forward_id}/replies.json", params: params, operation: "ListForwardReplies", max_items: max_items)
35
28
  end
36
29
  end
37
30
 
@@ -58,11 +51,13 @@ module Basecamp
58
51
  # @param inbox_id [Integer] inbox id ID
59
52
  # @param sort [String, nil] created_at|updated_at
60
53
  # @param direction [String, nil] asc|desc
61
- # @return [Enumerator<Hash>] paginated results
62
- def list(inbox_id:, sort: nil, direction: nil)
54
+ # @param page [Integer, nil] Page number for paginating through results. Defaults to 1. A positive value selects exactly that page, not a starting offset; see SPEC section 8.
55
+ # @param max_items [Integer, nil] cap on items yielded across pages; nil or non-positive means no cap
56
+ # @return [ListEnumerator<Hash>] lazily paginated results (#meta carries pagination metadata)
57
+ def list(inbox_id:, sort: nil, direction: nil, page: nil, max_items: nil)
63
58
  wrap_paginated(service: "forwards", operation: "list", is_mutation: false, resource_id: inbox_id) do
64
- params = compact_query_params(sort: sort, direction: direction)
65
- paginate("/inboxes/#{inbox_id}/forwards.json", params: params, operation: "ListForwards")
59
+ params = compact_query_params(sort: sort, direction: direction, page: page)
60
+ paginate("/inboxes/#{inbox_id}/inbox_forwards.json", params: params, operation: "ListForwards", max_items: max_items)
66
61
  end
67
62
  end
68
63
  end
@@ -49,10 +49,13 @@ module Basecamp
49
49
 
50
50
  # List gauge needles for a project, ordered newest first.
51
51
  # @param project_id [Integer] project id ID
52
- # @return [Enumerator<Hash>] paginated results
53
- def list_gauge_needles(project_id:)
52
+ # @param page [Integer, nil] Page number for paginating through results. Defaults to 1. A positive value selects exactly that page, not a starting offset; see SPEC section 8.
53
+ # @param max_items [Integer, nil] cap on items yielded across pages; nil or non-positive means no cap
54
+ # @return [ListEnumerator<Hash>] lazily paginated results (#meta carries pagination metadata)
55
+ def list_gauge_needles(project_id:, page: nil, max_items: nil)
54
56
  wrap_paginated(service: "gauges", operation: "list_gauge_needles", is_mutation: false, project_id: project_id) do
55
- paginate("/projects/#{project_id}/gauge/needles.json", operation: "ListGaugeNeedles")
57
+ params = compact_query_params(page: page)
58
+ paginate("/projects/#{project_id}/gauge/needles.json", params: params, operation: "ListGaugeNeedles", max_items: max_items)
56
59
  end
57
60
  end
58
61
 
@@ -71,11 +74,13 @@ module Basecamp
71
74
  # List gauges across all projects the authenticated user has access to.
72
75
  # @param bucket_ids [String, nil] Comma-separated list of project IDs. When provided, results are returned
73
76
  # in the order specified instead of by risk level.
74
- # @return [Enumerator<Hash>] paginated results
75
- def list_gauges(bucket_ids: nil)
77
+ # @param page [Integer, nil] Page number for paginating through results. Defaults to 1. A positive value selects exactly that page, not a starting offset; see SPEC section 8.
78
+ # @param max_items [Integer, nil] cap on items yielded across pages; nil or non-positive means no cap
79
+ # @return [ListEnumerator<Hash>] lazily paginated results (#meta carries pagination metadata)
80
+ def list_gauges(bucket_ids: nil, page: nil, max_items: nil)
76
81
  wrap_paginated(service: "gauges", operation: "list_gauges", is_mutation: false) do
77
- params = compact_query_params(bucket_ids: bucket_ids)
78
- paginate("/reports/gauges.json", params: params, operation: "ListGauges")
82
+ params = compact_query_params(bucket_ids: bucket_ids, page: page)
83
+ paginate("/reports/gauges.json", params: params, operation: "ListGauges", max_items: max_items)
79
84
  end
80
85
  end
81
86
  end
@@ -0,0 +1,61 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Basecamp
4
+ module Services
5
+ # Service for GoogleDocuments operations
6
+ #
7
+ # @generated from OpenAPI spec
8
+ class GoogleDocumentsService < BaseService
9
+
10
+ # Create a new Google document in a vault.
11
+ # @param bucket_id [Integer] bucket id ID
12
+ # @param vault_id [Integer] vault id ID
13
+ # @param url [String] url
14
+ # @param document_type [String] One of "doc", "sheet", "slide", "other". Backed by a Rails enum, so an
15
+ # unrecognized value is rejected up front with a field-keyed 422
16
+ # ({"errors": {"document_type": ["is not a valid document type"]}}) rather
17
+ # than reaching validation.
18
+ # @param title [String, nil] title
19
+ # @param description [String, nil] description
20
+ # @param status [String, nil] active|drafted — defaults to drafted
21
+ # @param subscriptions [Array, nil] subscriptions
22
+ # @param visible_to_clients [Boolean, nil] Whether the document is visible to the project's clients. Applies only
23
+ # when creating directly in the tool's vault — an item created inside a
24
+ # folder inherits the folder's visibility and ignores this. A client caller
25
+ # always creates client-visible records regardless of what is sent.
26
+ # @return [Hash] response data
27
+ def create_google_document(bucket_id:, vault_id:, url:, document_type:, title: nil, description: nil, status: nil, subscriptions: nil, visible_to_clients: nil)
28
+ with_operation(service: "googledocuments", operation: "create_google_document", is_mutation: true, project_id: bucket_id, resource_id: vault_id) do
29
+ http_post("/buckets/#{bucket_id}/vaults/#{vault_id}/google_documents.json", body: compact_params(url: url, document_type: document_type, title: title, description: description, status: status, subscriptions: subscriptions, visible_to_clients: visible_to_clients)).json
30
+ end
31
+ end
32
+
33
+ # Get a single Google document by id
34
+ # @param google_document_id [Integer] google document id ID
35
+ # @return [Hash] response data
36
+ def get_google_document(google_document_id:)
37
+ with_operation(service: "googledocuments", operation: "get_google_document", is_mutation: false, resource_id: google_document_id) do
38
+ http_get("/google_documents/#{google_document_id}", operation: "GetGoogleDocument").json
39
+ end
40
+ end
41
+
42
+ # Replace a Google document with a new complete representation.
43
+ # @param google_document_id [Integer] google document id ID
44
+ # @param url [String] url
45
+ # @param document_type [String] One of "doc", "sheet", "slide", "other". Backed by a Rails enum, so an
46
+ # unrecognized value is rejected up front with a field-keyed 422
47
+ # ({"errors": {"document_type": ["is not a valid document type"]}}) rather
48
+ # than reaching validation.
49
+ # @param title [String, nil] title
50
+ # @param description [String, nil] description
51
+ # @param status [String, nil] active|drafted
52
+ # @param subscriptions [Array, nil] subscriptions
53
+ # @return [Hash] response data
54
+ def update_google_document(google_document_id:, url:, document_type:, title: nil, description: nil, status: nil, subscriptions: nil)
55
+ with_operation(service: "googledocuments", operation: "update_google_document", is_mutation: true, resource_id: google_document_id) do
56
+ http_put("/google_documents/#{google_document_id}", body: compact_params(url: url, document_type: document_type, title: title, description: description, status: status, subscriptions: subscriptions)).json
57
+ end
58
+ end
59
+ end
60
+ end
61
+ end
@@ -9,10 +9,11 @@ module Basecamp
9
9
 
10
10
  # List message types in a project
11
11
  # @param bucket_id [Integer] bucket id ID
12
- # @return [Enumerator<Hash>] paginated results
13
- def list(bucket_id:)
12
+ # @param max_items [Integer, nil] cap on items yielded across pages; nil or non-positive means no cap
13
+ # @return [ListEnumerator<Hash>] lazily paginated results (#meta carries pagination metadata)
14
+ def list(bucket_id:, max_items: nil)
14
15
  wrap_paginated(service: "messagetypes", operation: "list", is_mutation: false, project_id: bucket_id) do
15
- paginate("/buckets/#{bucket_id}/categories.json", operation: "ListMessageTypes")
16
+ paginate("/buckets/#{bucket_id}/categories.json", operation: "ListMessageTypes", max_items: max_items)
16
17
  end
17
18
  end
18
19
 
@@ -11,11 +11,13 @@ module Basecamp
11
11
  # @param board_id [Integer] board id ID
12
12
  # @param sort [String, nil] created_at|updated_at
13
13
  # @param direction [String, nil] asc|desc
14
- # @return [Enumerator<Hash>] paginated results
15
- def list(board_id:, sort: nil, direction: nil)
14
+ # @param page [Integer, nil] Page number for paginating through results. Defaults to 1. A positive value selects exactly that page, not a starting offset; see SPEC section 8.
15
+ # @param max_items [Integer, nil] cap on items yielded across pages; nil or non-positive means no cap
16
+ # @return [ListEnumerator<Hash>] lazily paginated results (#meta carries pagination metadata)
17
+ def list(board_id:, sort: nil, direction: nil, page: nil, max_items: nil)
16
18
  wrap_paginated(service: "messages", operation: "list", is_mutation: false, resource_id: board_id) do
17
- params = compact_query_params(sort: sort, direction: direction)
18
- paginate("/message_boards/#{board_id}/messages.json", params: params, operation: "ListMessages")
19
+ params = compact_query_params(sort: sort, direction: direction, page: page)
20
+ paginate("/message_boards/#{board_id}/messages.json", params: params, operation: "ListMessages", max_items: max_items)
19
21
  end
20
22
  end
21
23
 
@@ -15,7 +15,7 @@ module Basecamp
15
15
  end
16
16
  end
17
17
 
18
- # Replace the note's content, recording a new revision server-side. The first
18
+ # Replace the note's content, recording a new revision server-side.
19
19
  # @param note [Hash] note
20
20
  # @return [Hash] response data
21
21
  def update_my_note(note:)
@@ -8,7 +8,9 @@ module Basecamp
8
8
  class MyNotificationsService < BaseService
9
9
 
10
10
  # Get the current user's notification inbox (the "Hey!" menu).
11
- # @param page [Integer, nil] Page number for paginating through read items. Defaults to 1.
11
+ # @param page [Integer, nil] Page number for paginating through read items. Defaults to 1. This
12
+ # operation is not auto-paginated in any SDK, so a page is returned as
13
+ # asked for and later pages are not followed.
12
14
  # @param limit_bubble_ups [Boolean, nil] Set to true to cap `bubble_ups` at 2 current bubble-ups and omit the
13
15
  # `scheduled_bubble_ups` key entirely. Defaults to false. Use the dedicated
14
16
  # bubble-ups endpoint (GetBubbleUps) to page through all current and
@@ -21,12 +23,13 @@ module Basecamp
21
23
  end
22
24
 
23
25
  # Get the current user's current and scheduled bubble-ups (paginated, 50 per page).
24
- # @param page [Integer, nil] Page number. Defaults to 1.
25
- # @return [Enumerator<Hash>] paginated results
26
- def get_bubble_ups(page: nil)
26
+ # @param page [Integer, nil] Page number. Defaults to 1. A positive value selects exactly that page, not a starting offset; see SPEC section 8.
27
+ # @param max_items [Integer, nil] cap on items yielded across pages; nil or non-positive means no cap
28
+ # @return [ListEnumerator<Hash>] lazily paginated results (#meta carries pagination metadata)
29
+ def get_bubble_ups(page: nil, max_items: nil)
27
30
  wrap_paginated(service: "mynotifications", operation: "get_bubble_ups", is_mutation: false) do
28
31
  params = compact_query_params(page: page)
29
- paginate("/my/readings/bubble_ups.json", params: params, operation: "GetBubbleUps")
32
+ paginate("/my/readings/bubble_ups.json", params: params, operation: "GetBubbleUps", max_items: max_items)
30
33
  end
31
34
  end
32
35
 
@@ -8,10 +8,11 @@ module Basecamp
8
8
  class PeopleService < BaseService
9
9
 
10
10
  # List all account users who can be pinged
11
- # @return [Enumerator<Hash>] paginated results
12
- def list_pingable()
11
+ # @param max_items [Integer, nil] cap on items yielded across pages; nil or non-positive means no cap
12
+ # @return [ListEnumerator<Hash>] lazily paginated results (#meta carries pagination metadata)
13
+ def list_pingable(max_items: nil)
13
14
  wrap_paginated(service: "people", operation: "list_pingable", is_mutation: false) do
14
- paginate("/circles/people.json", operation: "ListPingablePeople")
15
+ paginate("/circles/people.json", operation: "ListPingablePeople", max_items: max_items)
15
16
  end
16
17
  end
17
18
 
@@ -23,7 +24,7 @@ module Basecamp
23
24
  end
24
25
  end
25
26
 
26
- # Update the current user's preferences
27
+ # Update the current user's preferences.
27
28
  # @param person [Hash] person
28
29
  # @return [Hash] response data
29
30
  def update_my_preferences(person:)
@@ -58,10 +59,13 @@ module Basecamp
58
59
  end
59
60
 
60
61
  # List all people visible to the current user
61
- # @return [Enumerator<Hash>] paginated results
62
- def list()
62
+ # @param page [Integer, nil] Page number for paginating through results. Defaults to 1. A positive value selects exactly that page, not a starting offset; see SPEC section 8.
63
+ # @param max_items [Integer, nil] cap on items yielded across pages; nil or non-positive means no cap
64
+ # @return [ListEnumerator<Hash>] lazily paginated results (#meta carries pagination metadata)
65
+ def list(page: nil, max_items: nil)
63
66
  wrap_paginated(service: "people", operation: "list", is_mutation: false) do
64
- paginate("/people.json", operation: "ListPeople")
67
+ params = compact_query_params(page: page)
68
+ paginate("/people.json", params: params, operation: "ListPeople", max_items: max_items)
65
69
  end
66
70
  end
67
71
 
@@ -105,10 +109,13 @@ module Basecamp
105
109
 
106
110
  # List all active people on a project
107
111
  # @param project_id [Integer] project id ID
108
- # @return [Enumerator<Hash>] paginated results
109
- def list_for_project(project_id:)
112
+ # @param page [Integer, nil] Page number for paginating through results. Defaults to 1. A positive value selects exactly that page, not a starting offset; see SPEC section 8.
113
+ # @param max_items [Integer, nil] cap on items yielded across pages; nil or non-positive means no cap
114
+ # @return [ListEnumerator<Hash>] lazily paginated results (#meta carries pagination metadata)
115
+ def list_for_project(project_id:, page: nil, max_items: nil)
110
116
  wrap_paginated(service: "people", operation: "list_for_project", is_mutation: false, project_id: project_id) do
111
- paginate("/projects/#{project_id}/people.json", operation: "ListProjectPeople")
117
+ params = compact_query_params(page: page)
118
+ paginate("/projects/#{project_id}/people.json", params: params, operation: "ListProjectPeople", max_items: max_items)
112
119
  end
113
120
  end
114
121