one_msg_sdk 2.0.1 → 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.
Files changed (54) hide show
  1. checksums.yaml +4 -4
  2. data/AGENTS.md +6 -6
  3. data/README.md +8 -8
  4. data/docs/CallingApi.md +27 -31
  5. data/docs/CallingSettings.md +18 -0
  6. data/docs/CallingSettingsCalling.md +38 -0
  7. data/docs/CallingSettingsCallingAudio.md +18 -0
  8. data/docs/CallingSettingsCallingCallHours.md +22 -0
  9. data/docs/CallingSettingsCallingSip.md +20 -0
  10. data/docs/CallingSettingsCallingSipServersInner.md +28 -0
  11. data/docs/CallingSettingsCallingVideo.md +18 -0
  12. data/docs/InitiateCallRequest.md +28 -0
  13. data/docs/InitiateCallRequestSession.md +20 -0
  14. data/docs/InitiateCallResponse.md +26 -0
  15. data/docs/InitiateCallResponseCallsInner.md +18 -0
  16. data/docs/InitiateCallResponseResponse.md +18 -0
  17. data/docs/UpdateCallingSettings200Response.md +22 -0
  18. data/docs/UpdateCallingSettings200ResponseResponse.md +18 -0
  19. data/docs/WebhooksApi.md +1 -1
  20. data/lib/one_msg_sdk/api/calling_api.rb +37 -29
  21. data/lib/one_msg_sdk/api/webhooks_api.rb +2 -2
  22. data/lib/one_msg_sdk/models/calling_settings.rb +148 -0
  23. data/lib/one_msg_sdk/models/calling_settings_calling.rb +321 -0
  24. data/lib/one_msg_sdk/models/calling_settings_calling_audio.rb +148 -0
  25. data/lib/one_msg_sdk/models/calling_settings_calling_call_hours.rb +166 -0
  26. data/lib/one_msg_sdk/models/calling_settings_calling_sip.rb +193 -0
  27. data/lib/one_msg_sdk/models/calling_settings_calling_sip_servers_inner.rb +196 -0
  28. data/lib/one_msg_sdk/models/calling_settings_calling_video.rb +182 -0
  29. data/lib/one_msg_sdk/models/initiate_call_request.rb +277 -0
  30. data/lib/one_msg_sdk/models/initiate_call_request_session.rb +217 -0
  31. data/lib/one_msg_sdk/models/initiate_call_response.rb +188 -0
  32. data/lib/one_msg_sdk/models/initiate_call_response_calls_inner.rb +147 -0
  33. data/lib/one_msg_sdk/models/initiate_call_response_response.rb +148 -0
  34. data/lib/one_msg_sdk/models/update_calling_settings200_response.rb +165 -0
  35. data/lib/one_msg_sdk/models/update_calling_settings200_response_response.rb +147 -0
  36. data/lib/one_msg_sdk/version.rb +1 -1
  37. data/lib/one_msg_sdk.rb +14 -0
  38. data/spec/api/calling_api_spec.rb +9 -9
  39. data/spec/api/webhooks_api_spec.rb +1 -1
  40. data/spec/models/calling_settings_calling_audio_spec.rb +36 -0
  41. data/spec/models/calling_settings_calling_call_hours_spec.rb +48 -0
  42. data/spec/models/calling_settings_calling_sip_servers_inner_spec.rb +66 -0
  43. data/spec/models/calling_settings_calling_sip_spec.rb +46 -0
  44. data/spec/models/calling_settings_calling_spec.rb +112 -0
  45. data/spec/models/calling_settings_calling_video_spec.rb +40 -0
  46. data/spec/models/calling_settings_spec.rb +36 -0
  47. data/spec/models/initiate_call_request_session_spec.rb +46 -0
  48. data/spec/models/initiate_call_request_spec.rb +74 -0
  49. data/spec/models/initiate_call_response_calls_inner_spec.rb +36 -0
  50. data/spec/models/initiate_call_response_response_spec.rb +36 -0
  51. data/spec/models/initiate_call_response_spec.rb +60 -0
  52. data/spec/models/update_calling_settings200_response_response_spec.rb +36 -0
  53. data/spec/models/update_calling_settings200_response_spec.rb +48 -0
  54. metadata +120 -63
@@ -20,20 +20,20 @@ module OneMsgSdk
20
20
  @api_client = api_client
21
21
  end
22
22
  # Get calling settings
