one_msg_chat_api 1.0.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 (227) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +9 -0
  3. data/LICENSE.txt +21 -0
  4. data/Rakefile +10 -0
  5. data/docs/AddTemplateRequest.md +24 -0
  6. data/docs/BlockUserRequest.md +18 -0
  7. data/docs/CallingApi.md +231 -0
  8. data/docs/CatalogApi.md +153 -0
  9. data/docs/ChannelApi.md +225 -0
  10. data/docs/ConversationalAutomation.md +22 -0
  11. data/docs/ConversationalAutomationCommandsInner.md +20 -0
  12. data/docs/CreateCommerce200Response.md +18 -0
  13. data/docs/CreateCommerceRequest.md +18 -0
  14. data/docs/CreateCommerceRequestParams.md +20 -0
  15. data/docs/CreateGroups200Response.md +18 -0
  16. data/docs/CreateReadMessage200Response.md +18 -0
  17. data/docs/CreateReadMessage401Response.md +18 -0
  18. data/docs/CreateReadMessageRequest.md +22 -0
  19. data/docs/DeleteFlowsFlowId200Response.md +20 -0
  20. data/docs/DeleteGroupsGroupId200Response.md +20 -0
  21. data/docs/DeleteMediaLegacyRequest.md +18 -0
  22. data/docs/ErrorResponse.md +18 -0
  23. data/docs/FlowsApi.md +836 -0
  24. data/docs/GetCommerce200ResponseInner.md +22 -0
  25. data/docs/GetMmLiteStatus200Response.md +22 -0
  26. data/docs/GetWebhook200Response.md +18 -0
  27. data/docs/GetWhatsappBusinessEncryption200Response.md +22 -0
  28. data/docs/GroupsApi.md +507 -0
  29. data/docs/ListBlockedUsers200Response.md +18 -0
  30. data/docs/ListFlows200Response.md +26 -0
  31. data/docs/ListMessages200Response.md +20 -0
  32. data/docs/ListTemplates200Response.md +22 -0
  33. data/docs/MessageSentResponse.md +24 -0
  34. data/docs/MessagingApi.md +1784 -0
  35. data/docs/PatchFlowsFlowIdAssets200Response.md +22 -0
  36. data/docs/ProfileApi.md +155 -0
  37. data/docs/ProfileInfo.md +32 -0
  38. data/docs/RetrieveMedia200Response.md +26 -0
  39. data/docs/SendAddressMessageRequest.md +32 -0
  40. data/docs/SendButtonRequest.md +24 -0
  41. data/docs/SendButtonRequestSectionsInner.md +20 -0
  42. data/docs/SendButtonRequestSectionsInnerReply.md +20 -0
  43. data/docs/SendCarouselRequest1.md +26 -0
  44. data/docs/SendContactRequest.md +20 -0
  45. data/docs/SendContactRequestContactsInner.md +30 -0
  46. data/docs/SendContactRequestContactsInnerName.md +28 -0
  47. data/docs/SendContactRequestContactsInnerOrg.md +22 -0
  48. data/docs/SendContactRequestContactsInnerPhonesInner.md +22 -0
  49. data/docs/SendCtaUrlRequest.md +32 -0
  50. data/docs/SendFileRequest.md +34 -0
  51. data/docs/SendFlowRequest1.md +46 -0
  52. data/docs/SendFlowRequest1Header.md +49 -0
  53. data/docs/SendFlowRequestHeader.md +49 -0
  54. data/docs/SendListRequest.md +26 -0
  55. data/docs/SendListRequestSectionsInner.md +20 -0
  56. data/docs/SendListRequestSectionsInnerRowsInner.md +22 -0
  57. data/docs/SendLocationRequest1.md +30 -0
  58. data/docs/SendLocationRequestRequest.md +20 -0
  59. data/docs/SendMessageRequest.md +24 -0
  60. data/docs/SendOrderDetailsRequest.md +36 -0
  61. data/docs/SendOrderDetailsRequestLanguage.md +20 -0
  62. data/docs/SendOrderDetailsRequestOrder.md +28 -0
  63. data/docs/SendOrderDetailsRequestOrderItemsInner.md +24 -0
  64. data/docs/SendOrderDetailsRequestOrderItemsInnerAmount.md +20 -0
  65. data/docs/SendPaymentRequestRequest.md +26 -0
  66. data/docs/SendReactionRequest.md +22 -0
  67. data/docs/SendStickerRequest.md +26 -0
  68. data/docs/SendTemplateRequest.md +32 -0
  69. data/docs/SendTemplateRequestLanguage.md +20 -0
  70. data/docs/SetWhatsappBusinessEncryptionRequest.md +21 -0
  71. data/docs/SuccessResponse.md +18 -0
  72. data/docs/TemplatesApi.md +301 -0
  73. data/docs/UpdateMeRequest.md +30 -0
  74. data/docs/UsersApi.md +223 -0
  75. data/docs/WebhooksApi.md +155 -0
  76. data/git_push.sh +57 -0
  77. data/lib/one_msg_chat_api/api/calling_api.rb +228 -0
  78. data/lib/one_msg_chat_api/api/catalog_api.rb +161 -0
  79. data/lib/one_msg_chat_api/api/channel_api.rb +225 -0
  80. data/lib/one_msg_chat_api/api/flows_api.rb +788 -0
  81. data/lib/one_msg_chat_api/api/groups_api.rb +486 -0
  82. data/lib/one_msg_chat_api/api/messaging_api.rb +1833 -0
  83. data/lib/one_msg_chat_api/api/profile_api.rb +157 -0
  84. data/lib/one_msg_chat_api/api/templates_api.rb +293 -0
  85. data/lib/one_msg_chat_api/api/users_api.rb +232 -0
  86. data/lib/one_msg_chat_api/api/webhooks_api.rb +157 -0
  87. data/lib/one_msg_chat_api/api_client.rb +441 -0
  88. data/lib/one_msg_chat_api/api_error.rb +58 -0
  89. data/lib/one_msg_chat_api/api_model_base.rb +88 -0
  90. data/lib/one_msg_chat_api/configuration.rb +400 -0
  91. data/lib/one_msg_chat_api/models/add_template_request.rb +176 -0
  92. data/lib/one_msg_chat_api/models/block_user_request.rb +164 -0
  93. data/lib/one_msg_chat_api/models/conversational_automation.rb +210 -0
  94. data/lib/one_msg_chat_api/models/conversational_automation_commands_inner.rb +208 -0
  95. data/lib/one_msg_chat_api/models/create_commerce200_response.rb +147 -0
  96. data/lib/one_msg_chat_api/models/create_commerce_request.rb +164 -0
  97. data/lib/one_msg_chat_api/models/create_commerce_request_params.rb +192 -0
  98. data/lib/one_msg_chat_api/models/create_groups200_response.rb +149 -0
  99. data/lib/one_msg_chat_api/models/create_read_message200_response.rb +147 -0
  100. data/lib/one_msg_chat_api/models/create_read_message401_response.rb +147 -0
  101. data/lib/one_msg_chat_api/models/create_read_message_request.rb +168 -0
  102. data/lib/one_msg_chat_api/models/delete_flows_flow_id200_response.rb +158 -0
  103. data/lib/one_msg_chat_api/models/delete_groups_group_id200_response.rb +158 -0
  104. data/lib/one_msg_chat_api/models/delete_media_legacy_request.rb +165 -0
  105. data/lib/one_msg_chat_api/models/error_response.rb +149 -0
  106. data/lib/one_msg_chat_api/models/get_commerce200_response_inner.rb +168 -0
  107. data/lib/one_msg_chat_api/models/get_mm_lite_status200_response.rb +165 -0
  108. data/lib/one_msg_chat_api/models/get_webhook200_response.rb +147 -0
  109. data/lib/one_msg_chat_api/models/get_whatsapp_business_encryption200_response.rb +202 -0
  110. data/lib/one_msg_chat_api/models/list_blocked_users200_response.rb +149 -0
  111. data/lib/one_msg_chat_api/models/list_flows200_response.rb +189 -0
  112. data/lib/one_msg_chat_api/models/list_messages200_response.rb +158 -0
  113. data/lib/one_msg_chat_api/models/list_templates200_response.rb +169 -0
  114. data/lib/one_msg_chat_api/models/message_sent_response.rb +179 -0
  115. data/lib/one_msg_chat_api/models/patch_flows_flow_id_assets200_response.rb +169 -0
  116. data/lib/one_msg_chat_api/models/profile_info.rb +254 -0
  117. data/lib/one_msg_chat_api/models/retrieve_media200_response.rb +183 -0
  118. data/lib/one_msg_chat_api/models/send_address_message_request.rb +273 -0
  119. data/lib/one_msg_chat_api/models/send_button_request.rb +176 -0
  120. data/lib/one_msg_chat_api/models/send_button_request_sections_inner.rb +156 -0
  121. data/lib/one_msg_chat_api/models/send_button_request_sections_inner_reply.rb +156 -0
  122. data/lib/one_msg_chat_api/models/send_carousel_request1.rb +202 -0
  123. data/lib/one_msg_chat_api/models/send_contact_request.rb +158 -0
  124. data/lib/one_msg_chat_api/models/send_contact_request_contacts_inner.rb +209 -0
  125. data/lib/one_msg_chat_api/models/send_contact_request_contacts_inner_name.rb +192 -0
  126. data/lib/one_msg_chat_api/models/send_contact_request_contacts_inner_org.rb +165 -0
  127. data/lib/one_msg_chat_api/models/send_contact_request_contacts_inner_phones_inner.rb +165 -0
  128. data/lib/one_msg_chat_api/models/send_cta_url_request.rb +264 -0
  129. data/lib/one_msg_chat_api/models/send_file_request.rb +278 -0
  130. data/lib/one_msg_chat_api/models/send_flow_request1.rb +387 -0
  131. data/lib/one_msg_chat_api/models/send_flow_request1_header.rb +104 -0
  132. data/lib/one_msg_chat_api/models/send_flow_request_header.rb +105 -0
  133. data/lib/one_msg_chat_api/models/send_list_request.rb +185 -0
  134. data/lib/one_msg_chat_api/models/send_list_request_sections_inner.rb +158 -0
  135. data/lib/one_msg_chat_api/models/send_list_request_sections_inner_rows_inner.rb +165 -0
  136. data/lib/one_msg_chat_api/models/send_location_request1.rb +235 -0
  137. data/lib/one_msg_chat_api/models/send_location_request_request.rb +156 -0
  138. data/lib/one_msg_chat_api/models/send_message_request.rb +284 -0
  139. data/lib/one_msg_chat_api/models/send_order_details_request.rb +308 -0
  140. data/lib/one_msg_chat_api/models/send_order_details_request_language.rb +176 -0
  141. data/lib/one_msg_chat_api/models/send_order_details_request_order.rb +220 -0
  142. data/lib/one_msg_chat_api/models/send_order_details_request_order_items_inner.rb +174 -0
  143. data/lib/one_msg_chat_api/models/send_order_details_request_order_items_inner_amount.rb +156 -0
  144. data/lib/one_msg_chat_api/models/send_payment_request_request.rb +245 -0
  145. data/lib/one_msg_chat_api/models/send_reaction_request.rb +165 -0
  146. data/lib/one_msg_chat_api/models/send_sticker_request.rb +185 -0
  147. data/lib/one_msg_chat_api/models/send_template_request.rb +215 -0
  148. data/lib/one_msg_chat_api/models/send_template_request_language.rb +156 -0
  149. data/lib/one_msg_chat_api/models/set_whatsapp_business_encryption_request.rb +165 -0
  150. data/lib/one_msg_chat_api/models/success_response.rb +149 -0
  151. data/lib/one_msg_chat_api/models/update_me_request.rb +207 -0
  152. data/lib/one_msg_chat_api/version.rb +15 -0
  153. data/lib/one_msg_chat_api.rb +111 -0
  154. data/one_msg_chat_api.gemspec +41 -0
  155. data/spec/api/calling_api_spec.rb +73 -0
  156. data/spec/api/catalog_api_spec.rb +60 -0
  157. data/spec/api/channel_api_spec.rb +72 -0
  158. data/spec/api/flows_api_spec.rb +175 -0
  159. data/spec/api/groups_api_spec.rb +117 -0
  160. data/spec/api/messaging_api_spec.rb +359 -0
  161. data/spec/api/profile_api_spec.rb +60 -0
  162. data/spec/api/templates_api_spec.rb +83 -0
  163. data/spec/api/users_api_spec.rb +71 -0
  164. data/spec/api/webhooks_api_spec.rb +60 -0
  165. data/spec/models/add_template_request_spec.rb +54 -0
  166. data/spec/models/block_user_request_spec.rb +36 -0
  167. data/spec/models/conversational_automation_commands_inner_spec.rb +42 -0
  168. data/spec/models/conversational_automation_spec.rb +48 -0
  169. data/spec/models/create_commerce200_response_spec.rb +36 -0
  170. data/spec/models/create_commerce_request_params_spec.rb +42 -0
  171. data/spec/models/create_commerce_request_spec.rb +36 -0
  172. data/spec/models/create_groups200_response_spec.rb +36 -0
  173. data/spec/models/create_read_message200_response_spec.rb +36 -0
  174. data/spec/models/create_read_message401_response_spec.rb +36 -0
  175. data/spec/models/create_read_message_request_spec.rb +48 -0
  176. data/spec/models/delete_flows_flow_id200_response_spec.rb +42 -0
  177. data/spec/models/delete_groups_group_id200_response_spec.rb +42 -0
  178. data/spec/models/delete_media_legacy_request_spec.rb +36 -0
  179. data/spec/models/error_response_spec.rb +36 -0
  180. data/spec/models/get_commerce200_response_inner_spec.rb +48 -0
  181. data/spec/models/get_mm_lite_status200_response_spec.rb +48 -0
  182. data/spec/models/get_webhook200_response_spec.rb +36 -0
  183. data/spec/models/get_whatsapp_business_encryption200_response_spec.rb +52 -0
  184. data/spec/models/list_blocked_users200_response_spec.rb +36 -0
  185. data/spec/models/list_flows200_response_spec.rb +60 -0
  186. data/spec/models/list_messages200_response_spec.rb +42 -0
  187. data/spec/models/list_templates200_response_spec.rb +48 -0
  188. data/spec/models/message_sent_response_spec.rb +54 -0
  189. data/spec/models/patch_flows_flow_id_assets200_response_spec.rb +48 -0
  190. data/spec/models/profile_info_spec.rb +82 -0
  191. data/spec/models/retrieve_media200_response_spec.rb +60 -0
  192. data/spec/models/send_address_message_request_spec.rb +82 -0
  193. data/spec/models/send_button_request_sections_inner_reply_spec.rb +42 -0
  194. data/spec/models/send_button_request_sections_inner_spec.rb +42 -0
  195. data/spec/models/send_button_request_spec.rb +54 -0
  196. data/spec/models/send_carousel_request1_spec.rb +60 -0
  197. data/spec/models/send_contact_request_contacts_inner_name_spec.rb +66 -0
  198. data/spec/models/send_contact_request_contacts_inner_org_spec.rb +48 -0
  199. data/spec/models/send_contact_request_contacts_inner_phones_inner_spec.rb +48 -0
  200. data/spec/models/send_contact_request_contacts_inner_spec.rb +72 -0
  201. data/spec/models/send_contact_request_spec.rb +42 -0
  202. data/spec/models/send_cta_url_request_spec.rb +78 -0
  203. data/spec/models/send_file_request_spec.rb +88 -0
  204. data/spec/models/send_flow_request1_header_spec.rb +32 -0
  205. data/spec/models/send_flow_request1_spec.rb +128 -0
  206. data/spec/models/send_flow_request_header_spec.rb +32 -0
  207. data/spec/models/send_list_request_sections_inner_rows_inner_spec.rb +48 -0
  208. data/spec/models/send_list_request_sections_inner_spec.rb +42 -0
  209. data/spec/models/send_list_request_spec.rb +60 -0
  210. data/spec/models/send_location_request1_spec.rb +72 -0
  211. data/spec/models/send_location_request_request_spec.rb +42 -0
  212. data/spec/models/send_message_request_spec.rb +54 -0
  213. data/spec/models/send_order_details_request_language_spec.rb +42 -0
  214. data/spec/models/send_order_details_request_order_items_inner_amount_spec.rb +42 -0
  215. data/spec/models/send_order_details_request_order_items_inner_spec.rb +54 -0
  216. data/spec/models/send_order_details_request_order_spec.rb +66 -0
  217. data/spec/models/send_order_details_request_spec.rb +90 -0
  218. data/spec/models/send_payment_request_request_spec.rb +64 -0
  219. data/spec/models/send_reaction_request_spec.rb +48 -0
  220. data/spec/models/send_sticker_request_spec.rb +60 -0
  221. data/spec/models/send_template_request_language_spec.rb +42 -0
  222. data/spec/models/send_template_request_spec.rb +78 -0
  223. data/spec/models/set_whatsapp_business_encryption_request_spec.rb +36 -0
  224. data/spec/models/success_response_spec.rb +36 -0
  225. data/spec/models/update_me_request_spec.rb +72 -0
  226. data/spec/spec_helper.rb +111 -0
  227. metadata +408 -0
