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,157 @@
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 'cgi'
14
+
15
+ module OneMsgChatApi
16
+ class ProfileApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+ # Get Profile Info
23
+ # Get WhatsApp Business Account profile information
24
+ # @param token [String] JWT token or API key for authorization
25
+ # @param [Hash] opts the optional parameters
26
+ # @return [ProfileInfo]
27
+ def get_me(token, opts = {})
28
+ data, _status_code, _headers = get_me_with_http_info(token, opts)
29
+ data
30
+ end
31
+
32
+ # Get Profile Info
33
+ # Get WhatsApp Business Account profile information
34
+ # @param token [String] JWT token or API key for authorization
35
+ # @param [Hash] opts the optional parameters
36
+ # @return [Array<(ProfileInfo, Integer, Hash)>] ProfileInfo data, response status code and response headers
37
+ def get_me_with_http_info(token, opts = {})
38
+ if @api_client.config.debugging
39
+ @api_client.config.logger.debug 'Calling API: ProfileApi.get_me ...'
40
+ end
41
+ # verify the required parameter 'token' is set
42
+ if @api_client.config.client_side_validation && token.nil?
43
+ fail ArgumentError, "Missing the required parameter 'token' when calling ProfileApi.get_me"
44
+ end
45
+ # resource path
46
+ local_var_path = '/me'
47
+
48
+ # query parameters
49
+ query_params = opts[:query_params] || {}
50
+ query_params[:'token'] = token
51
+
52
+ # header parameters
53
+ header_params = opts[:header_params] || {}
54
+ # HTTP header 'Accept' (if needed)
55
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
56
+
57
+ # form parameters
58
+ form_params = opts[:form_params] || {}
59
+
60
+ # http body (model)
61
+ post_body = opts[:debug_body]
62
+
63
+ # return_type
64
+ return_type = opts[:debug_return_type] || 'ProfileInfo'
65
+
66
+ # auth_names
67
+ auth_names = opts[:debug_auth_names] || ['tokenAuth']
68
+
69
+ new_options = opts.merge(
70
+ :operation => :"ProfileApi.get_me",
71
+ :header_params => header_params,
72
+ :query_params => query_params,
73
+ :form_params => form_params,
74
+ :body => post_body,
75
+ :auth_names => auth_names,
76
+ :return_type => return_type
77
+ )
78
+
79
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
80
+ if @api_client.config.debugging
81
+ @api_client.config.logger.debug "API called: ProfileApi#get_me\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
82
+ end
83
+ return data, status_code, headers
84
+ end
85
+
86
+ # Update profile info
87
+ # Update WhatsApp Business Account profile fields. At least one of about, description, email, photo, address, vertical, websites is required. Blocked when the channel subscription limit is exceeded.
88
+ # @param token [String] JWT token or API key for authorization
89
+ # @param [Hash] opts the optional parameters
90
+ # @option opts [UpdateMeRequest] :update_me_request
91
+ # @return [Hash<String, Object>]
92
+ def update_me(token, opts = {})
93
+ data, _status_code, _headers = update_me_with_http_info(token, opts)
94
+ data
95
+ end
96
+
97
+ # Update profile info
98
+ # Update WhatsApp Business Account profile fields. At least one of about, description, email, photo, address, vertical, websites is required. Blocked when the channel subscription limit is exceeded.
99
+ # @param token [String] JWT token or API key for authorization
100
+ # @param [Hash] opts the optional parameters
101
+ # @option opts [UpdateMeRequest] :update_me_request
102
+ # @return [Array<(Hash<String, Object>, Integer, Hash)>] Hash<String, Object> data, response status code and response headers
103
+ def update_me_with_http_info(token, opts = {})
104
+ if @api_client.config.debugging
105
+ @api_client.config.logger.debug 'Calling API: ProfileApi.update_me ...'
106
+ end
107
+ # verify the required parameter 'token' is set
108
+ if @api_client.config.client_side_validation && token.nil?
109
+ fail ArgumentError, "Missing the required parameter 'token' when calling ProfileApi.update_me"
110
+ end
111
+ # resource path
112
+ local_var_path = '/me'
113
+
114
+ # query parameters
115
+ query_params = opts[:query_params] || {}
116
+ query_params[:'token'] = token
117
+
118
+ # header parameters
119
+ header_params = opts[:header_params] || {}
120
+ # HTTP header 'Accept' (if needed)
121
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
122
+ # HTTP header 'Content-Type'
123
+ content_type = @api_client.select_header_content_type(['application/json'])
124
+ if !content_type.nil?
125
+ header_params['Content-Type'] = content_type
126
+ end
127
+
128
+ # form parameters
129
+ form_params = opts[:form_params] || {}
130
+
131
+ # http body (model)
132
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'update_me_request'])
133
+
134
+ # return_type
135
+ return_type = opts[:debug_return_type] || 'Hash<String, Object>'
136
+
137
+ # auth_names
138
+ auth_names = opts[:debug_auth_names] || ['tokenAuth']
139
+
140
+ new_options = opts.merge(
141
+ :operation => :"ProfileApi.update_me",
142
+ :header_params => header_params,
143
+ :query_params => query_params,
144
+ :form_params => form_params,
145
+ :body => post_body,
146
+ :auth_names => auth_names,
147
+ :return_type => return_type
148
+ )
149
+
150
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
151
+ if @api_client.config.debugging
152
+ @api_client.config.logger.debug "API called: ProfileApi#update_me\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
153
+ end
154
+ return data, status_code, headers
155
+ end
156
+ end
157
+ end
@@ -0,0 +1,293 @@
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 'cgi'
14
+
15
+ module OneMsgChatApi
16
+ class TemplatesApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+ # Create message template
23
+ # @param token [String] JWT token or API key for authorization
24
+ # @param [Hash] opts the optional parameters
25
+ # @option opts [AddTemplateRequest] :add_template_request
26
+ # @return [Hash<String, Object>]
27
+ def add_template(token, opts = {})
28
+ data, _status_code, _headers = add_template_with_http_info(token, opts)
29
+ data
30
+ end
31
+
32
+ # Create message template
33
+ # @param token [String] JWT token or API key for authorization
34
+ # @param [Hash] opts the optional parameters
35
+ # @option opts [AddTemplateRequest] :add_template_request
36
+ # @return [Array<(Hash<String, Object>, Integer, Hash)>] Hash<String, Object> data, response status code and response headers
37
+ def add_template_with_http_info(token, opts = {})
38
+ if @api_client.config.debugging
39
+ @api_client.config.logger.debug 'Calling API: TemplatesApi.add_template ...'
40
+ end
41
+ # verify the required parameter 'token' is set
42
+ if @api_client.config.client_side_validation && token.nil?
43
+ fail ArgumentError, "Missing the required parameter 'token' when calling TemplatesApi.add_template"
44
+ end
45
+ # resource path
46
+ local_var_path = '/addTemplate'
47
+
48
+ # query parameters
49
+ query_params = opts[:query_params] || {}
50
+ query_params[:'token'] = token
51
+
52
+ # header parameters
53
+ header_params = opts[:header_params] || {}
54
+ # HTTP header 'Accept' (if needed)
55
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
56
+ # HTTP header 'Content-Type'
57
+ content_type = @api_client.select_header_content_type(['application/json'])
58
+ if !content_type.nil?
59
+ header_params['Content-Type'] = content_type
60
+ end
61
+
62
+ # form parameters
63
+ form_params = opts[:form_params] || {}
64
+
65
+ # http body (model)
66
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'add_template_request'])
67
+
68
+ # return_type
69
+ return_type = opts[:debug_return_type] || 'Hash<String, Object>'
70
+
71
+ # auth_names
72
+ auth_names = opts[:debug_auth_names] || ['tokenAuth']
73
+
74
+ new_options = opts.merge(
75
+ :operation => :"TemplatesApi.add_template",
76
+ :header_params => header_params,
77
+ :query_params => query_params,
78
+ :form_params => form_params,
79
+ :body => post_body,
80
+ :auth_names => auth_names,
81
+ :return_type => return_type
82
+ )
83
+
84
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
85
+ if @api_client.config.debugging
86
+ @api_client.config.logger.debug "API called: TemplatesApi#add_template\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
87
+ end
88
+ return data, status_code, headers
89
+ end
90
+
91
+ # Get templates list
92
+ # @param token [String] JWT token or API key for authorization
93
+ # @param [Hash] opts the optional parameters
94
+ # @return [ListTemplates200Response]
95
+ def list_templates(token, opts = {})
96
+ data, _status_code, _headers = list_templates_with_http_info(token, opts)
97
+ data
98
+ end
99
+
100
+ # Get templates list
101
+ # @param token [String] JWT token or API key for authorization
102
+ # @param [Hash] opts the optional parameters
103
+ # @return [Array<(ListTemplates200Response, Integer, Hash)>] ListTemplates200Response data, response status code and response headers
104
+ def list_templates_with_http_info(token, opts = {})
105
+ if @api_client.config.debugging
106
+ @api_client.config.logger.debug 'Calling API: TemplatesApi.list_templates ...'
107
+ end
108
+ # verify the required parameter 'token' is set
109
+ if @api_client.config.client_side_validation && token.nil?
110
+ fail ArgumentError, "Missing the required parameter 'token' when calling TemplatesApi.list_templates"
111
+ end
112
+ # resource path
113
+ local_var_path = '/templates'
114
+
115
+ # query parameters
116
+ query_params = opts[:query_params] || {}
117
+ query_params[:'token'] = token
118
+
119
+ # header parameters
120
+ header_params = opts[:header_params] || {}
121
+ # HTTP header 'Accept' (if needed)
122
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
123
+
124
+ # form parameters
125
+ form_params = opts[:form_params] || {}
126
+
127
+ # http body (model)
128
+ post_body = opts[:debug_body]
129
+
130
+ # return_type
131
+ return_type = opts[:debug_return_type] || 'ListTemplates200Response'
132
+
133
+ # auth_names
134
+ auth_names = opts[:debug_auth_names] || ['tokenAuth']
135
+
136
+ new_options = opts.merge(
137
+ :operation => :"TemplatesApi.list_templates",
138
+ :header_params => header_params,
139
+ :query_params => query_params,
140
+ :form_params => form_params,
141
+ :body => post_body,
142
+ :auth_names => auth_names,
143
+ :return_type => return_type
144
+ )
145
+
146
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
147
+ if @api_client.config.debugging
148
+ @api_client.config.logger.debug "API called: TemplatesApi#list_templates\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
149
+ end
150
+ return data, status_code, headers
151
+ end
152
+
153
+ # Remove message template
154
+ # @param token [String] JWT token or API key for authorization
155
+ # @param [Hash] opts the optional parameters
156
+ # @option opts [Hash<String, Object>] :request_body
157
+ # @return [Hash<String, Object>]
158
+ def remove_template(token, opts = {})
159
+ data, _status_code, _headers = remove_template_with_http_info(token, opts)
160
+ data
161
+ end
162
+
163
+ # Remove message template
164
+ # @param token [String] JWT token or API key for authorization
165
+ # @param [Hash] opts the optional parameters
166
+ # @option opts [Hash<String, Object>] :request_body
167
+ # @return [Array<(Hash<String, Object>, Integer, Hash)>] Hash<String, Object> data, response status code and response headers
168
+ def remove_template_with_http_info(token, opts = {})
169
+ if @api_client.config.debugging
170
+ @api_client.config.logger.debug 'Calling API: TemplatesApi.remove_template ...'
171
+ end
172
+ # verify the required parameter 'token' is set
173
+ if @api_client.config.client_side_validation && token.nil?
174
+ fail ArgumentError, "Missing the required parameter 'token' when calling TemplatesApi.remove_template"
175
+ end
176
+ # resource path
177
+ local_var_path = '/removeTemplate'
178
+
179
+ # query parameters
180
+ query_params = opts[:query_params] || {}
181
+ query_params[:'token'] = token
182
+
183
+ # header parameters
184
+ header_params = opts[:header_params] || {}
185
+ # HTTP header 'Accept' (if needed)
186
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
187
+ # HTTP header 'Content-Type'
188
+ content_type = @api_client.select_header_content_type(['application/json'])
189
+ if !content_type.nil?
190
+ header_params['Content-Type'] = content_type
191
+ end
192
+
193
+ # form parameters
194
+ form_params = opts[:form_params] || {}
195
+
196
+ # http body (model)
197
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'request_body'])
198
+
199
+ # return_type
200
+ return_type = opts[:debug_return_type] || 'Hash<String, Object>'
201
+
202
+ # auth_names
203
+ auth_names = opts[:debug_auth_names] || ['tokenAuth']
204
+
205
+ new_options = opts.merge(
206
+ :operation => :"TemplatesApi.remove_template",
207
+ :header_params => header_params,
208
+ :query_params => query_params,
209
+ :form_params => form_params,
210
+ :body => post_body,
211
+ :auth_names => auth_names,
212
+ :return_type => return_type
213
+ )
214
+
215
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
216
+ if @api_client.config.debugging
217
+ @api_client.config.logger.debug "API called: TemplatesApi#remove_template\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
218
+ end
219
+ return data, status_code, headers
220
+ end
221
+
222
+ # Send Template Message
223
+ # Send a WhatsApp template message (works outside the 24-hour session window). Supported `params` button `sub_type` values include: `url`, `quick_reply`, `copy_code` / `coupon_code`, `catalog`, `flow`, `limited_time_offer`, and **`order_details`** (WhatsApp Payments **India only** — requires an approved Utility template with an ORDER_DETAILS button). For India order/invoice payments outside 24h, include a button component: ```json { \"type\": \"button\", \"sub_type\": \"order_details\", \"index\": 0, \"parameters\": [{ \"type\": \"action\", \"action\": { \"order_details\": { \"reference_id\": \"...\", \"currency\": \"INR\", \"order\": {} } } }] } ``` Convenience wrapper with structured fields: `POST /sendOrderDetails`.
224
+ # @param token [String] JWT token or API key for authorization
225
+ # @param [Hash] opts the optional parameters
226
+ # @option opts [SendTemplateRequest] :send_template_request
227
+ # @return [Hash<String, Object>]
228
+ def send_template(token, opts = {})
229
+ data, _status_code, _headers = send_template_with_http_info(token, opts)
230
+ data
231
+ end
232
+
233
+ # Send Template Message
234
+ # Send a WhatsApp template message (works outside the 24-hour session window). Supported &#x60;params&#x60; button &#x60;sub_type&#x60; values include: &#x60;url&#x60;, &#x60;quick_reply&#x60;, &#x60;copy_code&#x60; / &#x60;coupon_code&#x60;, &#x60;catalog&#x60;, &#x60;flow&#x60;, &#x60;limited_time_offer&#x60;, and **&#x60;order_details&#x60;** (WhatsApp Payments **India only** — requires an approved Utility template with an ORDER_DETAILS button). For India order/invoice payments outside 24h, include a button component: &#x60;&#x60;&#x60;json { \&quot;type\&quot;: \&quot;button\&quot;, \&quot;sub_type\&quot;: \&quot;order_details\&quot;, \&quot;index\&quot;: 0, \&quot;parameters\&quot;: [{ \&quot;type\&quot;: \&quot;action\&quot;, \&quot;action\&quot;: { \&quot;order_details\&quot;: { \&quot;reference_id\&quot;: \&quot;...\&quot;, \&quot;currency\&quot;: \&quot;INR\&quot;, \&quot;order\&quot;: {} } } }] } &#x60;&#x60;&#x60; Convenience wrapper with structured fields: &#x60;POST /sendOrderDetails&#x60;.
235
+ # @param token [String] JWT token or API key for authorization
236
+ # @param [Hash] opts the optional parameters
237
+ # @option opts [SendTemplateRequest] :send_template_request
238
+ # @return [Array<(Hash<String, Object>, Integer, Hash)>] Hash<String, Object> data, response status code and response headers
239
+ def send_template_with_http_info(token, opts = {})
240
+ if @api_client.config.debugging
241
+ @api_client.config.logger.debug 'Calling API: TemplatesApi.send_template ...'
242
+ end
243
+ # verify the required parameter 'token' is set
244
+ if @api_client.config.client_side_validation && token.nil?
245
+ fail ArgumentError, "Missing the required parameter 'token' when calling TemplatesApi.send_template"
246
+ end
247
+ # resource path
248
+ local_var_path = '/sendTemplate'
249
+
250
+ # query parameters
251
+ query_params = opts[:query_params] || {}
252
+ query_params[:'token'] = token
253
+
254
+ # header parameters
255
+ header_params = opts[:header_params] || {}
256
+ # HTTP header 'Accept' (if needed)
257
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
258
+ # HTTP header 'Content-Type'
259
+ content_type = @api_client.select_header_content_type(['application/json'])
260
+ if !content_type.nil?
261
+ header_params['Content-Type'] = content_type
262
+ end
263
+
264
+ # form parameters
265
+ form_params = opts[:form_params] || {}
266
+
267
+ # http body (model)
268
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'send_template_request'])
269
+
270
+ # return_type
271
+ return_type = opts[:debug_return_type] || 'Hash<String, Object>'
272
+
273
+ # auth_names
274
+ auth_names = opts[:debug_auth_names] || ['tokenAuth']
275
+
276
+ new_options = opts.merge(
277
+ :operation => :"TemplatesApi.send_template",
278
+ :header_params => header_params,
279
+ :query_params => query_params,
280
+ :form_params => form_params,
281
+ :body => post_body,
282
+ :auth_names => auth_names,
283
+ :return_type => return_type
284
+ )
285
+
286
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
287
+ if @api_client.config.debugging
288
+ @api_client.config.logger.debug "API called: TemplatesApi#send_template\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
289
+ end
290
+ return data, status_code, headers
291
+ end
292
+ end
293
+ end
@@ -0,0 +1,232 @@
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 'cgi'
14
+
15
+ module OneMsgChatApi
16
+ class UsersApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+ # Block WhatsApp user
23
+ # @param token [String] JWT token or API key for authorization
24
+ # @param block_user_request [BlockUserRequest]
25
+ # @param [Hash] opts the optional parameters
26
+ # @return [SuccessResponse]
27
+ def block_user(token, block_user_request, opts = {})
28
+ data, _status_code, _headers = block_user_with_http_info(token, block_user_request, opts)
29
+ data
30
+ end
31
+
32
+ # Block WhatsApp user
33
+ # @param token [String] JWT token or API key for authorization
34
+ # @param block_user_request [BlockUserRequest]
35
+ # @param [Hash] opts the optional parameters
36
+ # @return [Array<(SuccessResponse, Integer, Hash)>] SuccessResponse data, response status code and response headers
37
+ def block_user_with_http_info(token, block_user_request, opts = {})
38
+ if @api_client.config.debugging
39
+ @api_client.config.logger.debug 'Calling API: UsersApi.block_user ...'
40
+ end
41
+ # verify the required parameter 'token' is set
42
+ if @api_client.config.client_side_validation && token.nil?
43
+ fail ArgumentError, "Missing the required parameter 'token' when calling UsersApi.block_user"
44
+ end
45
+ # verify the required parameter 'block_user_request' is set
46
+ if @api_client.config.client_side_validation && block_user_request.nil?
47
+ fail ArgumentError, "Missing the required parameter 'block_user_request' when calling UsersApi.block_user"
48
+ end
49
+ # resource path
50
+ local_var_path = '/blockUser'
51
+
52
+ # query parameters
53
+ query_params = opts[:query_params] || {}
54
+ query_params[:'token'] = token
55
+
56
+ # header parameters
57
+ header_params = opts[:header_params] || {}
58
+ # HTTP header 'Accept' (if needed)
59
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
60
+ # HTTP header 'Content-Type'
61
+ content_type = @api_client.select_header_content_type(['application/json'])
62
+ if !content_type.nil?
63
+ header_params['Content-Type'] = content_type
64
+ end
65
+
66
+ # form parameters
67
+ form_params = opts[:form_params] || {}
68
+
69
+ # http body (model)
70
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(block_user_request)
71
+
72
+ # return_type
73
+ return_type = opts[:debug_return_type] || 'SuccessResponse'
74
+
75
+ # auth_names
76
+ auth_names = opts[:debug_auth_names] || ['tokenAuth']
77
+
78
+ new_options = opts.merge(
79
+ :operation => :"UsersApi.block_user",
80
+ :header_params => header_params,
81
+ :query_params => query_params,
82
+ :form_params => form_params,
83
+ :body => post_body,
84
+ :auth_names => auth_names,
85
+ :return_type => return_type
86
+ )
87
+
88
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
89
+ if @api_client.config.debugging
90
+ @api_client.config.logger.debug "API called: UsersApi#block_user\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
91
+ end
92
+ return data, status_code, headers
93
+ end
94
+
95
+ # List blocked WhatsApp users
96
+ # Returns users currently blocked on this WhatsApp channel (WABA `GET /block_users`). Same channel token auth as `blockUser` / `unblockUser`.
97
+ # @param token [String] JWT token or API key for authorization
98
+ # @param [Hash] opts the optional parameters
99
+ # @return [ListBlockedUsers200Response]
100
+ def list_blocked_users(token, opts = {})
101
+ data, _status_code, _headers = list_blocked_users_with_http_info(token, opts)
102
+ data
103
+ end
104
+
105
+ # List blocked WhatsApp users
106
+ # Returns users currently blocked on this WhatsApp channel (WABA &#x60;GET /block_users&#x60;). Same channel token auth as &#x60;blockUser&#x60; / &#x60;unblockUser&#x60;.
107
+ # @param token [String] JWT token or API key for authorization
108
+ # @param [Hash] opts the optional parameters
109
+ # @return [Array<(ListBlockedUsers200Response, Integer, Hash)>] ListBlockedUsers200Response data, response status code and response headers
110
+ def list_blocked_users_with_http_info(token, opts = {})
111
+ if @api_client.config.debugging
112
+ @api_client.config.logger.debug 'Calling API: UsersApi.list_blocked_users ...'
113
+ end
114
+ # verify the required parameter 'token' is set
115
+ if @api_client.config.client_side_validation && token.nil?
116
+ fail ArgumentError, "Missing the required parameter 'token' when calling UsersApi.list_blocked_users"
117
+ end
118
+ # resource path
119
+ local_var_path = '/blockedUsers'
120
+
121
+ # query parameters
122
+ query_params = opts[:query_params] || {}
123
+ query_params[:'token'] = token
124
+
125
+ # header parameters
126
+ header_params = opts[:header_params] || {}
127
+ # HTTP header 'Accept' (if needed)
128
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
129
+
130
+ # form parameters
131
+ form_params = opts[:form_params] || {}
132
+
133
+ # http body (model)
134
+ post_body = opts[:debug_body]
135
+
136
+ # return_type
137
+ return_type = opts[:debug_return_type] || 'ListBlockedUsers200Response'
138
+
139
+ # auth_names
140
+ auth_names = opts[:debug_auth_names] || ['tokenAuth']
141
+
142
+ new_options = opts.merge(
143
+ :operation => :"UsersApi.list_blocked_users",
144
+ :header_params => header_params,
145
+ :query_params => query_params,
146
+ :form_params => form_params,
147
+ :body => post_body,
148
+ :auth_names => auth_names,
149
+ :return_type => return_type
150
+ )
151
+
152
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
153
+ if @api_client.config.debugging
154
+ @api_client.config.logger.debug "API called: UsersApi#list_blocked_users\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
155
+ end
156
+ return data, status_code, headers
157
+ end
158
+
159
+ # Unblock WhatsApp user
160
+ # @param token [String] JWT token or API key for authorization
161
+ # @param block_user_request [BlockUserRequest]
162
+ # @param [Hash] opts the optional parameters
163
+ # @return [SuccessResponse]
164
+ def unblock_user(token, block_user_request, opts = {})
165
+ data, _status_code, _headers = unblock_user_with_http_info(token, block_user_request, opts)
166
+ data
167
+ end
168
+
169
+ # Unblock WhatsApp user
170
+ # @param token [String] JWT token or API key for authorization
171
+ # @param block_user_request [BlockUserRequest]
172
+ # @param [Hash] opts the optional parameters
173
+ # @return [Array<(SuccessResponse, Integer, Hash)>] SuccessResponse data, response status code and response headers
174
+ def unblock_user_with_http_info(token, block_user_request, opts = {})
175
+ if @api_client.config.debugging
176
+ @api_client.config.logger.debug 'Calling API: UsersApi.unblock_user ...'
177
+ end
178
+ # verify the required parameter 'token' is set
179
+ if @api_client.config.client_side_validation && token.nil?
180
+ fail ArgumentError, "Missing the required parameter 'token' when calling UsersApi.unblock_user"
181
+ end
182
+ # verify the required parameter 'block_user_request' is set
183
+ if @api_client.config.client_side_validation && block_user_request.nil?
184
+ fail ArgumentError, "Missing the required parameter 'block_user_request' when calling UsersApi.unblock_user"
185
+ end
186
+ # resource path
187
+ local_var_path = '/unblockUser'
188
+
189
+ # query parameters
190
+ query_params = opts[:query_params] || {}
191
+ query_params[:'token'] = token
192
+
193
+ # header parameters
194
+ header_params = opts[:header_params] || {}
195
+ # HTTP header 'Accept' (if needed)
196
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
197
+ # HTTP header 'Content-Type'
198
+ content_type = @api_client.select_header_content_type(['application/json'])
199
+ if !content_type.nil?
200
+ header_params['Content-Type'] = content_type
201
+ end
202
+
203
+ # form parameters
204
+ form_params = opts[:form_params] || {}
205
+
206
+ # http body (model)
207
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(block_user_request)
208
+
209
+ # return_type
210
+ return_type = opts[:debug_return_type] || 'SuccessResponse'
211
+
212
+ # auth_names
213
+ auth_names = opts[:debug_auth_names] || ['tokenAuth']
214
+
215
+ new_options = opts.merge(
216
+ :operation => :"UsersApi.unblock_user",
217
+ :header_params => header_params,
218
+ :query_params => query_params,
219
+ :form_params => form_params,
220
+ :body => post_body,
221
+ :auth_names => auth_names,
222
+ :return_type => return_type
223
+ )
224
+
225
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
226
+ if @api_client.config.debugging
227
+ @api_client.config.logger.debug "API called: UsersApi#unblock_user\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
228
+ end
229
+ return data, status_code, headers
230
+ end
231
+ end
232
+ end