Class: Hatchet::Features::Filters
- Inherits:
-
Object
- Object
- Hatchet::Features::Filters
- Defined in:
- lib/hatchet/features/filters.rb
Overview
Filters client for interacting with Hatchet’s filters API
This class provides a high-level interface for creating, retrieving, listing, updating, and deleting filters in the Hatchet system.
Instance Method Summary collapse
-
#create(workflow_id:, expression:, scope:, payload: nil) ⇒ Object
Create a new filter.
-
#delete(filter_id) ⇒ Object
Delete a filter by its ID.
-
#get(filter_id) ⇒ Object
Get a filter by its ID.
-
#initialize(rest_client, config) ⇒ void
constructor
Initializes a new Filters client instance.
-
#list(limit: nil, offset: nil, workflow_ids: nil, scopes: nil) ⇒ Object
List filters for the current tenant.
-
#update(filter_id, updates) ⇒ Object
Update a filter by its ID.
Constructor Details
#initialize(rest_client, config) ⇒ void
Initializes a new Filters client instance
28 29 30 31 32 |
# File 'lib/hatchet/features/filters.rb', line 28 def initialize(rest_client, config) @rest_client = rest_client @config = config @filter_api = HatchetSdkRest::FilterApi.new(rest_client) end |
Instance Method Details
#create(workflow_id:, expression:, scope:, payload: nil) ⇒ Object
Create a new filter
82 83 84 85 86 87 88 89 90 |
# File 'lib/hatchet/features/filters.rb', line 82 def create(workflow_id:, expression:, scope:, payload: nil) request = HatchetSdkRest::V1CreateFilterRequest.new( workflow_id: workflow_id, expression: expression, scope: scope, payload: payload, ) @filter_api.v1_filter_create(@config.tenant_id, request) end |
#delete(filter_id) ⇒ Object
Delete a filter by its ID
99 100 101 |
# File 'lib/hatchet/features/filters.rb', line 99 def delete(filter_id) @filter_api.v1_filter_delete(@config.tenant_id, filter_id) end |
#get(filter_id) ⇒ Object
Get a filter by its ID
63 64 65 |
# File 'lib/hatchet/features/filters.rb', line 63 def get(filter_id) @filter_api.v1_filter_get(@config.tenant_id, filter_id) end |
#list(limit: nil, offset: nil, workflow_ids: nil, scopes: nil) ⇒ Object
List filters for the current tenant
44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/hatchet/features/filters.rb', line 44 def list(limit: nil, offset: nil, workflow_ids: nil, scopes: nil) @filter_api.v1_filter_list( @config.tenant_id, { limit: limit, offset: offset, workflow_ids: workflow_ids, scopes: scopes, }, ) end |
#update(filter_id, updates) ⇒ Object
Update a filter by its ID
111 112 113 114 |
# File 'lib/hatchet/features/filters.rb', line 111 def update(filter_id, updates) update_request = HatchetSdkRest::V1UpdateFilterRequest.new(updates) @filter_api.v1_filter_update(@config.tenant_id, filter_id, update_request) end |