trycourier 4.10.2 → 4.11.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 (148) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +21 -0
  3. data/lib/courier/client.rb +15 -1
  4. data/lib/courier/internal/transport/base_client.rb +2 -0
  5. data/lib/courier/models/create_journey_request.rb +39 -0
  6. data/lib/courier/models/journey_ai_node.rb +77 -0
  7. data/lib/courier/models/journey_api_invoke_trigger_node.rb +73 -0
  8. data/lib/courier/models/journey_archive_params.rb +20 -0
  9. data/lib/courier/models/journey_condition_atom.rb +8 -0
  10. data/lib/courier/models/journey_condition_group.rb +26 -0
  11. data/lib/courier/models/journey_condition_nested_group.rb +24 -0
  12. data/lib/courier/models/journey_conditions_field.rb +37 -0
  13. data/lib/courier/models/journey_create_params.rb +14 -0
  14. data/lib/courier/models/journey_delay_duration_node.rb +71 -0
  15. data/lib/courier/models/journey_delay_until_node.rb +71 -0
  16. data/lib/courier/models/journey_exit_node.rb +33 -0
  17. data/lib/courier/models/journey_fetch_get_delete_node.rb +103 -0
  18. data/lib/courier/models/journey_fetch_post_put_node.rb +110 -0
  19. data/lib/courier/models/journey_list_versions_params.rb +20 -0
  20. data/lib/courier/models/journey_merge_strategy.rb +18 -0
  21. data/lib/courier/models/journey_node.rb +139 -0
  22. data/lib/courier/models/journey_publish_params.rb +20 -0
  23. data/lib/courier/models/journey_publish_request.rb +18 -0
  24. data/lib/courier/models/journey_replace_params.rb +20 -0
  25. data/lib/courier/models/journey_response.rb +82 -0
  26. data/lib/courier/models/journey_retrieve_params.rb +29 -0
  27. data/lib/courier/models/journey_segment_trigger_node.rb +90 -0
  28. data/lib/courier/models/journey_send_node.rb +124 -0
  29. data/lib/courier/models/journey_state.rb +16 -0
  30. data/lib/courier/models/journey_template_create_request.rb +138 -0
  31. data/lib/courier/models/journey_template_get_response.rb +154 -0
  32. data/lib/courier/models/journey_template_list_response.rb +23 -0
  33. data/lib/courier/models/journey_template_publish_request.rb +18 -0
  34. data/lib/courier/models/journey_template_replace_request.rb +126 -0
  35. data/lib/courier/models/journey_template_summary.rb +60 -0
  36. data/lib/courier/models/journey_throttle_dynamic_node.rb +86 -0
  37. data/lib/courier/models/journey_throttle_static_node.rb +80 -0
  38. data/lib/courier/models/journey_version_item.rb +41 -0
  39. data/lib/courier/models/journey_versions_list_response.rb +24 -0
  40. data/lib/courier/models/journeys/template_archive_params.rb +28 -0
  41. data/lib/courier/models/journeys/template_create_params.rb +22 -0
  42. data/lib/courier/models/journeys/template_list_params.rb +39 -0
  43. data/lib/courier/models/journeys/template_list_versions_params.rb +28 -0
  44. data/lib/courier/models/journeys/template_publish_params.rb +28 -0
  45. data/lib/courier/models/journeys/template_replace_params.rb +28 -0
  46. data/lib/courier/models/journeys/template_retrieve_params.rb +28 -0
  47. data/lib/courier/models/tenants/template_delete_params.rb +28 -0
  48. data/lib/courier/models.rb +73 -0
  49. data/lib/courier/resources/journeys/templates.rb +224 -0
  50. data/lib/courier/resources/journeys.rb +167 -2
  51. data/lib/courier/resources/tenants/templates.rb +32 -0
  52. data/lib/courier/version.rb +1 -1
  53. data/lib/courier.rb +44 -0
  54. data/rbi/courier/models/create_journey_request.rbi +113 -0
  55. data/rbi/courier/models/journey_ai_node.rbi +141 -0
  56. data/rbi/courier/models/journey_api_invoke_trigger_node.rbi +164 -0
  57. data/rbi/courier/models/journey_archive_params.rbi +35 -0
  58. data/rbi/courier/models/journey_condition_atom.rbi +11 -0
  59. data/rbi/courier/models/journey_condition_group.rbi +43 -0
  60. data/rbi/courier/models/journey_condition_nested_group.rbi +51 -0
  61. data/rbi/courier/models/journey_conditions_field.rbi +27 -0
  62. data/rbi/courier/models/journey_create_params.rbi +27 -0
  63. data/rbi/courier/models/journey_delay_duration_node.rbi +146 -0
  64. data/rbi/courier/models/journey_delay_until_node.rbi +139 -0
  65. data/rbi/courier/models/journey_exit_node.rbi +57 -0
  66. data/rbi/courier/models/journey_fetch_get_delete_node.rbi +186 -0
  67. data/rbi/courier/models/journey_fetch_post_put_node.rbi +190 -0
  68. data/rbi/courier/models/journey_list_versions_params.rbi +35 -0
  69. data/rbi/courier/models/journey_merge_strategy.rbi +26 -0
  70. data/rbi/courier/models/journey_node.rbi +227 -0
  71. data/rbi/courier/models/journey_publish_params.rbi +35 -0
  72. data/rbi/courier/models/journey_publish_request.rbi +28 -0
  73. data/rbi/courier/models/journey_replace_params.rbi +35 -0
  74. data/rbi/courier/models/journey_response.rbi +108 -0
  75. data/rbi/courier/models/journey_retrieve_params.rbi +52 -0
  76. data/rbi/courier/models/journey_segment_trigger_node.rbi +200 -0
  77. data/rbi/courier/models/journey_send_node.rbi +254 -0
  78. data/rbi/courier/models/journey_state.rbi +20 -0
  79. data/rbi/courier/models/journey_template_create_request.rbi +381 -0
  80. data/rbi/courier/models/journey_template_get_response.rbi +334 -0
  81. data/rbi/courier/models/journey_template_list_response.rbi +45 -0
  82. data/rbi/courier/models/journey_template_publish_request.rbi +31 -0
  83. data/rbi/courier/models/journey_template_replace_request.rbi +368 -0
  84. data/rbi/courier/models/journey_template_summary.rbi +85 -0
  85. data/rbi/courier/models/journey_throttle_dynamic_node.rbi +162 -0
  86. data/rbi/courier/models/journey_throttle_static_node.rbi +158 -0
  87. data/rbi/courier/models/journey_version_item.rbi +54 -0
  88. data/rbi/courier/models/journey_versions_list_response.rbi +45 -0
  89. data/rbi/courier/models/journeys/template_archive_params.rbi +48 -0
  90. data/rbi/courier/models/journeys/template_create_params.rbi +40 -0
  91. data/rbi/courier/models/journeys/template_list_params.rbi +68 -0
  92. data/rbi/courier/models/journeys/template_list_versions_params.rbi +48 -0
  93. data/rbi/courier/models/journeys/template_publish_params.rbi +48 -0
  94. data/rbi/courier/models/journeys/template_replace_params.rbi +48 -0
  95. data/rbi/courier/models/journeys/template_retrieve_params.rbi +48 -0
  96. data/rbi/courier/models/tenants/template_delete_params.rbi +48 -0
  97. data/rbi/courier/models.rbi +76 -0
  98. data/rbi/courier/resources/journeys/templates.rbi +160 -0
  99. data/rbi/courier/resources/journeys.rbi +156 -3
  100. data/rbi/courier/resources/tenants/templates.rbi +22 -0
  101. data/sig/courier/models/create_journey_request.rbs +41 -0
  102. data/sig/courier/models/journey_ai_node.rbs +72 -0
  103. data/sig/courier/models/journey_api_invoke_trigger_node.rbs +68 -0
  104. data/sig/courier/models/journey_archive_params.rbs +23 -0
  105. data/sig/courier/models/journey_condition_atom.rbs +7 -0
  106. data/sig/courier/models/journey_condition_group.rbs +33 -0
  107. data/sig/courier/models/journey_condition_nested_group.rbs +33 -0
  108. data/sig/courier/models/journey_conditions_field.rbs +14 -0
  109. data/sig/courier/models/journey_create_params.rbs +15 -0
  110. data/sig/courier/models/journey_delay_duration_node.rbs +66 -0
  111. data/sig/courier/models/journey_delay_until_node.rbs +66 -0
  112. data/sig/courier/models/journey_exit_node.rbs +34 -0
  113. data/sig/courier/models/journey_fetch_get_delete_node.rbs +93 -0
  114. data/sig/courier/models/journey_fetch_post_put_node.rbs +100 -0
  115. data/sig/courier/models/journey_list_versions_params.rbs +23 -0
  116. data/sig/courier/models/journey_merge_strategy.rbs +16 -0
  117. data/sig/courier/models/journey_node.rbs +117 -0
  118. data/sig/courier/models/journey_publish_params.rbs +25 -0
  119. data/sig/courier/models/journey_publish_request.rbs +15 -0
  120. data/sig/courier/models/journey_replace_params.rbs +25 -0
  121. data/sig/courier/models/journey_response.rbs +65 -0
  122. data/sig/courier/models/journey_retrieve_params.rbs +30 -0
  123. data/sig/courier/models/journey_segment_trigger_node.rbs +85 -0
  124. data/sig/courier/models/journey_send_node.rbs +140 -0
  125. data/sig/courier/models/journey_state.rbs +14 -0
  126. data/sig/courier/models/journey_template_create_request.rbs +148 -0
  127. data/sig/courier/models/journey_template_get_response.rbs +157 -0
  128. data/sig/courier/models/journey_template_list_response.rbs +25 -0
  129. data/sig/courier/models/journey_template_publish_request.rbs +15 -0
  130. data/sig/courier/models/journey_template_replace_request.rbs +136 -0
  131. data/sig/courier/models/journey_template_summary.rbs +59 -0
  132. data/sig/courier/models/journey_throttle_dynamic_node.rbs +76 -0
  133. data/sig/courier/models/journey_throttle_static_node.rbs +72 -0
  134. data/sig/courier/models/journey_version_item.rbs +40 -0
  135. data/sig/courier/models/journey_versions_list_response.rbs +22 -0
  136. data/sig/courier/models/journeys/template_archive_params.rbs +30 -0
  137. data/sig/courier/models/journeys/template_create_params.rbs +27 -0
  138. data/sig/courier/models/journeys/template_list_params.rbs +38 -0
  139. data/sig/courier/models/journeys/template_list_versions_params.rbs +30 -0
  140. data/sig/courier/models/journeys/template_publish_params.rbs +34 -0
  141. data/sig/courier/models/journeys/template_replace_params.rbs +34 -0
  142. data/sig/courier/models/journeys/template_retrieve_params.rbs +30 -0
  143. data/sig/courier/models/tenants/template_delete_params.rbs +30 -0
  144. data/sig/courier/models.rbs +72 -0
  145. data/sig/courier/resources/journeys/templates.rbs +58 -0
  146. data/sig/courier/resources/journeys.rbs +41 -0
  147. data/sig/courier/resources/tenants/templates.rbs +6 -0
  148. metadata +134 -2