23
- # WhatsApp Calling API settings (beta). Requires Meta Calling enablement on the WABA. Not production-complete paths and webhook field names may change. Trial/subscription-limited channels are blocked.
23
+ # Return WhatsApp Calling API settings for this channel (beta). Proxies upstream `GET /calling/settings`. **Prerequisites** - Number must be eligible for Meta Calling (Cloud API; not COEX) - Trial / `subscriptionBlocked` channels receive **403** plain text - You need your own WebRTC or SIP stack; 1msg is a **signaling proxy** only and does **not** store call history or recordings See the **Calling** tag overview for inbound/outbound flows and webhooks.
24
24
  # @param token [String] JWT token or API key for authorization
25
25
  # @param [Hash] opts the optional parameters
26
- # @return [Hash<String, Object>]
26
+ # @return [CallingSettings]
27
27
  def get_calling_settings(token, opts = {})
28
28
  data, _status_code, _headers = get_calling_settings_with_http_info(token, opts)
29
29
  data
30
30
  end
31
31
 
32
32
  # Get calling settings
33
- # WhatsApp Calling API settings (beta). Requires Meta Calling enablement on the WABA. Not production-complete paths and webhook field names may change. Trial/subscription-limited channels are blocked.
33
+ # Return WhatsApp Calling API settings for this channel (beta). Proxies upstream &#x60;GET /calling/settings&#x60;. **Prerequisites** - Number must be eligible for Meta Calling (Cloud API; not COEX) - Trial / &#x60;subscriptionBlocked&#x60; channels receive **403** plain text - You need your own WebRTC or SIP stack; 1msg is a **signaling proxy** only and does **not** store call history or recordings See the **Calling** tag overview for inbound/outbound flows and webhooks.
34
34
  # @param token [String] JWT token or API key for authorization
35
35
  # @param [Hash] opts the optional parameters
36
- # @return [Array<(Hash<String, Object>, Integer, Hash)>] Hash<String, Object> data, response status code and response headers
36
+ # @return [Array<(CallingSettings, Integer, Hash)>] CallingSettings data, response status code and response headers
37
37
  def get_calling_settings_with_http_info(token, opts = {})
38
38
  if @api_client.config.debugging
39
39
  @api_client.config.logger.debug 'Calling API: CallingApi.get_calling_settings ...'
@@ -61,7 +61,7 @@ module OneMsgSdk
61
61
  post_body = opts[:debug_body]
62
62
 
63
63
  # return_type
64
- return_type = opts[:debug_return_type] || 'Hash<String, Object>'
64
+ return_type = opts[:debug_return_type] || 'CallingSettings'
65
65
 
66
66
  # auth_names
67
67
  auth_names = opts[:debug_auth_names] || ['tokenAuth']
@@ -83,24 +83,24 @@ module OneMsgSdk
83
83
  return data, status_code, headers
84
84
  end
85
85
 
86
- # Initiate WhatsApp call
87
- # Outbound Calling API (beta). Requires Meta Calling enablement and product consent. Not production-completeverify on stage before relying on this in production. Trial/subscription-limited channels are blocked.
86
+ # Call action (connect / pre_accept / accept / reject / terminate)
87
+ # Perform a WhatsApp Calling action (beta). Proxies upstream `POST /calling/calls`. Despite the historical path name `/initiateCall`, this endpoint handles **all** call actions: | action | Use | Required | |--------|-----|----------| | `connect` | Outbound business → user | `to` + `session` (`sdp_type: offer`) | | `pre_accept` | Inbound (optional, reduces audio clipping) | `call_id` + `session` (`sdp_type: answer`) | | `accept` | Inbound answer | `call_id` + `session` (`sdp_type: answer`) | | `reject` | Decline inbound | `call_id` | | `terminate` | Hang up | `call_id` | **SDP / media (critical)** - `accept` / `pre_accept` require a **WebRTC-generated SDP answer**. - Do **not** send Meta's offer SDP back as the answer. - Postman (or curl) alone **cannot** establish real media you need a WebRTC or SIP stack. 1msg only proxies signaling. Answer within ~**30–60 seconds** of an inbound `connect` webhook or Meta terminates as unanswered. Common Meta errors include Calling not enabled (`138000`), no permission (`138006`), SDP validation failures. **Outbound** requires a prior Call Permission Request (CPR) acceptance. See the **Calling** tag overview for the full outbound flow and CPR limits. Trial / `subscriptionBlocked` **403** plain text. Upstream failures often return HTTP 200 with `{ \"response\": { \"error\": \"...\" } }`.
88
88
  # @param token [String] JWT token or API key for authorization
89
+ # @param initiate_call_request [InitiateCallRequest]
89
90
  # @param [Hash] opts the optional parameters
90
- # @option opts [Hash<String, Object>] :request_body
91
- # @return [Hash<String, Object>]
92
- def initiate_call(token, opts = {})
93
- data, _status_code, _headers = initiate_call_with_http_info(token, opts)
91
+ # @return [InitiateCallResponse]
92
+ def initiate_call(token, initiate_call_request, opts = {})
93
+ data, _status_code, _headers = initiate_call_with_http_info(token, initiate_call_request, opts)
94
94
  data
