trycourier 6.0.0 → 6.2.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 +4 -4
- data/CHANGELOG.md +20 -0
- data/README.md +1 -1
- data/lib/courier/models/automation_run_list_item.rb +57 -0
- data/lib/courier/models/automation_run_list_response.rb +25 -0
- data/lib/courier/models/automation_run_step.rb +64 -0
- data/lib/courier/models/automation_run_steps_response.rb +17 -0
- data/lib/courier/models/automations/run_list_params.rb +71 -0
- data/lib/courier/models/automations/run_list_steps_params.rb +22 -0
- data/lib/courier/models/create_journey_request.rb +2 -2
- data/lib/courier/models/journey_audience_trigger_node.rb +77 -0
- data/lib/courier/models/journey_node.rb +8 -2
- data/lib/courier/models/journey_response.rb +2 -2
- data/lib/courier/models/journey_run.rb +66 -0
- data/lib/courier/models/journey_run_list_item.rb +50 -0
- data/lib/courier/models/journey_run_list_response.rb +33 -0
- data/lib/courier/models/journey_run_response.rb +22 -0
- data/lib/courier/models/journey_run_step.rb +65 -0
- data/lib/courier/models/journey_run_steps_response.rb +17 -0
- data/lib/courier/models/journey_segment_trigger_node.rb +5 -1
- data/lib/courier/models/journey_webhook_trigger_node.rb +85 -0
- data/lib/courier/models/journeys/run_list_params.rb +71 -0
- data/lib/courier/models/journeys/run_list_steps_params.rb +22 -0
- data/lib/courier/models/journeys/run_retrieve_params.rb +22 -0
- data/lib/courier/models/notification_get_metrics_params.rb +83 -0
- data/lib/courier/models/notification_metrics_response.rb +165 -0
- data/lib/courier/models/users/topic_preference.rb +21 -1
- data/lib/courier/models.rb +28 -0
- data/lib/courier/resources/automations/runs.rb +80 -0
- data/lib/courier/resources/automations.rb +6 -0
- data/lib/courier/resources/journeys/runs.rb +104 -0
- data/lib/courier/resources/journeys.rb +8 -2
- data/lib/courier/resources/notifications.rb +53 -0
- data/lib/courier/version.rb +1 -1
- data/lib/courier.rb +21 -0
- data/rbi/courier/models/automation_run_list_item.rbi +87 -0
- data/rbi/courier/models/automation_run_list_response.rbi +47 -0
- data/rbi/courier/models/automation_run_step.rbi +96 -0
- data/rbi/courier/models/automation_run_steps_response.rbi +28 -0
- data/rbi/courier/models/automations/run_list_params.rbi +114 -0
- data/rbi/courier/models/automations/run_list_steps_params.rbi +40 -0
- data/rbi/courier/models/create_journey_request.rbi +6 -0
- data/rbi/courier/models/journey_audience_trigger_node.rbi +162 -0
- data/rbi/courier/models/journey_node.rbi +2 -0
- data/rbi/courier/models/journey_response.rbi +2 -0
- data/rbi/courier/models/journey_run.rbi +97 -0
- data/rbi/courier/models/journey_run_list_item.rbi +79 -0
- data/rbi/courier/models/journey_run_list_response.rbi +58 -0
- data/rbi/courier/models/journey_run_response.rbi +33 -0
- data/rbi/courier/models/journey_run_step.rbi +97 -0
- data/rbi/courier/models/journey_run_steps_response.rbi +28 -0
- data/rbi/courier/models/journey_segment_trigger_node.rbi +9 -1
- data/rbi/courier/models/journey_webhook_trigger_node.rbi +174 -0
- data/rbi/courier/models/journeys/run_list_params.rbi +111 -0
- data/rbi/courier/models/journeys/run_list_steps_params.rbi +40 -0
- data/rbi/courier/models/journeys/run_retrieve_params.rbi +40 -0
- data/rbi/courier/models/notification_get_metrics_params.rbi +167 -0
- data/rbi/courier/models/notification_metrics_response.rbi +269 -0
- data/rbi/courier/models/users/topic_preference.rbi +33 -3
- data/rbi/courier/models.rbi +28 -0
- data/rbi/courier/resources/automations/runs.rbi +69 -0
- data/rbi/courier/resources/automations.rbi +5 -0
- data/rbi/courier/resources/journeys/runs.rbi +87 -0
- data/rbi/courier/resources/journeys.rbi +9 -0
- data/rbi/courier/resources/notifications.rbi +57 -0
- data/sig/courier/models/automation_run_list_item.rbs +46 -0
- data/sig/courier/models/automation_run_list_response.rbs +24 -0
- data/sig/courier/models/automation_run_step.rbs +53 -0
- data/sig/courier/models/automation_run_steps_response.rbs +14 -0
- data/sig/courier/models/automations/run_list_params.rbs +65 -0
- data/sig/courier/models/automations/run_list_steps_params.rbs +22 -0
- data/sig/courier/models/journey_audience_trigger_node.rbs +66 -0
- data/sig/courier/models/journey_node.rbs +2 -0
- data/sig/courier/models/journey_run.rbs +53 -0
- data/sig/courier/models/journey_run_list_item.rbs +46 -0
- data/sig/courier/models/journey_run_list_response.rbs +34 -0
- data/sig/courier/models/journey_run_response.rbs +13 -0
- data/sig/courier/models/journey_run_step.rbs +53 -0
- data/sig/courier/models/journey_run_steps_response.rbs +14 -0
- data/sig/courier/models/journey_segment_trigger_node.rbs +2 -1
- data/sig/courier/models/journey_webhook_trigger_node.rbs +73 -0
- data/sig/courier/models/journeys/run_list_params.rbs +65 -0
- data/sig/courier/models/journeys/run_list_steps_params.rbs +25 -0
- data/sig/courier/models/journeys/run_retrieve_params.rbs +25 -0
- data/sig/courier/models/notification_get_metrics_params.rbs +69 -0
- data/sig/courier/models/notification_metrics_response.rbs +127 -0
- data/sig/courier/models/users/topic_preference.rbs +17 -3
- data/sig/courier/models.rbs +28 -0
- data/sig/courier/resources/automations/runs.rbs +24 -0
- data/sig/courier/resources/automations.rbs +2 -0
- data/sig/courier/resources/journeys/runs.rbs +29 -0
- data/sig/courier/resources/journeys.rbs +2 -0
- data/sig/courier/resources/notifications.rbs +9 -0
- metadata +65 -2
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Courier
|
|
4
|
+
module Resources
|
|
5
|
+
class Automations
|
|
6
|
+
# Invoke a stored automation template or an ad hoc automation defined in the
|
|
7
|
+
# request.
|
|
8
|
+
class Runs
|
|
9
|
+
# Some parameter documentations has been truncated, see
|
|
10
|
+
# {Courier::Models::Automations::RunListParams} for more details.
|
|
11
|
+
#
|
|
12
|
+
# List runs of the workspace's v2 Automations, newest first, filtered by status,
|
|
13
|
+
# Template, or date range and paged by cursor. Journey (v3) runs are listed by
|
|
14
|
+
# `GET /journeys/runs` instead — the two surfaces never return each other's runs.
|
|
15
|
+
# Runs are retained for 95 days.
|
|
16
|
+
#
|
|
17
|
+
# @overload list(cursor: nil, end_date: nil, limit: nil, start_date: nil, status: nil, template_id: nil, request_options: {})
|
|
18
|
+
#
|
|
19
|
+
# @param cursor [String] A cursor token for pagination. Use the `next_cursor` from the previous response
|
|
20
|
+
#
|
|
21
|
+
# @param end_date [String] An inclusive upper bound on `created_at`, in the same format as `start_date`.
|
|
22
|
+
#
|
|
23
|
+
# @param limit [String] The number of runs to return per page, between `1` and `50`. Defaults to `20`. V
|
|
24
|
+
#
|
|
25
|
+
# @param start_date [String] An inclusive lower bound on `created_at`, as an ISO 8601 date or timestamp (e.g.
|
|
26
|
+
#
|
|
27
|
+
# @param status [String] A comma-separated list of run statuses to filter on, e.g. `PROCESSED,ERROR`.
|
|
28
|
+
#
|
|
29
|
+
# @param template_id [String] A comma-separated list of Automation Template ids to filter on.
|
|
30
|
+
#
|
|
31
|
+
# @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
32
|
+
#
|
|
33
|
+
# @return [Courier::Models::AutomationRunListResponse]
|
|
34
|
+
#
|
|
35
|
+
# @see Courier::Models::Automations::RunListParams
|
|
36
|
+
def list(params = {})
|
|
37
|
+
parsed, options = Courier::Automations::RunListParams.dump_request(params)
|
|
38
|
+
query = Courier::Internal::Util.encode_query_params(parsed)
|
|
39
|
+
@client.request(
|
|
40
|
+
method: :get,
|
|
41
|
+
path: "automations/runs",
|
|
42
|
+
query: query,
|
|
43
|
+
model: Courier::AutomationRunListResponse,
|
|
44
|
+
options: options
|
|
45
|
+
)
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
# List the per-step state of one Automation run, in full — this endpoint is not
|
|
49
|
+
# paginated. `message_id` is present on send steps that produced a message; follow
|
|
50
|
+
# it to `GET /messages/{message_id}` for delivery status. A send to a List or an
|
|
51
|
+
# Audience yields one `message_id` for the request, not one per recipient.
|
|
52
|
+
#
|
|
53
|
+
# @overload list_steps(id, request_options: {})
|
|
54
|
+
#
|
|
55
|
+
# @param id [String] A unique identifier representing the Automation run.
|
|
56
|
+
#
|
|
57
|
+
# @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
58
|
+
#
|
|
59
|
+
# @return [Courier::Models::AutomationRunStepsResponse]
|
|
60
|
+
#
|
|
61
|
+
# @see Courier::Models::Automations::RunListStepsParams
|
|
62
|
+
def list_steps(id, params = {})
|
|
63
|
+
@client.request(
|
|
64
|
+
method: :get,
|
|
65
|
+
path: ["automations/runs/%1$s/steps", id],
|
|
66
|
+
model: Courier::AutomationRunStepsResponse,
|
|
67
|
+
options: params[:request_options]
|
|
68
|
+
)
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
# @api private
|
|
72
|
+
#
|
|
73
|
+
# @param client [Courier::Client]
|
|
74
|
+
def initialize(client:)
|
|
75
|
+
@client = client
|
|
76
|
+
end
|
|
77
|
+
end
|
|
78
|
+
end
|
|
79
|
+
end
|
|
80
|
+
end
|
|
@@ -10,6 +10,11 @@ module Courier
|
|
|
10
10
|
# @return [Courier::Resources::Automations::Invoke]
|
|
11
11
|
attr_reader :invoke
|
|
12
12
|
|
|
13
|
+
# Invoke a stored automation template or an ad hoc automation defined in the
|
|
14
|
+
# request.
|
|
15
|
+
# @return [Courier::Resources::Automations::Runs]
|
|
16
|
+
attr_reader :runs
|
|
17
|
+
|
|
13
18
|
# Some parameter documentations has been truncated, see
|
|
14
19
|
# {Courier::Models::AutomationListParams} for more details.
|
|
15
20
|
#
|
|
@@ -45,6 +50,7 @@ module Courier
|
|
|
45
50
|
def initialize(client:)
|
|
46
51
|
@client = client
|
|
47
52
|
@invoke = Courier::Resources::Automations::Invoke.new(client: client)
|
|
53
|
+
@runs = Courier::Resources::Automations::Runs.new(client: client)
|
|
48
54
|
end
|
|
49
55
|
end
|
|
50
56
|
end
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Courier
|
|
4
|
+
module Resources
|
|
5
|
+
class Journeys
|
|
6
|
+
# Build, version, publish, invoke, and cancel multi-step notification workflows,
|
|
7
|
+
# along with the templates scoped to them.
|
|
8
|
+
class Runs
|
|
9
|
+
# Fetch one Journey run by id. Returns `404` for an unknown run, a run belonging
|
|
10
|
+
# to another workspace, a run past the 95-day retention window, or an Automation
|
|
11
|
+
# run id — the same body in every case, so the response never reveals whether a
|
|
12
|
+
# run exists elsewhere.
|
|
13
|
+
#
|
|
14
|
+
# @overload retrieve(run_id, request_options: {})
|
|
15
|
+
#
|
|
16
|
+
# @param run_id [String] A unique identifier representing the Journey run.
|
|
17
|
+
#
|
|
18
|
+
# @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
19
|
+
#
|
|
20
|
+
# @return [Courier::Models::JourneyRunResponse]
|
|
21
|
+
#
|
|
22
|
+
# @see Courier::Models::Journeys::RunRetrieveParams
|
|
23
|
+
def retrieve(run_id, params = {})
|
|
24
|
+
@client.request(
|
|
25
|
+
method: :get,
|
|
26
|
+
path: ["journeys/runs/%1$s", run_id],
|
|
27
|
+
model: Courier::JourneyRunResponse,
|
|
28
|
+
options: params[:request_options]
|
|
29
|
+
)
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
# Some parameter documentations has been truncated, see
|
|
33
|
+
# {Courier::Models::Journeys::RunListParams} for more details.
|
|
34
|
+
#
|
|
35
|
+
# List runs of the workspace's Journeys, newest first, filtered by status,
|
|
36
|
+
# Journey, or date range and paged by cursor. Runs of v2 Automations are listed by
|
|
37
|
+
# `GET /automations/runs` instead — the two surfaces never return each other's
|
|
38
|
+
# runs. Runs are retained for 95 days.
|
|
39
|
+
#
|
|
40
|
+
# @overload list(cursor: nil, end_date: nil, limit: nil, start_date: nil, status: nil, template_id: nil, request_options: {})
|
|
41
|
+
#
|
|
42
|
+
# @param cursor [String] A cursor token for pagination. Use the `next_cursor` from the previous response
|
|
43
|
+
#
|
|
44
|
+
# @param end_date [String] An inclusive upper bound on `created_at`, in the same format as `start_date`.
|
|
45
|
+
#
|
|
46
|
+
# @param limit [String] The number of runs to return per page, between `1` and `50`. Defaults to `20`. V
|
|
47
|
+
#
|
|
48
|
+
# @param start_date [String] An inclusive lower bound on `created_at`, as an ISO 8601 date or timestamp (e.g.
|
|
49
|
+
#
|
|
50
|
+
# @param status [String] A comma-separated list of run statuses to filter on, e.g. `PROCESSED,ERROR`.
|
|
51
|
+
#
|
|
52
|
+
# @param template_id [String] A comma-separated list of Journey ids to filter on.
|
|
53
|
+
#
|
|
54
|
+
# @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
55
|
+
#
|
|
56
|
+
# @return [Courier::Models::JourneyRunListResponse]
|
|
57
|
+
#
|
|
58
|
+
# @see Courier::Models::Journeys::RunListParams
|
|
59
|
+
def list(params = {})
|
|
60
|
+
parsed, options = Courier::Journeys::RunListParams.dump_request(params)
|
|
61
|
+
query = Courier::Internal::Util.encode_query_params(parsed)
|
|
62
|
+
@client.request(
|
|
63
|
+
method: :get,
|
|
64
|
+
path: "journeys/runs",
|
|
65
|
+
query: query,
|
|
66
|
+
model: Courier::JourneyRunListResponse,
|
|
67
|
+
options: options
|
|
68
|
+
)
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
# List the per-node state of one Journey run, in full — this endpoint is not
|
|
72
|
+
# paginated. Each step's `node_id` is the id of the node in the published Journey,
|
|
73
|
+
# so a step maps directly onto the Journey graph. `message_id` is present on send
|
|
74
|
+
# steps that produced a message; follow it to `GET /messages/{message_id}` for
|
|
75
|
+
# delivery status.
|
|
76
|
+
#
|
|
77
|
+
# @overload list_steps(run_id, request_options: {})
|
|
78
|
+
#
|
|
79
|
+
# @param run_id [String] A unique identifier representing the Journey run.
|
|
80
|
+
#
|
|
81
|
+
# @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
82
|
+
#
|
|
83
|
+
# @return [Courier::Models::JourneyRunStepsResponse]
|
|
84
|
+
#
|
|
85
|
+
# @see Courier::Models::Journeys::RunListStepsParams
|
|
86
|
+
def list_steps(run_id, params = {})
|
|
87
|
+
@client.request(
|
|
88
|
+
method: :get,
|
|
89
|
+
path: ["journeys/runs/%1$s/steps", run_id],
|
|
90
|
+
model: Courier::JourneyRunStepsResponse,
|
|
91
|
+
options: params[:request_options]
|
|
92
|
+
)
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
# @api private
|
|
96
|
+
#
|
|
97
|
+
# @param client [Courier::Client]
|
|
98
|
+
def initialize(client:)
|
|
99
|
+
@client = client
|
|
100
|
+
end
|
|
101
|
+
end
|
|
102
|
+
end
|
|
103
|
+
end
|
|
104
|
+
end
|
|
@@ -10,6 +10,11 @@ module Courier
|
|
|
10
10
|
# @return [Courier::Resources::Journeys::Templates]
|
|
11
11
|
attr_reader :templates
|
|
12
12
|
|
|
13
|
+
# Build, version, publish, invoke, and cancel multi-step notification workflows,
|
|
14
|
+
# along with the templates scoped to them.
|
|
15
|
+
# @return [Courier::Resources::Journeys::Runs]
|
|
16
|
+
attr_reader :runs
|
|
17
|
+
|
|
13
18
|
# Some parameter documentations has been truncated, see
|
|
14
19
|
# {Courier::Models::JourneyCreateParams} for more details.
|
|
15
20
|
#
|
|
@@ -20,7 +25,7 @@ module Courier
|
|
|
20
25
|
#
|
|
21
26
|
# @param name [String] Body param
|
|
22
27
|
#
|
|
23
|
-
# @param nodes [Array<Courier::Models::JourneyAPIInvokeTriggerNode, Courier::Models::JourneySegmentTriggerNode, Courier::Models::JourneySendNode, Courier::Models::JourneyDelayDurationNode, Courier::Models::JourneyDelayUntilNode, Courier::Models::JourneyFetchGetDeleteNode, Courier::Models::JourneyFetchPostPutNode, Courier::Models::JourneyAINode, Courier::Models::JourneyThrottleStaticNode, Courier::Models::JourneyThrottleDynamicNode, Courier::Models::JourneyNode::JourneyBatchNode, Courier::Models::JourneyNode::JourneyAddToDigestNode, Courier::Models::JourneyExitNode, Courier::Models::JourneyNode::JourneyBranchNode>] Body param
|
|
28
|
+
# @param nodes [Array<Courier::Models::JourneyAPIInvokeTriggerNode, Courier::Models::JourneySegmentTriggerNode, Courier::Models::JourneyAudienceTriggerNode, Courier::Models::JourneyWebhookTriggerNode, Courier::Models::JourneySendNode, Courier::Models::JourneyDelayDurationNode, Courier::Models::JourneyDelayUntilNode, Courier::Models::JourneyFetchGetDeleteNode, Courier::Models::JourneyFetchPostPutNode, Courier::Models::JourneyAINode, Courier::Models::JourneyThrottleStaticNode, Courier::Models::JourneyThrottleDynamicNode, Courier::Models::JourneyNode::JourneyBatchNode, Courier::Models::JourneyNode::JourneyAddToDigestNode, Courier::Models::JourneyExitNode, Courier::Models::JourneyNode::JourneyBranchNode>] Body param
|
|
24
29
|
#
|
|
25
30
|
# @param enabled [Boolean] Body param
|
|
26
31
|
#
|
|
@@ -263,7 +268,7 @@ module Courier
|
|
|
263
268
|
#
|
|
264
269
|
# @param name [String]
|
|
265
270
|
#
|
|
266
|
-
# @param nodes [Array<Courier::Models::JourneyAPIInvokeTriggerNode, Courier::Models::JourneySegmentTriggerNode, Courier::Models::JourneySendNode, Courier::Models::JourneyDelayDurationNode, Courier::Models::JourneyDelayUntilNode, Courier::Models::JourneyFetchGetDeleteNode, Courier::Models::JourneyFetchPostPutNode, Courier::Models::JourneyAINode, Courier::Models::JourneyThrottleStaticNode, Courier::Models::JourneyThrottleDynamicNode, Courier::Models::JourneyNode::JourneyBatchNode, Courier::Models::JourneyNode::JourneyAddToDigestNode, Courier::Models::JourneyExitNode, Courier::Models::JourneyNode::JourneyBranchNode>]
|
|
271
|
+
# @param nodes [Array<Courier::Models::JourneyAPIInvokeTriggerNode, Courier::Models::JourneySegmentTriggerNode, Courier::Models::JourneyAudienceTriggerNode, Courier::Models::JourneyWebhookTriggerNode, Courier::Models::JourneySendNode, Courier::Models::JourneyDelayDurationNode, Courier::Models::JourneyDelayUntilNode, Courier::Models::JourneyFetchGetDeleteNode, Courier::Models::JourneyFetchPostPutNode, Courier::Models::JourneyAINode, Courier::Models::JourneyThrottleStaticNode, Courier::Models::JourneyThrottleDynamicNode, Courier::Models::JourneyNode::JourneyBatchNode, Courier::Models::JourneyNode::JourneyAddToDigestNode, Courier::Models::JourneyExitNode, Courier::Models::JourneyNode::JourneyBranchNode>]
|
|
267
272
|
#
|
|
268
273
|
# @param enabled [Boolean]
|
|
269
274
|
#
|
|
@@ -291,6 +296,7 @@ module Courier
|
|
|
291
296
|
def initialize(client:)
|
|
292
297
|
@client = client
|
|
293
298
|
@templates = Courier::Resources::Journeys::Templates.new(client: client)
|
|
299
|
+
@runs = Courier::Resources::Journeys::Runs.new(client: client)
|
|
294
300
|
end
|
|
295
301
|
end
|
|
296
302
|
end
|
|
@@ -123,6 +123,59 @@ module Courier
|
|
|
123
123
|
)
|
|
124
124
|
end
|
|
125
125
|
|
|
126
|
+
# Some parameter documentations has been truncated, see
|
|
127
|
+
# {Courier::Models::NotificationGetMetricsParams} for more details.
|
|
128
|
+
#
|
|
129
|
+
# Fetch the delivery funnel for one Notification Template as a time series — sent,
|
|
130
|
+
# delivered, opened, clicked, errors, and undeliverable — broken out per provider
|
|
131
|
+
# and channel inside each bucket. Sum the entries in a bucket for its totals;
|
|
132
|
+
# there is no bucket-level total.
|
|
133
|
+
#
|
|
134
|
+
# Choose the window absolutely with `start` and `end`, or relatively with
|
|
135
|
+
# `lookback` (an ISO 8601 duration). `start` and `end` take precedence when both
|
|
136
|
+
# are supplied, and a request carrying neither defaults to `lookback=P30D`. The
|
|
137
|
+
# window is snapped outwards onto the `granularity` grid so every bucket it
|
|
138
|
+
# overlaps is returned whole, and the snapped boundaries come back as `start` and
|
|
139
|
+
# `end` — align a chart on those rather than on what was requested. Every boundary
|
|
140
|
+
# is UTC; there is no timezone support.
|
|
141
|
+
#
|
|
142
|
+
# Every bucket in the window is returned, including the quiet ones, whose `data`
|
|
143
|
+
# array is empty, so a series is directly plottable with no gap filling
|
|
144
|
+
# client-side. An unknown template id returns `200` with an all-empty series
|
|
145
|
+
# rather than `404`, and messages sent without a Notification Template never
|
|
146
|
+
# appear here.
|
|
147
|
+
#
|
|
148
|
+
# Available in the US region only.
|
|
149
|
+
#
|
|
150
|
+
# @overload get_metrics(id, end_: nil, granularity: nil, lookback: nil, start: nil, request_options: {})
|
|
151
|
+
#
|
|
152
|
+
# @param id [String] The Notification Template to report on — its ID (`nt_` prefix) or an alias. Must
|
|
153
|
+
#
|
|
154
|
+
# @param end_ [Time] The end of the window, as an ISO 8601 timestamp with an offset. Must be supplied
|
|
155
|
+
#
|
|
156
|
+
# @param granularity [Symbol, Courier::Models::NotificationGetMetricsParams::Granularity] The size of each bucket in the series. Defaults to `DAY`. `WEEK` buckets start o
|
|
157
|
+
#
|
|
158
|
+
# @param lookback [String] The length of the window, counted back from now, as an ISO 8601 duration (`P30D`
|
|
159
|
+
#
|
|
160
|
+
# @param start [Time] The inclusive start of the window, as an ISO 8601 timestamp with an offset (`202
|
|
161
|
+
#
|
|
162
|
+
# @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
163
|
+
#
|
|
164
|
+
# @return [Courier::Models::NotificationMetricsResponse]
|
|
165
|
+
#
|
|
166
|
+
# @see Courier::Models::NotificationGetMetricsParams
|
|
167
|
+
def get_metrics(id, params = {})
|
|
168
|
+
parsed, options = Courier::NotificationGetMetricsParams.dump_request(params)
|
|
169
|
+
query = Courier::Internal::Util.encode_query_params(parsed)
|
|
170
|
+
@client.request(
|
|
171
|
+
method: :get,
|
|
172
|
+
path: ["notifications/%1$s/metrics", id],
|
|
173
|
+
query: query.transform_keys(end_: "end"),
|
|
174
|
+
model: Courier::NotificationMetricsResponse,
|
|
175
|
+
options: options
|
|
176
|
+
)
|
|
177
|
+
end
|
|
178
|
+
|
|
126
179
|
# Returns a notification template's published versions, most recent first, for
|
|
127
180
|
# comparison or rollback. Paged.
|
|
128
181
|
#
|
data/lib/courier/version.rb
CHANGED
data/lib/courier.rb
CHANGED
|
@@ -113,8 +113,14 @@ require_relative "courier/models/auth_issue_token_params"
|
|
|
113
113
|
require_relative "courier/models/auth_issue_token_response"
|
|
114
114
|
require_relative "courier/models/automation_invoke_response"
|
|
115
115
|
require_relative "courier/models/automation_list_params"
|
|
116
|
+
require_relative "courier/models/automation_run_list_item"
|
|
117
|
+
require_relative "courier/models/automation_run_list_response"
|
|
118
|
+
require_relative "courier/models/automation_run_step"
|
|
119
|
+
require_relative "courier/models/automation_run_steps_response"
|
|
116
120
|
require_relative "courier/models/automations/invoke_invoke_ad_hoc_params"
|
|
117
121
|
require_relative "courier/models/automations/invoke_invoke_by_template_params"
|
|
122
|
+
require_relative "courier/models/automations/run_list_params"
|
|
123
|
+
require_relative "courier/models/automations/run_list_steps_params"
|
|
118
124
|
require_relative "courier/models/automation_template"
|
|
119
125
|
require_relative "courier/models/automation_template_list_response"
|
|
120
126
|
require_relative "courier/models/aws_sns"
|
|
@@ -194,6 +200,7 @@ require_relative "courier/models/journey"
|
|
|
194
200
|
require_relative "courier/models/journey_ai_node"
|
|
195
201
|
require_relative "courier/models/journey_api_invoke_trigger_node"
|
|
196
202
|
require_relative "courier/models/journey_archive_params"
|
|
203
|
+
require_relative "courier/models/journey_audience_trigger_node"
|
|
197
204
|
require_relative "courier/models/journey_cancel_params"
|
|
198
205
|
require_relative "courier/models/journey_condition_atom"
|
|
199
206
|
require_relative "courier/models/journey_condition_group"
|
|
@@ -216,6 +223,15 @@ require_relative "courier/models/journey_publish_params"
|
|
|
216
223
|
require_relative "courier/models/journey_replace_params"
|
|
217
224
|
require_relative "courier/models/journey_response"
|
|
218
225
|
require_relative "courier/models/journey_retrieve_params"
|
|
226
|
+
require_relative "courier/models/journey_run"
|
|
227
|
+
require_relative "courier/models/journey_run_list_item"
|
|
228
|
+
require_relative "courier/models/journey_run_list_response"
|
|
229
|
+
require_relative "courier/models/journey_run_response"
|
|
230
|
+
require_relative "courier/models/journey_run_step"
|
|
231
|
+
require_relative "courier/models/journey_run_steps_response"
|
|
232
|
+
require_relative "courier/models/journeys/run_list_params"
|
|
233
|
+
require_relative "courier/models/journeys/run_list_steps_params"
|
|
234
|
+
require_relative "courier/models/journeys/run_retrieve_params"
|
|
219
235
|
require_relative "courier/models/journeys/template_archive_params"
|
|
220
236
|
require_relative "courier/models/journeys/template_create_params"
|
|
221
237
|
require_relative "courier/models/journeys/template_list_params"
|
|
@@ -238,6 +254,7 @@ require_relative "courier/models/journey_throttle_dynamic_node"
|
|
|
238
254
|
require_relative "courier/models/journey_throttle_static_node"
|
|
239
255
|
require_relative "courier/models/journey_version_item"
|
|
240
256
|
require_relative "courier/models/journey_versions_list_response"
|
|
257
|
+
require_relative "courier/models/journey_webhook_trigger_node"
|
|
241
258
|
require_relative "courier/models/list_delete_params"
|
|
242
259
|
require_relative "courier/models/list_filter"
|
|
243
260
|
require_relative "courier/models/list_list_params"
|
|
@@ -281,9 +298,11 @@ require_relative "courier/models/notification_content_get_response"
|
|
|
281
298
|
require_relative "courier/models/notification_content_mutation_response"
|
|
282
299
|
require_relative "courier/models/notification_create_params"
|
|
283
300
|
require_relative "courier/models/notification_get_content"
|
|
301
|
+
require_relative "courier/models/notification_get_metrics_params"
|
|
284
302
|
require_relative "courier/models/notification_list_params"
|
|
285
303
|
require_relative "courier/models/notification_list_response"
|
|
286
304
|
require_relative "courier/models/notification_list_versions_params"
|
|
305
|
+
require_relative "courier/models/notification_metrics_response"
|
|
287
306
|
require_relative "courier/models/notification_preference_details"
|
|
288
307
|
require_relative "courier/models/notification_publish_params"
|
|
289
308
|
require_relative "courier/models/notification_put_content_params"
|
|
@@ -451,6 +470,7 @@ require_relative "courier/resources/audit_events"
|
|
|
451
470
|
require_relative "courier/resources/auth"
|
|
452
471
|
require_relative "courier/resources/automations"
|
|
453
472
|
require_relative "courier/resources/automations/invoke"
|
|
473
|
+
require_relative "courier/resources/automations/runs"
|
|
454
474
|
require_relative "courier/resources/brands"
|
|
455
475
|
require_relative "courier/resources/broadcasts"
|
|
456
476
|
require_relative "courier/resources/bulk"
|
|
@@ -458,6 +478,7 @@ require_relative "courier/resources/digests"
|
|
|
458
478
|
require_relative "courier/resources/digests/schedules"
|
|
459
479
|
require_relative "courier/resources/inbound"
|
|
460
480
|
require_relative "courier/resources/journeys"
|
|
481
|
+
require_relative "courier/resources/journeys/runs"
|
|
461
482
|
require_relative "courier/resources/journeys/templates"
|
|
462
483
|
require_relative "courier/resources/lists"
|
|
463
484
|
require_relative "courier/resources/lists/subscriptions"
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
# typed: strong
|
|
2
|
+
|
|
3
|
+
module Courier
|
|
4
|
+
module Models
|
|
5
|
+
class AutomationRunListItem < Courier::Internal::Type::BaseModel
|
|
6
|
+
OrHash =
|
|
7
|
+
T.type_alias do
|
|
8
|
+
T.any(Courier::AutomationRunListItem, Courier::Internal::AnyHash)
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
# A unique identifier representing the run.
|
|
12
|
+
sig { returns(String) }
|
|
13
|
+
attr_accessor :run_id
|
|
14
|
+
|
|
15
|
+
# Internal provenance strings describing what started the run, e.g.
|
|
16
|
+
# `invoke/<template_id>` or `segment/page/Pricing Page`. Diagnostic only — the
|
|
17
|
+
# format is unstable and should not be parsed.
|
|
18
|
+
sig { returns(T::Array[String]) }
|
|
19
|
+
attr_accessor :source
|
|
20
|
+
|
|
21
|
+
# When the run started, as an ISO 8601 timestamp.
|
|
22
|
+
sig { returns(T.nilable(String)) }
|
|
23
|
+
attr_reader :created_at
|
|
24
|
+
|
|
25
|
+
sig { params(created_at: String).void }
|
|
26
|
+
attr_writer :created_at
|
|
27
|
+
|
|
28
|
+
# The state of the run: `PROCESSING`, `PROCESSED`, `WAITING`, `CANCELED`, `ERROR`,
|
|
29
|
+
# `THROTTLED`, or `NOT PROCESSED`. Not an enum — new values have been added
|
|
30
|
+
# before.
|
|
31
|
+
sig { returns(T.nilable(String)) }
|
|
32
|
+
attr_reader :status
|
|
33
|
+
|
|
34
|
+
sig { params(status: String).void }
|
|
35
|
+
attr_writer :status
|
|
36
|
+
|
|
37
|
+
# The id of the Automation Template this run belongs to.
|
|
38
|
+
sig { returns(T.nilable(String)) }
|
|
39
|
+
attr_reader :template_id
|
|
40
|
+
|
|
41
|
+
sig { params(template_id: String).void }
|
|
42
|
+
attr_writer :template_id
|
|
43
|
+
|
|
44
|
+
# An Automation run as it appears in a list response.
|
|
45
|
+
sig do
|
|
46
|
+
params(
|
|
47
|
+
run_id: String,
|
|
48
|
+
source: T::Array[String],
|
|
49
|
+
created_at: String,
|
|
50
|
+
status: String,
|
|
51
|
+
template_id: String
|
|
52
|
+
).returns(T.attached_class)
|
|
53
|
+
end
|
|
54
|
+
def self.new(
|
|
55
|
+
# A unique identifier representing the run.
|
|
56
|
+
run_id:,
|
|
57
|
+
# Internal provenance strings describing what started the run, e.g.
|
|
58
|
+
# `invoke/<template_id>` or `segment/page/Pricing Page`. Diagnostic only — the
|
|
59
|
+
# format is unstable and should not be parsed.
|
|
60
|
+
source:,
|
|
61
|
+
# When the run started, as an ISO 8601 timestamp.
|
|
62
|
+
created_at: nil,
|
|
63
|
+
# The state of the run: `PROCESSING`, `PROCESSED`, `WAITING`, `CANCELED`, `ERROR`,
|
|
64
|
+
# `THROTTLED`, or `NOT PROCESSED`. Not an enum — new values have been added
|
|
65
|
+
# before.
|
|
66
|
+
status: nil,
|
|
67
|
+
# The id of the Automation Template this run belongs to.
|
|
68
|
+
template_id: nil
|
|
69
|
+
)
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
sig do
|
|
73
|
+
override.returns(
|
|
74
|
+
{
|
|
75
|
+
run_id: String,
|
|
76
|
+
source: T::Array[String],
|
|
77
|
+
created_at: String,
|
|
78
|
+
status: String,
|
|
79
|
+
template_id: String
|
|
80
|
+
}
|
|
81
|
+
)
|
|
82
|
+
end
|
|
83
|
+
def to_hash
|
|
84
|
+
end
|
|
85
|
+
end
|
|
86
|
+
end
|
|
87
|
+
end
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# typed: strong
|
|
2
|
+
|
|
3
|
+
module Courier
|
|
4
|
+
module Models
|
|
5
|
+
class AutomationRunListResponse < Courier::Internal::Type::BaseModel
|
|
6
|
+
OrHash =
|
|
7
|
+
T.type_alias do
|
|
8
|
+
T.any(Courier::AutomationRunListResponse, Courier::Internal::AnyHash)
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
sig { returns(T::Array[Courier::AutomationRunListItem]) }
|
|
12
|
+
attr_accessor :runs
|
|
13
|
+
|
|
14
|
+
# Pass back as `cursor` to fetch the next page. Absent on the last page.
|
|
15
|
+
sig { returns(T.nilable(String)) }
|
|
16
|
+
attr_reader :next_cursor
|
|
17
|
+
|
|
18
|
+
sig { params(next_cursor: String).void }
|
|
19
|
+
attr_writer :next_cursor
|
|
20
|
+
|
|
21
|
+
# A page of Automation runs.
|
|
22
|
+
sig do
|
|
23
|
+
params(
|
|
24
|
+
runs: T::Array[Courier::AutomationRunListItem::OrHash],
|
|
25
|
+
next_cursor: String
|
|
26
|
+
).returns(T.attached_class)
|
|
27
|
+
end
|
|
28
|
+
def self.new(
|
|
29
|
+
runs:,
|
|
30
|
+
# Pass back as `cursor` to fetch the next page. Absent on the last page.
|
|
31
|
+
next_cursor: nil
|
|
32
|
+
)
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
sig do
|
|
36
|
+
override.returns(
|
|
37
|
+
{
|
|
38
|
+
runs: T::Array[Courier::AutomationRunListItem],
|
|
39
|
+
next_cursor: String
|
|
40
|
+
}
|
|
41
|
+
)
|
|
42
|
+
end
|
|
43
|
+
def to_hash
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
# typed: strong
|
|
2
|
+
|
|
3
|
+
module Courier
|
|
4
|
+
module Models
|
|
5
|
+
class AutomationRunStep < Courier::Internal::Type::BaseModel
|
|
6
|
+
OrHash =
|
|
7
|
+
T.type_alias do
|
|
8
|
+
T.any(Courier::AutomationRunStep, Courier::Internal::AnyHash)
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
# The kind of step that ran, e.g. `send`, `delay`, or `update-profile`.
|
|
12
|
+
sig { returns(String) }
|
|
13
|
+
attr_accessor :action
|
|
14
|
+
|
|
15
|
+
# The state of the step: the seven run statuses, plus `SKIPPED` and `COMPUTING`.
|
|
16
|
+
# Not an enum — new values have been added before.
|
|
17
|
+
sig { returns(String) }
|
|
18
|
+
attr_accessor :status
|
|
19
|
+
|
|
20
|
+
# When the step started, as an ISO 8601 timestamp.
|
|
21
|
+
sig { returns(T.nilable(String)) }
|
|
22
|
+
attr_reader :created_at
|
|
23
|
+
|
|
24
|
+
sig { params(created_at: String).void }
|
|
25
|
+
attr_writer :created_at
|
|
26
|
+
|
|
27
|
+
# The message this step produced, present on send steps. Pass it to
|
|
28
|
+
# `GET /messages/{message_id}` for delivery status. A send to a List or an
|
|
29
|
+
# Audience yields one id for the request, not one per recipient.
|
|
30
|
+
sig { returns(T.nilable(String)) }
|
|
31
|
+
attr_reader :message_id
|
|
32
|
+
|
|
33
|
+
sig { params(message_id: String).void }
|
|
34
|
+
attr_writer :message_id
|
|
35
|
+
|
|
36
|
+
# A unique identifier representing the step.
|
|
37
|
+
sig { returns(T.nilable(String)) }
|
|
38
|
+
attr_reader :step_id
|
|
39
|
+
|
|
40
|
+
sig { params(step_id: String).void }
|
|
41
|
+
attr_writer :step_id
|
|
42
|
+
|
|
43
|
+
# When the step last changed state, as an ISO 8601 timestamp.
|
|
44
|
+
sig { returns(T.nilable(String)) }
|
|
45
|
+
attr_reader :updated_at
|
|
46
|
+
|
|
47
|
+
sig { params(updated_at: String).void }
|
|
48
|
+
attr_writer :updated_at
|
|
49
|
+
|
|
50
|
+
# One executed step of an Automation run.
|
|
51
|
+
sig do
|
|
52
|
+
params(
|
|
53
|
+
action: String,
|
|
54
|
+
status: String,
|
|
55
|
+
created_at: String,
|
|
56
|
+
message_id: String,
|
|
57
|
+
step_id: String,
|
|
58
|
+
updated_at: String
|
|
59
|
+
).returns(T.attached_class)
|
|
60
|
+
end
|
|
61
|
+
def self.new(
|
|
62
|
+
# The kind of step that ran, e.g. `send`, `delay`, or `update-profile`.
|
|
63
|
+
action:,
|
|
64
|
+
# The state of the step: the seven run statuses, plus `SKIPPED` and `COMPUTING`.
|
|
65
|
+
# Not an enum — new values have been added before.
|
|
66
|
+
status:,
|
|
67
|
+
# When the step started, as an ISO 8601 timestamp.
|
|
68
|
+
created_at: nil,
|
|
69
|
+
# The message this step produced, present on send steps. Pass it to
|
|
70
|
+
# `GET /messages/{message_id}` for delivery status. A send to a List or an
|
|
71
|
+
# Audience yields one id for the request, not one per recipient.
|
|
72
|
+
message_id: nil,
|
|
73
|
+
# A unique identifier representing the step.
|
|
74
|
+
step_id: nil,
|
|
75
|
+
# When the step last changed state, as an ISO 8601 timestamp.
|
|
76
|
+
updated_at: nil
|
|
77
|
+
)
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
sig do
|
|
81
|
+
override.returns(
|
|
82
|
+
{
|
|
83
|
+
action: String,
|
|
84
|
+
status: String,
|
|
85
|
+
created_at: String,
|
|
86
|
+
message_id: String,
|
|
87
|
+
step_id: String,
|
|
88
|
+
updated_at: String
|
|
89
|
+
}
|
|
90
|
+
)
|
|
91
|
+
end
|
|
92
|
+
def to_hash
|
|
93
|
+
end
|
|
94
|
+
end
|
|
95
|
+
end
|
|
96
|
+
end
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# typed: strong
|
|
2
|
+
|
|
3
|
+
module Courier
|
|
4
|
+
module Models
|
|
5
|
+
class AutomationRunStepsResponse < Courier::Internal::Type::BaseModel
|
|
6
|
+
OrHash =
|
|
7
|
+
T.type_alias do
|
|
8
|
+
T.any(Courier::AutomationRunStepsResponse, Courier::Internal::AnyHash)
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
sig { returns(T::Array[Courier::AutomationRunStep]) }
|
|
12
|
+
attr_accessor :steps
|
|
13
|
+
|
|
14
|
+
# Every step of an Automation run. Not paginated.
|
|
15
|
+
sig do
|
|
16
|
+
params(steps: T::Array[Courier::AutomationRunStep::OrHash]).returns(
|
|
17
|
+
T.attached_class
|
|
18
|
+
)
|
|
19
|
+
end
|
|
20
|
+
def self.new(steps:)
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
sig { override.returns({ steps: T::Array[Courier::AutomationRunStep] }) }
|
|
24
|
+
def to_hash
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|