basecamp-sdk 0.11.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 (62) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +127 -8
  3. data/lib/basecamp/client.rb +55 -11
  4. data/lib/basecamp/config.rb +69 -0
  5. data/lib/basecamp/generated/metadata.json +443 -133
  6. data/lib/basecamp/generated/services/base_service.rb +37 -16
  7. data/lib/basecamp/generated/services/bookmarks_service.rb +50 -0
  8. data/lib/basecamp/generated/services/boosts_service.rb +12 -6
  9. data/lib/basecamp/generated/services/calendars_service.rb +30 -0
  10. data/lib/basecamp/generated/services/campfires_service.rb +54 -41
  11. data/lib/basecamp/generated/services/cards_service.rb +6 -3
  12. data/lib/basecamp/generated/services/checkins_service.rb +28 -15
  13. data/lib/basecamp/generated/services/client_approvals_service.rb +8 -5
  14. data/lib/basecamp/generated/services/client_correspondences_service.rb +8 -5
  15. data/lib/basecamp/generated/services/client_replies_service.rb +12 -7
  16. data/lib/basecamp/generated/services/cloud_files_service.rb +57 -0
  17. data/lib/basecamp/generated/services/comments_service.rb +6 -3
  18. data/lib/basecamp/generated/services/documents_service.rb +9 -6
  19. data/lib/basecamp/generated/services/drafts_service.rb +22 -0
  20. data/lib/basecamp/generated/services/events_service.rb +6 -3
  21. data/lib/basecamp/generated/services/everything_service.rb +116 -69
  22. data/lib/basecamp/generated/services/folders_service.rb +62 -0
  23. data/lib/basecamp/generated/services/forwards_service.rb +12 -17
  24. data/lib/basecamp/generated/services/gauges_service.rb +12 -7
  25. data/lib/basecamp/generated/services/google_documents_service.rb +61 -0
  26. data/lib/basecamp/generated/services/message_types_service.rb +4 -3
  27. data/lib/basecamp/generated/services/messages_service.rb +6 -4
  28. data/lib/basecamp/generated/services/my_assignments_service.rb +31 -0
  29. data/lib/basecamp/generated/services/my_notes_service.rb +28 -0
  30. data/lib/basecamp/generated/services/my_notifications_service.rb +8 -5
  31. data/lib/basecamp/generated/services/people_service.rb +17 -10
  32. data/lib/basecamp/generated/services/projects_service.rb +26 -4
  33. data/lib/basecamp/generated/services/recordings_service.rb +6 -13
  34. data/lib/basecamp/generated/services/reports_service.rb +15 -9
  35. data/lib/basecamp/generated/services/schedules_service.rb +90 -16
  36. data/lib/basecamp/generated/services/search_service.rb +6 -4
  37. data/lib/basecamp/generated/services/templates_service.rb +6 -4
  38. data/lib/basecamp/generated/services/timeline_service.rb +6 -3
  39. data/lib/basecamp/generated/services/timesheets_service.rb +22 -8
  40. data/lib/basecamp/generated/services/todolist_groups_service.rb +7 -4
  41. data/lib/basecamp/generated/services/todolists_service.rb +11 -9
  42. data/lib/basecamp/generated/services/todos_service.rb +23 -14
  43. data/lib/basecamp/generated/services/uploads_service.rb +10 -6
  44. data/lib/basecamp/generated/services/vaults_service.rb +6 -3
  45. data/lib/basecamp/generated/services/webhooks_service.rb +4 -3
  46. data/lib/basecamp/generated/types.rb +847 -147
  47. data/lib/basecamp/http.rb +346 -163
  48. data/lib/basecamp/list_enumerator.rb +29 -0
  49. data/lib/basecamp/list_meta.rb +44 -0
  50. data/lib/basecamp/services/cards_extensions.rb +35 -27
  51. data/lib/basecamp/services/documents_extensions.rb +136 -0
  52. data/lib/basecamp/services/merge_safe.rb +255 -0
  53. data/lib/basecamp/services/schedules_extensions.rb +354 -0
  54. data/lib/basecamp/services/todolists_extensions.rb +274 -0
  55. data/lib/basecamp/services/todos_extensions.rb +22 -6
  56. data/lib/basecamp/validation_error.rb +11 -1
  57. data/lib/basecamp/version.rb +2 -2
  58. data/lib/basecamp.rb +94 -4
  59. data/scripts/generate-services.rb +74 -25
  60. data/scripts/generate-types.rb +2 -1
  61. data/scripts/go_type_spellings.rb +26 -0
  62. metadata +16 -2