95
95
  end
96
96
 
97
- # Initiate WhatsApp call
98
- # Outbound Calling API (beta). Requires Meta Calling enablement and product consent. Not production-completeverify on stage before relying on this in production. Trial/subscription-limited channels are blocked.
97
+ # Call action (connect / pre_accept / accept / reject / terminate)
98
+ # Perform a WhatsApp Calling action (beta). Proxies upstream &#x60;POST /calling/calls&#x60;. Despite the historical path name &#x60;/initiateCall&#x60;, this endpoint handles **all** call actions: | action | Use | Required | |--------|-----|----------| | &#x60;connect&#x60; | Outbound business → user | &#x60;to&#x60; + &#x60;session&#x60; (&#x60;sdp_type: offer&#x60;) | | &#x60;pre_accept&#x60; | Inbound (optional, reduces audio clipping) | &#x60;call_id&#x60; + &#x60;session&#x60; (&#x60;sdp_type: answer&#x60;) | | &#x60;accept&#x60; | Inbound answer | &#x60;call_id&#x60; + &#x60;session&#x60; (&#x60;sdp_type: answer&#x60;) | | &#x60;reject&#x60; | Decline inbound | &#x60;call_id&#x60; | | &#x60;terminate&#x60; | Hang up | &#x60;call_id&#x60; | **SDP / media (critical)** - &#x60;accept&#x60; / &#x60;pre_accept&#x60; require a **WebRTC-generated SDP answer**. - Do **not** send Meta&#39;s offer SDP back as the answer. - Postman (or curl) alone **cannot** establish real media you need a WebRTC or SIP stack. 1msg only proxies signaling. Answer within ~**30–60 seconds** of an inbound &#x60;connect&#x60; webhook or Meta terminates as unanswered. Common Meta errors include Calling not enabled (&#x60;138000&#x60;), no permission (&#x60;138006&#x60;), SDP validation failures. **Outbound** requires a prior Call Permission Request (CPR) acceptance. See the **Calling** tag overview for the full outbound flow and CPR limits. Trial / &#x60;subscriptionBlocked&#x60; **403** plain text. Upstream failures often return HTTP 200 with &#x60;{ \&quot;response\&quot;: { \&quot;error\&quot;: \&quot;...\&quot; } }&#x60;.
99
99
  # @param token [String] JWT token or API key for authorization
100
+ # @param initiate_call_request [InitiateCallRequest]
100
101
  # @param [Hash] opts the optional parameters
101
- # @option opts [Hash<String, Object>] :request_body
102
- # @return [Array<(Hash<String, Object>, Integer, Hash)>] Hash<String, Object> data, response status code and response headers
103
- def initiate_call_with_http_info(token, opts = {})
102
+ # @return [Array<(InitiateCallResponse, Integer, Hash)>] InitiateCallResponse data, response status code and response headers
103
+ def initiate_call_with_http_info(token, initiate_call_request, opts = {})
104
104
  if @api_client.config.debugging
105
105
  @api_client.config.logger.debug 'Calling API: CallingApi.initiate_call ...'
106
106
  end
@@ -108,6 +108,10 @@ module OneMsgSdk
108
108
  if @api_client.config.client_side_validation && token.nil?
109
109
  fail ArgumentError, "Missing the required parameter 'token' when calling CallingApi.initiate_call"
110
110
  end
111
+ # verify the required parameter 'initiate_call_request' is set
112
+ if @api_client.config.client_side_validation && initiate_call_request.nil?
113
+ fail ArgumentError, "Missing the required parameter 'initiate_call_request' when calling CallingApi.initiate_call"
114
+ end
111
115
  # resource path
112
116
  local_var_path = '/initiateCall'
113
117
 
@@ -129,10 +133,10 @@ module OneMsgSdk
129
133
  form_params = opts[:form_params] || {}
130
134
 
131
135
  # http body (model)
132
- post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'request_body'])
136
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(initiate_call_request)
133
137
 
134
138
  # return_type
135
- return_type = opts[:debug_return_type] || 'Hash<String, Object>'
139
+ return_type = opts[:debug_return_type] || 'InitiateCallResponse'
136
140
 
137
141
  # auth_names
138
142
  auth_names = opts[:debug_auth_names] || ['tokenAuth']
@@ -155,23 +159,23 @@ module OneMsgSdk
155
159
  end
156
160
 
157
161
  # Update calling settings
