one_msg_sdk 2.0.0 → 2.0.2
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/AGENTS.md +707 -0
- data/README.md +868 -0
- data/docs/CallingApi.md +27 -31
- data/docs/CallingSettings.md +18 -0
- data/docs/CallingSettingsCalling.md +38 -0
- data/docs/CallingSettingsCallingAudio.md +18 -0
- data/docs/CallingSettingsCallingCallHours.md +22 -0
- data/docs/CallingSettingsCallingSip.md +20 -0
- data/docs/CallingSettingsCallingSipServersInner.md +28 -0
- data/docs/CallingSettingsCallingVideo.md +18 -0
- data/docs/InitiateCallRequest.md +28 -0
- data/docs/InitiateCallRequestSession.md +20 -0
- data/docs/InitiateCallResponse.md +26 -0
- data/docs/InitiateCallResponseCallsInner.md +18 -0
- data/docs/InitiateCallResponseResponse.md +18 -0
- data/docs/UpdateCallingSettings200Response.md +22 -0
- data/docs/UpdateCallingSettings200ResponseResponse.md +18 -0
- data/docs/WebhooksApi.md +1 -1
- data/lib/one_msg_sdk/api/calling_api.rb +37 -29
- data/lib/one_msg_sdk/api/webhooks_api.rb +2 -2
- data/lib/one_msg_sdk/models/calling_settings.rb +148 -0
- data/lib/one_msg_sdk/models/calling_settings_calling.rb +321 -0
- data/lib/one_msg_sdk/models/calling_settings_calling_audio.rb +148 -0
- data/lib/one_msg_sdk/models/calling_settings_calling_call_hours.rb +166 -0
- data/lib/one_msg_sdk/models/calling_settings_calling_sip.rb +193 -0
- data/lib/one_msg_sdk/models/calling_settings_calling_sip_servers_inner.rb +196 -0
- data/lib/one_msg_sdk/models/calling_settings_calling_video.rb +182 -0
- data/lib/one_msg_sdk/models/initiate_call_request.rb +277 -0
- data/lib/one_msg_sdk/models/initiate_call_request_session.rb +217 -0
- data/lib/one_msg_sdk/models/initiate_call_response.rb +188 -0
- data/lib/one_msg_sdk/models/initiate_call_response_calls_inner.rb +147 -0
- data/lib/one_msg_sdk/models/initiate_call_response_response.rb +148 -0
- data/lib/one_msg_sdk/models/update_calling_settings200_response.rb +165 -0
- data/lib/one_msg_sdk/models/update_calling_settings200_response_response.rb +147 -0
- data/lib/one_msg_sdk/version.rb +1 -1
- data/lib/one_msg_sdk.rb +14 -0
- data/one_msg_sdk.gemspec +2 -2
- data/spec/api/calling_api_spec.rb +9 -9
- data/spec/api/webhooks_api_spec.rb +1 -1
- data/spec/models/calling_settings_calling_audio_spec.rb +36 -0
- data/spec/models/calling_settings_calling_call_hours_spec.rb +48 -0
- data/spec/models/calling_settings_calling_sip_servers_inner_spec.rb +66 -0
- data/spec/models/calling_settings_calling_sip_spec.rb +46 -0
- data/spec/models/calling_settings_calling_spec.rb +112 -0
- data/spec/models/calling_settings_calling_video_spec.rb +40 -0
- data/spec/models/calling_settings_spec.rb +36 -0
- data/spec/models/initiate_call_request_session_spec.rb +46 -0
- data/spec/models/initiate_call_request_spec.rb +74 -0
- data/spec/models/initiate_call_response_calls_inner_spec.rb +36 -0
- data/spec/models/initiate_call_response_response_spec.rb +36 -0
- data/spec/models/initiate_call_response_spec.rb +60 -0
- data/spec/models/update_calling_settings200_response_response_spec.rb +36 -0
- data/spec/models/update_calling_settings200_response_spec.rb +48 -0
- metadata +984 -57
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#1MSG WhatsApp Business API (Public)
|
|
3
|
+
|
|
4
|
+
#Public client API for sending messages, managing groups, flows, and templates. This is the API exposed to end customers via platform.1msg.io **Authentication:** All requests require `token` query parameter with JWT or API key. **Documentation:** https://help.1msg.io/platform-1msg/getting-start/quick-start **API Docs:** https://docs.1msg.io/
|
|
5
|
+
|
|
6
|
+
The version of the OpenAPI document: 1.0.0
|
|
7
|
+
Contact: support@1msg.io
|
|
8
|
+
Generated by: https://openapi-generator.tech
|
|
9
|
+
Generator version: 7.22.0
|
|
10
|
+
|
|
11
|
+
=end
|
|
12
|
+
|
|
13
|
+
require 'date'
|
|
14
|
+
require 'time'
|
|
15
|
+
|
|
16
|
+
module OneMsgSdk
|
|
17
|
+
# Video calling toggle when supported
|
|
18
|
+
class CallingSettingsCallingVideo < ApiModelBase
|
|
19
|
+
attr_accessor :status
|
|
20
|
+
|
|
21
|
+
class EnumAttributeValidator
|
|
22
|
+
attr_reader :datatype
|
|
23
|
+
attr_reader :allowable_values
|
|
24
|
+
|
|
25
|
+
def initialize(datatype, allowable_values)
|
|
26
|
+
@allowable_values = allowable_values.map do |value|
|
|
27
|
+
case datatype.to_s
|
|
28
|
+
when /Integer/i
|
|
29
|
+
value.to_i
|
|
30
|
+
when /Float/i
|
|
31
|
+
value.to_f
|
|
32
|
+
else
|
|
33
|
+
value
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def valid?(value)
|
|
39
|
+
!value || allowable_values.include?(value)
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
44
|
+
def self.attribute_map
|
|
45
|
+
{
|
|
46
|
+
:'status' => :'status'
|
|
47
|
+
}
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
# Returns attribute mapping this model knows about
|
|
51
|
+
def self.acceptable_attribute_map
|
|
52
|
+
attribute_map
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
# Returns all the JSON keys this model knows about
|
|
56
|
+
def self.acceptable_attributes
|
|
57
|
+
acceptable_attribute_map.values
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
# Attribute type mapping.
|
|
61
|
+
def self.openapi_types
|
|
62
|
+
{
|
|
63
|
+
:'status' => :'String'
|
|
64
|
+
}
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
# List of attributes with nullable: true
|
|
68
|
+
def self.openapi_nullable
|
|
69
|
+
Set.new([
|
|
70
|
+
])
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
# Initializes the object
|
|
74
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
75
|
+
def initialize(attributes = {})
|
|
76
|
+
if (!attributes.is_a?(Hash))
|
|
77
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `OneMsgSdk::CallingSettingsCallingVideo` initialize method"
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
81
|
+
acceptable_attribute_map = self.class.acceptable_attribute_map
|
|
82
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
83
|
+
if (!acceptable_attribute_map.key?(k.to_sym))
|
|
84
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `OneMsgSdk::CallingSettingsCallingVideo`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
|
|
85
|
+
end
|
|
86
|
+
h[k.to_sym] = v
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
if attributes.key?(:'status')
|
|
90
|
+
self.status = attributes[:'status']
|
|
91
|
+
end
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
95
|
+
# @return Array for valid properties with the reasons
|
|
96
|
+
def list_invalid_properties
|
|
97
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
98
|
+
invalid_properties = Array.new
|
|
99
|
+
invalid_properties
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
# Check to see if the all the properties in the model are valid
|
|
103
|
+
# @return true if the model is valid
|
|
104
|
+
def valid?
|
|
105
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
106
|
+
status_validator = EnumAttributeValidator.new('String', ["ENABLED", "DISABLED"])
|
|
107
|
+
return false unless status_validator.valid?(@status)
|
|
108
|
+
true
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
# Custom attribute writer method checking allowed values (enum).
|
|
112
|
+
# @param [Object] status Object to be assigned
|
|
113
|
+
def status=(status)
|
|
114
|
+
validator = EnumAttributeValidator.new('String', ["ENABLED", "DISABLED"])
|
|
115
|
+
unless validator.valid?(status)
|
|
116
|
+
fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}."
|
|
117
|
+
end
|
|
118
|
+
@status = status
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
# Checks equality by comparing each attribute.
|
|
122
|
+
# @param [Object] Object to be compared
|
|
123
|
+
def ==(o)
|
|
124
|
+
return true if self.equal?(o)
|
|
125
|
+
self.class == o.class &&
|
|
126
|
+
status == o.status
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
# @see the `==` method
|
|
130
|
+
# @param [Object] Object to be compared
|
|
131
|
+
def eql?(o)
|
|
132
|
+
self == o
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
# Calculates hash code according to all attributes.
|
|
136
|
+
# @return [Integer] Hash code
|
|
137
|
+
def hash
|
|
138
|
+
[status].hash
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
# Builds the object from hash
|
|
142
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
143
|
+
# @return [Object] Returns the model itself
|
|
144
|
+
def self.build_from_hash(attributes)
|
|
145
|
+
return nil unless attributes.is_a?(Hash)
|
|
146
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
147
|
+
transformed_hash = {}
|
|
148
|
+
openapi_types.each_pair do |key, type|
|
|
149
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
150
|
+
transformed_hash["#{key}"] = nil
|
|
151
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
152
|
+
# check to ensure the input is an array given that the attribute
|
|
153
|
+
# is documented as an array but the input is not
|
|
154
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
|
155
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
|
156
|
+
end
|
|
157
|
+
elsif !attributes[attribute_map[key]].nil?
|
|
158
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
|
159
|
+
end
|
|
160
|
+
end
|
|
161
|
+
new(transformed_hash)
|
|
162
|
+
end
|
|
163
|
+
|
|
164
|
+
# Returns the object in the form of hash
|
|
165
|
+
# @return [Hash] Returns the object in the form of hash
|
|
166
|
+
def to_hash
|
|
167
|
+
hash = {}
|
|
168
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
169
|
+
value = self.send(attr)
|
|
170
|
+
if value.nil?
|
|
171
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
172
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
173
|
+
end
|
|
174
|
+
|
|
175
|
+
hash[param] = _to_hash(value)
|
|
176
|
+
end
|
|
177
|
+
hash
|
|
178
|
+
end
|
|
179
|
+
|
|
180
|
+
end
|
|
181
|
+
|
|
182
|
+
end
|
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#1MSG WhatsApp Business API (Public)
|
|
3
|
+
|
|
4
|
+
#Public client API for sending messages, managing groups, flows, and templates. This is the API exposed to end customers via platform.1msg.io **Authentication:** All requests require `token` query parameter with JWT or API key. **Documentation:** https://help.1msg.io/platform-1msg/getting-start/quick-start **API Docs:** https://docs.1msg.io/
|
|
5
|
+
|
|
6
|
+
The version of the OpenAPI document: 1.0.0
|
|
7
|
+
Contact: support@1msg.io
|
|
8
|
+
Generated by: https://openapi-generator.tech
|
|
9
|
+
Generator version: 7.22.0
|
|
10
|
+
|
|
11
|
+
=end
|
|
12
|
+
|
|
13
|
+
require 'date'
|
|
14
|
+
require 'time'
|
|
15
|
+
|
|
16
|
+
module OneMsgSdk
|
|
17
|
+
# Call action payload for `POST /initiateCall` (proxies upstream `POST /calling/calls`). Despite the path name, this endpoint handles **all** call actions — not only outbound connect. ## Required fields by `action` | action | Required | `session` | |--------|----------|-----------| | `connect` (outbound) | `messaging_product`, `to`, `action` | `sdp_type: offer` + business WebRTC SDP | | `pre_accept` | `messaging_product`, `call_id`, `action` | `sdp_type: answer` (WebRTC-generated) | | `accept` | `messaging_product`, `call_id`, `action` | `sdp_type: answer` (WebRTC-generated) | | `reject` | `messaging_product`, `call_id`, `action` | none | | `terminate` | `messaging_product`, `call_id`, `action` | none | **Critical:** For `pre_accept` / `accept`, `session.sdp` must be a **WebRTC-generated SDP answer**. Do not echo Meta's offer SDP back. Postman alone cannot establish real media — you need a WebRTC (or SIP) stack.
|
|
18
|
+
class InitiateCallRequest < ApiModelBase
|
|
19
|
+
# Must be `whatsapp`
|
|
20
|
+
attr_accessor :messaging_product
|
|
21
|
+
|
|
22
|
+
# Call control action
|
|
23
|
+
attr_accessor :action
|
|
24
|
+
|
|
25
|
+
# WhatsApp call id from the inbound/outbound calls webhook (`calls[].id`). Required for `pre_accept`, `accept`, `reject`, `terminate`.
|
|
26
|
+
attr_accessor :call_id
|
|
27
|
+
|
|
28
|
+
# Recipient WhatsApp user phone (digits, country code, no +). Required for outbound `connect`.
|
|
29
|
+
attr_accessor :to
|
|
30
|
+
|
|
31
|
+
# Optional opaque string echoed on later call webhooks for correlation
|
|
32
|
+
attr_accessor :biz_opaque_callback_data
|
|
33
|
+
|
|
34
|
+
attr_accessor :session
|
|
35
|
+
|
|
36
|
+
class EnumAttributeValidator
|
|
37
|
+
attr_reader :datatype
|
|
38
|
+
attr_reader :allowable_values
|
|
39
|
+
|
|
40
|
+
def initialize(datatype, allowable_values)
|
|
41
|
+
@allowable_values = allowable_values.map do |value|
|
|
42
|
+
case datatype.to_s
|
|
43
|
+
when /Integer/i
|
|
44
|
+
value.to_i
|
|
45
|
+
when /Float/i
|
|
46
|
+
value.to_f
|
|
47
|
+
else
|
|
48
|
+
value
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
def valid?(value)
|
|
54
|
+
!value || allowable_values.include?(value)
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
59
|
+
def self.attribute_map
|
|
60
|
+
{
|
|
61
|
+
:'messaging_product' => :'messaging_product',
|
|
62
|
+
:'action' => :'action',
|
|
63
|
+
:'call_id' => :'call_id',
|
|
64
|
+
:'to' => :'to',
|
|
65
|
+
:'biz_opaque_callback_data' => :'biz_opaque_callback_data',
|
|
66
|
+
:'session' => :'session'
|
|
67
|
+
}
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
# Returns attribute mapping this model knows about
|
|
71
|
+
def self.acceptable_attribute_map
|
|
72
|
+
attribute_map
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
# Returns all the JSON keys this model knows about
|
|
76
|
+
def self.acceptable_attributes
|
|
77
|
+
acceptable_attribute_map.values
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
# Attribute type mapping.
|
|
81
|
+
def self.openapi_types
|
|
82
|
+
{
|
|
83
|
+
:'messaging_product' => :'String',
|
|
84
|
+
:'action' => :'String',
|
|
85
|
+
:'call_id' => :'String',
|
|
86
|
+
:'to' => :'String',
|
|
87
|
+
:'biz_opaque_callback_data' => :'String',
|
|
88
|
+
:'session' => :'InitiateCallRequestSession'
|
|
89
|
+
}
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
# List of attributes with nullable: true
|
|
93
|
+
def self.openapi_nullable
|
|
94
|
+
Set.new([
|
|
95
|
+
])
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
# Initializes the object
|
|
99
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
100
|
+
def initialize(attributes = {})
|
|
101
|
+
if (!attributes.is_a?(Hash))
|
|
102
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `OneMsgSdk::InitiateCallRequest` initialize method"
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
106
|
+
acceptable_attribute_map = self.class.acceptable_attribute_map
|
|
107
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
108
|
+
if (!acceptable_attribute_map.key?(k.to_sym))
|
|
109
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `OneMsgSdk::InitiateCallRequest`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
|
|
110
|
+
end
|
|
111
|
+
h[k.to_sym] = v
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
if attributes.key?(:'messaging_product')
|
|
115
|
+
self.messaging_product = attributes[:'messaging_product']
|
|
116
|
+
else
|
|
117
|
+
self.messaging_product = nil
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
if attributes.key?(:'action')
|
|
121
|
+
self.action = attributes[:'action']
|
|
122
|
+
else
|
|
123
|
+
self.action = nil
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
if attributes.key?(:'call_id')
|
|
127
|
+
self.call_id = attributes[:'call_id']
|
|
128
|
+
end
|
|
129
|
+
|
|
130
|
+
if attributes.key?(:'to')
|
|
131
|
+
self.to = attributes[:'to']
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
if attributes.key?(:'biz_opaque_callback_data')
|
|
135
|
+
self.biz_opaque_callback_data = attributes[:'biz_opaque_callback_data']
|
|
136
|
+
end
|
|
137
|
+
|
|
138
|
+
if attributes.key?(:'session')
|
|
139
|
+
self.session = attributes[:'session']
|
|
140
|
+
end
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
144
|
+
# @return Array for valid properties with the reasons
|
|
145
|
+
def list_invalid_properties
|
|
146
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
147
|
+
invalid_properties = Array.new
|
|
148
|
+
if @messaging_product.nil?
|
|
149
|
+
invalid_properties.push('invalid value for "messaging_product", messaging_product cannot be nil.')
|
|
150
|
+
end
|
|
151
|
+
|
|
152
|
+
if @action.nil?
|
|
153
|
+
invalid_properties.push('invalid value for "action", action cannot be nil.')
|
|
154
|
+
end
|
|
155
|
+
|
|
156
|
+
if !@biz_opaque_callback_data.nil? && @biz_opaque_callback_data.to_s.length > 512
|
|
157
|
+
invalid_properties.push('invalid value for "biz_opaque_callback_data", the character length must be smaller than or equal to 512.')
|
|
158
|
+
end
|
|
159
|
+
|
|
160
|
+
invalid_properties
|
|
161
|
+
end
|
|
162
|
+
|
|
163
|
+
# Check to see if the all the properties in the model are valid
|
|
164
|
+
# @return true if the model is valid
|
|
165
|
+
def valid?
|
|
166
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
167
|
+
return false if @messaging_product.nil?
|
|
168
|
+
messaging_product_validator = EnumAttributeValidator.new('String', ["whatsapp"])
|
|
169
|
+
return false unless messaging_product_validator.valid?(@messaging_product)
|
|
170
|
+
return false if @action.nil?
|
|
171
|
+
action_validator = EnumAttributeValidator.new('String', ["connect", "pre_accept", "accept", "reject", "terminate"])
|
|
172
|
+
return false unless action_validator.valid?(@action)
|
|
173
|
+
return false if !@biz_opaque_callback_data.nil? && @biz_opaque_callback_data.to_s.length > 512
|
|
174
|
+
true
|
|
175
|
+
end
|
|
176
|
+
|
|
177
|
+
# Custom attribute writer method checking allowed values (enum).
|
|
178
|
+
# @param [Object] messaging_product Object to be assigned
|
|
179
|
+
def messaging_product=(messaging_product)
|
|
180
|
+
validator = EnumAttributeValidator.new('String', ["whatsapp"])
|
|
181
|
+
unless validator.valid?(messaging_product)
|
|
182
|
+
fail ArgumentError, "invalid value for \"messaging_product\", must be one of #{validator.allowable_values}."
|
|
183
|
+
end
|
|
184
|
+
@messaging_product = messaging_product
|
|
185
|
+
end
|
|
186
|
+
|
|
187
|
+
# Custom attribute writer method checking allowed values (enum).
|
|
188
|
+
# @param [Object] action Object to be assigned
|
|
189
|
+
def action=(action)
|
|
190
|
+
validator = EnumAttributeValidator.new('String', ["connect", "pre_accept", "accept", "reject", "terminate"])
|
|
191
|
+
unless validator.valid?(action)
|
|
192
|
+
fail ArgumentError, "invalid value for \"action\", must be one of #{validator.allowable_values}."
|
|
193
|
+
end
|
|
194
|
+
@action = action
|
|
195
|
+
end
|
|
196
|
+
|
|
197
|
+
# Custom attribute writer method with validation
|
|
198
|
+
# @param [Object] biz_opaque_callback_data Value to be assigned
|
|
199
|
+
def biz_opaque_callback_data=(biz_opaque_callback_data)
|
|
200
|
+
if biz_opaque_callback_data.nil?
|
|
201
|
+
fail ArgumentError, 'biz_opaque_callback_data cannot be nil'
|
|
202
|
+
end
|
|
203
|
+
|
|
204
|
+
if biz_opaque_callback_data.to_s.length > 512
|
|
205
|
+
fail ArgumentError, 'invalid value for "biz_opaque_callback_data", the character length must be smaller than or equal to 512.'
|
|
206
|
+
end
|
|
207
|
+
|
|
208
|
+
@biz_opaque_callback_data = biz_opaque_callback_data
|
|
209
|
+
end
|
|
210
|
+
|
|
211
|
+
# Checks equality by comparing each attribute.
|
|
212
|
+
# @param [Object] Object to be compared
|
|
213
|
+
def ==(o)
|
|
214
|
+
return true if self.equal?(o)
|
|
215
|
+
self.class == o.class &&
|
|
216
|
+
messaging_product == o.messaging_product &&
|
|
217
|
+
action == o.action &&
|
|
218
|
+
call_id == o.call_id &&
|
|
219
|
+
to == o.to &&
|
|
220
|
+
biz_opaque_callback_data == o.biz_opaque_callback_data &&
|
|
221
|
+
session == o.session
|
|
222
|
+
end
|
|
223
|
+
|
|
224
|
+
# @see the `==` method
|
|
225
|
+
# @param [Object] Object to be compared
|
|
226
|
+
def eql?(o)
|
|
227
|
+
self == o
|
|
228
|
+
end
|
|
229
|
+
|
|
230
|
+
# Calculates hash code according to all attributes.
|
|
231
|
+
# @return [Integer] Hash code
|
|
232
|
+
def hash
|
|
233
|
+
[messaging_product, action, call_id, to, biz_opaque_callback_data, session].hash
|
|
234
|
+
end
|
|
235
|
+
|
|
236
|
+
# Builds the object from hash
|
|
237
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
238
|
+
# @return [Object] Returns the model itself
|
|
239
|
+
def self.build_from_hash(attributes)
|
|
240
|
+
return nil unless attributes.is_a?(Hash)
|
|
241
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
242
|
+
transformed_hash = {}
|
|
243
|
+
openapi_types.each_pair do |key, type|
|
|
244
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
245
|
+
transformed_hash["#{key}"] = nil
|
|
246
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
247
|
+
# check to ensure the input is an array given that the attribute
|
|
248
|
+
# is documented as an array but the input is not
|
|
249
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
|
250
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
|
251
|
+
end
|
|
252
|
+
elsif !attributes[attribute_map[key]].nil?
|
|
253
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
|
254
|
+
end
|
|
255
|
+
end
|
|
256
|
+
new(transformed_hash)
|
|
257
|
+
end
|
|
258
|
+
|
|
259
|
+
# Returns the object in the form of hash
|
|
260
|
+
# @return [Hash] Returns the object in the form of hash
|
|
261
|
+
def to_hash
|
|
262
|
+
hash = {}
|
|
263
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
264
|
+
value = self.send(attr)
|
|
265
|
+
if value.nil?
|
|
266
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
267
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
268
|
+
end
|
|
269
|
+
|
|
270
|
+
hash[param] = _to_hash(value)
|
|
271
|
+
end
|
|
272
|
+
hash
|
|
273
|
+
end
|
|
274
|
+
|
|
275
|
+
end
|
|
276
|
+
|
|
277
|
+
end
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#1MSG WhatsApp Business API (Public)
|
|
3
|
+
|
|
4
|
+
#Public client API for sending messages, managing groups, flows, and templates. This is the API exposed to end customers via platform.1msg.io **Authentication:** All requests require `token` query parameter with JWT or API key. **Documentation:** https://help.1msg.io/platform-1msg/getting-start/quick-start **API Docs:** https://docs.1msg.io/
|
|
5
|
+
|
|
6
|
+
The version of the OpenAPI document: 1.0.0
|
|
7
|
+
Contact: support@1msg.io
|
|
8
|
+
Generated by: https://openapi-generator.tech
|
|
9
|
+
Generator version: 7.22.0
|
|
10
|
+
|
|
11
|
+
=end
|
|
12
|
+
|
|
13
|
+
require 'date'
|
|
14
|
+
require 'time'
|
|
15
|
+
|
|
16
|
+
module OneMsgSdk
|
|
17
|
+
# WebRTC SDP session (required for connect / pre_accept / accept)
|
|
18
|
+
class InitiateCallRequestSession < ApiModelBase
|
|
19
|
+
# offer for outbound connect; answer for pre_accept/accept
|
|
20
|
+
attr_accessor :sdp_type
|
|
21
|
+
|
|
22
|
+
# Full SDP (RFC 8866). Replace placeholders with SDP from your WebRTC stack. Must negotiate ICE, DTLS-SRTP, and OPUS for WhatsApp media.
|
|
23
|
+
attr_accessor :sdp
|
|
24
|
+
|
|
25
|
+
class EnumAttributeValidator
|
|
26
|
+
attr_reader :datatype
|
|
27
|
+
attr_reader :allowable_values
|
|
28
|
+
|
|
29
|
+
def initialize(datatype, allowable_values)
|
|
30
|
+
@allowable_values = allowable_values.map do |value|
|
|
31
|
+
case datatype.to_s
|
|
32
|
+
when /Integer/i
|
|
33
|
+
value.to_i
|
|
34
|
+
when /Float/i
|
|
35
|
+
value.to_f
|
|
36
|
+
else
|
|
37
|
+
value
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def valid?(value)
|
|
43
|
+
!value || allowable_values.include?(value)
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
48
|
+
def self.attribute_map
|
|
49
|
+
{
|
|
50
|
+
:'sdp_type' => :'sdp_type',
|
|
51
|
+
:'sdp' => :'sdp'
|
|
52
|
+
}
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
# Returns attribute mapping this model knows about
|
|
56
|
+
def self.acceptable_attribute_map
|
|
57
|
+
attribute_map
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
# Returns all the JSON keys this model knows about
|
|
61
|
+
def self.acceptable_attributes
|
|
62
|
+
acceptable_attribute_map.values
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
# Attribute type mapping.
|
|
66
|
+
def self.openapi_types
|
|
67
|
+
{
|
|
68
|
+
:'sdp_type' => :'String',
|
|
69
|
+
:'sdp' => :'String'
|
|
70
|
+
}
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
# List of attributes with nullable: true
|
|
74
|
+
def self.openapi_nullable
|
|
75
|
+
Set.new([
|
|
76
|
+
])
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
# Initializes the object
|
|
80
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
81
|
+
def initialize(attributes = {})
|
|
82
|
+
if (!attributes.is_a?(Hash))
|
|
83
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `OneMsgSdk::InitiateCallRequestSession` initialize method"
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
87
|
+
acceptable_attribute_map = self.class.acceptable_attribute_map
|
|
88
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
89
|
+
if (!acceptable_attribute_map.key?(k.to_sym))
|
|
90
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `OneMsgSdk::InitiateCallRequestSession`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
|
|
91
|
+
end
|
|
92
|
+
h[k.to_sym] = v
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
if attributes.key?(:'sdp_type')
|
|
96
|
+
self.sdp_type = attributes[:'sdp_type']
|
|
97
|
+
else
|
|
98
|
+
self.sdp_type = nil
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
if attributes.key?(:'sdp')
|
|
102
|
+
self.sdp = attributes[:'sdp']
|
|
103
|
+
else
|
|
104
|
+
self.sdp = nil
|
|
105
|
+
end
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
109
|
+
# @return Array for valid properties with the reasons
|
|
110
|
+
def list_invalid_properties
|
|
111
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
112
|
+
invalid_properties = Array.new
|
|
113
|
+
if @sdp_type.nil?
|
|
114
|
+
invalid_properties.push('invalid value for "sdp_type", sdp_type cannot be nil.')
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
if @sdp.nil?
|
|
118
|
+
invalid_properties.push('invalid value for "sdp", sdp cannot be nil.')
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
invalid_properties
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
# Check to see if the all the properties in the model are valid
|
|
125
|
+
# @return true if the model is valid
|
|
126
|
+
def valid?
|
|
127
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
128
|
+
return false if @sdp_type.nil?
|
|
129
|
+
sdp_type_validator = EnumAttributeValidator.new('String', ["offer", "answer"])
|
|
130
|
+
return false unless sdp_type_validator.valid?(@sdp_type)
|
|
131
|
+
return false if @sdp.nil?
|
|
132
|
+
true
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
# Custom attribute writer method checking allowed values (enum).
|
|
136
|
+
# @param [Object] sdp_type Object to be assigned
|
|
137
|
+
def sdp_type=(sdp_type)
|
|
138
|
+
validator = EnumAttributeValidator.new('String', ["offer", "answer"])
|
|
139
|
+
unless validator.valid?(sdp_type)
|
|
140
|
+
fail ArgumentError, "invalid value for \"sdp_type\", must be one of #{validator.allowable_values}."
|
|
141
|
+
end
|
|
142
|
+
@sdp_type = sdp_type
|
|
143
|
+
end
|
|
144
|
+
|
|
145
|
+
# Custom attribute writer method with validation
|
|
146
|
+
# @param [Object] sdp Value to be assigned
|
|
147
|
+
def sdp=(sdp)
|
|
148
|
+
if sdp.nil?
|
|
149
|
+
fail ArgumentError, 'sdp cannot be nil'
|
|
150
|
+
end
|
|
151
|
+
|
|
152
|
+
@sdp = sdp
|
|
153
|
+
end
|
|
154
|
+
|
|
155
|
+
# Checks equality by comparing each attribute.
|
|
156
|
+
# @param [Object] Object to be compared
|
|
157
|
+
def ==(o)
|
|
158
|
+
return true if self.equal?(o)
|
|
159
|
+
self.class == o.class &&
|
|
160
|
+
sdp_type == o.sdp_type &&
|
|
161
|
+
sdp == o.sdp
|
|
162
|
+
end
|
|
163
|
+
|
|
164
|
+
# @see the `==` method
|
|
165
|
+
# @param [Object] Object to be compared
|
|
166
|
+
def eql?(o)
|
|
167
|
+
self == o
|
|
168
|
+
end
|
|
169
|
+
|
|
170
|
+
# Calculates hash code according to all attributes.
|
|
171
|
+
# @return [Integer] Hash code
|
|
172
|
+
def hash
|
|
173
|
+
[sdp_type, sdp].hash
|
|
174
|
+
end
|
|
175
|
+
|
|
176
|
+
# Builds the object from hash
|
|
177
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
178
|
+
# @return [Object] Returns the model itself
|
|
179
|
+
def self.build_from_hash(attributes)
|
|
180
|
+
return nil unless attributes.is_a?(Hash)
|
|
181
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
182
|
+
transformed_hash = {}
|
|
183
|
+
openapi_types.each_pair do |key, type|
|
|
184
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
185
|
+
transformed_hash["#{key}"] = nil
|
|
186
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
187
|
+
# check to ensure the input is an array given that the attribute
|
|
188
|
+
# is documented as an array but the input is not
|
|
189
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
|
190
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
|
191
|
+
end
|
|
192
|
+
elsif !attributes[attribute_map[key]].nil?
|
|
193
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
|
194
|
+
end
|
|
195
|
+
end
|
|
196
|
+
new(transformed_hash)
|
|
197
|
+
end
|
|
198
|
+
|
|
199
|
+
# Returns the object in the form of hash
|
|
200
|
+
# @return [Hash] Returns the object in the form of hash
|
|
201
|
+
def to_hash
|
|
202
|
+
hash = {}
|
|
203
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
204
|
+
value = self.send(attr)
|
|
205
|
+
if value.nil?
|
|
206
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
207
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
208
|
+
end
|
|
209
|
+
|
|
210
|
+
hash[param] = _to_hash(value)
|
|
211
|
+
end
|
|
212
|
+
hash
|
|
213
|
+
end
|
|
214
|
+
|
|
215
|
+
end
|
|
216
|
+
|
|
217
|
+
end
|