@@ -0,0 +1,141 @@
1
+ # typed: strong
2
+
3
+ module Courier
4
+ module Models
5
+ class JourneyAINode < Courier::Internal::Type::BaseModel
6
+ OrHash =
7
+ T.type_alias do
8
+ T.any(Courier::JourneyAINode, Courier::Internal::AnyHash)
9
+ end
10
+
11
+ # A JSONSchema object (Draft-07-compatible). Validated at runtime by Ajv.
12
+ sig { returns(T::Hash[Symbol, T.anything]) }
13
+ attr_accessor :output_schema
14
+
15
+ sig { returns(Courier::JourneyAINode::Type::OrSymbol) }
16
+ attr_accessor :type
17
+
18
+ sig { returns(T.nilable(String)) }
19
+ attr_reader :id
20
+
21
+ sig { params(id: String).void }
22
+ attr_writer :id
23
+
24
+ # Condition spec for a journey node. Accepts a single condition atom, an AND/OR
25
+ # group, or an AND/OR nested group. Omit the `conditions` property entirely to
26
+ # express "no conditions".
27
+ sig do
28
+ returns(
29
+ T.nilable(
30
+ T.any(
31
+ T::Array[String],
32
+ Courier::JourneyConditionGroup,
33
+ Courier::JourneyConditionNestedGroup
34
+ )
35
+ )
36
+ )
37
+ end
38
+ attr_reader :conditions
39
+
40
+ sig do
41
+ params(
42
+ conditions:
43
+ T.any(
44
+ T::Array[String],
45
+ Courier::JourneyConditionGroup::OrHash,
46
+ Courier::JourneyConditionNestedGroup::OrHash
47
+ )
48
+ ).void
49
+ end
50
+ attr_writer :conditions
51
+
52
+ sig { returns(T.nilable(String)) }
53
+ attr_reader :model
54
+
55
+ sig { params(model: String).void }
56
+ attr_writer :model
57
+
58
+ sig { returns(T.nilable(String)) }
59
+ attr_reader :user_prompt
60
+
61
+ sig { params(user_prompt: String).void }
62
+ attr_writer :user_prompt
63
+
64
+ sig { returns(T.nilable(T::Boolean)) }
65
+ attr_reader :web_search
66
+
67
+ sig { params(web_search: T::Boolean).void }
68
+ attr_writer :web_search
69
+
70
+ # Invoke an AI step with `user_prompt` and optional `web_search`. Returns a
71
+ # structured response conforming to `output_schema`.
72
+ sig do
73
+ params(
74
+ output_schema: T::Hash[Symbol, T.anything],
75
+ type: Courier::JourneyAINode::Type::OrSymbol,
76
+ id: String,
77
+ conditions:
78
+ T.any(
79
+ T::Array[String],
80
+ Courier::JourneyConditionGroup::OrHash,
81
+ Courier::JourneyConditionNestedGroup::OrHash
82
+ ),
83
+ model: String,
84
+ user_prompt: String,
85
+ web_search: T::Boolean
86
+ ).returns(T.attached_class)
87
+ end
88
+ def self.new(
89
+ # A JSONSchema object (Draft-07-compatible). Validated at runtime by Ajv.
90
+ output_schema:,
91
+ type:,
92
+ id: nil,
93
+ # Condition spec for a journey node. Accepts a single condition atom, an AND/OR
94
+ # group, or an AND/OR nested group. Omit the `conditions` property entirely to
95
+ # express "no conditions".
96
+ conditions: nil,
97
+ model: nil,
98
+ user_prompt: nil,
99
+ web_search: nil
100
+ )
101
+ end
102
+
103
+ sig do
104
+ override.returns(
105
+ {
106
+ output_schema: T::Hash[Symbol, T.anything],
107
+ type: Courier::JourneyAINode::Type::OrSymbol,
108
+ id: String,
109
+ conditions:
110
+ T.any(
111
+ T::Array[String],
112
+ Courier::JourneyConditionGroup,
113
+ Courier::JourneyConditionNestedGroup
114
+ ),
115
+ model: String,
116
+ user_prompt: String,
117
+ web_search: T::Boolean
118
+ }
119
+ )
120
+ end
121
+ def to_hash
122
+ end
123
+
124
+ module Type
125
+ extend Courier::Internal::Type::Enum
126
+
127
+ TaggedSymbol =
128
+ T.type_alias { T.all(Symbol, Courier::JourneyAINode::Type) }
129
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
130
+
131
+ AI = T.let(:ai, Courier::JourneyAINode::Type::TaggedSymbol)
132
+
133
+ sig do
134
+ override.returns(T::Array[Courier::JourneyAINode::Type::TaggedSymbol])
135
+ end
136
+ def self.values
137
+ end
138
+ end
139
+ end
140
+ end
141
+ end
@@ -0,0 +1,164 @@
1
+ # typed: strong
2
+
3
+ module Courier
4
+ module Models
5
+ class JourneyAPIInvokeTriggerNode < Courier::Internal::Type::BaseModel
6
+ OrHash =
7
+ T.type_alias do
8
+ T.any(
9
+ Courier::JourneyAPIInvokeTriggerNode,
10
+ Courier::Internal::AnyHash
11
+ )
12
+ end
13
+
14
+ sig do
15
+ returns(Courier::JourneyAPIInvokeTriggerNode::TriggerType::OrSymbol)
16
+ end
17
+ attr_accessor :trigger_type
18
+
19
+ sig { returns(Courier::JourneyAPIInvokeTriggerNode::Type::OrSymbol) }
20
+ attr_accessor :type
21
+
22
+ sig { returns(T.nilable(String)) }
23
+ attr_reader :id
24
+
25
+ sig { params(id: String).void }
26
+ attr_writer :id
27
+
28
+ # Condition spec for a journey node. Accepts a single condition atom, an AND/OR
29
+ # group, or an AND/OR nested group. Omit the `conditions` property entirely to
30
+ # express "no conditions".
31
+ sig do
32
+ returns(
33
+ T.nilable(
34
+ T.any(
35
+ T::Array[String],
36
+ Courier::JourneyConditionGroup,
37
+ Courier::JourneyConditionNestedGroup
38
+ )
39
+ )
40
+ )
41
+ end
42
+ attr_reader :conditions
43
+
44
+ sig do
45
+ params(
46
+ conditions:
47
+ T.any(
48
+ T::Array[String],
49
+ Courier::JourneyConditionGroup::OrHash,
50
+ Courier::JourneyConditionNestedGroup::OrHash
51
+ )
52
+ ).void
53
+ end
54
+ attr_writer :conditions
55
+
56
+ # A JSONSchema object (Draft-07-compatible). Validated at runtime by Ajv.
57
+ sig { returns(T.nilable(T::Hash[Symbol, T.anything])) }
58
+ attr_reader :schema
59
+
60
+ sig { params(schema: T::Hash[Symbol, T.anything]).void }
61
+ attr_writer :schema
62
+
63
+ # Trigger fired when the journey is invoked via the API. The optional `schema`
64
+ # field is a JSON Schema that validates the invocation payload.
65
+ sig do
66
+ params(
67
+ trigger_type:
68
+ Courier::JourneyAPIInvokeTriggerNode::TriggerType::OrSymbol,
69
+ type: Courier::JourneyAPIInvokeTriggerNode::Type::OrSymbol,
70
+ id: String,
71
+ conditions:
72
+ T.any(
73
+ T::Array[String],
74
+ Courier::JourneyConditionGroup::OrHash,
75
+ Courier::JourneyConditionNestedGroup::OrHash
76
+ ),
77
+ schema: T::Hash[Symbol, T.anything]
78
+ ).returns(T.attached_class)
79
+ end
80
+ def self.new(
81
+ trigger_type:,
82
+ type:,
83
+ id: nil,
84
+ # Condition spec for a journey node. Accepts a single condition atom, an AND/OR
85
+ # group, or an AND/OR nested group. Omit the `conditions` property entirely to
86
+ # express "no conditions".
87
+ conditions: nil,
88
+ # A JSONSchema object (Draft-07-compatible). Validated at runtime by Ajv.
89
+ schema: nil
90
+ )
91
+ end
92
+
93
+ sig do
94
+ override.returns(
95
+ {
96
+ trigger_type:
97
+ Courier::JourneyAPIInvokeTriggerNode::TriggerType::OrSymbol,
98
+ type: Courier::JourneyAPIInvokeTriggerNode::Type::OrSymbol,
99
+ id: String,
100
+ conditions:
101
+ T.any(
102
+ T::Array[String],
103
+ Courier::JourneyConditionGroup,
104
+ Courier::JourneyConditionNestedGroup
105
+ ),
106
+ schema: T::Hash[Symbol, T.anything]
107
+ }
108
+ )
109
+ end
110
+ def to_hash
111
+ end
112
+
113
+ module TriggerType
114
+ extend Courier::Internal::Type::Enum
115
+
116
+ TaggedSymbol =
117
+ T.type_alias do
118
+ T.all(Symbol, Courier::JourneyAPIInvokeTriggerNode::TriggerType)
119
+ end
120
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
121
+
122
+ API_INVOKE =
123
+ T.let(
124
+ :"api-invoke",
125
+ Courier::JourneyAPIInvokeTriggerNode::TriggerType::TaggedSymbol
126
+ )
127
+
128
+ sig do
129
+ override.returns(
130
+ T::Array[
131
+ Courier::JourneyAPIInvokeTriggerNode::TriggerType::TaggedSymbol
132
+ ]
133
+ )
134
+ end
135
+ def self.values
136
+ end
137
+ end
138
+
139
+ module Type
140
+ extend Courier::Internal::Type::Enum
141
+
142
+ TaggedSymbol =
143
+ T.type_alias do
144
+ T.all(Symbol, Courier::JourneyAPIInvokeTriggerNode::Type)
145
+ end
146
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
147
+
148
+ TRIGGER =
149
+ T.let(
150
+ :trigger,
151
+ Courier::JourneyAPIInvokeTriggerNode::Type::TaggedSymbol
152
+ )
153
+
154
+ sig do
155
+ override.returns(
156
+ T::Array[Courier::JourneyAPIInvokeTriggerNode::Type::TaggedSymbol]
157
+ )
158
+ end
159
+ def self.values
160
+ end
161
+ end
162
+ end
163
+ end
164
+ end
@@ -0,0 +1,35 @@
1
+ # typed: strong
2
+
3
+ module Courier
4
+ module Models
5
+ class JourneyArchiveParams < Courier::Internal::Type::BaseModel
6
+ extend Courier::Internal::Type::RequestParameters::Converter
7
+ include Courier::Internal::Type::RequestParameters
8
+
9
+ OrHash =
10
+ T.type_alias do
11
+ T.any(Courier::JourneyArchiveParams, Courier::Internal::AnyHash)
12
+ end
13
+
14
+ sig { returns(String) }
15
+ attr_accessor :template_id
16
+
17
+ sig do
18
+ params(
19
+ template_id: String,
20
+ request_options: Courier::RequestOptions::OrHash
21
+ ).returns(T.attached_class)
22
+ end
23
+ def self.new(template_id:, request_options: {})
24
+ end
25
+
26
+ sig do
27
+ override.returns(
28
+ { template_id: String, request_options: Courier::RequestOptions }
29
+ )
30
+ end
31
+ def to_hash
32
+ end
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,11 @@
1
+ # typed: strong
2
+
3
+ module Courier
4
+ module Models
5
+ JourneyConditionAtom =
6
+ T.let(
7
+ Courier::Internal::Type::ArrayOf[String],
8
+ Courier::Internal::Type::Converter
9
+ )
10
+ end
11
+ end
@@ -0,0 +1,43 @@
1
+ # typed: strong
2
+
3
+ module Courier
4
+ module Models
5
+ class JourneyConditionGroup < Courier::Internal::Type::BaseModel
6
+ OrHash =
7
+ T.type_alias do
8
+ T.any(Courier::JourneyConditionGroup, Courier::Internal::AnyHash)
9
+ end
10
+
11
+ sig { returns(T.nilable(T::Array[T::Array[String]])) }
12
+ attr_reader :and_
13
+
14
+ sig { params(and_: T::Array[T::Array[String]]).void }
15
+ attr_writer :and_
16
+
17
+ sig { returns(T.nilable(T::Array[T::Array[String]])) }
18
+ attr_reader :or_
19
+
20
+ sig { params(or_: T::Array[T::Array[String]]).void }
21
+ attr_writer :or_
22
+
23
+ # A leaf condition group. Exactly one of `AND` or `OR` must be present at runtime;
24
+ # each is a list of `JourneyConditionAtom` tuples.
25
+ sig do
26
+ params(
27
+ and_: T::Array[T::Array[String]],
28
+ or_: T::Array[T::Array[String]]
29
+ ).returns(T.attached_class)
30
+ end
31
+ def self.new(and_: nil, or_: nil)
32
+ end
33
+
34
+ sig do
35
+ override.returns(
36
+ { and_: T::Array[T::Array[String]], or_: T::Array[T::Array[String]] }
37
+ )
38
+ end
39
+ def to_hash
40
+ end
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,51 @@
1
+ # typed: strong
2
+
3
+ module Courier
4
+ module Models
5
+ class JourneyConditionNestedGroup < Courier::Internal::Type::BaseModel
6
+ OrHash =
7
+ T.type_alias do
8
+ T.any(
9
+ Courier::JourneyConditionNestedGroup,
10
+ Courier::Internal::AnyHash
11
+ )
12
+ end
13
+
14
+ sig { returns(T.nilable(T::Array[Courier::JourneyConditionGroup])) }
15
+ attr_reader :and_
16
+
17
+ sig do
18
+ params(and_: T::Array[Courier::JourneyConditionGroup::OrHash]).void
19
+ end
20
+ attr_writer :and_
21
+
22
+ sig { returns(T.nilable(T::Array[Courier::JourneyConditionGroup])) }
23
+ attr_reader :or_
24
+
25
+ sig { params(or_: T::Array[Courier::JourneyConditionGroup::OrHash]).void }
26
+ attr_writer :or_
27
+
28
+ # A nested condition group. Exactly one of `AND` or `OR` must be present at
29
+ # runtime; each is a list of `JourneyConditionGroup` items.
30
+ sig do
31
+ params(
32
+ and_: T::Array[Courier::JourneyConditionGroup::OrHash],
33
+ or_: T::Array[Courier::JourneyConditionGroup::OrHash]
34
+ ).returns(T.attached_class)
35
+ end
36
+ def self.new(and_: nil, or_: nil)
37
+ end
38
+
39
+ sig do
40
+ override.returns(
41
+ {
42
+ and_: T::Array[Courier::JourneyConditionGroup],
43
+ or_: T::Array[Courier::JourneyConditionGroup]
44
+ }
45
+ )
46
+ end
47
+ def to_hash
48
+ end
49
+ end
50
+ end
51
+ end
@@ -0,0 +1,27 @@
1
+ # typed: strong
2
+
3
+ module Courier
4
+ module Models
5
+ # Condition spec for a journey node. Accepts a single condition atom, an AND/OR
6
+ # group, or an AND/OR nested group. Omit the `conditions` property entirely to
7
+ # express "no conditions".
8
+ module JourneyConditionsField
9
+ extend Courier::Internal::Type::Union
10
+
11
+ Variants =
12
+ T.type_alias do
13
+ T.any(
14
+ T::Array[String],
15
+ Courier::JourneyConditionGroup,
16
+ Courier::JourneyConditionNestedGroup
17
+ )
18
+ end
19
+
20
+ sig do
21
+ override.returns(T::Array[Courier::JourneyConditionsField::Variants])
22
+ end
23
+ def self.variants
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,27 @@
1
+ # typed: strong
2
+
3
+ module Courier
4
+ module Models
5
+ class JourneyCreateParams < Courier::Models::CreateJourneyRequest
6
+ extend Courier::Internal::Type::RequestParameters::Converter
7
+ include Courier::Internal::Type::RequestParameters
8
+
9
+ OrHash =
10
+ T.type_alias do
11
+ T.any(Courier::JourneyCreateParams, Courier::Internal::AnyHash)
12
+ end
13
+
14
+ sig do
15
+ params(request_options: Courier::RequestOptions::OrHash).returns(
16
+ T.attached_class
17
+ )
18
+ end
19
+ def self.new(request_options: {})
20
+ end
21
+
22
+ sig { override.returns({ request_options: Courier::RequestOptions }) }
23
+ def to_hash
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,146 @@
1
+ # typed: strong
2
+
3
+ module Courier
4
+ module Models
5
+ class JourneyDelayDurationNode < Courier::Internal::Type::BaseModel
6
+ OrHash =
7
+ T.type_alias do
8
+ T.any(Courier::JourneyDelayDurationNode, Courier::Internal::AnyHash)
9
+ end
10
+
11
+ sig { returns(String) }
12
+ attr_accessor :duration
13
+
14
+ sig { returns(Courier::JourneyDelayDurationNode::Mode::OrSymbol) }
15
+ attr_accessor :mode
16
+
17
+ sig { returns(Courier::JourneyDelayDurationNode::Type::OrSymbol) }
18
+ attr_accessor :type
19
+
20
+ sig { returns(T.nilable(String)) }
21
+ attr_reader :id
22
+
23
+ sig { params(id: String).void }
24
+ attr_writer :id
25
+
26
+ # Condition spec for a journey node. Accepts a single condition atom, an AND/OR
27
+ # group, or an AND/OR nested group. Omit the `conditions` property entirely to
28
+ # express "no conditions".
29
+ sig do
30
+ returns(
31
+ T.nilable(
32
+ T.any(
33
+ T::Array[String],
34
+ Courier::JourneyConditionGroup,
35
+ Courier::JourneyConditionNestedGroup
36
+ )
37
+ )
38
+ )
39
+ end
40
+ attr_reader :conditions
41
+
42
+ sig do
43
+ params(
44
+ conditions:
45
+ T.any(
46
+ T::Array[String],
47
+ Courier::JourneyConditionGroup::OrHash,
48
+ Courier::JourneyConditionNestedGroup::OrHash
49
+ )
50
+ ).void
51
+ end
52
+ attr_writer :conditions
53
+
54
+ # Pause the journey run for a fixed `duration`.
55
+ sig do
56
+ params(
57
+ duration: String,
58
+ mode: Courier::JourneyDelayDurationNode::Mode::OrSymbol,
59
+ type: Courier::JourneyDelayDurationNode::Type::OrSymbol,
60
+ id: String,
61
+ conditions:
62
+ T.any(
63
+ T::Array[String],
64
+ Courier::JourneyConditionGroup::OrHash,
65
+ Courier::JourneyConditionNestedGroup::OrHash
66
+ )
67
+ ).returns(T.attached_class)
68
+ end
69
+ def self.new(
70
+ duration:,
71
+ mode:,
72
+ type:,
73
+ id: nil,
74
+ # Condition spec for a journey node. Accepts a single condition atom, an AND/OR
75
+ # group, or an AND/OR nested group. Omit the `conditions` property entirely to
76
+ # express "no conditions".
77
+ conditions: nil
78
+ )
79
+ end
80
+
81
+ sig do
82
+ override.returns(
83
+ {
84
+ duration: String,
85
+ mode: Courier::JourneyDelayDurationNode::Mode::OrSymbol,
86
+ type: Courier::JourneyDelayDurationNode::Type::OrSymbol,
87
+ id: String,
88
+ conditions:
89
+ T.any(
90
+ T::Array[String],
91
+ Courier::JourneyConditionGroup,
92
+ Courier::JourneyConditionNestedGroup
93
+ )
94
+ }
95
+ )
96
+ end
97
+ def to_hash
98
+ end
99
+
100
+ module Mode
101
+ extend Courier::Internal::Type::Enum
102
+
103
+ TaggedSymbol =
104
+ T.type_alias do
105
+ T.all(Symbol, Courier::JourneyDelayDurationNode::Mode)
106
+ end
107
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
108
+
109
+ DURATION =
110
+ T.let(
111
+ :duration,
112
+ Courier::JourneyDelayDurationNode::Mode::TaggedSymbol
113
+ )
114
+
115
+ sig do
116
+ override.returns(
117
+ T::Array[Courier::JourneyDelayDurationNode::Mode::TaggedSymbol]
118
+ )
119
+ end
120
+ def self.values
121
+ end
122
+ end
123
+
124
+ module Type
125
+ extend Courier::Internal::Type::Enum
126
+
127
+ TaggedSymbol =
128
+ T.type_alias do
129
+ T.all(Symbol, Courier::JourneyDelayDurationNode::Type)
130
+ end
131
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
132
+
133
+ DELAY =
134
+ T.let(:delay, Courier::JourneyDelayDurationNode::Type::TaggedSymbol)
135
+
136
+ sig do
137
+ override.returns(
138
+ T::Array[Courier::JourneyDelayDurationNode::Type::TaggedSymbol]
139
+ )
140
+ end
141
+ def self.values
142
+ end
143
+ end
144
+ end
145
+ end
146
+ end