158
- # Update WhatsApp Calling API settings (beta). Requires Meta Calling enablement. Trial/subscription-limited channels are blocked.
162
+ # Enable, disable, or update WhatsApp Calling settings (beta). Proxies upstream `POST /calling/settings`. Body is forwarded as-is (1msg does not validate fields). **Common fields under `calling`** - `status` (`ENABLED` | `DISABLED`) — required to turn calling on/off - `call_icon_visibility` (`DEFAULT` | `DISABLE_ALL`) — optional - `callback_permission_status` (`ENABLED` | `DISABLED`) — optional; when enabled, inbound user calls grant callback permission - `call_hours` — optional hours / timezone object - `sip` — optional SIP trunk; when SIP is ENABLED, Graph call actions and calling webhooks are not used - `srtp_key_exchange_protocol` (`DTLS` | `SDES`) — SDES only with SIP - `video.status` — optional Meta may accept only one feature group per request — prefer focused updates (e.g. enable status first, then SIP). Trial / `subscriptionBlocked` → **403** plain text.
159
163
  # @param token [String] JWT token or API key for authorization
164
+ # @param calling_settings [CallingSettings]
160
165
  # @param [Hash] opts the optional parameters
161
- # @option opts [Hash<String, Object>] :request_body
162
- # @return [Hash<String, Object>]
163
- def update_calling_settings(token, opts = {})
164
- data, _status_code, _headers = update_calling_settings_with_http_info(token, opts)
166
+ # @return [UpdateCallingSettings200Response]
167
+ def update_calling_settings(token, calling_settings, opts = {})
168
+ data, _status_code, _headers = update_calling_settings_with_http_info(token, calling_settings, opts)
165
169
  data
166
170
  end
167
171
 
168
172
  # Update calling settings
169
- # Update WhatsApp Calling API settings (beta). Requires Meta Calling enablement. Trial/subscription-limited channels are blocked.
173
+ # Enable, disable, or update WhatsApp Calling settings (beta). Proxies upstream &#x60;POST /calling/settings&#x60;. Body is forwarded as-is (1msg does not validate fields). **Common fields under &#x60;calling&#x60;** - &#x60;status&#x60; (&#x60;ENABLED&#x60; | &#x60;DISABLED&#x60;) — required to turn calling on/off - &#x60;call_icon_visibility&#x60; (&#x60;DEFAULT&#x60; | &#x60;DISABLE_ALL&#x60;) — optional - &#x60;callback_permission_status&#x60; (&#x60;ENABLED&#x60; | &#x60;DISABLED&#x60;) — optional; when enabled, inbound user calls grant callback permission - &#x60;call_hours&#x60; — optional hours / timezone object - &#x60;sip&#x60; — optional SIP trunk; when SIP is ENABLED, Graph call actions and calling webhooks are not used - &#x60;srtp_key_exchange_protocol&#x60; (&#x60;DTLS&#x60; | &#x60;SDES&#x60;) — SDES only with SIP - &#x60;video.status&#x60; — optional Meta may accept only one feature group per request — prefer focused updates (e.g. enable status first, then SIP). Trial / &#x60;subscriptionBlocked&#x60; → **403** plain text.
170
174
  # @param token [String] JWT token or API key for authorization
175
+ # @param calling_settings [CallingSettings]
171
176
  # @param [Hash] opts the optional parameters
172
- # @option opts [Hash<String, Object>] :request_body
173
- # @return [Array<(Hash<String, Object>, Integer, Hash)>] Hash<String, Object> data, response status code and response headers
174
- def update_calling_settings_with_http_info(token, opts = {})
177
+ # @return [Array<(UpdateCallingSettings200Response, Integer, Hash)>] UpdateCallingSettings200Response data, response status code and response headers
178
+ def update_calling_settings_with_http_info(token, calling_settings, opts = {})
175
179
  if @api_client.config.debugging
176
180
  @api_client.config.logger.debug 'Calling API: CallingApi.update_calling_settings ...'
177
181
  end
@@ -179,6 +183,10 @@ module OneMsgSdk
179
183
  if @api_client.config.client_side_validation && token.nil?
180
184
  fail ArgumentError, "Missing the required parameter 'token' when calling CallingApi.update_calling_settings"
181
185
  end
186
+ # verify the required parameter 'calling_settings' is set
187
+ if @api_client.config.client_side_validation && calling_settings.nil?
188
+ fail ArgumentError, "Missing the required parameter 'calling_settings' when calling CallingApi.update_calling_settings"
189
+ end
182
190
  # resource path
183
191
  local_var_path = '/callingSettings'
184
192
 
@@ -200,10 +208,10 @@ module OneMsgSdk
200
208
  form_params = opts[:form_params] || {}
201
209
 
202
210
  # http body (model)
203
- post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'request_body'])
211
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(calling_settings)
204
212
 
205
213
  # return_type
