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
@@ -57,37 +57,52 @@ module Basecamp
57
57
  raise
58
58
  end
59
59
 
60
- # Wraps a lazy Enumerator so operation hooks fire around actual iteration,
61
- # not at enumerator creation time. Hooks fire when the consumer begins
62
- # iterating (.each, .to_a, .first, etc.) and end fires via ensure when
63
- # iteration completes, errors, or is cut short by break/take.
60
+ # Wraps a paginated operation with hooks, preserving the pagination
61
+ # metadata carried by the inner ListEnumerator.
62
+ # Fires on_operation_start eagerly (paginate fetches page 1 inside the
63
+ # yield, so the start hook must precede it); on_operation_end fires via
64
+ # ensure when the first traversal completes, errors, or is cut short by
65
+ # break/take — exactly once, so re-enumerating never emits an
66
+ # on_operation_end without a matching start.
64
67
  def wrap_paginated(service:, operation:, is_mutation: false, project_id: nil, resource_id: nil)
65
68
  info = OperationInfo.new(
66
69
  service: service, operation: operation,
67
70
  is_mutation: is_mutation, project_id: project_id, resource_id: resource_id
68
71
  )
69
- enum = yield
70
-
71
72
  hooks = @hooks
72
- Enumerator.new do |yielder|
73
- start = Process.clock_gettime(Process::CLOCK_MONOTONIC)
73
+ start = Process.clock_gettime(Process::CLOCK_MONOTONIC)
74
+ safe_hook { hooks.on_operation_start(info) }
75
+
76
+ begin
77
+ enum = yield # paginate fetches page 1 here
78
+ rescue => e
79
+ duration = ((Process.clock_gettime(Process::CLOCK_MONOTONIC) - start) * 1000).round
80
+ safe_hook { hooks.on_operation_end(info, OperationResult.new(duration_ms: duration, error: e)) }
81
+ raise
82
+ end
83
+
84
+ ended = false
85
+ ListEnumerator.new(enum.meta) do |yielder|
74
86
  error = nil
75
87
  begin
76
- safe_hook { hooks.on_operation_start(info) }
77
88
  enum.each { |item| yielder.yield(item) }
78
89
  rescue => e
79
90
  error = e
80
91
  raise
81
92
  ensure
82
- duration = ((Process.clock_gettime(Process::CLOCK_MONOTONIC) - start) * 1000).round
83
- safe_hook { hooks.on_operation_end(info, OperationResult.new(duration_ms: duration, error: error)) }
93
+ unless ended
94
+ ended = true
95
+ duration = ((Process.clock_gettime(Process::CLOCK_MONOTONIC) - start) * 1000).round
96
+ safe_hook { hooks.on_operation_end(info, OperationResult.new(duration_ms: duration, error: error)) }
97
+ end
84
98
  end
85
99
  end
86
100
  end
87
101
 
88
102
  # Wraps a wrapped-paginated operation with hooks.
89
- # Fires on_operation_start eagerly (before page 1 fetch),
90
- # on_operation_end when the events Enumerator completes/errors/breaks.
103
+ # Fires on_operation_start eagerly (before page 1 fetch), and
104
+ # on_operation_end exactly once, when the first traversal of the events
105
+ # Enumerator completes/errors/breaks.
91
106
  def wrap_paginated_wrapped(key:, service:, operation:, is_mutation: false, project_id: nil, resource_id: nil)
