messente_api 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +9 -0
- data/Gemfile.lock +79 -0
- data/README.md +118 -0
- data/Rakefile +10 -0
- data/docs/BlacklistApi.md +209 -0
- data/docs/Channel.md +16 -0
- data/docs/ContactEnvelope.md +17 -0
- data/docs/ContactFields.md +35 -0
- data/docs/ContactListEnvelope.md +17 -0
- data/docs/ContactUpdateFields.md +33 -0
- data/docs/ContactsApi.md +430 -0
- data/docs/DeliveryReportApi.md +60 -0
- data/docs/DeliveryReportResponse.md +21 -0
- data/docs/DeliveryResult.md +27 -0
- data/docs/ErrorCodeOmnichannel.md +16 -0
- data/docs/ErrorCodeOmnichannelMachine.md +16 -0
- data/docs/ErrorCodePhonebook.md +16 -0
- data/docs/ErrorItemOmnichannel.md +23 -0
- data/docs/ErrorItemPhonebook.md +21 -0
- data/docs/ErrorOmnichannel.md +17 -0
- data/docs/ErrorPhonebook.md +17 -0
- data/docs/ErrorTitleOmnichannel.md +16 -0
- data/docs/ErrorTitlePhonebook.md +16 -0
- data/docs/FetchBlacklistSuccess.md +17 -0
- data/docs/GroupEnvelope.md +17 -0
- data/docs/GroupListEnvelope.md +17 -0
- data/docs/GroupName.md +17 -0
- data/docs/GroupResponseFields.md +23 -0
- data/docs/GroupsApi.md +265 -0
- data/docs/MessageResult.md +21 -0
- data/docs/NumberToBlacklist.md +17 -0
- data/docs/OmniMessageCreateSuccessResponse.md +21 -0
- data/docs/Omnimessage.md +25 -0
- data/docs/OmnimessageApi.md +111 -0
- data/docs/SMS.md +27 -0
- data/docs/Status.md +16 -0
- data/docs/TextStore.md +16 -0
- data/docs/Viber.md +29 -0
- data/docs/WhatsApp.md +29 -0
- data/docs/WhatsAppAudio.md +17 -0
- data/docs/WhatsAppDocument.md +19 -0
- data/docs/WhatsAppImage.md +19 -0
- data/docs/WhatsAppText.md +19 -0
- data/git_push.sh +55 -0
- data/lib/messente_api.rb +78 -0
- data/lib/messente_api/api/blacklist_api.rb +258 -0
- data/lib/messente_api/api/contacts_api.rb +521 -0
- data/lib/messente_api/api/delivery_report_api.rb +82 -0
- data/lib/messente_api/api/groups_api.rb +326 -0
- data/lib/messente_api/api/omnimessage_api.rb +144 -0
- data/lib/messente_api/api_client.rb +387 -0
- data/lib/messente_api/api_error.rb +57 -0
- data/lib/messente_api/configuration.rb +251 -0
- data/lib/messente_api/models/channel.rb +37 -0
- data/lib/messente_api/models/contact_envelope.rb +196 -0
- data/lib/messente_api/models/contact_fields.rb +283 -0
- data/lib/messente_api/models/contact_list_envelope.rb +198 -0
- data/lib/messente_api/models/contact_update_fields.rb +268 -0
- data/lib/messente_api/models/delivery_report_response.rb +234 -0
- data/lib/messente_api/models/delivery_result.rb +244 -0
- data/lib/messente_api/models/error_code_omnichannel.rb +41 -0
- data/lib/messente_api/models/error_code_omnichannel_machine.rb +46 -0
- data/lib/messente_api/models/error_code_phonebook.rb +40 -0
- data/lib/messente_api/models/error_item_omnichannel.rb +245 -0
- data/lib/messente_api/models/error_item_phonebook.rb +230 -0
- data/lib/messente_api/models/error_omnichannel.rb +203 -0
- data/lib/messente_api/models/error_phonebook.rb +203 -0
- data/lib/messente_api/models/error_title_omnichannel.rb +41 -0
- data/lib/messente_api/models/error_title_phonebook.rb +40 -0
- data/lib/messente_api/models/fetch_blacklist_success.rb +198 -0
- data/lib/messente_api/models/group_envelope.rb +196 -0
- data/lib/messente_api/models/group_list_envelope.rb +198 -0
- data/lib/messente_api/models/group_name.rb +220 -0
- data/lib/messente_api/models/group_response_fields.rb +240 -0
- data/lib/messente_api/models/message_result.rb +231 -0
- data/lib/messente_api/models/number_to_blacklist.rb +202 -0
- data/lib/messente_api/models/omni_message_create_success_response.rb +234 -0
- data/lib/messente_api/models/omnimessage.rb +247 -0
- data/lib/messente_api/models/sms.rb +300 -0
- data/lib/messente_api/models/status.rb +45 -0
- data/lib/messente_api/models/text_store.rb +37 -0
- data/lib/messente_api/models/viber.rb +293 -0
- data/lib/messente_api/models/whats_app.rb +289 -0
- data/lib/messente_api/models/whats_app_audio.rb +202 -0
- data/lib/messente_api/models/whats_app_document.rb +212 -0
- data/lib/messente_api/models/whats_app_image.rb +212 -0
- data/lib/messente_api/models/whats_app_text.rb +214 -0
- data/lib/messente_api/version.rb +15 -0
- data/messente_api.gemspec +45 -0
- data/spec/api/blacklist_api_spec.rb +78 -0
- data/spec/api/contacts_api_spec.rb +126 -0
- data/spec/api/delivery_report_api_spec.rb +46 -0
- data/spec/api/groups_api_spec.rb +90 -0
- data/spec/api/omnimessage_api_spec.rb +57 -0
- data/spec/api_client_spec.rb +226 -0
- data/spec/configuration_spec.rb +42 -0
- data/spec/models/channel_spec.rb +35 -0
- data/spec/models/contact_envelope_spec.rb +41 -0
- data/spec/models/contact_fields_spec.rb +95 -0
- data/spec/models/contact_list_envelope_spec.rb +41 -0
- data/spec/models/contact_update_fields_spec.rb +89 -0
- data/spec/models/delivery_report_response_spec.rb +53 -0
- data/spec/models/delivery_result_spec.rb +71 -0
- data/spec/models/error_code_omnichannel_machine_spec.rb +35 -0
- data/spec/models/error_code_omnichannel_spec.rb +35 -0
- data/spec/models/error_code_phonebook_spec.rb +35 -0
- data/spec/models/error_item_omnichannel_spec.rb +59 -0
- data/spec/models/error_item_phonebook_spec.rb +53 -0
- data/spec/models/error_omnichannel_spec.rb +41 -0
- data/spec/models/error_phonebook_spec.rb +41 -0
- data/spec/models/error_title_omnichannel_spec.rb +35 -0
- data/spec/models/error_title_phonebook_spec.rb +35 -0
- data/spec/models/fetch_blacklist_success_spec.rb +41 -0
- data/spec/models/group_envelope_spec.rb +41 -0
- data/spec/models/group_list_envelope_spec.rb +41 -0
- data/spec/models/group_name_spec.rb +41 -0
- data/spec/models/group_response_fields_spec.rb +59 -0
- data/spec/models/message_result_spec.rb +53 -0
- data/spec/models/number_to_blacklist_spec.rb +41 -0
- data/spec/models/omni_message_create_success_response_spec.rb +53 -0
- data/spec/models/omnimessage_spec.rb +65 -0
- data/spec/models/sms_spec.rb +79 -0
- data/spec/models/status_spec.rb +35 -0
- data/spec/models/text_store_spec.rb +35 -0
- data/spec/models/viber_spec.rb +81 -0
- data/spec/models/whats_app_audio_spec.rb +41 -0
- data/spec/models/whats_app_document_spec.rb +47 -0
- data/spec/models/whats_app_image_spec.rb +47 -0
- data/spec/models/whats_app_spec.rb +81 -0
- data/spec/models/whats_app_text_spec.rb +47 -0
- data/spec/spec_helper.rb +111 -0
- metadata +401 -0
data/lib/messente_api.rb
ADDED
@@ -0,0 +1,78 @@
|
|
1
|
+
=begin
|
2
|
+
#Messente API
|
3
|
+
|
4
|
+
#[Messente](https://messente.com) is a global provider of messaging and user verification services. Use Messente API library to send and receive SMS, Viber and WhatsApp messages, blacklist phone numbers to make sure you're not sending any unwanted messages, manage contacts and groups. Messente builds [tools](https://messente.com/documentation) to help organizations connect their services to people anywhere in the world.
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 1.0.1
|
7
|
+
Contact: messente@messente.com
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 4.0.0
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
# Common files
|
14
|
+
require 'messente_api/api_client'
|
15
|
+
require 'messente_api/api_error'
|
16
|
+
require 'messente_api/version'
|
17
|
+
require 'messente_api/configuration'
|
18
|
+
|
19
|
+
# Models
|
20
|
+
require 'messente_api/models/channel'
|
21
|
+
require 'messente_api/models/contact_envelope'
|
22
|
+
require 'messente_api/models/contact_fields'
|
23
|
+
require 'messente_api/models/contact_list_envelope'
|
24
|
+
require 'messente_api/models/contact_update_fields'
|
25
|
+
require 'messente_api/models/delivery_report_response'
|
26
|
+
require 'messente_api/models/delivery_result'
|
27
|
+
require 'messente_api/models/error_code_omnichannel'
|
28
|
+
require 'messente_api/models/error_code_omnichannel_machine'
|
29
|
+
require 'messente_api/models/error_code_phonebook'
|
30
|
+
require 'messente_api/models/error_item_omnichannel'
|
31
|
+
require 'messente_api/models/error_item_phonebook'
|
32
|
+
require 'messente_api/models/error_omnichannel'
|
33
|
+
require 'messente_api/models/error_phonebook'
|
34
|
+
require 'messente_api/models/error_title_omnichannel'
|
35
|
+
require 'messente_api/models/error_title_phonebook'
|
36
|
+
require 'messente_api/models/fetch_blacklist_success'
|
37
|
+
require 'messente_api/models/group_envelope'
|
38
|
+
require 'messente_api/models/group_list_envelope'
|
39
|
+
require 'messente_api/models/group_name'
|
40
|
+
require 'messente_api/models/group_response_fields'
|
41
|
+
require 'messente_api/models/message_result'
|
42
|
+
require 'messente_api/models/number_to_blacklist'
|
43
|
+
require 'messente_api/models/omni_message_create_success_response'
|
44
|
+
require 'messente_api/models/omnimessage'
|
45
|
+
require 'messente_api/models/sms'
|
46
|
+
require 'messente_api/models/status'
|
47
|
+
require 'messente_api/models/text_store'
|
48
|
+
require 'messente_api/models/viber'
|
49
|
+
require 'messente_api/models/whats_app'
|
50
|
+
require 'messente_api/models/whats_app_audio'
|
51
|
+
require 'messente_api/models/whats_app_document'
|
52
|
+
require 'messente_api/models/whats_app_image'
|
53
|
+
require 'messente_api/models/whats_app_text'
|
54
|
+
|
55
|
+
# APIs
|
56
|
+
require 'messente_api/api/blacklist_api'
|
57
|
+
require 'messente_api/api/contacts_api'
|
58
|
+
require 'messente_api/api/delivery_report_api'
|
59
|
+
require 'messente_api/api/groups_api'
|
60
|
+
require 'messente_api/api/omnimessage_api'
|
61
|
+
|
62
|
+
module MessenteApi
|
63
|
+
class << self
|
64
|
+
# Customize default settings for the SDK using block.
|
65
|
+
# MessenteApi.configure do |config|
|
66
|
+
# config.username = "xxx"
|
67
|
+
# config.password = "xxx"
|
68
|
+
# end
|
69
|
+
# If no block given, return the default Configuration object.
|
70
|
+
def configure
|
71
|
+
if block_given?
|
72
|
+
yield(Configuration.default)
|
73
|
+
else
|
74
|
+
Configuration.default
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
@@ -0,0 +1,258 @@
|
|
1
|
+
=begin
|
2
|
+
#Messente API
|
3
|
+
|
4
|
+
#[Messente](https://messente.com) is a global provider of messaging and user verification services. Use Messente API library to send and receive SMS, Viber and WhatsApp messages, blacklist phone numbers to make sure you're not sending any unwanted messages, manage contacts and groups. Messente builds [tools](https://messente.com/documentation) to help organizations connect their services to people anywhere in the world.
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 1.0.1
|
7
|
+
Contact: messente@messente.com
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 4.0.0
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'uri'
|
14
|
+
|
15
|
+
module MessenteApi
|
16
|
+
class BlacklistApi
|
17
|
+
attr_accessor :api_client
|
18
|
+
|
19
|
+
def initialize(api_client = ApiClient.default)
|
20
|
+
@api_client = api_client
|
21
|
+
end
|
22
|
+
# Adds a phone number to the blacklist.
|
23
|
+
# @param number_to_blacklist [NumberToBlacklist] Phone number to be blacklisted
|
24
|
+
# @param [Hash] opts the optional parameters
|
25
|
+
# @return [nil]
|
26
|
+
def add_to_blacklist(number_to_blacklist, opts = {})
|
27
|
+
add_to_blacklist_with_http_info(number_to_blacklist, opts)
|
28
|
+
nil
|
29
|
+
end
|
30
|
+
|
31
|
+
# Adds a phone number to the blacklist.
|
32
|
+
# @param number_to_blacklist [NumberToBlacklist] Phone number to be blacklisted
|
33
|
+
# @param [Hash] opts the optional parameters
|
34
|
+
# @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
|
35
|
+
def add_to_blacklist_with_http_info(number_to_blacklist, opts = {})
|
36
|
+
if @api_client.config.debugging
|
37
|
+
@api_client.config.logger.debug 'Calling API: BlacklistApi.add_to_blacklist ...'
|
38
|
+
end
|
39
|
+
# verify the required parameter 'number_to_blacklist' is set
|
40
|
+
if @api_client.config.client_side_validation && number_to_blacklist.nil?
|
41
|
+
fail ArgumentError, "Missing the required parameter 'number_to_blacklist' when calling BlacklistApi.add_to_blacklist"
|
42
|
+
end
|
43
|
+
# resource path
|
44
|
+
local_var_path = '/phonebook/blacklist'
|
45
|
+
|
46
|
+
# query parameters
|
47
|
+
query_params = opts[:query_params] || {}
|
48
|
+
|
49
|
+
# header parameters
|
50
|
+
header_params = opts[:header_params] || {}
|
51
|
+
# HTTP header 'Accept' (if needed)
|
52
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
53
|
+
# HTTP header 'Content-Type'
|
54
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
|
55
|
+
|
56
|
+
# form parameters
|
57
|
+
form_params = opts[:form_params] || {}
|
58
|
+
|
59
|
+
# http body (model)
|
60
|
+
post_body = opts[:body] || @api_client.object_to_http_body(number_to_blacklist)
|
61
|
+
|
62
|
+
# return_type
|
63
|
+
return_type = opts[:return_type]
|
64
|
+
|
65
|
+
# auth_names
|
66
|
+
auth_names = opts[:auth_names] || ['basicAuth']
|
67
|
+
|
68
|
+
new_options = opts.merge(
|
69
|
+
:header_params => header_params,
|
70
|
+
:query_params => query_params,
|
71
|
+
:form_params => form_params,
|
72
|
+
:body => post_body,
|
73
|
+
:auth_names => auth_names,
|
74
|
+
:return_type => return_type
|
75
|
+
)
|
76
|
+
|
77
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
78
|
+
if @api_client.config.debugging
|
79
|
+
@api_client.config.logger.debug "API called: BlacklistApi#add_to_blacklist\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
80
|
+
end
|
81
|
+
return data, status_code, headers
|
82
|
+
end
|
83
|
+
|
84
|
+
# Deletes a phone number from the blacklist.
|
85
|
+
# @param phone [String] A phone number
|
86
|
+
# @param [Hash] opts the optional parameters
|
87
|
+
# @return [nil]
|
88
|
+
def delete_from_blacklist(phone, opts = {})
|
89
|
+
delete_from_blacklist_with_http_info(phone, opts)
|
90
|
+
nil
|
91
|
+
end
|
92
|
+
|
93
|
+
# Deletes a phone number from the blacklist.
|
94
|
+
# @param phone [String] A phone number
|
95
|
+
# @param [Hash] opts the optional parameters
|
96
|
+
# @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
|
97
|
+
def delete_from_blacklist_with_http_info(phone, opts = {})
|
98
|
+
if @api_client.config.debugging
|
99
|
+
@api_client.config.logger.debug 'Calling API: BlacklistApi.delete_from_blacklist ...'
|
100
|
+
end
|
101
|
+
# verify the required parameter 'phone' is set
|
102
|
+
if @api_client.config.client_side_validation && phone.nil?
|
103
|
+
fail ArgumentError, "Missing the required parameter 'phone' when calling BlacklistApi.delete_from_blacklist"
|
104
|
+
end
|
105
|
+
# resource path
|
106
|
+
local_var_path = '/blacklist/{phone}'.sub('{' + 'phone' + '}', phone.to_s)
|
107
|
+
|
108
|
+
# query parameters
|
109
|
+
query_params = opts[:query_params] || {}
|
110
|
+
|
111
|
+
# header parameters
|
112
|
+
header_params = opts[:header_params] || {}
|
113
|
+
# HTTP header 'Accept' (if needed)
|
114
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
115
|
+
|
116
|
+
# form parameters
|
117
|
+
form_params = opts[:form_params] || {}
|
118
|
+
|
119
|
+
# http body (model)
|
120
|
+
post_body = opts[:body]
|
121
|
+
|
122
|
+
# return_type
|
123
|
+
return_type = opts[:return_type]
|
124
|
+
|
125
|
+
# auth_names
|
126
|
+
auth_names = opts[:auth_names] || ['basicAuth']
|
127
|
+
|
128
|
+
new_options = opts.merge(
|
129
|
+
:header_params => header_params,
|
130
|
+
:query_params => query_params,
|
131
|
+
:form_params => form_params,
|
132
|
+
:body => post_body,
|
133
|
+
:auth_names => auth_names,
|
134
|
+
:return_type => return_type
|
135
|
+
)
|
136
|
+
|
137
|
+
data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
|
138
|
+
if @api_client.config.debugging
|
139
|
+
@api_client.config.logger.debug "API called: BlacklistApi#delete_from_blacklist\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
140
|
+
end
|
141
|
+
return data, status_code, headers
|
142
|
+
end
|
143
|
+
|
144
|
+
# Returns all blacklisted phone numbers.
|
145
|
+
# @param [Hash] opts the optional parameters
|
146
|
+
# @return [FetchBlacklistSuccess]
|
147
|
+
def fetch_blacklist(opts = {})
|
148
|
+
data, _status_code, _headers = fetch_blacklist_with_http_info(opts)
|
149
|
+
data
|
150
|
+
end
|
151
|
+
|
152
|
+
# Returns all blacklisted phone numbers.
|
153
|
+
# @param [Hash] opts the optional parameters
|
154
|
+
# @return [Array<(FetchBlacklistSuccess, Integer, Hash)>] FetchBlacklistSuccess data, response status code and response headers
|
155
|
+
def fetch_blacklist_with_http_info(opts = {})
|
156
|
+
if @api_client.config.debugging
|
157
|
+
@api_client.config.logger.debug 'Calling API: BlacklistApi.fetch_blacklist ...'
|
158
|
+
end
|
159
|
+
# resource path
|
160
|
+
local_var_path = '/phonebook/blacklist'
|
161
|
+
|
162
|
+
# query parameters
|
163
|
+
query_params = opts[:query_params] || {}
|
164
|
+
|
165
|
+
# header parameters
|
166
|
+
header_params = opts[:header_params] || {}
|
167
|
+
# HTTP header 'Accept' (if needed)
|
168
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
169
|
+
|
170
|
+
# form parameters
|
171
|
+
form_params = opts[:form_params] || {}
|
172
|
+
|
173
|
+
# http body (model)
|
174
|
+
post_body = opts[:body]
|
175
|
+
|
176
|
+
# return_type
|
177
|
+
return_type = opts[:return_type] || 'FetchBlacklistSuccess'
|
178
|
+
|
179
|
+
# auth_names
|
180
|
+
auth_names = opts[:auth_names] || ['basicAuth']
|
181
|
+
|
182
|
+
new_options = opts.merge(
|
183
|
+
:header_params => header_params,
|
184
|
+
:query_params => query_params,
|
185
|
+
:form_params => form_params,
|
186
|
+
:body => post_body,
|
187
|
+
:auth_names => auth_names,
|
188
|
+
:return_type => return_type
|
189
|
+
)
|
190
|
+
|
191
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
192
|
+
if @api_client.config.debugging
|
193
|
+
@api_client.config.logger.debug "API called: BlacklistApi#fetch_blacklist\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
194
|
+
end
|
195
|
+
return data, status_code, headers
|
196
|
+
end
|
197
|
+
|
198
|
+
# Checks if a phone number is blacklisted.
|
199
|
+
# @param phone [String] A phone number
|
200
|
+
# @param [Hash] opts the optional parameters
|
201
|
+
# @return [nil]
|
202
|
+
def is_blacklisted(phone, opts = {})
|
203
|
+
is_blacklisted_with_http_info(phone, opts)
|
204
|
+
nil
|
205
|
+
end
|
206
|
+
|
207
|
+
# Checks if a phone number is blacklisted.
|
208
|
+
# @param phone [String] A phone number
|
209
|
+
# @param [Hash] opts the optional parameters
|
210
|
+
# @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
|
211
|
+
def is_blacklisted_with_http_info(phone, opts = {})
|
212
|
+
if @api_client.config.debugging
|
213
|
+
@api_client.config.logger.debug 'Calling API: BlacklistApi.is_blacklisted ...'
|
214
|
+
end
|
215
|
+
# verify the required parameter 'phone' is set
|
216
|
+
if @api_client.config.client_side_validation && phone.nil?
|
217
|
+
fail ArgumentError, "Missing the required parameter 'phone' when calling BlacklistApi.is_blacklisted"
|
218
|
+
end
|
219
|
+
# resource path
|
220
|
+
local_var_path = '/blacklist/{phone}'.sub('{' + 'phone' + '}', phone.to_s)
|
221
|
+
|
222
|
+
# query parameters
|
223
|
+
query_params = opts[:query_params] || {}
|
224
|
+
|
225
|
+
# header parameters
|
226
|
+
header_params = opts[:header_params] || {}
|
227
|
+
# HTTP header 'Accept' (if needed)
|
228
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
229
|
+
|
230
|
+
# form parameters
|
231
|
+
form_params = opts[:form_params] || {}
|
232
|
+
|
233
|
+
# http body (model)
|
234
|
+
post_body = opts[:body]
|
235
|
+
|
236
|
+
# return_type
|
237
|
+
return_type = opts[:return_type]
|
238
|
+
|
239
|
+
# auth_names
|
240
|
+
auth_names = opts[:auth_names] || ['basicAuth']
|
241
|
+
|
242
|
+
new_options = opts.merge(
|
243
|
+
:header_params => header_params,
|
244
|
+
:query_params => query_params,
|
245
|
+
:form_params => form_params,
|
246
|
+
:body => post_body,
|
247
|
+
:auth_names => auth_names,
|
248
|
+
:return_type => return_type
|
249
|
+
)
|
250
|
+
|
251
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
252
|
+
if @api_client.config.debugging
|
253
|
+
@api_client.config.logger.debug "API called: BlacklistApi#is_blacklisted\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
254
|
+
end
|
255
|
+
return data, status_code, headers
|
256
|
+
end
|
257
|
+
end
|
258
|
+
end
|
@@ -0,0 +1,521 @@
|
|
1
|
+
=begin
|
2
|
+
#Messente API
|
3
|
+
|
4
|
+
#[Messente](https://messente.com) is a global provider of messaging and user verification services. Use Messente API library to send and receive SMS, Viber and WhatsApp messages, blacklist phone numbers to make sure you're not sending any unwanted messages, manage contacts and groups. Messente builds [tools](https://messente.com/documentation) to help organizations connect their services to people anywhere in the world.
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 1.0.1
|
7
|
+
Contact: messente@messente.com
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 4.0.0
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'uri'
|
14
|
+
|
15
|
+
module MessenteApi
|
16
|
+
class ContactsApi
|
17
|
+
attr_accessor :api_client
|
18
|
+
|
19
|
+
def initialize(api_client = ApiClient.default)
|
20
|
+
@api_client = api_client
|
21
|
+
end
|
22
|
+
# Adds a contact to a group.
|
23
|
+
# @param group_id [String] String in uuid format.
|
24
|
+
# @param phone [String] A phone number
|
25
|
+
# @param [Hash] opts the optional parameters
|
26
|
+
# @return [Object]
|
27
|
+
def add_contact_to_group(group_id, phone, opts = {})
|
28
|
+
data, _status_code, _headers = add_contact_to_group_with_http_info(group_id, phone, opts)
|
29
|
+
data
|
30
|
+
end
|
31
|
+
|
32
|
+
# Adds a contact to a group.
|
33
|
+
# @param group_id [String] String in uuid format.
|
34
|
+
# @param phone [String] A phone number
|
35
|
+
# @param [Hash] opts the optional parameters
|
36
|
+
# @return [Array<(Object, Integer, Hash)>] Object data, response status code and response headers
|
37
|
+
def add_contact_to_group_with_http_info(group_id, phone, opts = {})
|
38
|
+
if @api_client.config.debugging
|
39
|
+
@api_client.config.logger.debug 'Calling API: ContactsApi.add_contact_to_group ...'
|
40
|
+
end
|
41
|
+
# verify the required parameter 'group_id' is set
|
42
|
+
if @api_client.config.client_side_validation && group_id.nil?
|
43
|
+
fail ArgumentError, "Missing the required parameter 'group_id' when calling ContactsApi.add_contact_to_group"
|
44
|
+
end
|
45
|
+
# verify the required parameter 'phone' is set
|
46
|
+
if @api_client.config.client_side_validation && phone.nil?
|
47
|
+
fail ArgumentError, "Missing the required parameter 'phone' when calling ContactsApi.add_contact_to_group"
|
48
|
+
end
|
49
|
+
# resource path
|
50
|
+
local_var_path = '/groups/{groupId}/contacts/{phone}'.sub('{' + 'groupId' + '}', group_id.to_s).sub('{' + 'phone' + '}', phone.to_s)
|
51
|
+
|
52
|
+
# query parameters
|
53
|
+
query_params = opts[:query_params] || {}
|
54
|
+
|
55
|
+
# header parameters
|
56
|
+
header_params = opts[:header_params] || {}
|
57
|
+
# HTTP header 'Accept' (if needed)
|
58
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
59
|
+
|
60
|
+
# form parameters
|
61
|
+
form_params = opts[:form_params] || {}
|
62
|
+
|
63
|
+
# http body (model)
|
64
|
+
post_body = opts[:body]
|
65
|
+
|
66
|
+
# return_type
|
67
|
+
return_type = opts[:return_type] || 'Object'
|
68
|
+
|
69
|
+
# auth_names
|
70
|
+
auth_names = opts[:auth_names] || ['basicAuth']
|
71
|
+
|
72
|
+
new_options = opts.merge(
|
73
|
+
:header_params => header_params,
|
74
|
+
:query_params => query_params,
|
75
|
+
:form_params => form_params,
|
76
|
+
:body => post_body,
|
77
|
+
:auth_names => auth_names,
|
78
|
+
:return_type => return_type
|
79
|
+
)
|
80
|
+
|
81
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
82
|
+
if @api_client.config.debugging
|
83
|
+
@api_client.config.logger.debug "API called: ContactsApi#add_contact_to_group\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
84
|
+
end
|
85
|
+
return data, status_code, headers
|
86
|
+
end
|
87
|
+
|
88
|
+
# Creates a new contact.
|
89
|
+
# @param contact_fields [ContactFields]
|
90
|
+
# @param [Hash] opts the optional parameters
|
91
|
+
# @return [ContactEnvelope]
|
92
|
+
def create_contact(contact_fields, opts = {})
|
93
|
+
data, _status_code, _headers = create_contact_with_http_info(contact_fields, opts)
|
94
|
+
data
|
95
|
+
end
|
96
|
+
|
97
|
+
# Creates a new contact.
|
98
|
+
# @param contact_fields [ContactFields]
|
99
|
+
# @param [Hash] opts the optional parameters
|
100
|
+
# @return [Array<(ContactEnvelope, Integer, Hash)>] ContactEnvelope data, response status code and response headers
|
101
|
+
def create_contact_with_http_info(contact_fields, opts = {})
|
102
|
+
if @api_client.config.debugging
|
103
|
+
@api_client.config.logger.debug 'Calling API: ContactsApi.create_contact ...'
|
104
|
+
end
|
105
|
+
# verify the required parameter 'contact_fields' is set
|
106
|
+
if @api_client.config.client_side_validation && contact_fields.nil?
|
107
|
+
fail ArgumentError, "Missing the required parameter 'contact_fields' when calling ContactsApi.create_contact"
|
108
|
+
end
|
109
|
+
# resource path
|
110
|
+
local_var_path = '/contacts'
|
111
|
+
|
112
|
+
# query parameters
|
113
|
+
query_params = opts[:query_params] || {}
|
114
|
+
|
115
|
+
# header parameters
|
116
|
+
header_params = opts[:header_params] || {}
|
117
|
+
# HTTP header 'Accept' (if needed)
|
118
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
119
|
+
# HTTP header 'Content-Type'
|
120
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
|
121
|
+
|
122
|
+
# form parameters
|
123
|
+
form_params = opts[:form_params] || {}
|
124
|
+
|
125
|
+
# http body (model)
|
126
|
+
post_body = opts[:body] || @api_client.object_to_http_body(contact_fields)
|
127
|
+
|
128
|
+
# return_type
|
129
|
+
return_type = opts[:return_type] || 'ContactEnvelope'
|
130
|
+
|
131
|
+
# auth_names
|
132
|
+
auth_names = opts[:auth_names] || ['basicAuth']
|
133
|
+
|
134
|
+
new_options = opts.merge(
|
135
|
+
:header_params => header_params,
|
136
|
+
:query_params => query_params,
|
137
|
+
:form_params => form_params,
|
138
|
+
:body => post_body,
|
139
|
+
:auth_names => auth_names,
|
140
|
+
:return_type => return_type
|
141
|
+
)
|
142
|
+
|
143
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
144
|
+
if @api_client.config.debugging
|
145
|
+
@api_client.config.logger.debug "API called: ContactsApi#create_contact\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
146
|
+
end
|
147
|
+
return data, status_code, headers
|
148
|
+
end
|
149
|
+
|
150
|
+
# Deletes a contact.
|
151
|
+
# @param phone [String] A phone number
|
152
|
+
# @param [Hash] opts the optional parameters
|
153
|
+
# @return [nil]
|
154
|
+
def delete_contact(phone, opts = {})
|
155
|
+
delete_contact_with_http_info(phone, opts)
|
156
|
+
nil
|
157
|
+
end
|
158
|
+
|
159
|
+
# Deletes a contact.
|
160
|
+
# @param phone [String] A phone number
|
161
|
+
# @param [Hash] opts the optional parameters
|
162
|
+
# @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
|
163
|
+
def delete_contact_with_http_info(phone, opts = {})
|
164
|
+
if @api_client.config.debugging
|
165
|
+
@api_client.config.logger.debug 'Calling API: ContactsApi.delete_contact ...'
|
166
|
+
end
|
167
|
+
# verify the required parameter 'phone' is set
|
168
|
+
if @api_client.config.client_side_validation && phone.nil?
|
169
|
+
fail ArgumentError, "Missing the required parameter 'phone' when calling ContactsApi.delete_contact"
|
170
|
+
end
|
171
|
+
# resource path
|
172
|
+
local_var_path = '/contacts/{phone}'.sub('{' + 'phone' + '}', phone.to_s)
|
173
|
+
|
174
|
+
# query parameters
|
175
|
+
query_params = opts[:query_params] || {}
|
176
|
+
|
177
|
+
# header parameters
|
178
|
+
header_params = opts[:header_params] || {}
|
179
|
+
# HTTP header 'Accept' (if needed)
|
180
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
181
|
+
|
182
|
+
# form parameters
|
183
|
+
form_params = opts[:form_params] || {}
|
184
|
+
|
185
|
+
# http body (model)
|
186
|
+
post_body = opts[:body]
|
187
|
+
|
188
|
+
# return_type
|
189
|
+
return_type = opts[:return_type]
|
190
|
+
|
191
|
+
# auth_names
|
192
|
+
auth_names = opts[:auth_names] || ['basicAuth']
|
193
|
+
|
194
|
+
new_options = opts.merge(
|
195
|
+
:header_params => header_params,
|
196
|
+
:query_params => query_params,
|
197
|
+
:form_params => form_params,
|
198
|
+
:body => post_body,
|
199
|
+
:auth_names => auth_names,
|
200
|
+
:return_type => return_type
|
201
|
+
)
|
202
|
+
|
203
|
+
data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
|
204
|
+
if @api_client.config.debugging
|
205
|
+
@api_client.config.logger.debug "API called: ContactsApi#delete_contact\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
206
|
+
end
|
207
|
+
return data, status_code, headers
|
208
|
+
end
|
209
|
+
|
210
|
+
# Lists a contact.
|
211
|
+
# @param phone [String] A phone number
|
212
|
+
# @param [Hash] opts the optional parameters
|
213
|
+
# @return [ContactEnvelope]
|
214
|
+
def fetch_contact(phone, opts = {})
|
215
|
+
data, _status_code, _headers = fetch_contact_with_http_info(phone, opts)
|
216
|
+
data
|
217
|
+
end
|
218
|
+
|
219
|
+
# Lists a contact.
|
220
|
+
# @param phone [String] A phone number
|
221
|
+
# @param [Hash] opts the optional parameters
|
222
|
+
# @return [Array<(ContactEnvelope, Integer, Hash)>] ContactEnvelope data, response status code and response headers
|
223
|
+
def fetch_contact_with_http_info(phone, opts = {})
|
224
|
+
if @api_client.config.debugging
|
225
|
+
@api_client.config.logger.debug 'Calling API: ContactsApi.fetch_contact ...'
|
226
|
+
end
|
227
|
+
# verify the required parameter 'phone' is set
|
228
|
+
if @api_client.config.client_side_validation && phone.nil?
|
229
|
+
fail ArgumentError, "Missing the required parameter 'phone' when calling ContactsApi.fetch_contact"
|
230
|
+
end
|
231
|
+
# resource path
|
232
|
+
local_var_path = '/contacts/{phone}'.sub('{' + 'phone' + '}', phone.to_s)
|
233
|
+
|
234
|
+
# query parameters
|
235
|
+
query_params = opts[:query_params] || {}
|
236
|
+
|
237
|
+
# header parameters
|
238
|
+
header_params = opts[:header_params] || {}
|
239
|
+
# HTTP header 'Accept' (if needed)
|
240
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
241
|
+
|
242
|
+
# form parameters
|
243
|
+
form_params = opts[:form_params] || {}
|
244
|
+
|
245
|
+
# http body (model)
|
246
|
+
post_body = opts[:body]
|
247
|
+
|
248
|
+
# return_type
|
249
|
+
return_type = opts[:return_type] || 'ContactEnvelope'
|
250
|
+
|
251
|
+
# auth_names
|
252
|
+
auth_names = opts[:auth_names] || ['basicAuth']
|
253
|
+
|
254
|
+
new_options = opts.merge(
|
255
|
+
:header_params => header_params,
|
256
|
+
:query_params => query_params,
|
257
|
+
:form_params => form_params,
|
258
|
+
:body => post_body,
|
259
|
+
:auth_names => auth_names,
|
260
|
+
:return_type => return_type
|
261
|
+
)
|
262
|
+
|
263
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
264
|
+
if @api_client.config.debugging
|
265
|
+
@api_client.config.logger.debug "API called: ContactsApi#fetch_contact\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
266
|
+
end
|
267
|
+
return data, status_code, headers
|
268
|
+
end
|
269
|
+
|
270
|
+
# Lists groups of a contact.
|
271
|
+
# @param phone [String] A phone number
|
272
|
+
# @param [Hash] opts the optional parameters
|
273
|
+
# @return [GroupListEnvelope]
|
274
|
+
def fetch_contact_groups(phone, opts = {})
|
275
|
+
data, _status_code, _headers = fetch_contact_groups_with_http_info(phone, opts)
|
276
|
+
data
|
277
|
+
end
|
278
|
+
|
279
|
+
# Lists groups of a contact.
|
280
|
+
# @param phone [String] A phone number
|
281
|
+
# @param [Hash] opts the optional parameters
|
282
|
+
# @return [Array<(GroupListEnvelope, Integer, Hash)>] GroupListEnvelope data, response status code and response headers
|
283
|
+
def fetch_contact_groups_with_http_info(phone, opts = {})
|
284
|
+
if @api_client.config.debugging
|
285
|
+
@api_client.config.logger.debug 'Calling API: ContactsApi.fetch_contact_groups ...'
|
286
|
+
end
|
287
|
+
# verify the required parameter 'phone' is set
|
288
|
+
if @api_client.config.client_side_validation && phone.nil?
|
289
|
+
fail ArgumentError, "Missing the required parameter 'phone' when calling ContactsApi.fetch_contact_groups"
|
290
|
+
end
|
291
|
+
# resource path
|
292
|
+
local_var_path = '/contacts/{phone}/groups'.sub('{' + 'phone' + '}', phone.to_s)
|
293
|
+
|
294
|
+
# query parameters
|
295
|
+
query_params = opts[:query_params] || {}
|
296
|
+
|
297
|
+
# header parameters
|
298
|
+
header_params = opts[:header_params] || {}
|
299
|
+
# HTTP header 'Accept' (if needed)
|
300
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
301
|
+
|
302
|
+
# form parameters
|
303
|
+
form_params = opts[:form_params] || {}
|
304
|
+
|
305
|
+
# http body (model)
|
306
|
+
post_body = opts[:body]
|
307
|
+
|
308
|
+
# return_type
|
309
|
+
return_type = opts[:return_type] || 'GroupListEnvelope'
|
310
|
+
|
311
|
+
# auth_names
|
312
|
+
auth_names = opts[:auth_names] || ['basicAuth']
|
313
|
+
|
314
|
+
new_options = opts.merge(
|
315
|
+
:header_params => header_params,
|
316
|
+
:query_params => query_params,
|
317
|
+
:form_params => form_params,
|
318
|
+
:body => post_body,
|
319
|
+
:auth_names => auth_names,
|
320
|
+
:return_type => return_type
|
321
|
+
)
|
322
|
+
|
323
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
324
|
+
if @api_client.config.debugging
|
325
|
+
@api_client.config.logger.debug "API called: ContactsApi#fetch_contact_groups\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
326
|
+
end
|
327
|
+
return data, status_code, headers
|
328
|
+
end
|
329
|
+
|
330
|
+
# Returns all contacts.
|
331
|
+
# @param [Hash] opts the optional parameters
|
332
|
+
# @option opts [Array<String>] :group_ids Optional one or many group id strings in uuid format. For example: \"/contacts?groupIds=group_id_one&groupIds=group_id_two\"
|
333
|
+
# @return [ContactListEnvelope]
|
334
|
+
def fetch_contacts(opts = {})
|
335
|
+
data, _status_code, _headers = fetch_contacts_with_http_info(opts)
|
336
|
+
data
|
337
|
+
end
|
338
|
+
|
339
|
+
# Returns all contacts.
|
340
|
+
# @param [Hash] opts the optional parameters
|
341
|
+
# @option opts [Array<String>] :group_ids Optional one or many group id strings in uuid format. For example: \"/contacts?groupIds=group_id_one&groupIds=group_id_two\"
|
342
|
+
# @return [Array<(ContactListEnvelope, Integer, Hash)>] ContactListEnvelope data, response status code and response headers
|
343
|
+
def fetch_contacts_with_http_info(opts = {})
|
344
|
+
if @api_client.config.debugging
|
345
|
+
@api_client.config.logger.debug 'Calling API: ContactsApi.fetch_contacts ...'
|
346
|
+
end
|
347
|
+
# resource path
|
348
|
+
local_var_path = '/contacts'
|
349
|
+
|
350
|
+
# query parameters
|
351
|
+
query_params = opts[:query_params] || {}
|
352
|
+
query_params[:'groupIds'] = @api_client.build_collection_param(opts[:'group_ids'], :multi) if !opts[:'group_ids'].nil?
|
353
|
+
|
354
|
+
# header parameters
|
355
|
+
header_params = opts[:header_params] || {}
|
356
|
+
# HTTP header 'Accept' (if needed)
|
357
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
358
|
+
|
359
|
+
# form parameters
|
360
|
+
form_params = opts[:form_params] || {}
|
361
|
+
|
362
|
+
# http body (model)
|
363
|
+
post_body = opts[:body]
|
364
|
+
|
365
|
+
# return_type
|
366
|
+
return_type = opts[:return_type] || 'ContactListEnvelope'
|
367
|
+
|
368
|
+
# auth_names
|
369
|
+
auth_names = opts[:auth_names] || ['basicAuth']
|
370
|
+
|
371
|
+
new_options = opts.merge(
|
372
|
+
:header_params => header_params,
|
373
|
+
:query_params => query_params,
|
374
|
+
:form_params => form_params,
|
375
|
+
:body => post_body,
|
376
|
+
:auth_names => auth_names,
|
377
|
+
:return_type => return_type
|
378
|
+
)
|
379
|
+
|
380
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
381
|
+
if @api_client.config.debugging
|
382
|
+
@api_client.config.logger.debug "API called: ContactsApi#fetch_contacts\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
383
|
+
end
|
384
|
+
return data, status_code, headers
|
385
|
+
end
|
386
|
+
|
387
|
+
# Removes a contact from a group.
|
388
|
+
# @param group_id [String] String in uuid format.
|
389
|
+
# @param phone [String] A phone number
|
390
|
+
# @param [Hash] opts the optional parameters
|
391
|
+
# @return [nil]
|
392
|
+
def remove_contact_from_group(group_id, phone, opts = {})
|
393
|
+
remove_contact_from_group_with_http_info(group_id, phone, opts)
|
394
|
+
nil
|
395
|
+
end
|
396
|
+
|
397
|
+
# Removes a contact from a group.
|
398
|
+
# @param group_id [String] String in uuid format.
|
399
|
+
# @param phone [String] A phone number
|
400
|
+
# @param [Hash] opts the optional parameters
|
401
|
+
# @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
|
402
|
+
def remove_contact_from_group_with_http_info(group_id, phone, opts = {})
|
403
|
+
if @api_client.config.debugging
|
404
|
+
@api_client.config.logger.debug 'Calling API: ContactsApi.remove_contact_from_group ...'
|
405
|
+
end
|
406
|
+
# verify the required parameter 'group_id' is set
|
407
|
+
if @api_client.config.client_side_validation && group_id.nil?
|
408
|
+
fail ArgumentError, "Missing the required parameter 'group_id' when calling ContactsApi.remove_contact_from_group"
|
409
|
+
end
|
410
|
+
# verify the required parameter 'phone' is set
|
411
|
+
if @api_client.config.client_side_validation && phone.nil?
|
412
|
+
fail ArgumentError, "Missing the required parameter 'phone' when calling ContactsApi.remove_contact_from_group"
|
413
|
+
end
|
414
|
+
# resource path
|
415
|
+
local_var_path = '/groups/{groupId}/contacts/{phone}'.sub('{' + 'groupId' + '}', group_id.to_s).sub('{' + 'phone' + '}', phone.to_s)
|
416
|
+
|
417
|
+
# query parameters
|
418
|
+
query_params = opts[:query_params] || {}
|
419
|
+
|
420
|
+
# header parameters
|
421
|
+
header_params = opts[:header_params] || {}
|
422
|
+
# HTTP header 'Accept' (if needed)
|
423
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
424
|
+
|
425
|
+
# form parameters
|
426
|
+
form_params = opts[:form_params] || {}
|
427
|
+
|
428
|
+
# http body (model)
|
429
|
+
post_body = opts[:body]
|
430
|
+
|
431
|
+
# return_type
|
432
|
+
return_type = opts[:return_type]
|
433
|
+
|
434
|
+
# auth_names
|
435
|
+
auth_names = opts[:auth_names] || ['basicAuth']
|
436
|
+
|
437
|
+
new_options = opts.merge(
|
438
|
+
:header_params => header_params,
|
439
|
+
:query_params => query_params,
|
440
|
+
:form_params => form_params,
|
441
|
+
:body => post_body,
|
442
|
+
:auth_names => auth_names,
|
443
|
+
:return_type => return_type
|
444
|
+
)
|
445
|
+
|
446
|
+
data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
|
447
|
+
if @api_client.config.debugging
|
448
|
+
@api_client.config.logger.debug "API called: ContactsApi#remove_contact_from_group\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
449
|
+
end
|
450
|
+
return data, status_code, headers
|
451
|
+
end
|
452
|
+
|
453
|
+
# Updates a contact.
|
454
|
+
# @param phone [String] A phone number
|
455
|
+
# @param contact_update_fields [ContactUpdateFields]
|
456
|
+
# @param [Hash] opts the optional parameters
|
457
|
+
# @return [ContactEnvelope]
|
458
|
+
def update_contact(phone, contact_update_fields, opts = {})
|
459
|
+
data, _status_code, _headers = update_contact_with_http_info(phone, contact_update_fields, opts)
|
460
|
+
data
|
461
|
+
end
|
462
|
+
|
463
|
+
# Updates a contact.
|
464
|
+
# @param phone [String] A phone number
|
465
|
+
# @param contact_update_fields [ContactUpdateFields]
|
466
|
+
# @param [Hash] opts the optional parameters
|
467
|
+
# @return [Array<(ContactEnvelope, Integer, Hash)>] ContactEnvelope data, response status code and response headers
|
468
|
+
def update_contact_with_http_info(phone, contact_update_fields, opts = {})
|
469
|
+
if @api_client.config.debugging
|
470
|
+
@api_client.config.logger.debug 'Calling API: ContactsApi.update_contact ...'
|
471
|
+
end
|
472
|
+
# verify the required parameter 'phone' is set
|
473
|
+
if @api_client.config.client_side_validation && phone.nil?
|
474
|
+
fail ArgumentError, "Missing the required parameter 'phone' when calling ContactsApi.update_contact"
|
475
|
+
end
|
476
|
+
# verify the required parameter 'contact_update_fields' is set
|
477
|
+
if @api_client.config.client_side_validation && contact_update_fields.nil?
|
478
|
+
fail ArgumentError, "Missing the required parameter 'contact_update_fields' when calling ContactsApi.update_contact"
|
479
|
+
end
|
480
|
+
# resource path
|
481
|
+
local_var_path = '/contacts/{phone}'.sub('{' + 'phone' + '}', phone.to_s)
|
482
|
+
|
483
|
+
# query parameters
|
484
|
+
query_params = opts[:query_params] || {}
|
485
|
+
|
486
|
+
# header parameters
|
487
|
+
header_params = opts[:header_params] || {}
|
488
|
+
# HTTP header 'Accept' (if needed)
|
489
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
490
|
+
# HTTP header 'Content-Type'
|
491
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
|
492
|
+
|
493
|
+
# form parameters
|
494
|
+
form_params = opts[:form_params] || {}
|
495
|
+
|
496
|
+
# http body (model)
|
497
|
+
post_body = opts[:body] || @api_client.object_to_http_body(contact_update_fields)
|
498
|
+
|
499
|
+
# return_type
|
500
|
+
return_type = opts[:return_type] || 'ContactEnvelope'
|
501
|
+
|
502
|
+
# auth_names
|
503
|
+
auth_names = opts[:auth_names] || ['basicAuth']
|
504
|
+
|
505
|
+
new_options = opts.merge(
|
506
|
+
:header_params => header_params,
|
507
|
+
:query_params => query_params,
|
508
|
+
:form_params => form_params,
|
509
|
+
:body => post_body,
|
510
|
+
:auth_names => auth_names,
|
511
|
+
:return_type => return_type
|
512
|
+
)
|
513
|
+
|
514
|
+
data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options)
|
515
|
+
if @api_client.config.debugging
|
516
|
+
@api_client.config.logger.debug "API called: ContactsApi#update_contact\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
517
|
+
end
|
518
|
+
return data, status_code, headers
|
519
|
+
end
|
520
|
+
end
|
521
|
+
end
|