surge_api 0.1.0 → 0.2.1
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 +39 -0
- data/README.md +12 -63
- data/lib/surge_api/file_part.rb +10 -7
- data/lib/surge_api/internal/transport/pooled_net_requester.rb +34 -31
- data/lib/surge_api/internal/type/file_input.rb +7 -4
- data/lib/surge_api/internal/type/union.rb +1 -1
- data/lib/surge_api/internal/util.rb +5 -5
- data/lib/surge_api/models/account_create_params.rb +13 -6
- data/lib/surge_api/models/account_update_params.rb +13 -6
- data/lib/surge_api/models/campaign_create_params.rb +7 -183
- data/lib/surge_api/models/campaign_params.rb +228 -0
- data/lib/surge_api/models/contact_opted_in_webhook_event.rb +54 -0
- data/lib/surge_api/models/contact_opted_out_webhook_event.rb +54 -0
- data/lib/surge_api/models/message_create_params.rb +8 -134
- data/lib/surge_api/models/message_params.rb +216 -0
- data/lib/surge_api/models/unwrap_webhook_event.rb +5 -1
- data/lib/surge_api/models.rb +8 -0
- data/lib/surge_api/resources/campaigns.rb +7 -18
- data/lib/surge_api/resources/messages.rb +7 -12
- data/lib/surge_api/resources/webhooks.rb +1 -1
- data/lib/surge_api/version.rb +1 -1
- data/lib/surge_api.rb +4 -0
- data/rbi/surge_api/file_part.rbi +1 -1
- data/rbi/surge_api/models/account_create_params.rbi +19 -8
- data/rbi/surge_api/models/account_update_params.rbi +19 -8
- data/rbi/surge_api/models/campaign_create_params.rbi +20 -346
- data/rbi/surge_api/models/campaign_params.rbi +481 -0
- data/rbi/surge_api/models/contact_opted_in_webhook_event.rbi +95 -0
- data/rbi/surge_api/models/contact_opted_out_webhook_event.rbi +95 -0
- data/rbi/surge_api/models/message_create_params.rbi +24 -243
- data/rbi/surge_api/models/message_params.rbi +430 -0
- data/rbi/surge_api/models/unwrap_webhook_event.rbi +2 -0
- data/rbi/surge_api/models.rbi +8 -0
- data/rbi/surge_api/resources/campaigns.rbi +4 -89
- data/rbi/surge_api/resources/messages.rbi +5 -22
- data/rbi/surge_api/resources/webhooks.rbi +2 -0
- data/sig/surge_api/file_part.rbs +1 -1
- data/sig/surge_api/models/campaign_create_params.rbs +7 -106
- data/sig/surge_api/models/campaign_params.rbs +141 -0
- data/sig/surge_api/models/contact_opted_in_webhook_event.rbs +45 -0
- data/sig/surge_api/models/contact_opted_out_webhook_event.rbs +45 -0
- data/sig/surge_api/models/message_create_params.rbs +7 -119
- data/sig/surge_api/models/message_params.rbs +189 -0
- data/sig/surge_api/models/unwrap_webhook_event.rbs +2 -0
- data/sig/surge_api/models.rbs +8 -0
- data/sig/surge_api/resources/campaigns.rbs +1 -9
- data/sig/surge_api/resources/messages.rbs +1 -6
- data/sig/surge_api/resources/webhooks.rbs +2 -0
- metadata +14 -2
|
@@ -11,87 +11,34 @@ module SurgeAPI
|
|
|
11
11
|
T.any(SurgeAPI::MessageCreateParams, SurgeAPI::Internal::AnyHash)
|
|
12
12
|
end
|
|
13
13
|
|
|
14
|
-
#
|
|
15
|
-
#
|
|
16
|
-
|
|
17
|
-
attr_reader :conversation
|
|
18
|
-
|
|
19
|
-
sig do
|
|
20
|
-
params(
|
|
21
|
-
conversation: SurgeAPI::MessageCreateParams::Conversation::OrHash
|
|
22
|
-
).void
|
|
23
|
-
end
|
|
24
|
-
attr_writer :conversation
|
|
25
|
-
|
|
26
|
-
sig do
|
|
27
|
-
returns(T.nilable(T::Array[SurgeAPI::MessageCreateParams::Attachment]))
|
|
28
|
-
end
|
|
29
|
-
attr_reader :attachments
|
|
30
|
-
|
|
14
|
+
# Payload for creating a message. Either an attachment or the body must be given.
|
|
15
|
+
# You can specify the recipient either using the 'conversation' parameter or the
|
|
16
|
+
# 'to'/'from' parameters, but not both.
|
|
31
17
|
sig do
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
18
|
+
returns(
|
|
19
|
+
T.any(
|
|
20
|
+
SurgeAPI::MessageParams::MessageParamsWithConversation,
|
|
21
|
+
SurgeAPI::MessageParams::SimpleMessageParams
|
|
22
|
+
)
|
|
23
|
+
)
|
|
36
24
|
end
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
# The message body.
|
|
40
|
-
sig { returns(T.nilable(String)) }
|
|
41
|
-
attr_reader :body
|
|
42
|
-
|
|
43
|
-
sig { params(body: String).void }
|
|
44
|
-
attr_writer :body
|
|
45
|
-
|
|
46
|
-
# An optional datetime for scheduling message up to a couple of months in the
|
|
47
|
-
# future.
|
|
48
|
-
sig { returns(T.nilable(Time)) }
|
|
49
|
-
attr_reader :send_at
|
|
50
|
-
|
|
51
|
-
sig { params(send_at: Time).void }
|
|
52
|
-
attr_writer :send_at
|
|
53
|
-
|
|
54
|
-
# The recipient's phone number in E.164 format. Cannot be used together with
|
|
55
|
-
# 'conversation'.
|
|
56
|
-
sig { returns(String) }
|
|
57
|
-
attr_accessor :to
|
|
58
|
-
|
|
59
|
-
# The sender's phone number in E.164 format or phone number ID. If omitted, uses
|
|
60
|
-
# the account's default phone number. Cannot be used together with 'conversation'.
|
|
61
|
-
sig { returns(T.nilable(String)) }
|
|
62
|
-
attr_reader :from
|
|
63
|
-
|
|
64
|
-
sig { params(from: String).void }
|
|
65
|
-
attr_writer :from
|
|
25
|
+
attr_accessor :message_params
|
|
66
26
|
|
|
67
27
|
sig do
|
|
68
28
|
params(
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
send_at: Time,
|
|
75
|
-
from: String,
|
|
29
|
+
message_params:
|
|
30
|
+
T.any(
|
|
31
|
+
SurgeAPI::MessageParams::MessageParamsWithConversation::OrHash,
|
|
32
|
+
SurgeAPI::MessageParams::SimpleMessageParams::OrHash
|
|
33
|
+
),
|
|
76
34
|
request_options: SurgeAPI::RequestOptions::OrHash
|
|
77
35
|
).returns(T.attached_class)
|
|
78
36
|
end
|
|
79
37
|
def self.new(
|
|
80
|
-
#
|
|
81
|
-
#
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
# 'conversation'.
|
|
85
|
-
to:,
|
|
86
|
-
attachments: nil,
|
|
87
|
-
# The message body.
|
|
88
|
-
body: nil,
|
|
89
|
-
# An optional datetime for scheduling message up to a couple of months in the
|
|
90
|
-
# future.
|
|
91
|
-
send_at: nil,
|
|
92
|
-
# The sender's phone number in E.164 format or phone number ID. If omitted, uses
|
|
93
|
-
# the account's default phone number. Cannot be used together with 'conversation'.
|
|
94
|
-
from: nil,
|
|
38
|
+
# Payload for creating a message. Either an attachment or the body must be given.
|
|
39
|
+
# You can specify the recipient either using the 'conversation' parameter or the
|
|
40
|
+
# 'to'/'from' parameters, but not both.
|
|
41
|
+
message_params:,
|
|
95
42
|
request_options: {}
|
|
96
43
|
)
|
|
97
44
|
end
|
|
@@ -99,183 +46,17 @@ module SurgeAPI
|
|
|
99
46
|
sig do
|
|
100
47
|
override.returns(
|
|
101
48
|
{
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
from: String,
|
|
49
|
+
message_params:
|
|
50
|
+
T.any(
|
|
51
|
+
SurgeAPI::MessageParams::MessageParamsWithConversation,
|
|
52
|
+
SurgeAPI::MessageParams::SimpleMessageParams
|
|
53
|
+
),
|
|
108
54
|
request_options: SurgeAPI::RequestOptions
|
|
109
55
|
}
|
|
110
56
|
)
|
|
111
57
|
end
|
|
112
58
|
def to_hash
|
|
113
59
|
end
|
|
114
|
-
|
|
115
|
-
class Conversation < SurgeAPI::Internal::Type::BaseModel
|
|
116
|
-
OrHash =
|
|
117
|
-
T.type_alias do
|
|
118
|
-
T.any(
|
|
119
|
-
SurgeAPI::MessageCreateParams::Conversation,
|
|
120
|
-
SurgeAPI::Internal::AnyHash
|
|
121
|
-
)
|
|
122
|
-
end
|
|
123
|
-
|
|
124
|
-
# Parameters for creating a contact
|
|
125
|
-
sig { returns(SurgeAPI::MessageCreateParams::Conversation::Contact) }
|
|
126
|
-
attr_reader :contact
|
|
127
|
-
|
|
128
|
-
sig do
|
|
129
|
-
params(
|
|
130
|
-
contact:
|
|
131
|
-
SurgeAPI::MessageCreateParams::Conversation::Contact::OrHash
|
|
132
|
-
).void
|
|
133
|
-
end
|
|
134
|
-
attr_writer :contact
|
|
135
|
-
|
|
136
|
-
# The phone number from which to send the message. This can be either the phone
|
|
137
|
-
# number in E.164 format or a Surge phone number id.
|
|
138
|
-
sig { returns(T.nilable(String)) }
|
|
139
|
-
attr_reader :phone_number
|
|
140
|
-
|
|
141
|
-
sig { params(phone_number: String).void }
|
|
142
|
-
attr_writer :phone_number
|
|
143
|
-
|
|
144
|
-
# Params for selecting or creating a new conversation. Either the id or the
|
|
145
|
-
# Contact must be given.
|
|
146
|
-
sig do
|
|
147
|
-
params(
|
|
148
|
-
contact:
|
|
149
|
-
SurgeAPI::MessageCreateParams::Conversation::Contact::OrHash,
|
|
150
|
-
phone_number: String
|
|
151
|
-
).returns(T.attached_class)
|
|
152
|
-
end
|
|
153
|
-
def self.new(
|
|
154
|
-
# Parameters for creating a contact
|
|
155
|
-
contact:,
|
|
156
|
-
# The phone number from which to send the message. This can be either the phone
|
|
157
|
-
# number in E.164 format or a Surge phone number id.
|
|
158
|
-
phone_number: nil
|
|
159
|
-
)
|
|
160
|
-
end
|
|
161
|
-
|
|
162
|
-
sig do
|
|
163
|
-
override.returns(
|
|
164
|
-
{
|
|
165
|
-
contact: SurgeAPI::MessageCreateParams::Conversation::Contact,
|
|
166
|
-
phone_number: String
|
|
167
|
-
}
|
|
168
|
-
)
|
|
169
|
-
end
|
|
170
|
-
def to_hash
|
|
171
|
-
end
|
|
172
|
-
|
|
173
|
-
class Contact < SurgeAPI::Internal::Type::BaseModel
|
|
174
|
-
OrHash =
|
|
175
|
-
T.type_alias do
|
|
176
|
-
T.any(
|
|
177
|
-
SurgeAPI::MessageCreateParams::Conversation::Contact,
|
|
178
|
-
SurgeAPI::Internal::AnyHash
|
|
179
|
-
)
|
|
180
|
-
end
|
|
181
|
-
|
|
182
|
-
# The contact's phone number in E.164 format.
|
|
183
|
-
sig { returns(String) }
|
|
184
|
-
attr_accessor :phone_number
|
|
185
|
-
|
|
186
|
-
# The contact's email address.
|
|
187
|
-
sig { returns(T.nilable(String)) }
|
|
188
|
-
attr_reader :email
|
|
189
|
-
|
|
190
|
-
sig { params(email: String).void }
|
|
191
|
-
attr_writer :email
|
|
192
|
-
|
|
193
|
-
# The contact's first name.
|
|
194
|
-
sig { returns(T.nilable(String)) }
|
|
195
|
-
attr_reader :first_name
|
|
196
|
-
|
|
197
|
-
sig { params(first_name: String).void }
|
|
198
|
-
attr_writer :first_name
|
|
199
|
-
|
|
200
|
-
# The contact's last name.
|
|
201
|
-
sig { returns(T.nilable(String)) }
|
|
202
|
-
attr_reader :last_name
|
|
203
|
-
|
|
204
|
-
sig { params(last_name: String).void }
|
|
205
|
-
attr_writer :last_name
|
|
206
|
-
|
|
207
|
-
# Set of key-value pairs that will be stored with the object.
|
|
208
|
-
sig { returns(T.nilable(T::Hash[Symbol, String])) }
|
|
209
|
-
attr_reader :metadata
|
|
210
|
-
|
|
211
|
-
sig { params(metadata: T::Hash[Symbol, String]).void }
|
|
212
|
-
attr_writer :metadata
|
|
213
|
-
|
|
214
|
-
# Parameters for creating a contact
|
|
215
|
-
sig do
|
|
216
|
-
params(
|
|
217
|
-
phone_number: String,
|
|
218
|
-
email: String,
|
|
219
|
-
first_name: String,
|
|
220
|
-
last_name: String,
|
|
221
|
-
metadata: T::Hash[Symbol, String]
|
|
222
|
-
).returns(T.attached_class)
|
|
223
|
-
end
|
|
224
|
-
def self.new(
|
|
225
|
-
# The contact's phone number in E.164 format.
|
|
226
|
-
phone_number:,
|
|
227
|
-
# The contact's email address.
|
|
228
|
-
email: nil,
|
|
229
|
-
# The contact's first name.
|
|
230
|
-
first_name: nil,
|
|
231
|
-
# The contact's last name.
|
|
232
|
-
last_name: nil,
|
|
233
|
-
# Set of key-value pairs that will be stored with the object.
|
|
234
|
-
metadata: nil
|
|
235
|
-
)
|
|
236
|
-
end
|
|
237
|
-
|
|
238
|
-
sig do
|
|
239
|
-
override.returns(
|
|
240
|
-
{
|
|
241
|
-
phone_number: String,
|
|
242
|
-
email: String,
|
|
243
|
-
first_name: String,
|
|
244
|
-
last_name: String,
|
|
245
|
-
metadata: T::Hash[Symbol, String]
|
|
246
|
-
}
|
|
247
|
-
)
|
|
248
|
-
end
|
|
249
|
-
def to_hash
|
|
250
|
-
end
|
|
251
|
-
end
|
|
252
|
-
end
|
|
253
|
-
|
|
254
|
-
class Attachment < SurgeAPI::Internal::Type::BaseModel
|
|
255
|
-
OrHash =
|
|
256
|
-
T.type_alias do
|
|
257
|
-
T.any(
|
|
258
|
-
SurgeAPI::MessageCreateParams::Attachment,
|
|
259
|
-
SurgeAPI::Internal::AnyHash
|
|
260
|
-
)
|
|
261
|
-
end
|
|
262
|
-
|
|
263
|
-
# The URL of the attachment.
|
|
264
|
-
sig { returns(String) }
|
|
265
|
-
attr_accessor :url
|
|
266
|
-
|
|
267
|
-
# Params for creating an attachment
|
|
268
|
-
sig { params(url: String).returns(T.attached_class) }
|
|
269
|
-
def self.new(
|
|
270
|
-
# The URL of the attachment.
|
|
271
|
-
url:
|
|
272
|
-
)
|
|
273
|
-
end
|
|
274
|
-
|
|
275
|
-
sig { override.returns({ url: String }) }
|
|
276
|
-
def to_hash
|
|
277
|
-
end
|
|
278
|
-
end
|
|
279
60
|
end
|
|
280
61
|
end
|
|
281
62
|
end
|