@@ -0,0 +1,88 @@
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
+ module OneMsgChatApi
14
+ class ApiModelBase
15
+ # Deserializes the data based on type
16
+ # @param string type Data type
17
+ # @param string value Value to be deserialized
18
+ # @return [Object] Deserialized data
19
+ def self._deserialize(type, value)
20
+ case type.to_sym
21
+ when :Time
22
+ Time.parse(value)
23
+ when :Date
24
+ Date.parse(value)
25
+ when :String
26
+ value.to_s
27
+ when :Integer
28
+ value.to_i
29
+ when :Float
30
+ value.to_f
31
+ when :Boolean
32
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
33
+ true
34
+ else
35
+ false
36
+ end
37
+ when :Object
38
+ # generic object (usually a Hash), return directly
39
+ value
40
+ when /\AArray<(?<inner_type>.+)>\z/
41
+ inner_type = Regexp.last_match[:inner_type]
42
+ value.map { |v| _deserialize(inner_type, v) }
43
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
44
+ k_type = Regexp.last_match[:k_type]
45
+ v_type = Regexp.last_match[:v_type]
46
+ {}.tap do |hash|
47
+ value.each do |k, v|
48
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
49
+ end
50
+ end
51
+ else # model
52
+ # models (e.g. Pet) or oneOf
53
+ klass = OneMsgChatApi.const_get(type)
54
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
55
+ end
56
+ end
57
+
58
+ # Returns the string representation of the object
59
+ # @return [String] String presentation of the object
60
+ def to_s
61
+ to_hash.to_s
62
+ end
63
+
64
+ # to_body is an alias to to_hash (backward compatibility)
65
+ # @return [Hash] Returns the object in the form of hash
66
+ def to_body
67
+ to_hash
68
+ end
69
+
70
+ # Outputs non-array value in the form of hash
71
+ # For object, use to_hash. Otherwise, just return the value
72
+ # @param [Object] value Any valid value
73
+ # @return [Hash] Returns the value in the form of hash
74
+ def _to_hash(value)
75
+ if value.is_a?(Array)
76
+ value.compact.map { |v| _to_hash(v) }
77
+ elsif value.is_a?(Hash)
78
+ {}.tap do |hash|
79
+ value.each { |k, v| hash[k] = _to_hash(v) }
80
+ end
81
+ elsif value.respond_to? :to_hash
82
+ value.to_hash
83
+ else
84
+ value
85
+ end
86
+ end
87
+ end
88
+ end
@@ -0,0 +1,400 @@
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
+ module OneMsgChatApi
14
+ class Configuration
15
+ # Defines url scheme
16
+ attr_accessor :scheme
17
+
18
+ # Defines url host
19
+ attr_accessor :host
20
+
21
+ # Defines url base path
22
+ attr_accessor :base_path
23
+
24
+ # Define server configuration index
25
+ attr_accessor :server_index
26
+
27
+ # Define server operation configuration index
28
+ attr_accessor :server_operation_index
29
+
30
+ # Default server variables
31
+ attr_accessor :server_variables
32
+
33
+ # Default server operation variables
34
+ attr_accessor :server_operation_variables
35
+
36
+ # Defines API keys used with API Key authentications.
37
+ #
38
+ # @return [Hash] key: parameter name, value: parameter value (API key)
39
+ #
40
+ # @example parameter name is "api_key", API key is "xxx" (e.g. "api_key=xxx" in query string)
41
+ # config.api_key['api_key'] = 'xxx'
42
+ attr_accessor :api_key
43
+
44
+ # Defines API key prefixes used with API Key authentications.
45
+ #
46
+ # @return [Hash] key: parameter name, value: API key prefix
47
+ #
48
+ # @example parameter name is "Authorization", API key prefix is "Token" (e.g. "Authorization: Token xxx" in headers)
49
+ # config.api_key_prefix['api_key'] = 'Token'
50
+ attr_accessor :api_key_prefix
51
+
52
+ # Defines the username used with HTTP basic authentication.
53
+ #
54
+ # @return [String]
55
+ attr_accessor :username
56
+
57
+ # Defines the password used with HTTP basic authentication.
58
+ #
59
+ # @return [String]
60
+ attr_accessor :password
61
+
62
+ # Defines the access token (Bearer) used with OAuth2.
63
+ attr_accessor :access_token
64
+
65
+ # Defines a Proc used to fetch or refresh access tokens (Bearer) used with OAuth2.
66
+ # Overrides the access_token if set
67
+ # @return [Proc]
68
+ attr_accessor :access_token_getter
69
+
70
+ # Set this to return data as binary instead of downloading a temp file. When enabled (set to true)
71
+ # HTTP responses with return type `File` will be returned as a stream of binary data.
72
+ # Default to false.
73
+ attr_accessor :return_binary_data
74
+
75
+ # Set this to enable/disable debugging. When enabled (set to true), HTTP request/response
76
+ # details will be logged with `logger.debug` (see the `logger` attribute).
77
+ # Default to false.
78
+ #
79
+ # @return [true, false]
80
+ attr_accessor :debugging
81
+
82
+ # Set this to ignore operation servers for the API client. This is useful when you need to
83
+ # send requests to a different server than the one specified in the OpenAPI document.
84
+ # Will default to the base url defined in the spec but can be overridden by setting
85
+ # `scheme`, `host`, `base_path` directly.
86
+ # Default to false.
87
+ # @return [true, false]
88
+ attr_accessor :ignore_operation_servers
89
+
90
+ # Defines the logger used for debugging.
91
+ # Default to `Rails.logger` (when in Rails) or logging to STDOUT.
92
+ #
93
+ # @return [#debug]
94
+ attr_accessor :logger
95
+
96
+ # Defines the temporary folder to store downloaded files
97
+ # (for API endpoints that have file response).
98
+ # Default to use `Tempfile`.
99
+ #
100
+ # @return [String]
101
+ attr_accessor :temp_folder_path
102
+
103
+ # The time limit for HTTP request in seconds.
104
+ # Default to 0 (never times out).
105
+ attr_accessor :timeout
106
+
107
+ # Set this to false to skip client side validation in the operation.
108
+ # Default to true.
109
+ # @return [true, false]
110
+ attr_accessor :client_side_validation
111
+
112
+ ### TLS/SSL setting
113
+ # Set this to false to skip verifying SSL certificate when calling API from https server.
114
+ # Default to true.
115
+ #
116
+ # @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks.
117
+ #
118
+ # @return [true, false]
119
+ attr_accessor :ssl_verify
120
+
121
+ ### TLS/SSL setting
122
+ # Any `OpenSSL::SSL::` constant (see https://ruby-doc.org/stdlib-2.5.1/libdoc/openssl/rdoc/OpenSSL/SSL.html)
123
+ #
124
+ # @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks.
125
+ #
126
+ attr_accessor :ssl_verify_mode
127
+
128
+ ### TLS/SSL setting
129
+ # Set this to customize the certificate file to verify the peer.
130
+ #
131
+ # @return [String] the path to the certificate file
132
+ attr_accessor :ssl_ca_file
133
+
134
+ ### TLS/SSL setting
135
+ # Client certificate file (for client certificate)
136
+ attr_accessor :ssl_client_cert
137
+
138
+ ### TLS/SSL setting
139
+ # Client private key file (for client certificate)
140
+ attr_accessor :ssl_client_key
141
+
142
+ ### Proxy setting
143
+ # HTTP Proxy settings
144
+ attr_accessor :proxy
145
+
146
+ # Set this to customize parameters encoder of array parameter.
147
+ # Default to nil. Faraday uses NestedParamsEncoder when nil.
148
+ #
149
+ # @see The params_encoder option of Faraday. Related source code:
150
+ # https://github.com/lostisland/faraday/tree/main/lib/faraday/encoders
151
+ attr_accessor :params_encoder
152
+
153
+
154
+ attr_accessor :inject_format
155
+
156
+ attr_accessor :force_ending_format
157
+
158
+ def initialize
159
+ @scheme = 'https'
160
+ @host = 'api.1msg.io'
161
+ @base_path = ''
162
+ @server_index = nil
163
+ @server_operation_index = {}
164
+ @server_variables = {}
165
+ @server_operation_variables = {}
166
+ @api_key = {}
167
+ @api_key_prefix = {}
168
+ @client_side_validation = true
169
+ @ssl_verify = true
170
+ @ssl_verify_mode = nil
171
+ @ssl_ca_file = nil
172
+ @ssl_client_cert = nil
173
+ @ssl_client_key = nil
174
+ @middlewares = Hash.new { |h, k| h[k] = [] }
175
+ @configure_connection_blocks = []
176
+ @timeout = 60
177
+ # return data as binary instead of file
178
+ @return_binary_data = false
179
+ @params_encoder = nil
180
+ @debugging = false
181
+ @ignore_operation_servers = false
182
+ @inject_format = false
183
+ @force_ending_format = false
184
+ @logger = defined?(Rails) ? Rails.logger : Logger.new(STDOUT)
185
+
186
+ yield(self) if block_given?
187
+ end
188
+
189
+ # The default Configuration object.
190
+ def self.default
191
+ @@default ||= Configuration.new
192
+ end
193
+
194
+ def configure
195
+ yield(self) if block_given?
196
+ end
197
+
198
+ def scheme=(scheme)
199
+ # remove :// from scheme
200
+ @scheme = scheme.sub(/:\/\//, '')
201
+ end
202
+
203
+ def host=(host)
204
+ # remove http(s):// and anything after a slash
205
+ @host = host.sub(/https?:\/\//, '').split('/').first
206
+ end
207
+
208
+ def base_path=(base_path)
209
+ # Add leading and trailing slashes to base_path
210
+ @base_path = "/#{base_path}".gsub(/\/+/, '/')
211
+ @base_path = '' if @base_path == '/'
212
+ end
213
+
214
+ # Returns base URL for specified operation based on server settings
215
+ def base_url(operation = nil)
216
+ return "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '') if ignore_operation_servers
217
+ if operation_server_settings.key?(operation) then
218
+ index = server_operation_index.fetch(operation, server_index)
219
+ server_url(index.nil? ? 0 : index, server_operation_variables.fetch(operation, server_variables), operation_server_settings[operation])
220
+ else
221
+ server_index.nil? ? "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '') : server_url(server_index, server_variables, nil)
222
+ end
223
+ end
224
+
225
+ # Gets API key (with prefix if set).
226
+ # @param [String] param_name the parameter name of API key auth
227
+ def api_key_with_prefix(param_name, param_alias = nil)
228
+ key = @api_key[param_name]
229
+ key = @api_key.fetch(param_alias, key) unless param_alias.nil?
230
+ if @api_key_prefix[param_name]
231
+ "#{@api_key_prefix[param_name]} #{key}"
232
+ else
233
+ key
234
+ end
235
+ end
236
+
237
+ # Gets access_token using access_token_getter or uses the static access_token
238
+ def access_token_with_refresh
239
+ return access_token if access_token_getter.nil?
240
+ access_token_getter.call
241
+ end
242
+
243
+ # Gets Basic Auth token string
244
+ def basic_auth_token
245
+ 'Basic ' + ["#{username}:#{password}"].pack('m').delete("\r\n")
246
+ end
247
+
248
+ # Returns Auth Settings hash for api client.
249
+ def auth_settings
250
+ {
251
+ 'tokenAuth' =>
252
+ {
253
+ type: 'api_key',
254
+ in: 'query',
255
+ key: 'token',
256
+ value: api_key_with_prefix('token')
257
+ },
258
+ }
259
+ end
260
+
261
+ # Returns an array of Server setting
262
+ def server_settings
263
+ [
264
+ {
265
+ url: "https://api.1msg.io",
266
+ description: "Production",
267
+ },
268
+ {
269
+ url: "https://api-stage.1msg.io",
270
+ description: "Staging",
271
+ },
272
+ {
273
+ url: "http://127.0.0.1:3050",
274
+ description: "Local development",
275
+ }
276
+ ]
277
+ end
278
+
279
+ def operation_server_settings
280
+ {
281
+ }
282
+ end
283
+
284
+ # Returns URL based on server settings
285
+ #
286
+ # @param index array index of the server settings
287
+ # @param variables hash of variable and the corresponding value
288
+ def server_url(index, variables = {}, servers = nil)
289
+ servers = server_settings if servers == nil
290
+
291
+ # check array index out of bound
292
+ if (index.nil? || index < 0 || index >= servers.size)
293
+ fail ArgumentError, "Invalid index #{index} when selecting the server. Must not be nil and must be less than #{servers.size}"
294
+ end
295
+
296
+ server = servers[index]
297
+ url = server[:url]
298
+
299
+ return url unless server.key? :variables
300
+
301
+ # go through variable and assign a value
302
+ server[:variables].each do |name, variable|
303
+ if variables.key?(name)
304
+ if (!server[:variables][name].key?(:enum_values) || server[:variables][name][:enum_values].include?(variables[name]))
305
+ url.gsub! "{" + name.to_s + "}", variables[name]
306
+ else
307
+ fail ArgumentError, "The variable `#{name}` in the server URL has invalid value #{variables[name]}. Must be #{server[:variables][name][:enum_values]}."
308
+ end
309
+ else
310
+ # use default value
311
+ url.gsub! "{" + name.to_s + "}", server[:variables][name][:default_value]
312
+ end
313
+ end
314
+
315
+ url
316
+ end
317
+
318
+ # Configure Faraday connection directly.
319
+ #
320
+ # ```
321
+ # c.configure_faraday_connection do |conn|
322
+ # conn.use Faraday::HttpCache, shared_cache: false, logger: logger
323
+ # conn.response :logger, nil, headers: true, bodies: true, log_level: :debug do |logger|
324
+ # logger.filter(/(Authorization: )(.*)/, '\1[REDACTED]')
325
+ # end
326
+ # end
327
+ #
328
+ # c.configure_faraday_connection do |conn|
329
+ # conn.adapter :typhoeus
330
+ # end
331
+ # ```
332
+ #
333
+ # @param block [Proc] `#call`able object that takes one arg, the connection
334
+ def configure_faraday_connection(&block)
335
+ @configure_connection_blocks << block
336
+ end
337
+
338
+ def configure_connection(conn)
339
+ @configure_connection_blocks.each do |block|
340
+ block.call(conn)
341
+ end
342
+ end
343
+
344
+ # Adds middleware to the stack
345
+ def use(*middleware)
346
+ set_faraday_middleware(:use, *middleware)
347
+ end
348
+
349
+ # Adds request middleware to the stack
350
+ def request(*middleware)
351
+ set_faraday_middleware(:request, *middleware)
352
+ end
353
+
354
+ # Adds response middleware to the stack
355
+ def response(*middleware)
356
+ set_faraday_middleware(:response, *middleware)
357
+ end
358
+
359
+ # Adds Faraday middleware setting information to the stack
360
+ #
361
+ # @example Use the `set_faraday_middleware` method to set middleware information
362
+ # config.set_faraday_middleware(:request, :retry, max: 3, methods: [:get, :post], retry_statuses: [503])
363
+ # config.set_faraday_middleware(:response, :logger, nil, { bodies: true, log_level: :debug })
364
+ # config.set_faraday_middleware(:use, Faraday::HttpCache, store: Rails.cache, shared_cache: false)
365
+ # config.set_faraday_middleware(:insert, 0, FaradayMiddleware::FollowRedirects, { standards_compliant: true, limit: 1 })
366
+ # config.set_faraday_middleware(:swap, 0, Faraday::Response::Logger)
367
+ # config.set_faraday_middleware(:delete, Faraday::Multipart::Middleware)
368
+ #
369
+ # @see https://github.com/lostisland/faraday/blob/v2.3.0/lib/faraday/rack_builder.rb#L92-L143
370
+ def set_faraday_middleware(operation, key, *args, &block)
371
+ unless [:request, :response, :use, :insert, :insert_before, :insert_after, :swap, :delete].include?(operation)
372
+ fail ArgumentError, "Invalid faraday middleware operation #{operation}. Must be" \
373
+ " :request, :response, :use, :insert, :insert_before, :insert_after, :swap or :delete."
374
+ end
375
+
376
+ @middlewares[operation] << [key, args, block]
377
+ end
378
+ ruby2_keywords(:set_faraday_middleware) if respond_to?(:ruby2_keywords, true)
379
+
380
+ # Set up middleware on the connection
381
+ def configure_middleware(connection)
382
+ return if @middlewares.empty?
383
+
384
+ [:request, :response, :use, :insert, :insert_before, :insert_after, :swap].each do |operation|
385
+ next unless @middlewares.key?(operation)
386
+
387
+ @middlewares[operation].each do |key, args, block|
388
+ connection.builder.send(operation, key, *args, &block)
389
+ end
390
+ end
391
+
392
+ if @middlewares.key?(:delete)
393
+ @middlewares[:delete].each do |key, _args, _block|
394
+ connection.builder.delete(key)
395
+ end
396
+ end
397
+ end
398
+
399
+ end
400
+ end
@@ -0,0 +1,176 @@
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 OneMsgChatApi
17
+ class AddTemplateRequest < ApiModelBase
18
+ attr_accessor :name
19
+
20
+ attr_accessor :category
21
+
22
+ attr_accessor :language
23
+
24
+ attr_accessor :components
25
+
26
+ # Attribute mapping from ruby-style variable name to JSON key.
27
+ def self.attribute_map
28
+ {
29
+ :'name' => :'name',
30
+ :'category' => :'category',
31
+ :'language' => :'language',
32
+ :'components' => :'components'
33
+ }
34
+ end
35
+
36
+ # Returns attribute mapping this model knows about
37
+ def self.acceptable_attribute_map
38
+ attribute_map
39
+ end
40
+
41
+ # Returns all the JSON keys this model knows about
42
+ def self.acceptable_attributes
43
+ acceptable_attribute_map.values
44
+ end
45
+
46
+ # Attribute type mapping.
47
+ def self.openapi_types
48
+ {
49
+ :'name' => :'String',
50
+ :'category' => :'String',
51
+ :'language' => :'String',
52
+ :'components' => :'Array<Hash<String, Object>>'
53
+ }
54
+ end
55
+
56
+ # List of attributes with nullable: true
57
+ def self.openapi_nullable
58
+ Set.new([
59
+ ])
60
+ end
61
+
62
+ # Initializes the object
63
+ # @param [Hash] attributes Model attributes in the form of hash
64
+ def initialize(attributes = {})
65
+ if (!attributes.is_a?(Hash))
66
+ fail ArgumentError, "The input argument (attributes) must be a hash in `OneMsgChatApi::AddTemplateRequest` initialize method"
67
+ end
68
+
69
+ # check to see if the attribute exists and convert string to symbol for hash key
70
+ acceptable_attribute_map = self.class.acceptable_attribute_map
71
+ attributes = attributes.each_with_object({}) { |(k, v), h|
72
+ if (!acceptable_attribute_map.key?(k.to_sym))
73
+ fail ArgumentError, "`#{k}` is not a valid attribute in `OneMsgChatApi::AddTemplateRequest`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
74
+ end
75
+ h[k.to_sym] = v
76
+ }
77
+
78
+ if attributes.key?(:'name')
79
+ self.name = attributes[:'name']
80
+ end
81
+
82
+ if attributes.key?(:'category')
83
+ self.category = attributes[:'category']
84
+ end
85
+
86
+ if attributes.key?(:'language')
87
+ self.language = attributes[:'language']
88
+ end
89
+
90
+ if attributes.key?(:'components')
91
+ if (value = attributes[:'components']).is_a?(Array)
92
+ self.components = value
93
+ end
94
+ end
95
+ end
96
+
97
+ # Show invalid properties with the reasons. Usually used together with valid?
98
+ # @return Array for valid properties with the reasons
99
+ def list_invalid_properties
100
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
101
+ invalid_properties = Array.new
102
+ invalid_properties
103
+ end
104
+
105
+ # Check to see if the all the properties in the model are valid
106
+ # @return true if the model is valid
107
+ def valid?
108
+ warn '[DEPRECATED] the `valid?` method is obsolete'
109
+ true
110
+ end
111
+
112
+ # Checks equality by comparing each attribute.
113
+ # @param [Object] Object to be compared
114
+ def ==(o)
115
+ return true if self.equal?(o)
116
+ self.class == o.class &&
117
+ name == o.name &&
118
+ category == o.category &&
119
+ language == o.language &&
120
+ components == o.components
121
+ end
122
+
123
+ # @see the `==` method
124
+ # @param [Object] Object to be compared
125
+ def eql?(o)
126
+ self == o
127
+ end
128
+
129
+ # Calculates hash code according to all attributes.
130
+ # @return [Integer] Hash code
131
+ def hash
132
+ [name, category, language, components].hash
133
+ end
134
+
135
+ # Builds the object from hash
136
+ # @param [Hash] attributes Model attributes in the form of hash
137
+ # @return [Object] Returns the model itself
138
+ def self.build_from_hash(attributes)
139
+ return nil unless attributes.is_a?(Hash)
140
+ attributes = attributes.transform_keys(&:to_sym)
141
+ transformed_hash = {}
142
+ openapi_types.each_pair do |key, type|
143
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
144
+ transformed_hash["#{key}"] = nil
145
+ elsif type =~ /\AArray<(.*)>/i
146
+ # check to ensure the input is an array given that the attribute
147
+ # is documented as an array but the input is not
148
+ if attributes[attribute_map[key]].is_a?(Array)
149
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
150
+ end
151
+ elsif !attributes[attribute_map[key]].nil?
152
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
153
+ end
154
+ end
155
+ new(transformed_hash)
156
+ end
157
+
158
+ # Returns the object in the form of hash
159
+ # @return [Hash] Returns the object in the form of hash
160
+ def to_hash
161
+ hash = {}
162
+ self.class.attribute_map.each_pair do |attr, param|
163
+ value = self.send(attr)
164
+ if value.nil?
165
+ is_nullable = self.class.openapi_nullable.include?(attr)
166
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
167
+ end
168
+
169
+ hash[param] = _to_hash(value)
170
+ end
171
+ hash
172
+ end
173
+
174
+ end
175
+
176
+ end