206
- return_type = opts[:debug_return_type] || 'Hash<String, Object>'
214
+ return_type = opts[:debug_return_type] || 'UpdateCallingSettings200Response'
207
215
 
208
216
  # auth_names
209
217
  auth_names = opts[:debug_auth_names] || ['tokenAuth']
@@ -84,7 +84,7 @@ module OneMsgSdk
84
84
  end
85
85
 
86
86
  # Set webhook URL
87
- # Configure the client webhook URL for inbound events.
87
+ # Configure the client webhook URL for inbound events. WhatsApp **Calling** events (`field=calls`) are forwarded as passthrough payloads with `type: \"calls\"` and `instanceId` (connect / status / terminate). Call permission replies arrive on the normal messages path (`call_permission_reply`). Details: **Calling** tag.
88
88
  # @param token [String] JWT token or API key for authorization
89
89
  # @param [Hash] opts the optional parameters
90
90
  # @option opts [GetWebhook200Response] :get_webhook200_response
@@ -95,7 +95,7 @@ module OneMsgSdk
95
95
  end
96
96
 
97
97
  # Set webhook URL
98
- # Configure the client webhook URL for inbound events.
98
+ # Configure the client webhook URL for inbound events. WhatsApp **Calling** events (&#x60;field&#x3D;calls&#x60;) are forwarded as passthrough payloads with &#x60;type: \&quot;calls\&quot;&#x60; and &#x60;instanceId&#x60; (connect / status / terminate). Call permission replies arrive on the normal messages path (&#x60;call_permission_reply&#x60;). Details: **Calling** tag.
99
99
  # @param token [String] JWT token or API key for authorization
100
100
  # @param [Hash] opts the optional parameters
101
101
  # @option opts [GetWebhook200Response] :get_webhook200_response
