Class: Knockapi::Resources::Schedules
- Inherits:
-
Object
- Object
- Knockapi::Resources::Schedules
- Defined in:
- lib/knockapi/resources/schedules.rb,
lib/knockapi/resources/schedules/bulk.rb,
sig/knockapi/resources/schedules.rbs,
sig/knockapi/resources/schedules/bulk.rbs
Overview
A schedule is a per-recipient, timezone-aware configuration for when to invoke a workflow.
Defined Under Namespace
Classes: Bulk
Instance Attribute Summary collapse
-
#bulk ⇒ Knockapi::Resources::Schedules::Bulk
readonly
A bulk operation is a set of changes applied across zero or more records triggered via a call to the Knock API and performed asynchronously.
Instance Method Summary collapse
-
#create(recipients:, workflow:, actor: nil, data: nil, ending_at: nil, repeats: nil, scheduled_at: nil, tenant: nil, request_options: {}) ⇒ Array<Knockapi::Models::Schedule>
Some parameter documentations has been truncated, see Models::ScheduleCreateParams for more details.
-
#delete(schedule_ids:, request_options: {}) ⇒ Array<Knockapi::Models::Schedule>
Permanently deletes one or more schedules identified by the provided schedule IDs.
-
#initialize(client:) ⇒ Schedules
constructor
private
A new instance of Schedules.
-
#list(workflow:, after: nil, before: nil, page_size: nil, recipients: nil, tenant: nil, request_options: {}) ⇒ Knockapi::Internal::EntriesCursor<Knockapi::Models::Schedule>
Returns a paginated list of schedules for the current environment, filtered by workflow and optionally by recipients and tenant.
-
#update(schedule_ids:, actor: nil, data: nil, ending_at: nil, repeats: nil, scheduled_at: nil, tenant: nil, request_options: {}) ⇒ Array<Knockapi::Models::Schedule>
Some parameter documentations has been truncated, see Models::ScheduleUpdateParams for more details.
Constructor Details
#initialize(client:) ⇒ Schedules
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Schedules.
158 159 160 161 |
# File 'lib/knockapi/resources/schedules.rb', line 158 def initialize(client:) @client = client @bulk = Knockapi::Resources::Schedules::Bulk.new(client: client) end |
Instance Attribute Details
#bulk ⇒ Knockapi::Resources::Schedules::Bulk (readonly)
A bulk operation is a set of changes applied across zero or more records triggered via a call to the Knock API and performed asynchronously.
11 12 13 |
# File 'lib/knockapi/resources/schedules.rb', line 11 def bulk @bulk end |
Instance Method Details
#create(recipients:, workflow:, actor: nil, data: nil, ending_at: nil, repeats: nil, scheduled_at: nil, tenant: nil, request_options: {}) ⇒ Array<Knockapi::Models::Schedule>
Some parameter documentations has been truncated, see Models::ScheduleCreateParams for more details.
Creates one or more schedules for a workflow with the specified recipients,
timing, and data. Schedules can be one-time or recurring. This endpoint also
handles
inline identifications
for the actor, recipient, and tenant fields.
45 46 47 48 49 50 51 52 53 54 |
# File 'lib/knockapi/resources/schedules.rb', line 45 def create(params) parsed, = Knockapi::ScheduleCreateParams.dump_request(params) @client.request( method: :post, path: "v1/schedules", body: parsed, model: Knockapi::Internal::Type::ArrayOf[Knockapi::Schedule], options: ) end |
#delete(schedule_ids:, request_options: {}) ⇒ Array<Knockapi::Models::Schedule>
Permanently deletes one or more schedules identified by the provided schedule IDs. This operation cannot be undone.
144 145 146 147 148 149 150 151 152 153 |
# File 'lib/knockapi/resources/schedules.rb', line 144 def delete(params) parsed, = Knockapi::ScheduleDeleteParams.dump_request(params) @client.request( method: :delete, path: "v1/schedules", body: parsed, model: Knockapi::Internal::Type::ArrayOf[Knockapi::Schedule], options: ) end |
#list(workflow:, after: nil, before: nil, page_size: nil, recipients: nil, tenant: nil, request_options: {}) ⇒ Knockapi::Internal::EntriesCursor<Knockapi::Models::Schedule>
Returns a paginated list of schedules for the current environment, filtered by workflow and optionally by recipients and tenant.
119 120 121 122 123 124 125 126 127 128 129 130 |
# File 'lib/knockapi/resources/schedules.rb', line 119 def list(params) parsed, = Knockapi::ScheduleListParams.dump_request(params) query = Knockapi::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: "v1/schedules", query: query, page: Knockapi::Internal::EntriesCursor, model: Knockapi::Schedule, options: ) end |
#update(schedule_ids:, actor: nil, data: nil, ending_at: nil, repeats: nil, scheduled_at: nil, tenant: nil, request_options: {}) ⇒ Array<Knockapi::Models::Schedule>
Some parameter documentations has been truncated, see Models::ScheduleUpdateParams for more details.
Updates one or more existing schedules with new timing, data, or other
properties. All specified schedule IDs will be updated with the same values.
This endpoint also handles
inline identifications
for the actor, recipient, and tenant fields.
86 87 88 89 90 91 92 93 94 95 |
# File 'lib/knockapi/resources/schedules.rb', line 86 def update(params) parsed, = Knockapi::ScheduleUpdateParams.dump_request(params) @client.request( method: :put, path: "v1/schedules", body: parsed, model: Knockapi::Internal::Type::ArrayOf[Knockapi::Schedule], options: ) end |