handinger 0.6.0 → 0.8.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 (39) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +16 -0
  3. data/README.md +3 -3
  4. data/lib/handinger/models/workers/update_webhook.rb +22 -0
  5. data/lib/handinger/models/workers/webhook.rb +32 -0
  6. data/lib/handinger/models/workers/webhook_delete_params.rb +22 -0
  7. data/lib/handinger/models/workers/webhook_execution.rb +102 -0
  8. data/lib/handinger/models/workers/webhook_execution_list.rb +42 -0
  9. data/lib/handinger/models/workers/webhook_list_executions_params.rb +31 -0
  10. data/lib/handinger/models/workers/webhook_regenerate_token_params.rb +22 -0
  11. data/lib/handinger/models/workers/webhook_retrieve_params.rb +22 -0
  12. data/lib/handinger/models/workers/webhook_update_params.rb +22 -0
  13. data/lib/handinger/resources/workers/webhooks.rb +138 -0
  14. data/lib/handinger/resources/workers.rb +5 -0
  15. data/lib/handinger/version.rb +1 -1
  16. data/lib/handinger.rb +10 -0
  17. data/rbi/handinger/models/workers/update_webhook.rbi +34 -0
  18. data/rbi/handinger/models/workers/webhook.rbi +45 -0
  19. data/rbi/handinger/models/workers/webhook_delete_params.rbi +40 -0
  20. data/rbi/handinger/models/workers/webhook_execution.rbi +146 -0
  21. data/rbi/handinger/models/workers/webhook_execution_list.rbi +64 -0
  22. data/rbi/handinger/models/workers/webhook_list_executions_params.rbi +57 -0
  23. data/rbi/handinger/models/workers/webhook_regenerate_token_params.rbi +40 -0
  24. data/rbi/handinger/models/workers/webhook_retrieve_params.rbi +40 -0
  25. data/rbi/handinger/models/workers/webhook_update_params.rbi +40 -0
  26. data/rbi/handinger/resources/workers/webhooks.rbi +101 -0
  27. data/rbi/handinger/resources/workers.rbi +4 -0
  28. data/sig/handinger/models/workers/update_webhook.rbs +15 -0
  29. data/sig/handinger/models/workers/webhook.rbs +17 -0
  30. data/sig/handinger/models/workers/webhook_delete_params.rbs +25 -0
  31. data/sig/handinger/models/workers/webhook_execution.rbs +78 -0
  32. data/sig/handinger/models/workers/webhook_execution_list.rbs +37 -0
  33. data/sig/handinger/models/workers/webhook_list_executions_params.rbs +32 -0
  34. data/sig/handinger/models/workers/webhook_regenerate_token_params.rbs +25 -0
  35. data/sig/handinger/models/workers/webhook_retrieve_params.rbs +25 -0
  36. data/sig/handinger/models/workers/webhook_update_params.rbs +27 -0
  37. data/sig/handinger/resources/workers/webhooks.rbs +36 -0
  38. data/sig/handinger/resources/workers.rbs +2 -0
  39. metadata +32 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 03e43a5f9df9dc47be5da0cb54df3bbd3a9caa7b0f32e35981f4375b443774e4
4
- data.tar.gz: 105454fa3a99cc7b62cf7241dd8dfaf72190f01f5208f171da41265cd577f8e3
3
+ metadata.gz: c2da95055e66f45cde46af0ef457dd77d4583bd7946d6f3c244fb9281f93b0e4
4
+ data.tar.gz: 8735d12d6338850b6ca41a70cff2ab88b6b1f0b67dacc7722743ca79962c6a16
5
5
  SHA512:
6
- metadata.gz: 8ac4f97f05e1380cffc03eccbbd7343e6cbe10d6d5c23a491f5e36a4e76c58febb0db9dbed58d627cfba60062feda20df24214fe87883f9ae10f968ac5fc65c4
7
- data.tar.gz: 8b9fa07b57feebd1066bac295f738ab3bf66a239c68b6a988e895212774c5dda056fbb4a1dde66ff94d01c182a02cfd4a2da73c983d29a73665b75c06e675143
6
+ metadata.gz: 06e00886ab79b1ef3daf23fc66b732611f37065f7d8f9585ff18e48c00798430b4264f94bcdc594353bb3e5277ae5e29ca6ad549a8cc38c36e5da2c20ee2161c
7
+ data.tar.gz: c6da45cc9db8b1a80166d30c45fc191d15ec6deb62973ae2f563cf911fff0acca95d6df67527d5f4199e74f7c79ab826b3d3ad40ffbc62112f4b8bf459306dbe
data/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.8.0 (2026-05-11)
4
+
5
+ Full Changelog: [v0.7.0...v0.8.0](https://github.com/ramensoft/handinger-ruby/compare/v0.7.0...v0.8.0)
6
+
7
+ ### Features
8
+
9
+ * **api:** api update ([96453f6](https://github.com/ramensoft/handinger-ruby/commit/96453f63068bbf90122a10ffdfccec3c1760395f))
10
+
11
+ ## 0.7.0 (2026-05-11)
12
+
13
+ Full Changelog: [v0.6.0...v0.7.0](https://github.com/Ramensoft/handinger-ruby/compare/v0.6.0...v0.7.0)
14
+
15
+ ### Features
16
+
17
+ * Add Webhook API docs ([a35a412](https://github.com/Ramensoft/handinger-ruby/commit/a35a412297f5103e8856e2da5d72891a3dde3a91))
18
+
3
19
  ## 0.6.0 (2026-05-11)
4
20
 
5
21
  Full Changelog: [v0.5.0...v0.6.0](https://github.com/Ramensoft/handinger-ruby/compare/v0.5.0...v0.6.0)
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Handinger Ruby API library
2
2
 
3
- The Handinger Ruby library provides convenient access to the Handinger REST API from any Ruby 3.2.0+ application. It ships with comprehensive types & docstrings in Yard, RBS, and RBI – [see below](https://github.com/Ramensoft/handinger-ruby#Sorbet) for usage with Sorbet. The standard library's `net/http` is used as the HTTP transport, with connection pooling via the `connection_pool` gem.
3
+ The Handinger Ruby library provides convenient access to the Handinger REST API from any Ruby 3.2.0+ application. It ships with comprehensive types & docstrings in Yard, RBS, and RBI – [see below](https://github.com/ramensoft/handinger-ruby#Sorbet) for usage with Sorbet. The standard library's `net/http` is used as the HTTP transport, with connection pooling via the `connection_pool` gem.
4
4
 
5
5
  It is generated with [Stainless](https://www.stainless.com/).
6
6
 
@@ -17,7 +17,7 @@ To use this gem, install via Bundler by adding the following to your application
17
17
  <!-- x-release-please-start-version -->
18
18
 
19
19
  ```ruby
20
- gem "handinger", "~> 0.6.0"
20
+ gem "handinger", "~> 0.8.0"
21
21
  ```
22
22
 
23
23
  <!-- x-release-please-end -->
@@ -244,4 +244,4 @@ Ruby 3.2.0 or higher.
244
244
 
245
245
  ## Contributing
246
246
 
247
- See [the contributing documentation](https://github.com/Ramensoft/handinger-ruby/tree/main/CONTRIBUTING.md).
247
+ See [the contributing documentation](https://github.com/ramensoft/handinger-ruby/tree/main/CONTRIBUTING.md).
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Handinger
4
+ module Models
5
+ module Workers
6
+ class UpdateWebhook < Handinger::Internal::Type::BaseModel
7
+ # @!attribute url
8
+ # HTTPS endpoint Handinger should POST to when a task finishes. Pass `null` to
9
+ # remove the webhook and clear its token.
10
+ #
11
+ # @return [String, nil]
12
+ required :url, String, nil?: true
13
+
14
+ # @!method initialize(url:)
15
+ # Some parameter documentations has been truncated, see
16
+ # {Handinger::Models::Workers::UpdateWebhook} for more details.
17
+ #
18
+ # @param url [String, nil] HTTPS endpoint Handinger should POST to when a task finishes. Pass `null` to rem
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,32 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Handinger
4
+ module Models
5
+ module Workers
6
+ # @see Handinger::Resources::Workers::Webhooks#retrieve
7
+ class Webhook < Handinger::Internal::Type::BaseModel
8
+ # @!attribute token
9
+ # Shared secret sent in the `X-Handinger-Token` header on each delivery. `null`
10
+ # when no webhook is configured.
11
+ #
12
+ # @return [String, nil]
13
+ required :token, String, nil?: true
14
+
15
+ # @!attribute url
16
+ # HTTPS endpoint that receives webhook deliveries when a task completes. `null`
17
+ # when no webhook is configured.
18
+ #
19
+ # @return [String, nil]
20
+ required :url, String, nil?: true
21
+
22
+ # @!method initialize(token:, url:)
23
+ # Some parameter documentations has been truncated, see
24
+ # {Handinger::Models::Workers::Webhook} for more details.
25
+ #
26
+ # @param token [String, nil] Shared secret sent in the `X-Handinger-Token` header on each delivery. `null` wh
27
+ #
28
+ # @param url [String, nil] HTTPS endpoint that receives webhook deliveries when a task completes. `null` wh
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Handinger
4
+ module Models
5
+ module Workers
6
+ # @see Handinger::Resources::Workers::Webhooks#delete
7
+ class WebhookDeleteParams < Handinger::Internal::Type::BaseModel
8
+ extend Handinger::Internal::Type::RequestParameters::Converter
9
+ include Handinger::Internal::Type::RequestParameters
10
+
11
+ # @!attribute worker_id
12
+ #
13
+ # @return [String]
14
+ required :worker_id, String
15
+
16
+ # @!method initialize(worker_id:, request_options: {})
17
+ # @param worker_id [String]
18
+ # @param request_options [Handinger::RequestOptions, Hash{Symbol=>Object}]
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,102 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Handinger
4
+ module Models
5
+ module Workers
6
+ class WebhookExecution < Handinger::Internal::Type::BaseModel
7
+ # @!attribute id
8
+ #
9
+ # @return [String]
10
+ required :id, String
11
+
12
+ # @!attribute created_at
13
+ #
14
+ # @return [Time]
15
+ required :created_at, Time, api_name: :createdAt
16
+
17
+ # @!attribute duration_ms
18
+ # Wall-clock time spent on the delivery attempt.
19
+ #
20
+ # @return [Integer]
21
+ required :duration_ms, Integer, api_name: :durationMs
22
+
23
+ # @!attribute error_message
24
+ # Failure reason when `requestStatus` is `error`.
25
+ #
26
+ # @return [String, nil]
27
+ required :error_message, String, api_name: :errorMessage, nil?: true
28
+
29
+ # @!attribute request_status
30
+ # `success` when the endpoint returned a 2xx response, `error` otherwise.
31
+ #
32
+ # @return [Symbol, Handinger::Models::Workers::WebhookExecution::RequestStatus]
33
+ required :request_status,
34
+ enum: -> { Handinger::Workers::WebhookExecution::RequestStatus },
35
+ api_name: :requestStatus
36
+
37
+ # @!attribute response_status
38
+ # HTTP status returned by the endpoint, when reachable.
39
+ #
40
+ # @return [Integer, nil]
41
+ required :response_status, Integer, api_name: :responseStatus, nil?: true
42
+
43
+ # @!attribute task_id
44
+ # Task that triggered the delivery, when available.
45
+ #
46
+ # @return [String, nil]
47
+ required :task_id, String, api_name: :taskId, nil?: true
48
+
49
+ # @!attribute task_title
50
+ # Title of the originating task, when available.
51
+ #
52
+ # @return [String, nil]
53
+ required :task_title, String, api_name: :taskTitle, nil?: true
54
+
55
+ # @!attribute url
56
+ # Endpoint Handinger attempted to deliver to.
57
+ #
58
+ # @return [String]
59
+ required :url, String
60
+
61
+ # @!attribute worker_id
62
+ #
63
+ # @return [String]
64
+ required :worker_id, String, api_name: :workerId
65
+
66
+ # @!method initialize(id:, created_at:, duration_ms:, error_message:, request_status:, response_status:, task_id:, task_title:, url:, worker_id:)
67
+ # @param id [String]
68
+ #
69
+ # @param created_at [Time]
70
+ #
71
+ # @param duration_ms [Integer] Wall-clock time spent on the delivery attempt.
72
+ #
73
+ # @param error_message [String, nil] Failure reason when `requestStatus` is `error`.
74
+ #
75
+ # @param request_status [Symbol, Handinger::Models::Workers::WebhookExecution::RequestStatus] `success` when the endpoint returned a 2xx response, `error` otherwise.
76
+ #
77
+ # @param response_status [Integer, nil] HTTP status returned by the endpoint, when reachable.
78
+ #
79
+ # @param task_id [String, nil] Task that triggered the delivery, when available.
80
+ #
81
+ # @param task_title [String, nil] Title of the originating task, when available.
82
+ #
83
+ # @param url [String] Endpoint Handinger attempted to deliver to.
84
+ #
85
+ # @param worker_id [String]
86
+
87
+ # `success` when the endpoint returned a 2xx response, `error` otherwise.
88
+ #
89
+ # @see Handinger::Models::Workers::WebhookExecution#request_status
90
+ module RequestStatus
91
+ extend Handinger::Internal::Type::Enum
92
+
93
+ SUCCESS = :success
94
+ ERROR = :error
95
+
96
+ # @!method self.values
97
+ # @return [Array<Symbol>]
98
+ end
99
+ end
100
+ end
101
+ end
102
+ end
@@ -0,0 +1,42 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Handinger
4
+ module Models
5
+ module Workers
6
+ # @see Handinger::Resources::Workers::Webhooks#list_executions
7
+ class WebhookExecutionList < Handinger::Internal::Type::BaseModel
8
+ # @!attribute logs
9
+ #
10
+ # @return [Array<Handinger::Models::Workers::WebhookExecution>]
11
+ required :logs, -> { Handinger::Internal::Type::ArrayOf[Handinger::Workers::WebhookExecution] }
12
+
13
+ # @!attribute page
14
+ # Current page number.
15
+ #
16
+ # @return [Integer]
17
+ required :page, Integer
18
+
19
+ # @!attribute page_count
20
+ # Total number of pages available.
21
+ #
22
+ # @return [Integer]
23
+ required :page_count, Integer, api_name: :pageCount
24
+
25
+ # @!attribute total_count
26
+ # Total number of executions recorded.
27
+ #
28
+ # @return [Integer]
29
+ required :total_count, Integer, api_name: :totalCount
30
+
31
+ # @!method initialize(logs:, page:, page_count:, total_count:)
32
+ # @param logs [Array<Handinger::Models::Workers::WebhookExecution>]
33
+ #
34
+ # @param page [Integer] Current page number.
35
+ #
36
+ # @param page_count [Integer] Total number of pages available.
37
+ #
38
+ # @param total_count [Integer] Total number of executions recorded.
39
+ end
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Handinger
4
+ module Models
5
+ module Workers
6
+ # @see Handinger::Resources::Workers::Webhooks#list_executions
7
+ class WebhookListExecutionsParams < Handinger::Internal::Type::BaseModel
8
+ extend Handinger::Internal::Type::RequestParameters::Converter
9
+ include Handinger::Internal::Type::RequestParameters
10
+
11
+ # @!attribute worker_id
12
+ #
13
+ # @return [String]
14
+ required :worker_id, String
15
+
16
+ # @!attribute page
17
+ # Page number (1-indexed). Defaults to 1.
18
+ #
19
+ # @return [Integer, nil]
20
+ optional :page, Integer
21
+
22
+ # @!method initialize(worker_id:, page: nil, request_options: {})
23
+ # @param worker_id [String]
24
+ #
25
+ # @param page [Integer] Page number (1-indexed). Defaults to 1.
26
+ #
27
+ # @param request_options [Handinger::RequestOptions, Hash{Symbol=>Object}]
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Handinger
4
+ module Models
5
+ module Workers
6
+ # @see Handinger::Resources::Workers::Webhooks#regenerate_token
7
+ class WebhookRegenerateTokenParams < Handinger::Internal::Type::BaseModel
8
+ extend Handinger::Internal::Type::RequestParameters::Converter
9
+ include Handinger::Internal::Type::RequestParameters
10
+
11
+ # @!attribute worker_id
12
+ #
13
+ # @return [String]
14
+ required :worker_id, String
15
+
16
+ # @!method initialize(worker_id:, request_options: {})
17
+ # @param worker_id [String]
18
+ # @param request_options [Handinger::RequestOptions, Hash{Symbol=>Object}]
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Handinger
4
+ module Models
5
+ module Workers
6
+ # @see Handinger::Resources::Workers::Webhooks#retrieve
7
+ class WebhookRetrieveParams < Handinger::Internal::Type::BaseModel
8
+ extend Handinger::Internal::Type::RequestParameters::Converter
9
+ include Handinger::Internal::Type::RequestParameters
10
+
11
+ # @!attribute worker_id
12
+ #
13
+ # @return [String]
14
+ required :worker_id, String
15
+
16
+ # @!method initialize(worker_id:, request_options: {})
17
+ # @param worker_id [String]
18
+ # @param request_options [Handinger::RequestOptions, Hash{Symbol=>Object}]
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Handinger
4
+ module Models
5
+ module Workers
6
+ # @see Handinger::Resources::Workers::Webhooks#update
7
+ class WebhookUpdateParams < Handinger::Models::Workers::UpdateWebhook
8
+ extend Handinger::Internal::Type::RequestParameters::Converter
9
+ include Handinger::Internal::Type::RequestParameters
10
+
11
+ # @!attribute worker_id
12
+ #
13
+ # @return [String]
14
+ required :worker_id, String
15
+
16
+ # @!method initialize(worker_id:, request_options: {})
17
+ # @param worker_id [String]
18
+ # @param request_options [Handinger::RequestOptions, Hash{Symbol=>Object}]
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,138 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Handinger
4
+ module Resources
5
+ class Workers
6
+ # Configure outbound webhooks delivered when a worker's tasks complete.
7
+ class Webhooks
8
+ # Retrieve the webhook URL and shared token configured for a worker. Both fields
9
+ # are `null` when no webhook is configured. Only the worker creator can read the
10
+ # webhook configuration.
11
+ #
12
+ # @overload retrieve(worker_id, request_options: {})
13
+ #
14
+ # @param worker_id [String] Worker id returned by the create worker endpoint.
15
+ #
16
+ # @param request_options [Handinger::RequestOptions, Hash{Symbol=>Object}, nil]
17
+ #
18
+ # @return [Handinger::Models::Workers::Webhook]
19
+ #
20
+ # @see Handinger::Models::Workers::WebhookRetrieveParams
21
+ def retrieve(worker_id, params = {})
22
+ @client.request(
23
+ method: :get,
24
+ path: ["api/workers/%1$s/webhook", worker_id],
25
+ model: Handinger::Workers::Webhook,
26
+ options: params[:request_options]
27
+ )
28
+ end
29
+
30
+ # Some parameter documentations has been truncated, see
31
+ # {Handinger::Models::Workers::WebhookUpdateParams} for more details.
32
+ #
33
+ # Set or replace the webhook URL for a worker. A fresh token is generated the
34
+ # first time a URL is set; subsequent updates keep the existing token. Pass
35
+ # `url: null` to clear the webhook (use the dedicated DELETE for the same effect).
36
+ # Only the worker creator can update the webhook.
37
+ #
38
+ # @overload update(worker_id, url:, request_options: {})
39
+ #
40
+ # @param worker_id [String] Worker id returned by the create worker endpoint.
41
+ #
42
+ # @param url [String, nil] HTTPS endpoint Handinger should POST to when a task finishes. Pass `null` to rem
43
+ #
44
+ # @param request_options [Handinger::RequestOptions, Hash{Symbol=>Object}, nil]
45
+ #
46
+ # @return [Handinger::Models::Workers::Webhook]
47
+ #
48
+ # @see Handinger::Models::Workers::WebhookUpdateParams
49
+ def update(worker_id, params)
50
+ parsed, options = Handinger::Workers::WebhookUpdateParams.dump_request(params)
51
+ @client.request(
52
+ method: :put,
53
+ path: ["api/workers/%1$s/webhook", worker_id],
54
+ body: parsed,
55
+ model: Handinger::Workers::Webhook,
56
+ options: options
57
+ )
58
+ end
59
+
60
+ # Remove the webhook from a worker. Both `url` and `token` are cleared and no
61
+ # further deliveries are attempted. Only the worker creator can delete the
62
+ # webhook.
63
+ #
64
+ # @overload delete(worker_id, request_options: {})
65
+ #
66
+ # @param worker_id [String] Worker id returned by the create worker endpoint.
67
+ #
68
+ # @param request_options [Handinger::RequestOptions, Hash{Symbol=>Object}, nil]
69
+ #
70
+ # @return [Handinger::Models::Workers::Webhook]
71
+ #
72
+ # @see Handinger::Models::Workers::WebhookDeleteParams
73
+ def delete(worker_id, params = {})
74
+ @client.request(
75
+ method: :delete,
76
+ path: ["api/workers/%1$s/webhook", worker_id],
77
+ model: Handinger::Workers::Webhook,
78
+ options: params[:request_options]
79
+ )
80
+ end
81
+
82
+ # List recent webhook delivery attempts for a worker, newest first, paginated 50
83
+ # per page. Only the worker creator can read execution history.
84
+ #
85
+ # @overload list_executions(worker_id, page: nil, request_options: {})
86
+ #
87
+ # @param worker_id [String] Worker id returned by the create worker endpoint.
88
+ #
89
+ # @param page [Integer] Page number (1-indexed). Defaults to 1.
90
+ #
91
+ # @param request_options [Handinger::RequestOptions, Hash{Symbol=>Object}, nil]
92
+ #
93
+ # @return [Handinger::Models::Workers::WebhookExecutionList]
94
+ #
95
+ # @see Handinger::Models::Workers::WebhookListExecutionsParams
96
+ def list_executions(worker_id, params = {})
97
+ parsed, options = Handinger::Workers::WebhookListExecutionsParams.dump_request(params)
98
+ query = Handinger::Internal::Util.encode_query_params(parsed)
99
+ @client.request(
100
+ method: :get,
101
+ path: ["api/workers/%1$s/webhook/executions", worker_id],
102
+ query: query,
103
+ model: Handinger::Workers::WebhookExecutionList,
104
+ options: options
105
+ )
106
+ end
107
+
108
+ # Issue a new shared token for the webhook, invalidating the previous one. The
109
+ # webhook URL is preserved. Only the worker creator can regenerate the token.
110
+ #
111
+ # @overload regenerate_token(worker_id, request_options: {})
112
+ #
113
+ # @param worker_id [String] Worker id returned by the create worker endpoint.
114
+ #
115
+ # @param request_options [Handinger::RequestOptions, Hash{Symbol=>Object}, nil]
116
+ #
117
+ # @return [Handinger::Models::Workers::Webhook]
118
+ #
119
+ # @see Handinger::Models::Workers::WebhookRegenerateTokenParams
120
+ def regenerate_token(worker_id, params = {})
121
+ @client.request(
122
+ method: :post,
123
+ path: ["api/workers/%1$s/webhook/regenerate-token", worker_id],
124
+ model: Handinger::Workers::Webhook,
125
+ options: params[:request_options]
126
+ )
127
+ end
128
+
129
+ # @api private
130
+ #
131
+ # @param client [Handinger::Client]
132
+ def initialize(client:)
133
+ @client = client
134
+ end
135
+ end
136
+ end
137
+ end
138
+ end
@@ -8,6 +8,10 @@ module Handinger
8
8
  # @return [Handinger::Resources::Workers::Schedules]
9
9
  attr_reader :schedules
10
10
 
11
+ # Configure outbound webhooks delivered when a worker's tasks complete.
12
+ # @return [Handinger::Resources::Workers::Webhooks]
13
+ attr_reader :webhooks
14
+
11
15
  # Some parameter documentations has been truncated, see
12
16
  # {Handinger::Models::WorkerCreateParams} for more details.
13
17
  #
@@ -159,6 +163,7 @@ module Handinger
159
163
  def initialize(client:)
160
164
  @client = client
161
165
  @schedules = Handinger::Resources::Workers::Schedules.new(client: client)
166
+ @webhooks = Handinger::Resources::Workers::Webhooks.new(client: client)
162
167
  end
163
168
  end
164
169
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Handinger
4
- VERSION = "0.6.0"
4
+ VERSION = "0.8.0"
5
5
  end
data/lib/handinger.rb CHANGED
@@ -54,6 +54,7 @@ require_relative "handinger/internal/transport/pooled_net_requester"
54
54
  require_relative "handinger/client"
55
55
  require_relative "handinger/models/create_task"
56
56
  require_relative "handinger/models/create_worker"
57
+ require_relative "handinger/models/workers/update_webhook"
57
58
  require_relative "handinger/models/update_worker"
58
59
  require_relative "handinger/models/delete_task_response"
59
60
  require_relative "handinger/models/delete_worker_response"
@@ -73,6 +74,14 @@ require_relative "handinger/models/workers/schedule_cancel_response"
73
74
  require_relative "handinger/models/workers/schedule_create_params"
74
75
  require_relative "handinger/models/workers/schedule_list_params"
75
76
  require_relative "handinger/models/workers/schedule_list_response"
77
+ require_relative "handinger/models/workers/webhook"
78
+ require_relative "handinger/models/workers/webhook_delete_params"
79
+ require_relative "handinger/models/workers/webhook_execution"
80
+ require_relative "handinger/models/workers/webhook_execution_list"
81
+ require_relative "handinger/models/workers/webhook_list_executions_params"
82
+ require_relative "handinger/models/workers/webhook_regenerate_token_params"
83
+ require_relative "handinger/models/workers/webhook_retrieve_params"
84
+ require_relative "handinger/models/workers/webhook_update_params"
76
85
  require_relative "handinger/models/workers/worker_schedule"
77
86
  require_relative "handinger/models/worker_template"
78
87
  require_relative "handinger/models/worker_update_params"
@@ -80,3 +89,4 @@ require_relative "handinger/models"
80
89
  require_relative "handinger/resources/tasks"
81
90
  require_relative "handinger/resources/workers"
82
91
  require_relative "handinger/resources/workers/schedules"
92
+ require_relative "handinger/resources/workers/webhooks"
@@ -0,0 +1,34 @@
1
+ # typed: strong
2
+
3
+ module Handinger
4
+ module Models
5
+ module Workers
6
+ class UpdateWebhook < Handinger::Internal::Type::BaseModel
7
+ OrHash =
8
+ T.type_alias do
9
+ T.any(
10
+ Handinger::Workers::UpdateWebhook,
11
+ Handinger::Internal::AnyHash
12
+ )
13
+ end
14
+
15
+ # HTTPS endpoint Handinger should POST to when a task finishes. Pass `null` to
16
+ # remove the webhook and clear its token.
17
+ sig { returns(T.nilable(String)) }
18
+ attr_accessor :url
19
+
20
+ sig { params(url: T.nilable(String)).returns(T.attached_class) }
21
+ def self.new(
22
+ # HTTPS endpoint Handinger should POST to when a task finishes. Pass `null` to
23
+ # remove the webhook and clear its token.
24
+ url:
25
+ )
26
+ end
27
+
28
+ sig { override.returns({ url: T.nilable(String) }) }
29
+ def to_hash
30
+ end
31
+ end
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,45 @@
1
+ # typed: strong
2
+
3
+ module Handinger
4
+ module Models
5
+ module Workers
6
+ class Webhook < Handinger::Internal::Type::BaseModel
7
+ OrHash =
8
+ T.type_alias do
9
+ T.any(Handinger::Workers::Webhook, Handinger::Internal::AnyHash)
10
+ end
11
+
12
+ # Shared secret sent in the `X-Handinger-Token` header on each delivery. `null`
13
+ # when no webhook is configured.
14
+ sig { returns(T.nilable(String)) }
15
+ attr_accessor :token
16
+
17
+ # HTTPS endpoint that receives webhook deliveries when a task completes. `null`
18
+ # when no webhook is configured.
19
+ sig { returns(T.nilable(String)) }
20
+ attr_accessor :url
21
+
22
+ sig do
23
+ params(token: T.nilable(String), url: T.nilable(String)).returns(
24
+ T.attached_class
25
+ )
26
+ end
27
+ def self.new(
28
+ # Shared secret sent in the `X-Handinger-Token` header on each delivery. `null`
29
+ # when no webhook is configured.
30
+ token:,
31
+ # HTTPS endpoint that receives webhook deliveries when a task completes. `null`
32
+ # when no webhook is configured.
33
+ url:
34
+ )
35
+ end
36
+
37
+ sig do
38
+ override.returns({ token: T.nilable(String), url: T.nilable(String) })
39
+ end
40
+ def to_hash
41
+ end
42
+ end
43
+ end
44
+ end
45
+ end