hivehook 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/LICENSE +21 -0
- data/README.md +53 -0
- data/lib/hivehook/errors.rb +36 -0
- data/lib/hivehook/resources/alert_rule_service.rb +44 -0
- data/lib/hivehook/resources/api_key_service.rb +34 -0
- data/lib/hivehook/resources/application_service.rb +39 -0
- data/lib/hivehook/resources/audit_log_service.rb +24 -0
- data/lib/hivehook/resources/base_service.rb +22 -0
- data/lib/hivehook/resources/bookmark_service.rb +29 -0
- data/lib/hivehook/resources/delivery_service.rb +24 -0
- data/lib/hivehook/resources/destination_service.rb +44 -0
- data/lib/hivehook/resources/dlq_service.rb +39 -0
- data/lib/hivehook/resources/endpoint_service.rb +44 -0
- data/lib/hivehook/resources/event_service.rb +24 -0
- data/lib/hivehook/resources/event_type_schema_service.rb +39 -0
- data/lib/hivehook/resources/message_service.rb +39 -0
- data/lib/hivehook/resources/organization_service.rb +74 -0
- data/lib/hivehook/resources/outbound_delivery_service.rb +24 -0
- data/lib/hivehook/resources/outbound_dlq_service.rb +39 -0
- data/lib/hivehook/resources/portal_service.rb +12 -0
- data/lib/hivehook/resources/source_service.rb +49 -0
- data/lib/hivehook/resources/status_service.rb +12 -0
- data/lib/hivehook/resources/stream_consumer_service.rb +40 -0
- data/lib/hivehook/resources/stream_service.rb +39 -0
- data/lib/hivehook/resources/stream_sink_service.rb +40 -0
- data/lib/hivehook/resources/subscription_service.rb +39 -0
- data/lib/hivehook/resources/transformation_service.rb +44 -0
- data/lib/hivehook/resources/user_service.rb +39 -0
- data/lib/hivehook/transport.rb +151 -0
- data/lib/hivehook/version.rb +5 -0
- data/lib/hivehook/webhook.rb +63 -0
- data/lib/hivehook.rb +76 -0
- metadata +110 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 83773b61f9eeb24c46400c370de13e0a9fc01a4cc72b5cb38eb2f8b2596574c0
|
|
4
|
+
data.tar.gz: 158c806493df64e7af4c6cbc094f5006273e3ba3f81bf5f07c97b98f38cbdd7d
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: ab0801f1c2be0e6d206b2b3be255305993561591b49043f5884c4092a6fb229fe01057af4c97731228d43a148dbb7669ee1cedde40343022181f36ffcd63a238
|
|
7
|
+
data.tar.gz: 9f1f8ad4047ac983cc1cc21cb5eb739f172745c01fdbc727bb9b26b79755ea3c415cf05875a245f262556f0effc7b330215a068d6638bd193a031e7eaf6937a6
|
data/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Hivehook
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# hivehook (Ruby)
|
|
2
|
+
|
|
3
|
+
Official Ruby client for [Hivehook](https://hivehook.com), the self-hostable webhook gateway (inbound + outbound).
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
gem install hivehook
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Or in your `Gemfile`:
|
|
12
|
+
|
|
13
|
+
```ruby
|
|
14
|
+
gem "hivehook"
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Quick start
|
|
18
|
+
|
|
19
|
+
```ruby
|
|
20
|
+
require "hivehook"
|
|
21
|
+
|
|
22
|
+
client = Hivehook::Client.new(
|
|
23
|
+
base_url: "http://localhost:8080",
|
|
24
|
+
api_key: ENV.fetch("HIVEHOOK_API_KEY"),
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
source = client.sources.create(
|
|
28
|
+
"name" => "Stripe production",
|
|
29
|
+
"slug" => "stripe-prod",
|
|
30
|
+
"providerType" => "stripe",
|
|
31
|
+
"verifyConfig" => { "secret" => "whsec_..." },
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
puts "created source #{source['id']}. POST webhooks to /ingest/#{source['slug']}"
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Webhook signature verification
|
|
38
|
+
|
|
39
|
+
```ruby
|
|
40
|
+
require "hivehook/webhook"
|
|
41
|
+
|
|
42
|
+
signature = request.headers["X-Hivehook-Signature"]
|
|
43
|
+
timestamp = request.headers["X-Hivehook-Timestamp"].to_i
|
|
44
|
+
ok = Hivehook::Webhook.verify(body, "your-signing-secret", signature, timestamp, 300)
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Documentation
|
|
48
|
+
|
|
49
|
+
See the full reference at [hivehook.com/docs](https://hivehook.com/docs).
|
|
50
|
+
|
|
51
|
+
## License
|
|
52
|
+
|
|
53
|
+
MIT. See [LICENSE](LICENSE).
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Hivehook
|
|
4
|
+
class HivehookError < StandardError; end
|
|
5
|
+
|
|
6
|
+
class APIError < HivehookError
|
|
7
|
+
attr_reader :status_code, :extensions, :graphql_code
|
|
8
|
+
|
|
9
|
+
def initialize(message, status_code = nil, extensions: nil, graphql_code: nil)
|
|
10
|
+
super(message)
|
|
11
|
+
@status_code = status_code
|
|
12
|
+
@extensions = extensions
|
|
13
|
+
@graphql_code = graphql_code
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
class AuthError < APIError
|
|
18
|
+
def initialize(message = "unauthorized", status_code = 401, extensions: nil, graphql_code: nil)
|
|
19
|
+
super(message, status_code, extensions: extensions, graphql_code: graphql_code)
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
class NotFoundError < APIError; end
|
|
24
|
+
class ConflictError < APIError; end
|
|
25
|
+
class ValidationError < APIError; end
|
|
26
|
+
class ServerError < APIError; end
|
|
27
|
+
|
|
28
|
+
class RateLimitError < APIError
|
|
29
|
+
attr_reader :retry_after
|
|
30
|
+
|
|
31
|
+
def initialize(message, status_code = 429, retry_after: nil, extensions: nil, graphql_code: nil)
|
|
32
|
+
super(message, status_code, extensions: extensions, graphql_code: graphql_code)
|
|
33
|
+
@retry_after = retry_after
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Hivehook
|
|
4
|
+
module Resources
|
|
5
|
+
class AlertRuleService < BaseService
|
|
6
|
+
FRAGMENT = "id name conditionType threshold webhookUrl channel emailConfig { to subjectTemplate } slackConfig { webhookUrl channel } cooldown enabled createdAt"
|
|
7
|
+
|
|
8
|
+
def list(options = {})
|
|
9
|
+
query = "query($enabled: Boolean, $search: String, $limit: Int, $offset: Int, $after: String, $first: Int) {
|
|
10
|
+
alertRules(enabled: $enabled, search: $search, limit: $limit, offset: $offset, after: $after, first: $first) {
|
|
11
|
+
nodes { #{FRAGMENT} }
|
|
12
|
+
pageInfo { total limit offset endCursor hasNextPage }
|
|
13
|
+
}
|
|
14
|
+
}"
|
|
15
|
+
@transport.execute(query, build_variables(options, %w[enabled search limit offset after first]))["alertRules"]
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def get(id)
|
|
19
|
+
query = "query($id: UUID!) { alertRule(id: $id) { #{FRAGMENT} } }"
|
|
20
|
+
@transport.execute(query, { "id" => id })["alertRule"]
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def create(input)
|
|
24
|
+
query = "mutation($input: CreateAlertRuleInput!) { createAlertRule(input: $input) { #{FRAGMENT} } }"
|
|
25
|
+
@transport.execute(query, { "input" => input })["createAlertRule"]
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def update(id, input)
|
|
29
|
+
query = "mutation($id: UUID!, $input: UpdateAlertRuleInput!) { updateAlertRule(id: $id, input: $input) { #{FRAGMENT} } }"
|
|
30
|
+
@transport.execute(query, { "id" => id, "input" => input })["updateAlertRule"]
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def delete(id)
|
|
34
|
+
query = "mutation($id: UUID!) { deleteAlertRule(id: $id) }"
|
|
35
|
+
@transport.execute(query, { "id" => id })["deleteAlertRule"]
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def test(id)
|
|
39
|
+
query = "mutation($id: UUID!) { testAlertRule(id: $id) }"
|
|
40
|
+
@transport.execute(query, { "id" => id })["testAlertRule"]
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Hivehook
|
|
4
|
+
module Resources
|
|
5
|
+
class APIKeyService < BaseService
|
|
6
|
+
FRAGMENT = "id name keyPrefix scopes sourceIds createdAt expiresAt revokedAt lastUsedAt"
|
|
7
|
+
|
|
8
|
+
def list(options = {})
|
|
9
|
+
query = "query($search: String, $limit: Int, $offset: Int) {
|
|
10
|
+
apiKeys(search: $search, limit: $limit, offset: $offset) {
|
|
11
|
+
nodes { #{FRAGMENT} }
|
|
12
|
+
pageInfo { total limit offset endCursor hasNextPage }
|
|
13
|
+
}
|
|
14
|
+
}"
|
|
15
|
+
@transport.execute(query, build_variables(options, %w[search limit offset]))["apiKeys"]
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def get(id)
|
|
19
|
+
query = "query($id: UUID!) { apiKey(id: $id) { #{FRAGMENT} } }"
|
|
20
|
+
@transport.execute(query, { "id" => id })["apiKey"]
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def create(input)
|
|
24
|
+
query = "mutation($input: CreateAPIKeyInput!) { createAPIKey(input: $input) { apiKey { #{FRAGMENT} } rawKey } }"
|
|
25
|
+
@transport.execute(query, { "input" => input })["createAPIKey"]
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def revoke(id)
|
|
29
|
+
query = "mutation($id: UUID!) { revokeAPIKey(id: $id) }"
|
|
30
|
+
@transport.execute(query, { "id" => id })["revokeAPIKey"]
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Hivehook
|
|
4
|
+
module Resources
|
|
5
|
+
class ApplicationService < BaseService
|
|
6
|
+
FRAGMENT = "id name uid createdAt"
|
|
7
|
+
|
|
8
|
+
def list(options = {})
|
|
9
|
+
query = "query($search: String, $limit: Int, $offset: Int, $after: String, $first: Int) {
|
|
10
|
+
applications(search: $search, limit: $limit, offset: $offset, after: $after, first: $first) {
|
|
11
|
+
nodes { #{FRAGMENT} }
|
|
12
|
+
pageInfo { total limit offset endCursor hasNextPage }
|
|
13
|
+
}
|
|
14
|
+
}"
|
|
15
|
+
@transport.execute(query, build_variables(options, %w[search limit offset after first]))["applications"]
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def get(id)
|
|
19
|
+
query = "query($id: UUID!) { application(id: $id) { #{FRAGMENT} } }"
|
|
20
|
+
@transport.execute(query, { "id" => id })["application"]
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def create(input)
|
|
24
|
+
query = "mutation($input: CreateApplicationInput!) { createApplication(input: $input) { #{FRAGMENT} } }"
|
|
25
|
+
@transport.execute(query, { "input" => input })["createApplication"]
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def update(id, input)
|
|
29
|
+
query = "mutation($id: UUID!, $input: UpdateApplicationInput!) { updateApplication(id: $id, input: $input) { #{FRAGMENT} } }"
|
|
30
|
+
@transport.execute(query, { "id" => id, "input" => input })["updateApplication"]
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def delete(id)
|
|
34
|
+
query = "mutation($id: UUID!) { deleteApplication(id: $id) }"
|
|
35
|
+
@transport.execute(query, { "id" => id })["deleteApplication"]
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Hivehook
|
|
4
|
+
module Resources
|
|
5
|
+
class AuditLogService < BaseService
|
|
6
|
+
FRAGMENT = "id actorType actorId actorName action resourceType resourceId orgId ipAddress userAgent details createdAt"
|
|
7
|
+
|
|
8
|
+
def list(options = {})
|
|
9
|
+
query = "query($actorType: String, $resourceType: String, $resourceId: UUID, $action: String, $since: Time, $until: Time, $search: String, $limit: Int, $offset: Int, $after: String, $first: Int) {
|
|
10
|
+
auditLogs(actorType: $actorType, resourceType: $resourceType, resourceId: $resourceId, action: $action, since: $since, until: $until, search: $search, limit: $limit, offset: $offset, after: $after, first: $first) {
|
|
11
|
+
nodes { #{FRAGMENT} }
|
|
12
|
+
pageInfo { total limit offset endCursor hasNextPage }
|
|
13
|
+
}
|
|
14
|
+
}"
|
|
15
|
+
@transport.execute(query, build_variables(options, %w[actorType resourceType resourceId action since until search limit offset after first]))["auditLogs"]
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def get(id)
|
|
19
|
+
query = "query($id: UUID!) { auditLog(id: $id) { #{FRAGMENT} } }"
|
|
20
|
+
@transport.execute(query, { "id" => id })["auditLog"]
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Hivehook
|
|
4
|
+
module Resources
|
|
5
|
+
class BaseService
|
|
6
|
+
def initialize(transport)
|
|
7
|
+
@transport = transport
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
private
|
|
11
|
+
|
|
12
|
+
def build_variables(options, allowed)
|
|
13
|
+
vars = {}
|
|
14
|
+
allowed.each do |key|
|
|
15
|
+
sym = key.to_sym
|
|
16
|
+
vars[key] = options[sym] if options.key?(sym)
|
|
17
|
+
end
|
|
18
|
+
vars
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Hivehook
|
|
4
|
+
module Resources
|
|
5
|
+
class BookmarkService < BaseService
|
|
6
|
+
FRAGMENT = "id eventId name notes createdAt"
|
|
7
|
+
|
|
8
|
+
def list(options = {})
|
|
9
|
+
query = "query($eventId: UUID, $search: String, $limit: Int, $offset: Int, $after: String, $first: Int) {
|
|
10
|
+
bookmarks(eventId: $eventId, search: $search, limit: $limit, offset: $offset, after: $after, first: $first) {
|
|
11
|
+
nodes { #{FRAGMENT} }
|
|
12
|
+
pageInfo { total limit offset endCursor hasNextPage }
|
|
13
|
+
}
|
|
14
|
+
}"
|
|
15
|
+
@transport.execute(query, build_variables(options, %w[eventId search limit offset after first]))["bookmarks"]
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def create(input)
|
|
19
|
+
query = "mutation($input: CreateBookmarkInput!) { createBookmark(input: $input) { #{FRAGMENT} } }"
|
|
20
|
+
@transport.execute(query, { "input" => input })["createBookmark"]
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def delete(id)
|
|
24
|
+
query = "mutation($id: UUID!) { deleteBookmark(id: $id) }"
|
|
25
|
+
@transport.execute(query, { "id" => id })["deleteBookmark"]
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Hivehook
|
|
4
|
+
module Resources
|
|
5
|
+
class DeliveryService < BaseService
|
|
6
|
+
FRAGMENT = "id eventId subscriptionId destinationId status attempts maxAttempts nextAttemptAt createdAt"
|
|
7
|
+
|
|
8
|
+
def list(options = {})
|
|
9
|
+
query = "query($eventId: UUID, $destinationId: UUID, $subscriptionId: UUID, $status: DeliveryStatus, $search: String, $limit: Int, $offset: Int, $after: String, $first: Int) {
|
|
10
|
+
deliveries(eventId: $eventId, destinationId: $destinationId, subscriptionId: $subscriptionId, status: $status, search: $search, limit: $limit, offset: $offset, after: $after, first: $first) {
|
|
11
|
+
nodes { #{FRAGMENT} }
|
|
12
|
+
pageInfo { total limit offset endCursor hasNextPage }
|
|
13
|
+
}
|
|
14
|
+
}"
|
|
15
|
+
@transport.execute(query, build_variables(options, %w[eventId destinationId subscriptionId status search limit offset after first]))["deliveries"]
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def get(id)
|
|
19
|
+
query = "query($id: UUID!) { delivery(id: $id) { #{FRAGMENT} } }"
|
|
20
|
+
@transport.execute(query, { "id" => id })["delivery"]
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Hivehook
|
|
4
|
+
module Resources
|
|
5
|
+
class DestinationService < BaseService
|
|
6
|
+
FRAGMENT = "id name url signingSecret status type typeConfig timeoutMs rateLimitRps headers authType deliveryMode ordered blockedDeliveryId healthScore disabledReason healthConfig { windowHours disableBelow } outputFormat createdAt"
|
|
7
|
+
|
|
8
|
+
def list(options = {})
|
|
9
|
+
query = "query($status: DestinationStatus, $search: String, $limit: Int, $offset: Int, $after: String, $first: Int) {
|
|
10
|
+
destinations(status: $status, search: $search, limit: $limit, offset: $offset, after: $after, first: $first) {
|
|
11
|
+
nodes { #{FRAGMENT} }
|
|
12
|
+
pageInfo { total limit offset endCursor hasNextPage }
|
|
13
|
+
}
|
|
14
|
+
}"
|
|
15
|
+
@transport.execute(query, build_variables(options, %w[status search limit offset after first]))["destinations"]
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def get(id)
|
|
19
|
+
query = "query($id: UUID!) { destination(id: $id) { #{FRAGMENT} } }"
|
|
20
|
+
@transport.execute(query, { "id" => id })["destination"]
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def create(input)
|
|
24
|
+
query = "mutation($input: CreateDestinationInput!) { createDestination(input: $input) { #{FRAGMENT} } }"
|
|
25
|
+
@transport.execute(query, { "input" => input })["createDestination"]
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def update(id, input)
|
|
29
|
+
query = "mutation($id: UUID!, $input: UpdateDestinationInput!) { updateDestination(id: $id, input: $input) { #{FRAGMENT} } }"
|
|
30
|
+
@transport.execute(query, { "id" => id, "input" => input })["updateDestination"]
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def delete(id)
|
|
34
|
+
query = "mutation($id: UUID!) { deleteDestination(id: $id) }"
|
|
35
|
+
@transport.execute(query, { "id" => id })["deleteDestination"]
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def rotate_secret(id)
|
|
39
|
+
query = "mutation($id: UUID!) { rotateDestinationSecret(id: $id) { #{FRAGMENT} } }"
|
|
40
|
+
@transport.execute(query, { "id" => id })["rotateDestinationSecret"]
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Hivehook
|
|
4
|
+
module Resources
|
|
5
|
+
class DLQService < BaseService
|
|
6
|
+
FRAGMENT = "id deliveryId eventId lastError replayedAt createdAt"
|
|
7
|
+
|
|
8
|
+
def list(options = {})
|
|
9
|
+
query = "query($eventId: UUID, $replayed: Boolean, $search: String, $limit: Int, $offset: Int, $after: String, $first: Int) {
|
|
10
|
+
dlqEntries(eventId: $eventId, replayed: $replayed, search: $search, limit: $limit, offset: $offset, after: $after, first: $first) {
|
|
11
|
+
nodes { #{FRAGMENT} }
|
|
12
|
+
pageInfo { total limit offset endCursor hasNextPage }
|
|
13
|
+
}
|
|
14
|
+
}"
|
|
15
|
+
@transport.execute(query, build_variables(options, %w[eventId replayed search limit offset after first]))["dlqEntries"]
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def get(id)
|
|
19
|
+
query = "query($id: UUID!) { dlqEntry(id: $id) { #{FRAGMENT} } }"
|
|
20
|
+
@transport.execute(query, { "id" => id })["dlqEntry"]
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def replay(id)
|
|
24
|
+
query = "mutation($id: UUID!) { replayDLQEntry(id: $id) }"
|
|
25
|
+
@transport.execute(query, { "id" => id })["replayDLQEntry"]
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def replay_all
|
|
29
|
+
query = "mutation { replayAllDLQ { deliveries } }"
|
|
30
|
+
@transport.execute(query)["replayAllDLQ"]
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def purge(older_than)
|
|
34
|
+
query = "mutation($olderThan: String!) { purgeDLQ(olderThan: $olderThan) { purged } }"
|
|
35
|
+
@transport.execute(query, { "olderThan" => older_than })["purgeDLQ"]
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Hivehook
|
|
4
|
+
module Resources
|
|
5
|
+
class EndpointService < BaseService
|
|
6
|
+
FRAGMENT = "id applicationId url signingSecret status type typeConfig rateLimitRps timeoutMs headers authType deliveryMode ordered blockedDeliveryId healthScore disabledReason healthConfig { windowHours disableBelow } outputFormat createdAt"
|
|
7
|
+
|
|
8
|
+
def list(options = {})
|
|
9
|
+
query = "query($applicationId: UUID, $status: EndpointStatus, $search: String, $limit: Int, $offset: Int, $after: String, $first: Int) {
|
|
10
|
+
endpoints(applicationId: $applicationId, status: $status, search: $search, limit: $limit, offset: $offset, after: $after, first: $first) {
|
|
11
|
+
nodes { #{FRAGMENT} }
|
|
12
|
+
pageInfo { total limit offset endCursor hasNextPage }
|
|
13
|
+
}
|
|
14
|
+
}"
|
|
15
|
+
@transport.execute(query, build_variables(options, %w[applicationId status search limit offset after first]))["endpoints"]
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def get(id)
|
|
19
|
+
query = "query($id: UUID!) { endpoint(id: $id) { #{FRAGMENT} } }"
|
|
20
|
+
@transport.execute(query, { "id" => id })["endpoint"]
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def create(input)
|
|
24
|
+
query = "mutation($input: CreateEndpointInput!) { createEndpoint(input: $input) { #{FRAGMENT} } }"
|
|
25
|
+
@transport.execute(query, { "input" => input })["createEndpoint"]
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def update(id, input)
|
|
29
|
+
query = "mutation($id: UUID!, $input: UpdateEndpointInput!) { updateEndpoint(id: $id, input: $input) { #{FRAGMENT} } }"
|
|
30
|
+
@transport.execute(query, { "id" => id, "input" => input })["updateEndpoint"]
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def delete(id)
|
|
34
|
+
query = "mutation($id: UUID!) { deleteEndpoint(id: $id) }"
|
|
35
|
+
@transport.execute(query, { "id" => id })["deleteEndpoint"]
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def rotate_secret(id)
|
|
39
|
+
query = "mutation($id: UUID!) { rotateEndpointSecret(id: $id) { #{FRAGMENT} } }"
|
|
40
|
+
@transport.execute(query, { "id" => id })["rotateEndpointSecret"]
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Hivehook
|
|
4
|
+
module Resources
|
|
5
|
+
class EventService < BaseService
|
|
6
|
+
FRAGMENT = "id sourceId idempotencyKey eventType rawBody status receivedAt"
|
|
7
|
+
|
|
8
|
+
def list(options = {})
|
|
9
|
+
query = "query($sourceId: UUID, $eventType: String, $status: EventStatus, $search: String, $limit: Int, $offset: Int, $after: String, $first: Int) {
|
|
10
|
+
events(sourceId: $sourceId, eventType: $eventType, status: $status, search: $search, limit: $limit, offset: $offset, after: $after, first: $first) {
|
|
11
|
+
nodes { #{FRAGMENT} }
|
|
12
|
+
pageInfo { total limit offset endCursor hasNextPage }
|
|
13
|
+
}
|
|
14
|
+
}"
|
|
15
|
+
@transport.execute(query, build_variables(options, %w[sourceId eventType status search limit offset after first]))["events"]
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def get(id)
|
|
19
|
+
query = "query($id: UUID!) { event(id: $id) { #{FRAGMENT} } }"
|
|
20
|
+
@transport.execute(query, { "id" => id })["event"]
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Hivehook
|
|
4
|
+
module Resources
|
|
5
|
+
class EventTypeSchemaService < BaseService
|
|
6
|
+
FRAGMENT = "id eventType description schema example createdAt updatedAt"
|
|
7
|
+
|
|
8
|
+
def list(options = {})
|
|
9
|
+
query = "query($search: String, $limit: Int, $offset: Int, $after: String, $first: Int) {
|
|
10
|
+
eventTypeSchemas(search: $search, limit: $limit, offset: $offset, after: $after, first: $first) {
|
|
11
|
+
nodes { #{FRAGMENT} }
|
|
12
|
+
pageInfo { total limit offset endCursor hasNextPage }
|
|
13
|
+
}
|
|
14
|
+
}"
|
|
15
|
+
@transport.execute(query, build_variables(options, %w[search limit offset after first]))["eventTypeSchemas"]
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def get(id)
|
|
19
|
+
query = "query($id: UUID!) { eventTypeSchema(id: $id) { #{FRAGMENT} } }"
|
|
20
|
+
@transport.execute(query, { "id" => id })["eventTypeSchema"]
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def create(input)
|
|
24
|
+
query = "mutation($input: CreateEventTypeSchemaInput!) { createEventTypeSchema(input: $input) { #{FRAGMENT} } }"
|
|
25
|
+
@transport.execute(query, { "input" => input })["createEventTypeSchema"]
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def update(id, input)
|
|
29
|
+
query = "mutation($id: UUID!, $input: UpdateEventTypeSchemaInput!) { updateEventTypeSchema(id: $id, input: $input) { #{FRAGMENT} } }"
|
|
30
|
+
@transport.execute(query, { "id" => id, "input" => input })["updateEventTypeSchema"]
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def delete(id)
|
|
34
|
+
query = "mutation($id: UUID!) { deleteEventTypeSchema(id: $id) }"
|
|
35
|
+
@transport.execute(query, { "id" => id })["deleteEventTypeSchema"]
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Hivehook
|
|
4
|
+
module Resources
|
|
5
|
+
class MessageService < BaseService
|
|
6
|
+
FRAGMENT = "id applicationId eventType payload idempotencyKey status createdAt"
|
|
7
|
+
|
|
8
|
+
def list(options = {})
|
|
9
|
+
query = "query($applicationId: UUID, $eventType: String, $status: MessageStatus, $search: String, $limit: Int, $offset: Int, $after: String, $first: Int) {
|
|
10
|
+
messages(applicationId: $applicationId, eventType: $eventType, status: $status, search: $search, limit: $limit, offset: $offset, after: $after, first: $first) {
|
|
11
|
+
nodes { #{FRAGMENT} }
|
|
12
|
+
pageInfo { total limit offset endCursor hasNextPage }
|
|
13
|
+
}
|
|
14
|
+
}"
|
|
15
|
+
@transport.execute(query, build_variables(options, %w[applicationId eventType status search limit offset after first]))["messages"]
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def get(id)
|
|
19
|
+
query = "query($id: UUID!) { message(id: $id) { #{FRAGMENT} } }"
|
|
20
|
+
@transport.execute(query, { "id" => id })["message"]
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def send(input)
|
|
24
|
+
query = "mutation($input: SendMessageInput!) { sendMessage(input: $input) { #{FRAGMENT} } }"
|
|
25
|
+
@transport.execute(query, { "input" => input })["sendMessage"]
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def broadcast(input)
|
|
29
|
+
query = "mutation($input: BroadcastMessageInput!) { broadcastMessage(input: $input) { #{FRAGMENT} } }"
|
|
30
|
+
@transport.execute(query, { "input" => input })["broadcastMessage"]
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def send_dynamic(input)
|
|
34
|
+
query = "mutation($input: SendDynamicMessageInput!) { sendDynamicMessage(input: $input) { #{FRAGMENT} } }"
|
|
35
|
+
@transport.execute(query, { "input" => input })["sendDynamicMessage"]
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Hivehook
|
|
4
|
+
module Resources
|
|
5
|
+
class OrganizationService < BaseService
|
|
6
|
+
FRAGMENT = "id name slug ssoEnabled ssoProvider retentionEvents retentionMessages otlpConfig { endpoint headers insecure sampleRate } createdAt updatedAt"
|
|
7
|
+
|
|
8
|
+
def list(options = {})
|
|
9
|
+
query = "query($search: String, $limit: Int, $offset: Int) {
|
|
10
|
+
organizations(search: $search, limit: $limit, offset: $offset) {
|
|
11
|
+
nodes { #{FRAGMENT} }
|
|
12
|
+
pageInfo { total limit offset endCursor hasNextPage }
|
|
13
|
+
}
|
|
14
|
+
}"
|
|
15
|
+
@transport.execute(query, build_variables(options, %w[search limit offset]))["organizations"]
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def get(id)
|
|
19
|
+
query = "query($id: UUID!) { organization(id: $id) { #{FRAGMENT} } }"
|
|
20
|
+
@transport.execute(query, { "id" => id })["organization"]
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def create(input)
|
|
24
|
+
query = "mutation($input: CreateOrganizationInput!) { createOrganization(input: $input) { #{FRAGMENT} } }"
|
|
25
|
+
@transport.execute(query, { "input" => input })["createOrganization"]
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def update(id, input)
|
|
29
|
+
query = "mutation($id: UUID!, $input: UpdateOrganizationInput!) { updateOrganization(id: $id, input: $input) { #{FRAGMENT} } }"
|
|
30
|
+
@transport.execute(query, { "id" => id, "input" => input })["updateOrganization"]
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def delete(id)
|
|
34
|
+
query = "mutation($id: UUID!) { deleteOrganization(id: $id) }"
|
|
35
|
+
@transport.execute(query, { "id" => id })["deleteOrganization"]
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def configure_sso(organization_id, input)
|
|
39
|
+
query = "mutation($organizationId: UUID!, $input: SSOConfigInput!) { configureSSO(organizationId: $organizationId, input: $input) { #{FRAGMENT} } }"
|
|
40
|
+
@transport.execute(query, { "organizationId" => organization_id, "input" => input })["configureSSO"]
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def disable_sso(organization_id)
|
|
44
|
+
query = "mutation($organizationId: UUID!) { disableSSO(organizationId: $organizationId) { #{FRAGMENT} } }"
|
|
45
|
+
@transport.execute(query, { "organizationId" => organization_id })["disableSSO"]
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def update_retention(organization_id, input)
|
|
49
|
+
query = "mutation($organizationId: UUID!, $input: RetentionInput!) { updateOrganizationRetention(organizationId: $organizationId, input: $input) { #{FRAGMENT} } }"
|
|
50
|
+
@transport.execute(query, { "organizationId" => organization_id, "input" => input })["updateOrganizationRetention"]
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
def delete_data(organization_id)
|
|
54
|
+
query = "mutation($organizationId: UUID!) { deleteOrganizationData(organizationId: $organizationId) }"
|
|
55
|
+
@transport.execute(query, { "organizationId" => organization_id })["deleteOrganizationData"]
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
def export_data(organization_id)
|
|
59
|
+
query = "mutation($organizationId: UUID!) { exportOrganizationData(organizationId: $organizationId) }"
|
|
60
|
+
@transport.execute(query, { "organizationId" => organization_id })["exportOrganizationData"]
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
def configure_otlp(organization_id, input)
|
|
64
|
+
query = "mutation($organizationId: UUID!, $input: OTLPConfigInput!) { configureOTLP(organizationId: $organizationId, input: $input) { #{FRAGMENT} } }"
|
|
65
|
+
@transport.execute(query, { "organizationId" => organization_id, "input" => input })["configureOTLP"]
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
def disable_otlp(organization_id)
|
|
69
|
+
query = "mutation($organizationId: UUID!) { disableOTLP(organizationId: $organizationId) { #{FRAGMENT} } }"
|
|
70
|
+
@transport.execute(query, { "organizationId" => organization_id })["disableOTLP"]
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
end
|