@@ -16,23 +16,26 @@ module Basecamp
16
16
  end
17
17
  end
18
18
 
19
- # Update an existing document
19
+ # Replace a document with a new complete representation.
20
20
  # @param document_id [Integer] document id ID
21
21
  # @param title [String, nil] title
22
22
  # @param content [String, nil] content
23
23
  # @return [Hash] response data
24
- def update(document_id:, title: nil, content: nil)
25
- with_operation(service: "documents", operation: "update", is_mutation: true, resource_id: document_id) do
24
+ def replace(document_id:, title: nil, content: nil)
25
+ with_operation(service: "documents", operation: "replace", is_mutation: true, resource_id: document_id) do
26
26
  http_put("/documents/#{document_id}", body: compact_params(title: title, content: content)).json
27
27
  end
28
28
  end
29
29
 
30
30
  # List documents in a vault
31
31
  # @param vault_id [Integer] vault id ID
32
- # @return [Enumerator<Hash>] paginated results
33
- def list(vault_id:)
32
+ # @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.
33
+ # @param max_items [Integer, nil] cap on items yielded across pages; nil or non-positive means no cap
34
+ # @return [ListEnumerator<Hash>] lazily paginated results (#meta carries pagination metadata)
35
+ def list(vault_id:, page: nil, max_items: nil)
34
36
  wrap_paginated(service: "documents", operation: "list", is_mutation: false, resource_id: vault_id) do
35
- paginate("/vaults/#{vault_id}/documents.json", operation: "ListDocuments")
37
+ params = compact_query_params(page: page)
38
+ paginate("/vaults/#{vault_id}/documents.json", params: params, operation: "ListDocuments", max_items: max_items)
36
39
  end
37
40
  end
38
41
 
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Basecamp
4
+ module Services
5
+ # Service for Drafts operations
6
+ #
7
+ # @generated from OpenAPI spec
8
+ class DraftsService < BaseService
9
+
10
+ # List the current user's drafts across their active projects, most recently
11
+ # @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.
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_my_drafts(page: nil, max_items: nil)
15
+ wrap_paginated(service: "drafts", operation: "list_my_drafts", is_mutation: false) do
16
+ params = compact_query_params(page: page)
17
+ paginate("/my/drafts.json", params: params, operation: "ListMyDrafts", max_items: max_items)
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
@@ -9,10 +9,13 @@ module Basecamp
9
9
 
10
10
  # List all events for a recording
11
11
  # @param recording_id [Integer] recording id ID
12
- # @return [Enumerator<Hash>] paginated results
13
- def list(recording_id:)
12
+ # @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.
13
+ # @param max_items [Integer, nil] cap on items yielded across pages; nil or non-positive means no cap
14
+ # @return [ListEnumerator<Hash>] lazily paginated results (#meta carries pagination metadata)
15
+ def list(recording_id:, page: nil, max_items: nil)
14
16
  wrap_paginated(service: "events", operation: "list", is_mutation: false, resource_id: recording_id) do
15
- paginate("/recordings/#{recording_id}/events.json", operation: "ListEvents")
17
+ params = compact_query_params(page: page)
18
+ paginate("/recordings/#{recording_id}/events.json", params: params, operation: "ListEvents", max_items: max_items)
16
19
  end
17
20
  end
18
21
  end
@@ -8,160 +8,207 @@ module Basecamp
8
8
  class EverythingService < BaseService
9
9
 
10
10
  # Completed cards across all accessible projects, grouped by project (paginated).
11
- # @param page [Integer, nil] Page number for paginating through results. Defaults to 1.
12
- # @return [Enumerator<Hash>] paginated results
13
- def get_everything_completed_cards(page: nil)
11
+ # @param assignee_ids [Array, nil] Restrict to tasks assigned to at least one of the given people (repeatable).
12
+ # Assignees on nested steps are not considered.
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. 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)
14
18
  wrap_paginated(service: "everything", operation: "get_everything_completed_cards", is_mutation: false) do
15
- params = compact_query_params(page: page)
16
- paginate("/cards/completed.json", params: params, operation: "GetEverythingCompletedCards")
19
+ params = compact_query_params(assignee_ids: assignee_ids, due: due, page: page)
20
+ paginate("/cards/completed.json", params: params, operation: "GetEverythingCompletedCards", max_items: max_items)
17
21
  end
18
22
  end
19
23
 
20
24
  # Open cards with no due date across all accessible projects, grouped by project (paginated).