@@ -0,0 +1,148 @@
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
+ # Calling settings payload for GET/POST `/callingSettings`. Proxies upstream `GET|POST /calling/settings`. Extra Meta fields may appear on GET responses; document core fields below.
18
+ class CallingSettings < ApiModelBase
19
+ attr_accessor :calling
20
+
21
+ # Attribute mapping from ruby-style variable name to JSON key.
22
+ def self.attribute_map
23
+ {
24
+ :'calling' => :'calling'
25
+ }
26
+ end
27
+
28
+ # Returns attribute mapping this model knows about
29
+ def self.acceptable_attribute_map
30
+ attribute_map
31
+ end
32
+
33
+ # Returns all the JSON keys this model knows about
34
+ def self.acceptable_attributes
35
+ acceptable_attribute_map.values
36
+ end
37
+
38
+ # Attribute type mapping.
39
+ def self.openapi_types
40
+ {
41
+ :'calling' => :'CallingSettingsCalling'
42
+ }
43
+ end
44
+
45
+ # List of attributes with nullable: true
46
+ def self.openapi_nullable
47
+ Set.new([
48
+ ])
49
+ end
50
+
51
+ # Initializes the object
52
+ # @param [Hash] attributes Model attributes in the form of hash
53
+ def initialize(attributes = {})
54
+ if (!attributes.is_a?(Hash))
55
+ fail ArgumentError, "The input argument (attributes) must be a hash in `OneMsgSdk::CallingSettings` initialize method"
56
+ end
57
+
58
+ # check to see if the attribute exists and convert string to symbol for hash key
59
+ acceptable_attribute_map = self.class.acceptable_attribute_map
60
+ attributes = attributes.each_with_object({}) { |(k, v), h|
61
+ if (!acceptable_attribute_map.key?(k.to_sym))
62
+ fail ArgumentError, "`#{k}` is not a valid attribute in `OneMsgSdk::CallingSettings`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
63
+ end
64
+ h[k.to_sym] = v
65
+ }
66
+
67
+ if attributes.key?(:'calling')
68
+ self.calling = attributes[:'calling']
69
+ end
70
+ end
71
+
72
+ # Show invalid properties with the reasons. Usually used together with valid?
73
+ # @return Array for valid properties with the reasons
74
+ def list_invalid_properties
75
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
76
+ invalid_properties = Array.new
77
+ invalid_properties
78
+ end
79
+
80
+ # Check to see if the all the properties in the model are valid
81
+ # @return true if the model is valid
82
+ def valid?
83
+ warn '[DEPRECATED] the `valid?` method is obsolete'
84
+ true
85
+ end
86
+
87
+ # Checks equality by comparing each attribute.
88
+ # @param [Object] Object to be compared
89
+ def ==(o)
90
+ return true if self.equal?(o)
91
+ self.class == o.class &&
92
+ calling == o.calling
93
+ end
94
+
95
+ # @see the `==` method
96
+ # @param [Object] Object to be compared
97
+ def eql?(o)
98
+ self == o
99
+ end
100
+
101
+ # Calculates hash code according to all attributes.
102
+ # @return [Integer] Hash code
103
+ def hash
104
+ [calling].hash
105
+ end
106
+
107
+ # Builds the object from hash
108
+ # @param [Hash] attributes Model attributes in the form of hash
109
+ # @return [Object] Returns the model itself
110
+ def self.build_from_hash(attributes)
111
+ return nil unless attributes.is_a?(Hash)
112
+ attributes = attributes.transform_keys(&:to_sym)
113
+ transformed_hash = {}
114
+ openapi_types.each_pair do |key, type|
115
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
116
+ transformed_hash["#{key}"] = nil
117
+ elsif type =~ /\AArray<(.*)>/i
118
+ # check to ensure the input is an array given that the attribute
119
+ # is documented as an array but the input is not
120
+ if attributes[attribute_map[key]].is_a?(Array)
121
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
122
+ end
123
+ elsif !attributes[attribute_map[key]].nil?
124
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
125
+ end
126
+ end
127
+ new(transformed_hash)
128
+ end
129
+
130
+ # Returns the object in the form of hash
131
+ # @return [Hash] Returns the object in the form of hash
132
+ def to_hash
133
+ hash = {}
134
+ self.class.attribute_map.each_pair do |attr, param|
135
+ value = self.send(attr)
136
+ if value.nil?
137
+ is_nullable = self.class.openapi_nullable.include?(attr)
138
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
139
+ end
140
+
141
+ hash[param] = _to_hash(value)
142
+ end
143
+ hash
144
+ end
145
+
146
+ end
147
+
148
+ end
@@ -0,0 +1,321 @@
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
+ # Calling feature configuration for the business phone number
18
+ class CallingSettingsCalling < ApiModelBase
19
+ # Enable or disable Calling API on this number
20
+ attr_accessor :status
21
+
22
+ # Controls call icon visibility in the WhatsApp client
23
+ attr_accessor :call_icon_visibility
24
+
25
+ # When ENABLED, a user who calls your business automatically grants call permission for business-initiated callbacks (subject to Meta rules).
26
+ attr_accessor :callback_permission_status
27
+
28
+ # SRTP key exchange. DTLS is default/recommended. SDES is only valid when SIP signaling is enabled.
29
+ attr_accessor :srtp_key_exchange_protocol
30
+
31
+ attr_accessor :call_hours
32
+
33
+ attr_accessor :sip
34
+
35
+ attr_accessor :video
36
+
37
+ attr_accessor :audio
38
+
39
+ # Calling restrictions (response-only)
40
+ attr_accessor :restrictions
41
+
42
+ # Meta media IP ranges (response-only)
43
+ attr_accessor :ip_addresses
44
+
45
+ # Call icon country restrictions (response-only)
46
+ attr_accessor :call_icons
47
+
48
+ class EnumAttributeValidator
49
+ attr_reader :datatype
50
+ attr_reader :allowable_values
51
+
52
+ def initialize(datatype, allowable_values)
53
+ @allowable_values = allowable_values.map do |value|
54
+ case datatype.to_s
55
+ when /Integer/i
56
+ value.to_i
57
+ when /Float/i
58
+ value.to_f
59
+ else
60
+ value
61
+ end
62
+ end
63
+ end
64
+
65
+ def valid?(value)
66
+ !value || allowable_values.include?(value)
67
+ end
68
+ end
69
+
70
+ # Attribute mapping from ruby-style variable name to JSON key.
71
+ def self.attribute_map
72
+ {
73
+ :'status' => :'status',
74
+ :'call_icon_visibility' => :'call_icon_visibility',
75
+ :'callback_permission_status' => :'callback_permission_status',
76
+ :'srtp_key_exchange_protocol' => :'srtp_key_exchange_protocol',
77
+ :'call_hours' => :'call_hours',
78
+ :'sip' => :'sip',
79
+ :'video' => :'video',
80
+ :'audio' => :'audio',
81
+ :'restrictions' => :'restrictions',
82
+ :'ip_addresses' => :'ip_addresses',
83
+ :'call_icons' => :'call_icons'
84
+ }
85
+ end
86
+
87
+ # Returns attribute mapping this model knows about
88
+ def self.acceptable_attribute_map
89
+ attribute_map
90
+ end
91
+
92
+ # Returns all the JSON keys this model knows about
93
+ def self.acceptable_attributes
94
+ acceptable_attribute_map.values
95
+ end
96
+
97
+ # Attribute type mapping.
98
+ def self.openapi_types
99
+ {
100
+ :'status' => :'String',
101
+ :'call_icon_visibility' => :'String',
102
+ :'callback_permission_status' => :'String',
103
+ :'srtp_key_exchange_protocol' => :'String',
104
+ :'call_hours' => :'CallingSettingsCallingCallHours',
105
+ :'sip' => :'CallingSettingsCallingSip',
106
+ :'video' => :'CallingSettingsCallingVideo',
107
+ :'audio' => :'CallingSettingsCallingAudio',
108
+ :'restrictions' => :'Hash<String, Object>',
109
+ :'ip_addresses' => :'Hash<String, Object>',
110
+ :'call_icons' => :'Hash<String, Object>'
111
+ }
112
+ end
113
+
114
+ # List of attributes with nullable: true
115
+ def self.openapi_nullable
116
+ Set.new([
117
+ ])
118
+ end
119
+
120
+ # Initializes the object
121
+ # @param [Hash] attributes Model attributes in the form of hash
122
+ def initialize(attributes = {})
123
+ if (!attributes.is_a?(Hash))
124
+ fail ArgumentError, "The input argument (attributes) must be a hash in `OneMsgSdk::CallingSettingsCalling` initialize method"
125
+ end
126
+
127
+ # check to see if the attribute exists and convert string to symbol for hash key
128
+ acceptable_attribute_map = self.class.acceptable_attribute_map
129
+ attributes = attributes.each_with_object({}) { |(k, v), h|
130
+ if (!acceptable_attribute_map.key?(k.to_sym))
131
+ fail ArgumentError, "`#{k}` is not a valid attribute in `OneMsgSdk::CallingSettingsCalling`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
132
+ end
133
+ h[k.to_sym] = v
134
+ }
135
+
136
+ if attributes.key?(:'status')
137
+ self.status = attributes[:'status']
138
+ end
139
+
140
+ if attributes.key?(:'call_icon_visibility')
141
+ self.call_icon_visibility = attributes[:'call_icon_visibility']
142
+ end
143
+
144
+ if attributes.key?(:'callback_permission_status')
145
+ self.callback_permission_status = attributes[:'callback_permission_status']
146
+ end
147
+
148
+ if attributes.key?(:'srtp_key_exchange_protocol')
149
+ self.srtp_key_exchange_protocol = attributes[:'srtp_key_exchange_protocol']
150
+ end
151
+
152
+ if attributes.key?(:'call_hours')
153
+ self.call_hours = attributes[:'call_hours']
154
+ end
155
+
156
+ if attributes.key?(:'sip')
157
+ self.sip = attributes[:'sip']
158
+ end
159
+
160
+ if attributes.key?(:'video')
161
+ self.video = attributes[:'video']
162
+ end
163
+
164
+ if attributes.key?(:'audio')
165
+ self.audio = attributes[:'audio']
166
+ end
167
+
168
+ if attributes.key?(:'restrictions')
169
+ if (value = attributes[:'restrictions']).is_a?(Hash)
170
+ self.restrictions = value
171
+ end
172
+ end
173
+
174
+ if attributes.key?(:'ip_addresses')
175
+ if (value = attributes[:'ip_addresses']).is_a?(Hash)
176
+ self.ip_addresses = value
177
+ end
178
+ end
179
+
180
+ if attributes.key?(:'call_icons')
181
+ if (value = attributes[:'call_icons']).is_a?(Hash)
182
+ self.call_icons = value
183
+ end
184
+ end
185
+ end
186
+
187
+ # Show invalid properties with the reasons. Usually used together with valid?
188
+ # @return Array for valid properties with the reasons
189
+ def list_invalid_properties
190
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
191
+ invalid_properties = Array.new
192
+ invalid_properties
193
+ end
194
+
195
+ # Check to see if the all the properties in the model are valid
196
+ # @return true if the model is valid
197
+ def valid?
198
+ warn '[DEPRECATED] the `valid?` method is obsolete'
199
+ status_validator = EnumAttributeValidator.new('String', ["ENABLED", "DISABLED"])
200
+ return false unless status_validator.valid?(@status)
201
+ call_icon_visibility_validator = EnumAttributeValidator.new('String', ["DEFAULT", "DISABLE_ALL"])
202
+ return false unless call_icon_visibility_validator.valid?(@call_icon_visibility)
203
+ callback_permission_status_validator = EnumAttributeValidator.new('String', ["ENABLED", "DISABLED"])
204
+ return false unless callback_permission_status_validator.valid?(@callback_permission_status)
205
+ srtp_key_exchange_protocol_validator = EnumAttributeValidator.new('String', ["DTLS", "SDES"])
206
+ return false unless srtp_key_exchange_protocol_validator.valid?(@srtp_key_exchange_protocol)
207
+ true
208
+ end
209
+
210
+ # Custom attribute writer method checking allowed values (enum).
211
+ # @param [Object] status Object to be assigned
212
+ def status=(status)
213
+ validator = EnumAttributeValidator.new('String', ["ENABLED", "DISABLED"])
214
+ unless validator.valid?(status)
215
+ fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}."
216
+ end
217
+ @status = status
218
+ end
219
+
220
+ # Custom attribute writer method checking allowed values (enum).
221
+ # @param [Object] call_icon_visibility Object to be assigned
222
+ def call_icon_visibility=(call_icon_visibility)
223
+ validator = EnumAttributeValidator.new('String', ["DEFAULT", "DISABLE_ALL"])
224
+ unless validator.valid?(call_icon_visibility)
225
+ fail ArgumentError, "invalid value for \"call_icon_visibility\", must be one of #{validator.allowable_values}."
226
+ end
227
+ @call_icon_visibility = call_icon_visibility
228
+ end
229
+
230
+ # Custom attribute writer method checking allowed values (enum).
231
+ # @param [Object] callback_permission_status Object to be assigned
232
+ def callback_permission_status=(callback_permission_status)
233
+ validator = EnumAttributeValidator.new('String', ["ENABLED", "DISABLED"])
234
+ unless validator.valid?(callback_permission_status)
235
+ fail ArgumentError, "invalid value for \"callback_permission_status\", must be one of #{validator.allowable_values}."
236
+ end
237
+ @callback_permission_status = callback_permission_status
238
+ end
239
+
240
+ # Custom attribute writer method checking allowed values (enum).
241
+ # @param [Object] srtp_key_exchange_protocol Object to be assigned
242
+ def srtp_key_exchange_protocol=(srtp_key_exchange_protocol)
243
+ validator = EnumAttributeValidator.new('String', ["DTLS", "SDES"])
244
+ unless validator.valid?(srtp_key_exchange_protocol)
245
+ fail ArgumentError, "invalid value for \"srtp_key_exchange_protocol\", must be one of #{validator.allowable_values}."
246
+ end
247
+ @srtp_key_exchange_protocol = srtp_key_exchange_protocol
248
+ end
249
+
250
+ # Checks equality by comparing each attribute.
251
+ # @param [Object] Object to be compared
252
+ def ==(o)
253
+ return true if self.equal?(o)
254
+ self.class == o.class &&
255
+ status == o.status &&
256
+ call_icon_visibility == o.call_icon_visibility &&
257
+ callback_permission_status == o.callback_permission_status &&
258
+ srtp_key_exchange_protocol == o.srtp_key_exchange_protocol &&
259
+ call_hours == o.call_hours &&
260
+ sip == o.sip &&
261
+ video == o.video &&
262
+ audio == o.audio &&
263
+ restrictions == o.restrictions &&
264
+ ip_addresses == o.ip_addresses &&
265
+ call_icons == o.call_icons
266
+ end
267
+
268
+ # @see the `==` method
269
+ # @param [Object] Object to be compared
270
+ def eql?(o)
271
+ self == o
272
+ end
273
+
274
+ # Calculates hash code according to all attributes.
275
+ # @return [Integer] Hash code
276
+ def hash
277
+ [status, call_icon_visibility, callback_permission_status, srtp_key_exchange_protocol, call_hours, sip, video, audio, restrictions, ip_addresses, call_icons].hash
278
+ end
279
+
280
+ # Builds the object from hash
281
+ # @param [Hash] attributes Model attributes in the form of hash
282
+ # @return [Object] Returns the model itself
283
+ def self.build_from_hash(attributes)
284
+ return nil unless attributes.is_a?(Hash)
285
+ attributes = attributes.transform_keys(&:to_sym)
286
+ transformed_hash = {}
287
+ openapi_types.each_pair do |key, type|
288
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
289
+ transformed_hash["#{key}"] = nil
290
+ elsif type =~ /\AArray<(.*)>/i
291
+ # check to ensure the input is an array given that the attribute
292
+ # is documented as an array but the input is not
293
+ if attributes[attribute_map[key]].is_a?(Array)
294
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
295
+ end
296
+ elsif !attributes[attribute_map[key]].nil?
297
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
298
+ end
299
+ end
300
+ new(transformed_hash)
301
+ end
302
+
303
+ # Returns the object in the form of hash
304
+ # @return [Hash] Returns the object in the form of hash
305
+ def to_hash
306
+ hash = {}
307
+ self.class.attribute_map.each_pair do |attr, param|
308
+ value = self.send(attr)
309
+ if value.nil?
310
+ is_nullable = self.class.openapi_nullable.include?(attr)
311
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
312
+ end
313
+
314
+ hash[param] = _to_hash(value)
315
+ end
316
+ hash
317
+ end
318
+
319
+ end
320
+
321
+ end