92
107
  info = OperationInfo.new(
93
108
  service: service, operation: operation,
@@ -106,7 +121,8 @@ module Basecamp
106
121
  end
107
122
 
108
123
  inner_enum = result[key]
109
- wrapped_enum = Enumerator.new do |yielder|
124
+ ended = false
125
+ wrapped_enum = ListEnumerator.new(inner_enum.meta) do |yielder|
110
126
  error = nil
111
127
  begin
112
128
  inner_enum.each { |item| yielder.yield(item) }
@@ -114,8 +130,13 @@ module Basecamp
114
130
  error = e
115
131
  raise
116
132
  ensure
117
- duration = ((Process.clock_gettime(Process::CLOCK_MONOTONIC) - start) * 1000).round
118
- safe_hook { hooks.on_operation_end(info, OperationResult.new(duration_ms: duration, error: error)) }
133
+ # Exactly once: on_operation_start fired once at call time, so
134
+ # re-enumerating must not emit unmatched on_operation_end events.
135
+ unless ended
136
+ ended = true
137
+ duration = ((Process.clock_gettime(Process::CLOCK_MONOTONIC) - start) * 1000).round
138
+ safe_hook { hooks.on_operation_end(info, OperationResult.new(duration_ms: duration, error: error)) }
139
+ end
119
140
  end
120
141
  end
121
142
 
@@ -0,0 +1,50 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Basecamp
4
+ module Services
5
+ # Service for Bookmarks operations
6
+ #
7
+ # @generated from OpenAPI spec
8
+ class BookmarksService < BaseService
9
+
10
+ # List the current user's bookmarks, most recently bookmarked first (paginated).
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_bookmarks(page: nil, max_items: nil)
15
+ wrap_paginated(service: "bookmarks", operation: "list_my_bookmarks", is_mutation: false) do
16
+ params = compact_query_params(page: page)
17
+ paginate("/my/bookmarks.json", params: params, operation: "ListMyBookmarks", max_items: max_items)
18
+ end
19
+ end
20
+
21
+ # Report whether the current user has bookmarked the recording.
22
+ # @param recording_id [Integer] recording id ID
23
+ # @return [Hash] response data
24
+ def get_bookmark(recording_id:)
25
+ with_operation(service: "bookmarks", operation: "get_bookmark", is_mutation: false, resource_id: recording_id) do
26
+ http_get("/recordings/#{recording_id}/bookmark.json", operation: "GetBookmark").json
27
+ end
28
+ end
29
+
30
+ # Bookmark a recording for the current user.
31
+ # @param recording_id [Integer] recording id ID
32
+ # @return [Hash] response data
33
+ def create_bookmark(recording_id:)
34
+ with_operation(service: "bookmarks", operation: "create_bookmark", is_mutation: true, resource_id: recording_id) do
35
+ http_post("/recordings/#{recording_id}/bookmark.json").json
36
+ end
37
+ end
38
+
39
+ # Remove the current user's bookmark from a recording (returns 204 No Content).
40
+ # @param recording_id [Integer] recording id ID
41
+ # @return [void]
42
+ def delete_bookmark(recording_id:)
43
+ with_operation(service: "bookmarks", operation: "delete_bookmark", is_mutation: true, resource_id: recording_id) do
44
+ http_delete("/recordings/#{recording_id}/bookmark.json")
45
+ nil
46
+ end
47
+ end
48
+ end
49
+ end
50
+ end
@@ -28,10 +28,13 @@ module Basecamp
28
28
 
29
29
  # List boosts on a recording
30
30
  # @param recording_id [Integer] recording id ID
31
- # @return [Enumerator<Hash>] paginated results
32
- def list_recording_boosts(recording_id:)
31
+ # @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.
32
+ # @param max_items [Integer, nil] cap on items yielded across pages; nil or non-positive means no cap
33
+ # @return [ListEnumerator<Hash>] lazily paginated results (#meta carries pagination metadata)
34
+ def list_recording_boosts(recording_id:, page: nil, max_items: nil)
33
35
  wrap_paginated(service: "boosts", operation: "list_recording_boosts", is_mutation: false, resource_id: recording_id) do
34
- paginate("/recordings/#{recording_id}/boosts.json", operation: "ListRecordingBoosts")
36
+ params = compact_query_params(page: page)
37
+ paginate("/recordings/#{recording_id}/boosts.json", params: params, operation: "ListRecordingBoosts", max_items: max_items)
35
38
  end
36
39
  end
37
40
 
@@ -48,10 +51,13 @@ module Basecamp
48
51
  # List boosts on a specific event within a recording
49
52
  # @param recording_id [Integer] recording id ID
50
53
  # @param event_id [Integer] event id ID
51
- # @return [Enumerator<Hash>] paginated results
52
- def list_event_boosts(recording_id:, event_id:)
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_event_boosts(recording_id:, event_id:, page: nil, max_items: nil)
53
58
  wrap_paginated(service: "boosts", operation: "list_event_boosts", is_mutation: false, resource_id: event_id) do
54
- paginate("/recordings/#{recording_id}/events/#{event_id}/boosts.json", operation: "ListEventBoosts")
59
+ params = compact_query_params(page: page)
60
+ paginate("/recordings/#{recording_id}/events/#{event_id}/boosts.json", params: params, operation: "ListEventBoosts", max_items: max_items)
55
61
  end
56
62
  end
57
63
 
@@ -0,0 +1,30 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Basecamp
4
+ module Services
5
+ # Service for Calendars operations
6
+ #
7
+ # @generated from OpenAPI spec
8
+ class CalendarsService < BaseService
9
+
10
+ # Get a calendar by its bucket id. A Calendar is a top-level BC5 bucketable
11
+ # @param calendar_id [Integer] calendar id ID
12
+ # @return [Hash] response data
13
+ def get_calendar(calendar_id:)
14
+ with_operation(service: "calendars", operation: "get_calendar", is_mutation: false, resource_id: calendar_id) do
15
+ http_get("/calendars/#{calendar_id}", operation: "GetCalendar").json
16
+ end
17
+ end
18
+
19
+ # Update a calendar's display color. An unknown color returns 422 with a JSON
20
+ # @param calendar_id [Integer] calendar id ID
21
+ # @param calendar [Hash] calendar
22
+ # @return [Hash] response data
23
+ def update_calendar(calendar_id:, calendar:)
24
+ with_operation(service: "calendars", operation: "update_calendar", is_mutation: true, resource_id: calendar_id) do
25
+ http_put("/calendars/#{calendar_id}", body: compact_params(calendar: calendar)).json
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
@@ -9,85 +9,96 @@ module Basecamp
9
9
  # @generated from OpenAPI spec
10
10
  class CampfiresService < BaseService
11
11
 
12
- # List all campfires across the account
13
- # @return [Enumerator<Hash>] paginated results
14
- def list()
15
- wrap_paginated(service: "campfires", operation: "list", is_mutation: false) do
16
- paginate("/chats.json", operation: "ListCampfires")
17
- end
18
- end
19
-
20
- # Get a campfire by ID
21
- # @param campfire_id [Integer] campfire id ID
22
- # @return [Hash] response data
23
- def get(campfire_id:)
24
- with_operation(service: "campfires", operation: "get", is_mutation: false, resource_id: campfire_id) do
25
- http_get("/chats/#{campfire_id}", operation: "GetCampfire").json
26
- end
27
- end
28
-
29
12
  # List all chatbots for a campfire
13
+ # @param bucket_id [Integer] bucket id ID
30
14
  # @param campfire_id [Integer] campfire id ID
31
- # @return [Enumerator<Hash>] paginated results
32
- def list_chatbots(campfire_id:)
33
- wrap_paginated(service: "campfires", operation: "list_chatbots", is_mutation: false, resource_id: campfire_id) do
34
- paginate("/chats/#{campfire_id}/integrations.json", operation: "ListChatbots")
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_chatbots(bucket_id:, campfire_id:, max_items: nil)
18
+ wrap_paginated(service: "campfires", operation: "list_chatbots", is_mutation: false, project_id: bucket_id, resource_id: campfire_id) do
19
+ paginate("/buckets/#{bucket_id}/chats/#{campfire_id}/integrations.json", operation: "ListChatbots", max_items: max_items)
35
20
  end
36
21
  end
37
22
 
38
23
  # Create a new chatbot for a campfire
24
+ # @param bucket_id [Integer] bucket id ID
39
25
  # @param campfire_id [Integer] campfire id ID
40
26
  # @param service_name [String] service name
41
27
  # @param command_url [String, nil] command url
42
28
  # @return [Hash] response data
43
- def create_chatbot(campfire_id:, service_name:, command_url: nil)
44
- with_operation(service: "campfires", operation: "create_chatbot", is_mutation: true, resource_id: campfire_id) do
45
- http_post("/chats/#{campfire_id}/integrations.json", body: compact_params(service_name: service_name, command_url: command_url)).json
29
+ def create_chatbot(bucket_id:, campfire_id:, service_name:, command_url: nil)
30
+ with_operation(service: "campfires", operation: "create_chatbot", is_mutation: true, project_id: bucket_id, resource_id: campfire_id) do
31
+ http_post("/buckets/#{bucket_id}/chats/#{campfire_id}/integrations.json", body: compact_params(service_name: service_name, command_url: command_url)).json
46
32
  end
47
33
  end
48
34
 
49
35
  # Get a chatbot by ID
36
+ # @param bucket_id [Integer] bucket id ID
50
37
  # @param campfire_id [Integer] campfire id ID
51
38
  # @param chatbot_id [Integer] chatbot id ID
52
39
  # @return [Hash] response data
53
- def get_chatbot(campfire_id:, chatbot_id:)
54
- with_operation(service: "campfires", operation: "get_chatbot", is_mutation: false, resource_id: chatbot_id) do
55
- http_get("/chats/#{campfire_id}/integrations/#{chatbot_id}", operation: "GetChatbot").json
40
+ def get_chatbot(bucket_id:, campfire_id:, chatbot_id:)
41
+ with_operation(service: "campfires", operation: "get_chatbot", is_mutation: false, project_id: bucket_id, resource_id: chatbot_id) do
42
+ http_get("/buckets/#{bucket_id}/chats/#{campfire_id}/integrations/#{chatbot_id}", operation: "GetChatbot").json
56
43
  end
57
44
  end
58
45
 
59
46
  # Update an existing chatbot
47
+ # @param bucket_id [Integer] bucket id ID
60
48
  # @param campfire_id [Integer] campfire id ID
61
49
  # @param chatbot_id [Integer] chatbot id ID
62
50
  # @param service_name [String] service name
63
51
  # @param command_url [String, nil] command url
64
52
  # @return [Hash] response data
65
- def update_chatbot(campfire_id:, chatbot_id:, service_name:, command_url: nil)
66
- with_operation(service: "campfires", operation: "update_chatbot", is_mutation: true, resource_id: chatbot_id) do
67
- http_put("/chats/#{campfire_id}/integrations/#{chatbot_id}", body: compact_params(service_name: service_name, command_url: command_url)).json
53
+ def update_chatbot(bucket_id:, campfire_id:, chatbot_id:, service_name:, command_url: nil)
54
+ with_operation(service: "campfires", operation: "update_chatbot", is_mutation: true, project_id: bucket_id, resource_id: chatbot_id) do
55
+ http_put("/buckets/#{bucket_id}/chats/#{campfire_id}/integrations/#{chatbot_id}", body: compact_params(service_name: service_name, command_url: command_url)).json
68
56
  end
69
57
  end
70
58
 
71
59
  # Delete a chatbot
60
+ # @param bucket_id [Integer] bucket id ID
72
61
  # @param campfire_id [Integer] campfire id ID
73
62
  # @param chatbot_id [Integer] chatbot id ID
74
63
  # @return [void]
75
- def delete_chatbot(campfire_id:, chatbot_id:)
76
- with_operation(service: "campfires", operation: "delete_chatbot", is_mutation: true, resource_id: chatbot_id) do
77
- http_delete("/chats/#{campfire_id}/integrations/#{chatbot_id}")
64
+ def delete_chatbot(bucket_id:, campfire_id:, chatbot_id:)
65
+ with_operation(service: "campfires", operation: "delete_chatbot", is_mutation: true, project_id: bucket_id, resource_id: chatbot_id) do
66
+ http_delete("/buckets/#{bucket_id}/chats/#{campfire_id}/integrations/#{chatbot_id}")
78
67
  nil
79
68
  end
80
69
  end
81
70
 
71
+ # List all campfires across the account
72
+ # @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.
73
+ # @param max_items [Integer, nil] cap on items yielded across pages; nil or non-positive means no cap
74
+ # @return [ListEnumerator<Hash>] lazily paginated results (#meta carries pagination metadata)
75
+ def list(page: nil, max_items: nil)
76
+ wrap_paginated(service: "campfires", operation: "list", is_mutation: false) do
77
+ params = compact_query_params(page: page)
78
+ paginate("/chats.json", params: params, operation: "ListCampfires", max_items: max_items)
79
+ end
80
+ end
81
+
82
+ # Get a campfire by ID
83
+ # @param campfire_id [Integer] campfire id ID
84
+ # @return [Hash] response data
85
+ def get(campfire_id:)
86
+ with_operation(service: "campfires", operation: "get", is_mutation: false, resource_id: campfire_id) do
87
+ http_get("/chats/#{campfire_id}", operation: "GetCampfire").json
88
+ end
89
+ end
90
+
82
91
  # List all lines (messages) in a campfire
83
92
  # @param campfire_id [Integer] campfire id ID
84
93
  # @param sort [String, nil] created_at|updated_at
85
94
  # @param direction [String, nil] asc|desc
86
- # @return [Enumerator<Hash>] paginated results
87
- def list_lines(campfire_id:, sort: nil, direction: nil)
95
+ # @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.
96
+ # @param max_items [Integer, nil] cap on items yielded across pages; nil or non-positive means no cap
97
+ # @return [ListEnumerator<Hash>] lazily paginated results (#meta carries pagination metadata)
98
+ def list_lines(campfire_id:, sort: nil, direction: nil, page: nil, max_items: nil)
88
99
  wrap_paginated(service: "campfires", operation: "list_lines", is_mutation: false, resource_id: campfire_id) do
89
- params = compact_query_params(sort: sort, direction: direction)
90
- paginate("/chats/#{campfire_id}/lines.json", params: params, operation: "ListCampfireLines")
100
+ params = compact_query_params(sort: sort, direction: direction, page: page)
101
+ paginate("/chats/#{campfire_id}/lines.json", params: params, operation: "ListCampfireLines", max_items: max_items)
91
102
  end
92
103
  end
93
104
 
@@ -139,11 +150,13 @@ module Basecamp
139
150
  # @param campfire_id [Integer] campfire id ID
140
151
  # @param sort [String, nil] created_at|updated_at
141
152
  # @param direction [String, nil] asc|desc
142
- # @return [Enumerator<Hash>] paginated results
143
- def list_uploads(campfire_id:, sort: nil, direction: nil)
153
+ # @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.
154
+ # @param max_items [Integer, nil] cap on items yielded across pages; nil or non-positive means no cap
155
+ # @return [ListEnumerator<Hash>] lazily paginated results (#meta carries pagination metadata)
156
+ def list_uploads(campfire_id:, sort: nil, direction: nil, page: nil, max_items: nil)
144
157
  wrap_paginated(service: "campfires", operation: "list_uploads", is_mutation: false, resource_id: campfire_id) do
145
- params = compact_query_params(sort: sort, direction: direction)
146
- paginate("/chats/#{campfire_id}/uploads.json", params: params, operation: "ListCampfireUploads")
158
+ params = compact_query_params(sort: sort, direction: direction, page: page)
159
+ paginate("/chats/#{campfire_id}/uploads.json", params: params, operation: "ListCampfireUploads", max_items: max_items)
147
160
  end
148
161
  end
149
162
 
@@ -43,10 +43,13 @@ module Basecamp
43
43
 
44
44
  # List cards in a column
45
45
  # @param column_id [Integer] column id ID
46
- # @return [Enumerator<Hash>] paginated results
47
- def list(column_id:)
46
+ # @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.
47
+ # @param max_items [Integer, nil] cap on items yielded across pages; nil or non-positive means no cap
48
+ # @return [ListEnumerator<Hash>] lazily paginated results (#meta carries pagination metadata)
49
+ def list(column_id:, page: nil, max_items: nil)
48
50
  wrap_paginated(service: "cards", operation: "list", is_mutation: false, resource_id: column_id) do
49
- paginate("/card_tables/lists/#{column_id}/cards.json", operation: "ListCards")
51
+ params = compact_query_params(page: page)
52
+ paginate("/card_tables/lists/#{column_id}/cards.json", params: params, operation: "ListCards", max_items: max_items)
50
53
  end
51
54
  end
52
55
 
@@ -8,10 +8,13 @@ module Basecamp
8
8
  class CheckinsService < BaseService
9
9
 
10
10
  # Get pending check-in reminders for the current user
11
- # @return [Enumerator<Hash>] paginated results
12
- def reminders()
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 reminders(page: nil, max_items: nil)
13
15
  wrap_paginated(service: "checkins", operation: "reminders", is_mutation: false) do
14
- paginate("/my/question_reminders.json", operation: "GetQuestionReminders")
16
+ params = compact_query_params(page: page)
17
+ paginate("/my/question_reminders.json", params: params, operation: "GetQuestionReminders", max_items: max_items)
15
18
  end
16
19
  end
17
20
 
@@ -47,10 +50,13 @@ module Basecamp
47
50
 
48
51
  # List all questions in a questionnaire
49
52
  # @param questionnaire_id [Integer] questionnaire id ID
50
- # @return [Enumerator<Hash>] paginated results
51
- def list_questions(questionnaire_id:)
53
+ # @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.
54
+ # @param max_items [Integer, nil] cap on items yielded across pages; nil or non-positive means no cap
55
+ # @return [ListEnumerator<Hash>] lazily paginated results (#meta carries pagination metadata)
56
+ def list_questions(questionnaire_id:, page: nil, max_items: nil)
52
57
  wrap_paginated(service: "checkins", operation: "list_questions", is_mutation: false, resource_id: questionnaire_id) do
53
- paginate("/questionnaires/#{questionnaire_id}/questions.json", operation: "ListQuestions")
58
+ params = compact_query_params(page: page)
59
+ paginate("/questionnaires/#{questionnaire_id}/questions.json", params: params, operation: "ListQuestions", max_items: max_items)
54
60
  end
55
61
  end
56
62
 
@@ -89,10 +95,13 @@ module Basecamp
89
95
 
90
96
  # List all answers for a question
91
97
  # @param question_id [Integer] question id ID
92
- # @return [Enumerator<Hash>] paginated results
93
- def list_answers(question_id:)
98
+ # @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.
99
+ # @param max_items [Integer, nil] cap on items yielded across pages; nil or non-positive means no cap
100
+ # @return [ListEnumerator<Hash>] lazily paginated results (#meta carries pagination metadata)
101
+ def list_answers(question_id:, page: nil, max_items: nil)
94
102
  wrap_paginated(service: "checkins", operation: "list_answers", is_mutation: false, resource_id: question_id) do
95
- paginate("/questions/#{question_id}/answers.json", operation: "ListAnswers")
103
+ params = compact_query_params(page: page)
104
+ paginate("/questions/#{question_id}/answers.json", params: params, operation: "ListAnswers", max_items: max_items)
96
105
  end
97
106
  end
98
107
 
@@ -109,20 +118,24 @@ module Basecamp
109
118
 
110
119
  # List all people who have answered a question (answerers)
111
120
  # @param question_id [Integer] question id ID
112
- # @return [Enumerator<Hash>] paginated results
113
- def answerers(question_id:)
121
+ # @param max_items [Integer, nil] cap on items yielded across pages; nil or non-positive means no cap
122
+ # @return [ListEnumerator<Hash>] lazily paginated results (#meta carries pagination metadata)
123
+ def answerers(question_id:, max_items: nil)
114
124
  wrap_paginated(service: "checkins", operation: "answerers", is_mutation: false, resource_id: question_id) do
115
- paginate("/questions/#{question_id}/answers/by.json", operation: "ListQuestionAnswerers")
125
+ paginate("/questions/#{question_id}/answers/by.json", operation: "ListQuestionAnswerers", max_items: max_items)
116
126
  end
117
127
  end
118
128
 
119
129
  # Get all answers from a specific person for a question
120
130
  # @param question_id [Integer] question id ID
121
131
  # @param person_id [Integer] person id ID
122
- # @return [Enumerator<Hash>] paginated results
123
- def by_person(question_id:, person_id:)
132
+ # @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.
133
+ # @param max_items [Integer, nil] cap on items yielded across pages; nil or non-positive means no cap
134
+ # @return [ListEnumerator<Hash>] lazily paginated results (#meta carries pagination metadata)
135
+ def by_person(question_id:, person_id:, page: nil, max_items: nil)
124
136
  wrap_paginated(service: "checkins", operation: "by_person", is_mutation: false, resource_id: person_id) do
125
- paginate("/questions/#{question_id}/answers/by/#{person_id}", operation: "GetAnswersByPerson")
137
+ params = compact_query_params(page: page)
138
+ paginate("/questions/#{question_id}/answers/by/#{person_id}", params: params, operation: "GetAnswersByPerson", max_items: max_items)
126
139
  end
127
140
  end
128
141
 
@@ -8,13 +8,16 @@ module Basecamp
8
8
  class ClientApprovalsService < BaseService
9
9
 
10
10
  # List all client approvals in a project
11
+ # @param bucket_id [Integer] bucket id ID
11
12
  # @param sort [String, nil] created_at|updated_at
12
13
  # @param direction [String, nil] asc|desc
13
- # @return [Enumerator<Hash>] paginated results
14
- def list(sort: nil, direction: nil)
15
- wrap_paginated(service: "clientapprovals", operation: "list", is_mutation: false) do
16
- params = compact_query_params(sort: sort, direction: direction)
17
- paginate("/client/approvals.json", params: params, operation: "ListClientApprovals")
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(bucket_id:, sort: nil, direction: nil, page: nil, max_items: nil)
18
+ wrap_paginated(service: "clientapprovals", operation: "list", is_mutation: false, project_id: bucket_id) do
19
+ params = compact_query_params(sort: sort, direction: direction, page: page)
20
+ paginate("/buckets/#{bucket_id}/client/approvals.json", params: params, operation: "ListClientApprovals", max_items: max_items)
18
21
  end
19
22
  end
20
23
 
@@ -8,13 +8,16 @@ module Basecamp
8
8
  class ClientCorrespondencesService < BaseService
9
9
 
10
10
  # List all client correspondences in a project
11
+ # @param bucket_id [Integer] bucket id ID
11
12
  # @param sort [String, nil] created_at|updated_at
12
13
  # @param direction [String, nil] asc|desc
13
- # @return [Enumerator<Hash>] paginated results
14
- def list(sort: nil, direction: nil)
15
- wrap_paginated(service: "clientcorrespondences", operation: "list", is_mutation: false) do
16
- params = compact_query_params(sort: sort, direction: direction)
17
- paginate("/client/correspondences.json", params: params, operation: "ListClientCorrespondences")
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(bucket_id:, sort: nil, direction: nil, page: nil, max_items: nil)
18
+ wrap_paginated(service: "clientcorrespondences", operation: "list", is_mutation: false, project_id: bucket_id) do
19
+ params = compact_query_params(sort: sort, direction: direction, page: page)
20
+ paginate("/buckets/#{bucket_id}/client/correspondences.json", params: params, operation: "ListClientCorrespondences", max_items: max_items)
18
21
  end
19
22
  end
20
23
 
@@ -8,21 +8,26 @@ module Basecamp
8
8
  class ClientRepliesService < BaseService
9
9
 
10
10
  # List all client replies for a recording (correspondence or approval)
11
+ # @param bucket_id [Integer] bucket id ID
11
12
  # @param recording_id [Integer] recording id ID
12
- # @return [Enumerator<Hash>] paginated results
13
- def list(recording_id:)
14
- wrap_paginated(service: "clientreplies", operation: "list", is_mutation: false, resource_id: recording_id) do
15
- paginate("/client/recordings/#{recording_id}/replies.json", operation: "ListClientReplies")
13
+ # @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.
14
+ # @param max_items [Integer, nil] cap on items yielded across pages; nil or non-positive means no cap
15
+ # @return [ListEnumerator<Hash>] lazily paginated results (#meta carries pagination metadata)
16
+ def list(bucket_id:, recording_id:, page: nil, max_items: nil)
17
+ wrap_paginated(service: "clientreplies", operation: "list", is_mutation: false, project_id: bucket_id, resource_id: recording_id) do
18
+ params = compact_query_params(page: page)
19
+ paginate("/buckets/#{bucket_id}/client/recordings/#{recording_id}/replies.json", params: params, operation: "ListClientReplies", max_items: max_items)
16
20
  end
17
21
  end
18
22
 
19
23
  # Get a single client reply by id
24
+ # @param bucket_id [Integer] bucket id ID
20
25
  # @param recording_id [Integer] recording id ID
21
26
  # @param reply_id [Integer] reply id ID
22
27
  # @return [Hash] response data
23
- def get(recording_id:, reply_id:)
24
- with_operation(service: "clientreplies", operation: "get", is_mutation: false, resource_id: reply_id) do
25
- http_get("/client/recordings/#{recording_id}/replies/#{reply_id}", operation: "GetClientReply").json
28
+ def get(bucket_id:, recording_id:, reply_id:)
29
+ with_operation(service: "clientreplies", operation: "get", is_mutation: false, project_id: bucket_id, resource_id: reply_id) do
30
+ http_get("/buckets/#{bucket_id}/client/recordings/#{recording_id}/replies/#{reply_id}", operation: "GetClientReply").json
26
31
  end
27
32
  end
28
33
  end
@@ -0,0 +1,57 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Basecamp
4
+ module Services
5
+ # Service for CloudFiles operations
6
+ #
7
+ # @generated from OpenAPI spec
8
+ class CloudFilesService < BaseService
9
+
10
+ # Create a new cloud file 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 service [String] Short identifier for the external service — "dropbox", "google_doc",
15
+ # "figma", "other", … Derived from the CloudFile::Service subclass name, so it
16
+ # is always present. `other` accepts any well-formed HTTPS URL.
17
+ # @param title [String, nil] title
18
+ # @param description [String, nil] description
19
+ # @param subscriptions [Array, nil] subscriptions
20
+ # @param visible_to_clients [Boolean, nil] Whether the cloud file is visible to the project's clients. Applies only
21
+ # when creating directly in the tool's vault — an item created inside a
22
+ # folder inherits the folder's visibility and ignores this. A client caller
23
+ # always creates client-visible records regardless of what is sent.
24
+ # @return [Hash] response data
25
+ def create_cloud_file(bucket_id:, vault_id:, url:, service:, title: nil, description: nil, subscriptions: nil, visible_to_clients: nil)
26
+ with_operation(service: "cloudfiles", operation: "create_cloud_file", is_mutation: true, project_id: bucket_id, resource_id: vault_id) do
27
+ http_post("/buckets/#{bucket_id}/vaults/#{vault_id}/cloud_files.json", body: compact_params(url: url, service: service, title: title, description: description, subscriptions: subscriptions, visible_to_clients: visible_to_clients)).json
28
+ end
29
+ end
30
+
31
+ # Get a single cloud file by id
32
+ # @param cloud_file_id [Integer] cloud file id ID
33
+ # @return [Hash] response data
34
+ def get_cloud_file(cloud_file_id:)
35
+ with_operation(service: "cloudfiles", operation: "get_cloud_file", is_mutation: false, resource_id: cloud_file_id) do
36
+ http_get("/cloud_files/#{cloud_file_id}", operation: "GetCloudFile").json
37
+ end
38
+ end
39
+
40
+ # Replace a cloud file with a new complete representation.
41
+ # @param cloud_file_id [Integer] cloud file id ID
42
+ # @param url [String] url
43
+ # @param service [String] Short identifier for the external service — "dropbox", "google_doc",
44
+ # "figma", "other", … Derived from the CloudFile::Service subclass name, so it
45
+ # is always present. `other` accepts any well-formed HTTPS URL.
46
+ # @param title [String, nil] title
47
+ # @param description [String, nil] description
48
+ # @param subscriptions [Array, nil] subscriptions
49
+ # @return [Hash] response data
50
+ def update_cloud_file(cloud_file_id:, url:, service:, title: nil, description: nil, subscriptions: nil)
51
+ with_operation(service: "cloudfiles", operation: "update_cloud_file", is_mutation: true, resource_id: cloud_file_id) do
52
+ http_put("/cloud_files/#{cloud_file_id}", body: compact_params(url: url, service: service, title: title, description: description, subscriptions: subscriptions)).json
53
+ end
54
+ end
55
+ end
56
+ end
57
+ end
@@ -28,10 +28,13 @@ module Basecamp
28
28
 
29
29
  # List comments on a recording
30
30
  # @param recording_id [Integer] recording id ID
31
- # @return [Enumerator<Hash>] paginated results
32
- def list(recording_id:)
31
+ # @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.
32
+ # @param max_items [Integer, nil] cap on items yielded across pages; nil or non-positive means no cap
33
+ # @return [ListEnumerator<Hash>] lazily paginated results (#meta carries pagination metadata)
34
+ def list(recording_id:, page: nil, max_items: nil)
33
35
  wrap_paginated(service: "comments", operation: "list", is_mutation: false, resource_id: recording_id) do
34
- paginate("/recordings/#{recording_id}/comments.json", operation: "ListComments")
36
+ params = compact_query_params(page: page)
37
+ paginate("/recordings/#{recording_id}/comments.json", params: params, operation: "ListComments", max_items: max_items)
35
38
  end
36
39
  end
37
40