21
- # @param page [Integer, nil] Page number for paginating through results. Defaults to 1.
22
- # @return [Enumerator<Hash>] paginated results
23
- def get_everything_no_due_date_cards(page: nil)
25
+ # @param assignee_ids [Array, nil] Restrict to tasks assigned to at least one of the given people (repeatable).
26
+ # Assignees on nested steps are not considered.
27
+ # @param due [String, nil] Filter by due date: with, without, or overdue. Unrecognized values are ignored.
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)
24
32
  wrap_paginated(service: "everything", operation: "get_everything_no_due_date_cards", is_mutation: false) do
25
- params = compact_query_params(page: page)
26
- paginate("/cards/no_due_date.json", params: params, operation: "GetEverythingNoDueDateCards")
33
+ params = compact_query_params(assignee_ids: assignee_ids, due: due, page: page)
34
+ paginate("/cards/no_due_date.json", params: params, operation: "GetEverythingNoDueDateCards", max_items: max_items)
27
35
  end
28
36
  end
29
37
 
30
38
  # Cards parked in a project's "Not now" column across all accessible projects, grouped by project (paginated).
31
- # @param page [Integer, nil] Page number for paginating through results. Defaults to 1.
32
- # @return [Enumerator<Hash>] paginated results
33
- def get_everything_not_now_cards(page: nil)
39
+ # @param assignee_ids [Array, nil] Restrict to tasks assigned to at least one of the given people (repeatable).
40
+ # Assignees on nested steps are not considered.
41
+ # @param due [String, nil] Filter by due date: with, without, or overdue. Unrecognized values are ignored.
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)
34
46
  wrap_paginated(service: "everything", operation: "get_everything_not_now_cards", is_mutation: false) do
35
- params = compact_query_params(page: page)
36
- paginate("/cards/not_now.json", params: params, operation: "GetEverythingNotNowCards")
47
+ params = compact_query_params(assignee_ids: assignee_ids, due: due, page: page)
48
+ paginate("/cards/not_now.json", params: params, operation: "GetEverythingNotNowCards", max_items: max_items)
37
49
  end
38
50
  end
39
51
 
40
52
  # Incomplete cards in active columns across all accessible projects, grouped by project (paginated).
41
- # @param page [Integer, nil] Page number for paginating through results. Defaults to 1.
42
- # @return [Enumerator<Hash>] paginated results
43
- def get_everything_open_cards(page: nil)
53
+ # @param assignee_ids [Array, nil] Restrict to tasks assigned to at least one of the given people (repeatable).
54
+ # Assignees on nested steps are not considered.
55
+ # @param due [String, nil] Filter by due date: with, without, or overdue. Unrecognized values are ignored.
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)
44
60
  wrap_paginated(service: "everything", operation: "get_everything_open_cards", is_mutation: false) do
45
- params = compact_query_params(page: page)
46
- paginate("/cards/open.json", params: params, operation: "GetEverythingOpenCards")
61
+ params = compact_query_params(assignee_ids: assignee_ids, due: due, page: page)
62
+ paginate("/cards/open.json", params: params, operation: "GetEverythingOpenCards", max_items: max_items)
47
63
  end
48
64
  end
49
65
 
50
66
  # Get every overdue card across all accessible projects, oldest-due-date-first.
67
+ # @param assignee_ids [Array, nil] Restrict to tasks assigned to at least one of the given people (repeatable).
68
+ # Assignees on nested steps are not considered.
69
+ # @param due [String, nil] Filter by due date: with, without, or overdue. Unrecognized values are ignored.
51
70
  # @return [Array<Hash>] response data
52
- def get_everything_overdue_cards()
71
+ def get_everything_overdue_cards(assignee_ids: nil, due: nil)
53
72
  with_operation(service: "everything", operation: "get_everything_overdue_cards", is_mutation: false) do
54
- http_get("/cards/overdue.json", operation: "GetEverythingOverdueCards").json
73
+ http_get("/cards/overdue.json", params: compact_query_params(assignee_ids: assignee_ids, due: due), operation: "GetEverythingOverdueCards").json
55
74
  end
56
75
  end
57
76
 
58
77
  # Open, unassigned cards across all accessible projects, grouped by project (paginated).
59
- # @param page [Integer, nil] Page number for paginating through results. Defaults to 1.
60
- # @return [Enumerator<Hash>] paginated results
61
- def get_everything_unassigned_cards(page: nil)
78
+ # @param assignee_ids [Array, nil] Restrict to tasks assigned to at least one of the given people (repeatable).
79
+ # Assignees on nested steps are not considered.
80
+ # @param due [String, nil] Filter by due date: with, without, or overdue. Unrecognized values are ignored.
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)
62
85
  wrap_paginated(service: "everything", operation: "get_everything_unassigned_cards", is_mutation: false) do
63
- params = compact_query_params(page: page)
64
- paginate("/cards/unassigned.json", params: params, operation: "GetEverythingUnassignedCards")
86
+ params = compact_query_params(assignee_ids: assignee_ids, due: due, page: page)
87
+ paginate("/cards/unassigned.json", params: params, operation: "GetEverythingUnassignedCards", max_items: max_items)
65
88
  end
66
89
  end
67
90
 
68
91
  # Get every automatic check-in answer across all accessible projects, newest-first.
69
- # @param page [Integer, nil] Page number for paginating through results. Defaults to 1.
70
- # @return [Enumerator<Hash>] paginated results
71
- 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)
72
96
  wrap_paginated(service: "everything", operation: "get_everything_checkins", is_mutation: false) do
73
97
  params = compact_query_params(page: page)
74
- paginate("/checkins.json", params: params, operation: "GetEverythingCheckins")
98
+ paginate("/checkins.json", params: params, operation: "GetEverythingCheckins", max_items: max_items)
75
99
  end
76
100
  end
77
101
 
78
102
  # Get every comment across all accessible projects, newest-first (paginated).
79
- # @param page [Integer, nil] Page number for paginating through results. Defaults to 1.
80
- # @return [Enumerator<Hash>] paginated results
81
- 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)
82
107
  wrap_paginated(service: "everything", operation: "get_everything_comments", is_mutation: false) do
83
108
  params = compact_query_params(page: page)
84
- paginate("/comments.json", params: params, operation: "GetEverythingComments")
109
+ paginate("/comments.json", params: params, operation: "GetEverythingComments", max_items: max_items)
85
110
  end
86
111
  end
87
112
 
88
113
  # Get every file recording across all accessible projects, newest-first (paginated).
89
114
  # @param kind [String, nil] Filter by file kind: all (default), images, pdfs, documents, or videos.
90
115
  # @param people_ids [Array, nil] Restrict to files created by the given people (repeatable).
91
- # @param page [Integer, nil] Page number for paginating through results. Defaults to 1.
92
- # @return [Enumerator<Hash>] paginated results
93
- 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)
94
120
  wrap_paginated(service: "everything", operation: "get_everything_files", is_mutation: false) do
95
121
  params = compact_query_params(kind: kind, people_ids: people_ids, page: page)
96
- paginate("/files.json", params: params, operation: "GetEverythingFiles")
122
+ paginate("/files.json", params: params, operation: "GetEverythingFiles", max_items: max_items)
97
123
  end
98
124
  end
99
125
 
100
126
  # Get every inbox forward across all accessible projects, newest-first (paginated).
101
- # @param page [Integer, nil] Page number for paginating through results. Defaults to 1.
102
- # @return [Enumerator<Hash>] paginated results
103
- 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)
104
131
  wrap_paginated(service: "everything", operation: "get_everything_forwards", is_mutation: false) do
105
132
  params = compact_query_params(page: page)
106
- paginate("/forwards.json", params: params, operation: "GetEverythingForwards")
133
+ paginate("/forwards.json", params: params, operation: "GetEverythingForwards", max_items: max_items)
107
134
  end
108
135
  end
109
136
 
110
137
  # Get every message across all accessible projects, newest-first (paginated).
111
- # @param page [Integer, nil] Page number for paginating through results. Defaults to 1.
112
- # @return [Enumerator<Hash>] paginated results
113
- 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)
114
142
  wrap_paginated(service: "everything", operation: "get_everything_messages", is_mutation: false) do
115
143
  params = compact_query_params(page: page)
116
- paginate("/messages.json", params: params, operation: "GetEverythingMessages")
144
+ paginate("/messages.json", params: params, operation: "GetEverythingMessages", max_items: max_items)
117
145
  end
118
146
  end
119
147
 
120
148
  # Completed to-dos across all accessible projects, grouped by project (paginated).
121
- # @param page [Integer, nil] Page number for paginating through results. Defaults to 1.
122
- # @return [Enumerator<Hash>] paginated results
123
- def get_everything_completed_todos(page: nil)
149
+ # @param assignee_ids [Array, nil] Restrict to tasks assigned to at least one of the given people (repeatable).
150
+ # Assignees on nested steps are not considered.
151
+ # @param due [String, nil] Filter by due date: with, without, or overdue. Unrecognized values are ignored.
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)
124
156
  wrap_paginated(service: "everything", operation: "get_everything_completed_todos", is_mutation: false) do
125
- params = compact_query_params(page: page)
126
- paginate("/todos/completed.json", params: params, operation: "GetEverythingCompletedTodos")
157
+ params = compact_query_params(assignee_ids: assignee_ids, due: due, page: page)
158
+ paginate("/todos/completed.json", params: params, operation: "GetEverythingCompletedTodos", max_items: max_items)
127
159
  end
128
160
  end
129
161
 
130
162
  # Open to-dos with no due date across all accessible projects, grouped by project (paginated).
131
- # @param page [Integer, nil] Page number for paginating through results. Defaults to 1.
132
- # @return [Enumerator<Hash>] paginated results
133
- def get_everything_no_due_date_todos(page: nil)
163
+ # @param assignee_ids [Array, nil] Restrict to tasks assigned to at least one of the given people (repeatable).
164
+ # Assignees on nested steps are not considered.
165
+ # @param due [String, nil] Filter by due date: with, without, or overdue. Unrecognized values are ignored.
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)
134
170
  wrap_paginated(service: "everything", operation: "get_everything_no_due_date_todos", is_mutation: false) do
135
- params = compact_query_params(page: page)
136
- paginate("/todos/no_due_date.json", params: params, operation: "GetEverythingNoDueDateTodos")
171
+ params = compact_query_params(assignee_ids: assignee_ids, due: due, page: page)
172
+ paginate("/todos/no_due_date.json", params: params, operation: "GetEverythingNoDueDateTodos", max_items: max_items)
137
173
  end
138
174
  end
139
175
 
140
176
  # Active, incomplete to-dos across all accessible projects, grouped by project (paginated).
141
- # @param page [Integer, nil] Page number for paginating through results. Defaults to 1.
142
- # @return [Enumerator<Hash>] paginated results
143
- def get_everything_open_todos(page: nil)
177
+ # @param assignee_ids [Array, nil] Restrict to tasks assigned to at least one of the given people (repeatable).
178
+ # Assignees on nested steps are not considered.
179
+ # @param due [String, nil] Filter by due date: with, without, or overdue. Unrecognized values are ignored.
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)
144
184
  wrap_paginated(service: "everything", operation: "get_everything_open_todos", is_mutation: false) do
145
- params = compact_query_params(page: page)
146
- paginate("/todos/open.json", params: params, operation: "GetEverythingOpenTodos")
185
+ params = compact_query_params(assignee_ids: assignee_ids, due: due, page: page)
186
+ paginate("/todos/open.json", params: params, operation: "GetEverythingOpenTodos", max_items: max_items)
147
187
  end
148
188
  end
149
189
 
150
190
  # Get every overdue to-do across all accessible projects, oldest-due-date-first.
191
+ # @param assignee_ids [Array, nil] Restrict to tasks assigned to at least one of the given people (repeatable).
192
+ # Assignees on nested steps are not considered.
193
+ # @param due [String, nil] Filter by due date: with, without, or overdue. Unrecognized values are ignored.
151
194
  # @return [Array<Hash>] response data
152
- def get_everything_overdue_todos()
195
+ def get_everything_overdue_todos(assignee_ids: nil, due: nil)
153
196
  with_operation(service: "everything", operation: "get_everything_overdue_todos", is_mutation: false) do
154
- http_get("/todos/overdue.json", operation: "GetEverythingOverdueTodos").json
197
+ http_get("/todos/overdue.json", params: compact_query_params(assignee_ids: assignee_ids, due: due), operation: "GetEverythingOverdueTodos").json
155
198
  end
156
199
  end
157
200
 
158
201
  # Open, unassigned to-dos across all accessible projects, grouped by project (paginated).
159
- # @param page [Integer, nil] Page number for paginating through results. Defaults to 1.
160
- # @return [Enumerator<Hash>] paginated results
161
- def get_everything_unassigned_todos(page: nil)
202
+ # @param assignee_ids [Array, nil] Restrict to tasks assigned to at least one of the given people (repeatable).
203
+ # Assignees on nested steps are not considered.
204
+ # @param due [String, nil] Filter by due date: with, without, or overdue. Unrecognized values are ignored.
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)
162
209
  wrap_paginated(service: "everything", operation: "get_everything_unassigned_todos", is_mutation: false) do
163
- params = compact_query_params(page: page)
164
- paginate("/todos/unassigned.json", params: params, operation: "GetEverythingUnassignedTodos")
210
+ params = compact_query_params(assignee_ids: assignee_ids, due: due, page: page)
211
+ paginate("/todos/unassigned.json", params: params, operation: "GetEverythingUnassignedTodos", max_items: max_items)
165
212
  end
166
213
  end
167
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